pull/488/head
gedoor 4 years ago
parent e9d1f65b21
commit 1af8e91440
  1. 3
      app/src/main/java/io/legado/app/data/entities/rule/ContentRule.kt
  2. 4
      app/src/main/java/io/legado/app/model/analyzeRule/QueryTTF.kt

@ -11,5 +11,6 @@ data class ContentRule(
var sourceRegex: String? = null, var sourceRegex: String? = null,
var replaceRegex: String? = null, var replaceRegex: String? = null,
var imageStyle: String? = null, //默认大小居中,FULL最大宽度 var imageStyle: String? = null, //默认大小居中,FULL最大宽度
var font: String? = null //必须返回ByteArray var font: String? = null, //网页内包含的字体必须返回ByteArray
var correctFont: String? = null, //正确的字体必须返回ByteArray
) : Parcelable ) : Parcelable

@ -9,7 +9,7 @@ import kotlin.experimental.and
* @see <a href="https://docs.microsoft.com/en-us/typography/opentype/spec/">获取详情</a> * @see <a href="https://docs.microsoft.com/en-us/typography/opentype/spec/">获取详情</a>
* @see <a href="https://photopea.github.io/Typr.js/demo/index.html">基于Javascript的TTF解析器</a> * @see <a href="https://photopea.github.io/Typr.js/demo/index.html">基于Javascript的TTF解析器</a>
*/ */
class QueryTTF(var Font: Array<Byte>) : JsExtensions { class QueryTTF(var Font: ByteArray) : JsExtensions {
private class Header { private class Header {
var majorVersion: UShort = 0u var majorVersion: UShort = 0u
var minorVersion: UShort = 0u var minorVersion: UShort = 0u
@ -150,7 +150,7 @@ class QueryTTF(var Font: Array<Byte>) : JsExtensions {
lateinit var yCoordinates: ArrayList<Short> lateinit var yCoordinates: ArrayList<Short>
} }
private class ByteArrayReader(var Buffer: Array<Byte>, var Index: Int) { private class ByteArrayReader(var Buffer: ByteArray, var Index: Int) {
fun ReadUIntX(len: Long): ULong { fun ReadUIntX(len: Long): ULong {
var result: ULong = 0u; var result: ULong = 0u;
for (i in 0 until len) { for (i in 0 until len) {

Loading…
Cancel
Save