/[freetype]/freetype2/src/tools/glnames.py
ViewVC logotype

Diff of /freetype2/src/tools/glnames.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.7 by wl, Thu Mar 10 06:28:07 2005 UTC revision 1.8 by freetype, Thu Mar 10 18:31:49 2005 UTC
# Line 4758  class StringTable: Line 4758  class StringTable:
4758      write( line + "\n  };\n\n\n" )      write( line + "\n  };\n\n\n" )
4759    
4760    
4761    #
4762    # here's an explanation about the way we now store the Adobe Glyph List.
4763    # First of all, we store the list as a tree. Consider for example that
4764    # you want to store the following name mapping:
4765    #
4766    #  A         => 1
4767    #  Aacute    => 6
4768    #  Abalon    => 2
4769    #  Abstract  => 4
4770    #
4771    # it's possible to store them in a tree, as in:
4772    #
4773    #  A => 1
4774    #  |
4775    #  +-acute => 6
4776    #  |
4777    #  +-b
4778    #    |
4779    #    +-alone => 2
4780    #    |
4781    #    +-stract => 4
4782    #
4783    # we see that each node in the tree has:
4784    #
4785    # - one or more 'letters'
4786    # - an optional value
4787    # - zero or more child nodes
4788    #
4789    # you can build such a tree with:
4790    #
4791    #   root = StringNode( "",0 )
4792    #   for word in map.values():
4793    #     root.add(word,map[word])
4794    #
4795    # this will create a large tree where each node has only one letter
4796    # then call:
4797    #
4798    #   root = root.optimize()
4799    #
4800    # which will optimize the tree by mergin the letters of successive
4801    # nodes whenever possible
4802    #
4803    # now, each node of the tree is stored as follows in the table:
4804    #
4805    #   - first the node's letters, according to the following scheme:
4806    #
4807    #
4808    #         name         bitsize     description
4809    #         -----------------------------------------
4810    #         notlast            1     set to 1 if this is not the last letter
4811    #                                  in the word
4812    #         ascii              7     the letter's ASCII value
4813    #
4814    #   - then, the children count and optional value:
4815    #
4816    #         name         bitsize     description
4817    #         -----------------------------------------
4818    #         hasvalue           1     set to 1 if a 16-bit Unicode value follows
4819    #         num_children       7     number of childrens. can be 0 only if
4820    #                                  'hasvalue' is set to 1
4821    #         if (hasvalue)
4822    #           value           16     optional Unicode value
4823    #
4824    #   - followed by the list of 16-bit absolute offsets to the children.
4825    #     Children must be sorted in increasing order of their first letter.
4826    #
4827    # All 16-bit quantities are stored in big-endian. If you don't know why,
4828    # you've never debugged this kind of code ;-)
4829    #
4830    # Finally, the root node has first letter = 0, and no value.
4831    #
4832  class StringNode:  class StringNode:
4833    def __init__( self, letter, value ):    def __init__( self, letter, value ):
4834      self.letter   = letter      self.letter   = letter

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26