LibreOffice Module sw (master) 1
Functions
sw::Justify Namespace Reference

Functions

sal_Int32 GetModelPosition (const KernArray &rKernArray, sal_Int32 nLen, tools::Long nX)
 Get model position base on given kern array. More...
 
void SpaceDistribution (KernArray &rKernArray, std::u16string_view aText, sal_Int32 nStt, sal_Int32 nLen, tools::Long nSpaceAdd, tools::Long nKern, bool bNoHalfSpace)
 Distribute space between words and letters. More...
 
tools::Long SnapToGrid (KernArray &rKernArray, std::u16string_view aText, sal_Int32 nStt, sal_Int32 nLen, tools::Long nGridWidth, bool bForceLeft)
 Snap ideographs to text grids: a) Ideographic open brackets are aligned to the rightmost edge of spanned grids so that. More...
 
void SnapToGridEdge (KernArray &rKernArray, sal_Int32 nLen, tools::Long nGridWidth, tools::Long nSpace, tools::Long nKern)
 Snap ideographs to text grids edge ( used when snap to char is off ): space will be distributed ( in case that alignment is set to justify. More...
 

Function Documentation

◆ GetModelPosition()

SW_DLLPUBLIC sal_Int32 sw::Justify::GetModelPosition ( const KernArray rKernArray,
sal_Int32  nLen,
tools::Long  nX 
)

Get model position base on given kern array.

Parameters
rKernArraytext positions from OutDev::GetTextArray().
nLennumber of elements to process in rKernArray.
nXthe visual position

Definition at line 77 of file justify.cxx.

Referenced by SwFntObj::GetModelPositionForViewPoint().

◆ SnapToGrid()

SW_DLLPUBLIC tools::Long sw::Justify::SnapToGrid ( KernArray rKernArray,
std::u16string_view  aText,
sal_Int32  nStt,
sal_Int32  nLen,
tools::Long  nGridWidth,
bool  bForceLeft 
)

Snap ideographs to text grids: a) Ideographic open brackets are aligned to the rightmost edge of spanned grids so that.

b) Ideographic close brackets, ideographic comma, and ideographic fullstop are aligned to the leftmost edge of spanned grids so that they can be closer to the previous ideograph. c) Other ideographs are aligned to the center of the spanned grids.

Parameters
[in,out]rKernArraytext positions from OutDev::GetTextArray().
aTextstring used to determine where space and kern are inserted.
nSttstarting index of rText.
nLennumber of elements to process in rKernArray and rText.
nGridWidthwidth of a text grid
bForceLeftfor align to the left edge of the grid disregard of the punctuation type. This is useful for calculate text width, line break, and conversion model position.
Returns
the delta offset of first glyph so text origin can be updated accordingly.

Definition at line 176 of file justify.cxx.

References i, KernArray::set(), and KernArray::size().

Referenced by SwTextCursor::AdjustBaseLine(), SwTextFormatter::CalcRealHeight(), SwFntObj::DrawText(), SwFntObj::GetModelPositionForViewPoint(), SwFont::GetTextBreak(), and SwFntObj::GetTextSize().

◆ SnapToGridEdge()

SW_DLLPUBLIC void sw::Justify::SnapToGridEdge ( KernArray rKernArray,
sal_Int32  nLen,
tools::Long  nGridWidth,
tools::Long  nSpace,
tools::Long  nKern 
)

Snap ideographs to text grids edge ( used when snap to char is off ): space will be distributed ( in case that alignment is set to justify.

).

Parameters
[in,out]rKernArraytext positions from OutDev::GetTextArray().
nLennumber of elements to process in rKernArray and rText.
nGridWidthwidth of a text grid
nSpaceamount of space distributed under justify text alignment mode.
nKernletter spacing.

Definition at line 216 of file justify.cxx.

References i, KernArray::set(), and KernArray::size().

Referenced by SwFntObj::DrawText(), SwFntObj::GetModelPositionForViewPoint(), SwFont::GetTextBreak(), and SwFntObj::GetTextSize().

◆ SpaceDistribution()

SW_DLLPUBLIC void sw::Justify::SpaceDistribution ( KernArray rKernArray,
std::u16string_view  aText,
sal_Int32  nStt,
sal_Int32  nLen,
tools::Long  nSpaceAdd,
tools::Long  nKern,
bool  bNoHalfSpace 
)

Distribute space between words and letters.

Parameters
[in,out]rKernArraytext positions from OutDev::GetTextArray().
aTextstring used to determine where space and kern are inserted.
nSttstarting index of rText.
nLennumber of elements to process in rKernArray and rText.
nSpaceAddamount of space to insert for each CH_BLANK.
nKernamount of space to insert between letters.
bNoHalfSpacewhether to split the space into two halves. Split spaces are inserted before and after CH_BLANK. Set to true in word line mode and for Arabic text to avoid splitting.

Definition at line 101 of file justify.cxx.

References KernArray::adjust(), CH_BLANK, i, nValue, KernArray::set(), and KernArray::size().

Referenced by SwFntObj::DrawText().