当前位置:网站首页>20.移植Freetype字体库
20.移植Freetype字体库
2022-07-05 23:08:00 【anieoo】
FreeType 支持 Gzip 压缩文件,会使用到 zlib 库。同时FreeType 可以加载 PNG 格式的彩色位
图字形,需要依赖于 libpng 库,因此在移植Freetype字体库前需要先移植zlib库和libpng库。
一、移植zlib库
下载源码
进入源码官网https://www.zlib.net/fossils/,下载源码

将下载的源码通过命令tar -vxzf xxx进行解压,创建一个目录zlib作为源码的安装目录,如下图所示:

配置zlib源码,首先执行脚本environment-setup-cortexa7hf-neon-poky-linux-gnueabi 文件进行环境变量初始化。
source /opt/fsl-imx-x11/4.1.15-2.1.0/environment-setup-cortexa7hf-neon-poky-linux-gnueabi配置完环境变量如下所示:

指定安装路径:./configure --prefix=/home/zyc/tools/zlib/

使用make命令编译zlib源码,编译结束后在使用make install进行安装:

将源码移植到IMX6ULL开发板:
由于scp命令会导致文件的符号链接解除,因此将源码压缩在传过去再解压缩,如下图所示:

随后将库文件拷贝到目录/usr/lib下

二、移植libpng库
下载源码
进入网址下载 https://github.com/glennrp/libpng/releases,:

解压libpng源码,并创建一个png文件夹用来安装libpng库:

libpng 依赖于 zlib 库,前面我们已经将 zlib 库编译成功了,但是我们得告知编译器 zlib 库的安装目录,这样编译器才能找到 zlib 的库文件以及头文件,编译 libpng 的时才不会报错,执行以下三条命令将 zlib 库安装目录下的 include 和 lib 路径导出到环境变量:
export LDFLAGS="${LDFLAGS} -L/home/zyc/tools/zlib/lib"
export CFLAGS="${CFLAGS} -I/home/zyc/tools/zlib/include"
export CPPFLAGS="${CPPFLAGS} -I/home/zyc/tools/zlib/include"接着执行以下命令对源码进行配置:
./configure --prefix=/home/zyc/tools/png --host=arm-poky-linux-gnueabi最后进行编译make和安装make install:

将源码移植到IMX6ULL开发板:
和之前的操作一样将bin目录下的文件拷贝到usr/bin/目录下,lib目录下的文件拷贝到/usr/lib目录下:

三、移植Freetype字体库
下载源码

解压源码并创建一个文件夹freetype用来保存安装文件:

配置文件
打开 include/freetype/config/ftoption.h 文件,打开以下两个宏定义:
#define FT_CONFIG_OPTION_SYSTEM_ZLIB
#define FT_CONFIG_OPTION_USE_PNG对源码进行如下配置:
./configure --prefix=/home/zyc/tools/freetype/ --host=arm-poky-linux-gnueabi --with-
zlib=yes --with-bzip2=no --with-png=yes --with-harfbuzz=no ZLIB_CFLAGS="-
I/home/zyc/tools/zlib/include -L/home/zyc/tools/zlib/lib" ZLIB_LIBS=-lz LIBPNG_CFLAGS="-
I/home/zyc/tools/png/include -L/home/zyc/tools/png/lib" LIBPNG_LIBS=-lpng
--prefix 选项指定 FreeType 库的安装目录; --host 选项设置为交叉编译器名称的前缀
--with-zlib=yes 表示使用 zlib;
--with-bzip2=no 表示不使用 bzip2 库;
--with-png=yes 表示使用 libpng 库;
--with-harfbuzz=no 表示不使用 harfbuzz 库。
ZLIB_CFLAGS 选项用于指定 zlib 的头文件路径和库文件路径,根据实际安装路径填写;
ZLIB_LIBS 选项指定链接的 zlib 库的名称;
LIBPNG_CFLAGS 选项用于指定 libpng 的头文件路径和库文件路径,根据实际安装路径填写;
LIBPNG_LIBS 选项用于指定链接的 libpng 库的名称。
配置完进行编译make和安装make install,如下图所示:

将源码移植到IMX6ULL开发板:
将lib目录下的文件拷贝到开发板的/usr/lib目录下:

边栏推荐
- regular expression
- [original] what is the core of programmer team management?
- Practice of concurrent search
- Sum of two numbers, sum of three numbers (sort + double pointer)
- The PNG image is normal when LabVIEW is opened, and the full black image is obtained when Photoshop is opened
- 2022.6.20-6.26 AI行业周刊(第103期):新的小生命
- Registration and skills of hoisting machinery command examination in 2022
- yate.conf
- 698. Divided into k equal subsets ●●
- JVM的简介
猜你喜欢

98. 验证二叉搜索树 ●●

Getting started stm32--gpio (running lantern) (nanny level)

Scala concurrent programming (II) akka

Go语言实现原理——Map实现原理

February 13, 2022-4-symmetric binary tree

Commonly used probability distributions: Bernoulli distribution, binomial distribution, polynomial distribution, Gaussian distribution, exponential distribution, Laplace distribution and Dirac delta d

数据库基础知识(面试)

Use of metadata in golang grpc
![[original] what is the core of programmer team management?](/img/11/d4b9929e8aadcaee019f656cb3b9fb.png)
[original] what is the core of programmer team management?

进击的技术er——自动化
随机推荐
98. 验证二叉搜索树 ●●
Commonly used probability distributions: Bernoulli distribution, binomial distribution, polynomial distribution, Gaussian distribution, exponential distribution, Laplace distribution and Dirac delta d
(4)UART应用设计及仿真验证2 —— RX模块设计(无状态机)
asp.net弹出层实例
开关电源Buck电路CCM及DCM工作模式
Dynamic planning: robbing families and houses
UVA – 11637 garbage remembering exam (combination + possibility)
14种神笔记方法,只需选择1招,让你的学习和工作效率提高100倍!
CorelDRAW plug-in -- GMS plug-in development -- new project -- macro recording -- VBA editing -- debugging skills -- CDR plug-in (2)
Practice of concurrent search
Go语言实现原理——Map实现原理
判斷二叉樹是否為完全二叉樹
Krypton Factor-紫书第七章暴力求解
证明 poj 1014 模优化修剪,部分递归 有错误
Three. JS VR house viewing
Hainan Nuanshen tea recruits warmhearted people: recruitment of the product experience recommender of Nuanshen multi bubble honey orchid single cluster
派对的最大快乐值
Switching power supply buck circuit CCM and DCM working mode
Expectation, variance and covariance
AsyncSocket长连接棒包装问题解决