jlatexmath-android如何实现自定义渲染字符

使用jlatexmath-android的过程,如果出现个别字符渲染不了,会导致无法显示

常用的做法是新增自定义字体+切换系统默认字体渲染,下面我们介绍第2种方法。

修改流程:

1、到jlatexmath-android的官网下载源码到本地,导入到IDE

2、找到这个类JLatexMathDrawable

3、在这个方法做替换操作

public Builder(String latex) {

//把latext里面不支持渲染的公式符号,替换为可见字符。

}

4、找到TeXParser类

5、找到这个方法Atom convertCharacter(char c, boolean oneChar) throws ParseException

6、在方法前面增加这个拦截,哪些字符采用android系统默认字体渲染

//把字符丢进去判断,如果是拦截的字符就自动过滤

if (useJavaFontRenderingAtomChar(c)) {

return new JavaFontRenderingAtom(Character.toString(c), Font.PLAIN);

}

7、请遵循源码的开源协议

相关推荐
summerkissyou19876 小时前
Android - 摄像头 - hal - 开发教程,例子,常见问题,分析方法,解决方案
android
summerkissyou19877 小时前
Android 16 架构图
android
神龙天舞20018 小时前
MySQL 备库为什么会延迟好几个小时
android·数据库·mysql
码农coding11 小时前
android12 systemUI 之锁屏
android
圆山猫11 小时前
[Virtualization](三):RISC-V H-extension 与 Guest 执行模式
android·java·risc-v
爱笑鱼11 小时前
Binder(七):getCallingUid() 读到的是谁?clearCallingIdentity() 又清掉了什么?
android
2501_9159090617 小时前
iOS 应用反调试技详解术 检测调试器的原理与防护实践
android·ios·小程序·https·uni-app·iphone·webview
Lvan的前端笔记17 小时前
AndroidX 完全入门指南
android·androidx
帅次18 小时前
Android 应用高级面试:Window 近1年高频追问 18 题
android·面试·职场和发展
总捣什么乱118 小时前
MySQL MySQL是怎么保证主备一致的?
android·mysql·adb