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