mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 03:45:46 +00:00
bug 874053 - ReadCMAP() must not leave the font entry's mCharacterMap pointer NULL, even if cmap table can't be read. r=roc
This commit is contained in:
parent
3979f5bbb7
commit
a9a5996e88
@ -410,6 +410,8 @@ gfxDWriteFontEntry::ReadCMAP()
|
||||
rv = gfxFontUtils::ReadCMAP(cmapData, cmapLen,
|
||||
*charmap, mUVSOffset,
|
||||
unicodeFont, symbolFont);
|
||||
} else {
|
||||
rv = NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
mHasCmapTable = NS_SUCCEEDED(rv);
|
||||
|
@ -310,6 +310,13 @@ public:
|
||||
virtual bool TestCharacterMap(uint32_t aCh);
|
||||
nsresult InitializeUVSMap();
|
||||
uint16_t GetUVSGlyph(uint32_t aCh, uint32_t aVS);
|
||||
|
||||
// All concrete gfxFontEntry subclasses (except gfxProxyFontEntry) need
|
||||
// to override this, otherwise the font will never be used as it will
|
||||
// be considered to support no characters.
|
||||
// ReadCMAP() must *always* set the mCharacterMap pointer to a valid
|
||||
// gfxCharacterMap, even if empty, as other code assumes this pointer
|
||||
// can be safely dereferenced.
|
||||
virtual nsresult ReadCMAP();
|
||||
|
||||
bool TryGetSVGData();
|
||||
|
@ -232,18 +232,20 @@ MacOSFontEntry::ReadCMAP()
|
||||
uint32_t kCMAP = TRUETYPE_TAG('c','m','a','p');
|
||||
|
||||
AutoTable cmapTable(this, kCMAP);
|
||||
if (!cmapTable) {
|
||||
return NS_OK; // leave it empty
|
||||
nsresult rv;
|
||||
|
||||
if (cmapTable) {
|
||||
bool unicodeFont = false, symbolFont = false; // currently ignored
|
||||
|
||||
uint32_t cmapLen;
|
||||
const char* cmapData = hb_blob_get_data(cmapTable, &cmapLen);
|
||||
rv = gfxFontUtils::ReadCMAP((const uint8_t*)cmapData, cmapLen,
|
||||
*charmap, mUVSOffset,
|
||||
unicodeFont, symbolFont);
|
||||
} else {
|
||||
rv = NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
bool unicodeFont = false, symbolFont = false; // currently ignored
|
||||
|
||||
uint32_t cmapLen;
|
||||
const char* cmapData = hb_blob_get_data(cmapTable, &cmapLen);
|
||||
nsresult rv = gfxFontUtils::ReadCMAP((const uint8_t*)cmapData, cmapLen,
|
||||
*charmap, mUVSOffset,
|
||||
unicodeFont, symbolFont);
|
||||
|
||||
if (NS_SUCCEEDED(rv) && !HasGraphiteTables()) {
|
||||
// We assume a Graphite font knows what it's doing,
|
||||
// and provides whatever shaping is needed for the
|
||||
|
@ -410,14 +410,14 @@ void
|
||||
gfxSystemFcFontEntry::ForgetHBFace()
|
||||
{
|
||||
gfxFontEntry::ForgetHBFace();
|
||||
MaybeReleaseFTFace();
|
||||
MaybeReleaseFTFace();
|
||||
}
|
||||
|
||||
void
|
||||
gfxSystemFcFontEntry::ReleaseGrFace(gr_face* aFace)
|
||||
{
|
||||
gfxFontEntry::ReleaseGrFace(aFace);
|
||||
MaybeReleaseFTFace();
|
||||
MaybeReleaseFTFace();
|
||||
}
|
||||
|
||||
// A namespace for @font-face family names in FcPatterns so that fontconfig
|
||||
|
Loading…
Reference in New Issue
Block a user