Merge branch 'master' into cff-subset

This commit is contained in:
Michiharu Ariza 2018-11-07 15:09:30 -08:00
commit 4d74020694
2 changed files with 13 additions and 8 deletions

View File

@ -466,9 +466,9 @@ hb_ft_get_font_h_extents (hb_font_t *font HB_UNUSED,
const hb_ft_font_t *ft_font = (const hb_ft_font_t *) font_data;
hb_lock_t lock (ft_font->lock);
FT_Face ft_face = ft_font->ft_face;
metrics->ascender = ft_face->size->metrics.ascender;
metrics->descender = ft_face->size->metrics.descender;
metrics->line_gap = ft_face->size->metrics.height - (ft_face->size->metrics.ascender - ft_face->size->metrics.descender);
metrics->ascender = FT_MulFix(ft_face->ascender, ft_face->size->metrics.y_scale);
metrics->descender = FT_MulFix(ft_face->descender, ft_face->size->metrics.y_scale);
metrics->line_gap = FT_MulFix( ft_face->height, ft_face->size->metrics.y_scale ) - (metrics->ascender - metrics->descender);
if (font->y_scale < 0)
{
metrics->ascender = -metrics->ascender;

View File

@ -49,12 +49,15 @@ namespace OT {
struct postV2Tail
{
friend struct post;
inline bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (glyphNameIndex.sanitize (c));
}
protected:
ArrayOf<HBUINT16> glyphNameIndex; /* This is not an offset, but is the
* ordinal number of the glyph in 'post'
* string tables. */
@ -62,6 +65,7 @@ struct postV2Tail
namesX; /* Glyph names with length bytes [variable]
* (a Pascal string). */
public:
DEFINE_SIZE_ARRAY2 (2, glyphNameIndex, namesX);
};
@ -124,7 +128,9 @@ struct post
pool = &StructAfter<uint8_t> (v2.glyphNameIndex);
const uint8_t *end = (uint8_t *) table + table_length;
for (const uint8_t *data = pool; data < end && data + *data <= end; data += 1 + *data)
for (const uint8_t *data = pool;
index_to_offset.len < 65535 && data < end && data + *data < end;
data += 1 + *data)
index_to_offset.push (data - pool);
}
inline void fini (void)
@ -142,10 +148,9 @@ struct post
return false;
if (!buf_len)
return true;
if (buf_len <= s.len) /* What to do with truncation? Returning false for now. */
return false;
strncpy (buf, s.arrayZ, s.len);
buf[s.len] = '\0';
unsigned int len = MIN (buf_len - 1, s.len);
strncpy (buf, s.arrayZ, len);
buf[len] = '\0';
return true;
}