Closed whereswaldon closed 1 year ago
Fyne uses x/text, and mostly it is just not compatible with the APIs in @benoitkugler repositories so I have to manage the two font definitions side-by-side (we still use x/text for rasterising).
If they were able to be compatible that would be a huge relief, but I suspect we can't.
Thankfully the bidi
package does not seem to depend on their definition of a Font/Face so we may be able to make use of it internally.
If they were able to be compatible that would be a huge relief, but I suspect we can't.
The main reason we can't for now is because x/text Opentype implementation does not support all the layout tables (GPOS/GSUB and AAT, which make the complexity and value of Harfbuzz, by the way). We could maybe try to propose PRs into x/text to fill the gap..
It may be easier to do the other way around and add rasterising into go-text (relying on x/text or implementing from scratch).
The ideal situation, which seems reachable, is that a single font definition (that is a font.Face
element) is enough to provide both metrics for layout and sufficient glyphs drawing data/rasterization.
Thankfully the bidi package does not seem to depend on their definition of a Font/Face so we may be able to make use of it internally.
Indeed (and for a good reason which is that, contrary to shaping or font fallback, the bidi algorithm is actually totally font agnostic).
x/text/unicode/bidi
seems actually in good shape. Would you like me to look closer at how we can use it ? In particular, what I have in mind is starting by checking if the test suite from fribidi is passing with x/text.
@npillmayer Do you know anything about the status of x/text/unicode/bidi
?
@benoitkugler If you have time to check it against the fribidi
test sutie, I think that would be very interesting data!
I think this isn't necessarily a go-text problem. Gio does use this implementation of bidirectional segmentation and it's doing just fine for us. I'm going to close this for now.
I just stumbled across
golang.org/x/text/unicode/bidi
. I don't think I've heard us talk about this library before, so I wanted to ask if that's because we know it isn't adequate to our needs, or because we didn't realize it was available. Does anybody know anything about the x/text implementation?