如何解决如何在Cairo C中渲染乳胶字体和公式? 这是我遇到的第一个麻烦事以mp4视频格式呈现乳胶配方的最佳方法是什么?
我已经尝试了以下步骤:
- 一个独立的tex文件:
\documentclass[preview]{standalone}
\usepackage[utf8]{inputenc}
\usepackage[spanish]{babel}
\begin{document}
\[ \sum_{i=1}^{n}i^3=\left( \sum_{i=1}^{n}i \right)^2 \]
\end{document}
- 我已经编译过了:
latex file.tex
这意味着:pdfTeX Version 3.14159265-2.6-1.40.19 (TeX Live 2018) (preloaded format=latex)
获得了dvi
文件。
- 用下一个将我的
dvi
转换为svg
:
dvisvgm --libgs=/usr/local/Cellar/ghostscript/9.53.3/lib/libgs.9.53.dylib file.dvi
这是我遇到的第一个麻烦事
当我打开svg
时,它在Chrome
中用假符号进行渲染,但是在Safari
中,我获得了成功。但是我放弃了,继续开罗。
#include <cairo.h>
#include <librsvg/rsvg.h>
#include <stdio.h>
int main(void){
cairo_surface_t *surface;
cairo_t *cr;
RsvgHandle *handle;
/* Code */
if( (handle = rsvg_handle_new_from_file("file.svg",NULL)) == NULL ){
printf("Error trying to load a SVG file\n");
}
if( rsvg_handle_render_cairo(handle,cr) != TRUE ){
printf("Error trying to draw a SVG file\n");
}
cairo_surface_write_to_png(surface,"image.png");
cairo_destroy(cr);
cairo_surface_destroy(surface);
return 0;
}
我将其渲染:
Chrome
中的符号相同。当我打开svg
时,它看起来像这样的最后几行:
<text class='f1' x='138.107022' y='-25.204175'>n</text>
<text class='f4' x='133.374191' y='-22.215398'></text>
<text class='f1' x='134.116478' y='-0.996264'>i</text>
<text class='f3' x='136.935205' y='-0.996264'>=1</text>
<text class='f0' x='149.425099' y='-12.750829'>i</text>
<text class='f3' x='152.857357' y='-16.864325'>3</text>
<text class='f2' x='160.09406' y='-12.750829'>=</text>
<text class='f4' x='170.610139' y='-29.787102'></text>
<text class='f1' x='183.230082' y='-25.204175'>n</text>
<text class='f4' x='178.49725' y='-22.215398'></text>
<text class='f1' x='179.239538' y='-0.996264'>i</text>
<text class='f3' x='182.058265' y='-0.996264'>=1</text>
<text class='f0' x='194.548158' y='-12.750829'>i</text>
<text class='f4' x='197.980417' y='-29.787102'></text>
<text class='f3' x='205.867527' y='-27.722624'>2</text>
所以失败了。
另一方面,我想说pig-config --cflags librsvg-2.0
显示正确的输出,但是当我阅读标题时,那里有一个WARNING
关于开罗用户的信息:
#if !defined (__RSVG_RSVG_H_INSIDE__) && !defined (RSVG_COMPILATION)
#warning "Including <librsvg/rsvg-cairo.h> directly is deprecated."
#endif
#ifndef RSVG_CAIRO_H
#define RSVG_CAIRO_H
#include <cairo.h>
这就是包含rsvg
报头而不是Cairo-svg
的原因,因为它包括了:
#ifndef RSVG_H
#define RSVG_H
#define __RSVG_RSVG_H_INSIDE__
#include <glib-object.h>
#include <gio/gio.h>
#include <cairo.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
G_BEGIN_DECLS
/* Code and Defs */
G_END_DECLS
#include "librsvg-features.h"
#include "rsvg-cairo.h"
但是没有任何相关文件。
最后一个问题:
以mp4视频格式呈现乳胶配方的最佳方法是什么?
我的意思是,我已经尝试过开罗,然后将其放到视频中。但是直接用FFMPEG
渲染该公式会有更好的结果吗?我在python
上找到了一些结果,但是我对此感到非常厌倦。我正在寻找不同的方式。目的是:使用C
代码。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。