0

So I can specify my fonts in my website style CSS, and then set the font-family:

    @font-face {
    font-family: "custom-helvetica";
    src: url("/assets/HelveticaNeue.ttf");
    src: url("/assets/HelveticaNeueBold.ttf");
    src: url("/assets/HelveticaBlkIt.ttf");
    }
    
    @font-face {
    font-family: "custom-tahoma";
    src: url("/assets/Tahoma.ttf");
    src: url("/assets/Tahomabd.ttf");
    }
    
    html {
        font-family: Tahoma, Helvetica, Arial, sans-serif;
        }

Here's an example piece of text:

Testing glyphs in PHP: ± µ ⁓ â ฿ ₿

So let's suppose that the font Helvetica contains all the glyphs in the example apart from ±, µ, and that the font Tahoma contains all the glyphs in the example apart from â, ฿, . Let's suppose that the font Arial contains every glyph in the example.

How does PHP/CSS work with this?

Will it apply Tahoma to the example and get this result? - Testing glyphs in PHP: ± µ ⁓ ࠀ ࠀ ࠀ

Or will it decide that Arial is the only font that can render the entire string correctly, and apply that font to the whole string? Or will the font change dynamically throughout the string to adapt to any missing glyphs?

meewog
  • 1,690
  • 1
  • 22
  • 26
AutoBaker
  • 919
  • 2
  • 15
  • 31
  • 1
    This would be squarely a CSS/browser rendering issue as PHP's only task is to tell the browser which characters to render based on their codepoints. – BoltClock Aug 11 '20 at 11:00
  • I see, so that it can be browser dependent? – AutoBaker Aug 11 '20 at 11:02
  • Well, not quite *so that*, moreso it is just what it is. – BoltClock Aug 11 '20 at 11:04
  • https://stackoverflow.com/questions/29241764/how-do-web-browsers-implement-font-fallback, https://stackoverflow.com/questions/56847665/how-do-browsers-deal-with-tofu-characters – CBroe Aug 11 '20 at 11:07

0 Answers0