Display of double-overstrike character in various browsers

APL-related discussions - a stream of APL consciousness.
Not sure where to start a discussion ? Here's the place to be
Forum rules
This forum is for discussing APL-related issues. If you think that the subject is off-topic, then the Chat forum is probably a better place for your thoughts !

Re: Display of double-overstrike character in various browse

Postby paulmansour on Tue Feb 15, 2022 7:07 am

If it displays correctly now, it is simply because Stefan is now using the APL385 Unicode font. No?
paulmansour
 
Posts: 418
Joined: Fri Oct 03, 2008 4:14 pm

Re: Display of double-overstrike character in various browse

Postby Adam|Dyalog on Sun Feb 20, 2022 6:57 am

kai wrote:No way they are going to change that any time soon,

The current behaviour is by design. All mainstream browsers (even Firefox!) use the HarfBuzz text layout engine, but with varying configurations. All Chromium-based software (Chrome, Edge, Opera, Vivaldi, Brave, Amazon Silk, Samsung Internet, Dyalog HTMLRenderer, Electron, WebView2, DotNetBrowser, Qt, etc. etc.) tell HarfBuzz to prefer an attempt at composing two characters from the requested font rather than getting a pre-composed character from a different font. All Gecko-based software (Firefox, SeaMonkey, Thunderbird) instead tell HarfBuzz to attempt at getting a missing character from a different font, before attempting to compose it.

Both approaches are reasonable. The former prefers overall stylistic consistency over internal glyph precision, while the latter prefers correct rendering of individual glyphs at the cost of a potentially uneven "look".

paulmansour wrote:If it displays correctly now, it is simply because Stefan is now using the APL385 Unicode font. No?

Yes, the fix is simple: Specify a font that has the characters you need, and HarfBuzz will not need to compromise for neither Blink nor Gecko. Don't forget to make the font available on your server in case the client doesn't have it. Here's the CSS that Stefan recently began using:
Code: Select all
@font-face {
    font-family: "codefont";
    src: local("APL385 Unicode"),
         url(APL385.ttf) format("truetype");
}

/* Use the code font where relevant. */
 t, code, kbd, samp, pre, .output.text_html span {
    font-family: codefont!important
}
User avatar
Adam|Dyalog
 
Posts: 134
Joined: Thu Jun 25, 2015 1:13 pm

Re: Display of double-overstrike character in various browse

Postby StefanoLanzavecchia on Mon Feb 21, 2022 7:29 am

The thing is that the fix is not simple. If you are the author of the web page that needs to displays APL characters, and the only characters you need to display as part of the APL Code (like comments, quoted strings and so on) are covered by APL385, then, by all means, a bit of CSS, the font hosted on your server and you're good to go.

But what if the APL code contains Chinese comments? Or the APL program you wrote contains extensive quotes from a Sanskrit text? Or if the programs makes use of all the latest and greatest emojis the Unicode committee keeps adding? Is anybody busy adding new glyphs to APL385?

Also: what if you are not the maintainer of the web page? Sites like github, gitlab are very unlikely to upgrade their CSSs because Harfbuzz mangles a few of the APL glyphs, yet they are used to host large swathes of APL code... How do you fix this:
Image?

The way I solved the problem is by lowering my beauty standards and by teaching myself to recognise the few funny patterns which don't make sense in proper APL.
User avatar
StefanoLanzavecchia
 
Posts: 109
Joined: Fri Oct 03, 2008 9:37 am

Re: Display of double-overstrike character in various browse

Postby Adam|Dyalog on Mon Mar 21, 2022 12:36 pm

But what if the APL code contains Chinese comments? Or the APL program you wrote contains extensive quotes from a Sanskrit text?

That should "just work". HarfBuzz will fall back to a font that does have those characters.
Is anybody busy adding new glyphs to APL385?
As per the above; no need.
Also: what if you are not the maintainer of the web page? Sites like github, gitlab are very unlikely to upgrade their CSSs because Harfbuzz mangles a few of the APL glyphs, yet they are used to host large swathes of APL code... How do you fix this:

Install a browser user style extension (I use Stylus) and add the style:
Code: Select all
.blob-code-inner{font-family:APL385 Unicode}

Image
User avatar
Adam|Dyalog
 
Posts: 134
Joined: Thu Jun 25, 2015 1:13 pm

Re: Display of double-overstrike character in various browse

Postby StefanoLanzavecchia on Mon Mar 21, 2022 12:44 pm

As far as I am aware, mobile browsers don't allow extensions. Nor many corporate controlled browsers.
User avatar
StefanoLanzavecchia
 
Posts: 109
Joined: Fri Oct 03, 2008 9:37 am

Previous

Return to APL Chat

Who is online

Users browsing this forum: No registered users and 1 guest