freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[freetype2-demos] master 0e3786b 2/2: * src/ftcommon.c (FTDemo_String_Se


From: Werner Lemberg
Subject: [freetype2-demos] master 0e3786b 2/2: * src/ftcommon.c (FTDemo_String_Set): Refactor.
Date: Sun, 14 Aug 2022 23:43:18 -0400 (EDT)

branch: master
commit 0e3786b2486907dd17c1b17b4c46387726b61048
Author: Alexei Podtelezhnikov <apodtele@gmail.com>
Commit: Alexei Podtelezhnikov <apodtele@gmail.com>

    * src/ftcommon.c (FTDemo_String_Set): Refactor.
---
 src/ftcommon.c | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/src/ftcommon.c b/src/ftcommon.c
index 0459f32..677048f 100644
--- a/src/ftcommon.c
+++ b/src/ftcommon.c
@@ -1686,24 +1686,15 @@
   {
     const char*    p = string;
     const char*    end = p + strlen( string );
-    unsigned long  codepoint;
     int            ch;
-    int            expect;
     PGlyph         glyph = handle->string;
 
 
     handle->string_length = 0;
-    codepoint = expect = 0;
 
-    for (;;)
+    while ( ( ch = utf8_next( &p, end ) ) >= 0 )
     {
-      ch = utf8_next( &p, end );
-      if ( ch < 0 )
-        break;
-
-      codepoint = (unsigned long)ch;
-
-      glyph->glyph_index = FTDemo_Get_Index( handle, codepoint );
+      glyph->glyph_index = FTDemo_Get_Index( handle, (FT_UInt32)ch );
 
       glyph++;
       handle->string_length++;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]