diff --git a/cbuild.bat b/cbuild.bat index 0d7427f51..f91fe310b 100644 --- a/cbuild.bat +++ b/cbuild.bat @@ -296,6 +296,7 @@ rem # setup build echo #define FIRMWARE_REVISION L"%SVNREVISION%">>%F_VER_H% echo #define REVISION_STR "Clover revision: %SVNREVISION%">>%F_VER_H% echo #define BUILDINFOS_STR %clover_build_info%>>%F_VER_H% + copy %F_VER_H% rEFIt_UEFI\%F_VER_H% :callbuild rem # launch build diff --git a/rEFIt_UEFI/libeg/VectorGraphics.cpp b/rEFIt_UEFI/libeg/VectorGraphics.cpp index eb8b2936d..fe8fa346e 100755 --- a/rEFIt_UEFI/libeg/VectorGraphics.cpp +++ b/rEFIt_UEFI/libeg/VectorGraphics.cpp @@ -421,6 +421,23 @@ EFI_STATUS ParseSVGTheme(CONST CHAR8* buffer, TagPtr * dict, UINT32 bufSize) GlobalConfig.MainEntriesSize = (INTN)(128.f * Scale); } DBG("parsing theme finish\n"); +#if 1 //dump fonts + { + NSVGfont *fontSVG = NULL; + NSVGfontChain *fontChain = fontsDB; + + while (fontChain) { + fontSVG = fontChain->font; + if (fontSVG) { + DBG("probe fontFamily=%a fontStyle=%c\n", fontSVG->fontFamily, fontSVG->fontStyle); + } + else { + DBG("nextChain is empty\n"); + } + fontChain = fontChain->next; + } + } +#endif return EFI_SUCCESS; } diff --git a/rEFIt_UEFI/libeg/nanosvg.cpp b/rEFIt_UEFI/libeg/nanosvg.cpp index 4ddfb3bcc..149123118 100644 --- a/rEFIt_UEFI/libeg/nanosvg.cpp +++ b/rEFIt_UEFI/libeg/nanosvg.cpp @@ -547,12 +547,14 @@ void nsvg__deleteFont(NSVGfont* font) return; } if (font->missingGlyph) { +// DBG("missing glyph=%a\n", font->missingGlyph->name); nsvg__deletePaths(font->missingGlyph->path); FreePool(font->missingGlyph); font->missingGlyph = NULL; } glyphs = font->glyphs; while (glyphs) { +// DBG(" glyph=%a\n", glyphs->name); next = glyphs->next; nsvg__deletePaths(glyphs->path); FreePool(glyphs); @@ -2838,19 +2840,26 @@ static void nsvg__parseText(NSVGparser* p, const char** dict) //if the font is not registered then we have to load new one NSVGfont *fontSVG = NULL; NSVGfontChain *fontChain = fontsDB; - + NSVGfontChain *fontChainSimilar = NULL; while (fontChain) { fontSVG = fontChain->font; if (fontSVG) { - DBG("probe fontFamily=%a fontStyle=%c\n", fontSVG->fontFamily, fontSVG->fontStyle); - if ((strcmp(fontSVG->fontFamily, text->fontFace->fontFamily) == 0) && - (fontSVG->fontStyle == text->fontStyle)) { - DBG("font %a found\n", fontSVG->fontFamily); - break; + DBG("probe fontFamily=%a fontStyle=%c\n", fontSVG->fontFamily, fontSVG->fontStyle); + if (strcmp(fontSVG->fontFamily, text->fontFace->fontFamily) == 0) { + fontChainSimilar = fontChain; + DBG("font %a found\n", fontSVG->fontFamily); + if (fontSVG->fontStyle == text->fontStyle) { + break; + } } } fontChain = fontChain->next; } + if (!fontChain && fontChainSimilar) { //font with this style is not found but we have same font with other style + DBG("found similar font with style=%c\n", fontChainSimilar->font->fontStyle); + fontChain = fontChainSimilar; + fontSVG = fontChain->font; + } if (!fontChain) { // font not found in the chain //then load it UINT8 *FileData = NULL; @@ -2865,24 +2874,27 @@ static void nsvg__parseText(NSVGparser* p, const char** dict) if (!p1) { DBG("font %a not parsed\n", text->fontFace->fontFamily); } else { - fontSVG = (__typeof__(fontSVG))AllocateCopyPool(sizeof(NSVGfont), p1->font); - DBG("font family %a parsed\n", fontSVG->fontFamily); + /* fontSVG = (__typeof__(fontSVG))AllocateCopyPool(sizeof(NSVGfont), p1->font); + DBG("font family %a parsed\n", fontSVG->fontFamily); fontChain = (__typeof__(fontChain))AllocatePool(sizeof(*fontChain)); fontChain->font = fontSVG; fontChain->next = fontsDB; fontsDB = fontChain; + */ + fontSVG = fontsDB->font; //last added during parse file data text->font = fontSVG; //this is the same pointer as in fontChain but we will never free text->font. We will free fontChain } FreePool(FileData); //after load FileData = NULL; } else { + DBG("set embedded font\n"); text->font = p->font; //else embedded if present which is also double fontChain } } else { - DBG("set found font %a\n", fontSVG->id); + DBG("set found font %a\n", fontSVG->fontFamily); text->font = fontSVG; //the font found in fontChain } - + //instead of embedded if (fontSVG && fontSVG->glyphs) { NSVGgroup* group = attr->group; @@ -3557,7 +3569,7 @@ static void nsvg__parseFont(NSVGparser* p, const char** dict) if (!font->horizAdvX) { font->horizAdvX = 1000; } - DBG("found font id=%a\n", font->id); + DBG("found font id=%a family=%a\n", font->id, font->fontFamily); NSVGfontChain* fontChain = (__typeof__(fontChain))AllocatePool(sizeof(*fontChain)); fontChain->font = font; @@ -4303,7 +4315,12 @@ NSVGparser* nsvgParse(char* input, /* const char* units,*/ float dpi, float opac } p->dpi = dpi; p->opacity = opacity; +// DBG("fontDb=%x\n", (UINTN)fontsDB); nsvg__parseXML(input, nsvg__startElement, nsvg__endElement, nsvg__content, p); +// DBG("fontDb after parse=%x\n", (UINTN)fontsDB); +// if (fontsDB && fontsDB->font) { +// DBG("added font=%a\n", fontsDB->font->fontFamily); //yes, fonts added here +// } //assign gradients clipPath = p->image->clipPaths; while (clipPath != NULL) { diff --git a/rEFIt_UEFI/libeg/nanosvg.h b/rEFIt_UEFI/libeg/nanosvg.h index c7ef54a2a..d9f948abb 100644 --- a/rEFIt_UEFI/libeg/nanosvg.h +++ b/rEFIt_UEFI/libeg/nanosvg.h @@ -108,7 +108,7 @@ typedef struct NSVGgradientStop { float offset; } NSVGgradientStop; -typedef struct NSVGgradient { +typedef struct NSVGgradient { //undefined sizeof float xform[6]; // float position[6]; float fx, fy; diff --git a/rEFIt_UEFI/refit/main.cpp b/rEFIt_UEFI/refit/main.cpp index be5d7460b..137a2563d 100644 --- a/rEFIt_UEFI/refit/main.cpp +++ b/rEFIt_UEFI/refit/main.cpp @@ -630,7 +630,6 @@ static VOID StartLoader(IN LOADER_ENTRY *Entry) // OSIcons NSVGfontChain *fontChain = fontsDB; while (fontChain) { - DBG("free fontChain \n"); font = fontChain->font; NSVGfontChain *nextChain = fontChain->next; if (font) { @@ -638,8 +637,9 @@ static VOID StartLoader(IN LOADER_ENTRY *Entry) fontChain->font = NULL; } FreePool(fontChain); - fontChain = nextChain->next; + fontChain = nextChain; } + fontsDB = NULL; // nsvg__deleteParser(mainParser); //temporary disabled //destruct_globals_objects(NULL); //we can't destruct our globals here. We need, for example, Volumes.