[sword-svn] r472 - branches/BCB5
chrislit at www.crosswire.org
chrislit at www.crosswire.org
Sun Jan 6 01:35:55 MST 2008
Author: chrislit
Date: 2008-01-06 01:35:54 -0700 (Sun, 06 Jan 2008)
New Revision: 472
Modified:
branches/BCB5/swdisprtfchap.cpp
Log:
simplified procedure for adding support for new Arabic & Hebrew script languages
Modified: branches/BCB5/swdisprtfchap.cpp
===================================================================
--- branches/BCB5/swdisprtfchap.cpp 2007-10-23 06:12:48 UTC (rev 471)
+++ branches/BCB5/swdisprtfchap.cpp 2008-01-06 08:35:54 UTC (rev 472)
@@ -58,6 +58,9 @@
char buf[254];
System::AnsiString newtext, tmptext, tmptext2;
+ static bool hebarLang;
+ static char* hebarLanguages[] = {"he", "ar", "fa", "ug", 0};
+
VerseKey *key = (VerseKey *)(SWKey *)Module;
key->Headings(1);
testmt = key->Testament();
@@ -78,6 +81,16 @@
module = &Module;
type = "Default";
+ //Windows of various flavors has odd behavior with Hebrew & Arabic, which are only partially supported as RTL scripts.
+ //This snippet determines whether the module is set up to use one of these languages and is tagged as RTL.
+ hebarLang = false;
+ if (Module.Direction() == DIRECTION_RTL && Module.Lang()) {
+ for (unsigned char l = 0; hebarLanguages[l]; l++) {
+ if (!strnicmp(Module.Lang(), hebarLanguages[l], 2)) { //change the length variable if we ever get any 3-char language codes
+ hebarLang = true;
+ }
+ }
+ }
recalcAppearance();
newtext = RTFHeader;
@@ -86,7 +99,7 @@
if (Module.Direction() == DIRECTION_RTL) {
newtext = newtext + "\\qr ";
}
- if (Module.Direction() == DIRECTION_RTL && (platformID == VER_PLATFORM_WIN32_NT && (!strnicmp(Module.Lang(), "he", 2) || !strnicmp(Module.Lang(), "ar", 2) || !strnicmp(Module.Lang(), "fa", 2)))) {
+ if (platformID == VER_PLATFORM_WIN32_NT && hebarLang) {
newtext = newtext + "\\rtlpar ";
}
@@ -123,7 +136,7 @@
}
else break;
} while (true);
- if (Module.Direction() == DIRECTION_RTL && (platformID == VER_PLATFORM_WIN32_WINDOWS || (Module.Lang() && strnicmp(Module.Lang(), "he", 2) && strnicmp(Module.Lang(), "ar", 2) && strnicmp(Module.Lang(), "fa", 2)))) {
+ if (Module.Direction() == DIRECTION_RTL && (platformID == VER_PLATFORM_WIN32_WINDOWS || !hebarLang)) {
newtext = newtext + RTFVersePre;
if ((key->Verse() == verse) && (dispAttribs.markCurrentVerse)) {
newtext = newtext + "\\cf2 "; // \cf2 = second color in color table
More information about the sword-cvs
mailing list