|
|
|
@ -39,16 +39,16 @@ object BookContent { |
|
|
|
|
val fontRule = contentRule.font |
|
|
|
|
val correctFontRule = contentRule.correctFont |
|
|
|
|
var font: ByteArray? = null |
|
|
|
|
var correctFont: ByteArray? = null |
|
|
|
|
var cQueryTTF: QueryTTF? = null |
|
|
|
|
fontRule?.let { |
|
|
|
|
//todo 获取网页嵌入字体 |
|
|
|
|
font = analyzeRule.getByteArray(it) |
|
|
|
|
font = analyzeRule.getResult(it) as? ByteArray |
|
|
|
|
} |
|
|
|
|
correctFontRule?.let { |
|
|
|
|
//todo 获取正确字体 |
|
|
|
|
correctFont = analyzeRule.getByteArray(it) |
|
|
|
|
cQueryTTF = analyzeRule.getResult(it) as? QueryTTF |
|
|
|
|
} |
|
|
|
|
if (correctFont == null && font != null) { |
|
|
|
|
if (cQueryTTF == null && font != null) { |
|
|
|
|
BookHelp.saveFont(book, bookChapter, font!!) |
|
|
|
|
} |
|
|
|
|
var contentData = analyzeContent( |
|
|
|
@ -114,13 +114,12 @@ object BookContent { |
|
|
|
|
analyzeRule.chapter = bookChapter |
|
|
|
|
contentStr = analyzeRule.getString(replaceRegex) |
|
|
|
|
} |
|
|
|
|
if (correctFont != null && font != null) { |
|
|
|
|
if (cQueryTTF != null && font != null) { |
|
|
|
|
val queryTTF = QueryTTF(font!!) |
|
|
|
|
val cQueryTTF = QueryTTF(correctFont!!) |
|
|
|
|
val contentArray = contentStr.toCharArray() |
|
|
|
|
contentArray.forEachIndexed { index, s -> |
|
|
|
|
if(s> 58000.toChar()){ |
|
|
|
|
val code = cQueryTTF.GetCodeByGlyf(queryTTF.GetGlyfByCode(s.toInt())) |
|
|
|
|
if (s > 58000.toChar()) { |
|
|
|
|
val code = cQueryTTF!!.GetCodeByGlyf(queryTTF.GetGlyfByCode(s.toInt())) |
|
|
|
|
contentArray[index] = code.toChar() |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|