nanogui: Add Native font in compiler phase


Previous by date: 6 Dec 2006 23:20:06 +0000 Re: transparent support of PNG image, Greg Haerr
Next by date: 6 Dec 2006 23:20:06 +0000 Re: VTSWITCH vs. Timers vs. Sleep Mode, Greg Haerr
Previous in thread: 6 Dec 2006 23:20:06 +0000 Re: Add Native font in compiler phase, Ricardo P. Jasinski
Next in thread:

Subject: Re: [nanogui] Add Native font in compiler phase
From: "Greg Haerr" ####@####.####
Date: 6 Dec 2006 23:20:06 +0000
Message-Id: <06d601c7198d$1bf36e90$0300a8c0@RDP>

: I tried to put together the few steps necessary to add a new compiled-in
: font in microwindows/nano-x. Hope it helps.

Thanks, nice description.



:
: Also, if anyone could give me a hint, I would like to know how to switch
the
: default font used when drawing a window. I mean, I would like to draw half
: the screen using one font, and the other half with a different font. Can
: anyone give me a brief description on how to do that?

Assuming nano-X API:
fontid = GrCreateFont("Arial", 17, NULL);
GrSetGCFont(wid, font);

You'll need to have another fontid for the default
font, which is called "System"


: Step 1. Obtain a c-source file for the new font. In windows, this can be
: bone using the convfnt32.exe tool, for example. You can find this tool in
: src/fonts/tools. At this point, you will specify the font size and
attibutes
: (bold, italic, etc.). Be sure to respect font owner's copyrights.

Better yet, find .bdf source from a free font distribution,
and use tools/convbdf -c filename.  This option also allows
creating a .fnt file using the -f option which then doesn't
require anything to be linked into the server,but loaded
on demand.


:
: Step 2. Throw the resulting c-file (say, winArial4x12.c) in the src/fonts
: folder. You might want to fix the declaration of the offset table (look
for
: the comment /* Character->glyph data. */) from 'static unsigned short' to
: 'static unsigned long', as suggested by Greg.

Or, change the source to cnvfnt32.c ,and recompile the tool.



: Note: a better approach would be changing your default font in compile
time
: using the specific nano-x functions, but for now I don't know how to do
: this. Any ideas? Thanks!!

See above, and look at all those font demos I wrote:
src/demo*.sh, src/demos/nanox.

Regards,

Greg




Previous by date: 6 Dec 2006 23:20:06 +0000 Re: transparent support of PNG image, Greg Haerr
Next by date: 6 Dec 2006 23:20:06 +0000 Re: VTSWITCH vs. Timers vs. Sleep Mode, Greg Haerr
Previous in thread: 6 Dec 2006 23:20:06 +0000 Re: Add Native font in compiler phase, Ricardo P. Jasinski
Next in thread:


Powered by ezmlm-browse 0.20.