• choosing fonts (was: HTML and Unicode notations)

    From Helmut Richter@21:1/5 to Jukka K. Korpela on Thu Apr 6 09:58:35 2023
    This message is in MIME format. The first part should be readable text,
    while the remaining parts are likely unreadable without MIME-aware tools.

    On Sat, 1 Apr 2023, Jukka K. Korpela wrote:

    In fonts like Cambria, Times New Roman, FreeSerif, and Noto Serif, the difference between italic a and italic alpha looks quite sufficient to my eyes.

    I am offering information on web space (thus “authoring”) and I know that there are many fonts and many ways to specify fonts in stylesheets or perhaps elsewhere. I have still refrained from using that very much, because there
    are too many choices and I do not know where to begin. I would be grateful
    for any advice you may have from your experience.

    I have the following choices:

    (1) how to provide the font to the reader
    (2) which properties of the font to consider required or preferable

    (1a) The easiest way is to use a font that is already installed on all reasonably expected systems and to provide a general specification of its features, e.g. „font-family: Georgia, serif;“: that is Georgia if installed,
    otherwise another serif font. Now Georgia, which I do like, is not installed everywhere. How could I find out enough names of fonts so that on most
    systems at least one of them is installed? If I specify features (like
    serif), how many of them can I specify without running the risk that there
    are systems where no font matches all of them?

    (1b) Another way is to provide a free – proprietary or not – font on my server and specify in the style sheets that it shall be downloaded from my
    site prior to use. Does the time for downloading matter until the user sees
    the contents? Are there any other drawbacks of this approach? What have I to
    do (up to now, I have not yet seen a straightforward recipe)?

    (1c) I rule out solutions which require the reader to manually install fonts
    or anything else before reading my web content.

    (1d) I rule out solutions where the reader’s browser loads a font from
    a server other than mine. What my readers read is no concern of
    third-party companies. (Probably required by the European General Data Protection Regulation GDPR)

    (1e) I rule out solutions which I have to pay for, except perhaps a moderate one-time payment for an unlimited-time licence.

    (1f) A possible solution could also be to specify two of three fonts that are widely installed (=1a), and one for download (=1b) as fallback when none of
    the first group is installed.

    Required and desired features of fonts to be used are:

    (2a) support of a reasonable subset of Unicode, at least the European and Middle-East scripts and the symbols in the basic plane – for seldom-used foreign scripts I could live with special fonts that must be explicitly specified (e.g. by :lang(...) in CSS)

    (2b) one clearly readable serif font for body text; preferably with wide characters (e.g. Georgia); required to have a matching set of italic
    characters thoroughly distinct from non-italics; preferably support of
    medieval numbers (which, as I find, fit typographically better in serif
    fonts).

    (2c) one clearly readable sans-serif font for headlines

    (2d) I have no reqirements of “corporate design” in the sense that a Web page
    must look exactly the same on every system. But the basic features as
    described above should be similar.

    Now, when I try to satisfy both (1) and (2) simultaneously, I run into the problem of determining which fonts come into consideration and what
    requirement each of them satisfies. Mostly, a description specifies only a
    few of the features mentiones above.

    Thanks for any assistance.

    --
    Helmut Richter

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jukka K. Korpela@21:1/5 to Helmut Richter on Fri Apr 7 17:01:30 2023
    Helmut Richter wrote:

    I have the following choices:

    (1) how to provide the font to the reader
    (2) which properties of the font to consider required or preferable

    (1a) The easiest way is to use a font that is already installed on all reasonably expected systems and to provide a general specification of its features, e.g. „font-family: Georgia, serif;“: that is Georgia if installed,
    otherwise another serif font. Now Georgia, which I do like, is not installed everywhere. How could I find out enough names of fonts so that on most systems at least one of them is installed?

    I’m afraid there is no general procedure for that. There used to be web
    pages that listed commonly available fonts, but they were based on
    questionable methodology, and they seem to have disappeared. The
    situation has become more complicated e.g. due to mobile devices that
    may have their own, limited font repertoires – which might be specially designed for them.

    Using “font-family: Georgia, serif” may well be the right way when you
    have a reason to suggest Georgia when available. If you add alternative
    fonts, there is no guarantee that the result is better than the generic fallback to “serif”.

    If I specify features (like
    serif), how many of them can I specify without running the risk that there are systems where no font matches all of them?

    I’m not sure I understand this part. The name “serif” does not speficy a feature; it refers to an implementation-defined serif font (and possibly user-defined, as a browser may let the user specify how the name “serif” is mapped to an actual font).

    (1b) Another way is to provide a free – proprietary or not – font on my server and specify in the style sheets that it shall be downloaded from my site prior to use. Does the time for downloading matter until the user sees the contents?

    It may, but this is probably not a big issue these days in most
    circumstances.

    Are there any other drawbacks of this approach?

    If the downloadable font is on a server different from that of the HTML document, it may happen that the page is loaded without the font. In
    this case, a default font (as defined in font-family or the browser configuration) will be used instead.

    If the download of the font is slow, it may happen that the browser
    first renders the page without it, using a default font, then redraws
    the page when it gets the font. Somewhat disturbing.

    What have I to
    do (up to now, I have not yet seen a straightforward recipe)?

    I’d suggest starting with a Google font used remotely, i.e. with a
    reference to it hosted on a Google server. From this simple approach you
    can then move to other, perhaps more effective and more efficient
    solutions, if suitable.

    Here’s a simple example from a page of mine, where I wish to display
    some texts in a Fraktur font, and it does not matter much which Fraktur,
    so I use the Google font UnifrakturMaguntia: On the <head> I have

    <link href= "https://fonts.googleapis.com/css?family=UnifrakturMaguntia&amp;subset=all" rel="stylesheet">

    <style>
    .fr {
    font-family: UnifrakturMaguntia;
    }
    /* change Fraktur to default serif on mouseover: */
    span.fr:hover { font-family: serif }
    </style>

    And in <body> I use class=fr for texts to be displayed in Fraktur, e.g.
    <span class=fr>abc</a>.

    If you find a suitable font at https://fonts.google.com/ you will see instructions on using it that way, with some extra stuff suggested there.

    (1d) I rule out solutions where the reader’s browser loads a font from
    a server other than mine.

    If you do so, you exclude the simple approach outlined above, but you
    could still use it for testing (the suitability of a font etc.) and then
    move to the approach where you download a font family and prepare it for
    use on your own server. (I don’t know how good Google instructions for
    that are. You might need to use a “Download family” button, unzip the package and study its contents.

    (1f) A possible solution could also be to specify two of three fonts that are widely installed (=1a), and one for download (=1b) as fallback when none of the first group is installed.

    That would be suitable if the two or three fonts are essentially better
    than the downloadable font. And with suitable use of CSS, it’s almost as simple as using just a downloadable font.

    Required and desired features of fonts to be used are:

    (2a) support of a reasonable subset of Unicode

    That’s a lot to ask for, for many values of “reasonable”. Even for a modest basic repertoire of about 1,000 “European” characters (like the
    old MEs-2 subset), there is a rather limited set of fonts that contain
    all of them. On the other hand, most web pages in European languages
    probably have a much more limited character repertoire.

    (2b) one clearly readable serif font for body text; preferably with wide characters (e.g. Georgia); required to have a matching set of italic characters thoroughly distinct from non-italics;

    I think this boils down to a font family that has (at least) both
    regular and italic typeface. For serif fonts, they tend to be different
    enough.
    It’s different for sans-serif fonts and for fonts that lack an italic typeface,
    so that the “italic” you get from them e.g. by using <i>...</i> is
    “false italic”,
    i.e. regular characters slanted algorithmically.

    preferably support of
    medieval numbers (which, as I find, fit typographically better in serif fonts).

    I suppose you mean “oldstyle figures”, i.e. digit glyphs that vary in height
    like lowercase letters do. Most fonts used on web pages do not have them.
    Some, like Georgia and Constantia, have them as default glyphs for digits. Some, like Cambria, have them as optional alternatives, i.e. you need to do something special to get them. In CSS, you would use the font-variant
    property or the older, possibly better supported font-feature-settings property. This means that you can use, say, Georgia for different texts
    so that oldstyle numbers are used in normal text but the other design,
    lining figures, e.g. in numerical tables or with text in capital letters.

    (2c) one clearly readable sans-serif font for headlines

    That’s a natural requirement, but it means you need to select another
    font family, though sometimes a serif font family and a sans-serif font
    family are available as members of a “superfamily”, such as Noto Serif
    and Noto Sans, As for Georgia for example, there is no such concept; you
    need to decide which sans-serif font to use with it.

    Yucca

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Stan Brown@21:1/5 to Jukka K. Korpela on Fri Apr 7 08:03:41 2023
    On Fri, 7 Apr 2023 17:01:30 +0300, Jukka K. Korpela wrote:
    Helmut Richter wrote:
    (1b) Another way is to provide a free ? proprietary or not ? font on my server and specify in the style sheets that it shall be downloaded from my site prior to use. Does the time for downloading matter until the user sees the contents?

    It may, but this is probably not a big issue these days in most circumstances.

    Are there any other drawbacks of this approach?

    If the downloadable font is on a server different from that of the HTML document, it may happen that the page is loaded without the font. In
    this case, a default font (as defined in font-family or the browser configuration) will be used instead.

    If the download of the font is slow, it may happen that the browser
    first renders the page without it, using a default font, then redraws
    the page when it gets the font. Somewhat disturbing.

    I wonder if this is what's happening with aarp.org. (For non-US
    folks, AARP is an organization for persons over 50, and it has
    millions of members.) Every single page -- every one that I've seen,
    anyway -- paints, then blanks and repaints. I figured it was bad
    scripting, but maybe it's this font thingy.



    --
    Stan Brown, Tehachapi, California, USA
    https://BrownMath.com/

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Arno Welzel@21:1/5 to All on Fri Apr 7 17:39:51 2023
    Jukka K. Korpela, 2023-04-07 16:01:

    [...]
    If the download of the font is slow, it may happen that the browser
    first renders the page without it, using a default font, then redraws
    the page when it gets the font. Somewhat disturbing.

    You can force the browser to wait a bit before displaying anything.

    Also see <https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display>

    However keep in mind that using "font-display: block;" may cause overall delays. Also if a font was ever downloaded once it should be in the
    cache and there effect of font swapping should not occur any longer.

    With this in mind, using stuff like Google fonts - besides potential
    privacy issues - may even be preferrable since many sites just load the
    same fonts and it is very likely that visitors may already have the
    desired font in their browser cache.


    --
    Arno Welzel
    https://arnowelzel.de

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Arno Welzel@21:1/5 to All on Fri Apr 7 17:34:38 2023
    Helmut Richter, 2023-04-06 09:58:

    On Sat, 1 Apr 2023, Jukka K. Korpela wrote:

    In fonts like Cambria, Times New Roman, FreeSerif, and Noto Serif, the
    difference between italic a and italic alpha looks quite sufficient to my
    eyes.

    I am offering information on web space (thus “authoring”) and I know that there are many fonts and many ways to specify fonts in stylesheets or perhaps elsewhere. I have still refrained from using that very much, because there are too many choices and I do not know where to begin. I would be grateful for any advice you may have from your experience.

    Very simple: no font at all. Just decide wether you want to use "serif"
    or "sans-serif" and let the user choose in their Browser setting
    whatever they like to have for that. By default Browsers already support
    these generic font families and users can configure which font to use then.

    I have the following choices:

    (1) how to provide the font to the reader

    WOFF and WOFF2 like this:

    @font-face {
    font-family: "Lato";
    src: url("/fonts/Lato/Lato-Regular.woff2") format("woff2"),
    url("/fonts/Lato/Lato-Regular.woff") format("woff");
    font-display: swap;
    }

    @font-face {
    font-family: "Lato";
    font-style: italic;
    src: url("/fonts/Lato/Lato-Italic.woff2") format("woff2"),
    url("/fonts/Lato/Lato-Italic.woff") format("woff");
    font-display: swap;
    }

    @font-face {
    font-family: "Lato";
    font-style: normal;
    font-weight: bold;
    src: url("/fonts/Lato/Lato-Bold.woff2") format("woff2"),
    url("/fonts/Lato/Lato-Bold.woff") format("woff");
    font-display: swap;
    }

    @font-face {
    font-family: "Lato";
    font-style: italic;
    font-weight: bold;
    src: url("/fonts/Lato/Lato-BoldItalic.woff2") format("woff2"),
    url("/fonts/Lato/Lato-BoldItalic.woff") format("woff");
    font-display: swap;
    }

    There are other formats as well like EOT (Embedded OpenType) by
    Microsoft or SVG Fonts used by older version of iOS. But nowadays just
    using WOFF2 with a fallback to WOFF should be sufficent for most
    visitors. If you then define the font family with a fall back as well,
    the visitors will still have a text without any confusing change from
    serif to sans-serif:

    html,
    button,
    input,
    select,
    option,
    optgroup,
    textarea {
    font-family: "Lato", sans-serif;
    font-size: 1em;
    }


    (2) which properties of the font to consider required or preferable

    It should be readable on all devices you expect your visitors to use.
    The only way to check this is to use the devices and test it. But
    usually there are some well-known fonts which already work quite well
    like Lato or Roboto.

    Otherwise consult a graphic designer who is specialized for online media.

    (1a) The easiest way is to use a font that is already installed on all reasonably expected systems and to provide a general specification of its features, e.g. „font-family: Georgia, serif;“: that is Georgia if installed,
    [...]

    No, that's not the easiest way since you then have to decide what
    systems can be expected *and* what fonts there are. Also keep in mind
    that over time the font stacks may change as well and older versions of
    a system may not provide the same fonts as newer versions.

    Providing webfonts is much easier. Even if you add the fonts in your
    stylesheet Browsers will only load the fonts they really need for
    rendering. And even 1-2 MB for the font files is not a big deal nowadays
    where even mobile devices often have more than 10 MBit/s connection
    speed and downloading 1 MB of data takes often less than 1 second.

    (1b) Another way is to provide a free – proprietary or not – font on my server and specify in the style sheets that it shall be downloaded from my site prior to use. Does the time for downloading matter until the user sees the contents? Are there any other drawbacks of this approach? What have I to do (up to now, I have not yet seen a straightforward recipe)?

    No, see above. I maintain websites of which some have millions of
    visitors each year and I never had any issue with performance because of webfonts.


    --
    Arno Welzel
    https://arnowelzel.de

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Arno Welzel@21:1/5 to All on Fri Apr 7 17:44:36 2023
    Stan Brown, 2023-04-07 17:03:

    On Fri, 7 Apr 2023 17:01:30 +0300, Jukka K. Korpela wrote:
    Helmut Richter wrote:
    (1b) Another way is to provide a free ? proprietary or not ? font on my
    server and specify in the style sheets that it shall be downloaded from my >>> site prior to use. Does the time for downloading matter until the user sees >>> the contents?

    It may, but this is probably not a big issue these days in most
    circumstances.

    Are there any other drawbacks of this approach?

    If the downloadable font is on a server different from that of the HTML
    document, it may happen that the page is loaded without the font. In
    this case, a default font (as defined in font-family or the browser
    configuration) will be used instead.

    If the download of the font is slow, it may happen that the browser
    first renders the page without it, using a default font, then redraws
    the page when it gets the font. Somewhat disturbing.

    I wonder if this is what's happening with aarp.org. (For non-US
    [...]

    Maybe - but the way how that site behaves is really weird. I have never
    since shuch a strong font swapping effect. And even if the font is
    already cached, font swapping still happens. To me this looks like the
    result of the CMS they use.

    For comparison see my own website: <https://arnowelzel.de/en/>

    The very first time you load it, you *may* notice font swapping. But
    when reloading the site or opening any article, this should not happen
    again since the font is then cached and does not need to be swapped again.


    --
    Arno Welzel
    https://arnowelzel.de

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jukka K. Korpela@21:1/5 to Stan Brown on Sat Apr 8 20:25:23 2023
    Stan Brown wrote:

    On Fri, 7 Apr 2023 17:01:30 +0300, Jukka K. Korpela wrote:
    – –
    If the download of the font is slow, it may happen that the browser
    first renders the page without it, using a default font, then redraws
    the page when it gets the font. Somewhat disturbing.

    I wonder if this is what's happening with aarp.org. (For non-US
    folks, AARP is an organization for persons over 50, and it has
    millions of members.) Every single page -- every one that I've seen,
    anyway -- paints, then blanks and repaints. I figured it was bad
    scripting, but maybe it's this font thingy.

    It isn’t scripting: with JavaScript disabled, the font flash is still there.

    The problem is probably caused by the placement of the <link> element
    that refers to the Google font Lato. It is placed near the end of the
    <body> element, violating HTML syntax. Browsers still interpret such
    misplaced elements, but when the browser reaches that element, it has
    already processed the <head> part and started rendering the document
    body, using font-family: Lato, sans-serif and therefore the browser’s
    default sans-serif font, since no Lato font is available at that point.

    Yucca

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Arno Welzel@21:1/5 to All on Sat Apr 8 21:18:01 2023
    Jukka K. Korpela, 2023-04-08 19:25:

    Stan Brown wrote:

    On Fri, 7 Apr 2023 17:01:30 +0300, Jukka K. Korpela wrote:
    – –
    If the download of the font is slow, it may happen that the browser
    first renders the page without it, using a default font, then redraws
    the page when it gets the font. Somewhat disturbing.
    [...]
    The problem is probably caused by the placement of the <link> element
    that refers to the Google font Lato. It is placed near the end of the
    <body> element, violating HTML syntax. Browsers still interpret such misplaced elements, but when the browser reaches that element, it has
    already processed the <head> part and started rendering the document
    body, using font-family: Lato, sans-serif and therefore the browser’s default sans-serif font, since no Lato font is available at that point.

    Nice find. Yes, this is the problem. I'll write about this to the
    webmaster of <https://www.aarp.org>. Hopefully they fix that.

    --
    Arno Welzel
    https://arnowelzel.de

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Stan Brown@21:1/5 to Arno Welzel on Sun Apr 9 12:20:41 2023
    On Sat, 8 Apr 2023 21:18:01 +0200, Arno Welzel wrote:

    Jukka K. Korpela, 2023-04-08 19:25:

    Stan Brown wrote:

    On Fri, 7 Apr 2023 17:01:30 +0300, Jukka K. Korpela wrote:
    ? ?
    If the download of the font is slow, it may happen that the browser
    first renders the page without it, using a default font, then redraws
    the page when it gets the font. Somewhat disturbing.
    [...]
    The problem is probably caused by the placement of the <link> element
    that refers to the Google font Lato. It is placed near the end of the <body> element, violating HTML syntax. Browsers still interpret such misplaced elements, but when the browser reaches that element, it has already processed the <head> part and started rendering the document
    body, using font-family: Lato, sans-serif and therefore the browser?s default sans-serif font, since no Lato font is available at that point.

    Thanks, Jukka! This has been an annoyance for as long as I can
    remember, and it's nice at least to know the cause.

    Nice find. Yes, this is the problem. I'll write about this to the
    webmaster of <https://www.aarp.org>. Hopefully they fix that.

    Thanks! I was going to ask if I should do that, but without a lot of
    hope. Please let us know what kind of reply you get, if any.

    --
    Stan Brown, Tehachapi, California, USA
    https://BrownMath.com/

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)