]>
git.saurik.com Git - apple/icu.git/blob - icuSources/test/letest/SimpleFontInstance.cpp
2 *******************************************************************************
4 * Copyright (C) 1999-2015, International Business Machines
5 * Corporation and others. All Rights Reserved.
7 *******************************************************************************
8 * file name: SimpleFontInstance.cpp
10 * created on: 03/30/2006
11 * created by: Eric R. Mader
14 #include "unicode/utypes.h"
15 #include "unicode/uchar.h"
17 #include "layout/LETypes.h"
18 #include "layout/LEFontInstance.h"
21 #include "CanonShaping.h"
24 #include "SimpleFontInstance.h"
26 SimpleFontInstance::SimpleFontInstance(float pointSize
, LEErrorCode
&status
)
27 : fPointSize(pointSize
), fAscent(0), fDescent(0)
29 if (LE_FAILURE(status
)) {
33 fAscent
= (le_int32
) yUnitsToPoints(2000.0);
34 fDescent
= (le_int32
) yUnitsToPoints(600.0);
39 SimpleFontInstance::~SimpleFontInstance()
44 const void *SimpleFontInstance::getFontTable(LETag tableTag
, size_t &length
) const
46 length
= -1; // unknown for this test.
48 if (tableTag
== LE_GSUB_TABLE_TAG
) {
49 return CanonShaping::glyphSubstitutionTable
;
52 if (tableTag
== LE_GDEF_TABLE_TAG
) {
53 return CanonShaping::glyphDefinitionTable
;
59 void SimpleFontInstance::getGlyphAdvance(LEGlyphID glyph
, LEPoint
&advance
) const
62 if (u_getCombiningClass((UChar32
) glyph
) == 0) {
63 advance
.fX
= xUnitsToPoints(2048);
68 (void)glyph
; // Suppress unused parameter compiler warning.
69 advance
.fX
= xUnitsToPoints(2048);
75 le_int32
SimpleFontInstance::getUnitsPerEM() const
80 le_int32
SimpleFontInstance::getAscent() const
85 le_int32
SimpleFontInstance::getDescent() const
90 le_int32
SimpleFontInstance::getLeading() const
95 // We really want to inherit this method from the superclass, but some compilers
96 // issue a warning if we don't implement it...
97 LEGlyphID
SimpleFontInstance::mapCharToGlyph(LEUnicode32 ch
, const LECharMapper
*mapper
, le_bool filterZeroWidth
) const
99 return LEFontInstance::mapCharToGlyph(ch
, mapper
, filterZeroWidth
);
102 // We really want to inherit this method from the superclass, but some compilers
103 // issue a warning if we don't implement it...
104 LEGlyphID
SimpleFontInstance::mapCharToGlyph(LEUnicode32 ch
, const LECharMapper
*mapper
) const
106 return LEFontInstance::mapCharToGlyph(ch
, mapper
);
109 LEGlyphID
SimpleFontInstance::mapCharToGlyph(LEUnicode32 ch
) const
111 return (LEGlyphID
) ch
;
114 float SimpleFontInstance::getXPixelsPerEm() const
119 float SimpleFontInstance::getYPixelsPerEm() const
124 float SimpleFontInstance::getScaleFactorX() const
129 float SimpleFontInstance::getScaleFactorY() const
134 le_bool
SimpleFontInstance::getGlyphPoint(LEGlyphID
/*glyph*/, le_int32
/*pointNumber*/, LEPoint
&/*point*/) const