Skip to content
This repository has been archived by the owner on Dec 17, 2021. It is now read-only.

Initial description of font interface #1

Closed
wants to merge 5 commits into from
Closed

Conversation

benoitkugler
Copy link
Collaborator

This is a sketch of a possible font interface. The common interface may be implemented by the "simple" font formats like Type1 and bitmap. The opentype.FaceOpentype would be use by the shaper (Harfbuzz) for Opentype font files.

This package could also provide a way to render glyphs (it's the purpose of the FaceRenderer interface), but I've not thought about it yet.

Comment on lines +90 to +92
Ascender float32 // Typographic ascender.
Descender float32 // Typographic descender.
LineGap float32 // Suggested line spacing gap.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a drive-by comment: why float32?
shouldn't we use some fixed-point integer type (like x/image/math/fixed.Int26_6) instead ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, thanks ! I've used float32 for simplicity, but x/image/math/fixed.Int26_6 will probably be required for integration and performances.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps this should be reflected in this PR? :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, thinking of it a bit more, it is not obvious to me that x/image/math/fixed.Int26_6 is a better choice. From what I've read, the performance of float32 is similar on modern computers. I'm not sure about the integration point.
I've opened this issue to discuss the question.

opentype/opentype.go Outdated Show resolved Hide resolved
opentype/opentype.go Outdated Show resolved Hide resolved
Kerx TableKernx
GSUB TableGSUB // An absent table has a nil slice of lookups
GPOS TableGPOS // An absent table has a nil slice of lookups
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know it's just a sketch, but: what about MATH TableMATH ?
https://docs.microsoft.com/en-us/typography/opentype/spec/math

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason is simply that Harfbuzz does not support layout using MATH, thus, for now, this field is not required by the shaper.
However we could expose this table (just as Harfbuzz does), so that other math shaper can consume it.

benoitkugler and others added 2 commits August 8, 2021 14:00
Co-authored-by: Sebastien Binet <binet@cern.ch>
Co-authored-by: Sebastien Binet <binet@cern.ch>
face.go Outdated Show resolved Hide resolved
face.go Outdated Show resolved Hide resolved
Co-authored-by: Sebastien Binet <binet@cern.ch>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants