[CBDT] Minor
This commit is contained in:
parent
b7068af423
commit
e4bfccfb2a
|
@ -56,6 +56,15 @@ struct SmallGlyphMetrics
|
||||||
DEFINE_SIZE_STATIC(5);
|
DEFINE_SIZE_STATIC(5);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct BigGlyphMetrics : SmallGlyphMetrics
|
||||||
|
{
|
||||||
|
CHAR vertBearingX;
|
||||||
|
CHAR vertBearingY;
|
||||||
|
BYTE vertAdvance;
|
||||||
|
|
||||||
|
DEFINE_SIZE_STATIC(8);
|
||||||
|
};
|
||||||
|
|
||||||
struct SBitLineMetrics
|
struct SBitLineMetrics
|
||||||
{
|
{
|
||||||
inline bool sanitize (hb_sanitize_context_t *c) const
|
inline bool sanitize (hb_sanitize_context_t *c) const
|
||||||
|
@ -171,6 +180,7 @@ struct IndexSubtable
|
||||||
IndexSubtableHeader header;
|
IndexSubtableHeader header;
|
||||||
IndexSubtableFormat1 format1;
|
IndexSubtableFormat1 format1;
|
||||||
IndexSubtableFormat3 format3;
|
IndexSubtableFormat3 format3;
|
||||||
|
/* TODO: Format 2, 4, 5. */
|
||||||
} u;
|
} u;
|
||||||
public:
|
public:
|
||||||
DEFINE_SIZE_UNION (8, header);
|
DEFINE_SIZE_UNION (8, header);
|
||||||
|
@ -321,7 +331,6 @@ struct CBLC
|
||||||
{
|
{
|
||||||
/* TODO: Make it possible to select strike. */
|
/* TODO: Make it possible to select strike. */
|
||||||
|
|
||||||
const BitmapSizeTable *sizeTable = &Null(BitmapSizeTable);
|
|
||||||
unsigned int count = sizeTables.len;
|
unsigned int count = sizeTables.len;
|
||||||
for (uint32_t i = 0; i < count; ++i)
|
for (uint32_t i = 0; i < count; ++i)
|
||||||
{
|
{
|
||||||
|
@ -329,15 +338,13 @@ struct CBLC
|
||||||
unsigned int endGlyphIndex = sizeTables.array[i].endGlyphIndex;
|
unsigned int endGlyphIndex = sizeTables.array[i].endGlyphIndex;
|
||||||
if (startGlyphIndex <= glyph && glyph <= endGlyphIndex)
|
if (startGlyphIndex <= glyph && glyph <= endGlyphIndex)
|
||||||
{
|
{
|
||||||
sizeTable = &sizeTables[i];
|
*x_ppem = sizeTables[i].ppemX;
|
||||||
break;
|
*y_ppem = sizeTables[i].ppemY;
|
||||||
|
return sizeTables[i].find_table (glyph, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*x_ppem = sizeTable->ppemX;
|
return NULL;
|
||||||
*y_ppem = sizeTable->ppemY;
|
|
||||||
|
|
||||||
return sizeTable->find_table (glyph, this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -246,14 +246,12 @@ struct hb_ot_face_cbdt_accelerator_t
|
||||||
{
|
{
|
||||||
unsigned int x_ppem = upem, y_ppem = upem; /* TODO Use font ppem if available. */
|
unsigned int x_ppem = upem, y_ppem = upem; /* TODO Use font ppem if available. */
|
||||||
|
|
||||||
if (cblc == NULL) {
|
if (cblc == NULL)
|
||||||
return false; // Not a color bitmap font.
|
return false; // Not a color bitmap font.
|
||||||
}
|
|
||||||
|
|
||||||
const OT::IndexSubtableRecord *subtable_record = this->cblc->find_table(glyph, &x_ppem, &y_ppem);
|
const OT::IndexSubtableRecord *subtable_record = this->cblc->find_table(glyph, &x_ppem, &y_ppem);
|
||||||
if (subtable_record == NULL) {
|
if (subtable_record == NULL)
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
if (subtable_record->get_extents (extents))
|
if (subtable_record->get_extents (extents))
|
||||||
return true;
|
return true;
|
||||||
|
@ -262,23 +260,27 @@ struct hb_ot_face_cbdt_accelerator_t
|
||||||
if (!subtable_record->get_image_data (glyph, &image_offset, &image_length, &image_format))
|
if (!subtable_record->get_image_data (glyph, &image_offset, &image_length, &image_format))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (unlikely (image_offset > cbdt_len || cbdt_len - image_offset < image_length))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
switch (image_format)
|
|
||||||
{
|
{
|
||||||
case 17: {
|
/* TODO Move the following into CBDT struct when adding more formats. */
|
||||||
if (unlikely (image_length < OT::GlyphBitmapDataFormat17::min_size))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
const OT::GlyphBitmapDataFormat17& glyphFormat17 =
|
if (unlikely (image_offset > cbdt_len || cbdt_len - image_offset < image_length))
|
||||||
OT::StructAtOffset<OT::GlyphBitmapDataFormat17> (this->cbdt, image_offset);
|
|
||||||
glyphFormat17.glyphMetrics.get_extents (extents);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
// TODO: Support other image formats.
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
switch (image_format)
|
||||||
|
{
|
||||||
|
case 17: {
|
||||||
|
if (unlikely (image_length < OT::GlyphBitmapDataFormat17::min_size))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
const OT::GlyphBitmapDataFormat17& glyphFormat17 =
|
||||||
|
OT::StructAtOffset<OT::GlyphBitmapDataFormat17> (this->cbdt, image_offset);
|
||||||
|
glyphFormat17.glyphMetrics.get_extents (extents);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// TODO: Support other image formats.
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Convert to the font units. */
|
/* Convert to the font units. */
|
||||||
|
|
Loading…
Reference in New Issue