[dense] Implement FT_New_Face2 and fix glyph loading

* include/freetype/freetype.h: Add filed "size" to FT_Open_Args

* src/base/ftobjs.c: Use slot from face's glyph_array in FT_Load_Glyph
Implement FT_New_Face2
This commit is contained in:
Anurag Thakur 2023-10-10 02:12:54 +05:30
parent e7c4fb9d13
commit b2f570a2bb
2 changed files with 27 additions and 1 deletions

View File

@ -2534,6 +2534,10 @@ FT_BEGIN_HEADER
* params ::
* Extra parameters passed to the font driver when opening a new face.
*
* size ::
* Size at which the glyphs will be rendered. Use same value as
* @FT_Set_Pixel_Sizes
*
* @note:
* The stream type is determined by the contents of `flags`:
*
@ -2571,6 +2575,7 @@ FT_BEGIN_HEADER
FT_Module driver;
FT_Int num_params;
FT_Parameter* params;
FT_UInt size;
} FT_Open_Args;

View File

@ -922,7 +922,7 @@
/* The validity test for `glyph_index' is performed by the */
/* font drivers. */
slot = face->glyph;
slot = face->glyph_array[glyph_index];
ft_glyphslot_clear( slot );
driver = face->driver;
@ -1630,6 +1630,27 @@
return ft_open_face_internal( library, &args, face_index, aface, 1 );
}
FT_EXPORT_DEF( FT_Error )
FT_New_Face2( FT_Library library,
const char* pathname,
FT_Long face_index,
FT_Face *aface,
FT_UInt size)
{
FT_Open_Args args;
/* test for valid `library' and `aface' delayed to `FT_Open_Face' */
if ( !pathname )
return FT_THROW( Invalid_Argument );
args.flags = FT_OPEN_PATHNAME;
args.size = size;
args.pathname = (char*)pathname;
args.stream = NULL;
return ft_open_face_internal( library, &args, face_index, aface, 1 );
}
#endif