summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2015-08-09 12:33:27 +0000
committerrubidium <rubidium@openttd.org>2015-08-09 12:33:27 +0000
commit69fac508c386f660be4428a1e58da30ec0acd9a1 (patch)
tree7a0fd9a382b0e7dec5966bc7e50f249021d9f91a /src
parentbdf090b406e87ff2d0a3f3c5b6dc92b4c232dc3c (diff)
downloadopenttd-69fac508c386f660be4428a1e58da30ec0acd9a1.tar.xz
(svn r27367) -Codechange: make a distinction between the layouting part of ICU (lx) or the sorting/collation part of ICU (i18n)
Diffstat (limited to 'src')
-rw-r--r--src/crashlog.cpp15
-rw-r--r--src/gfx_layout.cpp10
-rw-r--r--src/gfx_layout.h10
-rw-r--r--src/language.h8
-rw-r--r--src/string.cpp10
-rw-r--r--src/strings.cpp12
6 files changed, 35 insertions, 30 deletions
diff --git a/src/crashlog.cpp b/src/crashlog.cpp
index e8290a7c3..7ddc2131f 100644
--- a/src/crashlog.cpp
+++ b/src/crashlog.cpp
@@ -196,9 +196,9 @@ char *CrashLog::LogConfiguration(char *buffer, const char *last) const
# include <ft2build.h>
# include FT_FREETYPE_H
#endif /* WITH_FREETYPE */
-#ifdef WITH_ICU
+#if defined(WITH_ICU_LAYOUT) || defined(WITH_ICU_SORT)
# include <unicode/uversion.h>
-#endif /* WITH_ICU */
+#endif /* WITH_ICU_SORT || WITH_ICU_LAYOUT */
#ifdef WITH_LZMA
# include <lzma.h>
#endif
@@ -241,14 +241,19 @@ char *CrashLog::LogLibraries(char *buffer, const char *last) const
buffer += seprintf(buffer, last, " FreeType: %d.%d.%d\n", major, minor, patch);
#endif /* WITH_FREETYPE */
-#ifdef WITH_ICU
+#if defined(WITH_ICU_LAYOUT) || defined(WITH_ICU_SORT)
/* 4 times 0-255, separated by dots (.) and a trailing '\0' */
char buf[4 * 3 + 3 + 1];
UVersionInfo ver;
u_getVersion(ver);
u_versionToString(ver, buf);
- buffer += seprintf(buffer, last, " ICU: %s\n", buf);
-#endif /* WITH_ICU */
+#ifdef WITH_ICU_SORT
+ buffer += seprintf(buffer, last, " ICU i18n: %s\n", buf);
+#endif
+#ifdef WITH_ICU_LAYOUT
+ buffer += seprintf(buffer, last, " ICU lx: %s\n", buf);
+#endif
+#endif /* WITH_ICU_SORT || WITH_ICU_LAYOUT */
#ifdef WITH_LZMA
buffer += seprintf(buffer, last, " LZMA: %s\n", lzma_version_string());
diff --git a/src/gfx_layout.cpp b/src/gfx_layout.cpp
index 2dba6a204..f5463d401 100644
--- a/src/gfx_layout.cpp
+++ b/src/gfx_layout.cpp
@@ -17,9 +17,9 @@
#include "table/control_codes.h"
-#ifdef WITH_ICU
+#ifdef WITH_ICU_LAYOUT
#include <unicode/ustring.h>
-#endif /* WITH_ICU */
+#endif /* WITH_ICU_LAYOUT */
#include "safeguards.h"
@@ -42,7 +42,7 @@ Font::Font(FontSize size, TextColour colour) :
assert(size < FS_END);
}
-#ifdef WITH_ICU
+#ifdef WITH_ICU_LAYOUT
/* Implementation details of LEFontInstance */
le_int32 Font::getUnitsPerEM() const
@@ -213,7 +213,7 @@ static ParagraphLayouter *GetParagraphLayout(UChar *buff, UChar *buff_end, FontM
return new ICUParagraphLayout(p);
}
-#endif /* WITH_ICU */
+#endif /* WITH_ICU_LAYOUT */
/*** Paragraph layout ***/
/**
@@ -654,7 +654,7 @@ Layouter::Layouter(const char *str, int maxw, TextColour colour, FontSize fontsi
line.layout->Reflow();
} else {
/* Line is new, layout it */
-#ifdef WITH_ICU
+#ifdef WITH_ICU_LAYOUT
FontState old_state = state;
const char *old_str = str;
diff --git a/src/gfx_layout.h b/src/gfx_layout.h
index 7cd70ce28..0a21d9b0c 100644
--- a/src/gfx_layout.h
+++ b/src/gfx_layout.h
@@ -19,12 +19,12 @@
#include <map>
#include <string>
-#ifdef WITH_ICU
+#ifdef WITH_ICU_LAYOUT
#include "layout/ParagraphLayout.h"
#define ICU_FONTINSTANCE : public LEFontInstance
-#else /* WITH_ICU */
+#else /* WITH_ICU_LAYOUT */
#define ICU_FONTINSTANCE
-#endif /* WITH_ICU */
+#endif /* WITH_ICU_LAYOUT */
/**
* Text drawing parameters, which can change while drawing a line, but are kept between multiple parts
@@ -75,7 +75,7 @@ public:
Font(FontSize size, TextColour colour);
-#ifdef WITH_ICU
+#ifdef WITH_ICU_LAYOUT
/* Implementation details of LEFontInstance */
le_int32 getUnitsPerEM() const;
@@ -91,7 +91,7 @@ public:
LEGlyphID mapCharToGlyph(LEUnicode32 ch) const;
void getGlyphAdvance(LEGlyphID glyph, LEPoint &advance) const;
le_bool getGlyphPoint(LEGlyphID glyph, le_int32 pointNumber, LEPoint &point) const;
-#endif /* WITH_ICU */
+#endif /* WITH_ICU_LAYOUT */
};
/** Mapping from index to font. */
diff --git a/src/language.h b/src/language.h
index 694b0ca1b..fed138e63 100644
--- a/src/language.h
+++ b/src/language.h
@@ -13,9 +13,9 @@
#define LANGUAGE_H
#include "core/smallvec_type.hpp"
-#ifdef WITH_ICU
+#ifdef WITH_ICU_SORT
#include <unicode/coll.h>
-#endif /* WITH_ICU */
+#endif /* WITH_ICU_SORT */
static const uint8 CASE_GENDER_LEN = 16; ///< The (maximum) length of a case/gender string.
static const uint8 MAX_NUM_GENDERS = 8; ///< Maximum number of supported genders.
@@ -110,9 +110,9 @@ extern LanguageList _languages;
/** The currently loaded language. */
extern const LanguageMetadata *_current_language;
-#ifdef WITH_ICU
+#ifdef WITH_ICU_SORT
extern Collator *_current_collator;
-#endif /* WITH_ICU */
+#endif /* WITH_ICU_SORT */
bool ReadLanguagePack(const LanguageMetadata *lang);
const LanguageMetadata *GetLanguage(byte newgrflangid);
diff --git a/src/string.cpp b/src/string.cpp
index 6bc9319c1..377fb7f98 100644
--- a/src/string.cpp
+++ b/src/string.cpp
@@ -25,12 +25,12 @@
#include <errno.h> // required by vsnprintf implementation for MSVC
#endif
-#ifdef WITH_ICU
+#ifdef WITH_ICU_SORT
/* Required by strnatcmp. */
#include <unicode/ustring.h>
#include "language.h"
#include "gfx_func.h"
-#endif /* WITH_ICU */
+#endif /* WITH_ICU_SORT */
/* The function vsnprintf is used internally to perform the required formatting
* tasks. As such this one must be allowed, and makes sure it's terminated. */
@@ -572,7 +572,7 @@ int strnatcmp(const char *s1, const char *s2, bool ignore_garbage_at_front)
s1 = SkipGarbage(s1);
s2 = SkipGarbage(s2);
}
-#ifdef WITH_ICU
+#ifdef WITH_ICU_SORT
if (_current_collator != NULL) {
UErrorCode status = U_ZERO_ERROR;
int result;
@@ -592,13 +592,13 @@ int strnatcmp(const char *s1, const char *s2, bool ignore_garbage_at_front)
if (U_SUCCESS(status)) return result;
}
-#endif /* WITH_ICU */
+#endif /* WITH_ICU_SORT */
/* Do a normal comparison if ICU is missing or if we cannot create a collator. */
return strcasecmp(s1, s2);
}
-#ifdef WITH_ICU
+#ifdef WITH_ICU_SORT
#include <unicode/utext.h>
#include <unicode/brkiter.h>
diff --git a/src/strings.cpp b/src/strings.cpp
index 9c88b70c7..5d1059243 100644
--- a/src/strings.cpp
+++ b/src/strings.cpp
@@ -49,9 +49,9 @@ const LanguageMetadata *_current_language = NULL; ///< The currently loaded lang
TextDirection _current_text_dir; ///< Text direction of the currently selected language.
-#ifdef WITH_ICU
+#ifdef WITH_ICU_SORT
Collator *_current_collator = NULL; ///< Collator for the language currently in use.
-#endif /* WITH_ICU */
+#endif /* WITH_ICU_SORT */
static uint64 _global_string_params_data[20]; ///< Global array of string parameters. To access, use #SetDParam.
static WChar _global_string_params_type[20]; ///< Type of parameters stored in #_decode_parameters
@@ -1790,7 +1790,7 @@ bool ReadLanguagePack(const LanguageMetadata *lang)
strecpy(_config_language_file, c_file, lastof(_config_language_file));
SetCurrentGrfLangID(_current_language->newgrflangid);
-#ifdef WITH_ICU
+#ifdef WITH_ICU_SORT
/* Delete previous collator. */
if (_current_collator != NULL) {
delete _current_collator;
@@ -1807,7 +1807,7 @@ bool ReadLanguagePack(const LanguageMetadata *lang)
delete _current_collator;
_current_collator = NULL;
}
-#endif /* WITH_ICU */
+#endif /* WITH_ICU_SORT */
/* Some lists need to be sorted again after a language change. */
ReconsiderGameScriptLanguage();
@@ -2132,7 +2132,7 @@ void CheckForMissingGlyphs(bool base_font, MissingGlyphSearcher *searcher)
/* Update the font with cache */
LoadStringWidthTable(searcher->Monospace());
-#if !defined(WITH_ICU)
+#if !defined(WITH_ICU_LAYOUT)
/*
* For right-to-left languages we need the ICU library. If
* we do not have support for that library we warn the user
@@ -2152,5 +2152,5 @@ void CheckForMissingGlyphs(bool base_font, MissingGlyphSearcher *searcher)
SetDParamStr(0, err_str);
ShowErrorMessage(STR_JUST_RAW_STRING, INVALID_STRING_ID, WL_ERROR);
}
-#endif
+#endif /* !WITH_ICU_LAYOUT */
}