1ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 2ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/* 3ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 4ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * (C) Copyright IBM Corp. 1998-2007 - All Rights Reserved 5ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 6ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 7ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 8ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#ifndef __LEFONTINSTANCE_H 9ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#define __LEFONTINSTANCE_H 10ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 11ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "LETypes.h" 12ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/** 13ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * \file 14ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * \brief C++ API: Layout Engine Font Instance object 15ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 16ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 17ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruU_NAMESPACE_BEGIN 18ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 19ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/** 20ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Instances of this class are used by <code>LEFontInstance::mapCharsToGlyphs</code> and 21ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <code>LEFontInstance::mapCharToGlyph</code> to adjust character codes before the character 22ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * to glyph mapping process. Examples of this are filtering out control characters 23ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * and character mirroring - replacing a character which has both a left and a right 24ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * hand form with the opposite form. 25ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 26ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 27ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 28ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruclass LECharMapper /* not : public UObject because this is an interface/mixin class */ 29ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 30ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Querupublic: 31ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 32ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Destructor. 33ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 34ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 35ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual ~LECharMapper(); 36ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 37ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 38ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This method does the adjustments. 39ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 40ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param ch - the input character 41ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 42ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the adjusted character 43ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 44ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.8 45ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 46ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual LEUnicode32 mapChar(LEUnicode32 ch) const = 0; 47ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru}; 48ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 49ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/** 50ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This is a forward reference to the class which holds the per-glyph 51ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * storage. 52ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 53ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.0 54ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 55ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruclass LEGlyphStorage; 56ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 57ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/** 58ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This is a virtual base class that serves as the interface between a LayoutEngine 59ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * and the platform font environment. It allows a LayoutEngine to access font tables, do 60ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * character to glyph mapping, and obtain metrics information without knowing any platform 61ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * specific details. There are also a few utility methods for converting between points, 62ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * pixels and funits. (font design units) 63ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 64ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * An instance of an <code>LEFontInstance</code> represents a font at a particular point 65ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * size. Each instance can represent either a single physical font, or a composite font. 66ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * A composite font is a collection of physical fonts, each of which contains a subset of 67ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * the characters contained in the composite font. 68ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 69ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Note: with the exception of <code>getSubFont</code>, the methods in this class only 70ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * make sense for a physical font. If you have an <code>LEFontInstance</code> which 71ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * represents a composite font you should only call the methods below which have 72ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * an <code>LEGlyphID</code>, an <code>LEUnicode</code> or an <code>LEUnicode32</code> 73ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * as one of the arguments because these can be used to select a particular subfont. 74ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 75ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Subclasses which implement composite fonts should supply an implementation of these 76ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * methods with some default behavior such as returning constant values, or using the 77ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * values from the first subfont. 78ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 79ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.0 80ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 81ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruclass U_LAYOUT_API LEFontInstance : public UObject 82ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 83ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Querupublic: 84ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 85ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 86ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This virtual destructor is here so that the subclass 87ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * destructors can be invoked through the base class. 88ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 89ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.8 90ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 91ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual ~LEFontInstance(); 92ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 93ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 94ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Get a physical font which can render the given text. For composite fonts, 95ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * if there is no single physical font which can render all of the text, 96ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * return a physical font which can render an initial substring of the text, 97ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * and set the <code>offset</code> parameter to the end of that substring. 98ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 99ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Internally, the LayoutEngine works with runs of text all in the same 100ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * font and script, so it is best to call this method with text which is 101ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * in a single script, passing the script code in as a hint. If you don't 102ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * know the script of the text, you can use zero, which is the script code 103ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * for characters used in more than one script. 104ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 105ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * The default implementation of this method is intended for instances of 106ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <code>LEFontInstance</code> which represent a physical font. It returns 107ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <code>this</code> and indicates that the entire string can be rendered. 108ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 109ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This method will return a valid <code>LEFontInstance</code> unless you 110ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * have passed illegal parameters, or an internal error has been encountered. 111ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * For composite fonts, it may return the warning <code>LE_NO_SUBFONT_WARNING</code> 112ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * to indicate that the returned font may not be able to render all of 113ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * the text. Whenever a valid font is returned, the <code>offset</code> parameter 114ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * will be advanced by at least one. 115ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 116ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Subclasses which implement composite fonts must override this method. 117ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Where it makes sense, they should use the script code as a hint to render 118ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * characters from the COMMON script in the font which is used for the given 119ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * script. For example, if the input text is a series of Arabic words separated 120ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * by spaces, and the script code passed in is <code>arabScriptCode</code> you 121ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * should return the font used for Arabic characters for all of the input text, 122ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * including the spaces. If, on the other hand, the input text contains characters 123ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * which cannot be rendered by the font used for Arabic characters, but which can 124ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * be rendered by another font, you should return that font for those characters. 125ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 126ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param chars - the array of Unicode characters. 127ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param offset - a pointer to the starting offset in the text. On exit this 128ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * will be set the the limit offset of the text which can be 129ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * rendered using the returned font. 130ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param limit - the limit offset for the input text. 131ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param script - the script hint. 132ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param success - set to an error code if the arguments are illegal, or no font 133ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * can be returned for some reason. May also be set to 134ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <code>LE_NO_SUBFONT_WARNING</code> if the subfont which 135ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * was returned cannot render all of the text. 136ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 137ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return an <code>LEFontInstance</code> for the sub font which can render the characters, or 138ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <code>NULL</code> if there is an error. 139ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 140ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see LEScripts.h 141ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 142ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 143ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 144ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual const LEFontInstance *getSubFont(const LEUnicode chars[], le_int32 *offset, le_int32 limit, le_int32 script, LEErrorCode &success) const; 145ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 146ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // 147ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // Font file access 148ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // 149ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 150ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 151ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This method reads a table from the font. Note that in general, 152ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * it only makes sense to call this method on an <code>LEFontInstance</code> 153ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * which represents a physical font - i.e. one which has been returned by 154ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <code>getSubFont()</code>. This is because each subfont in a composite font 155ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * will have different tables, and there's no way to know which subfont to access. 156ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 157ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Subclasses which represent composite fonts should always return <code>NULL</code>. 158ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 159ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param tableTag - the four byte table tag. (e.g. 'cmap') 160ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 161ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the address of the table in memory, or <code>NULL</code> 162ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * if the table doesn't exist. 163ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 164ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.8 165ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 166ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual const void *getFontTable(LETag tableTag) const = 0; 167ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 168ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 169ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This method is used to determine if the font can 170ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * render the given character. This can usually be done 171ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * by looking the character up in the font's character 172ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * to glyph mapping. 173ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 174ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * The default implementation of this method will return 175ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <code>TRUE</code> if <code>mapCharToGlyph(ch)</code> 176ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * returns a non-zero value. 177ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 178ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param ch - the character to be tested 179ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 180ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return <code>TRUE</code> if the font can render ch. 181ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 182ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 183ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 184ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual le_bool canDisplay(LEUnicode32 ch) const; 185ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 186ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 187ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This method returns the number of design units in 188ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * the font's EM square. 189ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 190ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the number of design units pre EM. 191ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 192ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.8 193ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 194ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual le_int32 getUnitsPerEM() const = 0; 195ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 196ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 197ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This method maps an array of character codes to an array of glyph 198ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * indices, using the font's character to glyph map. 199ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 200ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * The default implementation iterates over all of the characters and calls 201ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <code>mapCharToGlyph(ch, mapper)</code> on each one. It also handles surrogate 202ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * characters, storing the glyph ID for the high surrogate, and a deleted glyph (0xFFFF) 203ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * for the low surrogate. 204ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 205ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Most sublcasses will not need to implement this method. 206ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 207ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param chars - the character array 208ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param offset - the index of the first character 209ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param count - the number of characters 210ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param reverse - if <code>TRUE</code>, store the glyph indices in reverse order. 211ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param mapper - the character mapper. 212ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param filterZeroWidth - <code>TRUE</code> if ZWJ / ZWNJ characters should map to a glyph w/ no contours. 213ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param glyphStorage - the object which contains the output glyph array 214ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 215ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see LECharMapper 216ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 217ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.6 218ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 219ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void mapCharsToGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, const LECharMapper *mapper, le_bool filterZeroWidth, LEGlyphStorage &glyphStorage) const; 220ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 221ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 222ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This method maps a single character to a glyph index, using the 223ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * font's character to glyph map. The default implementation of this 224ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * method calls the mapper, and then calls <code>mapCharToGlyph(mappedCh)</code>. 225ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 226ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param ch - the character 227ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param mapper - the character mapper 228ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param filterZeroWidth - <code>TRUE</code> if ZWJ / ZWNJ characters should map to a glyph w/ no contours. 229ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 230ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the glyph index 231ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 232ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see LECharMapper 233ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 234ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.6 235ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 236ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual LEGlyphID mapCharToGlyph(LEUnicode32 ch, const LECharMapper *mapper, le_bool filterZeroWidth) const; 237ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 238ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 239ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This method maps a single character to a glyph index, using the 240ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * font's character to glyph map. The default implementation of this 241ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * method calls the mapper, and then calls <code>mapCharToGlyph(mappedCh)</code>. 242ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 243ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param ch - the character 244ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param mapper - the character mapper 245ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 246ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the glyph index 247ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 248ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see LECharMapper 249ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 250ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 251ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 252ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual LEGlyphID mapCharToGlyph(LEUnicode32 ch, const LECharMapper *mapper) const; 253ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 254ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 255ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This method maps a single character to a glyph index, using the 256ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * font's character to glyph map. There is no default implementation 257ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * of this method because it requires information about the platform 258ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * font implementation. 259ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 260ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param ch - the character 261ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 262ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the glyph index 263ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 264ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 265ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 266ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual LEGlyphID mapCharToGlyph(LEUnicode32 ch) const = 0; 267ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 268ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // 269ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // Metrics 270ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // 271ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 272ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 273ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This method gets the X and Y advance of a particular glyph, in pixels. 274ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 275ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param glyph - the glyph index 276ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param advance - the X and Y pixel values will be stored here 277ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 278ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 279ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 280ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void getGlyphAdvance(LEGlyphID glyph, LEPoint &advance) const = 0; 281ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 282ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 283ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This method gets the hinted X and Y pixel coordinates of a particular 284ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * point in the outline of the given glyph. 285ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 286ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param glyph - the glyph index 287ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param pointNumber - the number of the point 288ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param point - the point's X and Y pixel values will be stored here 289ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 290ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return <code>TRUE</code> if the point coordinates could be stored. 291ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 292ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.8 293ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 294ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual le_bool getGlyphPoint(LEGlyphID glyph, le_int32 pointNumber, LEPoint &point) const = 0; 295ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 296ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 297ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This method returns the width of the font's EM square 298ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * in pixels. 299ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 300ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the pixel width of the EM square 301ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 302ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.8 303ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 304ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual float getXPixelsPerEm() const = 0; 305ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 306ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 307ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This method returns the height of the font's EM square 308ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * in pixels. 309ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 310ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the pixel height of the EM square 311ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 312ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.8 313ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 314ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual float getYPixelsPerEm() const = 0; 315ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 316ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 317ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This method converts font design units in the 318ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * X direction to points. 319ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 320ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param xUnits - design units in the X direction 321ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 322ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return points in the X direction 323ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 324ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 325ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 326ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual float xUnitsToPoints(float xUnits) const; 327ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 328ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 329ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This method converts font design units in the 330ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Y direction to points. 331ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 332ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param yUnits - design units in the Y direction 333ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 334ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return points in the Y direction 335ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 336ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 337ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 338ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual float yUnitsToPoints(float yUnits) const; 339ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 340ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 341ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This method converts font design units to points. 342ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 343ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param units - X and Y design units 344ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param points - set to X and Y points 345ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 346ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 347ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 348ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void unitsToPoints(LEPoint &units, LEPoint &points) const; 349ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 350ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 351ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This method converts pixels in the 352ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * X direction to font design units. 353ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 354ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param xPixels - pixels in the X direction 355ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 356ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return font design units in the X direction 357ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 358ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 359ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 360ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual float xPixelsToUnits(float xPixels) const; 361ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 362ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 363ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This method converts pixels in the 364ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Y direction to font design units. 365ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 366ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param yPixels - pixels in the Y direction 367ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 368ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return font design units in the Y direction 369ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 370ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 371ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 372ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual float yPixelsToUnits(float yPixels) const; 373ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 374ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 375ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This method converts pixels to font design units. 376ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 377ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param pixels - X and Y pixel 378ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param units - set to X and Y font design units 379ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 380ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 381ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 382ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void pixelsToUnits(LEPoint &pixels, LEPoint &units) const; 383ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 384ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 385ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Get the X scale factor from the font's transform. The default 386ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * implementation of <code>transformFunits()</code> will call this method. 387ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 388ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the X scale factor. 389ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 390ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 391ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see transformFunits 392ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 393ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 394ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 395ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual float getScaleFactorX() const = 0; 396ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 397ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 398ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Get the Y scale factor from the font's transform. The default 399ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * implementation of <code>transformFunits()</code> will call this method. 400ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 401ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the Yscale factor. 402ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 403ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see transformFunits 404ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 405ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 406ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 407ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual float getScaleFactorY() const = 0; 408ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 409ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 410ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This method transforms an X, Y point in font design units to a 411ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * pixel coordinate, applying the font's transform. The default 412ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * implementation of this method calls <code>getScaleFactorX()</code> 413ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * and <code>getScaleFactorY()</code>. 414ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 415ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param xFunits - the X coordinate in font design units 416ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param yFunits - the Y coordinate in font design units 417ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param pixels - the tranformed co-ordinate in pixels 418ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 419ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see getScaleFactorX 420ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see getScaleFactorY 421ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 422ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 423ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 424ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void transformFunits(float xFunits, float yFunits, LEPoint &pixels) const; 425ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 426ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 427ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This is a convenience method used to convert 428ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * values in a 16.16 fixed point format to floating point. 429ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 430ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param fixed - the fixed point value 431ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 432ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the floating point value 433ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 434ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.8 435ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 436ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru static inline float fixedToFloat(le_int32 fixed); 437ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 438ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 439ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This is a convenience method used to convert 440ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * floating point values to 16.16 fixed point format. 441ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 442ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param theFloat - the floating point value 443ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 444ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the fixed point value 445ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 446ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.8 447ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 448ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru static inline le_int32 floatToFixed(float theFloat); 449ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 450ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // 451ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // These methods won't ever be called by the LayoutEngine, 452ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // but are useful for clients of <code>LEFontInstance</code> who 453ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // need to render text. 454ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // 455ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 456ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 457ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Get the font's ascent. 458ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 459ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the font's ascent, in points. This value 460ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * will always be positive. 461ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 462ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 463ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 464ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual le_int32 getAscent() const = 0; 465ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 466ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 467ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Get the font's descent. 468ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 469ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the font's descent, in points. This value 470ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * will always be positive. 471ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 472ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 473ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 474ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual le_int32 getDescent() const = 0; 475ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 476ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 477ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Get the font's leading. 478ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 479ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the font's leading, in points. This value 480ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * will always be positive. 481ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 482ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 483ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 484ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual le_int32 getLeading() const = 0; 485ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 486ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 487ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Get the line height required to display text in 488ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * this font. The default implementation of this method 489ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * returns the sum of the ascent, descent, and leading. 490ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 491ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the line height, in points. This vaule will 492ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * always be positive. 493ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 494ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 495ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 496ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual le_int32 getLineHeight() const; 497ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 498ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 499ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * ICU "poor man's RTTI", returns a UClassID for the actual class. 500ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 501ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 502ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 503ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual UClassID getDynamicClassID() const; 504ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 505ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 506ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * ICU "poor man's RTTI", returns a UClassID for this class. 507ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 508ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 509ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 510ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru static UClassID getStaticClassID(); 511ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 512ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru}; 513ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 514ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruinline float LEFontInstance::fixedToFloat(le_int32 fixed) 515ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 516ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru return (float) (fixed / 65536.0); 517ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 518ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 519ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruinline le_int32 LEFontInstance::floatToFixed(float theFloat) 520ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 521ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru return (le_int32) (theFloat * 65536.0); 522ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 523ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 524ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruU_NAMESPACE_END 525ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#endif 526ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 527ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 528