Commit 2aa19cc4 authored by Alexander.Trofimov's avatar Alexander.Trofimov Committed by Alexander.Trofimov

Добавил fontManager для измерения (он без хинтования) для ускорения.

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@57837 954022d7-b5bf-4e40-9824-e11837661b57
parent 118a8682
...@@ -809,7 +809,7 @@ ...@@ -809,7 +809,7 @@
* @return {FontMetrics} * @return {FontMetrics}
*/ */
DrawingContext.prototype.getFontMetrics = function (units) { DrawingContext.prototype.getFontMetrics = function (units) {
var fm = this.fmgrGraphics[0]; var fm = this.fmgrGraphics[3];
var d = Math.abs(fm.m_lDescender); var d = Math.abs(fm.m_lDescender);
var r = getCvtRatio(0/*px*/, units >= 0 && units <=3 ? units : this.units, this.ppiX); var r = getCvtRatio(0/*px*/, units >= 0 && units <=3 ? units : this.units, this.ppiX);
var factor = this.getFontSize() * r / fm.m_lUnits_Per_Em; var factor = this.getFontSize() * r / fm.m_lUnits_Per_Em;
...@@ -869,6 +869,8 @@ ...@@ -869,6 +869,8 @@
} else { } else {
r = window.g_font_infos[ font.FontFamily.Index ].LoadFont( r = window.g_font_infos[ font.FontFamily.Index ].LoadFont(
window.g_font_loader, this.fmgrGraphics[0], font.FontSize, fontStyle, this.ppiX, this.ppiY); window.g_font_loader, this.fmgrGraphics[0], font.FontSize, fontStyle, this.ppiX, this.ppiY);
window.g_font_infos[ font.FontFamily.Index ].LoadFont(
window.g_font_loader, this.fmgrGraphics[3], font.FontSize, fontStyle, this.ppiX, this.ppiY);
} }
if (r === false) { if (r === false) {
...@@ -895,7 +897,7 @@ ...@@ -895,7 +897,7 @@
* @return {TextMetrics} Returns the dimension of string {width: w, height: h} * @return {TextMetrics} Returns the dimension of string {width: w, height: h}
*/ */
DrawingContext.prototype.measureText = function (text, units) { DrawingContext.prototype.measureText = function (text, units) {
var fm = this.fmgrGraphics[0], var fm = this.fmgrGraphics[3],
r = getCvtRatio(0/*px*/, units >= 0 && units <=3 ? units : this.units, this.ppiX); r = getCvtRatio(0/*px*/, units >= 0 && units <=3 ? units : this.units, this.ppiX);
for (var tmp, w = 0, w2 = 0, i = 0; i < text.length; ++i) { for (var tmp, w = 0, w2 = 0, i = 0; i < text.length; ++i) {
tmp = fm.MeasureChar( text.charCodeAt(i) ); tmp = fm.MeasureChar( text.charCodeAt(i) );
......
...@@ -151,10 +151,12 @@ ...@@ -151,10 +151,12 @@
this.fmgrGraphics.push(new CFontManager()); // Для обычного this.fmgrGraphics.push(new CFontManager()); // Для обычного
this.fmgrGraphics.push(new CFontManager()); // Для поворотного this.fmgrGraphics.push(new CFontManager()); // Для поворотного
this.fmgrGraphics.push(new CFontManager()); // Для автофигур this.fmgrGraphics.push(new CFontManager()); // Для автофигур
this.fmgrGraphics.push(new CFontManager()); // Для измерений
this.fmgrGraphics[0].Initialize(true); // IE memory enable this.fmgrGraphics[0].Initialize(true); // IE memory enable
this.fmgrGraphics[1].Initialize(true); // IE memory enable this.fmgrGraphics[1].Initialize(true); // IE memory enable
this.fmgrGraphics[2].Initialize(true); // IE memory enable this.fmgrGraphics[2].Initialize(true); // IE memory enable
this.fmgrGraphics[3].Initialize(true); // IE memory enable
this.buffers = {}; this.buffers = {};
this.drawingCtx = undefined; this.drawingCtx = undefined;
...@@ -2044,6 +2046,11 @@ ...@@ -2044,6 +2046,11 @@
if (!hintProps) if (!hintProps)
continue; continue;
// Последний без хинтования (только для измерения)
if (i === length - 1) {
bIsHinting = bIsSubpixHinting = false;
}
if (bIsHinting && bIsSubpixHinting) { if (bIsHinting && bIsSubpixHinting) {
hintProps.TT_USE_BYTECODE_INTERPRETER = true; hintProps.TT_USE_BYTECODE_INTERPRETER = true;
hintProps.TT_CONFIG_OPTION_SUBPIXEL_HINTING = true; hintProps.TT_CONFIG_OPTION_SUBPIXEL_HINTING = true;
......
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