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、请遵循源码的开源协议

相关推荐
jike_202610 小时前
安卓平台免费录音转文字工具深度测评:5 款 APP 功能对比与选型指南
android·智能电视
Code Man10 小时前
Windows 下使用 Appium
android·windows·appium
码农coding10 小时前
android 12 中的VSYNC接收
android
GitLqr11 小时前
Flutter 3.44 性能飞跃:深度解析 Android Platform View 的 HCPP 新特性
android·flutter·性能优化
码农coding11 小时前
android 12 SurfaceFlinger中的CompositionEngine
android
Mem0rin12 小时前
[MySQL] 聚合函数、分组查询、连接查询
android·mysql
码龙-DragonCoding13 小时前
一键批量提取音频、提取视频
android·音视频·提取
祉猷并茂,雯华若锦13 小时前
Win下完美解决Allure报错,生成Web自动化测试报告
android·python·selenium·自动化
IT小盘14 小时前
08-FastAPI加MySQL实现AI对话记录持久化
android·mysql·fastapi
alice--小文子14 小时前
安卓(Android)- 怎么在adb中通过真机操作日志相关
android·adb