[HarfBuzz] hb-view
Behdad Esfahbod
behdad at behdad.org
Thu Apr 21 14:49:14 PDT 2011
On 04/21/11 17:21, Adam Twardoch (List) wrote:
> So far so good!
Great!
> Two suggestions, which would make my, and some other people's, life
> wonderful:
>
> 1. Please add a --text-width option that would be mutually exclusive to
> the --font-size option (i.e. it would override it). If used, hb-view
> should render the text to a given width, i.e. calculate the appropriate
> font-size itself. It's quite trivial to make, of course, especially with
> your method of drawing the text twice. That would be tremendously
> useful. (So if I specify --text-width=480 and --margin=10, the result
> will always be 500 pixels/points wide).
That's a bit trickier than you'd imagine. I've done this before for a client.
The only way I can get really scalable text is to get the glyphs set for a
nominal size, convert to outlines using cairo, and scale the outline.
That said, when I add my own TT table handling, I may be able to just let go
of FreeType and then everything will be truly scalable (but not hinted).
> 2. Please add a --format option, which should take the values "png",
> "pdf", "svg" and "txt". This is very simple to do (using
> cairo_show_glyphs), but I'm sure you know that.
Right. I did this to pango-view, and will do with hb-view.
> Please bear in mind that it's the first time in my life that I touched
> some C or C++ code EVER. But your code was clear enough for me to figure
> out how to do it (especially when I realized that you get the size of
> the canvas by calling draw() twice).
I'm glad to hear that you are playing with the source!
> The "txt" format (which could be named differently, and could also be
> Json, or XML, I don't care), should output:
> * The actual font size used (useful with --text-width)
> * The dimensions of the text (width and height)
> * Tuples of (glyph IDs, x-pos, y-pos) used for rendering
Right. I'm still undecided whether I want this in a separate tool (that
wouldn't link to cairo) or in hb-view. Perhaps I add it as you suggest (with
format="xml" and format="js" or format="json" perhaps), and see how it goes.
> I think it should be no more than 1-2 hours, and you'd make me really
> happy. Plus, that would allow me to run REALLY extensive tests on LOTS
> of fonts -- which might help me find some potential bugs or problems.
True. I need that for hb's test suite too.
behdad
> Many thanks,
> Adam
More information about the HarfBuzz
mailing list