[comp.windows.x] Changing fonts on the fly

argv%eureka@Sun.COM (Dan Heller) (05/18/89)

I'd like to be able to make a request to the server to change
certain attributes about a font during the runtime of my application.

Currently, I create fonts on the fly in the application according
to the zoom factor of the page and display pixels per inch of the
screen, etc... The glyphs of the font are stored in pixmaps and cached.
When the user types, the glyph is CopyArea'd onto the window and the
caret advances occording to the info about the char as well as word 
and letter spacing, etc...  When reflowing of the text is necessary,
there are quite a bit of copyareas that really hit the network layer
and slow down the application.

One of the ways being considered to improve performance is the idea
of using XDrawString and specify the string and font to be used.  But
to do this, the font has to be uploaded to the server.  If the zoom
level changes, then I can redraw the characters of the font, modify
the XFontStruct info and send all this to the server.

The changing of the zoom level is only one reason that the font info
might change.  Because there is a cache of fonts, I'd like to be able
to have a "scratch font" in which I can modify any particular value.
That is, "A" doesn't have to render an image that looks like an A, but
the fact that the glyph in that position is known to my application as
rendering a specific glyph.  Again, this buys me the ability to use
XDrawString to render a stream of pixmaps easily and quickly.

    dan  <argv@sun.com>
    dan  <argv@sun.com>