Skip to content
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

x/image: packages to render TrueType fonts #16904

Open
nigeltao opened this issue Aug 28, 2016 · 6 comments
Open

x/image: packages to render TrueType fonts #16904

nigeltao opened this issue Aug 28, 2016 · 6 comments

Comments

@nigeltao
Copy link
Contributor

nigeltao commented Aug 28, 2016

github.com/golang/freetype already exists, but its license (the Freetype license) differs from the Go standard library, and code in the stdlib or under golang.org/x cannot depend on out-of-tree code.

I propose to add two new packages in the golang.org/x/image repo that together lets you use TTFs to draw text. There are existing packages under golang.org/x/image/font that can draw bitmap fonts, but this would be the first golang.org/x package that draws vector fonts.

The golang.org/x/image/vector package rasterizes 2-D vector graphics: filled and stroked polygons and Bézier curves. 2-D vector graphics (and the scope of this package) encompasses more than just fonts, but this package will rasterize the glyphs of a vector font such as TrueType. It'd be comparable to the github.com/golang/freetype/raster package, but not based on the Freetype code.

The golang.org/x/image/font/sfnt package parses sfnt font formats, including TrueType (.ttf) and OpenType (.otf). It will implement the existing golang.org/x/image/font font.Face interface for font format agnostic text drawing. It'd be comparable to the github.com/golang/freetype/truetype package, but not based on the Freetype code.

A proof of concept (as a single "package main" instead of two separate packages) exists in a separate repository, https://github.com/google/font-go, which is in turn based on https://github.com/google/font-rs and the accompanying article (https://medium.com/@raphlinus/inside-the-fastest-font-renderer-in-the-world-75ae5270c445) by Raph Levien of Google. Roughly speaking, font.go would become package sfnt, and raster.go and acc*.{go,s} would become package vector.

@adg
Copy link
Contributor

adg commented Sep 1, 2016

I'm @adg and I approve this proposal.

@bradfitz
Copy link
Contributor

bradfitz commented Sep 1, 2016

I'm not @adg and I approve this proposal.

@gopherbot
Copy link

CL https://golang.org/cl/28347 mentions this issue.

gopherbot pushed a commit to golang/image that referenced this issue Sep 4, 2016
Updates golang/go#16904

Change-Id: I4e11e4e859c007c3444655a227ac935c27f3f784
Reviewed-on: https://go-review.googlesource.com/28347
Reviewed-by: David Crawshaw <crawshaw@golang.org>
@quentinmit quentinmit modified the milestones: Proposals, Proposal Sep 6, 2016
@akavel
Copy link
Contributor

akavel commented Sep 7, 2016

Is the reference API of the Rust package published somewhere, or does one have to browse the sources? Will it be possible to stroke curves with dashes/dots pattern? (I use forked freetype-go to draw dashed lines and curves in my Go port of ditaa.)

@nigeltao
Copy link
Contributor Author

nigeltao commented Sep 8, 2016

I don't know enough about the Rust community to know if the API is published anywhere other than the source at https://github.com/google/font-rs but its API is pretty minimal: it is a prototype / proof of concept rather than a polished library.

I expect golang.org/x/image/vector will be as capable as github.com/golang/freetype/raster in terms of strokes, so you can build your own dashing code on top of that.

@gopherbot
Copy link

CL https://golang.org/cl/33417 mentions this issue.

gopherbot pushed a commit to golang/image that referenced this issue Nov 23, 2016
Updates golang/go#16904

Change-Id: Ic4c55865741b712f7d82448276fc357f2edf9b45
Reviewed-on: https://go-review.googlesource.com/33417
Reviewed-by: Dave Day <djd@golang.org>
mrhyperbit23z0d added a commit to mrhyperbit23z0d/bhegde8 that referenced this issue Jun 6, 2022
Updates golang/go#16904

Change-Id: I4e11e4e859c007c3444655a227ac935c27f3f784
Reviewed-on: https://go-review.googlesource.com/28347
Reviewed-by: David Crawshaw <crawshaw@golang.org>
mrhyperbit23z0d added a commit to mrhyperbit23z0d/bhegde8 that referenced this issue Jun 6, 2022
Updates golang/go#16904

Change-Id: Ic4c55865741b712f7d82448276fc357f2edf9b45
Reviewed-on: https://go-review.googlesource.com/33417
Reviewed-by: Dave Day <djd@golang.org>
GalaxyForcew added a commit to GalaxyForcew/A1bisshy that referenced this issue Jun 6, 2022
Updates golang/go#16904

Change-Id: I4e11e4e859c007c3444655a227ac935c27f3f784
Reviewed-on: https://go-review.googlesource.com/28347
Reviewed-by: David Crawshaw <crawshaw@golang.org>
GalaxyForcew added a commit to GalaxyForcew/A1bisshy that referenced this issue Jun 6, 2022
Updates golang/go#16904

Change-Id: Ic4c55865741b712f7d82448276fc357f2edf9b45
Reviewed-on: https://go-review.googlesource.com/33417
Reviewed-by: Dave Day <djd@golang.org>
yi-ge3 added a commit to yi-ge3/wislie that referenced this issue Jun 6, 2022
Updates golang/go#16904

