]> git.eshelyaron.com Git - emacs.git/commitdiff
(w32_compute_glyph_string_overhangs): Compute overhangs
authorJason Rumney <jasonr@gnu.org>
Wed, 9 Apr 2008 12:14:52 +0000 (12:14 +0000)
committerJason Rumney <jasonr@gnu.org>
Wed, 9 Apr 2008 12:14:52 +0000 (12:14 +0000)
for new font backend and composite cases.

src/ChangeLog
src/w32term.c

index 179fcadfc215e869ef91dd13079eaa228aa2f27b..a9ba878737e0c95aed6e204cb179a07e14c7e479 100644 (file)
@@ -1,3 +1,8 @@
+2008-04-09  Jason Rumney  <jasonr@gnu.org>
+
+       * w32term.c (w32_compute_glyph_string_overhangs): Compute overhangs
+       for new font backend and composite cases.
+
 2008-04-09  Jan Djärv  <jan.h.d@swipnet.se>
 
        * atimer.c (alarm_signal_handler): Call run_timers if not SYNC_INPUT.
@@ -5,7 +10,8 @@
        (do_pending_atimers): Call run_timers.
        (run_timers): New function.
 
-       * sysdep.c (emacs_write): If SYNC_INPUT and pending_atimers, run atimers.
+       * sysdep.c (emacs_write): If SYNC_INPUT and pending_atimers,
+       run atimers.
 
        * process.c (wait_reading_process_output): The same as above.
 
index 944c0f9fa430d76bae6b042f5c14dd919f3e6e2c..a40fe2edc4878904aefd63a38f7a5acc3e774a44 100644 (file)
@@ -1763,9 +1763,35 @@ static void
 w32_compute_glyph_string_overhangs (s)
      struct glyph_string *s;
 {
+  if (s->cmp == NULL
+      && s->first_glyph->type == CHAR_GLYPH)
+    {
+#ifdef USE_FONT_BACKEND
+      if (enable_font_backend)
+       {
+         unsigned *code = alloca (sizeof (unsigned) * s->nchars);
+         struct font *font = (struct font *) s->font_info;
+         struct font_metrics metrics;
+         int i;
+
+         for (i = 0; i < s->nchars; i++)
+           code[i] = s->char2b[i];
+         font->driver->text_extents (font, code, s->nchars, &metrics);
+         s->right_overhang = (metrics.rbearing > metrics.width
+                              ? metrics.rbearing - metrics.width : 0);
+         s->left_overhang = metrics.lbearing < 0 ? -metrics.lbearing : 0;
+       }
+#else
   /* TODO: Windows does not appear to have a method for
      getting this info without getting the ABC widths for each
      individual character and working it out manually. */
+#endif
+    }
+  else if (s->cmp)
+    {
+      s->right_overhang = s->cmp->rbearing - s->cmp->pixel_width;
+      s->left_overhang = -s->cmp->lbearing;
+    }
 }
 
 
@@ -6892,7 +6918,7 @@ static struct redisplay_interface w32_redisplay_interface =
   w32_destroy_fringe_bitmap,
   w32_per_char_metric,
   w32_encode_char,
-  NULL, /* w32_compute_glyph_string_overhangs */
+  w32_compute_glyph_string_overhangs,
   x_draw_glyph_string,
   w32_define_frame_cursor,
   w32_clear_frame_area,