Le mar. 14 juil. 2020 à 09:42, Werner LEMBERG <w...@gnu.org> a écrit :

>
> Hello Derek,
>
>
> sorry for the late reply.
>
> >
> > I don't really have a question beyond: is my understanding of what's
> > going on correct?
>
> Your understanding is correct: `FT_Face::FT_GlyphSlot::advance` is in
> 26.6 format, while `FT_Glyph::advance` is in 16.16 format, and the
> different rounding causes slight differences in the result.
>
> And I agree that there is probably nothing to be fixed except the
> documentation, which should mention this difference, and how to
> circumvent it if necessary.
>
> David?
>
>
Yes, FT_Set_Transform is a convenience function, and client code should use
direct floating-point computations for better accuracy.
Here's a patch to update the function's documentation. Feel free to correct
and apply it.

- David


> By the way, do you have a reason to mix `FT_Set_Transform` with
> `FT_Glyph_Transform` to get the same advance widths?  Otherwise, the
> difference shouldn't be an issue, right?
>
>
>     Werner
>
From 631c16837f08cdabaa1d0fe76e0fe7dc3343a928 Mon Sep 17 00:00:00 2001
From: David Turner <david.turner....@gmail.com>
Date: Tue, 14 Jul 2020 16:12:29 +0200
Subject: [doc] Update FT_Set_Transform documentation.

In order to mention the limited accuracy of FT_Matrix coefficients
and encourage client code to perform the transform themselves with
floating point values instead.
---
 include/freetype/freetype.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h
index ba3950e63..1b603a55f 100644
--- a/include/freetype/freetype.h
+++ b/include/freetype/freetype.h
@@ -3175,6 +3175,12 @@ FT_BEGIN_HEADER
    *     A pointer to the translation vector.  Use `NULL` for the null vector.
    *
    * @note:
+   *   This function is provided as a convenience, but keep in mind that
+   *   FT_Matrix coefficients are only 16.16 fixed point values, which can
+   *   limit the accuracy of the results. Using floating-point computations
+   *   to perform the transform directly in client code instead will always
+   *   yield better numbers.
+   *
    *   The transformation is only applied to scalable image formats after the
    *   glyph has been loaded.  It means that hinting is unaltered by the
    *   transformation and is performed on the character size given in the
-- 
2.20.1

Reply via email to