Change-Id: I4e11e4e859c007c3444655a227ac935c27f3f784
Reviewed-on: https://go-review.googlesource.com/28347
Reviewed-by: David Crawshaw <crawshaw@golang.org>
yi-ge3 added a commit to yi-ge3/wislie that referenced this issue Jun 6, 2022
Updates golang/go#16904

Change-Id: Ic4c55865741b712f7d82448276fc357f2edf9b45
Reviewed-on: https://go-review.googlesource.com/33417
Reviewed-by: Dave Day <djd@golang.org>
balloontmz6 added a commit to balloontmz6/Likewise42l that referenced this issue Jun 6, 2022
Updates golang/go#16904

Change-Id: I4e11e4e859c007c3444655a227ac935c27f3f784
Reviewed-on: https://go-review.googlesource.com/28347
Reviewed-by: David Crawshaw <crawshaw@golang.org>
balloontmz6 added a commit to balloontmz6/Likewise42l that referenced this issue Jun 6, 2022
Updates golang/go#16904

Change-Id: Ic4c55865741b712f7d82448276fc357f2edf9b45
Reviewed-on: https://go-review.googlesource.com/33417
Reviewed-by: Dave Day <djd@golang.org>
@rsc rsc changed the title proposal: x/image packages to render TrueType fonts x/image packages to render TrueType fonts Aug 5, 2022
snapbakkhfbav added a commit to snapbakkhfbav/SayedBaladohr that referenced this issue Oct 6, 2022
Updates golang/go#16904

Change-Id: I4e11e4e859c007c3444655a227ac935c27f3f784
Reviewed-on: https://go-review.googlesource.com/28347
Reviewed-by: David Crawshaw <crawshaw@golang.org>
snapbakkhfbav added a commit to snapbakkhfbav/SayedBaladohr that referenced this issue Oct 6, 2022
Updates golang/go#16904

Change-Id: Ic4c55865741b712f7d82448276fc357f2edf9b45
Reviewed-on: https://go-review.googlesource.com/33417
Reviewed-by: Dave Day <djd@golang.org>
MiderWong5ddop added a commit to MiderWong5ddop/sidie88f that referenced this issue Oct 7, 2022
Updates golang/go#16904

Change-Id: I4e11e4e859c007c3444655a227ac935c27f3f784
Reviewed-on: https://go-review.googlesource.com/28347
Reviewed-by: David Crawshaw <crawshaw@golang.org>
MiderWong5ddop added a commit to MiderWong5ddop/sidie88f that referenced this issue Oct 7, 2022
Updates golang/go#16904

Change-Id: Ic4c55865741b712f7d82448276fc357f2edf9b45
Reviewed-on: https://go-review.googlesource.com/33417
Reviewed-by: Dave Day <djd@golang.org>
rorypeckwnt4v added a commit to rorypeckwnt4v/LearnByBhanuPrataph that referenced this issue Oct 7, 2022
Updates golang/go#16904

Change-Id: I4e11e4e859c007c3444655a227ac935c27f3f784
Reviewed-on: https://go-review.googlesource.com/28347
Reviewed-by: David Crawshaw <crawshaw@golang.org>
rorypeckwnt4v added a commit to rorypeckwnt4v/LearnByBhanuPrataph that referenced this issue Oct 7, 2022
Updates golang/go#16904

Change-Id: Ic4c55865741b712f7d82448276fc357f2edf9b45
Reviewed-on: https://go-review.googlesource.com/33417
Reviewed-by: Dave Day <djd@golang.org>
egorovcharenko9 added a commit to egorovcharenko9/RiceBIOC470z that referenced this issue Oct 7, 2022
Updates golang/go#16904

Change-Id: I4e11e4e859c007c3444655a227ac935c27f3f784
Reviewed-on: https://go-review.googlesource.com/28347
Reviewed-by: David Crawshaw <crawshaw@golang.org>
egorovcharenko9 added a commit to egorovcharenko9/RiceBIOC470z that referenced this issue Oct 7, 2022
Updates golang/go#16904

Change-Id: Ic4c55865741b712f7d82448276fc357f2edf9b45
Reviewed-on: https://go-review.googlesource.com/33417
Reviewed-by: Dave Day <djd@golang.org>
RafayGhafoorf added a commit to RafayGhafoorf/dustinsand8 that referenced this issue Oct 7, 2022
Updates golang/go#16904

Change-Id: I4e11e4e859c007c3444655a227ac935c27f3f784
Reviewed-on: https://go-review.googlesource.com/28347
Reviewed-by: David Crawshaw <crawshaw@golang.org>
RafayGhafoorf added a commit to RafayGhafoorf/dustinsand8 that referenced this issue Oct 7, 2022
Updates golang/go#16904

Change-Id: Ic4c55865741b712f7d82448276fc357f2edf9b45
Reviewed-on: https://go-review.googlesource.com/33417
Reviewed-by: Dave Day <djd@golang.org>
@seankhliao seankhliao changed the title x/image packages to render TrueType fonts x/image: packages to render TrueType fonts Jan 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants