Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show error message once for native fonts. #4191

Merged
merged 1 commit into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading