1ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 2ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/* 3ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 459d709d503bab6e2b61931737e662dd293b40578ccornelius * (C) Copyright IBM Corp. 1998-2013 - 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/** 1359d709d503bab6e2b61931737e662dd293b40578ccornelius * \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 11059d709d503bab6e2b61931737e662dd293b40578ccornelius * 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 * 15959d709d503bab6e2b61931737e662dd293b40578ccornelius * Note that implementing this function does not allow for range checking. 16059d709d503bab6e2b61931737e662dd293b40578ccornelius * Subclasses that desire the safety of range checking must implement the 16159d709d503bab6e2b61931737e662dd293b40578ccornelius * variation which has a length parameter. 16259d709d503bab6e2b61931737e662dd293b40578ccornelius * 16359d709d503bab6e2b61931737e662dd293b40578ccornelius * @param tableTag - the four byte table tag. (e.g. 'cmap') 164ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 165ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the address of the table in memory, or <code>NULL</code> 166ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * if the table doesn't exist. 167ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 168ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.8 169ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 170ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual const void *getFontTable(LETag tableTag) const = 0; 171ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 172ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 17354dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius * This method reads a table from the font. Note that in general, 17454dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius * it only makes sense to call this method on an <code>LEFontInstance</code> 17554dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius * which represents a physical font - i.e. one which has been returned by 17654dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius * <code>getSubFont()</code>. This is because each subfont in a composite font 17754dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius * will have different tables, and there's no way to know which subfont to access. 17854dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius * 17954dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius * Subclasses which represent composite fonts should always return <code>NULL</code>. 18059d709d503bab6e2b61931737e662dd293b40578ccornelius * 18154dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius * This version sets a length, for range checking. 18259d709d503bab6e2b61931737e662dd293b40578ccornelius * Note that range checking can only be accomplished if this function is 18359d709d503bab6e2b61931737e662dd293b40578ccornelius * implemented in subclasses. 18454dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius * 18559d709d503bab6e2b61931737e662dd293b40578ccornelius * @param tableTag - the four byte table tag. (e.g. 'cmap') 18654dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius * @param length - ignored on entry, on exit will be the length of the table if known, or -1 if unknown. 18754dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius * @return the address of the table in memory, or <code>NULL</code> 18854dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius * if the table doesn't exist. 18959d709d503bab6e2b61931737e662dd293b40578ccornelius * @draft ICU 52 19054dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius */ 19154dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius virtual const void* getFontTable(LETag tableTag, size_t &length) const { length=-1; return getFontTable(tableTag); } /* -1 = unknown length */ 19254dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius 19354dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius /** 194ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This method is used to determine if the font can 195ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * render the given character. This can usually be done 196ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * by looking the character up in the font's character 197ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * to glyph mapping. 198ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 199ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * The default implementation of this method will return 200ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <code>TRUE</code> if <code>mapCharToGlyph(ch)</code> 201ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * returns a non-zero value. 202ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 203ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param ch - the character to be tested 204ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 205ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return <code>TRUE</code> if the font can render ch. 206ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 207ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 208ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 209ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual le_bool canDisplay(LEUnicode32 ch) const; 210ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 211ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 212ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This method returns the number of design units in 213ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * the font's EM square. 214ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 215ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the number of design units pre EM. 216ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 217ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.8 218ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 219ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual le_int32 getUnitsPerEM() const = 0; 220ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 221ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 222ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This method maps an array of character codes to an array of glyph 223ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * indices, using the font's character to glyph map. 224ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 225ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * The default implementation iterates over all of the characters and calls 226ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <code>mapCharToGlyph(ch, mapper)</code> on each one. It also handles surrogate 227ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * characters, storing the glyph ID for the high surrogate, and a deleted glyph (0xFFFF) 228ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * for the low surrogate. 229ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 230ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Most sublcasses will not need to implement this method. 231ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 232ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param chars - the character array 233ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param offset - the index of the first character 234ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param count - the number of characters 235ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param reverse - if <code>TRUE</code>, store the glyph indices in reverse order. 236ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param mapper - the character mapper. 237ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param filterZeroWidth - <code>TRUE</code> if ZWJ / ZWNJ characters should map to a glyph w/ no contours. 238ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param glyphStorage - the object which contains the output glyph array 239ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 240ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see LECharMapper 241ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 242ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.6 243ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 244ac04d0bbe12b3ef54518635711412f178cb4d16Jean-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; 245ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 246ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 247ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This method maps a single character to a glyph index, using the 248ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * font's character to glyph map. The default implementation of this 249ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * method calls the mapper, and then calls <code>mapCharToGlyph(mappedCh)</code>. 250ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 251ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param ch - the character 252ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param mapper - the character mapper 253ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param filterZeroWidth - <code>TRUE</code> if ZWJ / ZWNJ characters should map to a glyph w/ no contours. 254ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 255ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the glyph index 256ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 257ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see LECharMapper 258ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 259ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.6 260ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 261ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual LEGlyphID mapCharToGlyph(LEUnicode32 ch, const LECharMapper *mapper, le_bool filterZeroWidth) const; 262ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 263ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 264ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This method maps a single character to a glyph index, using the 265ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * font's character to glyph map. The default implementation of this 266ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * method calls the mapper, and then calls <code>mapCharToGlyph(mappedCh)</code>. 267ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 268ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param ch - the character 269ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param mapper - the character mapper 270ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 271ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the glyph index 272ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 273ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see LECharMapper 274ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 275ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 276ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 277ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual LEGlyphID mapCharToGlyph(LEUnicode32 ch, const LECharMapper *mapper) const; 278ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 279ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 280ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This method maps a single character to a glyph index, using the 281ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * font's character to glyph map. There is no default implementation 282ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * of this method because it requires information about the platform 283ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * font implementation. 284ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 285ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param ch - the character 286ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 287ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the glyph index 288ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 289ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 290ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 291ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual LEGlyphID mapCharToGlyph(LEUnicode32 ch) const = 0; 292ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 293ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // 294ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // Metrics 295ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // 296ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 297ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 298ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This method gets the X and Y advance of a particular glyph, in pixels. 299ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 300ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param glyph - the glyph index 301ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param advance - the X and Y pixel values will be stored here 302ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 303ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 304ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 305ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void getGlyphAdvance(LEGlyphID glyph, LEPoint &advance) const = 0; 306ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 307ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 308ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This method gets the hinted X and Y pixel coordinates of a particular 309ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * point in the outline of the given glyph. 310ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 311ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param glyph - the glyph index 312ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param pointNumber - the number of the point 313ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param point - the point's X and Y pixel values will be stored here 314ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 315ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return <code>TRUE</code> if the point coordinates could be stored. 316ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 317ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.8 318ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 319ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual le_bool getGlyphPoint(LEGlyphID glyph, le_int32 pointNumber, LEPoint &point) const = 0; 320ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 321ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 322ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This method returns the width of the font's EM square 323ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * in pixels. 324ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 325ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the pixel width of the EM square 326ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 327ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.8 328ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 329ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual float getXPixelsPerEm() const = 0; 330ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 331ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 332ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This method returns the height of the font's EM square 333ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * in pixels. 334ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 335ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the pixel height of the EM square 336ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 337ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.8 338ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 339ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual float getYPixelsPerEm() const = 0; 340ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 341ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 342ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This method converts font design units in the 343ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * X direction to points. 344ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 345ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param xUnits - design units in the X direction 346ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 347ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return points in the X direction 348ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 349ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 350ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 351ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual float xUnitsToPoints(float xUnits) const; 352ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 353ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 354ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This method converts font design units in the 355ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Y direction to points. 356ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 357ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param yUnits - design units in the Y direction 358ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 359ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return points in the Y direction 360ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 361ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 362ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 363ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual float yUnitsToPoints(float yUnits) const; 364ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 365ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 366ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This method converts font design units to points. 367ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 368ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param units - X and Y design units 369ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param points - set to X and Y points 370ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 371ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 372ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 373ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void unitsToPoints(LEPoint &units, LEPoint &points) const; 374ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 375ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 376ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This method converts pixels in the 377ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * X direction to font design units. 378ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 379ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param xPixels - pixels in the X direction 380ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 381ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return font design units in the X direction 382ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 383ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 384ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 385ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual float xPixelsToUnits(float xPixels) const; 386ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 387ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 388ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This method converts pixels in the 389ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Y direction to font design units. 390ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 391ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param yPixels - pixels in the Y direction 392ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 393ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return font design units in the Y direction 394ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 395ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 396ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 397ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual float yPixelsToUnits(float yPixels) const; 398ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 399ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 400ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This method converts pixels to font design units. 401ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 402ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param pixels - X and Y pixel 403ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param units - set to X and Y font design units 404ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 405ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 406ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 407ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void pixelsToUnits(LEPoint &pixels, LEPoint &units) const; 408ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 409ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 410ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Get the X scale factor from the font's transform. The default 411ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * implementation of <code>transformFunits()</code> will call this method. 412ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 413ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the X scale factor. 414ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 415ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 416ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see transformFunits 417ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 418ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 419ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 420ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual float getScaleFactorX() const = 0; 421ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 422ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 423ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Get the Y scale factor from the font's transform. The default 424ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * implementation of <code>transformFunits()</code> will call this method. 425ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 426ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the Yscale factor. 427ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 428ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see transformFunits 429ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 430ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 431ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 432ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual float getScaleFactorY() const = 0; 433ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 434ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 435ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This method transforms an X, Y point in font design units to a 436ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * pixel coordinate, applying the font's transform. The default 437ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * implementation of this method calls <code>getScaleFactorX()</code> 438ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * and <code>getScaleFactorY()</code>. 439ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 440ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param xFunits - the X coordinate in font design units 441ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param yFunits - the Y coordinate in font design units 442ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param pixels - the tranformed co-ordinate in pixels 443ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 444ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see getScaleFactorX 445ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see getScaleFactorY 446ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 447ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 448ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 449ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void transformFunits(float xFunits, float yFunits, LEPoint &pixels) const; 450ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 451ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 452ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This is a convenience method used to convert 453ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * values in a 16.16 fixed point format to floating point. 454ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 455ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param fixed - the fixed point value 456ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 457ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the floating point value 458ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 459ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.8 460ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 461ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru static inline float fixedToFloat(le_int32 fixed); 462ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 463ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 464ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This is a convenience method used to convert 465ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * floating point values to 16.16 fixed point format. 466ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 467ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param theFloat - the floating point value 468ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 469ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the fixed point value 470ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 471ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.8 472ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 473ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru static inline le_int32 floatToFixed(float theFloat); 474ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 475ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // 476ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // These methods won't ever be called by the LayoutEngine, 477ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // but are useful for clients of <code>LEFontInstance</code> who 478ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // need to render text. 479ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // 480ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 481ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 482ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Get the font's ascent. 483ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 484ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the font's ascent, in points. This value 485ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * will always be positive. 486ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 487ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 488ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 489ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual le_int32 getAscent() const = 0; 490ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 491ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 492ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Get the font's descent. 493ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 494ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the font's descent, in points. This value 495ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * will always be positive. 496ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 497ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 498ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 499ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual le_int32 getDescent() const = 0; 500ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 501ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 502ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Get the font's leading. 503ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 504ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the font's leading, in points. This value 505ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * will always be positive. 506ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 507ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 508ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 509ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual le_int32 getLeading() const = 0; 510ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 511ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 512ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Get the line height required to display text in 513ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * this font. The default implementation of this method 514ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * returns the sum of the ascent, descent, and leading. 515ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 516ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the line height, in points. This vaule will 517ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * always be positive. 518ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 519ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 520ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 521ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual le_int32 getLineHeight() const; 522ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 523ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 524ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * ICU "poor man's RTTI", returns a UClassID for the actual class. 525ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 526ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 527ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 528ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual UClassID getDynamicClassID() const; 529ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 530ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 531ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * ICU "poor man's RTTI", returns a UClassID for this class. 532ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 533ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 534ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 535ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru static UClassID getStaticClassID(); 536ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 537ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru}; 538ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 539ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruinline float LEFontInstance::fixedToFloat(le_int32 fixed) 540ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 541ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru return (float) (fixed / 65536.0); 542ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 543ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 544ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruinline le_int32 LEFontInstance::floatToFixed(float theFloat) 545ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 546ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru return (le_int32) (theFloat * 65536.0); 547ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 548ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 549ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruU_NAMESPACE_END 550ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#endif 551