22#include <unicode/ubidi.h>
23#include <unicode/uchar.h>
37 , mnMinCharPos(nMinCharPos)
38 , mnEndCharPos(nEndCharPos)
39 , m_pTextLayoutCache(pLayoutCache)
41 , mpKashidaArray(nullptr)
62 UErrorCode rcI18n = U_ZERO_ERROR;
64 UBiDi* pParaBidi = ubidi_openSized(
nLength, 0, &rcI18n);
67 ubidi_setPara(pParaBidi,
reinterpret_cast<const UChar*
>(
mrStr.getStr()) +
mnMinCharPos,
68 nLength, nLevel,
nullptr, &rcI18n);
71 const int nRunCount = ubidi_countRuns(pParaBidi, &rcI18n);
72 for (
int i = 0;
i < nRunCount; ++
i)
74 int32_t nMinPos, nRunLength;
75 const UBiDiDirection nDir = ubidi_getVisualRun(pParaBidi,
i, &nMinPos, &nRunLength);
77 const int nPos1 = nPos0 + nRunLength;
79 const bool bRTL = (nDir == UBIDI_RTL);
80 AddRun(nPos0, nPos1, bRTL);
84 ubidi_close(pParaBidi);
119 if ((0x0001 <= cChar) && (cChar <= 0x001F))
122 if ((0x200E <= cChar) && (cChar <= 0x200F))
124 if ((0x2028 <= cChar) && (cChar <= 0x202E))
127 if ((0x206A <= cChar) && (cChar <= 0x206F))
132 if ((cChar == 0xFEFF) || (cChar == 0xFFFE) || (cChar == 0xFFFF))
143 SAL_WARN_IF(nCharPos0 > nCharPos1,
"vcl",
"ImplLayoutArgs::AddRun() nCharPos0>=nCharPos1");
148 for (
int i = nCharPos0;
i < nCharPos1; ++
i)
158 for (
int i = nCharPos1; --
i >= nCharPos0;)
174 if (pGlyphsImpl !=
nullptr)
179 for (
auto const& aGlyphItem : *pGlyphsImpl)
181 for (
int i = aGlyphItem.charPos();
i < aGlyphItem.charPos() + aGlyphItem.charCount();
201 std::vector<int> aPosVector;
202 aPosVector.reserve(
mrStr.getLength());
205 for (
int i = nMin;
i < nEnd; ++
i)
206 aPosVector.push_back(
i);
210 std::sort(aPosVector.begin(), aPosVector.end());
219 auto it = std::lower_bound(aPosVector.begin(), aPosVector.end(), nMin);
220 for (; (it != aPosVector.end()) && (*it < nEnd); ++it)
221 aNewRuns.
AddPos(*it, bRTL);
225 auto it = std::upper_bound(aPosVector.begin(), aPosVector.end(), nEnd);
226 while ((it != aPosVector.begin()) && (*--it >= nMin))
227 aNewRuns.
AddPos(*it, bRTL);
238 bool bValid =
maRuns.
GetRun(nMinRunPos, nEndRunPos, bRTL);
249 s <<
"ImplLayoutArgs{";
256 bool need_or =
false;
259 if (rArgs.mnFlags & SalLayoutFlags::x) \
288 for (
int i = 0;
i < lim;
i++)
290 if (rArgs.
mrStr[
i] ==
'\n')
293 s <<
"\\0x" << std::hex << std::setw(2) << std::setfill(
'0')
294 <<
static_cast<int>(rArgs.
mrStr[
i]) << std::setfill(
' ') << std::setw(1) << std::dec;
295 else if (rArgs.
mrStr[
i] < 0x7F)
296 s << static_cast<char>(rArgs.
mrStr[
i]);
298 s <<
"\\u" << std::hex << std::setw(4) << std::setfill(
'0')
299 <<
static_cast<int>(rArgs.
mrStr[
i]) << std::setfill(
' ') << std::setw(1) << std::dec;
313 for (
int i = 0;
i < lim;
i++)
330 s <<
",KashidaArray=";
338 for (
int i = 0;
i < lim;
i++)
void AddPos(int nCharPos, bool bRTL)
bool GetNextPos(int *nCharPos, bool *bRTL)
bool GetRun(int *nMinRunPos, int *nEndRunPos, bool *bRTL) const
void AddRun(int nMinRunPos, int nEndRunPos, bool bRTL)
void SetLayoutWidth(double nWidth)
bool GetNextPos(int *nCharPos, bool *bRTL)
void SetOrientation(Degree10 nOrientation)
bool GetNextRun(int *nMinRunPos, int *nEndRunPos, bool *bRTL)
void AddRun(int nMinCharPos, int nEndCharPos, bool bRTL)
ImplLayoutArgs(OUString const &rStr, int nMinCharPos, int nEndCharPos, SalLayoutFlags nFlags, LanguageTag aLanguageTag, vcl::text::TextLayoutCache const *pLayoutCache)
void SetKashidaArray(const sal_Bool *pKashidaArray)
const sal_Bool * mpKashidaArray
ImplLayoutRuns maFallbackRuns
bool PrepareFallback(const SalLayoutGlyphsImpl *pGlyphsImpl)
void AddFallbackRun(int nMinRunPos, int nEndRunPos, bool bRTL)
bool HasFallbackRun() const
void SetDXArray(const double *pDXArray)
#define SAL_WARN_IF(condition, area, stream)
LanguageTag maLanguageTag
static bool IsControlChar(sal_UCS4 cChar)
std::basic_ostream< charT, traits > & operator<<(std::basic_ostream< charT, traits > &stream, const Region &rRegion)