mirror of https://github.com/OpenTTD/OpenTTD
(svn r26032) [1.3] -Backport from trunk:
- Fix: The internal index of a character in the layout line depends on the used layouter (r26029) - Fix: Make the installer warning about Windows XP SP3 not trigger on the 64 bit Windows XP which is not really Windows XP to start with [FS#5773] (r26028)release/1.3
parent
28dfc29888
commit
4a33c03a49
|
@ -545,15 +545,22 @@ FunctionEnd
|
||||||
;-------------------------------------------------------------------------------
|
;-------------------------------------------------------------------------------
|
||||||
; Determine windows version, returns "win9x" if Win9x/Me/2000/XP SP2- or "winnt" for the rest on the stack
|
; Determine windows version, returns "win9x" if Win9x/Me/2000/XP SP2- or "winnt" for the rest on the stack
|
||||||
Function GetWindowsVersion
|
Function GetWindowsVersion
|
||||||
|
GetVersion::WindowsPlatformArchitecture
|
||||||
|
Pop $R0
|
||||||
|
IntCmp $R0 64 WinNT 0
|
||||||
ClearErrors
|
ClearErrors
|
||||||
StrCpy $R0 "win9x"
|
StrCpy $R0 "win9x"
|
||||||
${If} ${IsNT}
|
${If} ${IsNT}
|
||||||
${If} ${IsWinXP}
|
${If} ${IsWinXP}
|
||||||
${AndIf} ${AtLeastServicePack} 3
|
${AndIf} ${AtLeastServicePack} 3
|
||||||
${OrIf} ${AtLeastWin2003}
|
${OrIf} ${AtLeastWin2003}
|
||||||
|
GoTo WinNT
|
||||||
|
${EndIf}
|
||||||
|
${EndIf}
|
||||||
|
GoTo Done
|
||||||
|
WinNT:
|
||||||
StrCpy $R0 "winnt"
|
StrCpy $R0 "winnt"
|
||||||
${EndIf}
|
Done:
|
||||||
${EndIf}
|
|
||||||
Push $R0
|
Push $R0
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
|
||||||
|
|
|
@ -163,6 +163,12 @@ public:
|
||||||
int GetWidth() const { return l->getWidth(); }
|
int GetWidth() const { return l->getWidth(); }
|
||||||
int CountRuns() const { return l->countRuns(); }
|
int CountRuns() const { return l->countRuns(); }
|
||||||
const ParagraphLayouter::VisualRun *GetVisualRun(int run) const { return *this->Get(run); }
|
const ParagraphLayouter::VisualRun *GetVisualRun(int run) const { return *this->Get(run); }
|
||||||
|
|
||||||
|
int GetInternalCharLength(WChar c) const
|
||||||
|
{
|
||||||
|
/* ICU uses UTF-16 internally which means we need to account for surrogate pairs. */
|
||||||
|
return Utf8CharLen(c) < 4 ? 1 : 2;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
ICUParagraphLayout(ParagraphLayout *p) : p(p) { }
|
ICUParagraphLayout(ParagraphLayout *p) : p(p) { }
|
||||||
|
@ -259,6 +265,8 @@ public:
|
||||||
int GetWidth() const;
|
int GetWidth() const;
|
||||||
int CountRuns() const;
|
int CountRuns() const;
|
||||||
const ParagraphLayouter::VisualRun *GetVisualRun(int run) const;
|
const ParagraphLayouter::VisualRun *GetVisualRun(int run) const;
|
||||||
|
|
||||||
|
int GetInternalCharLength(WChar c) const { return 1; }
|
||||||
};
|
};
|
||||||
|
|
||||||
const WChar *buffer_begin; ///< Begin of the buffer.
|
const WChar *buffer_begin; ///< Begin of the buffer.
|
||||||
|
@ -699,12 +707,7 @@ Point Layouter::GetCharPosition(const char *ch) const
|
||||||
size_t len = Utf8Decode(&c, str);
|
size_t len = Utf8Decode(&c, str);
|
||||||
if (c == '\0' || c == '\n') break;
|
if (c == '\0' || c == '\n') break;
|
||||||
str += len;
|
str += len;
|
||||||
#ifdef WITH_ICU
|
index += (*this->Begin())->GetInternalCharLength(c);
|
||||||
/* ICU uses UTF-16 internally which means we need to account for surrogate pairs. */
|
|
||||||
index += len < 4 ? 1 : 2;
|
|
||||||
#else
|
|
||||||
index++;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (str == ch) {
|
if (str == ch) {
|
||||||
|
@ -762,15 +765,8 @@ const char *Layouter::GetCharAtPosition(int x) const
|
||||||
for (const char *str = this->string; *str != '\0'; ) {
|
for (const char *str = this->string; *str != '\0'; ) {
|
||||||
if (cur_idx == index) return str;
|
if (cur_idx == index) return str;
|
||||||
|
|
||||||
WChar c;
|
WChar c = Utf8Consume(&str);
|
||||||
size_t len = Utf8Decode(&c, str);
|
cur_idx += line->GetInternalCharLength(c);
|
||||||
#ifdef WITH_ICU
|
|
||||||
/* ICU uses UTF-16 internally which means we need to account for surrogate pairs. */
|
|
||||||
cur_idx += len < 4 ? 1 : 2;
|
|
||||||
#else
|
|
||||||
cur_idx++;
|
|
||||||
#endif
|
|
||||||
str += len;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,6 +124,7 @@ public:
|
||||||
virtual int GetWidth() const = 0;
|
virtual int GetWidth() const = 0;
|
||||||
virtual int CountRuns() const = 0;
|
virtual int CountRuns() const = 0;
|
||||||
virtual const VisualRun *GetVisualRun(int run) const = 0;
|
virtual const VisualRun *GetVisualRun(int run) const = 0;
|
||||||
|
virtual int GetInternalCharLength(WChar c) const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual void Reflow() = 0;
|
virtual void Reflow() = 0;
|
||||||
|
|
|
@ -15,6 +15,10 @@
|
||||||
* functions may still be available if you return an older API version
|
* functions may still be available if you return an older API version
|
||||||
* in GetAPIVersion() in info.nut.
|
* in GetAPIVersion() in info.nut.
|
||||||
*
|
*
|
||||||
|
* \b 1.3.3
|
||||||
|
*
|
||||||
|
* No changes
|
||||||
|
*
|
||||||
* \b 1.3.2
|
* \b 1.3.2
|
||||||
*
|
*
|
||||||
* No changes
|
* No changes
|
||||||
|
|
|
@ -15,6 +15,10 @@
|
||||||
* functions may still be available if you return an older API version
|
* functions may still be available if you return an older API version
|
||||||
* in GetAPIVersion() in info.nut.
|
* in GetAPIVersion() in info.nut.
|
||||||
*
|
*
|
||||||
|
* \b 1.3.3
|
||||||
|
*
|
||||||
|
* No changes
|
||||||
|
*
|
||||||
* \b 1.3.2
|
* \b 1.3.2
|
||||||
*
|
*
|
||||||
* No changes
|
* No changes
|
||||||
|
|
Loading…
Reference in New Issue