int Slot::getAttr(const Segment *seg, attrCode ind, uint8 subindex) const
{ if (ind >= gr_slatJStretch && ind < gr_slatJStretch + 20 && ind != gr_slatJWidth)
{ int indx = ind - gr_slatJStretch; return getJustify(seg, indx / 5, indx % 5);
}
switch (ind)
{ case gr_slatAdvX : returnint(m_advance.x); case gr_slatAdvY : returnint(m_advance.y); case gr_slatAttTo : return m_parent ? 1 : 0; case gr_slatAttX : returnint(m_attach.x); case gr_slatAttY : returnint(m_attach.y); case gr_slatAttXOff : case gr_slatAttYOff : return0; case gr_slatAttWithX : returnint(m_with.x); case gr_slatAttWithY : returnint(m_with.y); case gr_slatAttWithXOff: case gr_slatAttWithYOff:return0; case gr_slatAttLevel : return m_attLevel; case gr_slatBreak : return seg->charinfo(m_original)->breakWeight(); case gr_slatCompRef : return0; case gr_slatDir : return seg->dir() & 1; case gr_slatInsert : return isInsertBefore(); case gr_slatPosX : returnint(m_position.x); // but need to calculate it case gr_slatPosY : returnint(m_position.y); case gr_slatShiftX : returnint(m_shift.x); case gr_slatShiftY : returnint(m_shift.y); case gr_slatMeasureSol: return -1; // err what's this? case gr_slatMeasureEol: return -1; case gr_slatJWidth: returnint(m_just); 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()) default : return0;
}
}
#define SLOTCOLSETATTR(x) { \
SlotCollision *c = seg->collisionInfo(this); \ if (c) { c-> x ; c->setFlags(c->flags() & ~SlotCollision::COLL_KNOWN); } \ break; } #define SLOTCOLSETCOMPLEXATTR(t, y, x) { \
SlotCollision *c = seg->collisionInfo(this); \ if (c) { \ const t &s = c-> y; \
c-> x ; c->setFlags(c->flags() & ~SlotCollision::COLL_KNOWN); } \ break; }
void Slot::setAttr(Segment *seg, attrCode ind, uint8 subindex, int16 value, const SlotMap & map)
{ if (ind == gr_slatUserDefnV1)
{
ind = gr_slatUserDefn;
subindex = 0; if (seg->numAttrs() == 0) return;
} elseif (ind >= gr_slatJStretch && ind < gr_slatJStretch + 20 && ind != gr_slatJWidth)
{ int indx = ind - gr_slatJStretch; return setJustify(seg, indx / 5, indx % 5, value);
}
switch (ind)
{ case gr_slatAdvX : m_advance.x = value; break; case gr_slatAdvY : m_advance.y = value; break; case gr_slatAttTo :
{ const uint16 idx = uint16(value); if (idx < map.size() && map[idx])
{
Slot *other = map[idx]; if (other == this || other == m_parent || other->isCopied()) break; if (m_parent) { m_parent->removeChild(this); attachTo(NULL); }
Slot *pOther = other; int count = 0; bool foundOther = false; while (pOther)
{
++count; if (pOther == this) foundOther = true;
pOther = pOther->attachedTo();
} for (pOther = m_child; pOther; pOther = pOther->m_child)
++count; for (pOther = m_sibling; pOther; pOther = pOther->m_sibling)
++count; if (count < 100 && !foundOther && other->child(this))
{
attachTo(other); if ((map.dir() != 0) ^ (idx > subindex))
m_with = Position(advance(), 0); else// normal match to previous root
m_attach = Position(other->advance(), 0);
}
} break;
} case gr_slatAttX : m_attach.x = value; break; case gr_slatAttY : m_attach.y = value; break; case gr_slatAttXOff : case gr_slatAttYOff : break; case gr_slatAttWithX : m_with.x = value; break; case gr_slatAttWithY : m_with.y = value; break; case gr_slatAttWithXOff : case gr_slatAttWithYOff : break; case gr_slatAttLevel :
m_attLevel = byte(value); break; case gr_slatBreak :
seg->charinfo(m_original)->breakWeight(value); break; case gr_slatCompRef : break; // not sure what to do here case gr_slatDir : break; case gr_slatInsert :
markInsertBefore(value? true : false); break; case gr_slatPosX : break; // can't set these here case gr_slatPosY : break; case gr_slatShiftX : m_shift.x = value; break; case gr_slatShiftY : m_shift.y = value; break; case gr_slatMeasureSol : break; case gr_slatMeasureEol : break; case gr_slatJWidth : just(value); break; case gr_slatSegSplit : seg->charinfo(m_original)->addflags(value & 3); break; case gr_slatUserDefn : m_userAttr[subindex] = value; break; case gr_slatColFlags : {
SlotCollision *c = seg->collisionInfo(this); if (c)
c->setFlags(value); break; } case gr_slatColLimitblx : SLOTCOLSETCOMPLEXATTR(Rect, limit(), setLimit(Rect(Position(value, s.bl.y), s.tr))) case gr_slatColLimitbly : SLOTCOLSETCOMPLEXATTR(Rect, limit(), setLimit(Rect(Position(s.bl.x, value), s.tr))) case gr_slatColLimittrx : SLOTCOLSETCOMPLEXATTR(Rect, limit(), setLimit(Rect(s.bl, Position(value, s.tr.y)))) case gr_slatColLimittry : SLOTCOLSETCOMPLEXATTR(Rect, limit(), setLimit(Rect(s.bl, Position(s.tr.x, value)))) case gr_slatColMargin : SLOTCOLSETATTR(setMargin(value)) case gr_slatColMarginWt : SLOTCOLSETATTR(setMarginWt(value)) case gr_slatColExclGlyph : SLOTCOLSETATTR(setExclGlyph(value)) case gr_slatColExclOffx : SLOTCOLSETCOMPLEXATTR(Position, exclOffset(), setExclOffset(Position(value, s.y))) case gr_slatColExclOffy : SLOTCOLSETCOMPLEXATTR(Position, exclOffset(), setExclOffset(Position(s.x, value))) case gr_slatSeqClass : SLOTCOLSETATTR(setSeqClass(value)) case gr_slatSeqProxClass : SLOTCOLSETATTR(setSeqProxClass(value)) case gr_slatSeqOrder : SLOTCOLSETATTR(setSeqOrder(value)) case gr_slatSeqAboveXoff : SLOTCOLSETATTR(setSeqAboveXoff(value)) case gr_slatSeqAboveWt : SLOTCOLSETATTR(setSeqAboveWt(value)) case gr_slatSeqBelowXlim : SLOTCOLSETATTR(setSeqBelowXlim(value)) case gr_slatSeqBelowWt : SLOTCOLSETATTR(setSeqBelowWt(value)) case gr_slatSeqValignHt : SLOTCOLSETATTR(setSeqValignHt(value)) case gr_slatSeqValignWt : SLOTCOLSETATTR(setSeqValignWt(value)) default : break;
}
}
int Slot::getJustify(const Segment *seg, uint8 level, uint8 subindex) const
{ if (level && level >= seg->silf()->numJustLevels()) return0;
if (m_justs) return m_justs->values[level * SlotJustify::NUMJUSTPARAMS + subindex];
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.