Re: [Alephmodular-devel] CFontSpec musing
Status: Pre-Alpha
Brought to you by:
brefin
|
From: Br'fin <br...@ma...> - 2003-09-03 19:56:44
|
Grunt, Half back to the drawing board on CFontSpec. Not that I don't
want to do the following things. But because CFontSpec itself seemed to
be getting out of hand for a relatively 'simple' class.
I think I'm going to simplify the class, then try to work through
things again, forcing back and around on code paths that currently use
TextSpecs.
-Jeremy Parsons
On Monday, September 1, 2003, at 01:51 AM, Br'fin wrote:
> Following is what I'm currently trying to setup for handling
> CFontSpecs ... a combination of font, size, and style.
>
> Oddly enough, all the details you think might be here aren't.
>
> Constructing a CFontSpec_Impl is left to the drawing context. As are
> most of the ways one would access things such as text width. And most
> of the interesting details are all stored in the platform specific
> implementation (Not yet devised)
>
> Usage might go something like
>
> CBuffer::Context context=buffer.get_drawing_context()
> CFontSpec my_font(context->get_font("Monaco", 24, CFontSpec::bold));
> int height= context->get_font_height(my_font);
> int width= context->get_text_width("Hello world", my_font);
> context->draw_text("Hello world", CPoint(0, 0), my_font,
> CColor::white);
>
> I decided to have all access through the context as the font may be
> specific (and cached) for the current buffer. (An OpenGL font spec,
> for instance, would probably own the storage of the appropriate
> display lists for each character.) Also, the context may have need to
> finesse the resulting values of these functions.
>
> For instance, I'm thinking of a scaled buffer type. (The actual buffer
> is perhaps the whole screen, but only claims to be 640x480) Where the
> drawing context is the main agent performing the transformations.
> Deciding that it should use large point sizes and the like. And
> needing to do two way transformations.
>
> Scaling is 2x
> Request for 24 point font becomes a 48 point font
> Request for text width fetches the actual value, then divides by two
> Request to draw at 0, 10 is changed into drawing at 0, 20
> etc, etc
>
> -Jeremy Parsons
>
|