优化
This commit is contained in:
@@ -496,14 +496,14 @@ interface JsExtensions {
|
|||||||
correctQueryTTF: QueryTTF?
|
correctQueryTTF: QueryTTF?
|
||||||
): String {
|
): String {
|
||||||
if (errorQueryTTF == null || correctQueryTTF == null) return text
|
if (errorQueryTTF == null || correctQueryTTF == null) return text
|
||||||
val contentArray = text.toCharArray()
|
val contentArray = text.toStringArray()
|
||||||
contentArray.forEachIndexed { index, s ->
|
contentArray.forEachIndexed { index, s ->
|
||||||
val oldCode = s.code
|
val oldCode = s.codePointAt(0)
|
||||||
if (errorQueryTTF.inLimit(s)) {
|
if (errorQueryTTF.inLimit(oldCode)) {
|
||||||
val glyf = errorQueryTTF.getGlyfByCode(oldCode)
|
val glyf = errorQueryTTF.getGlyfByCode(oldCode)
|
||||||
val code = correctQueryTTF.getCodeByGlyf(glyf)
|
val code = correctQueryTTF.getCodeByGlyf(glyf)
|
||||||
if (code != 0) {
|
if (code != 0) {
|
||||||
contentArray[index] = code.toChar()
|
contentArray[index] = code.toChar().toString()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -479,6 +479,8 @@ public class QueryTTF {
|
|||||||
for (short b : glyf.get(gid).yCoordinates) sb.append(b);
|
for (short b : glyf.get(gid).yCoordinates) sb.append(b);
|
||||||
String val = sb.toString();
|
String val = sb.toString();
|
||||||
if (limitMix == 0) limitMix = key;
|
if (limitMix == 0) limitMix = key;
|
||||||
|
if (limitMix > key) limitMix = key;
|
||||||
|
if (limitMax < key) limitMax = key;
|
||||||
limitMax = key;
|
limitMax = key;
|
||||||
codeToGlyph.put(key, val);
|
codeToGlyph.put(key, val);
|
||||||
if (glyphToCode.containsKey(val)) continue;
|
if (glyphToCode.containsKey(val)) continue;
|
||||||
@@ -576,7 +578,7 @@ public class QueryTTF {
|
|||||||
* @param code 传入Unicode十进制值
|
* @param code 传入Unicode十进制值
|
||||||
* @return 返回bool查询结果
|
* @return 返回bool查询结果
|
||||||
*/
|
*/
|
||||||
public boolean inLimit(char code) {
|
public boolean inLimit(int code) {
|
||||||
return (limitMix <= code) && (code < limitMax);
|
return (limitMix <= code) && (code < limitMax);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user