diff --git a/platform/darwin/src/local_glyph_rasterizer.mm b/platform/darwin/src/local_glyph_rasterizer.mm index 005989f57da..17afef992e1 100644 --- a/platform/darwin/src/local_glyph_rasterizer.mm +++ b/platform/darwin/src/local_glyph_rasterizer.mm @@ -301,11 +301,11 @@ CGContextHandle context(CGBitmapContextCreate( manufacturedGlyph.id = glyphID; BOOL isBold = NO; - for (auto& fontName : fontStack) { - std::string lowercaseFont = platform::lowercase(fontName); - if (lowercaseFont.find("bold") != std::string::npos) { + // Only check the first font name to detect if the user prefers using bold + if (!fontStack.empty()) { + std::string lowercaseFont = platform::lowercase(fontStack.front()); + if (lowercaseFont.find("bold") != std::string::npos && lowercaseFont.find("semibold") == std::string::npos) { isBold = YES; - break; } } diff --git a/test/fixtures/local_glyphs/ping_fang_with_bold_in_style/expected.png b/test/fixtures/local_glyphs/ping_fang_with_bold_in_style/expected.png index 88ad2d75af0..3de939b4787 100644 Binary files a/test/fixtures/local_glyphs/ping_fang_with_bold_in_style/expected.png and b/test/fixtures/local_glyphs/ping_fang_with_bold_in_style/expected.png differ