-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Opentype font writer #102
Opentype font writer #102
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool addition - not quite sure about the naming though - will this support other font types like collections? if so the generic Write
name may need clarity.
opentype/loader/writer.go
Outdated
// Write creates a single font file from the given [tables] slice, | ||
// which must be sorted by Tag | ||
func Write(tables []Table) []byte { | ||
buffer := writeTTF(tables) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function has a single purpose - to call writeTTF
, which is strange - if it is generic we don't need the extra function, but if it is because this writer is for TTF perhaps the generic name isn't right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair point. In the future, we may want to support other formats, like web font (WOFF). In such case, the Write function would become Write(tables []Table, woff bool) []byte
, and internally call writeTTF
or writeWOFF
.
But, for now, it seems indeed cleaner to drop the internal function and rename Write
to, say, WriteTTF
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay. Feature looks good! Thank you.
This PR adds support to write an Opentype font file from a list of tables.
This is a simple implementation, since neither font collections nor compressed format (WOFF) are supported.
This paves the way for features such as subsetter or variable font instantiater.
Conceptually, the
Write
function performs the reverse operation ofNewLoader
, so that I think it should belong to this package.Note that the GUI toolkits are probably NOT interested by such features, but since the Go linker is able to remove dead code, it should come with no cost for end users anyway.