my Android 4 app generates long views by adding multiple textviews
to a linearlayout
. This works well for all my list items, except of one. The problem is, that the list of textviews
aborts after adding the first textview
, but no exception is thrown!
I just see this warning in my LogCat:
TextLayoutCache | computeValuesWithHarfbuzz -- need to force to single run
Does anyone know what that means?
HarfBuzz is a layout/shaping engine for OpenType fonts. Its purpose is to standardize text layout in Open-source projects. That warning, can be traced back to android/graphics/TextLayoutCache.cpp.
The relevant code block is:
ubidi_setPara(bidi, chars, contextCount, bidiReq, NULL, &status); //runs the algorithm
int paraDir = ubidi_getParaLevel(bidi) & kDirection_Mask; // 0 if ltr, 1 if rtl
if (U_SUCCESS(status) && rc == 1) {
// Normal case: one run, status is ok
isRTL = (paraDir == 1);
useSingleRun = true;
} else if (!U_SUCCESS(status) || rc < 1) {
LOGW("computeValuesWithHarfbuzz -- need to force to single run");
isRTL = (paraDir == 1);
useSingleRun = true;
} else {...}
This part of the code is a part of the BiDi algorithm (uBiDi) which stands for Unicode Bidirectional, as detailed here.
Data in Arabic, Hebrew or another RTL languages need handling of bidirectional text. Because these right-to-left scripts use digits that are written from left to right, the text is actually bidirectional: a mixture of right-to-left and left-to-right text.
rc
in the above is the runcount of the algorithm. Each unicode character is assigned a level. (Even the unassigned ones)
Text is first split into different levels, (Level 0 is plain English text, Level 1 is plain Arabic text, possibly embedded within English level 0 text, etc)
The runs now occur in the following manner.
Levels: 0 0 0 1 1 1 2
Runs: <--- 1 ---> <--- 2 ---> <3>
Run count in the above example is 3. The warning is thrown if the BiDi algorithm hasn't been able to run even once successfully. There are many errors that can occur, preventing the successful running of the algorithm. Any one of these could've triggered the warning.
However, whether the warning occurs or not, the code behaviour is exactly identical except for the warning logged. So, it shouldn't affect the running of the application.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With