diff options
author | Peter Breitenlohner <peb@mppmu.mpg.de> | 2010-12-03 09:05:05 +0000 |
---|---|---|
committer | Peter Breitenlohner <peb@mppmu.mpg.de> | 2010-12-03 09:05:05 +0000 |
commit | e04c6a878f5044d36eaa95d4c2318e0381a32998 (patch) | |
tree | 5b7c36578140e48c0114863004c8375ea55db21d /Build/source/libs/icu/icu-4.6/test/letest/SimpleFontInstance.cpp | |
parent | fa438554bd1a061515cd8f5f46fbe311ff08dcd6 (diff) |
icu 4.6
git-svn-id: svn://tug.org/texlive/trunk@20645 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/libs/icu/icu-4.6/test/letest/SimpleFontInstance.cpp')
-rw-r--r-- | Build/source/libs/icu/icu-4.6/test/letest/SimpleFontInstance.cpp | 132 |
1 files changed, 132 insertions, 0 deletions
diff --git a/Build/source/libs/icu/icu-4.6/test/letest/SimpleFontInstance.cpp b/Build/source/libs/icu/icu-4.6/test/letest/SimpleFontInstance.cpp new file mode 100644 index 00000000000..fa5aaedda0a --- /dev/null +++ b/Build/source/libs/icu/icu-4.6/test/letest/SimpleFontInstance.cpp @@ -0,0 +1,132 @@ +/* + ******************************************************************************* + * + * Copyright (C) 1999-2007, International Business Machines + * Corporation and others. All Rights Reserved. + * + ******************************************************************************* + * file name: SimpleFontInstance.cpp + * + * created on: 03/30/2006 + * created by: Eric R. Mader + */ + +#include "unicode/utypes.h" +#include "unicode/uchar.h" + +#include "layout/LETypes.h" +#include "layout/LEFontInstance.h" + +#include "CanonShaping.h" +#include "SimpleFontInstance.h" + +SimpleFontInstance::SimpleFontInstance(float pointSize, LEErrorCode &status) + : fPointSize(pointSize), fAscent(0), fDescent(0) +{ + if (LE_FAILURE(status)) { + return; + } + + fAscent = (le_int32) yUnitsToPoints(2000.0); + fDescent = (le_int32) yUnitsToPoints(600.0); + + return; +} + +SimpleFontInstance::~SimpleFontInstance() +{ + // nothing to do... +} + +const void *SimpleFontInstance::getFontTable(LETag tableTag) const +{ + if (tableTag == LE_GSUB_TABLE_TAG) { + return CanonShaping::glyphSubstitutionTable; + } + + if (tableTag == LE_GDEF_TABLE_TAG) { + return CanonShaping::glyphDefinitionTable; + } + + return NULL; +} + +void SimpleFontInstance::getGlyphAdvance(LEGlyphID glyph, LEPoint &advance) const +{ +#if 0 + if (u_getCombiningClass((UChar32) glyph) == 0) { + advance.fX = xUnitsToPoints(2048); + } else { + advance.fX = 0; + } +#else + advance.fX = xUnitsToPoints(2048); +#endif + + advance.fY = 0; +} + +le_int32 SimpleFontInstance::getUnitsPerEM() const +{ + return 2048; +} + +le_int32 SimpleFontInstance::getAscent() const +{ + return fAscent; +} + +le_int32 SimpleFontInstance::getDescent() const +{ + return fDescent; +} + +le_int32 SimpleFontInstance::getLeading() const +{ + return 0; +} + +// We really want to inherit this method from the superclass, but some compilers +// issue a warning if we don't implement it... +LEGlyphID SimpleFontInstance::mapCharToGlyph(LEUnicode32 ch, const LECharMapper *mapper, le_bool filterZeroWidth) const +{ + return LEFontInstance::mapCharToGlyph(ch, mapper, filterZeroWidth); +} + +// We really want to inherit this method from the superclass, but some compilers +// issue a warning if we don't implement it... +LEGlyphID SimpleFontInstance::mapCharToGlyph(LEUnicode32 ch, const LECharMapper *mapper) const +{ + return LEFontInstance::mapCharToGlyph(ch, mapper); +} + +LEGlyphID SimpleFontInstance::mapCharToGlyph(LEUnicode32 ch) const +{ + return (LEGlyphID) ch; +} + +float SimpleFontInstance::getXPixelsPerEm() const +{ + return fPointSize; +} + +float SimpleFontInstance::getYPixelsPerEm() const +{ + return fPointSize; +} + +float SimpleFontInstance::getScaleFactorX() const +{ + return 1.0; +} + +float SimpleFontInstance::getScaleFactorY() const +{ + return 1.0; +} + +le_bool SimpleFontInstance::getGlyphPoint(LEGlyphID /*glyph*/, le_int32 /*pointNumber*/, LEPoint &/*point*/) const +{ + return FALSE; +} + |