struct GlyphInfoData glyphs01[] =
{
- {4u, 38u, 0.f, 0.f, 0.f, 0.f, 11.f, 0.f, true, true},
- {4u, 39u, 0.f, 0.f, 0.f, 0.f, 10.f, 0.f, true, true},
- {4u, 40u, 0.f, 0.f, 0.f, 0.f, 10.f, 0.f, true, true},
- {4u, 41u, 0.f, 0.f, 0.f, 0.f, 10.f, 0.f, true, true},
+ {4u, 38u, 0.f, 0.f, 0.f, 0.f, 11.f, 0.f, true, false},
+ {4u, 39u, 0.f, 0.f, 0.f, 0.f, 10.f, 0.f, true, false},
+ {4u, 40u, 0.f, 0.f, 0.f, 0.f, 10.f, 0.f, true, false},
+ {4u, 41u, 0.f, 0.f, 0.f, 0.f, 10.f, 0.f, true, false},
};
struct GlyphInfoData glyphs02[] =
{
{1u, 38u, 0.f, 0.f, 0.f, 0.f, 10.f, 0.f, false, false},
- {2u, 39u, 0.f, 0.f, 0.f, 0.f, 10.f, 0.f, false, true},
+ {2u, 39u, 0.f, 0.f, 0.f, 0.f, 10.f, 0.f, false, false},
{3u, 40u, 0.f, 0.f, 0.f, 0.f, 10.f, 0.f, true, false},
- {4u, 41u, 0.f, 0.f, 0.f, 0.f, 10.f, 0.f, true, true},
+ {4u, 41u, 0.f, 0.f, 0.f, 0.f, 10.f, 0.f, true, false},
};
CharacterIndex characterIndices[] = {0u, 1u, 2u, 3u};
FontId fontId = fontClient.GetFontId(currentFontDescription, currentFontPointSize);
currentFontId = fontId;
+ // Prevent double-bolding from both markup and style
+ bool isFontChangedByBold = false;
+
+ if(currentFontDescription.weight == TextAbstraction::FontWeight::BOLD)
+ {
+ TextAbstraction::FontDescription currentFontDescriptionWithoutBold = TextAbstraction::FontDescription(currentFontDescription);
+ currentFontDescriptionWithoutBold.weight = TextAbstraction::FontWeight::NORMAL;
+
+ FontId fontIdWithoutBold = fontClient.GetFontId(currentFontDescriptionWithoutBold, currentFontPointSize);
+ if(fontId != fontIdWithoutBold)
+ {
+ // If a font is already changed by the bold feature, do not let Freetype further embolden it.
+ isFontChangedByBold = true;
+ }
+ }
+
// Get the script for the current character.
Script script = GetScript(index,
scriptRunIt,
}
// Whether bols style is required.
- isBoldRequired = (currentFontDescription.weight >= TextAbstraction::FontWeight::BOLD);
+ isBoldRequired = (!isFontChangedByBold && (currentFontDescription.weight >= TextAbstraction::FontWeight::BOLD));
// Whether italic style is required.
isItalicRequired = (currentFontDescription.slant >= TextAbstraction::FontSlant::ITALIC);