-
Notifications
You must be signed in to change notification settings - Fork 34
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
API Qs/feedback #23
Comments
Sounds good. I will add Whoops, I forgot to mention in the readme that unlike hb, rb doesn't support font size. You should scale the produced offsets and advances manually.
Same as harfbuzz. There are no changes here.
|
So it's not necessary to set font size in the
Ach ja. Those names are confusing IMO. From KAS-text's HarfBuzz support: let index = idx_offset + info.cluster;
assert!(info.codepoint <= u16::MAX as u32, "failed to map glyph id");
let id = GlyphId(info.codepoint as u16); The type T = [u32; 32];
pub struct A(T);
pub struct B(T);
pub fn f(a: A) -> B {
B(a.0)
} |
Yes. And even with variation it's not necessary, because variation doesn't affect size, technically speaking.
Yes.
It is, but it never copied, or rather cloned, but moved. |
You know that CPUs don't have a concept of moves, right? This is a Rust concept (avoiding the need to destroy one object and construct another, especially so that |
Sure, and? This is how Rust works. If you what, you can box buffers, but it would not affect the performance in any way. |
One would have to box the buffers inside |
Other:
|
Yes. This are some leftovers from the old version. But the are no interesting error in ttf-parser either, since it simply skips malformed tables. |
Well, implementing this in KAS-text wasn't hard (mostly copy+paste from HarfBuzz code): #23 |
Nice! |
For text renderers, it would be useful if rather than this method taking an owned If that was already the plan, I think Awesome library, by the way! |
@AldaronLau Yes, this is a common request for ttf-parser, there is even owned_ttf_parser. But the problem is that ttf-parser designed to work on a borrowed data. It doesn't do heap allocations at all. On the other hand, ttf-parser::Face creation is basically free compared to the shaping process itself. So it shouldn't be a bottleneck. |
@RazrFalcon Thanks for the clarification. I didn't know it was basically free to create one. |
@AldaronLau Judging by ttf-parser benchmarks, a |
It should be noted that in contrast to ttf-parser's |
@laurmaedje Oh, I forgot about it. I thought it allocated only before the shaping itself and not on font creation. |
In any case it sounds like it's not a problem to have both a |
@laurmaedje Either way, the only |
@AldaronLau Yes, I guess |
@AldaronLau That's true, but in any case I wanted to point out that rustybuzz's The |
Any thoughts on implementing this through the traits |
I haven't looked into this yet. |
Hey @RazrFalcon, just looking over your API for use in KAS-text and I have a few comments.
I notice that
Face
is a wrapper aroundttf-parser::Face
, which KAS-text already has an instance of. I can supply the data pointer and face index no problem, but I could also directly supply a&'a Face
(or possibly even just store therustybuzz::Face
the embeddedttf-parser::Face
could still be accessed). But this isn't really important.More significant, KAS-text stores text-runs with a
FontId
(index in internal list) plus a size (DPU
aka pixels per font unit). I see yourFace
object embeds the size. For my purposes would storing a singleFace
and adjusting the size before each shaping run be the best option?Your
GlyphBuffer
reportscodepoint
andcluster
. KAS-text needs the text-index of each glyph (required for editing support), and trying to reconstruct this from codepoints is not ideal.I see you use the same
UnicodeBuffer ←→ GlyphBuffer
model as HarfBuzz. I'm not sure how best to cache this type since it is consumed by value in theshape
method. Maybe it would be better ifUnicodeBuffer
andGlyphBuffer
were wrappers aroundBox<Buffer>
to avoid large copies? Or does the optimiser avoid this issue anyway?The text was updated successfully, but these errors were encountered: