2 *******************************************************************************
4 * Copyright (C) 2016 and later: Unicode, Inc. and others.
5 * License & terms of use: http://www.unicode.org/copyright.html#License
7 *******************************************************************************
8 *******************************************************************************
10 * Copyright (C) 1999-2013, International Business Machines
11 * Corporation and others. All Rights Reserved.
13 *******************************************************************************
14 * file name: SimpleFontInstance.cpp
16 * created on: 03/30/2006
17 * created by: Eric R. Mader
20 #include "unicode/utypes.h"
21 #include "unicode/uchar.h"
23 #include "layout/LETypes.h"
24 #include "layout/LEFontInstance.h"
26 #include "layout/CanonShaping.h"
27 #include "SimpleFontInstance.h"
29 SimpleFontInstance::SimpleFontInstance(float pointSize, LEErrorCode &status)
30 : fPointSize(pointSize), fAscent(0), fDescent(0)
32 if (LE_FAILURE(status)) {
36 fAscent = (le_int32) yUnitsToPoints(2000.0);
37 fDescent = (le_int32) yUnitsToPoints(600.0);
42 SimpleFontInstance::~SimpleFontInstance()
47 const void *SimpleFontInstance::getFontTable(LETag tableTag) const
49 if (tableTag == LE_GSUB_TABLE_TAG) {
50 return CanonShaping::glyphSubstitutionTable;
53 if (tableTag == LE_GDEF_TABLE_TAG) {
54 return CanonShaping::glyphDefinitionTable;
60 void SimpleFontInstance::getGlyphAdvance(LEGlyphID glyph, LEPoint &advance) const
63 if (u_getCombiningClass((UChar32) glyph) == 0) {
64 advance.fX = xUnitsToPoints(2048);
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