Merge branch 'master' into cff-subset
This commit is contained in:
commit
4d74020694
|
@ -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;
|
const hb_ft_font_t *ft_font = (const hb_ft_font_t *) font_data;
|
||||||
hb_lock_t lock (ft_font->lock);
|
hb_lock_t lock (ft_font->lock);
|
||||||
FT_Face ft_face = ft_font->ft_face;
|
FT_Face ft_face = ft_font->ft_face;
|
||||||
metrics->ascender = ft_face->size->metrics.ascender;
|
metrics->ascender = FT_MulFix(ft_face->ascender, ft_face->size->metrics.y_scale);
|
||||||
metrics->descender = ft_face->size->metrics.descender;
|
metrics->descender = FT_MulFix(ft_face->descender, ft_face->size->metrics.y_scale);
|
||||||
metrics->line_gap = ft_face->size->metrics.height - (ft_face->size->metrics.ascender - ft_face->size->metrics.descender);
|
metrics->line_gap = FT_MulFix( ft_face->height, ft_face->size->metrics.y_scale ) - (metrics->ascender - metrics->descender);
|
||||||
if (font->y_scale < 0)
|
if (font->y_scale < 0)
|
||||||
{
|
{
|
||||||
metrics->ascender = -metrics->ascender;
|
metrics->ascender = -metrics->ascender;
|
||||||
|
|
|
@ -49,12 +49,15 @@ namespace OT {
|
||||||
|
|
||||||
struct postV2Tail
|
struct postV2Tail
|
||||||
{
|
{
|
||||||
|
friend struct post;
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *c) const
|
inline bool sanitize (hb_sanitize_context_t *c) const
|
||||||
{
|
{
|
||||||
TRACE_SANITIZE (this);
|
TRACE_SANITIZE (this);
|
||||||
return_trace (glyphNameIndex.sanitize (c));
|
return_trace (glyphNameIndex.sanitize (c));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
ArrayOf<HBUINT16> glyphNameIndex; /* This is not an offset, but is the
|
ArrayOf<HBUINT16> glyphNameIndex; /* This is not an offset, but is the
|
||||||
* ordinal number of the glyph in 'post'
|
* ordinal number of the glyph in 'post'
|
||||||
* string tables. */
|
* string tables. */
|
||||||
|
@ -62,6 +65,7 @@ struct postV2Tail
|
||||||
namesX; /* Glyph names with length bytes [variable]
|
namesX; /* Glyph names with length bytes [variable]
|
||||||
* (a Pascal string). */
|
* (a Pascal string). */
|
||||||
|
|
||||||
|
public:
|
||||||
DEFINE_SIZE_ARRAY2 (2, glyphNameIndex, namesX);
|
DEFINE_SIZE_ARRAY2 (2, glyphNameIndex, namesX);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -124,7 +128,9 @@ struct post
|
||||||
pool = &StructAfter<uint8_t> (v2.glyphNameIndex);
|
pool = &StructAfter<uint8_t> (v2.glyphNameIndex);
|
||||||
|
|
||||||
const uint8_t *end = (uint8_t *) table + table_length;
|
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);
|
index_to_offset.push (data - pool);
|
||||||
}
|
}
|
||||||
inline void fini (void)
|
inline void fini (void)
|
||||||
|
@ -142,10 +148,9 @@ struct post
|
||||||
return false;
|
return false;
|
||||||
if (!buf_len)
|
if (!buf_len)
|
||||||
return true;
|
return true;
|
||||||
if (buf_len <= s.len) /* What to do with truncation? Returning false for now. */
|
unsigned int len = MIN (buf_len - 1, s.len);
|
||||||
return false;
|
strncpy (buf, s.arrayZ, len);
|
||||||
strncpy (buf, s.arrayZ, s.len);
|
buf[len] = '\0';
|
||||||
buf[s.len] = '\0';
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue