POV-Ray : Newsgroups : povray.beta-test : Possible v3,8 b2ta 2 fix for "Borked diacritical marks" Server Time
8 Oct 2024 16:41:01 EDT (-0400)
  Possible v3,8 b2ta 2 fix for "Borked diacritical marks" (Message 1 to 4 of 4)  
From: William F Pokorny
Subject: Possible v3,8 b2ta 2 fix for "Borked diacritical marks"
Date: 6 Apr 2023 17:04:40
Message: <642f33e8$1@news.povray.org>
With respect to the "Borked diacritical marks" thread in 
povray.binaries.images.

Ref:

http://news.povray.org/povray.binaries.images/thread/%3C642f0cc9%241%40news.povray.org%3E/

or

Message: <63cd6b12$1@news.povray.org>


I believe, but I've not verified, the fix used for the povr fork will
work with the current v3.8 beta 2 code. See below - with a little 
reformatting to prevent awkward lines splits.

Bill P.



In truetype.cpp change the following v3.8 beta 2 code:

//---
#ifdef TTF_DEBUG
             Debug_Info("sub_glyph %d: ", sub_glyph_index);
#endif

             if (flags & ARG_1_AND_2_ARE_WORDS)
             {
#ifdef TTF_DEBUG
                 Debug_Info("ARG_1_AND_2_ARE_WORDS ");
#endif
                 arg1 = READSHORT(ffile->fp);
                 arg2 = READSHORT(ffile->fp);
             }
             else
             {
                 arg1 = READUSHORT(ffile->fp);
                 arg2 = arg1 & 0xFF;
                 arg1 = (arg1 >> 8) & 0xFF;
             }
//---

to this:

//---
#ifdef TTF_DEBUG
             Debug_Info("sub_glyph %d:\n", sub_glyph_index);
#endif

             if (flags & ARG_1_AND_2_ARE_WORDS)
             {
#ifdef TTF_DEBUG
                 Debug_Info("ARG_1_AND_2_ARE_WORDS\n");
#endif
                 if (flags & ARGS_ARE_XY_VALUES)
                 {  // Values are int16_t
                     arg1 = READSHORT(*ffile->file);
                     arg2 = READSHORT(*ffile->file);
                 }
                 else
                 {  // Values are uint16_t
                     arg1 = READUSHORT(*ffile->file);
                     arg1 = READUSHORT(*ffile->file);
                 }
             }
             else
#ifdef TTF_DEBUG
                 Debug_Info("ARG_1_AND_2_ARE_BYTES\n");
#endif
                 if (flags & ARGS_ARE_XY_VALUES)
                 {  // Values are int8_t * 2

                     union uC {
                         int8_t buffer[2];
                         uint16_t value;
                     } u;
                     u.value = READUSHORT(*ffile->file);

             // Determine this machine's endianness. Method used herein
             // derived from netpbm's pamtopfm converter by: Bryan
             // Henderson, San Jose, CA April 2004. Code was contributed
             // to the public domain.
                     short const testNumber = 0x0001;
                     unsigned char* const storedNumber =
			(unsigned char *)&testNumber;
                     int BigEndian = (storedNumber[0] == 0x01) ? 0 : 1;

                     if (BigEndian)
                     {
                         arg1 = (SHORT)u.buffer[0];
                         arg2 = (SHORT)u.buffer[1];
                     }
                     else
                     {
                         arg1 = (SHORT)u.buffer[1];
                         arg2 = (SHORT)u.buffer[0];
                     }
                 }
                 else
                 {  // Values are uint8_t
                     arg1 = READUSHORT(*ffile->file);
                     arg2 = arg1 & 0xFF;
                     arg1 = (arg1 >> 8) & 0xFF;
                 }
             }
//---


Post a reply to this message

From: jr
Subject: Re: Possible v3,8 b2ta 2 fix for "Borked diacritical marks"
Date: 7 Apr 2023 07:30:00
Message: <web.642ffe31500c41f34301edef6cde94f1@news.povray.org>
hi,

William F Pokorny <ano### [at] anonymousorg> wrote:
> With respect to the "Borked diacritical marks" thread in
> povray.binaries.images.
> ...
> I believe, but I've not verified, the fix used for the povr fork will
> work with the current v3.8 beta 2 code.

no, alas.  see below.


> ...
> to this:
>
> //---
> #ifdef TTF_DEBUG
>              Debug_Info("sub_glyph %d:\n", sub_glyph_index);
> #endif
>
>              if (flags & ARG_1_AND_2_ARE_WORDS)
>              {
> #ifdef TTF_DEBUG
>                  Debug_Info("ARG_1_AND_2_ARE_WORDS\n");
> #endif
>                  if (flags & ARGS_ARE_XY_VALUES)
>                  {  // Values are int16_t
>                      arg1 = READSHORT(*ffile->file);
>                      arg2 = READSHORT(*ffile->file);
>                  }
>                  else
>                  {  // Values are uint16_t
>                      arg1 = READUSHORT(*ffile->file);
>                      arg1 = READUSHORT(*ffile->file);
>                  }
>              }
>              else

lost opening brace ?


in your 'povr' you made changes to the TrueTypeFont struct(ure), among them the
introduction of the 'file' member.
source/core/shape/truetype.h:125, in version _6e4ed6c2.

think this is really important, and useful, and so hope you will find the time
to "back-port".  (thank you, in advance)


regards, jr.


Post a reply to this message

From: William F Pokorny
Subject: Re: Possible v3,8 b2ta 2 fix for "Borked diacritical marks"
Date: 7 Apr 2023 09:45:59
Message: <64301e97$1@news.povray.org>
On 4/7/23 07:27, jr wrote:
> think this is really important, and useful, and so hope you will find the time
> to "back-port".  (thank you, in advance)

The particular change there was one of Christoph's which got backed out 
for the v3.8 release. The READSHORT() and READUSHORT() arguments need to 
be changed to what they are in the v3.8 beta 2 code. I didn't notice the 
argument change as it has nothing to do with the fix.

In any case, I had a current local copy of the v3.8 beta 2 unix/linux 
tar ball. Attached is a unified diff patch file. It should be Chris, or 
whomever, can use it to apply the fix to the current v3.8 beta 2 
truetype.cpp file and compile. I ran one of my test sets (vowels with 9 
Ubuntu shipped fonts) and results looked OK.

patch truetype.cpp <borked_ttf.patch

Bill P.


Post a reply to this message


Attachments:
Download 'borked_ttf.patch.txt' (3 KB)

From: jr
Subject: Re: Possible v3,8 b2ta 2 fix for "Borked diacritical marks"
Date: 7 Apr 2023 11:15:00
Message: <web.643032c0500c41f34301edef6cde94f1@news.povray.org>
hi,

William F Pokorny <ano### [at] anonymousorg> wrote:
> ...
> In any case, I had a current local copy of the v3.8 beta 2 unix/linux
> tar ball. Attached is a unified diff patch file. It should be Chris, or
> whomever, can use it to apply the fix to the current v3.8 beta 2
> truetype.cpp file and compile. I ran one of my test sets (vowels with 9
> Ubuntu shipped fonts) and results looked OK.

wow.  quick.  patched a beta.2 and tried with a couple of fonts, and (think) I
see an improvement with 'times.ttf'.  hope to do some more .. organised :-)
testing this weekend.  thank you.


regards, jr.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.