diff --git a/app/src/main/java/io/legado/app/model/webBook/BookContent.kt b/app/src/main/java/io/legado/app/model/webBook/BookContent.kt index 4285b4a2e..a47f9a5a8 100644 --- a/app/src/main/java/io/legado/app/model/webBook/BookContent.kt +++ b/app/src/main/java/io/legado/app/model/webBook/BookContent.kt @@ -10,8 +10,10 @@ import io.legado.app.help.BookHelp import io.legado.app.model.Debug import io.legado.app.model.analyzeRule.AnalyzeRule import io.legado.app.model.analyzeRule.AnalyzeUrl +import io.legado.app.model.analyzeRule.QueryTTF import io.legado.app.utils.NetworkUtils import io.legado.app.utils.htmlFormat +import io.legado.app.utils.toStringArray import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.withContext @@ -34,11 +36,13 @@ object BookContent { val content = StringBuilder() val nextUrlList = arrayListOf(baseUrl) val contentRule = bookSource.getContentRule() + var queryTTF: QueryTTF? = null contentRule.font?.let { //todo 获取字体 val analyzeRule = AnalyzeRule(book) analyzeRule.setContent(body).setBaseUrl(baseUrl) analyzeRule.getByteArray(it)?.let { font -> + queryTTF = QueryTTF(font) BookHelp.saveFont(book, bookChapter, font) } } @@ -110,6 +114,12 @@ object BookContent { Debug.log(bookSource.bookSourceUrl, "└${bookChapter.title}") Debug.log(bookSource.bookSourceUrl, "┌获取正文内容") Debug.log(bookSource.bookSourceUrl, "└\n$contentStr") + queryTTF?.let { + contentStr.toStringArray().forEach { str -> + val fontData = it.getGlyf(str.toInt()) + + } + } if (contentStr.isNotBlank()) { BookHelp.saveContent(book, bookChapter, contentStr) } diff --git a/app/src/main/java/io/legado/app/model/webBook/WebBook.kt b/app/src/main/java/io/legado/app/model/webBook/WebBook.kt index c9923b776..a2d487113 100644 --- a/app/src/main/java/io/legado/app/model/webBook/WebBook.kt +++ b/app/src/main/java/io/legado/app/model/webBook/WebBook.kt @@ -111,7 +111,7 @@ class WebBook(val bookSource: BookSource) { headerMapF = bookSource.getHeaderMap(), book = book ).getResponseAwait(bookSource.bookSourceUrl) - BookInfo.analyzeBookInfo(book, res.body, bookSource, res.url, canReName) + BookInfo.analyzeBookInfo(book, res.body, bookSource, book.bookUrl, canReName) } book }