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

git-svn-id:...

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@49601 954022d7-b5bf-4e40-9824-e11837661b57
parent 964bec8d
var g_fontManager2 = null;
function CClipManager() function CClipManager()
{ {
this.clipRects = []; this.clipRects = [];
...@@ -498,6 +500,10 @@ function CGraphics() ...@@ -498,6 +500,10 @@ function CGraphics()
this.TextClipRect = null; this.TextClipRect = null;
this.IsClipContext = false; this.IsClipContext = false;
this.IsUseFonts2 = false;
this.m_oFontManager2 = null;
this.m_oLastFont2 = null;
} }
CGraphics.prototype = CGraphics.prototype =
...@@ -910,6 +916,7 @@ CGraphics.prototype = ...@@ -910,6 +916,7 @@ CGraphics.prototype =
h -= _off; h -= _off;
} }
if ((_sr-_sx) > 0 && (_sb-_sy) > 0 && w > 0 && h > 0)
this.m_oContext.drawImage(img,_sx,_sy,_sr-_sx,_sb-_sy,x,y,w,h); this.m_oContext.drawImage(img,_sx,_sy,_sr-_sx,_sb-_sy,x,y,w,h);
} }
else else
...@@ -996,6 +1003,7 @@ CGraphics.prototype = ...@@ -996,6 +1003,7 @@ CGraphics.prototype =
h -= _off; h -= _off;
} }
if ((_sr-_sx) > 0 && (_sb-_sy) > 0 && w > 0 && h > 0)
this.m_oContext.drawImage(img,_sx,_sy,_sr-_sx,_sb-_sy,x,y,w,h); this.m_oContext.drawImage(img,_sx,_sy,_sr-_sx,_sb-_sy,x,y,w,h);
} }
else else
...@@ -1077,7 +1085,8 @@ CGraphics.prototype = ...@@ -1077,7 +1085,8 @@ CGraphics.prototype =
}, },
font : function(font_id,font_size) font : function(font_id,font_size)
{ {
g_font_infos[g_map_font_index[font_id]].LoadFont(editor.FontLoader, this.m_oFontManager, font_size, 0, this.m_dDpiX, this.m_dDpiY, this.m_oTransform); g_font_infos[g_map_font_index[font_id]].LoadFont(editor.FontLoader, this.IsUseFonts2 ? this.m_oFontManager2 : this.m_oFontManager,
font_size, 0, this.m_dDpiX, this.m_dDpiY, this.m_oTransform);
}, },
SetFont : function(font) SetFont : function(font)
{ {
...@@ -1114,13 +1123,16 @@ CGraphics.prototype = ...@@ -1114,13 +1123,16 @@ CGraphics.prototype =
else if ( bItalic && bBold ) else if ( bItalic && bBold )
oFontStyle = FontStyle.FontStyleBoldItalic; oFontStyle = FontStyle.FontStyleBoldItalic;
this.m_oLastFont.SetUpIndex = font.FontFamily.Index; var _last_font = this.IsUseFonts2 ? this.m_oLastFont2 : this.m_oLastFont;
this.m_oLastFont.SetUpSize = font.FontSize; var _font_manager = this.IsUseFonts2 ? this.m_oFontManager2 : this.m_oFontManager;
this.m_oLastFont.SetUpStyle = oFontStyle;
g_font_infos[font.FontFamily.Index].LoadFont(g_font_loader, this.m_oFontManager, font.FontSize, oFontStyle, this.m_dDpiX, this.m_dDpiY, this.m_oTransform); _last_font.SetUpIndex = font.FontFamily.Index;
_last_font.SetUpSize = font.FontSize;
_last_font.SetUpStyle = oFontStyle;
var _mD = this.m_oLastFont.SetUpMatrix; g_font_infos[font.FontFamily.Index].LoadFont(g_font_loader, _font_manager, font.FontSize, oFontStyle, this.m_dDpiX, this.m_dDpiY, this.m_oTransform);
var _mD = _last_font.SetUpMatrix;
var _mS = this.m_oTransform; var _mS = this.m_oTransform;
_mD.sx = _mS.sx; _mD.sx = _mS.sx;
...@@ -1130,7 +1142,7 @@ CGraphics.prototype = ...@@ -1130,7 +1142,7 @@ CGraphics.prototype =
_mD.tx = _mS.tx; _mD.tx = _mS.tx;
_mD.ty = _mS.ty; _mD.ty = _mS.ty;
//this.m_oFontManager.SetTextMatrix(this.m_oTransform.sx,this.m_oTransform.shy,this.m_oTransform.shx, //_font_manager.SetTextMatrix(this.m_oTransform.sx,this.m_oTransform.shy,this.m_oTransform.shx,
// this.m_oTransform.sy,this.m_oTransform.tx,this.m_oTransform.ty); // this.m_oTransform.sy,this.m_oTransform.tx,this.m_oTransform.ty);
}, },
...@@ -1142,7 +1154,7 @@ CGraphics.prototype = ...@@ -1142,7 +1154,7 @@ CGraphics.prototype =
SetFontSlot : function(slot, fontSizeKoef) SetFontSlot : function(slot, fontSizeKoef)
{ {
var _rfonts = this.m_oTextPr.RFonts; var _rfonts = this.m_oTextPr.RFonts;
var _lastFont = this.m_oLastFont; var _lastFont = this.IsUseFonts2 ? this.m_oLastFont2 : this.m_oLastFont;
switch (slot) switch (slot)
{ {
...@@ -1222,17 +1234,19 @@ CGraphics.prototype = ...@@ -1222,17 +1234,19 @@ CGraphics.prototype =
if (_lastFont.Bold) if (_lastFont.Bold)
_style += 1; _style += 1;
var _font_manager = this.IsUseFonts2 ? this.m_oFontManager2 : this.m_oFontManager;
if (_lastFont.Index != _lastFont.SetUpIndex || _lastFont.Size != _lastFont.SetUpSize || _style != _lastFont.SetUpStyle) if (_lastFont.Index != _lastFont.SetUpIndex || _lastFont.Size != _lastFont.SetUpSize || _style != _lastFont.SetUpStyle)
{ {
_lastFont.SetUpIndex = _lastFont.Index; _lastFont.SetUpIndex = _lastFont.Index;
_lastFont.SetUpSize = _lastFont.Size; _lastFont.SetUpSize = _lastFont.Size;
_lastFont.SetUpStyle = _style; _lastFont.SetUpStyle = _style;
g_font_infos[_lastFont.SetUpIndex].LoadFont(g_font_loader, this.m_oFontManager, _lastFont.SetUpSize, _lastFont.SetUpStyle, this.m_dDpiX, this.m_dDpiY, this.m_oTransform); g_font_infos[_lastFont.SetUpIndex].LoadFont(g_font_loader, _font_manager, _lastFont.SetUpSize, _lastFont.SetUpStyle, this.m_dDpiX, this.m_dDpiY, this.m_oTransform);
} }
else else
{ {
var _mD = this.m_oLastFont.SetUpMatrix; var _mD = _lastFont.SetUpMatrix;
var _mS = this.m_oTransform; var _mS = this.m_oTransform;
if (_mD.sx != _mS.sx || _mD.sy != _mS.sy || _mD.shx != _mS.shx || _mD.shy != _mS.shy || _mD.tx != _mS.tx || _mD.ty != _mS.ty) if (_mD.sx != _mS.sx || _mD.sy != _mS.sy || _mD.shx != _mS.shx || _mD.shy != _mS.shy || _mD.tx != _mS.tx || _mD.ty != _mS.ty)
...@@ -1244,11 +1258,11 @@ CGraphics.prototype = ...@@ -1244,11 +1258,11 @@ CGraphics.prototype =
_mD.tx = _mS.tx; _mD.tx = _mS.tx;
_mD.ty = _mS.ty; _mD.ty = _mS.ty;
this.m_oFontManager.SetTextMatrix(_mD.sx,_mD.shy,_mD.shx,_mD.sy,_mD.tx,_mD.ty); _font_manager.SetTextMatrix(_mD.sx,_mD.shy,_mD.shx,_mD.sy,_mD.tx,_mD.ty);
} }
} }
//this.m_oFontManager.SetTextMatrix(this.m_oTransform.sx,this.m_oTransform.shy,this.m_oTransform.shx, //_font_manager.SetTextMatrix(this.m_oTransform.sx,this.m_oTransform.shy,this.m_oTransform.shx,
// this.m_oTransform.sy,this.m_oTransform.tx,this.m_oTransform.ty); // this.m_oTransform.sy,this.m_oTransform.tx,this.m_oTransform.ty);
}, },
...@@ -1266,9 +1280,11 @@ CGraphics.prototype = ...@@ -1266,9 +1280,11 @@ CGraphics.prototype =
var _x = this.m_oInvertFullTransform.TransformPointX(x,y); var _x = this.m_oInvertFullTransform.TransformPointX(x,y);
var _y = this.m_oInvertFullTransform.TransformPointY(x,y); var _y = this.m_oInvertFullTransform.TransformPointY(x,y);
var _font_manager = this.IsUseFonts2 ? this.m_oFontManager2 : this.m_oFontManager;
try try
{ {
this.m_oFontManager.LoadString2C(text,_x,_y); _font_manager.LoadString2C(text,_x,_y);
} }
catch(err) catch(err)
{ {
...@@ -1278,7 +1294,7 @@ CGraphics.prototype = ...@@ -1278,7 +1294,7 @@ CGraphics.prototype =
{ {
this.m_oContext.setTransform(1,0,0,1,0,0); this.m_oContext.setTransform(1,0,0,1,0,0);
} }
var pGlyph = this.m_oFontManager.m_oGlyphString.m_pGlyphsBuffer[0]; var pGlyph = _font_manager.m_oGlyphString.m_pGlyphsBuffer[0];
if (null == pGlyph) if (null == pGlyph)
return; return;
...@@ -1300,9 +1316,11 @@ CGraphics.prototype = ...@@ -1300,9 +1316,11 @@ CGraphics.prototype =
var _x = this.m_oInvertFullTransform.TransformPointX(x,y); var _x = this.m_oInvertFullTransform.TransformPointX(x,y);
var _y = this.m_oInvertFullTransform.TransformPointY(x,y); var _y = this.m_oInvertFullTransform.TransformPointY(x,y);
var _font_manager = this.IsUseFonts2 ? this.m_oFontManager2 : this.m_oFontManager;
try try
{ {
this.m_oFontManager.LoadString2(text,_x,_y); _font_manager.LoadString2(text,_x,_y);
} }
catch(err) catch(err)
{ {
...@@ -1311,7 +1329,7 @@ CGraphics.prototype = ...@@ -1311,7 +1329,7 @@ CGraphics.prototype =
this.m_oContext.setTransform(1,0,0,1,0,0); this.m_oContext.setTransform(1,0,0,1,0,0);
while (true) while (true)
{ {
var pGlyph = this.m_oFontManager.GetNextChar2(); var pGlyph = _font_manager.GetNextChar2();
if (null == pGlyph) if (null == pGlyph)
break; break;
...@@ -1335,16 +1353,18 @@ CGraphics.prototype = ...@@ -1335,16 +1353,18 @@ CGraphics.prototype =
var _x = this.m_oInvertFullTransform.TransformPointX(x,y); var _x = this.m_oInvertFullTransform.TransformPointX(x,y);
var _y = this.m_oInvertFullTransform.TransformPointY(x,y); var _y = this.m_oInvertFullTransform.TransformPointY(x,y);
var _font_manager = this.IsUseFonts2 ? this.m_oFontManager2 : this.m_oFontManager;
try try
{ {
this.m_oFontManager.LoadString2C(text,_x,_y); _font_manager.LoadString2C(text,_x,_y);
} }
catch(err) catch(err)
{ {
} }
this.m_oContext.setTransform(1,0,0,1,0,0); this.m_oContext.setTransform(1,0,0,1,0,0);
var pGlyph = this.m_oFontManager.m_oGlyphString.m_pGlyphsBuffer[0]; var pGlyph = _font_manager.m_oGlyphString.m_pGlyphsBuffer[0];
if (null == pGlyph) if (null == pGlyph)
return; return;
...@@ -1366,9 +1386,11 @@ CGraphics.prototype = ...@@ -1366,9 +1386,11 @@ CGraphics.prototype =
var _x = this.m_oInvertFullTransform.TransformPointX(x,y); var _x = this.m_oInvertFullTransform.TransformPointX(x,y);
var _y = this.m_oInvertFullTransform.TransformPointY(x,y); var _y = this.m_oInvertFullTransform.TransformPointY(x,y);
var _font_manager = this.IsUseFonts2 ? this.m_oFontManager2 : this.m_oFontManager;
try try
{ {
this.m_oFontManager.LoadString2(text,_x,_y); _font_manager.LoadString2(text,_x,_y);
} }
catch(err) catch(err)
{ {
...@@ -1377,7 +1399,7 @@ CGraphics.prototype = ...@@ -1377,7 +1399,7 @@ CGraphics.prototype =
this.m_oContext.setTransform(1,0,0,1,0,0); this.m_oContext.setTransform(1,0,0,1,0,0);
while (true) while (true)
{ {
var pGlyph = this.m_oFontManager.GetNextChar2(); var pGlyph = _font_manager.GetNextChar2();
if (null == pGlyph) if (null == pGlyph)
break; break;
...@@ -1402,9 +1424,11 @@ CGraphics.prototype = ...@@ -1402,9 +1424,11 @@ CGraphics.prototype =
var _x = this.m_oInvertFullTransform.TransformPointX(x,y); var _x = this.m_oInvertFullTransform.TransformPointX(x,y);
var _y = this.m_oInvertFullTransform.TransformPointY(x,y); var _y = this.m_oInvertFullTransform.TransformPointY(x,y);
var _font_manager = this.IsUseFonts2 ? this.m_oFontManager2 : this.m_oFontManager;
try try
{ {
this.m_oFontManager.LoadString4C(lUnicode,_x,_y); _font_manager.LoadString4C(lUnicode,_x,_y);
} }
catch(err) catch(err)
{ {
...@@ -1414,7 +1438,7 @@ CGraphics.prototype = ...@@ -1414,7 +1438,7 @@ CGraphics.prototype =
{ {
this.m_oContext.setTransform(1,0,0,1,0,0); this.m_oContext.setTransform(1,0,0,1,0,0);
} }
var pGlyph = this.m_oFontManager.m_oGlyphString.m_pGlyphsBuffer[0]; var pGlyph = _font_manager.m_oGlyphString.m_pGlyphsBuffer[0];
if (null == pGlyph) if (null == pGlyph)
return; return;
...@@ -1437,9 +1461,11 @@ CGraphics.prototype = ...@@ -1437,9 +1461,11 @@ CGraphics.prototype =
var _x = this.m_oInvertFullTransform.TransformPointX(x,y); var _x = this.m_oInvertFullTransform.TransformPointX(x,y);
var _y = this.m_oInvertFullTransform.TransformPointY(x,y); var _y = this.m_oInvertFullTransform.TransformPointY(x,y);
var _font_manager = this.IsUseFonts2 ? this.m_oFontManager2 : this.m_oFontManager;
try try
{ {
this.m_oFontManager.LoadString3C(text,_x,_y); _font_manager.LoadString3C(text,_x,_y);
} }
catch(err) catch(err)
{ {
...@@ -1449,7 +1475,7 @@ CGraphics.prototype = ...@@ -1449,7 +1475,7 @@ CGraphics.prototype =
{ {
this.m_oContext.setTransform(1,0,0,1,0,0); this.m_oContext.setTransform(1,0,0,1,0,0);
} }
var pGlyph = this.m_oFontManager.m_oGlyphString.m_pGlyphsBuffer[0]; var pGlyph = _font_manager.m_oGlyphString.m_pGlyphsBuffer[0];
if (null == pGlyph) if (null == pGlyph)
return; return;
...@@ -1483,8 +1509,10 @@ CGraphics.prototype = ...@@ -1483,8 +1509,10 @@ CGraphics.prototype =
if (0 == nW || 0 == nH) if (0 == nW || 0 == nH)
return; return;
var nX = (this.m_oFontManager.m_oGlyphString.m_fX + pGlyph.fX + pGlyph.oBitmap.nX) >> 0; var _font_manager = this.IsUseFonts2 ? this.m_oFontManager2 : this.m_oFontManager;
var nY = (this.m_oFontManager.m_oGlyphString.m_fY + pGlyph.fY - pGlyph.oBitmap.nY) >> 0;
var nX = (_font_manager.m_oGlyphString.m_fX + pGlyph.fX + pGlyph.oBitmap.nX) >> 0;
var nY = (_font_manager.m_oGlyphString.m_fY + pGlyph.fY - pGlyph.oBitmap.nY) >> 0;
pGlyph.oBitmap.oGlyphData.checkColor(this.m_oBrush.Color1.R,this.m_oBrush.Color1.G,this.m_oBrush.Color1.B,nW,nH); pGlyph.oBitmap.oGlyphData.checkColor(this.m_oBrush.Color1.R,this.m_oBrush.Color1.G,this.m_oBrush.Color1.B,nW,nH);
...@@ -1502,8 +1530,10 @@ CGraphics.prototype = ...@@ -1502,8 +1530,10 @@ CGraphics.prototype =
if (0 == nW || 0 == nH) if (0 == nW || 0 == nH)
return; return;
var nX = (this.m_oFontManager.m_oGlyphString.m_fX + pGlyph.fX + pGlyph.oBitmap.nX) >> 0; var _font_manager = this.IsUseFonts2 ? this.m_oFontManager2 : this.m_oFontManager;
var nY = (this.m_oFontManager.m_oGlyphString.m_fY + pGlyph.fY - pGlyph.oBitmap.nY) >> 0;
var nX = (_font_manager.m_oGlyphString.m_fX + pGlyph.fX + pGlyph.oBitmap.nX) >> 0;
var nY = (_font_manager.m_oGlyphString.m_fY + pGlyph.fY - pGlyph.oBitmap.nY) >> 0;
var d_koef = this.m_dDpiX / 25.4; var d_koef = this.m_dDpiX / 25.4;
...@@ -1527,8 +1557,10 @@ CGraphics.prototype = ...@@ -1527,8 +1557,10 @@ CGraphics.prototype =
if (0 == nW || 0 == nH) if (0 == nW || 0 == nH)
return; return;
var nX = parseInt(this.m_oFontManager.m_oGlyphString.m_fX + pGlyph.fX + pGlyph.oBitmap.nX); var _font_manager = this.IsUseFonts2 ? this.m_oFontManager2 : this.m_oFontManager;
var nY = parseInt(this.m_oFontManager.m_oGlyphString.m_fY + pGlyph.fY - pGlyph.oBitmap.nY);
var nX = (_font_manager.m_oGlyphString.m_fX + pGlyph.fX + pGlyph.oBitmap.nX) >> 0;
var nY = (_font_manager.m_oGlyphString.m_fY + pGlyph.fY - pGlyph.oBitmap.nY) >> 0;
var imageData = this.m_oContext.getImageData(nX,nY,nW,nH); var imageData = this.m_oContext.getImageData(nX,nY,nW,nH);
var pPixels = imageData.data; var pPixels = imageData.data;
...@@ -2614,5 +2646,29 @@ CGraphics.prototype = ...@@ -2614,5 +2646,29 @@ CGraphics.prototype =
{ {
this.SetIntegerGrid(false); this.SetIntegerGrid(false);
} }
},
CheckUseFonts2 : function(_transform)
{
if (!global_MatrixTransformer.IsIdentity2(_transform))
{
if (window.g_fontManager2 == null)
{
window.g_fontManager2 = new CFontManager();
window.g_fontManager2.Initialize(true);
}
this.m_oFontManager2 = window.g_fontManager2;
if (null == this.m_oLastFont2)
this.m_oLastFont2 = new CFontSetup();
this.IsUseFonts2 = true;
}
},
UncheckUseFonts2 : function()
{
this.IsUseFonts2 = false;
} }
}; };
...@@ -851,6 +851,9 @@ function CEditorPage(api) ...@@ -851,6 +851,9 @@ function CEditorPage(api)
// нужно проверить режим и сбросить кеш грамотно (ie version) // нужно проверить режим и сбросить кеш грамотно (ie version)
g_fontManager.ClearRasterMemory(); g_fontManager.ClearRasterMemory();
if (window.g_fontManager2 !== undefined && window.g_fontManager2 !== null)
window.g_fontManager2.ClearRasterMemory();
var oWordControl = oThis; var oWordControl = oThis;
oWordControl.m_bIsRePaintOnScroll = false; oWordControl.m_bIsRePaintOnScroll = false;
...@@ -3117,6 +3120,9 @@ function CEditorPage(api) ...@@ -3117,6 +3120,9 @@ function CEditorPage(api)
{ {
this.m_oDrawingDocument.ClearCachePages(); this.m_oDrawingDocument.ClearCachePages();
g_fontManager.ClearFontsRasterCache(); g_fontManager.ClearFontsRasterCache();
if (window.g_fontManager2 !== undefined && window.g_fontManager2 !== null)
window.g_fontManager2.ClearFontsRasterCache();
} }
return bFlag; return bFlag;
......
...@@ -1982,7 +1982,6 @@ WordShape.prototype = ...@@ -1982,7 +1982,6 @@ WordShape.prototype =
graphics.SetIntegerGrid(false); graphics.SetIntegerGrid(false);
graphics.transform3(this.transformText, true); graphics.transform3(this.transformText, true);
} }
else else
{ {
...@@ -1991,7 +1990,8 @@ WordShape.prototype = ...@@ -1991,7 +1990,8 @@ WordShape.prototype =
graphics.transform3(this.transformText, true); graphics.transform3(this.transformText, true);
graphics.AddClipRect(clip_rect.x, clip_rect.y, clip_rect.w, clip_rect.h); graphics.AddClipRect(clip_rect.x, clip_rect.y, clip_rect.w, clip_rect.h);
} }
/* if (_rect != null) /*
if (_rect != null)
{ {
graphics.SaveGrState(); graphics.SaveGrState();
// TODO: !!! // TODO: !!!
...@@ -1999,10 +1999,18 @@ WordShape.prototype = ...@@ -1999,10 +1999,18 @@ WordShape.prototype =
var l_ins = typeof body_pr.lIns === "number" ? body_pr.lIns : 2.54; var l_ins = typeof body_pr.lIns === "number" ? body_pr.lIns : 2.54;
var t_ins = typeof body_pr.tIns === "number" ? body_pr.tIns : 1.27; var t_ins = typeof body_pr.tIns === "number" ? body_pr.tIns : 1.27;
graphics.AddClipRect(-(l_ins), -(t_ins ), _rect.w, _rect.h ); graphics.AddClipRect(-(l_ins), -(t_ins ), _rect.w, _rect.h );
} */ }
*/
var result_page_index = typeof pageIndex === "number" ? pageIndex : this.pageIndex; var result_page_index = typeof pageIndex === "number" ? pageIndex : this.pageIndex;
if (graphics.CheckUseFonts2 !== undefined)
graphics.CheckUseFonts2(this.transformText);
this.textBoxContent.Draw(result_page_index, graphics); this.textBoxContent.Draw(result_page_index, graphics);
if (graphics.UncheckUseFonts2 !== undefined)
graphics.UncheckUseFonts2();
if(typeof pageIndex === "number") if(typeof pageIndex === "number")
{ {
this.textBoxContent.Set_StartPage(old_start_page); this.textBoxContent.Set_StartPage(old_start_page);
......
...@@ -2564,6 +2564,9 @@ asc_docs_api.prototype.SetFontRenderingMode = function(mode) ...@@ -2564,6 +2564,9 @@ asc_docs_api.prototype.SetFontRenderingMode = function(mode)
this.WordControl.m_oDrawingDocument.ClearCachePages(); this.WordControl.m_oDrawingDocument.ClearCachePages();
g_fontManager.ClearFontsRasterCache(); g_fontManager.ClearFontsRasterCache();
if (window.g_fontManager2 !== undefined && window.g_fontManager2 !== null)
window.g_fontManager2.ClearFontsRasterCache();
if (this.bInit_word_control) if (this.bInit_word_control)
this.WordControl.OnScroll(); this.WordControl.OnScroll();
} }
......
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