- Paragraph::size_type const last = rowLastPrintable(row);
-
- if (font.language()->lang() == "hebrew") {
- if (Encodings::IsComposeChar_hebrew(c)) {
- int const width = lyxfont::width(c, font2);
- int dx = 0;
- for (Paragraph::size_type i = pos-1; i >= 0; --i) {
- c = row->par()->getChar(i);
- if (!Encodings::IsComposeChar_hebrew(c)) {
- if (IsPrintableNonspace(c)) {
- int const width2 =
- singleWidth(bview,
- row->par(),
- i, c);
- dx = (c == 'ø' || c == 'ã') // dalet / resh
- ? width2 - width : (width2 - width) / 2;
- }
- break;
- }
- }
- // Draw nikud
- pain.text(int(x) + dx, offset + row->baseline(),
- textstring, font);
- } else {
- while (vpos <= last &&
- (pos = vis2log(vpos)) >= 0
- && IsPrintableNonspace(c = row->par()->getChar(pos))
- && !Encodings::IsComposeChar_hebrew(c)
- && font2 == getFont(bview->buffer(), row->par(), pos)) {
- textstring += c;
- ++vpos;
- }
- // Draw text and set the new x position
- pain.text(int(x), offset + row->baseline(),
- textstring, font);
- x += lyxfont::width(textstring, font);
- }
- } else if (font.language()->lang() == "arabic" &&
- (lyxrc.font_norm_type == LyXRC::ISO_8859_6_8 ||
- lyxrc.font_norm_type == LyXRC::ISO_10646_1)) {
- if (Encodings::IsComposeChar_arabic(c)) {
- c = transformChar(c, row->par(), pos);
- textstring = c;
- int const width = lyxfont::width(c, font2);
- int dx = 0;
- for (Paragraph::size_type i = pos-1; i >= 0; --i) {
- c = row->par()->getChar(i);
- if (!Encodings::IsComposeChar_arabic(c)) {
- if (IsPrintableNonspace(c)) {
- int const width2 =
- singleWidth(bview,
- row->par(),
- i, c);
- dx = (width2 - width) / 2;
- }
- break;
- }
- }
- // Draw nikud
- pain.text(int(x) + dx, offset + row->baseline(),
- textstring, font);
- } else {
- textstring = transformChar(c, row->par(), pos);
- while (vpos <= last &&
- (pos = vis2log(vpos)) >= 0
- && IsPrintableNonspace(c = row->par()->getChar(pos))
- && !Encodings::IsComposeChar_arabic(c)
- && font2 == getFont(bview->buffer(), row->par(), pos)) {
- c = transformChar(c, row->par(), pos);
- textstring += c;
- ++vpos;
- }
- // Draw text and set the new x position
- pain.text(int(x), offset + row->baseline(),
- textstring, font);
- x += lyxfont::width(textstring, font);
- }
- } else {
- while (vpos <= last &&
- (pos = vis2log(vpos)) >= 0
- && IsPrintableNonspace(c = row->par()->getChar(pos))
- && font2 == getFont(bview->buffer(), row->par(), pos)) {
- textstring += c;
- ++vpos;
- }
- // Draw text and set the new x position
- pain.text(int(x), offset + row->baseline(), textstring, font);
- x += lyxfont::width(textstring, font);