summaryrefslogtreecommitdiffstats
path: root/unmaintained/freetype-infinality/freetype2-infinality-protect_null_pointer-goddesse.patch
blob: 43143e69e1f33e8da129459e58e319fb80ce3dd6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
Contributed by goddesse
https://bbs.archlinux.org/viewtopic.php?pid=864901#p864901

diff -Naur freetype-2.4.4/src/base/ftlcdfil.c freetype-2.4.4.new/src/base/ftlcdfil.c
--- freetype-2.4.4/src/base/ftlcdfil.c    2010-12-12 12:05:21.606671258 -0600
+++ freetype-2.4.4.new/src/base/ftlcdfil.c    2010-12-12 12:08:17.726671242 -0600
@@ -180,14 +180,17 @@
         else if (strcasecmp(alignment_type_env, "infinality1") == 0) alignment_type = 6;
         else alignment_type = 0;
 
-        if ( /*strstr(slot.metrics->root.scaler.face->style_name, "Regular")
-          || strstr(slot.metrics->root.scaler.face->style_name, "Book")
-          || strstr(slot.metrics->root.scaler.face->style_name, "Medium")
-          ||*/ strcasestr(slot->face->style_name, "Italic")
-          || strcasestr(slot->face->style_name, "Oblique") )
-          alignment_type = 0;
-        if ( strcasestr(slot->face->style_name, "Bold") )
-          alignment_type = 0;
+        if ( slot->face != NULL && slot->face->style_name != NULL )
+        {
+          if ( /*strstr(slot.metrics->root.scaler.face->style_name, "Regular")
+            || strstr(slot.metrics->root.scaler.face->style_name, "Book")
+            || strstr(slot.metrics->root.scaler.face->style_name, "Medium")
+            ||*/ strcasestr(slot->face->style_name, "Italic")
+            || strcasestr(slot->face->style_name, "Oblique") )
+            alignment_type = 0;
+          if ( strcasestr(slot->face->style_name, "Bold") )
+            alignment_type = 0;
+        }
       }
       checked_alignment_type = 1;
     }
@@ -214,16 +217,19 @@
     /*printf("%s,%s ", slot->face->family_name, slot->face->style_name);*/
     /*printf("%d ", slot->face->size->metrics.x_ppem);*/
 
-    /* set gamma value to 1 if out of range */
-    if ( slot->face->size->metrics.x_ppem >= pseudo_gamma_lt )
+    if ( slot->face && slot->face->size )
     {
-      pseudo_gamma_value = 1;
-    }
+        /* set gamma value to 1 if out of range */
+        if ( slot->face->size->metrics.x_ppem >= pseudo_gamma_lt )
+        {
+          pseudo_gamma_value = 1;
+        }
 
-    /* don't do alignment for < 10 */
-    if ( slot->face->size->metrics.x_ppem < 10 )
-    {
-      alignment_type = 0;
+        /* don't do alignment for < 10 */
+        if ( slot->face->size->metrics.x_ppem < 10 )
+        {
+          alignment_type = 0;
+        }
     }
 
     if ( mode == FT_RENDER_MODE_LCD )
@@ -642,7 +648,9 @@
       if ( pseudo_gamma_value != 1 )
       {
         FT_Byte*  line = bitmap->buffer;
-        float ppem = (float)slot->face->size->metrics.x_ppem;
+        float ppem = 0;
+        if ( slot->face && slot->face->size )
+            ppem = (float)slot->face->size->metrics.x_ppem;
 
         if (ppem >= 5 )
         for (height = (FT_UInt)bitmap->rows; height > 0; height--, line += bitmap->pitch )