From d43a4dfacb2c0eb3a6ec7d6e3c66c38704ef262d Mon Sep 17 00:00:00 2001 From: TheQwertiest Date: Tue, 4 Feb 2020 17:24:03 +0300 Subject: [PATCH] [docs] Added performance note for `GdiFont` (fixes #95) --- component/docs/js/foo_spider_monkey_panel.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/component/docs/js/foo_spider_monkey_panel.js b/component/docs/js/foo_spider_monkey_panel.js index 8cc4828f..cef06ab0 100644 --- a/component/docs/js/foo_spider_monkey_panel.js +++ b/component/docs/js/foo_spider_monkey_panel.js @@ -670,7 +670,10 @@ let gdi = { CreateImage: function (w, h) { }, // (GdiBitmap) /** - * Performance note: avoid using inside `on_paint`. + * Performance note: avoid using inside `on_paint`.
+ * Performance note II: try caching and reusing `GdiFont` objects, + * since the maximum amount of such objects is hard-limited by Windows. + * `GdiFont` creation will fail after reaching this limit. * * @param {string} name * @param {number} size_px See Helper.js > Point2Pixel function for conversions @@ -2823,7 +2826,11 @@ function GdiBitmap(arg) { } /** - * Constructor may fail if font is not present. + * Constructor may fail if font is not present.
+ * + * Performance note: try caching and reusing `GdiFont` objects, + * since the maximum amount of such objects is hard-limited by Windows. + * `GdiFont` creation will fail after reaching this limit. * * @constructor * @param {string} name