Bug 1243843 - Pull latest bugfixes from upstream graphite2 (now at e569e28d83491fedb31b9220493f3c07f6ec6d80). r=jdaggett

This commit is contained in:
Jonathan Kew 2016-02-01 20:26:09 +00:00
parent 34bd0d345b
commit 9ac399fd8f
4 changed files with 11 additions and 4 deletions

View File

@ -238,7 +238,7 @@ uint16 Face::getGlyphMetric(uint16 gid, uint8 metric) const
case kgmetAscent : return m_ascent;
case kgmetDescent : return m_descent;
default:
if (gid > glyphs().numGlyphs()) return 0;
if (gid >= glyphs().numGlyphs()) return 0;
return glyphs().glyph(gid)->getMetric(metric);
}
}

View File

@ -60,8 +60,12 @@ FileFace::FileFace(const char *filename)
if (!TtfUtil::GetTableDirInfo(_header_tbl, tbl_offset, tbl_len)) return;
_table_dir = (TtfUtil::Sfnt::OffsetSubTable::Entry*)gralloc<char>(tbl_len);
if (fseek(_file, tbl_offset, SEEK_SET)) return;
if (_table_dir)
if (fread(_table_dir, 1, tbl_len, _file) != tbl_len) return;
if (_table_dir && fread(_table_dir, 1, tbl_len, _file) != tbl_len)
{
free(_table_dir);
_table_dir = NULL;
}
return;
}
FileFace::~FileFace()

View File

@ -100,7 +100,9 @@ bool Pass::readPass(const byte * const pass_start, size_t pass_length, size_t su
if (e.test(pass_length < 40, E_BADPASSLENGTH)) return face.error(e);
// Read in basic values
const byte flags = be::read<byte>(p);
if (e.test((flags & 0x1f) && pt < PASS_TYPE_POSITIONING, E_BADCOLLISIONPASS))
if (e.test((flags & 0x1f) &&
(pt < PASS_TYPE_POSITIONING || !m_silf->aCollision() || !face.glyphs().hasBoxes()),
E_BADCOLLISIONPASS))
return face.error(e);
m_numCollRuns = flags & 0x7;
m_kernColls = (flags >> 3) & 0x3;

View File

@ -112,6 +112,7 @@ public:
const SlantBox & getSubBoundingSlantBox(unsigned short glyphid, uint8 subindex) const;
const BBox & getSubBoundingBBox(unsigned short glyphid, uint8 subindex) const;
bool check(unsigned short glyphid) const;
bool hasBoxes() const { return _boxes != 0; }
CLASS_NEW_DELETE;