benoitkugler / textlayout Goto Github PK
View Code? Open in Web Editor NEWFonts and text layout for Golang
License: MIT License
Fonts and text layout for Golang
License: MIT License
I was loading a font, but I cannot share it here. However, upon debugging, I found out that languageToString
will return utf-8
, and the loop will fail because of the s+1
expression.
Lines 309 to 317 in 9459f67
I am coming from the c/++ Harfbuzz library and use GuessSegmentProperties to fill in the properties.
It seems that you have implemented this as well. Could you export the guessSegmentProperties in buffer.go? That way we could use it as a library.
BTW: this is a totally awesome project!
We have noticed, partly based on the comment here, that the following map is massive:
textlayout/fonts/glyphsnames/glyphs.go
Line 118 in f0394e7
Howdy @benoitkugler!
While working on go-text, I noticed that the method Font.ExtentsForDirection()
does not apply the configured font scaling factor (harfbuzz.Font.{X,Y}Scale
) to the output fonts.FontExtents
. Is that a deliberate design decision, or an oversight?
hi,
(apologies if that's not the best place to ask this type of question. feel free to point me to the correct forum otherwise).
any reason why the type1
and truetype
types do not integrate well with the x/image/font
interfaces? (such as font.Face
).
it would be great to have this kind of inter-operability.
(also, any reason you'd reimplement x/image/font/sfnt
in truetype
?)
Installing textlayout gives
go get -v github.com/benoitkugler/[email protected]
go: downloading github.com/benoitkugler/textlayout v0.0.10
go: github.com/benoitkugler/[email protected]: stream error: stream ID 1; NO_ERROR; received from peer`
I can't recreate on mac, but on 4 various windows machines on different networks, all with well functioning downloads of other packages.
When manually unzip'ing @v0.0.10.zip with 7zip on windows, a data error is reported.
Data error : github.com\benoitkugler\[email protected]\fonts\truetype\testdata\layout_fonts\morx\TRAK.ttf
Could these be related?
Hello! This work is really exiting and interesting. I'm one of the maintainers of Gio, and both we and the Fyne toolkit have been searching for a way to achieve HarfBuzz's functionality without losing portability. A port of HarfBuzz to Go is one of the things we considered, but we thought it was likely too much effort to create and maintain to be realistic.
That being said, @sbinet stumbled across this repository, and it seems to be doing that very thing, so I'm opening this issue as a public place to ask some questions about your work:
My goal with asking these is really to see whether there's enough alignment between your project goals and those of Gio/Fyne for a collaboration to make sense. I'm not trying to ask you to do a bunch of work on our behalf, and I hope that's clear.
Regardless of the answers to the above, thanks for plumbing these depths on behalf of Gophers everywhere!
I'm guessing that the answer is "no", but I can't find documentation either way. I'm interested in whether multiple Gio application windows can shape text with the same underlying *truetype.Font
concurrently.
I couldn't help notice that downloading github.com/benoitkugler/textlayout
takes quite a while, so I ran
$ du -hs .
311M .
$ du -hs *
155M fonts
4.0K go.mod
4.0K go.sum
19M graphite
12M harfbuzz
440K language
4.0K LICENSE
4.0K README.md
4.0K test
5.2M unicodedata
to check.
It's unfortunate to have to fetch at least ~200 MB data, or even > 300 MB for the entire history just to access the Go source. Would you be open to slimming down the repository and rewrite Git history to obtain a leaner dependency? If it's inconvenient to slim down the testdata files, perhaps they could be extracted into a separate (test-only) dependency module?
In Gio, I'm currently parsing the font twice so that I have access to the actual glyph shapes. I parse it with the library here so that harfbuzz has the data that it needs, and I also parse it with sfnt
because I know how to access the glyph path data there.
I couldn't figure out how to do so with the APIs in this module. Do you surface that information somewhere? I'm essentially looking for an analog of LoadGlyph
. Sorry if I've missed it in the API!
I'd like to use textlayout in a project of mine (https://github.com/speedata/boxesandglue) which is a library for PDF creation. For that I need font embedding and subsetting.
Currently I use my own code for that. Using my own code would require another step of interpreting the font code which is not strictly necessary, since the shaper already loads and interprets all kinds of tables in the OpenType / TrueType font.
Do you have subsetting / embedding code already somewhere in your projects (I see that you have a port of weasyprint) - or if not - do you have plans to add this code?
(please delete the question if not appropriate)
hi,
I stumbled on your nice package.
still digging through the code but this made me cringe a bit: fonts.Ressource
should be spelled fonts.Resource
(yeah, in french we'd write it with 2 s
s...)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.