Unify FRAME_window_system_DISPLAY_INFO macros between all ports.
[bpt/emacs.git] / src / nsfont.m
index ad169d7..b61147d 100644 (file)
@@ -61,6 +61,7 @@ static void ns_uni_to_glyphs (struct nsfont_info *font_info,
 static void ns_glyph_metrics (struct nsfont_info *font_info,
                               unsigned char block);
 
+#define INVALID_GLYPH 0xFFFF
 
 /* ==========================================================================
 
@@ -661,7 +662,7 @@ struct font_driver nsfont_driver =
 static Lisp_Object
 nsfont_get_cache (struct frame *frame)
 {
-  Display_Info *dpyinfo = FRAME_NS_DISPLAY_INFO (frame);
+  Display_Info *dpyinfo = FRAME_DISPLAY_INFO (frame);
   return (dpyinfo->name_list_element);
 }
 
@@ -920,8 +921,7 @@ nsfont_open (struct frame *f, Lisp_Object font_entity, int pixel_size)
     font->underline_thickness = lrint (font_info->underwidth);
 
     font->props[FONT_NAME_INDEX] = Ffont_xlfd_name (font_object, Qnil);
-    font->props[FONT_FULLNAME_INDEX] =
-      make_unibyte_string (font_info->name, strlen (font_info->name));
+    font->props[FONT_FULLNAME_INDEX] = build_unibyte_string (font_info->name);
   }
   unblock_input ();
 
@@ -982,7 +982,7 @@ nsfont_encode_char (struct font *font, int c)
     ns_uni_to_glyphs (font_info, high);
 
   g = font_info->glyphs[high][low];
-  return g == 0xFFFF ? FONT_INVALID_CODE : g;
+  return g == INVALID_GLYPH ? FONT_INVALID_CODE : g;
 }
 
 
@@ -1175,7 +1175,7 @@ nsfont_draw (struct glyph_string *s, int from, int to, int x, int y,
           : FRAME_BACKGROUND_COLOR (s->f)) set];
       else
         {
-          struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (s->f);
+          struct ns_display_info *dpyinfo = FRAME_DISPLAY_INFO (s->f);
           [[dpyinfo->bitmaps[face->stipple-1].img stippleMask] set];
         }
       NSRectFill (br);
@@ -1355,8 +1355,8 @@ ns_uni_to_glyphs (struct nsfont_info *font_info, unsigned char block)
 #else
         g = glyphStorage->cglyphs[i];
         /* TODO: is this a good check?  maybe need to use coveredChars.. */
-        if (g > numGlyphs)
-          g = 0xFFFF; /* hopefully unused... */
+        if (g > numGlyphs || g == NSNullGlyph)
+          g = INVALID_GLYPH; /* hopefully unused... */
 #endif
         *glyphs = g;
       }
@@ -1484,7 +1484,7 @@ ns_glyph_metrics (struct nsfont_info *font_info, unsigned char block)
         characterIndex: (NSUInteger)charIndex
 {
   len = glyphIndex+length;
-  for (i =glyphIndex; i<len; i++)
+  for (i =glyphIndex; i<len; i++) 
     cglyphs[i] = glyphs[i-glyphIndex];
   if (len > maxGlyph)
     maxGlyph = len;