[prev in list] [next in list] [prev in thread] [next in thread]
List: freetype-devel
Subject: Re: [ft-devel] Minor FT_Set_Var_Design_Coordinates() request
From: Matthias Clasen <matthias.clasen () gmail ! com>
Date: 2017-12-18 18:49:20
Message-ID: CAFwd_vB_P15ns6c2KWiimP_hu_wtf5Jygf8tp=pKKDaLJXFW4w () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
On Mon, Dec 18, 2017 at 1:39 PM, Behdad Esfahbod <behdad@behdad.org> wrote:
> Hi Werner,
>
> Is there any chance you can modify FT_Set_Var_Design_Coordinates() to
> detect when the set face coordinates are not changed and shortcircuit out
> early? Currently, if one calls that function too often (say, for every
> glyph load, which is how we want to call it in cairo), it causes font
> metrics and autohinter reinitialization even if the coordinates didn't
> change. Can you please fix that? Matthias and I are hacking together this
> week, trying to finish font variations support in the Pango stack.
>
> Thanks,
>
> --
> behdad
> http://behdad.org/
>
Here is a quick hack to demonstrate the idea
[Attachment #5 (text/html)]
<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Dec \
18, 2017 at 1:39 PM, Behdad Esfahbod <span dir="ltr"><<a \
href="mailto:behdad@behdad.org" target="_blank">behdad@behdad.org</a>></span> \
wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px \
#ccc solid;padding-left:1ex"><div dir="ltr"><div><div>Hi Werner,<br><br></div>Is \
there any chance you can modify FT_Set_Var_Design_Coordinates(<wbr>) to detect when \
the set face coordinates are not changed and shortcircuit out early? Currently, if \
one calls that function too often (say, for every glyph load, which is how we want to \
call it in cairo), it causes font metrics and autohinter reinitialization even if the \
coordinates didn't change. Can you please fix that? Matthias and I are \
hacking together this week, trying to finish font variations support in the Pango \
stack.<br><br></div>Thanks,<span class="HOEnZb"><font color="#888888"><br \
clear="all"><div><div><div><br>-- <br><div \
class="m_-6647617913516074517gmail_signature">behdad<br><a href="http://behdad.org/" \
target="_blank">http://behdad.org/</a></div> </div></div></div></font></span></div>
</blockquote></div></div><div class="gmail_extra"><br></div><div \
class="gmail_extra">Here is a quick hack to demonstrate the idea<br></div></div>
--001a11406c0af2d0a50560a1cec0--
["font-variations-shortcut.patch" (text/x-patch)]
diff --git a/src/base/ftmm.c b/src/base/ftmm.c
index e0131ece3..1f2be46f8 100644
--- a/src/base/ftmm.c
+++ b/src/base/ftmm.c
@@ -24,6 +24,7 @@
#include FT_SERVICE_MULTIPLE_MASTERS_H
#include FT_SERVICE_METRICS_VARIATIONS_H
+#include <alloca.h>
/*************************************************************************/
/* */
@@ -201,6 +202,25 @@
if ( !error )
{
error = FT_ERR( Invalid_Argument );
+ if ( service_mm->get_var_design )
+ {
+ FT_Fixed *my_coords;
+ FT_UInt i;
+
+ my_coords = alloca (sizeof(FT_Fixed) * num_coords);
+
+ error = service_mm->get_var_design( face, num_coords, my_coords );
+ if (error)
+ return error;
+
+ for (i = 0; i < num_coords; i++)
+ {
+ if (coords[i] != my_coords[i])
+ break;
+ }
+ if (i == num_coords)
+ return 0;
+ }
if ( service_mm->set_var_design )
error = service_mm->set_var_design( face, num_coords, coords );
}
_______________________________________________
Freetype-devel mailing list
Freetype-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/freetype-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic