Improved support for international text
- Implementation by @herm for GSOC 2012 (http://mapnik.org/news/2012/10/06/gsoc2012-status9/)
- C++11 port, improvements, optimizations by @artemp
- Testing and integration with master by @springmeyer
- Thank you to all the support from @behdad along the way
- Thanks for help testing @toton6868, @stephankn, @nirvn, @mfrasca, @simonsonc and many others
Refs: #2073,#2070,#2038,#2037,#1953,#1820,#1819,#1714,#1634,#1547,#1532,#1319,#1208,#1154,#1146
2013-11-22 09:06:32 +01:00
|
|
|
/*
|
|
|
|
*******************************************************************************
|
|
|
|
*
|
|
|
|
* Copyright (C) 1999-2001, International Business Machines
|
|
|
|
* Corporation and others. All Rights Reserved.
|
|
|
|
*
|
|
|
|
*******************************************************************************
|
|
|
|
* file name: scrptrun.cpp
|
|
|
|
*
|
|
|
|
* created on: 10/17/2001
|
|
|
|
* created by: Eric R. Mader
|
|
|
|
*
|
|
|
|
* NOTE: This file is copied from ICU.
|
|
|
|
* http://source.icu-project.org/repos/icu/icu/trunk/license.html
|
|
|
|
*/
|
|
|
|
|
2020-11-19 15:30:30 +01:00
|
|
|
#include <mapnik/warning.hpp>
|
|
|
|
MAPNIK_DISABLE_WARNING_PUSH
|
2016-03-10 21:46:00 +01:00
|
|
|
#include <mapnik/warning_ignore.hpp>
|
Improved support for international text
- Implementation by @herm for GSOC 2012 (http://mapnik.org/news/2012/10/06/gsoc2012-status9/)
- C++11 port, improvements, optimizations by @artemp
- Testing and integration with master by @springmeyer
- Thank you to all the support from @behdad along the way
- Thanks for help testing @toton6868, @stephankn, @nirvn, @mfrasca, @simonsonc and many others
Refs: #2073,#2070,#2038,#2037,#1953,#1820,#1819,#1714,#1634,#1547,#1532,#1319,#1208,#1154,#1146
2013-11-22 09:06:32 +01:00
|
|
|
#include <unicode/utypes.h>
|
|
|
|
#include <unicode/uscript.h>
|
2020-11-19 15:30:30 +01:00
|
|
|
MAPNIK_DISABLE_WARNING_POP
|
Improved support for international text
- Implementation by @herm for GSOC 2012 (http://mapnik.org/news/2012/10/06/gsoc2012-status9/)
- C++11 port, improvements, optimizations by @artemp
- Testing and integration with master by @springmeyer
- Thank you to all the support from @behdad along the way
- Thanks for help testing @toton6868, @stephankn, @nirvn, @mfrasca, @simonsonc and many others
Refs: #2073,#2070,#2038,#2037,#1953,#1820,#1819,#1714,#1634,#1547,#1532,#1319,#1208,#1154,#1146
2013-11-22 09:06:32 +01:00
|
|
|
|
|
|
|
#include <mapnik/text/scrptrun.hpp>
|
|
|
|
|
2022-01-26 10:43:31 +01:00
|
|
|
template<class T, std::size_t N>
|
2019-11-01 14:06:21 +01:00
|
|
|
constexpr std::size_t ARRAY_SIZE(const T (&array)[N]) noexcept
|
|
|
|
{
|
|
|
|
return N;
|
|
|
|
}
|
Improved support for international text
- Implementation by @herm for GSOC 2012 (http://mapnik.org/news/2012/10/06/gsoc2012-status9/)
- C++11 port, improvements, optimizations by @artemp
- Testing and integration with master by @springmeyer
- Thank you to all the support from @behdad along the way
- Thanks for help testing @toton6868, @stephankn, @nirvn, @mfrasca, @simonsonc and many others
Refs: #2073,#2070,#2038,#2037,#1953,#1820,#1819,#1714,#1634,#1547,#1532,#1319,#1208,#1154,#1146
2013-11-22 09:06:32 +01:00
|
|
|
|
2022-01-26 10:43:31 +01:00
|
|
|
const char ScriptRun::fgClassID = 0;
|
|
|
|
|
|
|
|
UChar32 ScriptRun::pairedChars[] = {0x0028, 0x0029, // ascii paired punctuation
|
|
|
|
0x003c, 0x003e, 0x005b, 0x005d, 0x007b, 0x007d, 0x00ab, 0x00bb, // guillemets
|
|
|
|
0x2018, 0x2019, // general punctuation
|
|
|
|
0x201c, 0x201d, 0x2039, 0x203a, 0x3008, 0x3009, // chinese paired punctuation
|
|
|
|
0x300a, 0x300b, 0x300c, 0x300d, 0x300e, 0x300f, 0x3010, 0x3011,
|
|
|
|
0x3014, 0x3015, 0x3016, 0x3017, 0x3018, 0x3019, 0x301a, 0x301b};
|
Improved support for international text
- Implementation by @herm for GSOC 2012 (http://mapnik.org/news/2012/10/06/gsoc2012-status9/)
- C++11 port, improvements, optimizations by @artemp
- Testing and integration with master by @springmeyer
- Thank you to all the support from @behdad along the way
- Thanks for help testing @toton6868, @stephankn, @nirvn, @mfrasca, @simonsonc and many others
Refs: #2073,#2070,#2038,#2037,#1953,#1820,#1819,#1714,#1634,#1547,#1532,#1319,#1208,#1154,#1146
2013-11-22 09:06:32 +01:00
|
|
|
|
|
|
|
const int32_t ScriptRun::pairedCharCount = ARRAY_SIZE(pairedChars);
|
|
|
|
const int32_t ScriptRun::pairedCharPower = 1 << highBit(pairedCharCount);
|
|
|
|
const int32_t ScriptRun::pairedCharExtra = pairedCharCount - pairedCharPower;
|
|
|
|
|
|
|
|
int8_t ScriptRun::highBit(int32_t value)
|
|
|
|
{
|
2022-01-26 10:43:31 +01:00
|
|
|
if (value <= 0)
|
|
|
|
{
|
Improved support for international text
- Implementation by @herm for GSOC 2012 (http://mapnik.org/news/2012/10/06/gsoc2012-status9/)
- C++11 port, improvements, optimizations by @artemp
- Testing and integration with master by @springmeyer
- Thank you to all the support from @behdad along the way
- Thanks for help testing @toton6868, @stephankn, @nirvn, @mfrasca, @simonsonc and many others
Refs: #2073,#2070,#2038,#2037,#1953,#1820,#1819,#1714,#1634,#1547,#1532,#1319,#1208,#1154,#1146
2013-11-22 09:06:32 +01:00
|
|
|
return -32;
|
|
|
|
}
|
|
|
|
|
|
|
|
int8_t bit = 0;
|
|
|
|
|
2022-01-26 10:43:31 +01:00
|
|
|
if (value >= 1 << 16)
|
|
|
|
{
|
Improved support for international text
- Implementation by @herm for GSOC 2012 (http://mapnik.org/news/2012/10/06/gsoc2012-status9/)
- C++11 port, improvements, optimizations by @artemp
- Testing and integration with master by @springmeyer
- Thank you to all the support from @behdad along the way
- Thanks for help testing @toton6868, @stephankn, @nirvn, @mfrasca, @simonsonc and many others
Refs: #2073,#2070,#2038,#2037,#1953,#1820,#1819,#1714,#1634,#1547,#1532,#1319,#1208,#1154,#1146
2013-11-22 09:06:32 +01:00
|
|
|
value >>= 16;
|
|
|
|
bit += 16;
|
|
|
|
}
|
|
|
|
|
2022-01-26 10:43:31 +01:00
|
|
|
if (value >= 1 << 8)
|
|
|
|
{
|
Improved support for international text
- Implementation by @herm for GSOC 2012 (http://mapnik.org/news/2012/10/06/gsoc2012-status9/)
- C++11 port, improvements, optimizations by @artemp
- Testing and integration with master by @springmeyer
- Thank you to all the support from @behdad along the way
- Thanks for help testing @toton6868, @stephankn, @nirvn, @mfrasca, @simonsonc and many others
Refs: #2073,#2070,#2038,#2037,#1953,#1820,#1819,#1714,#1634,#1547,#1532,#1319,#1208,#1154,#1146
2013-11-22 09:06:32 +01:00
|
|
|
value >>= 8;
|
|
|
|
bit += 8;
|
|
|
|
}
|
|
|
|
|
2022-01-26 10:43:31 +01:00
|
|
|
if (value >= 1 << 4)
|
|
|
|
{
|
Improved support for international text
- Implementation by @herm for GSOC 2012 (http://mapnik.org/news/2012/10/06/gsoc2012-status9/)
- C++11 port, improvements, optimizations by @artemp
- Testing and integration with master by @springmeyer
- Thank you to all the support from @behdad along the way
- Thanks for help testing @toton6868, @stephankn, @nirvn, @mfrasca, @simonsonc and many others
Refs: #2073,#2070,#2038,#2037,#1953,#1820,#1819,#1714,#1634,#1547,#1532,#1319,#1208,#1154,#1146
2013-11-22 09:06:32 +01:00
|
|
|
value >>= 4;
|
|
|
|
bit += 4;
|
|
|
|
}
|
|
|
|
|
2022-01-26 10:43:31 +01:00
|
|
|
if (value >= 1 << 2)
|
|
|
|
{
|
Improved support for international text
- Implementation by @herm for GSOC 2012 (http://mapnik.org/news/2012/10/06/gsoc2012-status9/)
- C++11 port, improvements, optimizations by @artemp
- Testing and integration with master by @springmeyer
- Thank you to all the support from @behdad along the way
- Thanks for help testing @toton6868, @stephankn, @nirvn, @mfrasca, @simonsonc and many others
Refs: #2073,#2070,#2038,#2037,#1953,#1820,#1819,#1714,#1634,#1547,#1532,#1319,#1208,#1154,#1146
2013-11-22 09:06:32 +01:00
|
|
|
value >>= 2;
|
|
|
|
bit += 2;
|
|
|
|
}
|
|
|
|
|
2022-01-26 10:43:31 +01:00
|
|
|
if (value >= 1 << 1)
|
|
|
|
{
|
Improved support for international text
- Implementation by @herm for GSOC 2012 (http://mapnik.org/news/2012/10/06/gsoc2012-status9/)
- C++11 port, improvements, optimizations by @artemp
- Testing and integration with master by @springmeyer
- Thank you to all the support from @behdad along the way
- Thanks for help testing @toton6868, @stephankn, @nirvn, @mfrasca, @simonsonc and many others
Refs: #2073,#2070,#2038,#2037,#1953,#1820,#1819,#1714,#1634,#1547,#1532,#1319,#1208,#1154,#1146
2013-11-22 09:06:32 +01:00
|
|
|
value >>= 1;
|
|
|
|
bit += 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return bit;
|
|
|
|
}
|
|
|
|
|
|
|
|
int32_t ScriptRun::getPairIndex(UChar32 ch)
|
|
|
|
{
|
|
|
|
int32_t probe = pairedCharPower;
|
|
|
|
int32_t index = 0;
|
|
|
|
|
2022-01-26 10:43:31 +01:00
|
|
|
if (ch >= pairedChars[pairedCharExtra])
|
|
|
|
{
|
Improved support for international text
- Implementation by @herm for GSOC 2012 (http://mapnik.org/news/2012/10/06/gsoc2012-status9/)
- C++11 port, improvements, optimizations by @artemp
- Testing and integration with master by @springmeyer
- Thank you to all the support from @behdad along the way
- Thanks for help testing @toton6868, @stephankn, @nirvn, @mfrasca, @simonsonc and many others
Refs: #2073,#2070,#2038,#2037,#1953,#1820,#1819,#1714,#1634,#1547,#1532,#1319,#1208,#1154,#1146
2013-11-22 09:06:32 +01:00
|
|
|
index = pairedCharExtra;
|
|
|
|
}
|
|
|
|
|
2022-01-26 10:43:31 +01:00
|
|
|
while (probe > (1 << 0))
|
|
|
|
{
|
Improved support for international text
- Implementation by @herm for GSOC 2012 (http://mapnik.org/news/2012/10/06/gsoc2012-status9/)
- C++11 port, improvements, optimizations by @artemp
- Testing and integration with master by @springmeyer
- Thank you to all the support from @behdad along the way
- Thanks for help testing @toton6868, @stephankn, @nirvn, @mfrasca, @simonsonc and many others
Refs: #2073,#2070,#2038,#2037,#1953,#1820,#1819,#1714,#1634,#1547,#1532,#1319,#1208,#1154,#1146
2013-11-22 09:06:32 +01:00
|
|
|
probe >>= 1;
|
|
|
|
|
2022-01-26 10:43:31 +01:00
|
|
|
if (ch >= pairedChars[index + probe])
|
|
|
|
{
|
Improved support for international text
- Implementation by @herm for GSOC 2012 (http://mapnik.org/news/2012/10/06/gsoc2012-status9/)
- C++11 port, improvements, optimizations by @artemp
- Testing and integration with master by @springmeyer
- Thank you to all the support from @behdad along the way
- Thanks for help testing @toton6868, @stephankn, @nirvn, @mfrasca, @simonsonc and many others
Refs: #2073,#2070,#2038,#2037,#1953,#1820,#1819,#1714,#1634,#1547,#1532,#1319,#1208,#1154,#1146
2013-11-22 09:06:32 +01:00
|
|
|
index += probe;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-26 10:43:31 +01:00
|
|
|
if (pairedChars[index] != ch)
|
|
|
|
{
|
Improved support for international text
- Implementation by @herm for GSOC 2012 (http://mapnik.org/news/2012/10/06/gsoc2012-status9/)
- C++11 port, improvements, optimizations by @artemp
- Testing and integration with master by @springmeyer
- Thank you to all the support from @behdad along the way
- Thanks for help testing @toton6868, @stephankn, @nirvn, @mfrasca, @simonsonc and many others
Refs: #2073,#2070,#2038,#2037,#1953,#1820,#1819,#1714,#1634,#1547,#1532,#1319,#1208,#1154,#1146
2013-11-22 09:06:32 +01:00
|
|
|
index = -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return index;
|
|
|
|
}
|
|
|
|
|
|
|
|
UBool ScriptRun::sameScript(int32_t scriptOne, int32_t scriptTwo)
|
|
|
|
{
|
|
|
|
return scriptOne <= USCRIPT_INHERITED || scriptTwo <= USCRIPT_INHERITED || scriptOne == scriptTwo;
|
|
|
|
}
|
|
|
|
|
|
|
|
UBool ScriptRun::next()
|
|
|
|
{
|
2022-01-26 10:43:31 +01:00
|
|
|
int32_t startSP = parenSP; // used to find the first new open character
|
Improved support for international text
- Implementation by @herm for GSOC 2012 (http://mapnik.org/news/2012/10/06/gsoc2012-status9/)
- C++11 port, improvements, optimizations by @artemp
- Testing and integration with master by @springmeyer
- Thank you to all the support from @behdad along the way
- Thanks for help testing @toton6868, @stephankn, @nirvn, @mfrasca, @simonsonc and many others
Refs: #2073,#2070,#2038,#2037,#1953,#1820,#1819,#1714,#1634,#1547,#1532,#1319,#1208,#1154,#1146
2013-11-22 09:06:32 +01:00
|
|
|
UErrorCode error = U_ZERO_ERROR;
|
|
|
|
|
|
|
|
// if we've fallen off the end of the text, we're done
|
2022-01-26 10:43:31 +01:00
|
|
|
if (scriptEnd >= charLimit)
|
|
|
|
{
|
Improved support for international text
- Implementation by @herm for GSOC 2012 (http://mapnik.org/news/2012/10/06/gsoc2012-status9/)
- C++11 port, improvements, optimizations by @artemp
- Testing and integration with master by @springmeyer
- Thank you to all the support from @behdad along the way
- Thanks for help testing @toton6868, @stephankn, @nirvn, @mfrasca, @simonsonc and many others
Refs: #2073,#2070,#2038,#2037,#1953,#1820,#1819,#1714,#1634,#1547,#1532,#1319,#1208,#1154,#1146
2013-11-22 09:06:32 +01:00
|
|
|
return false;
|
|
|
|
}
|
2017-01-31 17:42:24 +01:00
|
|
|
|
Improved support for international text
- Implementation by @herm for GSOC 2012 (http://mapnik.org/news/2012/10/06/gsoc2012-status9/)
- C++11 port, improvements, optimizations by @artemp
- Testing and integration with master by @springmeyer
- Thank you to all the support from @behdad along the way
- Thanks for help testing @toton6868, @stephankn, @nirvn, @mfrasca, @simonsonc and many others
Refs: #2073,#2070,#2038,#2037,#1953,#1820,#1819,#1714,#1634,#1547,#1532,#1319,#1208,#1154,#1146
2013-11-22 09:06:32 +01:00
|
|
|
scriptCode = USCRIPT_COMMON;
|
|
|
|
|
2022-01-26 10:43:31 +01:00
|
|
|
for (scriptStart = scriptEnd; scriptEnd < charLimit; scriptEnd += 1)
|
|
|
|
{
|
|
|
|
UChar high = charArray[scriptEnd];
|
|
|
|
UChar32 ch = high;
|
Improved support for international text
- Implementation by @herm for GSOC 2012 (http://mapnik.org/news/2012/10/06/gsoc2012-status9/)
- C++11 port, improvements, optimizations by @artemp
- Testing and integration with master by @springmeyer
- Thank you to all the support from @behdad along the way
- Thanks for help testing @toton6868, @stephankn, @nirvn, @mfrasca, @simonsonc and many others
Refs: #2073,#2070,#2038,#2037,#1953,#1820,#1819,#1714,#1634,#1547,#1532,#1319,#1208,#1154,#1146
2013-11-22 09:06:32 +01:00
|
|
|
|
|
|
|
// if the character is a high surrogate and it's not the last one
|
|
|
|
// in the text, see if it's followed by a low surrogate
|
|
|
|
if (high >= 0xD800 && high <= 0xDBFF && scriptEnd < charLimit - 1)
|
|
|
|
{
|
|
|
|
UChar low = charArray[scriptEnd + 1];
|
|
|
|
|
|
|
|
// if it is followed by a low surrogate,
|
|
|
|
// consume it and form the full character
|
2022-01-26 10:43:31 +01:00
|
|
|
if (low >= 0xDC00 && low <= 0xDFFF)
|
|
|
|
{
|
Improved support for international text
- Implementation by @herm for GSOC 2012 (http://mapnik.org/news/2012/10/06/gsoc2012-status9/)
- C++11 port, improvements, optimizations by @artemp
- Testing and integration with master by @springmeyer
- Thank you to all the support from @behdad along the way
- Thanks for help testing @toton6868, @stephankn, @nirvn, @mfrasca, @simonsonc and many others
Refs: #2073,#2070,#2038,#2037,#1953,#1820,#1819,#1714,#1634,#1547,#1532,#1319,#1208,#1154,#1146
2013-11-22 09:06:32 +01:00
|
|
|
ch = (high - 0xD800) * 0x0400 + low - 0xDC00 + 0x10000;
|
|
|
|
scriptEnd += 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
UScriptCode sc = uscript_getScript(ch, &error);
|
|
|
|
int32_t pairIndex = getPairIndex(ch);
|
|
|
|
|
|
|
|
// Paired character handling:
|
|
|
|
//
|
|
|
|
// if it's an open character, push it onto the stack.
|
|
|
|
// if it's a close character, find the matching open on the
|
|
|
|
// stack, and use that script code. Any non-matching open
|
|
|
|
// characters above it on the stack will be poped.
|
2022-01-26 10:43:31 +01:00
|
|
|
if (pairIndex >= 0)
|
|
|
|
{
|
|
|
|
if ((pairIndex & 1) == 0)
|
|
|
|
{
|
2019-11-04 14:59:23 +01:00
|
|
|
++parenSP;
|
2019-11-18 09:45:03 +01:00
|
|
|
if (static_cast<std::size_t>(parenSP) < parenStack.size())
|
2022-01-26 10:43:31 +01:00
|
|
|
parenStack[parenSP] = {pairIndex, scriptCode};
|
2019-11-18 09:45:03 +01:00
|
|
|
else
|
|
|
|
parenStack.emplace_back(pairIndex, scriptCode);
|
2019-11-05 10:50:51 +01:00
|
|
|
startSP = parenSP;
|
2022-01-26 10:43:31 +01:00
|
|
|
}
|
|
|
|
else if (parenSP >= 0)
|
|
|
|
{
|
Improved support for international text
- Implementation by @herm for GSOC 2012 (http://mapnik.org/news/2012/10/06/gsoc2012-status9/)
- C++11 port, improvements, optimizations by @artemp
- Testing and integration with master by @springmeyer
- Thank you to all the support from @behdad along the way
- Thanks for help testing @toton6868, @stephankn, @nirvn, @mfrasca, @simonsonc and many others
Refs: #2073,#2070,#2038,#2037,#1953,#1820,#1819,#1714,#1634,#1547,#1532,#1319,#1208,#1154,#1146
2013-11-22 09:06:32 +01:00
|
|
|
int32_t pi = pairIndex & ~1;
|
|
|
|
|
2022-01-26 10:43:31 +01:00
|
|
|
while (parenSP >= 0 && parenStack[parenSP].pairIndex != pi)
|
|
|
|
{
|
Improved support for international text
- Implementation by @herm for GSOC 2012 (http://mapnik.org/news/2012/10/06/gsoc2012-status9/)
- C++11 port, improvements, optimizations by @artemp
- Testing and integration with master by @springmeyer
- Thank you to all the support from @behdad along the way
- Thanks for help testing @toton6868, @stephankn, @nirvn, @mfrasca, @simonsonc and many others
Refs: #2073,#2070,#2038,#2037,#1953,#1820,#1819,#1714,#1634,#1547,#1532,#1319,#1208,#1154,#1146
2013-11-22 09:06:32 +01:00
|
|
|
parenSP -= 1;
|
|
|
|
}
|
|
|
|
|
2022-01-26 10:43:31 +01:00
|
|
|
if (parenSP < startSP)
|
|
|
|
{
|
Improved support for international text
- Implementation by @herm for GSOC 2012 (http://mapnik.org/news/2012/10/06/gsoc2012-status9/)
- C++11 port, improvements, optimizations by @artemp
- Testing and integration with master by @springmeyer
- Thank you to all the support from @behdad along the way
- Thanks for help testing @toton6868, @stephankn, @nirvn, @mfrasca, @simonsonc and many others
Refs: #2073,#2070,#2038,#2037,#1953,#1820,#1819,#1714,#1634,#1547,#1532,#1319,#1208,#1154,#1146
2013-11-22 09:06:32 +01:00
|
|
|
startSP = parenSP;
|
|
|
|
}
|
|
|
|
|
2022-01-26 10:43:31 +01:00
|
|
|
if (parenSP >= 0)
|
|
|
|
{
|
Improved support for international text
- Implementation by @herm for GSOC 2012 (http://mapnik.org/news/2012/10/06/gsoc2012-status9/)
- C++11 port, improvements, optimizations by @artemp
- Testing and integration with master by @springmeyer
- Thank you to all the support from @behdad along the way
- Thanks for help testing @toton6868, @stephankn, @nirvn, @mfrasca, @simonsonc and many others
Refs: #2073,#2070,#2038,#2037,#1953,#1820,#1819,#1714,#1634,#1547,#1532,#1319,#1208,#1154,#1146
2013-11-22 09:06:32 +01:00
|
|
|
sc = parenStack[parenSP].scriptCode;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-26 10:43:31 +01:00
|
|
|
if (sameScript(scriptCode, sc))
|
|
|
|
{
|
|
|
|
if (scriptCode <= USCRIPT_INHERITED && sc > USCRIPT_INHERITED)
|
|
|
|
{
|
Improved support for international text
- Implementation by @herm for GSOC 2012 (http://mapnik.org/news/2012/10/06/gsoc2012-status9/)
- C++11 port, improvements, optimizations by @artemp
- Testing and integration with master by @springmeyer
- Thank you to all the support from @behdad along the way
- Thanks for help testing @toton6868, @stephankn, @nirvn, @mfrasca, @simonsonc and many others
Refs: #2073,#2070,#2038,#2037,#1953,#1820,#1819,#1714,#1634,#1547,#1532,#1319,#1208,#1154,#1146
2013-11-22 09:06:32 +01:00
|
|
|
scriptCode = sc;
|
|
|
|
// now that we have a final script code, fix any open
|
|
|
|
// characters we pushed before we knew the script code.
|
2022-01-26 10:43:31 +01:00
|
|
|
while (startSP < parenSP)
|
|
|
|
{
|
Improved support for international text
- Implementation by @herm for GSOC 2012 (http://mapnik.org/news/2012/10/06/gsoc2012-status9/)
- C++11 port, improvements, optimizations by @artemp
- Testing and integration with master by @springmeyer
- Thank you to all the support from @behdad along the way
- Thanks for help testing @toton6868, @stephankn, @nirvn, @mfrasca, @simonsonc and many others
Refs: #2073,#2070,#2038,#2037,#1953,#1820,#1819,#1714,#1634,#1547,#1532,#1319,#1208,#1154,#1146
2013-11-22 09:06:32 +01:00
|
|
|
parenStack[++startSP].scriptCode = scriptCode;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// if this character is a close paired character,
|
|
|
|
// pop it from the stack
|
2022-01-26 10:43:31 +01:00
|
|
|
if (pairIndex >= 0 && (pairIndex & 1) != 0 && parenSP >= 0)
|
|
|
|
{
|
Improved support for international text
- Implementation by @herm for GSOC 2012 (http://mapnik.org/news/2012/10/06/gsoc2012-status9/)
- C++11 port, improvements, optimizations by @artemp
- Testing and integration with master by @springmeyer
- Thank you to all the support from @behdad along the way
- Thanks for help testing @toton6868, @stephankn, @nirvn, @mfrasca, @simonsonc and many others
Refs: #2073,#2070,#2038,#2037,#1953,#1820,#1819,#1714,#1634,#1547,#1532,#1319,#1208,#1154,#1146
2013-11-22 09:06:32 +01:00
|
|
|
parenSP -= 1;
|
|
|
|
startSP -= 1;
|
|
|
|
}
|
2022-01-26 10:43:31 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
Improved support for international text
- Implementation by @herm for GSOC 2012 (http://mapnik.org/news/2012/10/06/gsoc2012-status9/)
- C++11 port, improvements, optimizations by @artemp
- Testing and integration with master by @springmeyer
- Thank you to all the support from @behdad along the way
- Thanks for help testing @toton6868, @stephankn, @nirvn, @mfrasca, @simonsonc and many others
Refs: #2073,#2070,#2038,#2037,#1953,#1820,#1819,#1714,#1634,#1547,#1532,#1319,#1208,#1154,#1146
2013-11-22 09:06:32 +01:00
|
|
|
// if the run broke on a surrogate pair,
|
|
|
|
// end it before the high surrogate
|
2022-01-26 10:43:31 +01:00
|
|
|
if (ch >= 0x10000)
|
|
|
|
{
|
Improved support for international text
- Implementation by @herm for GSOC 2012 (http://mapnik.org/news/2012/10/06/gsoc2012-status9/)
- C++11 port, improvements, optimizations by @artemp
- Testing and integration with master by @springmeyer
- Thank you to all the support from @behdad along the way
- Thanks for help testing @toton6868, @stephankn, @nirvn, @mfrasca, @simonsonc and many others
Refs: #2073,#2070,#2038,#2037,#1953,#1820,#1819,#1714,#1634,#1547,#1532,#1319,#1208,#1154,#1146
2013-11-22 09:06:32 +01:00
|
|
|
scriptEnd -= 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|