[icu-le] Actually use the FontTableCache
This commit is contained in:
parent
7d242364ea
commit
e96bb36995
|
@ -112,7 +112,7 @@ PortableFontInstance::PortableFontInstance(const char *fileName, float pointSize
|
||||||
fDirExtra = numTables - fDirPower;
|
fDirExtra = numTables - fDirPower;
|
||||||
|
|
||||||
// read unitsPerEm from 'head' table
|
// read unitsPerEm from 'head' table
|
||||||
headTable = (const HEADTable *) readFontTable(headTag);
|
headTable = (const HEADTable *) getFontTable(headTag);
|
||||||
|
|
||||||
if (headTable == NULL) {
|
if (headTable == NULL) {
|
||||||
status = LE_MISSING_FONT_TABLE_ERROR;
|
status = LE_MISSING_FONT_TABLE_ERROR;
|
||||||
|
@ -121,9 +121,8 @@ PortableFontInstance::PortableFontInstance(const char *fileName, float pointSize
|
||||||
|
|
||||||
fUnitsPerEM = SWAPW(headTable->unitsPerEm);
|
fUnitsPerEM = SWAPW(headTable->unitsPerEm);
|
||||||
fFontChecksum = SWAPL(headTable->checksumAdjustment);
|
fFontChecksum = SWAPL(headTable->checksumAdjustment);
|
||||||
freeFontTable(headTable);
|
|
||||||
|
|
||||||
//nameTable = (NAMETable *) readFontTable(nameTag);
|
//nameTable = (NAMETable *) getFontTable(nameTag);
|
||||||
|
|
||||||
//if (nameTable == NULL) {
|
//if (nameTable == NULL) {
|
||||||
// status = LE_MISSING_FONT_TABLE_ERROR;
|
// status = LE_MISSING_FONT_TABLE_ERROR;
|
||||||
|
@ -137,9 +136,7 @@ PortableFontInstance::PortableFontInstance(const char *fileName, float pointSize
|
||||||
// goto error_exit;
|
// goto error_exit;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
//freeFontTable(nameTable);
|
hheaTable = (HHEATable *) getFontTable(hheaTag);
|
||||||
|
|
||||||
hheaTable = (HHEATable *) readFontTable(hheaTag);
|
|
||||||
|
|
||||||
if (hheaTable == NULL) {
|
if (hheaTable == NULL) {
|
||||||
status = LE_MISSING_FONT_TABLE_ERROR;
|
status = LE_MISSING_FONT_TABLE_ERROR;
|
||||||
|
@ -152,8 +149,6 @@ PortableFontInstance::PortableFontInstance(const char *fileName, float pointSize
|
||||||
|
|
||||||
fNumLongHorMetrics = SWAPW(hheaTable->numOfLongHorMetrics);
|
fNumLongHorMetrics = SWAPW(hheaTable->numOfLongHorMetrics);
|
||||||
|
|
||||||
freeFontTable((void *) hheaTable);
|
|
||||||
|
|
||||||
fCMAPMapper = findUnicodeMapper();
|
fCMAPMapper = findUnicodeMapper();
|
||||||
|
|
||||||
if (fCMAPMapper == NULL) {
|
if (fCMAPMapper == NULL) {
|
||||||
|
@ -174,9 +169,6 @@ PortableFontInstance::~PortableFontInstance()
|
||||||
if (fFile != NULL) {
|
if (fFile != NULL) {
|
||||||
fclose(fFile);
|
fclose(fFile);
|
||||||
|
|
||||||
freeFontTable(fHMTXTable);
|
|
||||||
freeFontTable(fNAMETable);
|
|
||||||
|
|
||||||
delete fCMAPMapper;
|
delete fCMAPMapper;
|
||||||
|
|
||||||
DELETE_ARRAY(fDirectory);
|
DELETE_ARRAY(fDirectory);
|
||||||
|
@ -245,7 +237,7 @@ const void *PortableFontInstance::readFontTable(LETag tableTag) const
|
||||||
CMAPMapper *PortableFontInstance::findUnicodeMapper()
|
CMAPMapper *PortableFontInstance::findUnicodeMapper()
|
||||||
{
|
{
|
||||||
LETag cmapTag = LE_CMAP_TABLE_TAG;
|
LETag cmapTag = LE_CMAP_TABLE_TAG;
|
||||||
const CMAPTable *cmap = (CMAPTable *) readFontTable(cmapTag);
|
const CMAPTable *cmap = (CMAPTable *) getFontTable(cmapTag);
|
||||||
|
|
||||||
if (cmap == NULL) {
|
if (cmap == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -260,7 +252,7 @@ const char *PortableFontInstance::getNameString(le_uint16 nameID, le_uint16 plat
|
||||||
LETag nameTag = LE_NAME_TABLE_TAG;
|
LETag nameTag = LE_NAME_TABLE_TAG;
|
||||||
PortableFontInstance *realThis = (PortableFontInstance *) this;
|
PortableFontInstance *realThis = (PortableFontInstance *) this;
|
||||||
|
|
||||||
realThis->fNAMETable = (const NAMETable *) readFontTable(nameTag);
|
realThis->fNAMETable = (const NAMETable *) getFontTable(nameTag);
|
||||||
|
|
||||||
if (realThis->fNAMETable != NULL) {
|
if (realThis->fNAMETable != NULL) {
|
||||||
realThis->fNameCount = SWAPW(realThis->fNAMETable->count);
|
realThis->fNameCount = SWAPW(realThis->fNAMETable->count);
|
||||||
|
@ -293,7 +285,7 @@ const LEUnicode16 *PortableFontInstance::getUnicodeNameString(le_uint16 nameID,
|
||||||
LETag nameTag = LE_NAME_TABLE_TAG;
|
LETag nameTag = LE_NAME_TABLE_TAG;
|
||||||
PortableFontInstance *realThis = (PortableFontInstance *) this;
|
PortableFontInstance *realThis = (PortableFontInstance *) this;
|
||||||
|
|
||||||
realThis->fNAMETable = (const NAMETable *) readFontTable(nameTag);
|
realThis->fNAMETable = (const NAMETable *) getFontTable(nameTag);
|
||||||
|
|
||||||
if (realThis->fNAMETable != NULL) {
|
if (realThis->fNAMETable != NULL) {
|
||||||
realThis->fNameCount = SWAPW(realThis->fNAMETable->count);
|
realThis->fNameCount = SWAPW(realThis->fNAMETable->count);
|
||||||
|
@ -340,15 +332,14 @@ void PortableFontInstance::getGlyphAdvance(LEGlyphID glyph, LEPoint &advance) co
|
||||||
if (fHMTXTable == NULL) {
|
if (fHMTXTable == NULL) {
|
||||||
LETag maxpTag = LE_MAXP_TABLE_TAG;
|
LETag maxpTag = LE_MAXP_TABLE_TAG;
|
||||||
LETag hmtxTag = LE_HMTX_TABLE_TAG;
|
LETag hmtxTag = LE_HMTX_TABLE_TAG;
|
||||||
const MAXPTable *maxpTable = (MAXPTable *) readFontTable(maxpTag);
|
const MAXPTable *maxpTable = (MAXPTable *) getFontTable(maxpTag);
|
||||||
PortableFontInstance *realThis = (PortableFontInstance *) this;
|
PortableFontInstance *realThis = (PortableFontInstance *) this;
|
||||||
|
|
||||||
if (maxpTable != NULL) {
|
if (maxpTable != NULL) {
|
||||||
realThis->fNumGlyphs = SWAPW(maxpTable->numGlyphs);
|
realThis->fNumGlyphs = SWAPW(maxpTable->numGlyphs);
|
||||||
freeFontTable(maxpTable);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
realThis->fHMTXTable = (const HMTXTable *) readFontTable(hmtxTag);
|
realThis->fHMTXTable = (const HMTXTable *) getFontTable(hmtxTag);
|
||||||
}
|
}
|
||||||
|
|
||||||
le_uint16 index = ttGlyph;
|
le_uint16 index = ttGlyph;
|
||||||
|
|
Loading…
Reference in New Issue