summaryrefslogtreecommitdiff
path: root/Build/source/libs/graphite2/graphite2-src/src/Slot.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/libs/graphite2/graphite2-src/src/Slot.cpp')
-rw-r--r--Build/source/libs/graphite2/graphite2-src/src/Slot.cpp88
1 files changed, 41 insertions, 47 deletions
diff --git a/Build/source/libs/graphite2/graphite2-src/src/Slot.cpp b/Build/source/libs/graphite2/graphite2-src/src/Slot.cpp
index 4227327c4b3..0fdb0989526 100644
--- a/Build/source/libs/graphite2/graphite2-src/src/Slot.cpp
+++ b/Build/source/libs/graphite2/graphite2-src/src/Slot.cpp
@@ -15,8 +15,8 @@
You should also have received a copy of the GNU Lesser General Public
License along with this library in the file named "LICENSE".
- If not, write to the Free Software Foundation, 51 Franklin Street,
- Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
+ If not, write to the Free Software Foundation, 51 Franklin Street,
+ Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
internet at http://www.fsf.org/licenses/lgpl.html.
Alternatively, the contents of this file may be used under the terms of the
@@ -40,7 +40,7 @@ Slot::Slot(int16 *user_attrs) :
m_index(0), m_parent(NULL), m_child(NULL), m_sibling(NULL),
m_position(0, 0), m_shift(0, 0), m_advance(0, 0),
m_attach(0, 0), m_with(0, 0), m_just(0.),
- m_flags(0), m_attLevel(0), m_bidiCls(-1), m_bidiLevel(0),
+ m_flags(0), m_attLevel(0), m_bidiCls(-1), m_bidiLevel(0),
m_userAttr(user_attrs), m_justs(NULL)
{
}
@@ -57,7 +57,7 @@ void Slot::set(const Slot & orig, int charOffset, size_t sizeAttr, size_t justLe
else
m_before = orig.m_before + charOffset;
if (charOffset <= 0 && orig.m_after + charOffset >= numChars)
- m_after = numChars - 1;
+ m_after = int(numChars) - 1;
else
m_after = orig.m_after + charOffset;
m_parent = NULL;
@@ -107,7 +107,7 @@ Position Slot::finalise(const Segment *seg, const Font *font, Position & base, R
tAdvance = (m_advance.x - glyphFace->theAdvance().x + m_just) * scale + font->advance(glyph());
else
tAdvance *= scale;
- }
+ }
Position res;
m_position = base + shift;
@@ -142,7 +142,7 @@ Position Slot::finalise(const Segment *seg, const Font *font, Position & base, R
Position tRes = m_sibling->finalise(seg, font, base, bbox, attrLevel, clusterMin, rtl, isFinal, depth + 1);
if (tRes.x > res.x) res = tRes;
}
-
+
if (!m_parent && clusterMin < base.x)
{
Position adj = Position(m_position.x - clusterMin, 0.);
@@ -165,25 +165,25 @@ int32 Slot::clusterMetric(const Segment *seg, uint8 metric, uint8 attrLevel, boo
switch (metrics(metric))
{
case kgmetLsb :
- return bbox.bl.x;
+ return int32(bbox.bl.x);
case kgmetRsb :
- return res.x - bbox.tr.x;
+ return int32(res.x - bbox.tr.x);
case kgmetBbTop :
- return bbox.tr.y;
+ return int32(bbox.tr.y);
case kgmetBbBottom :
- return bbox.bl.y;
+ return int32(bbox.bl.y);
case kgmetBbLeft :
- return bbox.bl.x;
+ return int32(bbox.bl.x);
case kgmetBbRight :
- return bbox.tr.x;
+ return int32(bbox.tr.x);
case kgmetBbWidth :
- return bbox.tr.x - bbox.bl.x;
+ return int32(bbox.tr.x - bbox.bl.x);
case kgmetBbHeight :
- return bbox.tr.y - bbox.bl.y;
+ return int32(bbox.tr.y - bbox.bl.y);
case kgmetAdvWidth :
- return res.x;
+ return int32(res.x);
case kgmetAdvHeight :
- return res.y;
+ return int32(res.y);
default :
return 0;
}
@@ -193,14 +193,7 @@ int32 Slot::clusterMetric(const Segment *seg, uint8 metric, uint8 attrLevel, boo
int Slot::getAttr(const Segment *seg, attrCode ind, uint8 subindex) const
{
- if (ind == gr_slatUserDefnV1)
- {
- ind = gr_slatUserDefn;
- subindex = 0;
- if (seg->numAttrs() == 0)
- return 0;
- }
- else if (ind >= gr_slatJStretch && ind < gr_slatJStretch + 20 && ind != gr_slatJWidth)
+ if (ind >= gr_slatJStretch && ind < gr_slatJStretch + 20 && ind != gr_slatJWidth)
{
int indx = ind - gr_slatJStretch;
return getJustify(seg, indx / 5, indx % 5);
@@ -231,30 +224,32 @@ int Slot::getAttr(const Segment *seg, attrCode ind, uint8 subindex) const
case gr_slatMeasureSol: return -1; // err what's this?
case gr_slatMeasureEol: return -1;
case gr_slatJWidth: return int(m_just);
- case gr_slatUserDefn : return m_userAttr[subindex];
+ case gr_slatUserDefnV1: subindex = 0; GR_FALLTHROUGH;
+ // no break
+ case gr_slatUserDefn : return subindex < seg->numAttrs() ? m_userAttr[subindex] : 0;
case gr_slatSegSplit : return seg->charinfo(m_original)->flags() & 3;
case gr_slatBidiLevel: return m_bidiLevel;
case gr_slatColFlags : { SlotCollision *c = seg->collisionInfo(this); return c ? c->flags() : 0; }
- case gr_slatColLimitblx : SLOTGETCOLATTR(limit().bl.x)
- case gr_slatColLimitbly : SLOTGETCOLATTR(limit().bl.y)
- case gr_slatColLimittrx : SLOTGETCOLATTR(limit().tr.x)
- case gr_slatColLimittry : SLOTGETCOLATTR(limit().tr.y)
- case gr_slatColShiftx : SLOTGETCOLATTR(offset().x)
- case gr_slatColShifty : SLOTGETCOLATTR(offset().y)
- case gr_slatColMargin : SLOTGETCOLATTR(margin())
- case gr_slatColMarginWt : SLOTGETCOLATTR(marginWt())
- case gr_slatColExclGlyph : SLOTGETCOLATTR(exclGlyph())
- case gr_slatColExclOffx : SLOTGETCOLATTR(exclOffset().x)
- case gr_slatColExclOffy : SLOTGETCOLATTR(exclOffset().y)
- case gr_slatSeqClass : SLOTGETCOLATTR(seqClass())
- case gr_slatSeqProxClass : SLOTGETCOLATTR(seqProxClass())
- case gr_slatSeqOrder : SLOTGETCOLATTR(seqOrder())
- case gr_slatSeqAboveXoff : SLOTGETCOLATTR(seqAboveXoff())
- case gr_slatSeqAboveWt : SLOTGETCOLATTR(seqAboveWt())
- case gr_slatSeqBelowXlim : SLOTGETCOLATTR(seqBelowXlim())
- case gr_slatSeqBelowWt : SLOTGETCOLATTR(seqBelowWt())
- case gr_slatSeqValignHt : SLOTGETCOLATTR(seqValignHt())
- case gr_slatSeqValignWt : SLOTGETCOLATTR(seqValignWt())
+ case gr_slatColLimitblx:SLOTGETCOLATTR(limit().bl.x)
+ case gr_slatColLimitbly:SLOTGETCOLATTR(limit().bl.y)
+ case gr_slatColLimittrx:SLOTGETCOLATTR(limit().tr.x)
+ case gr_slatColLimittry:SLOTGETCOLATTR(limit().tr.y)
+ case gr_slatColShiftx : SLOTGETCOLATTR(offset().x)
+ case gr_slatColShifty : SLOTGETCOLATTR(offset().y)
+ case gr_slatColMargin : SLOTGETCOLATTR(margin())
+ case gr_slatColMarginWt:SLOTGETCOLATTR(marginWt())
+ case gr_slatColExclGlyph:SLOTGETCOLATTR(exclGlyph())
+ case gr_slatColExclOffx:SLOTGETCOLATTR(exclOffset().x)
+ case gr_slatColExclOffy:SLOTGETCOLATTR(exclOffset().y)
+ case gr_slatSeqClass : SLOTGETCOLATTR(seqClass())
+ case gr_slatSeqProxClass:SLOTGETCOLATTR(seqProxClass())
+ case gr_slatSeqOrder : SLOTGETCOLATTR(seqOrder())
+ case gr_slatSeqAboveXoff:SLOTGETCOLATTR(seqAboveXoff())
+ case gr_slatSeqAboveWt: SLOTGETCOLATTR(seqAboveWt())
+ case gr_slatSeqBelowXlim:SLOTGETCOLATTR(seqBelowXlim())
+ case gr_slatSeqBelowWt: SLOTGETCOLATTR(seqBelowWt())
+ case gr_slatSeqValignHt:SLOTGETCOLATTR(seqValignHt())
+ case gr_slatSeqValignWt:SLOTGETCOLATTR(seqValignWt())
default : return 0;
}
}
@@ -480,7 +475,7 @@ void Slot::setGlyph(Segment *seg, uint16 glyphid, const GlyphFace * theGlyph)
m_advance = Position(aGlyph->theAdvance().x, 0.);
if (seg->silf()->aPassBits())
{
- seg->mergePassBits(theGlyph->attrs()[seg->silf()->aPassBits()]);
+ seg->mergePassBits(uint8(theGlyph->attrs()[seg->silf()->aPassBits()]));
if (seg->silf()->numPasses() > 16)
seg->mergePassBits(theGlyph->attrs()[seg->silf()->aPassBits()+1] << 16);
}
@@ -532,4 +527,3 @@ bool Slot::isChildOf(const Slot *base) const
return true;
return false;
}
-