X-Authentication-Warning: delorie.com: mail set sender to geda-user-bounces using -f X-Recipient: geda-user AT delorie DOT com Message-ID: <51E599BA.5080402@sonic.net> Date: Tue, 16 Jul 2013 12:06:34 -0700 From: Dave Curtis User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121028 Thunderbird/16.0.2 MIME-Version: 1.0 To: geda-user AT delorie DOT com Subject: Re: [geda-user] gschem cairo text measure References: <51CCD179 DOT 7010903 AT sonic DOT net> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Reply-To: geda-user AT delorie DOT com On 07/16/2013 09:13 AM, Roland Lutz wrote: > On Thu, 27 Jun 2013, Dave Curtis wrote: >> I'm not very familiar with Cairo, but I've managed to come up with >> something that appears to work, but it relies heavily on a magic >> number that I arrived at empirically. > >> _gschemScalingConstant = 10000.0/555.0 # Magic number > > Maybe you are interested in this constant from > libgeda/src/o_text_basic.c: > > /*! \brief Scale factor between legacy gschem font units and > postscript points. > * > * \par Description > * gschem fonts are nominally specified in points, however there is a > * difference in how the specified font size corresponds to the > metrics of > * the font when compared to typical typographic usage. > * > * The following factor was impirically determined to approximately > match the > * cap-height between the legacy gschem font, and fonts rendered > using pango. > */ > #define GEDA_FONT_FACTOR 1.3 > > This factor has been empirically determined, too; it's 1.3, not 18, > though, so this is probably not exactly what you are looking for. Thanks for the code snippet. It must somehow be scaling something different, because 1.3 is not very close to 18. That's a bit of a mystery. I note that their comment is looking at the cap-height of the fonts. In my case, I was only interested in the text width measurement. So I arrived at my magic number by measuring in gschem the width of "The quick brown fox..." in both caps and lower case, in 10 and 8 point Ariel. It turns out that my symbols are looking pretty decent with that scaling. I wish I knew why, but I'll take it. Thanks! -dave > > Roland >