@@ -207,15 +207,13 @@ FT2Font::get_path(std::vector<double> &vertices, std::vector<unsigned char> &cod
207207}
208208
209209FT2Font::FT2Font (long hinting_factor_, std::vector<FT2Font *> &fallback_list,
210- FT2Font::WarnFunc warn, bool warn_if_used)
211- : ft_glyph_warn(warn), warn_if_used(warn_if_used), image({1 , 1 }), face(nullptr ),
210+ bool warn_if_used)
211+ : warn_if_used(warn_if_used), image({1 , 1 }), face(nullptr ), fallbacks(fallback_list ),
212212 hinting_factor(hinting_factor_),
213213 // set default kerning factor to 0, i.e., no kerning manipulation
214214 kerning_factor(0 )
215215{
216216 clear ();
217- // Set fallbacks
218- std::copy (fallback_list.begin (), fallback_list.end (), std::back_inserter (fallbacks));
219217}
220218
221219FT2Font::~FT2Font ()
@@ -544,21 +542,19 @@ FT_UInt FT2Font::get_char_index(FT_ULong charcode, bool fallback = false)
544542 return FT_Get_Char_Index (ft_object->get_face (), charcode);
545543}
546544
547- void FT2Font::get_width_height ( long *width , long *height )
545+ std::tuple< long , long > FT2Font::get_width_height ( )
548546{
549- *width = advance;
550- *height = bbox.yMax - bbox.yMin ;
547+ return {advance, bbox.yMax - bbox.yMin };
551548}
552549
553550long FT2Font::get_descent ()
554551{
555552 return -bbox.yMin ;
556553}
557554
558- void FT2Font::get_bitmap_offset ( long *x , long *y )
555+ std::tuple< long , long > FT2Font::get_bitmap_offset ( )
559556{
560- *x = bbox.xMin ;
561- *y = 0 ;
557+ return {bbox.xMin , 0 };
562558}
563559
564560void FT2Font::draw_glyphs_to_bitmap (bool antialiased)
@@ -607,8 +603,11 @@ void FT2Font::draw_glyph_to_bitmap(
607603 draw_bitmap (im, &bitmap->bitmap , x + bitmap->left , y);
608604}
609605
610- void FT2Font::get_glyph_name (unsigned int glyph_number, std::string &buffer )
606+ std::string FT2Font::get_glyph_name (unsigned int glyph_number)
611607{
608+ std::string buffer;
609+ buffer.resize (128 );
610+
612611 if (!FT_HAS_GLYPH_NAMES (face)) {
613612 /* Note that this generated name must match the name that
614613 is generated by ttconv in ttfont_CharStrings_getname. */
@@ -625,6 +624,8 @@ void FT2Font::get_glyph_name(unsigned int glyph_number, std::string &buffer)
625624 buffer.resize (len);
626625 }
627626 }
627+
628+ return buffer;
628629}
629630
630631long FT2Font::get_name_index (char *name)
0 commit comments