From 25ff22b505881cbed47795c5121b14c6d0339ac5 Mon Sep 17 00:00:00 2001 From: malc Date: Sat, 29 Nov 2014 07:59:52 +0300 Subject: [PATCH] Allow opting out of fontconfig --- config.ml | 3 ++- link.c | 8 +++++--- main.ml | 6 +++++- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/config.ml b/config.ml index 1aeff54..5c0d220 100644 --- a/config.ml +++ b/config.ml @@ -93,7 +93,7 @@ and angle = int and params = (angle * fitmodel * trimparams * texcount * sliceheight * memsize * colorspace * fontpath * trimcachepath - * haspbo) + * haspbo * usefontconfig) and width = int and height = int and leftx = int @@ -109,6 +109,7 @@ and aalevel = int and trimparams = (trimmargins * irect) and colorspace = | Rgb | Bgr | Gray and haspbo = bool +and usefontconfig = bool and uri = string and caption = string and x = int diff --git a/link.c b/link.c index b287a11..bea5e11 100644 --- a/link.c +++ b/link.c @@ -4360,9 +4360,11 @@ CAMLprim value ml_init (value csock_v, value params_v) state.ctx = fz_new_context (NULL, NULL, mustoresize); #ifdef USE_FONTCONFIG - fz_install_load_system_font_funcs ( - state.ctx, fc_load_system_font_func, NULL - ); + if (Bool_val (Field (params_v, 10))) { + fz_install_load_system_font_funcs ( + state.ctx, fc_load_system_font_func, NULL + ); + } #endif state.trimmargins = Bool_val (Field (trim_v, 0)); diff --git a/main.ml b/main.ml index feb08ad..838a836 100644 --- a/main.ml +++ b/main.ml @@ -6133,6 +6133,7 @@ let () = let pageno = ref None in let rootwid = ref 0 in let openlast = ref false in + let nofc = ref false in selfexec := Sys.executable_name; Arg.parse (Arg.align @@ -6175,6 +6176,8 @@ let () = ("-gc", Arg.Set_string gcconfig, " Collect garbage with the help of a script"); + ("-nofc", Arg.Set nofc, " Do not use fontconfig"); + ("-v", Arg.Unit (fun () -> Printf.printf "%s\nconfiguration path: %s\n" @@ -6385,7 +6388,8 @@ let () = conf.angle, conf.fitmodel, (conf.trimmargins, conf.trimfuzz), conf.texcount, conf.sliceheight, conf.mustoresize, conf.colorspace, !Config.fontpath, !trimcachepath, - GlMisc.check_extension "GL_ARB_pixel_buffer_object" + GlMisc.check_extension "GL_ARB_pixel_buffer_object", + not !nofc ); List.iter GlArray.enable [`texture_coord; `vertex]; state.ss <- ss; -- 2.11.4.GIT