pdfGetPrimaryDirection
Get the primary writing direction of the word list.
int pdfGetPrimaryDirection(PDFHandle pdf)
This function returns the primary writing direction of the word list
constructed by the most recent call to
pdfBuildWordList
. The
result will be +1 for left-to-right scripts, and -1 for right-to-left
scripts. The primary writing direction is determined by counting the
number of left-to-right and right-to-left characters, and choosing the
larger count.
To get the writing direction of individual words, call
pdfGetWordDirection
.
C:
PDFWordHandle word;
int primaryDir, wordDir;
/* make word list for page 1 */
pdfBuildWordList(pdf, 1);
/* get the primary writing direction for the page */
primaryDir = pdfGetPrimaryDirection();
for (i = 0; i < pdfGetNumWords(pdf); ++i) {
word = pdfGetWord(pdf, i);
wordDir = pdfGetWordDirection(word);
...
}