[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xfree-fonts
Subject:    Re: [Fonts] Complex text layout and mapping screen coordinates
From:       Keyur Shroff <keyur_shroff () yahoo ! com>
Date:       2002-02-26 8:57:17
[Download RAW message or body]


--- Joseph Koshy <jkoshy@FreeBSD.ORG> wrote:
> 
> 
> >>>> "as" == "Arun Sharma", "keithp" == "Keith Packard"
> 
> as> Do you think interpreting the argument to
> XDrawString()
> as> as a sequence of character codes instead of a glyph
> string would be a
> as> violation of the X protocol ?
> 
> keithp> Yes.  The protocol specification says that the
> glyphs are
> keithp> directly indexed by the character codes delivered
> over the wire.
> 
> as> Yes to bad idea or Yes to illegal (i.e. violation of
> the protocol) ?
> 
> Both.
> 
> The X protocol is not specified in terms of code points
> of character sets.

See 'man XDrawString'. See the defination of "string"

     string    Specifies the character string.


Also see the first line in description of PolyText16 on
Page 57 of protocol specification.

   "This request is similar to PolyText8,except 2-byte (or
    16-bit) characters are used."

The description of ImageText16 says the same.

See description of QueryTextExtents on Page 40.

   "This request returns the logical extents of the
    specified string of characters in the specified font."


At all these places I found the indication of using
character string in protocol request? Where are the glyph
codes?

Also, TrueType fonts have some mapping table which maps
from character codes to glyph codes. If these TrueType
fonts are used by the Xserver and they do have such mapping
tables then what a client is expected to send? character
codes or glyph codes? Also the font resources are kept by
the server and font renderer. Client has no direct access
to it. So how can client decide which glyph is being used
for a character? Or can we say that all fonts in which
"character codes != glyph codes" are not usable on the
server side because protocol doesn't allow us to send
character codes? Then why FreeType renderer is there in
XFree86 doing mapping from "character code" to "glyph
code"?

Also, we pass character codes in XUtf8DrawString and
XmbDrawString. Where the conversion from character string
to glyph string takes place? 


Can someone clear my doubts about passing character string
in protocol request?

> 
> Further, it is a bad idea to move code point rendering
> into the X
> server, because the process of rendering code points into
> visible artifacts is, in general, application dependent.

This is really font specific which can be controlled by the
application. It is at the sole discretion of font designer
to decide which glyph to use for visual representation of a
character. The font designer may give freedom to
application to control this behaviour.

> 
> as> Is it fair to say that the X protocol doesn't
> interpret those values (as
> as> either character codes or glyph codes) and just uses
> them as "numbers"
> as> used to index a font file ?
> 
> Isn't the phrase "directly indexed" clear enough?

Nowhere in the protocol specification I found the word
"directly indexed".

> 
> The X specification says that its fonts are conceptually
> arrays of
> glyphs and the values specified in the text drawing
> requests are used to index into this array.

In the specification following is the defination of "Font"

  "A font is a matrix of glyphs (typically characters).
   The protocol does no translation or inter-pretation of
   character sets. The client simply indicates values used
   to index the glyph array. A font contains additional
   metric information to determine interglyph and interline
   spacing."

Does it say that "values used to index the glyph array" are
glyph indices? Can't we assume that character codes are
"values used to index the glyph array (may be using some
intermediate mapping table)"?

> You can have a linear (one byte index) or two-dimensional
> index.
> 
> Given a glyph index, the glyph retrieval operation can be
> expressed as:
> 
>   one_glyph's_bits = glyph_table_of_font(one-glyph-index)
> 
> The important points here are:
> 
> o An implementation needs to ensure that a given glyph
> index into a font
>   always selects the same glyph (i.e no context
> sensitivity allowed).
>
> o An implementation is not allowed to substitute a
> sequence of glyphs
>   with another (i.e no ligatures).

Then why mapping tables are there in the font renderer?

> 
> o An implementation is not allowed to reorder glyphs (as
> would be needed
>   when rendering some indic scripts).
> 
> o An implementation is not allowed to place glyphs at
> anything other
>   than the /precise/ positions in the request (i.e. no
> kerning).
> 

Will you please give us the pointers of these in the
protocol specification?

- Keyur



__________________________________________________
Do You Yahoo!?
Yahoo! Sports - Coverage of the 2002 Olympic Games
http://sports.yahoo.com
_______________________________________________
Fonts mailing list
Fonts@XFree86.Org
http://XFree86.Org/mailman/listinfo/fonts
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic