]>
git.saurik.com Git - apple/icu.git/blob - icuSources/test/perf/leperf/SimpleFontInstance.cpp
2 *******************************************************************************
4 * Copyright (C) 1999-2013, 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"
20 #include "layout/CanonShaping.h"
21 #include "SimpleFontInstance.h"
23 SimpleFontInstance::SimpleFontInstance(float pointSize
, LEErrorCode
&status
)
24 : fPointSize(pointSize
), fAscent(0), fDescent(0)
26 if (LE_FAILURE(status
)) {
30 fAscent
= (le_int32
) yUnitsToPoints(2000.0);
31 fDescent
= (le_int32
) yUnitsToPoints(600.0);
36 SimpleFontInstance::~SimpleFontInstance()
41 const void *SimpleFontInstance::getFontTable(LETag tableTag
) const
43 if (tableTag
== LE_GSUB_TABLE_TAG
) {
44 return CanonShaping::glyphSubstitutionTable
;
47 if (tableTag
== LE_GDEF_TABLE_TAG
) {
48 return CanonShaping::glyphDefinitionTable
;
54 void SimpleFontInstance::getGlyphAdvance(LEGlyphID glyph
, LEPoint
&advance
) const
57 if (u_getCombiningClass((UChar32
) glyph
) == 0) {
58 advance
.fX
= xUnitsToPoints(2048);
63 advance
.fX
= xUnitsToPoints(2048);
69 le_int32
SimpleFontInstance::getUnitsPerEM() const
74 le_int32
SimpleFontInstance::getAscent() const
79 le_int32
SimpleFontInstance::getDescent() const
84 le_int32
SimpleFontInstance::getLeading() const
89 // We really want to inherit this method from the superclass, but some compilers
90 // issue a warning if we don't implement it...
91 LEGlyphID
SimpleFontInstance::mapCharToGlyph(LEUnicode32 ch
, const LECharMapper
*mapper
, le_bool filterZeroWidth
) const
93 return LEFontInstance::mapCharToGlyph(ch
, mapper
, filterZeroWidth
);
96 // We really want to inherit this method from the superclass, but some compilers
97 // issue a warning if we don't implement it...
98 LEGlyphID
SimpleFontInstance::mapCharToGlyph(LEUnicode32 ch
, const LECharMapper
*mapper
) const
100 return LEFontInstance::mapCharToGlyph(ch
, mapper
);
103 LEGlyphID
SimpleFontInstance::mapCharToGlyph(LEUnicode32 ch
) const
105 return (LEGlyphID
) ch
;
108 float SimpleFontInstance::getXPixelsPerEm() const
113 float SimpleFontInstance::getYPixelsPerEm() const
118 float SimpleFontInstance::getScaleFactorX() const
123 float SimpleFontInstance::getScaleFactorY() const
128 le_bool
SimpleFontInstance::getGlyphPoint(LEGlyphID
/*glyph*/, le_int32
/*pointNumber*/, LEPoint
&/*point*/) const