harfbuzz / harfbuzz/harfbuzz

Multiple strikes in OpenType bitmap fonts can't use different advance widths

Open
#4,430 9 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
6.1k
Forks
779
Avg merge
14h 26m
Merged PRs (30d)
76

Description

Hi HarfBuzz devs!

tl;dr: EBDT/EBLC tables contain advance widths per strike in pixels, but HarfBuzz ignores them and only uses advance widths from the hmtx table

What I'm trying to do is create an OpenType (.otb) version of a bitmap font that contains multiple strikes. The problem I have is that even in bitmap-only OpenType fonts, HarfBuzz appears to take advance widths from the hmtx table and ignore the ones provided in the EBDT/EBLC tables. This wouldn't be a problem in a bitmap font with only one strike, since the values from EBDT/EBLC could just be mirrored in hmtx (after being converted from pixels to font units), however, in fonts with multiple strikes, if the advance widths aren't proportional to the pixels per em, the font writer appears to be out of luck...

I'm attaching a font with such a problem: [monegasque.otb.gz](https://github.com/harfbuzz/harfbuzz/files/12838159/monegasque.otb.gz)

It contains strikes at both 12 ppem and 16 ppem (9 and 12 point), however only the advance widths of the 12 ppem strike are correct - the advance widths of the 16 ppem strike are too wide.

The 16 ppem strike looks like this:
![image](https://github.com/harfbuzz/harfbuzz/assets/66847847/e1652d25-6f24-46f5-8fec-e78ba25488b5)

But it should look like this:
![image](https://github.com/harfbuzz/harfbuzz/assets/66847847/47a32a03-9695-45f4-9a19-d498c36f2999)

Am happy to provide any more information that might be needed. Thanks for looking!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.