Commit 7eb4a0ee authored by Oleg Korshul's avatar Oleg Korshul Committed by Alexander.Trofimov

перегрузка функций TextMeasurer для презентаций

parent a2d81204
......@@ -23,6 +23,31 @@ var FOCUS_OBJECT_NOTES = 2;
var COMMENT_WIDTH = 18;
var COMMENT_HEIGHT = 16;
CTextMeasurer.prototype.GetAscender = function()
{
var UnitsPerEm = this.m_oManager.m_lUnits_Per_Em;
//var Ascender = this.m_oManager.m_lAscender;
var Ascender = ( 0 !== this.m_oManager.m_lLineHeight ) ? 1.2 * UnitsPerEm * this.m_oManager.m_lAscender / this.m_oManager.m_lLineHeight : this.m_oManager.m_lAscender;
return Ascender * this.m_oLastFont.SetUpSize / UnitsPerEm * g_dKoef_pt_to_mm;
};
CTextMeasurer.prototype.GetDescender = function()
{
var UnitsPerEm = this.m_oManager.m_lUnits_Per_Em;
//var Descender = this.m_oManager.m_lDescender;
var Descender = ( 0 !== this.m_oManager.m_lLineHeight ) ? 1.2 * UnitsPerEm * this.m_oManager.m_lDescender / this.m_oManager.m_lLineHeight : this.m_oManager.m_lDescender;
return Descender * this.m_oLastFont.SetUpSize / UnitsPerEm * g_dKoef_pt_to_mm;
};
CTextMeasurer.prototype.GetHeight = function()
{
var UnitsPerEm = this.m_oManager.m_lUnits_Per_Em;
//var Height = this.m_oManager.m_lLineHeight;
var Height = ( 0 !== this.m_oManager.m_lLineHeight ) ? 1.2 * UnitsPerEm : this.m_oManager.m_lLineHeight;
return Height * this.m_oLastFont.SetUpSize / UnitsPerEm * g_dKoef_pt_to_mm;
};
function CTableMarkup(Table)
{
this.Internal =
......
......@@ -187,6 +187,11 @@ asc_docs_api.prototype.asc_isOffline = function()
{
return true;
};
asc_docs_api.prototype.SetThemesPath = function(path)
{
this.ThemeLoader.ThemesUrl = path;
this.ThemeLoader.ThemesUrlAbs = path;
};
asc_docs_api.prototype["asc_addImage"] = asc_docs_api.prototype.asc_addImage;
asc_docs_api.prototype["AddImageUrl"] = asc_docs_api.prototype.AddImageUrl;
......@@ -195,6 +200,7 @@ asc_docs_api.prototype["asc_Save"] = asc_docs_api.prototype.asc_Save;
asc_docs_api.prototype["asc_DownloadAs"] = asc_docs_api.prototype.asc_DownloadAs;
asc_docs_api.prototype["asc_isOffline"] = asc_docs_api.prototype.asc_isOffline;
asc_docs_api.prototype["SetDocumentModified"] = asc_docs_api.prototype.SetDocumentModified;
asc_docs_api.prototype["SetThemesPath"] = asc_docs_api.prototype.SetThemesPath;
window["DesktopOfflineAppDocumentAddImageEnd"] = function(url)
{
......
......@@ -2408,28 +2408,31 @@ CMatrixL.prototype =
function CTextMeasurer()
{
this.m_oManager = new AscFonts.CFontManager();
this.m_oManager = new AscFonts.CFontManager();
this.m_oFont = null;
this.m_oFont = null;
// RFonts
this.m_oTextPr = null;
this.m_oGrFonts = new CGrRFonts();
this.m_oLastFont = new CFontSetup();
this.m_oTextPr = null;
this.m_oGrFonts = new CGrRFonts();
this.m_oLastFont = new CFontSetup();
this.LastFontOriginInfo = { Name : "", Replace : null };
this.LastFontOriginInfo = {Name : "", Replace : null};
}
this.Init = function()
CTextMeasurer.prototype =
{
Init : function()
{
this.m_oManager.Initialize();
};
},
this.SetStringGid = function(bGID)
SetStringGid : function(bGID)
{
this.m_oManager.SetStringGID(bGID);
};
},
this.SetFont = function(font)
SetFont : function(font)
{
if (!font)
return;
......@@ -2456,9 +2459,9 @@ function CTextMeasurer()
g_fontApplication.LoadFont(_lastSetUp.SetUpName, window.g_font_loader, this.m_oManager, _lastSetUp.SetUpSize, _lastSetUp.SetUpStyle, 72, 72, undefined, this.LastFontOriginInfo);
}
};
},
this.SetFontInternal = function(_name, _size, _style)
SetFontInternal : function(_name, _size, _style)
{
var _lastSetUp = this.m_oLastFont;
if (_lastSetUp.SetUpName != _name || _lastSetUp.SetUpSize != _size || _lastSetUp.SetUpStyle != _style)
......@@ -2469,18 +2472,18 @@ function CTextMeasurer()
g_fontApplication.LoadFont(_lastSetUp.SetUpName, window.g_font_loader, this.m_oManager, _lastSetUp.SetUpSize, _lastSetUp.SetUpStyle, 72, 72, undefined, this.LastFontOriginInfo);
}
};
},
this.SetTextPr = function(textPr, theme)
SetTextPr : function(textPr, theme)
{
this.m_oTextPr = textPr;
if (theme)
this.m_oGrFonts.checkFromTheme(theme.themeElements.fontScheme, this.m_oTextPr.RFonts);
else
this.m_oGrFonts = this.m_oTextPr.RFonts;
};
},
this.SetFontSlot = function(slot, fontSizeKoef)
SetFontSlot : function(slot, fontSizeKoef)
{
var _rfonts = this.m_oGrFonts;
var _lastFont = this.m_oLastFont;
......@@ -2551,19 +2554,19 @@ function CTextMeasurer()
g_fontApplication.LoadFont(_lastFont.SetUpName, window.g_font_loader, this.m_oManager, _lastFont.SetUpSize, _lastFont.SetUpStyle, 72, 72, undefined, this.LastFontOriginInfo);
}
};
},
this.GetTextPr = function()
GetTextPr : function()
{
return this.m_oTextPr;
};
},
this.GetFont = function()
GetFont : function()
{
return this.m_oFont;
};
},
this.Measure = function(text)
Measure : function(text)
{
var Width = 0;
var Height = 0;
......@@ -2578,8 +2581,8 @@ function CTextMeasurer()
Height = 0;//Temp.fHeight;
return { Width : Width, Height : Height };
};
this.Measure2 = function(text)
},
Measure2 : function(text)
{
var Width = 0;
......@@ -2611,9 +2614,9 @@ function CTextMeasurer()
rasterOffsetX: Temp.oBBox.rasterDistances.dist_l * 25.4 / 72,
rasterOffsetY: Temp.oBBox.rasterDistances.dist_t * 25.4 / 72
};
};
},
this.MeasureCode = function(lUnicode)
MeasureCode : function(lUnicode)
{
var Width = 0;
var Height = 0;
......@@ -2627,8 +2630,8 @@ function CTextMeasurer()
Height = ((Temp.oBBox.fMaxY - Temp.oBBox.fMinY) * 25.4 / 72);
return { Width : Width, Height : Height, Ascent : (Temp.oBBox.fMaxY * 25.4 / 72) };
};
this.Measure2Code = function(lUnicode)
},
Measure2Code : function(lUnicode)
{
var Width = 0;
......@@ -2659,30 +2662,30 @@ function CTextMeasurer()
rasterOffsetX: (Temp.oBBox.rasterDistances.dist_l + Temp.oBBox.fMinX) * 25.4 / 72,
rasterOffsetY: Temp.oBBox.rasterDistances.dist_t * 25.4 / 72
};
};
},
this.GetAscender = function()
GetAscender : function()
{
var UnitsPerEm = this.m_oManager.m_lUnits_Per_Em;
var Ascender = this.m_oManager.m_lAscender;
return Ascender * this.m_oLastFont.SetUpSize / UnitsPerEm * g_dKoef_pt_to_mm;
};
this.GetDescender = function()
},
GetDescender : function()
{
var UnitsPerEm = this.m_oManager.m_lUnits_Per_Em;
var Descender = this.m_oManager.m_lDescender;
return Descender * this.m_oLastFont.SetUpSize / UnitsPerEm * g_dKoef_pt_to_mm;
};
this.GetHeight = function()
},
GetHeight : function()
{
var UnitsPerEm = this.m_oManager.m_lUnits_Per_Em;
var Height = this.m_oManager.m_lLineHeight;
return Height * this.m_oLastFont.SetUpSize / UnitsPerEm * g_dKoef_pt_to_mm;
};
}
}
};
var g_oTextMeasurer = new CTextMeasurer();
g_oTextMeasurer.Init();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment