graphicore / librebarcode

Libre Barcode: barcode fonts for various barcode standards.
https://graphicore.github.io/librebarcode
SIL Open Font License 1.1
425 stars 25 forks source link

iPhone problem: font-feature-settings: "calt" Limbo; #29

Open timrobinson81 opened 3 years ago

timrobinson81 commented 3 years ago

Hi everyone, Hope you're all well. If you look at this link below on an iPhone, 'Libre Barcode EAN13 Text' on Google Fonts renders only numbers and doesn't appear like a bar-code as it does on other devices: https://bit.ly/2TUo3Tp Many thanks and kind regards, Tim

graphicore commented 3 years ago

Hi, I can reproduce this, but, I don't think it's a problem with the font, as I can use the fonts on iOS (13.7) Safari (NOTE: font version is 1.006, newer than the one currently at google fonts):

ean13-testing page screenshot from IPhone.

IMG_5164

This lead to a strange finding though. May not be the case for the current version 1.004 now on Google Fonts, as I am using v1.006 which is not yet updated there!:

The complex symbol selection of the font is done using OpenType Feature substitutions, namely the calt feature, which should be on by default, according to the spec. In this font, with calt turned off you don't get numbers but patterns of number below + start pattern. That is because it supports a compatible input encoding mode, compatible with the grandzebu EAN 13 font:

/* CSS */
.ean13 {
    font-family: "Libre Barcode EAN13 Text";
    font-feature-settings: "calt" 0;
}

IMG_5165

When calt is on, an input like that will be turned into an barcode. The first calt feature turns all compatibility glyphs into number glyphs and from there continues. With iOS on Safari and Chrome it applies just the first calt rule then stops.

/* CSS */
.ean13 {
    font-family: "Libre Barcode EAN13 Text";
}

IMG_5166

In CSS, using "font-feature-settings: "calt" 1;" fixes it!

/* CSS */
.ean13 {
    font-family: "Libre Barcode EAN13 Text";
    font-feature-settings: "calt" 1;
}

Using font-feature-settings: "calt" 0; turnes calt off as expected.

So there's apparently a third mode in iOS, one between on and off. 🤬

I suggest waiting for the update at Google Fonts to version 1.006 before reporting there. But eventually, this seems like a bad implementation by Apple, and I don't know how to report issues efficiently to them.

simoncozens commented 3 years ago

Works in macOS Safari, but not iOS, so that's some weird rendering bug cc @nedley.

timrobinson81 commented 3 years ago

Hi, For me, problem solved. Many thanks and kind regards, Tim

graphicore commented 3 years ago

@timrobinson81 thanks. However, I'll keep this open until its properly documented. You can unsubscribe from notifications if you like.