Skip to content

Arabic names are not being rendered #359

Closed

Description

@XPipe-SL

As seen in the screenshot, currently, arabic names are not being rendered in the map.

GranadaNotShowing

Activity

  1. 1ec5 commented on Apr 20, 2022

    @1ec5
    Member

    We probably need to install the right-to-left text plugin on the site.

  2. danrademacher commented on Apr 20, 2022

    @danrademacher

    Thanks for the tip @1ec5 ! I don't think we've used that before, so this'll be a little learning on our part, but I imagine it's relatively straightforward to install and configure.

  3. gregallensworth commented on Apr 22, 2022

    @gregallensworth

    So, a rough outline for my local testing:

  4. gregallensworth commented on Apr 22, 2022

    @gregallensworth

    First proof of concept: RTL plugin + the fontstack URLs over at Mapbox.

    Naturally, we can't really use this fontstack at Mapbox with someone else's access token and all. But it does prove the concept that Open Sans is still the shortcoming. If I supplement it with Noto Arabic and Noto Hebrew, this should work...

    image

  5. gregallensworth commented on Apr 22, 2022

    @gregallensworth

    I could use some help on building the font stack necessary.

    To use Open Sans, then failing over to some fonts which support other characters, the map style would read like this:

    "text-font": ["Open Sans Regular", "Noto Sans Regular", "Noto Sans Arabic Regular", "Noto Sans Hebrew Regular"]
    

    But of course this translates to:

    https://openhistoricalmap.github.io/map-styles/fonts/Open%20Sans%20Regular,Noto%20Sans,Noto%20Sans%20Arabic,Noto%20Sans%20Hebrew/0-255.pbf

    So the next question is how one combines the PBFs for the various fonts, in order to create a proper font stack that supports all of the glyphs?

    At Mapbox URLs such as https://api.mapbox.com/fonts/v1/mapbox/DIN%20Offc%20Pro%20Regular,Arial%20Unicode%20MS%20Regular/8192-8447.pbf?access_token=xxx work for a variety of fonts and combinations of fonts. I imagine that they have already combined them and/or have some service which combines them on the fly.

  6. 1ec5 commented on Apr 23, 2022

    @1ec5
    Member

    If I remember correctly, Mapbox’s Fonts API uses node-fontnik under the hood to vend PBFs that fall back to different fonts per glyph. Typically the style (or GL) will append Arial Unicode MS to the fontstack as a pan-Unicode font. I don’t think it generates the PBFs on the fly exactly.

  7. gregallensworth commented on Apr 23, 2022

    @gregallensworth
  8. 1ec5 commented on Apr 23, 2022

    @1ec5
    Member

    There are other pan-Unicode fonts, some of them freely licensed, but any pan-Unicode font comes with a lot of compromises. For example, Arial Unicode MS has a very tall line height because of its Thai and Vietnamese support, although some more recent fonts include Thai and Vietnamese with much less leading. If you can manage to include a wide variety of Noto fonts in the fontstack, I think that would lead to higher quality results (and ultimately the same performance characteristics on the client side).

    Arial Unicode MS also makes some fraught compromises for CJK, but we already render CJK on the client side so it’s irrelevant here.

  9. gregallensworth commented on May 2, 2022

    @gregallensworth

    Thumbing through some pan-Unicode fonts, starting with the list at https://en.wikipedia.org/wiki/Open-source_Unicode_typefaces#Comparison

    GNU Unifont

    Despite the ugly website at https://unifoundry.com/unifont/ Unifont is being updated actively, its most recent being April 2022.

    It is released under GPL, but our usage would likely fall under the GPL Font Embedding Exception.

    Its glyph support is extensive.

    There does not seem to be a bold nor italic version of the font. Arch Linux has a package script using mkfont and mkbold with the BDF version of the font, so if this proves promising there may be a path forward there: Unifont BDF -> mkbold and mkitalic -> mkttf -> fontnik build-glyphs

    Promising results

    Hebrew

    image

    Arabic

    image

    Japanese, Chinese

    image

    But Latin characters are not very pretty, kind of "computery"

    image

  10. gregallensworth commented on May 3, 2022

    @gregallensworth

    I have composed some new fonts:
    https://github.com/OpenHistoricalMap/map-styles/tree/staging/fonts/OpenHistorical
    https://github.com/OpenHistoricalMap/map-styles/tree/staging/fonts/OpenHistorical%20Bold
    https://github.com/OpenHistoricalMap/map-styles/tree/staging/fonts/OpenHistorical%20Italic

    These are Open Sans Regular, Bold, and Italic, with Unifont appended to them. Therefore the glyph from Open Sans will be used where it has a matching glyph (Latin character sets), then the Unifont glyph will be used where not (Hebrew, Arabic, and beyond).

    In the map style definition in ohm.style.original.js I then replaced the font name:

    • "Open Sans" => "OpenHistorical"
    • "Open Sans Bold" => "OpenHistorical Bold"
    • "Open Sans Italic" => "OpenHistorical Italic"

    In my testing this looks great:

    image

    image

    image

    image

    image

    Caveat about bold & italic:

    • Unifont does not have a bold nor italic version readily available. As such, an Arabic or Hebrew name that should be bold may show up in not-bold. I would need an example in order to test this out. I see that Arch Linux has a script when compiling their packages for creating bold & italic Unifont, so perhaps there is a way forward should this come up?

    Next steps:

    • can anyone bring up an example of an Arabic or Hebrew label which should be bold? if so, does it appear bold correctly? @XPipe-SL ?
    • communicate with @tsinn about making corresponding changes in the upstream style, or otherwise figuring up what else would need to change e.g. font sizes
    • Create a branch & pull request for ohm-website with this modified style, get it deployed
    • Discuss with @vknoppkewetzel whether Woodblock would need something similar, e.g. a new "OpenHistorical Woodblock" font composed of Eaudi + Unifont?
  11. added a commit that references this issue on May 6, 2022
  12. added a commit that references this issue on May 6, 2022
  13. gregallensworth commented on May 6, 2022

    @gregallensworth

    See new branch: gin-openhistorical-font

    See new pull request: OpenHistoricalMap/ohm-website#88

  14. added theissue type on Mar 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions