|
|
|
@ -242,17 +242,18 @@ interface JsExtensions { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
fun queryTTF(path: String): QueryTTF? { |
|
|
|
|
var qTTF = CacheManager.getQueryTTF(path) |
|
|
|
|
val key = md5Encode16(path) |
|
|
|
|
var qTTF = CacheManager.getQueryTTF(key) |
|
|
|
|
if (qTTF != null) { |
|
|
|
|
return qTTF |
|
|
|
|
} |
|
|
|
|
val font: ByteArray? = when { |
|
|
|
|
path.isAbsUrl() -> runBlocking { |
|
|
|
|
var x = CacheManager.getByteArray(path) |
|
|
|
|
var x = CacheManager.getByteArray(key) |
|
|
|
|
if (x == null) { |
|
|
|
|
x = HttpHelper.simpleGetBytesAsync(path) |
|
|
|
|
x?.let { |
|
|
|
|
CacheManager.put(path, it) |
|
|
|
|
CacheManager.put(key, it) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return@runBlocking x |
|
|
|
@ -266,7 +267,7 @@ interface JsExtensions { |
|
|
|
|
} |
|
|
|
|
font ?: return null |
|
|
|
|
qTTF = QueryTTF(font) |
|
|
|
|
CacheManager.put(path, qTTF) |
|
|
|
|
CacheManager.put(key, qTTF) |
|
|
|
|
return qTTF |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|