On Thu, Feb 21, 2002 at 01:46:25AM +0530, Tapan S. Parikh wrote:
>
>
> > The proposed new algorithm:
> >
> > FindPosition(textpos, startx, pixel_width)
> > // Make a single request to the X Server - this doesn't exist in
> > // the X protocol yet
> > nchars = XComputeWidth(textbuf[textpos:end-of-line], startx, pixel_width,
> > // other args font etc)
> >
> > // everything starting from textpos to textpos + nchars is "selected"
> >
>
> Is textbuf supposed to be modified and returned by XComputeWidth?
No. Textbuf contains character codes. The reordering happens on glyph
codes. The X server could do the complex mapping from character ->
glyph including reordering etc, then compute the width and return the result.
The client is completely ignorant about the glyph codes.
XComputeWidth, XPolyText' (a brand new request, which uses character
codes) and friends could potentially be in an X extension for a server side
implementation.
> 2) From this inadequate knowledge, it seems to me that the philosophies of
> Open Type Fonts / True Type Fonts and X may not match so well together, in
> that the X Server expects clients to send glyph codes, but fonts are
> maintained server-side (not a big deal if char codes _are_ glyph codes),
> while in the TTF/OTF world, the font files contain the neccesary
> information for doing char-glyph mapping. It seems in X both Server and
> Client would need open type font info (the client for doing char->glyph
> mapping, the server for doing rfendering, positioning, etc.) Somewhat of a
> catch-22, or am I missing something?
TTF and OTF were designed primarily for Windows/Mac environment, where
network transparent protocols aren't the main issue.
In the client side rendering model, the X server (or the X font server)
will have to open the OTF file, parse the cmap tables, respond to client
requests for the font information. The client uses that information to
compute the ordering of the glyphs and sends PolyText requests to draw
the glyphs.
Thus information originates in the X server (or the font
server and then moves to the X server), goes to the client, where all
the heavy duty stuff happens, comes back to the server in the form of a
sequence of glyph codes and rendered by the X server. This imposes some
network traffic overhead, unless cached on the client.
In the server side model, the code moves to where the data is - the X
server, thereby reducing the network overhead. Some overhead is added
because character codes occupy more bytes than glyph codes. It's not
clear to me which one is the dominant overhead - some empirical data
would be useful.
-Arun
|