diff --git a/src/HTMLRenderer/export.cc b/src/HTMLRenderer/export.cc
index ff76fc6..c9e1516 100644
--- a/src/HTMLRenderer/export.cc
+++ b/src/HTMLRenderer/export.cc
@@ -18,62 +18,67 @@
namespace pdf2htmlEX {
- void HTMLRenderer::export_remote_font(const FontInfo & info, const string & suffix, GfxFont * font)
+void HTMLRenderer::export_remote_font(const FontInfo & info, const string & suffix, GfxFont * font)
+{
+ string mime_type, format;
+ if(suffix == ".ttf")
{
- string mime_type, format;
- if (suffix == ".ttf") {
- format = "truetype";
- mime_type = "application/x-font-ttf";
- }
- else if (suffix == ".otf") {
- format = "opentype";
- mime_type = "application/x-font-otf";
- }
- else if (suffix == ".woff") {
- format = "woff";
- mime_type = "application/font-woff";
- }
- else if (suffix == ".eot") {
- format = "embedded-opentype";
- mime_type = "application/vnd.ms-fontobject";
- }
- else if (suffix == ".svg") {
- format = "svg";
- mime_type = "image/svg+xml";
- }
-
- f_css.fs << "@font-face{"
- << "font-family:f" << info.id << ";"
- << "src:url(";
-
- {
- auto fn = str_fmt("f%llx%s", info.id, suffix.c_str());
- if(param->single_html)
- {
- auto path = param->tmp_dir + "/" + (char*)fn;
- ifstream fin(path, ifstream::binary);
- if(!fin)
- throw "Cannot locate font file: " + path;
- f_css.fs << "'data:font/" + mime_type + ";base64," << base64stream(fin) << "'";
- }
- else
- {
- f_css.fs << (char*)fn;
- }
- }
-
- f_css.fs << ")"
- << "format(\"" << format << "\");"
- << "}" // end of @font-face
- << ".f" << info.id << "{"
- << "font-family:f" << info.id << ";"
- << "line-height:" << round(info.ascent - info.descent) << ";"
- << "font-style:normal;"
- << "font-weight:normal;"
- << "visibility:visible;"
- << "}" // end of .f
- << endl;
+ format = "truetype";
+ mime_type = "application/x-font-ttf";
}
+ else if(suffix == ".otf")
+ {
+ format = "opentype";
+ mime_type = "application/x-font-otf";
+ }
+ else if(suffix == ".woff")
+ {
+ format = "woff";
+ mime_type = "application/font-woff";
+ }
+ else if(suffix == ".eot")
+ {
+ format = "embedded-opentype";
+ mime_type = "application/vnd.ms-fontobject";
+ }
+ else if(suffix == ".svg")
+ {
+ format = "svg";
+ mime_type = "image/svg+xml";
+ }
+
+ f_css.fs << "@font-face{"
+ << "font-family:f" << info.id << ";"
+ << "src:url(";
+
+ {
+ auto fn = str_fmt("f%llx%s", info.id, suffix.c_str());
+ if(param->single_html)
+ {
+ auto path = param->tmp_dir + "/" + (char*)fn;
+ ifstream fin(path, ifstream::binary);
+ if(!fin)
+ throw "Cannot locate font file: " + path;
+ f_css.fs << "'data:font/" + mime_type + ";base64," << base64stream(fin) << "'";
+ }
+ else
+ {
+ f_css.fs << (char*)fn;
+ }
+ }
+
+ f_css.fs << ")"
+ << "format(\"" << format << "\");"
+ << "}" // end of @font-face
+ << ".f" << info.id << "{"
+ << "font-family:f" << info.id << ";"
+ << "line-height:" << round(info.ascent - info.descent) << ";"
+ << "font-style:normal;"
+ << "font-weight:normal;"
+ << "visibility:visible;"
+ << "}" // end of .f
+ << endl;
+}
static string general_font_family(GfxFont * font)
{