On Tue, 18 Dec 2018 08:47:54 +0000, Huw Davies wrote:
On Fri, Dec 14, 2018 at 10:44:56PM +0900, Akihiro Sagawa wrote:
if((lf.lfPitchAndFamily & FIXED_PITCH) ||
(lf.lfPitchAndFamily & 0xF0) == FF_MODERN)
(lf.lfPitchAndFamily & 0xF0) == FF_MODERN) { strcpyW(lf.lfFaceName, defFixed);
- else if((lf.lfPitchAndFamily & 0xF0) == FF_ROMAN)
fallback_list = default_fixed_list;
- }
- else if((lf.lfPitchAndFamily & 0xF0) == FF_ROMAN) { strcpyW(lf.lfFaceName, defSerif);
- else if((lf.lfPitchAndFamily & 0xF0) == FF_SWISS)
fallback_list = default_serif_list;
- }
- else if((lf.lfPitchAndFamily & 0xF0) == FF_SWISS) { strcpyW(lf.lfFaceName, defSans);
- else
fallback_list = default_sans_list;
- }
- else { strcpyW(lf.lfFaceName, defSans);
- LIST_FOR_EACH_ENTRY( family, &font_list, Family, entry ) {
if(!strncmpiW(family->FamilyName, lf.lfFaceName, LF_FACESIZE - 1)) {
font_link = find_font_link(family->FamilyName);
face_list = get_face_list_from_family(family);
LIST_FOR_EACH_ENTRY( face, face_list, Face, entry ) {
if (!(face->scalable || can_use_bitmap))
continue;
if (csi.fs.fsCsb[0] & face->fs.fsCsb[0])
goto found;
if (font_link != NULL && csi.fs.fsCsb[0] & font_link->fs.fsCsb[0])
goto found;
fallback_list = default_sans_list;
- }
- for (; *fallback_list; fallback_list++) {
Can you explain why you need to loop through the list. It should be sorted so that either the first entry exists or no entries exist.
Thanks for reviewing. Indeed, looping through the font list is superfluous. There are three patterns to test the face (Sans, Mono, Serif). I'll try the first three entries in the list.
WCHAR face_name[LF_FACESIZE];
strcpyW(face_name, *fallback_list);
Why do you need the strcpy here?
I'll remove this. It's redundant.
LIST_FOR_EACH_ENTRY( family, &font_list, Family, entry ) {
if(!strncmpiW(family->FamilyName, face_name, LF_FACESIZE - 1)) {
font_link = find_font_link(family->FamilyName);
face_list = get_face_list_from_family(family);
LIST_FOR_EACH_ENTRY( face, face_list, Face, entry ) {
if (!(face->scalable || can_use_bitmap))
continue;
if (csi.fs.fsCsb[0] & face->fs.fsCsb[0])
goto found;
if (font_link != NULL && csi.fs.fsCsb[0] & font_link->fs.fsCsb[0])
goto found;
}} } }
Akihiro Sagawa