1. A computer-implemented method to process text in an electronic document including text defined by a string that includes one or more references, each reference representing a character in the text, the method comprising: performing operations by a programmable processor of a computer, the operations comprising: parsing the string to identify a reference, the reference representing a first character in the text; based on the identified reference, identifying a glyphlet embedded in the electronic document and stored with the electronic document in a memory of the computer, the glyphlet being a data structure including both a set of one or more character attributes defining semantic information of the first character and a set of one or more glyph attributes defining appearance information from which a glyph image of a glyph representing the first character can be rendered, the glyph attributes including all the information necessary to render the glyph image; and using one or more character attributes or glyph attributes for the identified glyphlet to process text in the electronic document, including using the set of character attributes of the glyphlet to process semantic information of the first character or using the set of glyph attributes of the glyphlet to process appearance information for a representation of the first character.