-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
Comments
I'm @adg and I approve this proposal. |
I'm not @adg and I approve this proposal. |
CL https://golang.org/cl/28347 mentions this issue. |
Updates golang/go#16904 Change-Id: I4e11e4e859c007c3444655a227ac935c27f3f784 Reviewed-on: https://go-review.googlesource.com/28347 Reviewed-by: David Crawshaw <crawshaw@golang.org>
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.) |
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. |
CL https://golang.org/cl/33417 mentions this issue. |
Updates golang/go#16904 Change-Id: Ic4c55865741b712f7d82448276fc357f2edf9b45 Reviewed-on: https://go-review.googlesource.com/33417 Reviewed-by: Dave Day <djd@golang.org>
Updates golang/go#16904 Change-Id: I4e11e4e859c007c3444655a227ac935c27f3f784 Reviewed-on: https://go-review.googlesource.com/28347 Reviewed-by: David Crawshaw <crawshaw@golang.org>
Updates golang/go#16904 Change-Id: Ic4c55865741b712f7d82448276fc357f2edf9b45 Reviewed-on: https://go-review.googlesource.com/33417 Reviewed-by: Dave Day <djd@golang.org>
Updates golang/go#16904 Change-Id: I4e11e4e859c007c3444655a227ac935c27f3f784 Reviewed-on: https://go-review.googlesource.com/28347 Reviewed-by: David Crawshaw <crawshaw@golang.org>
Updates golang/go#16904 Change-Id: Ic4c55865741b712f7d82448276fc357f2edf9b45 Reviewed-on: https://go-review.googlesource.com/33417 Reviewed-by: Dave Day <djd@golang.org>
Updates golang/go#16904 Change-Id: I4e11e4e859c007c3444655a227ac935c27f3f784 Reviewed-on: https://go-review.googlesource.com/28347 Reviewed-by: David Crawshaw <crawshaw@golang.org>
Updates golang/go#16904 Change-Id: Ic4c55865741b712f7d82448276fc357f2edf9b45 Reviewed-on: https://go-review.googlesource.com/33417 Reviewed-by: Dave Day <djd@golang.org>
Updates golang/go#16904 Change-Id: I4e11e4e859c007c3444655a227ac935c27f3f784 Reviewed-on: https://go-review.googlesource.com/28347 Reviewed-by: David Crawshaw <crawshaw@golang.org>
Updates golang/go#16904 Change-Id: Ic4c55865741b712f7d82448276fc357f2edf9b45 Reviewed-on: https://go-review.googlesource.com/33417 Reviewed-by: Dave Day <djd@golang.org>
Updates golang/go#16904 Change-Id: I4e11e4e859c007c3444655a227ac935c27f3f784 Reviewed-on: https://go-review.googlesource.com/28347 Reviewed-by: David Crawshaw <crawshaw@golang.org>
Updates golang/go#16904 Change-Id: Ic4c55865741b712f7d82448276fc357f2edf9b45 Reviewed-on: https://go-review.googlesource.com/33417 Reviewed-by: Dave Day <djd@golang.org>
Updates golang/go#16904 Change-Id: I4e11e4e859c007c3444655a227ac935c27f3f784 Reviewed-on: https://go-review.googlesource.com/28347 Reviewed-by: David Crawshaw <crawshaw@golang.org>
Updates golang/go#16904 Change-Id: Ic4c55865741b712f7d82448276fc357f2edf9b45 Reviewed-on: https://go-review.googlesource.com/33417 Reviewed-by: Dave Day <djd@golang.org>
Updates golang/go#16904 Change-Id: I4e11e4e859c007c3444655a227ac935c27f3f784 Reviewed-on: https://go-review.googlesource.com/28347 Reviewed-by: David Crawshaw <crawshaw@golang.org>
Updates golang/go#16904 Change-Id: Ic4c55865741b712f7d82448276fc357f2edf9b45 Reviewed-on: https://go-review.googlesource.com/33417 Reviewed-by: Dave Day <djd@golang.org>
Updates golang/go#16904 Change-Id: I4e11e4e859c007c3444655a227ac935c27f3f784 Reviewed-on: https://go-review.googlesource.com/28347 Reviewed-by: David Crawshaw <crawshaw@golang.org>
Updates golang/go#16904 Change-Id: Ic4c55865741b712f7d82448276fc357f2edf9b45 Reviewed-on: https://go-review.googlesource.com/33417 Reviewed-by: Dave Day <djd@golang.org>
Updates golang/go#16904 Change-Id: I4e11e4e859c007c3444655a227ac935c27f3f784 Reviewed-on: https://go-review.googlesource.com/28347 Reviewed-by: David Crawshaw <crawshaw@golang.org>
Updates golang/go#16904 Change-Id: Ic4c55865741b712f7d82448276fc357f2edf9b45 Reviewed-on: https://go-review.googlesource.com/33417 Reviewed-by: Dave Day <djd@golang.org>
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.
The text was updated successfully, but these errors were encountered: