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

Re: XML file format - Linux vs Windows



On Tue, 18 Jun 2002, Cyrille Chepelov wrote:
> Le Tue, Jun 18, 2002, à 01:37:13PM -0500, Lars Clausen a écrit:
> 
> 
>> It's not a question of saving the bounding boxes.  The problem is that
>> the size of the text determines the size of the surrounding box.  If the
>> text doesn't scale linearly, the size of the box is indeterminate.
> 
> 
> By the way, I think I've got a (slow ?) idea on how to perform scaling:
> 
> * compute the text extents at scale 100%
> * if scale != 100%:
> 	font_scale = scale.
> 	while (1):
> 		compute the text extents for font size (size * font_scale).
> 		if (computed extents < (scale * 100%_extents)):
> 			break
> 		else:
> 			font_scale *= 0.95
> 
> This way, in the worst case, we would display slightly smaller text than
> what the scaling factor requires; however, we'd still use a bounding box
> linear to the 100% bounding box (thinking about it, with the hinting and all
> that stuff, I see no way for text to scale linearly under a certain size).
> 
> That might require a little surgery in the Renderers (basically, instead
> of calling renderer->set_font(renderer,font,height), we'd call
> renderer->set_font(renderer,font,nominal_height,scaling_factor);
> 
> Same for renderer->get_text_width(), of course.
> 
> Does that sound good or rubbish ?

So this way we're sure that the bounding box does contain the text, but the
text will occasionally look too short.  It's an option, I guess.  The
alternative may be to render the font in a big enough size that it's
linear, then scale it down by hand.  Not a pretty solution, but a little
caching can go a long way.

-Lars

-- 
Lars Clausen (http://shasta.cs.uiuc.edu/~lrclause)| Hårdgrim of Numenor
"I do not agree with a word that you say, but I   |----------------------------
will defend to the death your right to say it."   | Where are we going, and
    --Evelyn Beatrice Hall paraphrasing Voltaire  | what's with the handbasket?


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index] Mail converted by Mofo Magic and the Flying D

 
All trademarks and copyrights are the property of their respective owners.

Other Directory Sites: SeekWonder | Directory Owners Forum

GuideSMACK