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

full support chenge char/gid mode

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@58611 954022d7-b5bf-4e40-9824-e11837661b57
parent 5cf63753
...@@ -49,6 +49,7 @@ function CFontFile(fileName, faceIndex) ...@@ -49,6 +49,7 @@ function CFontFile(fileName, faceIndex)
this.m_lUnits_Per_Em = 0; this.m_lUnits_Per_Em = 0;
this.m_arrCacheSizes = []; this.m_arrCacheSizes = [];
this.m_arrCacheSizesGid = [];
this.m_bUseDefaultFont = false; this.m_bUseDefaultFont = false;
this.m_pDefaultFont = null; this.m_pDefaultFont = null;
...@@ -309,21 +310,13 @@ function CFontFile(fileName, faceIndex) ...@@ -309,21 +310,13 @@ function CFontFile(fileName, faceIndex)
this.ClearCache = function() this.ClearCache = function()
{ {
if (this.m_oFontManager != null && this.m_oFontManager.RasterMemory != null) this.Destroy();
{ this.ClearCacheNoAttack();
var _arr = this.m_arrCacheSizes;
for (var i in _arr)
{
if (_arr[i].oBitmap != null)
_arr[i].oBitmap.Free();
}
}
this.m_arrCacheSizes = [];
} }
this.ClearCacheNoAttack = function() this.ClearCacheNoAttack = function()
{ {
this.m_arrCacheSizes = []; this.m_arrCacheSizes = [];
this.m_arrCacheSizesGid = [];
} }
this.Destroy = function() this.Destroy = function()
...@@ -336,6 +329,12 @@ function CFontFile(fileName, faceIndex) ...@@ -336,6 +329,12 @@ function CFontFile(fileName, faceIndex)
if (_arr[i].oBitmap != null) if (_arr[i].oBitmap != null)
_arr[i].oBitmap.Free(); _arr[i].oBitmap.Free();
} }
_arr = this.m_arrCacheSizesGid;
for (var i in _arr)
{
if (_arr[i].oBitmap != null)
_arr[i].oBitmap.Free();
}
} }
} }
...@@ -409,6 +408,8 @@ function CFontFile(fileName, faceIndex) ...@@ -409,6 +408,8 @@ function CFontFile(fileName, faceIndex)
this.UpdateMatrix1(); this.UpdateMatrix1();
} }
var _cache_array = (this.m_bStringGID === false) ? this.m_arrCacheSizes : this.m_arrCacheSizesGid;
for (var nIndex = 0; nIndex < pString.GetLength(); ++nIndex) for (var nIndex = 0; nIndex < pString.GetLength(); ++nIndex)
{ {
nCMapIndex.index = 0; nCMapIndex.index = 0;
...@@ -419,7 +420,7 @@ function CFontFile(fileName, faceIndex) ...@@ -419,7 +420,7 @@ function CFontFile(fileName, faceIndex)
var ushUnicode = pCurGlyph.lUnicode; var ushUnicode = pCurGlyph.lUnicode;
var unGID = 0; var unGID = 0;
var charSymbolObj = this.m_arrCacheSizes[ushUnicode]; var charSymbolObj = _cache_array[ushUnicode];
if (undefined == charSymbolObj) if (undefined == charSymbolObj)
{ {
var nCMapIndex = new CCMapIndex(); var nCMapIndex = new CCMapIndex();
...@@ -512,7 +513,7 @@ function CFontFile(fileName, faceIndex) ...@@ -512,7 +513,7 @@ function CFontFile(fileName, faceIndex)
oSizes.bBitmap = false; oSizes.bBitmap = false;
oSizes.oBitmap = null; oSizes.oBitmap = null;
this.m_arrCacheSizes[oSizes.ushUnicode] = oSizes; _cache_array[oSizes.ushUnicode] = oSizes;
} }
else else
{ {
...@@ -601,6 +602,8 @@ function CFontFile(fileName, faceIndex) ...@@ -601,6 +602,8 @@ function CFontFile(fileName, faceIndex)
var unPrevGID = 0; var unPrevGID = 0;
var fPenX = 0, fPenY = 0; var fPenX = 0, fPenY = 0;
var _cache_array = (this.m_bStringGID === false) ? this.m_arrCacheSizes : this.m_arrCacheSizesGid;
for (var nIndex = 0; nIndex < pString.GetLength(); ++nIndex) for (var nIndex = 0; nIndex < pString.GetLength(); ++nIndex)
{ {
// Сначала мы все рассчитываем исходя только из матрицы шрифта FontMatrix // Сначала мы все рассчитываем исходя только из матрицы шрифта FontMatrix
...@@ -618,7 +621,7 @@ function CFontFile(fileName, faceIndex) ...@@ -618,7 +621,7 @@ function CFontFile(fileName, faceIndex)
var ushUnicode = pCurGlyph.lUnicode; var ushUnicode = pCurGlyph.lUnicode;
var unGID = 0; var unGID = 0;
var charSymbolObj = this.m_arrCacheSizes[ushUnicode]; var charSymbolObj = _cache_array[ushUnicode];
if (undefined == charSymbolObj || null == charSymbolObj.oBitmap) if (undefined == charSymbolObj || null == charSymbolObj.oBitmap)
{ {
var nCMapIndex = new CCMapIndex(); var nCMapIndex = new CCMapIndex();
...@@ -781,7 +784,7 @@ function CFontFile(fileName, faceIndex) ...@@ -781,7 +784,7 @@ function CFontFile(fileName, faceIndex)
// ---------------------------------------- // ----------------------------------------
} }
this.m_arrCacheSizes[oSizes.ushUnicode] = oSizes; _cache_array[oSizes.ushUnicode] = oSizes;
charSymbolObj = oSizes; charSymbolObj = oSizes;
} }
if (null != charSymbolObj) if (null != charSymbolObj)
...@@ -882,8 +885,10 @@ function CFontFile(fileName, faceIndex) ...@@ -882,8 +885,10 @@ function CFontFile(fileName, faceIndex)
var pCurGlyph = pString.m_pGlyphsBuffer[0]; var pCurGlyph = pString.m_pGlyphsBuffer[0];
var ushUnicode = pCurGlyph.lUnicode; var ushUnicode = pCurGlyph.lUnicode;
var _cache_array = (this.m_bStringGID === false) ? this.m_arrCacheSizes : this.m_arrCacheSizesGid;
var unGID = 0; var unGID = 0;
var charSymbolObj = this.m_arrCacheSizes[ushUnicode]; var charSymbolObj = _cache_array[ushUnicode];
if (undefined == charSymbolObj || (null == charSymbolObj.oBitmap && charSymbolObj.bBitmap === false)) if (undefined == charSymbolObj || (null == charSymbolObj.oBitmap && charSymbolObj.bBitmap === false))
{ {
var nCMapIndex = new CCMapIndex(); var nCMapIndex = new CCMapIndex();
...@@ -1051,7 +1056,7 @@ function CFontFile(fileName, faceIndex) ...@@ -1051,7 +1056,7 @@ function CFontFile(fileName, faceIndex)
// ---------------------------------------- // ----------------------------------------
} }
this.m_arrCacheSizes[oSizes.ushUnicode] = oSizes; _cache_array[oSizes.ushUnicode] = oSizes;
charSymbolObj = oSizes; charSymbolObj = oSizes;
} }
else else
...@@ -1216,7 +1221,10 @@ function CFontFile(fileName, faceIndex) ...@@ -1216,7 +1221,10 @@ function CFontFile(fileName, faceIndex)
} }
var unGID = 0; var unGID = 0;
var charSymbolObj = this.m_arrCacheSizes[ushUnicode];
var _cache_array = (this.m_bStringGID === false) ? this.m_arrCacheSizes : this.m_arrCacheSizesGid;
var charSymbolObj = _cache_array[ushUnicode];
if (undefined == charSymbolObj) if (undefined == charSymbolObj)
{ {
var nCMapIndex = new CCMapIndex(); var nCMapIndex = new CCMapIndex();
...@@ -1317,7 +1325,7 @@ function CFontFile(fileName, faceIndex) ...@@ -1317,7 +1325,7 @@ function CFontFile(fileName, faceIndex)
} }
} }
this.m_arrCacheSizes[oSizes.ushUnicode] = oSizes; _cache_array[oSizes.ushUnicode] = oSizes;
Result = oSizes; Result = oSizes;
} }
else else
......
...@@ -153,6 +153,11 @@ function CTextMeasurer() ...@@ -153,6 +153,11 @@ function CTextMeasurer()
this.m_oManager.Initialize(); this.m_oManager.Initialize();
} }
this.SetStringGid = function(bGID)
{
this.m_oManager.SetStringGID(bGID);
}
this.SetFont = function(font) this.SetFont = function(font)
{ {
if (!font) if (!font)
......
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