Skip to content

Commit

Permalink
Show error message once for native fonts. (#4191)
Browse files Browse the repository at this point in the history
  • Loading branch information
smimram authored Oct 25, 2024
1 parent 7211e86 commit 808885c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/core/decoder/text/video_text_native.ml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@
*****************************************************************************)

open Mm
open Extralib

let log = Log.make ["video"; "text"; "native"]

let render_text ~font ~size text =
if font <> Configure.conf_default_font#get then
log#important "video.text.native does not support custom fonts yet!";
Fun.once (fun () ->
log#important "video.text.native does not support custom fonts yet!");
let () = ignore font in
let font = Image.Bitmap.Font.native in
let bmp = Image.Bitmap.Font.render text in
Expand Down
12 changes: 12 additions & 0 deletions src/lang/extralib.ml
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,15 @@ module Int = struct
assert false
with Exit -> !ans
end

module Fun = struct
include Fun

(** Execute a function at most once. *)
let once =
let already = ref false in
fun f ->
if not !already then (
already := true;
f ())
end

0 comments on commit 808885c

Please sign in to comment.