POV-Ray : Newsgroups : povray.beta-test : Possible v3,8 b2ta 2 fix for "Borked diacritical marks" : Possible v3,8 b2ta 2 fix for "Borked diacritical marks" Server Time
2 Mar 2024 20:22:30 EST (-0500)
  Possible v3,8 b2ta 2 fix for "Borked diacritical marks"  
From: William F Pokorny
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

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