New text metric procedure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hey all.

Sorry to just blurt onto the developer list like this, but the nice
folks on #GIMP said that this was the place for such contributions.

I was looking through the PDB for a good procedure to return the
metrics of a text string a la gdk_string_extents() but all I could
find was gimp-text-get-extents. Unfortunately it returns the ascent
and descent of the font, not of the characters in the current string.

So, if you need to align the baselines of two or more strings in
potentially different fonts and/or sizes (I do), you're stuck. Maybe
there is some way to do it with the functions that are available, but
if so then I am too dumb to figure out what that approach might be,
and there are probably a lot of people at least as dumb as me out
there who would get similarly stuck.

The attached patch to 1.1.25 is my solution, two new functions
text_get_string_extents and text_get_string_extents_fontname, that
provide the "real" ascent and descent info, as well as the lbearing
and rbearing of the string. It's really just a map-through to
gdk_string_extents(), but it solves my problem so I thought I would
throw it out there for general consumption.

If someone could tell me how to submit this to the development I would
greatly appreciate it. Also, if someone wants to point out the obvious
"other" solution that I could have used (if one exists), that would be
edifying.

Nick Marden - nick@xxxxxxxxxx (New numbers - please note!)
(T) 781-455-0675 (C) 781-929-5279 (F) 781-455-6278

Attachment: patch.string_extents
Description: Binary data


[Index of Archives]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [GIMP for Windows]     [KDE]     [GEGL]     [Gimp's Home]     [Gimp on GUI]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux