@@ -84,6 +84,63 @@ static const MCAndroidDroidFontMap s_droid_fonts[] = {
8484static void MCAndroidCustomFontsList (char *&r_font_names);
8585static MCAndroidFontStyle MCAndroidCustomFontsGetStyle (const char *p_name);
8686
87+ bool MCSystemListFontFamilies (MCListRef& r_names)
88+ {
89+ MCAutoListRef t_list;
90+ if (!MCListCreateMutable (' \n ' , &t_list))
91+ return false ;
92+ for (uint32_t i = 0 ; s_droid_fonts[i].name != nil; i++)
93+ if (!MCListAppendCString (*t_list, s_droid_fonts[i].name ))
94+ return false ;
95+
96+ char *t_custom_font_names;
97+ MCAndroidCustomFontsList (t_custom_font_names);
98+ if (!MCListAppendCString (*t_list, t_custom_font_names))
99+ return false ;
100+
101+ MCCStringFree (t_custom_font_names);
102+
103+ return MCListCopy (*t_list, r_names);
104+ }
105+
106+ bool MCSystemListFontsForFamily (MCStringRef p_family, MCListRef& r_styles)
107+ {
108+ uint32_t t_styles;
109+ t_styles = 0 ;
110+
111+ for (uint32_t i = 0 ; s_droid_fonts[i].name != nil; i++)
112+ {
113+ if (MCStringIsEqualToCString (p_family, s_droid_fonts[i].name , kMCCompareCaseless ))
114+ {
115+ t_styles = s_droid_fonts[i].styles ;
116+ break ;
117+ }
118+ }
119+
120+ if (t_styles == 0 )
121+ t_styles = MCAndroidCustomFontsGetStyle (MCStringGetCString (p_family));
122+
123+
124+ MCAutoListRef t_list;
125+ if (!MCListCreateMutable (' \n ' , &t_list))
126+ return false ;
127+
128+ if (t_styles & kMCAndroidFontStyleRegular )
129+ if (!MCListAppendCString (*t_list, " plain" ))
130+ return false ;
131+ if (t_styles & kMCAndroidFontStyleBold )
132+ if (!MCListAppendCString (*t_list, " bold" ))
133+ return false ;
134+ if (t_styles & kMCAndroidFontStyleItalic )
135+ if (!MCListAppendCString (*t_list, " italic" ))
136+ return false ;
137+ if (t_styles & kMCAndroidFontStyleBoldItalic )
138+ if (!MCListAppendCString (*t_list, " bold-italic" ))
139+ return false ;
140+
141+ return MCListCopy (*t_list, r_styles);
142+ }
143+ /*
87144void MCSystemListFontFamilies(MCExecPoint& ep)
88145{
89146 ep . clear();
@@ -95,13 +152,13 @@ void MCSystemListFontFamilies(MCExecPoint& ep)
95152 MCAndroidCustomFontsList(t_custom_font_names);
96153 if (t_custom_font_names != nil)
97154 ep.concatcstring(t_custom_font_names, EC_RETURN, ep.getsvalue().getlength() == 0);
98- /* UNCHECKED */ MCCStringFree (t_custom_font_names);
155+ MCCStringFree(t_custom_font_names);
99156}
100157
158+
101159bool MCSystemListFontsForFamily(MCExecPoint& ep, const char *p_family)
102160{
103- // TODO
104- /* uint32_t t_styles;
161+ uint32_t t_styles;
105162 t_styles = 0;
106163
107164 for (uint32_t i = 0; s_droid_fonts[i].name != nil; i++)
@@ -124,11 +181,11 @@ bool MCSystemListFontsForFamily(MCExecPoint& ep, const char *p_family)
124181 if (t_styles & kMCAndroidFontStyleItalic)
125182 ep.concatcstring("italic", EC_RETURN, ep.getsvalue().getlength() == 0);
126183 if (t_styles & kMCAndroidFontStyleBoldItalic)
127- ep.concatcstring("bold-italic", EC_RETURN, ep.getsvalue().getlength() == 0); */
184+ ep.concatcstring("bold-italic", EC_RETURN, ep.getsvalue().getlength() == 0);
128185
129186 return false;
130187}
131-
188+ */
132189// //////////////////////////////////////////////////////////////////////////////
133190
134191struct MCAndroidCustomFont {
0 commit comments