Fix bug 66872

This commit is contained in:
Oleg Korshul
2024-04-25 12:08:44 +03:00
parent 73624f28ac
commit 66d8690dc3
3 changed files with 12 additions and 1 deletions

View File

@ -134,7 +134,11 @@ JSSmart<CJSValue> CTextMeasurerEmbed::FT_Get_Glyph_Render_Params(JSSmart<CJSValu
JSSmart<CJSValue> CTextMeasurerEmbed::FT_Get_Glyph_Render_Buffer(JSSmart<CJSValue> face, JSSmart<CJSValue> size)
{
void* Data = NSShaper::FT_Get_Glyph_Render_Buffer(RAW_POINTER(face));
return CJSContext::createUint8Array((unsigned char*)Data, size->toInt32(), true);
int nSize = size->toInt32();
int nSizeMax = NSShaper::FT_Get_Glyph_Render_BufferSize(RAW_POINTER(face));
if (nSize > nSizeMax)
nSize = nSizeMax;
return CJSContext::createUint8Array((unsigned char*)Data, nSize, true);
}
JSSmart<CJSValue> CTextMeasurerEmbed::FT_Set_Transform(JSSmart<CJSValue> face, JSSmart<CJSValue> xx, JSSmart<CJSValue> yx, JSSmart<CJSValue> xy, JSSmart<CJSValue> yy)

View File

@ -356,6 +356,12 @@ namespace NSShaper
return ((FT_Face)face)->glyph->bitmap.buffer;
}
int FT_Get_Glyph_Render_BufferSize(void* face)
{
FT_GlyphSlot slot = ((FT_Face)face)->glyph;
return slot->bitmap.pitch * slot->bitmap.rows;
}
bool FT_Get_Glyph_Render_Params(void* face, int render_mode, CExternalPointer* result)
{
FT_GlyphSlot slot = ((FT_Face)face)->glyph;

View File

@ -70,6 +70,7 @@ namespace NSShaper
GRAPHICS_DECL bool FT_Get_Glyph_Render_Params(void* face, int render_mode, CExternalPointer* result);
GRAPHICS_DECL unsigned char* FT_Get_Glyph_Render_Buffer(void* face);
GRAPHICS_DECL int FT_Get_Glyph_Render_BufferSize(void* face);
GRAPHICS_DECL void FT_Glyph_Get_CBox(void* glyph, unsigned int bbox_mode, CExternalPointer* result);