/* SPDX-License-Identifier: MIT OR MPL-2.0 OR LGPL-2.1-or-later OR GPL-2.0-or-later */ /* Copyright 2010, SIL International, All rights reserved. */ #pragma once
enum gr_justFlags { /// Indicates that this segment is a complete line
gr_justCompleteLine = 0, /// Indicates that the start of the slot list is not at the start of a line
gr_justStartInline = 1, /// Indicates that the end of the slot list is not at the end of a line
gr_justEndInline = 2
};
/** Used for looking up slot attributes. Most are already available in other functions **/ enum gr_attrCode { /// adjusted glyph advance in x direction in design units
gr_slatAdvX = 0, /// adjusted glyph advance in y direction (usually 0) in design units
gr_slatAdvY, /// returns 0. Deprecated.
gr_slatAttTo, /// This slot attaches to its parent at the given design units in the x direction
gr_slatAttX, /// This slot attaches to its parent at the given design units in the y direction
gr_slatAttY, /// This slot attaches to its parent at the given glyph point (not implemented)
gr_slatAttGpt, /// x-direction adjustment from the given glyph point (not implemented)
gr_slatAttXOff, /// y-direction adjustment from the given glyph point (not implemented)
gr_slatAttYOff, /// Where on this glyph should align with the attachment point on the parent glyph in the x-direction.
gr_slatAttWithX, /// Where on this glyph should align with the attachment point on the parent glyph in the y-direction
gr_slatAttWithY, /// Which glyph point on this glyph should align with the attachment point on the parent glyph (not implemented).
gr_slatWithGpt, /// Adjustment to gr_slatWithGpt in x-direction (not implemented)
gr_slatAttWithXOff, /// Adjustment to gr_slatWithGpt in y-direction (not implemented)
gr_slatAttWithYOff, /// Attach at given nesting level (not implemented)
gr_slatAttLevel, /// Line break breakweight for this glyph
gr_slatBreak, /// Ligature component reference (not implemented)
gr_slatCompRef, /// bidi directionality of this glyph (not implemented)
gr_slatDir, /// Whether insertion is allowed before this glyph
gr_slatInsert, /// Final positioned position of this glyph relative to its parent in x-direction in pixels
gr_slatPosX, /// Final positioned position of this glyph relative to its parent in y-direction in pixels
gr_slatPosY, /// Amount to shift glyph by in x-direction design units
gr_slatShiftX, /// Amount to shift glyph by in y-direction design units
gr_slatShiftY, /// attribute user1
gr_slatUserDefnV1, /// not implemented
gr_slatMeasureSol, /// not implemented
gr_slatMeasureEol, /// Amount this slot can stretch (not implemented)
gr_slatJStretch, /// Amount this slot can shrink (not implemented)
gr_slatJShrink, /// Granularity by which this slot can stretch or shrink (not implemented)
gr_slatJStep, /// Justification weight for this glyph (not implemented)
gr_slatJWeight, /// Amount this slot mush shrink or stretch in design units
gr_slatJWidth = 29, /// SubSegment split point
gr_slatSegSplit = gr_slatJStretch + 29, /// User defined attribute, see subattr for user attr number
gr_slatUserDefn, /// Bidi level
gr_slatBidiLevel = 56, /// Collision flags
gr_slatColFlags, /// Collision constraint rectangle left (bl.x)
gr_slatColLimitblx, /// Collision constraint rectangle lower (bl.y)
gr_slatColLimitbly, /// Collision constraint rectangle right (tr.x)
gr_slatColLimittrx, /// Collision constraint rectangle upper (tr.y)
gr_slatColLimittry, /// Collision shift x
gr_slatColShiftx, /// Collision shift y
gr_slatColShifty, /// Collision margin
gr_slatColMargin, /// Margin cost weight
gr_slatColMarginWt, // Additional glyph that excludes movement near this one:
gr_slatColExclGlyph,
gr_slatColExclOffx,
gr_slatColExclOffy, // Collision sequence enforcing attributes:
gr_slatSeqClass,
gr_slatSeqProxClass,
gr_slatSeqOrder,
gr_slatSeqAboveXoff,
gr_slatSeqAboveWt,
gr_slatSeqBelowXlim,
gr_slatSeqBelowWt,
gr_slatSeqValignHt,
gr_slatSeqValignWt,
/// not implemented
gr_slatMax, /// not implemented
gr_slatNoEffect = gr_slatMax + 1
};
enum gr_bidirtl { /// Underlying paragraph direction is RTL
gr_rtl = 1, /// Set this to not run the bidi pass internally, even if the font asks for it. /// This presumes that the segment is in a single direction. Most of the time /// this bit should be set unless you know you are passing full paragraphs of text.
gr_nobidi = 2, /// Disable auto mirroring for rtl text
gr_nomirror = 4
};
/** Returns Unicode character for a charinfo. * *@parampPointertocharinfotoreturninformationon.
*/
GR2_API unsignedint gr_cinfo_unicode_char(const gr_char_info* p/*not NULL*/);
/** Returns breakweight for a charinfo. * *@returnBreakweightisanumberbetween-50and50indicatingthecostofa *breakbeforeorafterthischaracter.Ifthevalue<0,theabsolutevalue *isthischaracter'scontributiontotheoverallbreakweightbeforeit.Ifthevalue *>0,thenthevalueisthischaracter'scontributiontotheoverallbreakweightafterit. *Theoverallbreakweightbetweentwocharactersisthemaximumofthebreakweight *contributionsfromthecharacterseithersideofit.Ifacharactermakesno *contributiontothebreakweightononesideofit,thecontributionisconsidered *tobe0. *@parampPointertocharinfotoreturninformationon.
*/
GR2_API int gr_cinfo_break_weight(const gr_char_info* p/*not NULL*/);
/** Returns the slot index that after this character is after in the slot stream * *Ineffecteachcharacterisassociatedwithasetofslotsandthisreturns *theindexofthelastslotinthesegmentthischaracterisassociatedwith. * *@returnafterslotindexbetween0andgr_seg_n_slots() *@parampPointertocharinfotoreturninformationon.
*/
GR2_API int gr_cinfo_after(const gr_char_info* p/*not NULL*/);
/** Returns the slot index that before this character is before in the slot stream * *Ineffecteachcharacterisassociatedwithasetofslotsandthisreturns *theindexofthefirstslotinthesegmentthischaracterisassociatedwith. * *@returnbeforeslotindexbetween0andgr_seg_n_slots() *@parampPointertocharinfotoreturninformationon.
*/
GR2_API int gr_cinfo_before(const gr_char_info* p/*not NULL*/);
/** Returns the code unit index of this character in the input string * *@returncodeunitindexbetween0andtheendofthestring *@parampPointertocharinfotoreturninformationon.
*/
GR2_API size_t gr_cinfo_base(const gr_char_info* p/*not NULL*/);
/** Returns the number of unicode characters in a string. * *@returnnumberofcharactersinthestring *@paramencSpecifiesthetypeofdatainthestring:utf8,utf16,utf32 *@parambuffer_beginThestartofthestring *@parambuffer_endMeasureuptothefirstnulorwhenendisreached,whicheverisearliest. *ThisparametermaybeNULL. *@parampErrorIfthereisastructuralfaultinthestring,thelocationisreturned *inthisvariable.Ifnoerroroccurs,pErrorwillcontainNULL.NULL *maybepassedforpErrorifnosuchinformationisrequired.
*/
GR2_API size_t gr_count_unicode_characters(enum gr_encform enc, constvoid* buffer_begin, constvoid* buffer_end, constvoid** pError);
/** Destroys a segment, freeing the memory. * *@parampThesegmenttodestroy
*/
GR2_API void gr_seg_destroy(gr_segment* p);
/** Returns the advance for the whole segment. * *Returnsthewidthofthesegmentuptothenextglyphoriginafterthesegment
*/
GR2_API float gr_seg_advance_X(const gr_segment* pSeg/*not NULL*/);
/** Returns the height advance for the segment. **/
GR2_API float gr_seg_advance_Y(const gr_segment* pSeg/*not NULL*/);
/** Returns the number of gr_char_infos in the segment. **/
GR2_API unsignedint gr_seg_n_cinfo(const gr_segment* pSeg/*not NULL*/);
/** Returns a gr_char_info at a given index in the segment. **/
GR2_API const gr_char_info* gr_seg_cinfo(const gr_segment* pSeg/*not NULL*/, unsigned int index/*must be <number_of_CharInfo*/);
/** Returns the number of glyph gr_slots in the segment. **/
GR2_API unsignedint gr_seg_n_slots(const gr_segment* pSeg/*not NULL*/); //one slot per glyph
/** Returns the first gr_slot in the segment. * *Thefirstslotinasegmenthasagr_slot_prev_in_segment()ofNULL.Slotsareowned *bytheirsegmentandaredestroyedalongwiththesegment.
*/
GR2_API const gr_slot* gr_seg_first_slot(gr_segment* pSeg/*not NULL*/); //may give a base slot or a slot which is attached to another
/** Returns the last gr_slot in the segment. * *Thelastslotinasegmenthasagr_slot_next_in_segment()ofNULL
*/
GR2_API const gr_slot* gr_seg_last_slot(gr_segment* pSeg/*not NULL*/); //may give a base slot or a slot which is attached to another
/** Justifies a linked list of slots for a line to a given width * *Passedapointertothestartofalinkedlistofslotscorrespondingtoaline,as *setupbygr_slot_linebreak_before,thisfunctionwillpositiontheglyphsintheline *totakeupthegivenwidth.Itispossibletospecifyasubrangewithinthelinetoprocess. *Thisallowsskippingoflineinitialorfinalwhitespace,forexample.Whilethiswillensure *thatthesubrangefitswidth,thelinewillstillbepositionedwiththefirstglyphofthe *lineat0.Sotheresultingpositionsmaybebeyondwidth. * *@returnfloatTheresultingwidthoftherangeofslotsjustified. *@parampSegPointertothesegment *@parampStartPointertothestartofthelinelinkedlist(includingskippedcharacters) *@parampFontFonttouseforpositioning *@paramwidthWidthinpixelsinwhichtofittheline.If<0.don'tadjustnaturalwidth,justrunjustificationpasses *tohandlelineendcontextuals,ifthereareany. *@paramflagsIndicateslineendingtypes.Defaultislinkedlistisafullline *@parampFirstIfnotNULL,thefirstslotinthelisttobeconsideredpartoftheline(socanskip) *@parampLastIfnotNULL,thelastslottoprocessintheline(allowsaytrailingwhitespacetobeskipped)
*/
GR2_API float gr_seg_justify(gr_segment* pSeg/*not NULL*/, const gr_slot* pStart/*not NULL*/, const gr_font *pFont, double width, enum gr_justFlags flags, const gr_slot* pFirst, const gr_slot* pLast);
/** Returns the next slot along in the segment. * *Slotsareheldinalinkedlist.Thisreturnsthenextinthelinkedlist.Theslot *mayormaynotbeattachedtoanotherslot.ReturnsNULLattheendofthesegment.
*/
GR2_API const gr_slot* gr_slot_next_in_segment(const gr_slot* p);
/** Returns the previous slot along in the segment. * *Slotsareheldinadoublylinkedlist.Thisreturnsthepreviosslotinthelinked *list.Thisslotmayormaynotbeattachedtoit.ReturnsNULLatthestartofthe *segment.
*/
GR2_API const gr_slot* gr_slot_prev_in_segment(const gr_slot* p);
/** Returns the attachment parent slot of this slot. * *Attachedslotsformatree.Thisreturnstheparentofthisslotinthattree.A *baseglyphwhichisnotattachedtoanotherglyph,alwaysreturnsNULL.
*/
GR2_API const gr_slot* gr_slot_attached_to(const gr_slot* p);
/** Returns the first slot attached to this slot. * *Attachedslotsformasinglylinkedlistfromtheparent.Thisreturnsthefirst *slotinthatlist.Notethatthisisareferencetoanotherslotthatisalsoin *themainsegmentdoublylinkedlist. * *ifgr_slot_first_attachment(p)!=NULLthengr_slot_attached_to(gr_slot_first_attachment(p))==p.
*/
GR2_API const gr_slot* gr_slot_first_attachment(const gr_slot* p);
/** Returns the next slot attached to our attachment parent. * *Thisreturnsthenextslotinthesinglylinkedlistofslotsattachedtothis *slot'sparent.Iftherearenomoresuchslots,NULLisreturned.Ifthereis *noparent,i.e.thepassedslotisaclusterbase,thenthenextclusterbase *ingraphicalorder(ltr,evenforrtltext)isreturned. * *ifgr_slot_next_sibling_attachment(p)!=NULLthengr_slot_attached_to(gr_slot_next_sibling_attachment(p))==gr_slot_attached_to(p).
*/
GR2_API const gr_slot* gr_slot_next_sibling_attachment(const gr_slot* p);
/** Returns glyph id of the slot * *Eachslothasaglyphidwhichisrenderedatthepositiongivenbytheslot.This *glyphidistherealglyphtoberenderedandneverapseudoglyph.
*/
GR2_API unsignedshort gr_slot_gid(const gr_slot* p);
/** Returns X offset of glyph from start of segment **/
GR2_API float gr_slot_origin_X(const gr_slot* p);
/** Returns Y offset of glyph from start of segment **/
GR2_API float gr_slot_origin_Y(const gr_slot* p);
/** Returns the glyph advance for this glyph as adjusted for kerning * *@parampSlottogiveresultsfor *@paramfacegr_faceoftheglyphs.MaybeNULLifunhintedadvancesused *@paramfontgr_fonttoscaleforpixelresults.IfNULLreturnsdesign *unitsadvance.IfnotNULLthenreturnspixeladvancebased *onhintedorscaledglyphadvancesinthefont.facemustbe *passedforhintedadvancestobeused.
*/
GR2_API float gr_slot_advance_X(const gr_slot* p, const gr_face* face, const gr_font *font);
/** Returns the vertical advance for the glyph in the slot adjusted for kerning * *ReturnsdesignunitsunlessfontisnotNULLinwhichcasethepixelvalue *isreturnedscaledforthegivenfont
*/
GR2_API float gr_slot_advance_Y(const gr_slot* p, const gr_face* face, const gr_font *font);
/** Returns the gr_char_info index before us * *Returnstheindexofthegr_char_infothatacursorbeforethisslot,wouldput *anunderlyingcursorbefore.Thismayalsobeinterprettedaseachslotholding *asetofchar_infosthatitisassociatedwithandthisfunctionreturningthe *indexofthechar_infowithlowestindex,fromthisset.
*/
GR2_API int gr_slot_before(const gr_slot* p/*not NULL*/);
/** Returns the gr_char_info index after us * *Returnstheindexofthegr_char_infothatacursorafterthisslotwouldputan *underlyingcursorafter.Thismayalsobeinterprettedaseachslotholdingaset *ofchar_infosthatitisassociatedwithandthisfunctionreturningtheindexof *thechar_infowiththehighestindex,fromthisset.
*/
GR2_API int gr_slot_after(const gr_slot* p/*not NULL*/);
/** Returns the index of this slot in the segment * *Returnstheindexgiventothisslotduringfinalpositioning.Thiscorresponds *tothevaluereturnedbrgr_cinfo_before()andgr_cinfo_after()
*/
GR2_API unsignedint gr_slot_index(const gr_slot* p/*not NULL*/);
/** Return a slot attribute value * *Givenaslotandanattributealongwithapossiblesubattribute,returnthe *correspondingvalueintheslot.Seeenumgr_attrCodefordetailsofeachattribute.
*/
GR2_API int gr_slot_attr(const gr_slot* p/*not NULL*/, const gr_segment* pSeg/*not NULL*/, enum gr_attrCode index, gr_uint8 subindex); //tbd - do we need to expose this?
/** Returns whether text may be inserted before this glyph. * *Thisindicateswhetheracursorcanbeputbeforethisslot.Itappliesto *baseglyphsthathavenoparentaswellasattachedglyphsthathavethe *.insertattributeexplicitlysettotrue.Thisistheprimarymechanism *foridentifyingcontiguoussequencesofbaseplusdiacritics.
*/
GR2_API int gr_slot_can_insert_before(const gr_slot* p);
/** Returns the original gr_char_info index this slot refers to. * *EachSlothasagr_char_infothatitoriginatesfrom.Thisisthatgr_char_info. *Theindexispassedtogr_seg_cinfo().Thisinformationisusefulfortesting.
*/
GR2_API int gr_slot_original(const gr_slot* p/*not NULL*/);
/** Breaks a segment into lines. * *Breakstheslotlinkedlistatthegivenpointinthelinkedlist.Itisup *totheapplicationtokeeptrackofthefirstslotoneachline.
*/
GR2_API void gr_slot_linebreak_before(gr_slot *p/*not NULL*/);
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.