0N/A/*
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A *
0N/A */
0N/A
0N/A/*
0N/A *
0N/A * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
0N/A *
0N/A */
0N/A
0N/A#ifndef __GLYPHPOSITIONADJUSTMENTS_H
0N/A#define __GLYPHPOSITIONADJUSTMENTS_H
0N/A
1693N/A/**
1693N/A * \file
1693N/A * \internal
1693N/A */
1693N/A
0N/A#include "LETypes.h"
0N/A#include "OpenTypeTables.h"
0N/A
1693N/AU_NAMESPACE_BEGIN
1693N/A
0N/Aclass LEGlyphStorage;
0N/Aclass LEFontInstance;
0N/A
1693N/Aclass GlyphPositionAdjustments : public UMemory
0N/A{
0N/Aprivate:
1693N/A class Adjustment : public UMemory {
0N/A public:
0N/A
0N/A inline Adjustment();
0N/A inline Adjustment(float xPlace, float yPlace, float xAdv, float yAdv, le_int32 baseOff = -1);
0N/A inline ~Adjustment();
0N/A
0N/A inline float getXPlacement() const;
0N/A inline float getYPlacement() const;
0N/A inline float getXAdvance() const;
0N/A inline float getYAdvance() const;
0N/A
0N/A inline le_int32 getBaseOffset() const;
0N/A
0N/A inline void setXPlacement(float newXPlacement);
0N/A inline void setYPlacement(float newYPlacement);
0N/A inline void setXAdvance(float newXAdvance);
0N/A inline void setYAdvance(float newYAdvance);
0N/A
0N/A inline void setBaseOffset(le_int32 newBaseOffset);
0N/A
0N/A inline void adjustXPlacement(float xAdjustment);
0N/A inline void adjustYPlacement(float yAdjustment);
0N/A inline void adjustXAdvance(float xAdjustment);
0N/A inline void adjustYAdvance(float yAdjustment);
0N/A
0N/A private:
0N/A float xPlacement;
0N/A float yPlacement;
0N/A float xAdvance;
0N/A float yAdvance;
0N/A
0N/A le_int32 baseOffset;
0N/A
0N/A // allow copying of this class because all of its fields are simple types
0N/A };
0N/A
1693N/A class EntryExitPoint : public UMemory
0N/A {
0N/A public:
0N/A inline EntryExitPoint();
0N/A inline ~EntryExitPoint();
0N/A
0N/A inline le_bool isCursiveGlyph() const;
0N/A inline le_bool baselineIsLogicalEnd() const;
0N/A
0N/A LEPoint *getEntryPoint(LEPoint &entryPoint) const;
0N/A LEPoint *getExitPoint(LEPoint &exitPoint) const;
0N/A
3171N/A inline void clearEntryPoint();
3171N/A inline void clearExitPoint();
0N/A inline void setEntryPoint(LEPoint &newEntryPoint, le_bool baselineIsLogicalEnd);
0N/A inline void setExitPoint(LEPoint &newExitPoint, le_bool baselineIsLogicalEnd);
0N/A inline void setCursiveGlyph(le_bool baselineIsLogicalEnd);
0N/A
0N/A private:
0N/A enum EntryExitFlags
0N/A {
0N/A EEF_HAS_ENTRY_POINT = 0x80000000L,
0N/A EEF_HAS_EXIT_POINT = 0x40000000L,
0N/A EEF_IS_CURSIVE_GLYPH = 0x20000000L,
0N/A EEF_BASELINE_IS_LOGICAL_END = 0x10000000L
0N/A };
0N/A
0N/A le_uint32 fFlags;
0N/A LEPoint fEntryPoint;
0N/A LEPoint fExitPoint;
0N/A };
0N/A
0N/A le_int32 fGlyphCount;
0N/A EntryExitPoint *fEntryExitPoints;
0N/A Adjustment *fAdjustments;
0N/A
0N/A GlyphPositionAdjustments();
0N/A
0N/Apublic:
0N/A GlyphPositionAdjustments(le_int32 glyphCount);
0N/A ~GlyphPositionAdjustments();
0N/A
0N/A inline le_bool hasCursiveGlyphs() const;
0N/A inline le_bool isCursiveGlyph(le_int32 index) const;
0N/A inline le_bool baselineIsLogicalEnd(le_int32 index) const;
0N/A
0N/A const LEPoint *getEntryPoint(le_int32 index, LEPoint &entryPoint) const;
0N/A const LEPoint *getExitPoint(le_int32 index, LEPoint &exitPoint) const;
0N/A
0N/A inline float getXPlacement(le_int32 index) const;
0N/A inline float getYPlacement(le_int32 index) const;
0N/A inline float getXAdvance(le_int32 index) const;
0N/A inline float getYAdvance(le_int32 index) const;
0N/A
0N/A inline le_int32 getBaseOffset(le_int32 index) const;
0N/A
0N/A inline void setXPlacement(le_int32 index, float newXPlacement);
0N/A inline void setYPlacement(le_int32 index, float newYPlacement);
0N/A inline void setXAdvance(le_int32 index, float newXAdvance);
0N/A inline void setYAdvance(le_int32 index, float newYAdvance);
0N/A
0N/A inline void setBaseOffset(le_int32 index, le_int32 newBaseOffset);
0N/A
0N/A inline void adjustXPlacement(le_int32 index, float xAdjustment);
0N/A inline void adjustYPlacement(le_int32 index, float yAdjustment);
0N/A inline void adjustXAdvance(le_int32 index, float xAdjustment);
0N/A inline void adjustYAdvance(le_int32 index, float yAdjustment);
0N/A
3171N/A void clearEntryPoint(le_int32 index);
3171N/A void clearExitPoint(le_int32 index);
1693N/A void setEntryPoint(le_int32 index, LEPoint &newEntryPoint, le_bool baselineIsLogicalEnd);
1693N/A void setExitPoint(le_int32 index, LEPoint &newExitPoint, le_bool baselineIsLogicalEnd);
0N/A void setCursiveGlyph(le_int32 index, le_bool baselineIsLogicalEnd);
0N/A
1693N/A void applyCursiveAdjustments(LEGlyphStorage &glyphStorage, le_bool rightToLeft, const LEFontInstance *fontInstance);
0N/A};
0N/A
0N/Ainline GlyphPositionAdjustments::Adjustment::Adjustment()
0N/A : xPlacement(0), yPlacement(0), xAdvance(0), yAdvance(0), baseOffset(-1)
0N/A{
0N/A // nothing else to do!
0N/A}
0N/A
1693N/Ainline GlyphPositionAdjustments::Adjustment::Adjustment(float xPlace, float yPlace, float xAdv, float yAdv, le_int32 baseOff)
1693N/A : xPlacement(xPlace), yPlacement(yPlace), xAdvance(xAdv), yAdvance(yAdv), baseOffset(baseOff)
0N/A{
0N/A // nothing else to do!
0N/A}
0N/A
0N/Ainline GlyphPositionAdjustments::Adjustment::~Adjustment()
0N/A{
0N/A // nothing to do!
0N/A}
0N/A
0N/Ainline float GlyphPositionAdjustments::Adjustment::getXPlacement() const
0N/A{
0N/A return xPlacement;
0N/A}
0N/A
0N/Ainline float GlyphPositionAdjustments::Adjustment::getYPlacement() const
0N/A{
0N/A return yPlacement;
0N/A}
0N/A
0N/Ainline float GlyphPositionAdjustments::Adjustment::getXAdvance() const
0N/A{
0N/A return xAdvance;
0N/A}
0N/A
0N/Ainline float GlyphPositionAdjustments::Adjustment::getYAdvance() const
0N/A{
0N/A return yAdvance;
0N/A}
0N/A
0N/Ainline le_int32 GlyphPositionAdjustments::Adjustment::getBaseOffset() const
0N/A{
0N/A return baseOffset;
0N/A}
0N/A
0N/Ainline void GlyphPositionAdjustments::Adjustment::setXPlacement(float newXPlacement)
0N/A{
0N/A xPlacement = newXPlacement;
0N/A}
0N/A
0N/Ainline void GlyphPositionAdjustments::Adjustment::setYPlacement(float newYPlacement)
0N/A{
0N/A yPlacement = newYPlacement;
0N/A}
0N/A
0N/Ainline void GlyphPositionAdjustments::Adjustment::setXAdvance(float newXAdvance)
0N/A{
0N/A xAdvance = newXAdvance;
0N/A}
0N/A
0N/Ainline void GlyphPositionAdjustments::Adjustment::setYAdvance(float newYAdvance)
0N/A{
0N/A yAdvance = newYAdvance;
0N/A}
0N/A
0N/Ainline void GlyphPositionAdjustments::Adjustment::setBaseOffset(le_int32 newBaseOffset)
0N/A{
0N/A baseOffset = newBaseOffset;
0N/A}
0N/A
0N/Ainline void GlyphPositionAdjustments::Adjustment::adjustXPlacement(float xAdjustment)
0N/A{
0N/A xPlacement += xAdjustment;
0N/A}
0N/A
0N/Ainline void GlyphPositionAdjustments::Adjustment::adjustYPlacement(float yAdjustment)
0N/A{
0N/A yPlacement += yAdjustment;
0N/A}
0N/A
0N/Ainline void GlyphPositionAdjustments::Adjustment::adjustXAdvance(float xAdjustment)
0N/A{
0N/A xAdvance += xAdjustment;
0N/A}
0N/A
0N/Ainline void GlyphPositionAdjustments::Adjustment::adjustYAdvance(float yAdjustment)
0N/A{
0N/A yAdvance += yAdjustment;
0N/A}
0N/A
0N/Ainline GlyphPositionAdjustments::EntryExitPoint::EntryExitPoint()
0N/A : fFlags(0)
0N/A{
1693N/A fEntryPoint.fX = fEntryPoint.fY = fExitPoint.fX = fExitPoint.fY = 0;
0N/A}
0N/A
0N/Ainline GlyphPositionAdjustments::EntryExitPoint::~EntryExitPoint()
0N/A{
0N/A // nothing special to do
0N/A}
0N/A
0N/Ainline le_bool GlyphPositionAdjustments::EntryExitPoint::isCursiveGlyph() const
0N/A{
0N/A return (fFlags & EEF_IS_CURSIVE_GLYPH) != 0;
0N/A}
0N/A
0N/Ainline le_bool GlyphPositionAdjustments::EntryExitPoint::baselineIsLogicalEnd() const
0N/A{
0N/A return (fFlags & EEF_BASELINE_IS_LOGICAL_END) != 0;
0N/A}
0N/A
3171N/Ainline void GlyphPositionAdjustments::EntryExitPoint::clearEntryPoint()
3171N/A{
3171N/A fFlags &= ~EEF_HAS_ENTRY_POINT;
3171N/A}
3171N/A
3171N/Ainline void GlyphPositionAdjustments::EntryExitPoint::clearExitPoint()
3171N/A{
3171N/A fFlags &= ~EEF_HAS_EXIT_POINT;
3171N/A}
3171N/A
1693N/Ainline void GlyphPositionAdjustments::EntryExitPoint::setEntryPoint(LEPoint &newEntryPoint, le_bool baselineIsLogicalEnd)
0N/A{
0N/A if (baselineIsLogicalEnd) {
1693N/A fFlags |= (EEF_HAS_ENTRY_POINT | EEF_IS_CURSIVE_GLYPH | EEF_BASELINE_IS_LOGICAL_END);
0N/A } else {
0N/A fFlags |= (EEF_HAS_ENTRY_POINT | EEF_IS_CURSIVE_GLYPH);
0N/A }
0N/A
0N/A fEntryPoint = newEntryPoint;
0N/A}
0N/A
1693N/Ainline void GlyphPositionAdjustments::EntryExitPoint::setExitPoint(LEPoint &newExitPoint, le_bool baselineIsLogicalEnd)
0N/A{
0N/A if (baselineIsLogicalEnd) {
1693N/A fFlags |= (EEF_HAS_EXIT_POINT | EEF_IS_CURSIVE_GLYPH | EEF_BASELINE_IS_LOGICAL_END);
0N/A } else {
0N/A fFlags |= (EEF_HAS_EXIT_POINT | EEF_IS_CURSIVE_GLYPH);
0N/A }
0N/A
0N/A fExitPoint = newExitPoint;
0N/A}
0N/A
1693N/Ainline void GlyphPositionAdjustments::EntryExitPoint::setCursiveGlyph(le_bool baselineIsLogicalEnd)
0N/A{
0N/A if (baselineIsLogicalEnd) {
0N/A fFlags |= (EEF_IS_CURSIVE_GLYPH | EEF_BASELINE_IS_LOGICAL_END);
0N/A } else {
0N/A fFlags |= EEF_IS_CURSIVE_GLYPH;
0N/A }
0N/A}
0N/A
0N/Ainline le_bool GlyphPositionAdjustments::isCursiveGlyph(le_int32 index) const
0N/A{
0N/A return fEntryExitPoints != NULL && fEntryExitPoints[index].isCursiveGlyph();
0N/A}
0N/A
0N/Ainline le_bool GlyphPositionAdjustments::baselineIsLogicalEnd(le_int32 index) const
0N/A{
0N/A return fEntryExitPoints != NULL && fEntryExitPoints[index].baselineIsLogicalEnd();
0N/A}
0N/A
0N/Ainline float GlyphPositionAdjustments::getXPlacement(le_int32 index) const
0N/A{
0N/A return fAdjustments[index].getXPlacement();
0N/A}
0N/A
0N/Ainline float GlyphPositionAdjustments::getYPlacement(le_int32 index) const
0N/A{
0N/A return fAdjustments[index].getYPlacement();
0N/A}
0N/A
0N/Ainline float GlyphPositionAdjustments::getXAdvance(le_int32 index) const
0N/A{
0N/A return fAdjustments[index].getXAdvance();
0N/A}
0N/A
0N/Ainline float GlyphPositionAdjustments::getYAdvance(le_int32 index) const
0N/A{
0N/A return fAdjustments[index].getYAdvance();
0N/A}
0N/A
0N/A
0N/Ainline le_int32 GlyphPositionAdjustments::getBaseOffset(le_int32 index) const
0N/A{
0N/A return fAdjustments[index].getBaseOffset();
0N/A}
0N/A
0N/Ainline void GlyphPositionAdjustments::setXPlacement(le_int32 index, float newXPlacement)
0N/A{
0N/A fAdjustments[index].setXPlacement(newXPlacement);
0N/A}
0N/A
0N/Ainline void GlyphPositionAdjustments::setYPlacement(le_int32 index, float newYPlacement)
0N/A{
0N/A fAdjustments[index].setYPlacement(newYPlacement);
0N/A}
0N/A
0N/Ainline void GlyphPositionAdjustments::setXAdvance(le_int32 index, float newXAdvance)
0N/A{
0N/A fAdjustments[index].setXAdvance(newXAdvance);
0N/A}
0N/A
0N/Ainline void GlyphPositionAdjustments::setYAdvance(le_int32 index, float newYAdvance)
0N/A{
0N/A fAdjustments[index].setYAdvance(newYAdvance);
0N/A}
0N/A
0N/Ainline void GlyphPositionAdjustments::setBaseOffset(le_int32 index, le_int32 newBaseOffset)
0N/A{
0N/A fAdjustments[index].setBaseOffset(newBaseOffset);
0N/A}
0N/A
0N/Ainline void GlyphPositionAdjustments::adjustXPlacement(le_int32 index, float xAdjustment)
0N/A{
0N/A fAdjustments[index].adjustXPlacement(xAdjustment);
0N/A}
0N/A
0N/Ainline void GlyphPositionAdjustments::adjustYPlacement(le_int32 index, float yAdjustment)
0N/A{
0N/A fAdjustments[index].adjustYPlacement(yAdjustment);
0N/A}
0N/A
0N/Ainline void GlyphPositionAdjustments::adjustXAdvance(le_int32 index, float xAdjustment)
0N/A{
0N/A fAdjustments[index].adjustXAdvance(xAdjustment);
0N/A}
0N/A
0N/Ainline void GlyphPositionAdjustments::adjustYAdvance(le_int32 index, float yAdjustment)
0N/A{
0N/A fAdjustments[index].adjustYAdvance(yAdjustment);
0N/A}
0N/A
0N/Ainline le_bool GlyphPositionAdjustments::hasCursiveGlyphs() const
0N/A{
0N/A return fEntryExitPoints != NULL;
0N/A}
0N/A
1693N/AU_NAMESPACE_END
0N/A#endif