[Alephmodular-devel] Font musing
Status: Pre-Alpha
Brought to you by:
brefin
|
From: Br'fin <br...@ma...> - 2003-09-16 03:59:12
|
Mrrf, mis-sent initially.
Trying to fight with fonts conceptually. Did a first pass of using
CFontSpec in the submitted code. But I've been a little unhappy with
hashing out the issues of ownership and responsibility for fonts.
Drawing Context is the most convenient things to get fonts from
Buffer makes the most sense in terms of getting the right kind of font
(Assuming a given build will have access to both unaccelerated fonts as
well as access to OpenGL and thus need extra font info stored for that.)
Some kind of Font Repository also makes sense too.
Something that you can ask for "Monaco", 10, bold or I want the bold
variant of the font in this CFontSpec. Or that you might be able to ask
for a native representation thereof and it will perform appropriate
things and give you the right CFontSpec back.
I'm currently leaning more towards a platform neutral CFontSpec with
ids that should be known to some kind of central lookup. And you can
ask the lookup for the platform specific variant one needs
I don't know, sigh.
Create Buffer
Associate Buffer with Font Respository (Specific to platform and mode
(accelerate vs non))
Get Drawing Context
// Perform initial queries for required fonts
// (Should pre-load/cache fonts in Font Repository.
// For instance, OpenGL fonts may have overhead and need pre-loading)
globals.font_terminal_bold= buffer.get_font("monaco", 10, bold);
globals.font_hud_normal= buffer.get_font("helvetica", 12, normal);
Release Context
... later ...
Get drawing context
context.draw_text(globals.font_terminal_bold, "Wheee", 10, 10, black);
Sigh, still trying to wrap my head around this.
-Jeremy Parsons
|