Giter Club home page Giter Club logo

textlayout's People

Contributors

andydotxyz avatar benoitkugler avatar eliasnaur avatar jacalz avatar whereswaldon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

textlayout's Issues

When `langStr` is `utf-8`, NewOTTagsFromScriptAndLanguage fails

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.

langStr := languageToString(language)
limit := -1
privateUseSubtag := ""
if langStr[0] == 'x' && langStr[1] == '-' {
privateUseSubtag = langStr
} else {
var s int
for s = 1; s < len(langStr); s++ { // s index in lang_str
if langStr[s-1] == '-' && langStr[s+1] == '-' {

Export harfbuzz.guessSegmentProperties()

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!

Trim down or minimize memory usage

We have noticed, partly based on the comment here, that the following map is massive:

var glyphAliases = map[string]string{ // 2462 entries

A map of, according to the comment, 2462 different strings result in a lot of memory usage and quite a huge piece of binary size increases. Can this map be reduced in any way, only created when actually needed or something like that? It might make sense to convert it into one large switch-case (especially now that Go 1.19 uses jump tables for large int and string switch cases) as the Go compiler more easily can optimize that but it would have to be tested to make sure that it isn't noticeably slower.

fonts/{type1,truetype}: x/image/font.Face interface

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?)

Data error TRAK.ttf in v.0.0.10.zip

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?

Questions about the approach and future of this project

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:

  1. How are you planning to license the project? It doesn't seem to have a License right now.
  2. How are you "porting" the Harfbuzz code? Is it all manual, or do you have some kind of automation in place for translating the C++ into Go?
  3. What is your planned scope for the project? Are you shooting for total parity with HarfBuzz, or some subset of its features?

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!

Are parsed fonts safe for concurrent use?

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.

repository is large (200MB)

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?

How can I extract the path data for an opentype font?

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!

Question about subsetting fonts (for PDF embedding)

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)

fonts: Ressource should be spelled Resource

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 ss...)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.