20#include <osl/diagnose.h>
54 pGlyphDev = &
SM_MOD()->GetDefaultVirtualDev();
61 aFnt.SetAlignment(ALIGN_TOP);
66 Size aFntSize = aFnt.GetFontSize();
70 while( aFntSize.
Height() > 2000 * nScaleFactor )
73 aFnt.SetFontSize(
Size( aFntSize.
Width() / nScaleFactor, aFntSize.
Height() / nScaleFactor ) );
81 OSL_ENSURE( bSuccess,
"GetTextBoundRect failed" );
87 aTmp.
Right() * nScaleFactor, aTmp.
Bottom() * nScaleFactor);
88 if (&rDev != pGlyphDev)
91 if (nGDTextWidth != 0 &&
92 nTextWidth != nGDTextWidth)
94 aResult.SetRight( aResult.Right() * nTextWidth );
95 aResult.SetRight( aResult.Right() / ( nGDTextWidth * nScaleFactor) );
103 aResult.Move(0, nDelta);
111bool SmIsMathAlpha(std::u16string_view aText)
120 u'\x2113',
u'\xE0D6',
u'\x2107',
124 u'\x2373',
u'\xE0A5',
u'\x2112',
131 OSL_ENSURE(aText.size() == 1,
"Sm : string must be exactly one character long");
135 if (u
'\xE0AC' <= cChar && cChar <= u
'\xE0D4')
138 return aMathAlpha.find(cChar) != aMathAlpha.end();
154 , nItalicLeftSpace(0)
155 , nItalicRightSpace(0)
159 , bHasBaseline(false)
160 , bHasAlignInfo(false)
179 const OUString &rText, sal_uInt16 nBorder)
182 , aSize(rDev.GetTextWidth(rText), rDev.GetTextHeight())
186 bool bAllowSmaller = bIsMath && !SmIsMathAlpha(rText);
215 nDelta = nFontHeight * 8 / 43;
224 bool bSuccess = SmGetGlyphBoundRect(rDev, rText, aGlyphRect);
226 SAL_WARN(
"starmath",
"Ooops... (Font missing?)");
260 OSL_ENSURE(rText.isEmpty() || !
IsEmpty(),
261 "Sm: empty rectangle created");
271 , aSize(nWidth, nHeight)
273 , nItalicLeftSpace(0)
274 , nItalicRightSpace(0)
276 , bHasBaseline(false)
277 , bHasAlignInfo(true)
442 if ((nTmp =
GetTop()) < nT)
526 bool bKeepVerAlignParams)
540 if (bKeepVerAlignParams)
558 bool bIsInside = IsInsideItalicRect(rPoint);
563 {
Point aIC (GetItalicCenterX(), GetCenterY());
565 aRef.
setX( rPoint.X() >= aIC.
X() ? GetItalicRight() : GetItalicLeft() );
566 aRef.
setY( rPoint.Y() >= aIC.
Y() ? GetBottom() : GetTop() );
571 if (rPoint.X() > GetItalicRight())
572 aRef.
setX( GetItalicRight() );
573 else if (rPoint.X() < GetItalicLeft())
574 aRef.
setX( GetItalicLeft() );
576 aRef.
setX( rPoint.X() );
578 if (rPoint.Y() > GetBottom())
579 aRef.
setY( GetBottom() );
580 else if (rPoint.Y() < GetTop())
581 aRef.
setY( GetTop() );
583 aRef.
setY( rPoint.Y() );
587 Point aDist (aRef - rPoint);
590 nAbsY = std::abs(aDist.
Y());
592 return bIsInside ? - std::min(nAbsX, nAbsY) : std::max (nAbsX, nAbsY);
css::chart::ChartAxisLabelPosition ePos
static OutputDevice * GetDefaultDevice()
tools::Long GetAscent() const
tools::Long GetInternalLeading() const
const vcl::Font & GetFont() const
void SetFont(const vcl::Font &rNewFont)
bool GetTextBoundRect(tools::Rectangle &rRect, const OUString &rStr, sal_Int32 nBase=0, sal_Int32 nIndex=0, sal_Int32 nLen=-1, sal_uLong nLayoutWidth=0, KernArraySpan aDXArray=KernArraySpan(), o3tl::span< const sal_Bool > pKashidaArray={}, const SalLayoutGlyphs *pGlyphs=nullptr) const
tools::Long GetTextWidth(const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1, vcl::text::TextLayoutCache const *=nullptr, SalLayoutGlyphs const *const pLayoutCache=nullptr) const
FontMetric GetFontMetric() const
const MapMode & GetMapMode() const
void Push(vcl::PushFlags nFlags=vcl::PushFlags::ALL)
tools::Long GetTextHeight() const
OutDevType GetOutDevType() const
constexpr tools::Long Y() const
void setX(tools::Long nX)
void setY(tools::Long nY)
tools::Long AdjustY(tools::Long nVertMove)
tools::Long AdjustX(tools::Long nHorzMove)
constexpr tools::Long X() const
constexpr tools::Long Height() const
void setWidth(tools::Long nWidth)
void setHeight(tools::Long nHeight)
constexpr tools::Long Width() const
tools::Long GetItalicLeft() const
void SetTop(tools::Long nTop)
tools::Long GetItalicLeftSpace() const
const Point & GetTopLeft() const
tools::Long GetItalicWidth() const
bool IsInsideRect(const Point &rPoint) const
void SetBottom(tools::Long nBottom)
tools::Long nItalicLeftSpace
tools::Long GetCenterY() const
tools::Long GetItalicRight() const
SmRect AsGlyphRect() const
tools::Long GetAlignT() const
tools::Long GetHeight() const
tools::Long OrientedDist(const Point &rPoint) const
tools::Long GetHiAttrFence() const
tools::Long GetItalicCenterX() const
void SetLeft(tools::Long nLeft)
void Move(const Point &rPosition)
void CopyAlignInfo(const SmRect &rRect)
tools::Long GetTop() const
bool IsInsideItalicRect(const Point &rPoint) const
tools::Long GetBottom() const
SmRect & ExtendBy(const SmRect &rRect, RectCopyMBL eCopyMode)
tools::Long nItalicRightSpace
tools::Long GetBaseline() const
void Union(const SmRect &rRect)
Italic correction is NOT taken into account here!
Point AlignTo(const SmRect &rRect, RectPos ePos, RectHorAlign eHor, RectVerAlign eVer) const
tools::Long GetLoAttrFence() const
void SetRight(tools::Long nRight)
tools::Long GetAlignB() const
tools::Long GetWidth() const
tools::Long GetAlignM() const
void SetItalicSpaces(tools::Long nLeftSpace, tools::Long nRightSpace)
bool HasAlignInfo() const
tools::Long GetLeft() const
void CopyMBL(const SmRect &rRect)
tools::Long GetRight() const
tools::Long GetItalicRightSpace() const
const OUString & GetFamilyName() const
const Size & GetFontSize() const
#define SAL_WARN(area, stream)
tools::Long const nBorder
tools::Long SmFromTo(tools::Long nFrom, tools::Long nTo, double fRelDist)
sal_Unicode const MS_SETN
constexpr OUStringLiteral FONTNAME_MATH
sal_Unicode const MS_LAMBDABAR
sal_Unicode const MS_SETQ
sal_Unicode const MS_SETR
sal_Unicode const MS_ALEPH
sal_Unicode const MS_SETC
sal_Unicode const MS_SETZ
sal_Unicode const MS_HBAR
sal_Unicode const MS_EMPTYSET