@@ -307,46 +307,8 @@ static void apply_element(void* ctx, const CGPathElement* element)
307307 if (CFIndex count = CTRunGetGlyphCount (run))
308308 {
309309 rive::GlyphRun gr (count);
310-
311- // Because CoreText will automatically do its own font fallbacks
312- // we need to detect that it's trying to use a different font.
313- CFDictionaryRef attributes = CTRunGetAttributes (run);
314- CTFontRef runCtFont = static_cast <CTFontRef>(
315- CFDictionaryGetValue (attributes, kCTFontAttributeName ));
316- const float scale = textRun.size / (float )CTFontGetSize (runCtFont);
317- if (!CFEqual (runCtFont, ctFont))
318- {
319- // Get the original font's traits and create a fallback font
320- // with the same traits. In some cases, CoreText will use a
321- // different font for the fallback, but the fallback font will
322- // not have the same traits (e.g weight) as the original font.
323- CTFontSymbolicTraits originalTraits =
324- CTFontGetSymbolicTraits (ctFont);
325- CTFontRef fallbackFont =
326- CTFontCreateCopyWithSymbolicTraits (runCtFont,
327- CTFontGetSize (runCtFont),
328- nullptr ,
329- originalTraits,
330- originalTraits);
331- if (!fallbackFont)
332- {
333- fallbackFont = runCtFont;
334- }
335-
336- gr.font = HBFont::FromSystem (
337- (void *)fallbackFont, true , m_weight, m_width);
338-
339- // If the fallback font is not the same as the original run
340- // font, we need to release it since we made a copy of it
341- if ((void *)fallbackFont != (void *)runCtFont)
342- {
343- CFRelease (fallbackFont);
344- }
345- }
346- else
347- {
348- gr.font = textRun.font ;
349- }
310+ const float scale = textRun.size / (float )CTFontGetSize (ctFont);
311+ gr.font = textRun.font ;
350312 gr.size = textRun.size ;
351313 gr.lineHeight = textRun.lineHeight ;
352314 gr.letterSpacing = textRun.letterSpacing ;
0 commit comments