diff options
| author | Eli Zaretskii | 2010-11-13 15:29:31 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2010-11-13 15:29:31 +0200 |
| commit | 0eb025fb55277c038c39e7325a556de46ecbd2e4 (patch) | |
| tree | 677650021eae4915030d38baabe6c872eaa31845 | |
| parent | 6e060cee8186d9fe5ad5f8a783d45f80f9b1bbe3 (diff) | |
| download | emacs-0eb025fb55277c038c39e7325a556de46ecbd2e4.tar.gz emacs-0eb025fb55277c038c39e7325a556de46ecbd2e4.zip | |
Fix and document display of glyphless characters.
src/xdisp.c (set_cursor_from_row): Fix cursor positioning on
zero-width characters.
(syms_of_xdisp) <glyphless-char-display>: Doc fix.
src/.gdbinit (pgx): Adapt to latest changes in `struct glyph'.
src/w32term.c (x_draw_glyphless_glyph_string_foreground): Draw the
box before drawing the glyphs inside it.
src/dispextern.h (enum glyphless_display_method): Rename
GLYPHLESS_DISPLAY_HEXA_CODE to GLYPHLESS_DISPLAY_HEX_CODE. All
users changed.
src/term.c (append_glyphless_glyph, produce_glyphless_glyph): Fix
comments.
(produce_glyphless_glyph): Enclose "U+nnnn" and "empty box"
whitespace in "[]", to simulate a box. Don't use uninitialized
variable `width'.
lisp/international/characters.el (glyphless-char-display-control):
Renamed from glyphless-char-control; all users changed. Doc fix.
Signal an error if display method is not one of the recognized
symbols.
doc/emacs/rmail.texi (Rmail Coding): Characters with no fonts are not
necessarily displayed as empty boxes.
doc/emacs/mule.texi (Language Environments, Fontsets): Characters with no
fonts are not necessarily displayed as empty boxes.
doc/emacs/display.texi (Text Display): Document display of glyphless
characters.
doc/lispref/display.texi (Usual Display): Characters with no fonts are not
necessarily displayed as empty boxes.
etc/NEWS: Document display of glyphless characters.
| -rw-r--r-- | doc/emacs/ChangeLog | 11 | ||||
| -rw-r--r-- | doc/emacs/display.texi | 42 | ||||
| -rw-r--r-- | doc/emacs/mule.texi | 18 | ||||
| -rw-r--r-- | doc/emacs/rmail.texi | 3 | ||||
| -rw-r--r-- | doc/lispref/ChangeLog | 5 | ||||
| -rw-r--r-- | doc/lispref/display.texi | 6 | ||||
| -rw-r--r-- | etc/ChangeLog | 4 | ||||
| -rw-r--r-- | etc/NEWS | 12 | ||||
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/international/characters.el | 54 | ||||
| -rw-r--r-- | src/.gdbinit | 26 | ||||
| -rw-r--r-- | src/ChangeLog | 22 | ||||
| -rw-r--r-- | src/dispextern.h | 14 | ||||
| -rw-r--r-- | src/term.c | 33 | ||||
| -rw-r--r-- | src/w32term.c | 14 | ||||
| -rw-r--r-- | src/xdisp.c | 28 | ||||
| -rw-r--r-- | src/xterm.c | 2 |
17 files changed, 216 insertions, 84 deletions
diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog index e96846d7ea2..cb243825d5d 100644 --- a/doc/emacs/ChangeLog +++ b/doc/emacs/ChangeLog | |||
| @@ -1,3 +1,14 @@ | |||
| 1 | 2010-11-13 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * rmail.texi (Rmail Coding): Characters with no fonts are not | ||
| 4 | necessarily displayed as empty boxes. | ||
| 5 | |||
| 6 | * mule.texi (Language Environments, Fontsets): Characters with no | ||
| 7 | fonts are not necessarily displayed as empty boxes. | ||
| 8 | |||
| 9 | * display.texi (Text Display): Document display of glyphless | ||
| 10 | characters. | ||
| 11 | |||
| 1 | 2010-11-13 Glenn Morris <rgm@gnu.org> | 12 | 2010-11-13 Glenn Morris <rgm@gnu.org> |
| 2 | 13 | ||
| 3 | * basic.texi (Position Info): Add M-x count-words-region. | 14 | * basic.texi (Position Info): Add M-x count-words-region. |
diff --git a/doc/emacs/display.texi b/doc/emacs/display.texi index 3b5e7b0b955..cd08a524f50 100644 --- a/doc/emacs/display.texi +++ b/doc/emacs/display.texi | |||
| @@ -1136,6 +1136,48 @@ prefix these characters with an escape character. | |||
| 1136 | by means of a display table. @xref{Display Tables,, Display Tables, | 1136 | by means of a display table. @xref{Display Tables,, Display Tables, |
| 1137 | elisp, The Emacs Lisp Reference Manual}. | 1137 | elisp, The Emacs Lisp Reference Manual}. |
| 1138 | 1138 | ||
| 1139 | @cindex glyphless characters | ||
| 1140 | @cindex characters with no font glyphs | ||
| 1141 | On graphics displays, some characters could have no glyphs in any of | ||
| 1142 | the fonts available to Emacs. On text terminals, some characters | ||
| 1143 | could be impossible to encode with the terminal coding system | ||
| 1144 | (@pxref{Terminal Coding}). Emacs can display such @dfn{glyphless} | ||
| 1145 | characters using one of the following methods: | ||
| 1146 | |||
| 1147 | @table @code | ||
| 1148 | @item zero-width | ||
| 1149 | Don't display the character. | ||
| 1150 | |||
| 1151 | @item thin-space | ||
| 1152 | Display a thin space, 1-pixel wide on graphics displays or 1-character | ||
| 1153 | wide on text terminals. | ||
| 1154 | |||
| 1155 | @item empty-box | ||
| 1156 | Display an empty box. | ||
| 1157 | |||
| 1158 | @item acronym | ||
| 1159 | Display the acronym of the character's name (such as @sc{zwnj} or | ||
| 1160 | @sc{rlm}) in a box. | ||
| 1161 | |||
| 1162 | @item hex-code | ||
| 1163 | Display the Unicode codepoint of the character in hexadecimal | ||
| 1164 | notation, in a box. | ||
| 1165 | @end table | ||
| 1166 | |||
| 1167 | @noindent | ||
| 1168 | @cindex @code{glyphless-char} face | ||
| 1169 | With the exception of @code{zero-width}, all other methods draw these | ||
| 1170 | characters in a special face @code{glyphless-char}, which you can | ||
| 1171 | customize. | ||
| 1172 | |||
| 1173 | @vindex glyphless-char-display-control | ||
| 1174 | @vindex char-acronym-table | ||
| 1175 | To control what glyphless characters are displayed using which method, | ||
| 1176 | customize the variable @code{glyphless-char-display-control}; see its | ||
| 1177 | doc string for the details. For even finer control, set the elements | ||
| 1178 | of 2 char-tables: @code{glyphless-char-display} and | ||
| 1179 | @code{char-acronym-table}. | ||
| 1180 | |||
| 1139 | @node Cursor Display | 1181 | @node Cursor Display |
| 1140 | @section Displaying the Cursor | 1182 | @section Displaying the Cursor |
| 1141 | 1183 | ||
diff --git a/doc/emacs/mule.texi b/doc/emacs/mule.texi index 9fdef175826..79dbf78f292 100644 --- a/doc/emacs/mule.texi +++ b/doc/emacs/mule.texi | |||
| @@ -351,10 +351,11 @@ which prefers Cyrillic characters and files encoded in Windows-1255). | |||
| 351 | @cindex Intlfonts package, installation | 351 | @cindex Intlfonts package, installation |
| 352 | To display the script(s) used by your language environment on a | 352 | To display the script(s) used by your language environment on a |
| 353 | graphical display, you need to have a suitable font. If some of the | 353 | graphical display, you need to have a suitable font. If some of the |
| 354 | characters appear as empty boxes, you should install the GNU Intlfonts | 354 | characters appear as empty boxes or hex codes, you should install the |
| 355 | package, which includes fonts for most supported scripts.@footnote{If | 355 | GNU Intlfonts package, which includes fonts for most supported |
| 356 | you run Emacs on X, you need to inform the X server about the location | 356 | scripts.@footnote{If you run Emacs on X, you need to inform the X |
| 357 | of the newly installed fonts with the following commands: | 357 | server about the location of the newly installed fonts with the |
| 358 | following commands: | ||
| 358 | 359 | ||
| 359 | @example | 360 | @example |
| 360 | xset fp+ /usr/local/share/emacs/fonts | 361 | xset fp+ /usr/local/share/emacs/fonts |
| @@ -1314,10 +1315,11 @@ characters the font does not cover. The standard fontset is only used if | |||
| 1314 | explicitly requested, despite its name. | 1315 | explicitly requested, despite its name. |
| 1315 | 1316 | ||
| 1316 | A fontset does not necessarily specify a font for every character | 1317 | A fontset does not necessarily specify a font for every character |
| 1317 | code. If a fontset specifies no font for a certain character, or if it | 1318 | code. If a fontset specifies no font for a certain character, or if |
| 1318 | specifies a font that does not exist on your system, then it cannot | 1319 | it specifies a font that does not exist on your system, then it cannot |
| 1319 | display that character properly. It will display that character as an | 1320 | display that character properly. It will display that character as a |
| 1320 | empty box instead. | 1321 | hex code or thin space or an empty box instead. (@xref{Text Display, |
| 1322 | glyphless characters}, for details.) | ||
| 1321 | 1323 | ||
| 1322 | @node Defining Fontsets | 1324 | @node Defining Fontsets |
| 1323 | @section Defining fontsets | 1325 | @section Defining fontsets |
diff --git a/doc/emacs/rmail.texi b/doc/emacs/rmail.texi index d477ca73c46..ddf68e62bbf 100644 --- a/doc/emacs/rmail.texi +++ b/doc/emacs/rmail.texi | |||
| @@ -1192,7 +1192,8 @@ specification, or because the specification was inaccurate. For | |||
| 1192 | example, a misconfigured mailer could send a message with a | 1192 | example, a misconfigured mailer could send a message with a |
| 1193 | @samp{charset=iso-8859-1} header when the message is actually encoded | 1193 | @samp{charset=iso-8859-1} header when the message is actually encoded |
| 1194 | in @code{koi8-r}. When you see the message text garbled, or some of | 1194 | in @code{koi8-r}. When you see the message text garbled, or some of |
| 1195 | its characters displayed as empty boxes, this may have happened. | 1195 | its characters displayed as hex codes or empty boxes, this may have |
| 1196 | happened. | ||
| 1196 | 1197 | ||
| 1197 | @findex rmail-redecode-body | 1198 | @findex rmail-redecode-body |
| 1198 | You can correct the problem by decoding the message again using the | 1199 | You can correct the problem by decoding the message again using the |
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index 5607d179aad..d6853e0066d 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2010-11-13 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * display.texi (Usual Display): Characters with no fonts are not | ||
| 4 | necessarily displayed as empty boxes. | ||
| 5 | |||
| 1 | 2010-10-31 Glenn Morris <rgm@gnu.org> | 6 | 2010-10-31 Glenn Morris <rgm@gnu.org> |
| 2 | 7 | ||
| 3 | * maps.texi (Standard Keymaps): Update File menu description. | 8 | * maps.texi (Standard Keymaps): Update File menu description. |
diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index 92f96d302d9..6e872ad4233 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi | |||
| @@ -5579,9 +5579,9 @@ digit characters representing the character code in octal. (A display | |||
| 5579 | table can specify a glyph to use instead of @samp{\}.) | 5579 | table can specify a glyph to use instead of @samp{\}.) |
| 5580 | 5580 | ||
| 5581 | @item | 5581 | @item |
| 5582 | Multibyte character codes above 256 are displayed as themselves, or as a | 5582 | Multibyte character codes above 256 are displayed as themselves, or as |
| 5583 | question mark or empty box if the terminal cannot display that | 5583 | a question mark or a hex code or an empty box if the terminal cannot |
| 5584 | character. | 5584 | display that character. |
| 5585 | @end itemize | 5585 | @end itemize |
| 5586 | 5586 | ||
| 5587 | The usual display conventions apply even when there is a display | 5587 | The usual display conventions apply even when there is a display |
diff --git a/etc/ChangeLog b/etc/ChangeLog index a01fb8beef2..06bd63e9f8c 100644 --- a/etc/ChangeLog +++ b/etc/ChangeLog | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | 2010-11-13 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * NEWS: Document display of glyphless characters. | ||
| 4 | |||
| 1 | 2010-11-11 Eric Schulte <schulte.eric@gmail.com> | 5 | 2010-11-11 Eric Schulte <schulte.eric@gmail.com> |
| 2 | 6 | ||
| 3 | * refcards/orgcard.tex: Add new Babel key sequences. | 7 | * refcards/orgcard.tex: Add new Babel key sequences. |
| @@ -138,6 +138,18 @@ with Xft. To change font, use X resource faceName, for example: | |||
| 138 | Emacs.pane.menubar.faceName: Courier-12 | 138 | Emacs.pane.menubar.faceName: Courier-12 |
| 139 | Set faceName to none and use font to use the old X fonts. | 139 | Set faceName to none and use font to use the old X fonts. |
| 140 | 140 | ||
| 141 | +++ | ||
| 142 | ** Enhanced support for characters that have no glyphs in available fonts | ||
| 143 | If a character has no glyphs in any of the available fonts, Emacs by | ||
| 144 | default will display it either as a hexadecimal code in a box or as a | ||
| 145 | thin 1-pixel space. In addition to these two methods, Emacs can | ||
| 146 | display these characters as empty box, as an acronym, or not display | ||
| 147 | them at all. To change how these characters are displayed, customize | ||
| 148 | the variable `glyphless-char-display-control'. | ||
| 149 | |||
| 150 | On character terminals these methods are used for characters that | ||
| 151 | cannot be encoded by the `terminal-coding-system'. | ||
| 152 | |||
| 141 | ** On graphical displays, the mode-line no longer ends in dashes. | 153 | ** On graphical displays, the mode-line no longer ends in dashes. |
| 142 | 154 | ||
| 143 | ** Basic SELinux support has been added. | 155 | ** Basic SELinux support has been added. |
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 2e344badb72..3c673667f3e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2010-11-13 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * international/characters.el (glyphless-char-display-control): | ||
| 4 | Doc fix. Signal an error if display method is not one of the | ||
| 5 | recognized symbols. | ||
| 6 | |||
| 1 | 2010-11-13 Michael Albinus <michael.albinus@gmx.de> | 7 | 2010-11-13 Michael Albinus <michael.albinus@gmx.de> |
| 2 | 8 | ||
| 3 | * net/tramp-compat.el (tramp-compat-line-beginning-position) | 9 | * net/tramp-compat.el (tramp-compat-line-beginning-position) |
diff --git a/lisp/international/characters.el b/lisp/international/characters.el index 49ada52fa63..379ce76c4b2 100644 --- a/lisp/international/characters.el +++ b/lisp/international/characters.el | |||
| @@ -1294,40 +1294,48 @@ Setup char-width-table appropriate for non-CJK language environment." | |||
| 1294 | (aset char-acronym-table #xE007F "->|TAG") ; CANCEL TAG | 1294 | (aset char-acronym-table #xE007F "->|TAG") ; CANCEL TAG |
| 1295 | 1295 | ||
| 1296 | ;;; Control of displaying glyphless characters. | 1296 | ;;; Control of displaying glyphless characters. |
| 1297 | (defvar glyphless-char-control | 1297 | (defvar glyphless-char-display-control |
| 1298 | '((format-control . thin-space) | 1298 | '((format-control . thin-space) |
| 1299 | (no-font . hexa-code)) | 1299 | (no-font . hex-code)) |
| 1300 | "List of directives to control displaying of glyphless characters. | 1300 | "List of directives to control display of glyphless characters. |
| 1301 | 1301 | ||
| 1302 | Each element has the form (TARGET . METHOD), where TARGET is a | 1302 | Each element has the form (GROUP . METHOD), where GROUP is a |
| 1303 | symbol specifying the target character group to control, and | 1303 | symbol specifying the character group, and METHOD is a symbol |
| 1304 | METHOD is a symbol specifying the method of displaying them. | 1304 | specifying the method of displaying characters belonging to that |
| 1305 | 1305 | group. | |
| 1306 | TARGET must be one of these symbols: | 1306 | |
| 1307 | `c0-control': U+0000..U+001F. | 1307 | GROUP must be one of these symbols: |
| 1308 | `c1-control': U+0080..U+009F. | 1308 | `c0-control': U+0000..U+001F. |
| 1309 | `format-control': Characters of Unicode General Category `Cf'. | 1309 | `c1-control': U+0080..U+009F. |
| 1310 | Ex: U+200C (ZWNJ), U+200E (LRM)), but don't include characters | 1310 | `format-control': Characters of Unicode General Category `Cf', |
| 1311 | that have graphic image such as U+00AD (SHY). | 1311 | such as U+200C (ZWNJ), U+200E (LRM), but |
| 1312 | `no-font': characters for which no suitable font is found. | 1312 | excluding characters that have graphic images, |
| 1313 | such as U+00AD (SHY). | ||
| 1314 | `no-font': characters for which no suitable font is found. | ||
| 1315 | For character terminals, characters that cannot | ||
| 1316 | be encoded by `terminal-coding-system'. | ||
| 1313 | 1317 | ||
| 1314 | METHOD must be one of these symbols: | 1318 | METHOD must be one of these symbols: |
| 1315 | `zero-width': don't display. | 1319 | `zero-width': don't display. |
| 1316 | `thin-space': display a thin space (1-pixel width). | 1320 | `thin-space': display a thin (1-pixel width) space. On character |
| 1317 | `empty-box': display an empty box. | 1321 | terminals, display as 1-character space. |
| 1318 | `acronym': display an acronum string in a box. | 1322 | `empty-box': display an empty box. |
| 1319 | `hexa-code': display a hexadecimal character code in a box. | 1323 | `acronym': display an acronym of the character in a box. The |
| 1324 | acronym is taken from `char-acronym-table', which see. | ||
| 1325 | `hex-code': display the hexadecimal character code in a box. | ||
| 1320 | 1326 | ||
| 1321 | Just setting this variable does not take effect. Call the | 1327 | Just setting this variable does not take effect. Call the |
| 1322 | function `update-glyphless-char-display' (which see) after | 1328 | function `update-glyphless-char-display' (which see) after |
| 1323 | setting this variable.") | 1329 | setting this variable.") |
| 1324 | 1330 | ||
| 1325 | (defun update-glyphless-char-display () | 1331 | (defun update-glyphless-char-display () |
| 1326 | "Make the setting of `glyphless-char-control' take effect. | 1332 | "Make the setting of `glyphless-char-display-control' take effect. |
| 1327 | This function updates the char-table `glyphless-char-display'." | 1333 | This function updates the char-table `glyphless-char-display'." |
| 1328 | (dolist (elt glyphless-char-control) | 1334 | (dolist (elt glyphless-char-display-control) |
| 1329 | (let ((target (car elt)) | 1335 | (let ((target (car elt)) |
| 1330 | (method (cdr elt))) | 1336 | (method (cdr elt))) |
| 1337 | (or (memq method '(zero-width thin-space empty-box acronym hex-code)) | ||
| 1338 | (error "Invalid glyphless character display method: %s" method)) | ||
| 1331 | (cond ((eq target 'c0-control) | 1339 | (cond ((eq target 'c0-control) |
| 1332 | (set-char-table-range glyphless-char-display '(#x00 . #x1F) | 1340 | (set-char-table-range glyphless-char-display '(#x00 . #x1F) |
| 1333 | method)) | 1341 | method)) |
| @@ -1346,7 +1354,7 @@ This function updates the char-table `glyphless-char-display'." | |||
| 1346 | (while (<= from to) | 1354 | (while (<= from to) |
| 1347 | (when (/= from #xAD) | 1355 | (when (/= from #xAD) |
| 1348 | (if (eq method 'acronym) | 1356 | (if (eq method 'acronym) |
| 1349 | (setq this-method | 1357 | (setq this-method |
| 1350 | (aref char-acronym-table from))) | 1358 | (aref char-acronym-table from))) |
| 1351 | (set-char-table-range glyphless-char-display | 1359 | (set-char-table-range glyphless-char-display |
| 1352 | from this-method)) | 1360 | from this-method)) |
| @@ -1355,7 +1363,7 @@ This function updates the char-table `glyphless-char-display'." | |||
| 1355 | ((eq target 'no-font) | 1363 | ((eq target 'no-font) |
| 1356 | (set-char-table-extra-slot glyphless-char-display 0 method)) | 1364 | (set-char-table-extra-slot glyphless-char-display 0 method)) |
| 1357 | (t | 1365 | (t |
| 1358 | (error "Invalid target character group: %s" target)))))) | 1366 | (error "Invalid glyphless character group: %s" target)))))) |
| 1359 | 1367 | ||
| 1360 | (update-glyphless-char-display) | 1368 | (update-glyphless-char-display) |
| 1361 | 1369 | ||
diff --git a/src/.gdbinit b/src/.gdbinit index b3bb6b58267..73fecea5972 100644 --- a/src/.gdbinit +++ b/src/.gdbinit | |||
| @@ -494,14 +494,30 @@ define pgx | |||
| 494 | end | 494 | end |
| 495 | # COMPOSITE_GLYPH | 495 | # COMPOSITE_GLYPH |
| 496 | if ($g->type == 1) | 496 | if ($g->type == 1) |
| 497 | printf "COMP[%d (%d..%d)]", $g->u.cmp.id, $g->u.cmp.from, $g->u.cmp.to | 497 | printf "COMP[%d (%d..%d)]", $g->u.cmp.id, $g->slice.cmp.from, $g->slice.cmp.to |
| 498 | end | 498 | end |
| 499 | # IMAGE_GLYPH | 499 | # GLYPHLESS_GLYPH |
| 500 | if ($g->type == 2) | 500 | if ($g->type == 2) |
| 501 | printf "GLYPHLESS[" | ||
| 502 | if ($g->u.glyphless.method == 0) | ||
| 503 | printf "THIN]" | ||
| 504 | end | ||
| 505 | if ($g->u.glyphless.method == 1) | ||
| 506 | printf "EMPTY]" | ||
| 507 | end | ||
| 508 | if ($g->u.glyphless.method == 2) | ||
| 509 | printf "ACRO]" | ||
| 510 | end | ||
| 511 | if ($g->u.glyphless.method == 3) | ||
| 512 | printf "HEX]" | ||
| 513 | end | ||
| 514 | end | ||
| 515 | # IMAGE_GLYPH | ||
| 516 | if ($g->type == 3) | ||
| 501 | printf "IMAGE[%d]", $g->u.img_id | 517 | printf "IMAGE[%d]", $g->u.img_id |
| 502 | end | 518 | end |
| 503 | # STRETCH_GLYPH | 519 | # STRETCH_GLYPH |
| 504 | if ($g->type == 3) | 520 | if ($g->type == 4) |
| 505 | printf "STRETCH[%d+%d]", $g->u.stretch.height, $g->u.stretch.ascent | 521 | printf "STRETCH[%d+%d]", $g->u.stretch.height, $g->u.stretch.ascent |
| 506 | end | 522 | end |
| 507 | xgettype ($g->object) | 523 | xgettype ($g->object) |
| @@ -544,8 +560,8 @@ define pgx | |||
| 544 | if ($g->right_box_line_p) | 560 | if ($g->right_box_line_p) |
| 545 | printf " ]" | 561 | printf " ]" |
| 546 | end | 562 | end |
| 547 | if ($g->slice.x || $g->slice.y || $g->slice.width || $g->slice.height) | 563 | if ($g->slice.img.x || $g->slice.img.y || $g->slice.img.width || $g->slice.img.height) |
| 548 | printf " slice=%d,%d,%d,%d" ,$g->slice.x, $g->slice.y, $g->slice.width, $g->slice.height | 564 | printf " slice=%d,%d,%d,%d" ,$g->slice.img.x, $g->slice.img.y, $g->slice.img.width, $g->slice.img.height |
| 549 | end | 565 | end |
| 550 | printf "\n" | 566 | printf "\n" |
| 551 | end | 567 | end |
diff --git a/src/ChangeLog b/src/ChangeLog index 13f90d12790..2bac819c0d5 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,25 @@ | |||
| 1 | 2010-11-13 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * xdisp.c (set_cursor_from_row): Fix cursor positioning on | ||
| 4 | zero-width characters. | ||
| 5 | |||
| 6 | * .gdbinit (pgx): Adapt to latest changes in `struct glyph'. | ||
| 7 | |||
| 8 | * w32term.c (x_draw_glyphless_glyph_string_foreground): Draw the | ||
| 9 | box before drawing the glyphs inside it. | ||
| 10 | |||
| 11 | * xdisp.c (syms_of_xdisp) <glyphless-char-display>: Doc fix. | ||
| 12 | |||
| 13 | * dispextern.h (enum glyphless_display_method): Rename | ||
| 14 | GLYPHLESS_DISPLAY_HEXA_CODE to GLYPHLESS_DISPLAY_HEX_CODE. All | ||
| 15 | users changed. | ||
| 16 | |||
| 17 | * term.c (append_glyphless_glyph, produce_glyphless_glyph): Fix | ||
| 18 | comments. | ||
| 19 | (produce_glyphless_glyph): Enclose "U+nnnn" and "empty box" | ||
| 20 | whitespace in "[]", to simulate a box. Don't use uninitialized | ||
| 21 | variable `width'. | ||
| 22 | |||
| 1 | 2010-11-11 Julien Danjou <julien@danjou.info> | 23 | 2010-11-11 Julien Danjou <julien@danjou.info> |
| 2 | 24 | ||
| 3 | * xsettings.c (init_xsettings): Use already fetch atoms. | 25 | * xsettings.c (init_xsettings): Use already fetch atoms. |
diff --git a/src/dispextern.h b/src/dispextern.h index 30bd051b0ac..0786fff67cc 100644 --- a/src/dispextern.h +++ b/src/dispextern.h | |||
| @@ -371,12 +371,11 @@ struct glyph | |||
| 371 | displaying. The member `pixel_width' above is set to 1. */ | 371 | displaying. The member `pixel_width' above is set to 1. */ |
| 372 | unsigned padding_p : 1; | 372 | unsigned padding_p : 1; |
| 373 | 373 | ||
| 374 | /* 1 means the actual glyph is not available, draw a box instead. | 374 | /* 1 means the actual glyph is not available, draw using `struct |
| 375 | This can happen when a font couldn't be loaded, or a character | 375 | glyphless' below instead. This can happen when a font couldn't |
| 376 | doesn't have a glyph in a font. */ | 376 | be loaded, or a character doesn't have a glyph in a font. */ |
| 377 | unsigned glyph_not_available_p : 1; | 377 | unsigned glyph_not_available_p : 1; |
| 378 | 378 | ||
| 379 | |||
| 380 | /* Non-zero means don't display cursor here. */ | 379 | /* Non-zero means don't display cursor here. */ |
| 381 | unsigned avoid_cursor_p : 1; | 380 | unsigned avoid_cursor_p : 1; |
| 382 | 381 | ||
| @@ -1997,14 +1996,15 @@ enum line_wrap_method | |||
| 1997 | 1996 | ||
| 1998 | enum glyphless_display_method | 1997 | enum glyphless_display_method |
| 1999 | { | 1998 | { |
| 2000 | /* Display a thin (1-pixel width) space. */ | 1999 | /* Display a thin (1-pixel width) space. On a TTY, display a |
| 2000 | 1-character width space. */ | ||
| 2001 | GLYPHLESS_DISPLAY_THIN_SPACE, | 2001 | GLYPHLESS_DISPLAY_THIN_SPACE, |
| 2002 | /* Display an empty box of proper width. */ | 2002 | /* Display an empty box of proper width. */ |
| 2003 | GLYPHLESS_DISPLAY_EMPTY_BOX, | 2003 | GLYPHLESS_DISPLAY_EMPTY_BOX, |
| 2004 | /* Display an acronym string in a box. */ | 2004 | /* Display an acronym string in a box. */ |
| 2005 | GLYPHLESS_DISPLAY_ACRONYM, | 2005 | GLYPHLESS_DISPLAY_ACRONYM, |
| 2006 | /* Display a hexadecimal character code in a box. */ | 2006 | /* Display the hexadecimal code of the character in a box. */ |
| 2007 | GLYPHLESS_DISPLAY_HEXA_CODE | 2007 | GLYPHLESS_DISPLAY_HEX_CODE |
| 2008 | }; | 2008 | }; |
| 2009 | 2009 | ||
| 2010 | struct it_slice | 2010 | struct it_slice |
diff --git a/src/term.c b/src/term.c index dbbdc03f190..71df92822ac 100644 --- a/src/term.c +++ b/src/term.c | |||
| @@ -1850,9 +1850,9 @@ produce_composite_glyph (struct it *it) | |||
| 1850 | 1850 | ||
| 1851 | 1851 | ||
| 1852 | /* Append a glyph for a glyphless character to IT->glyph_row. FACE_ID | 1852 | /* Append a glyph for a glyphless character to IT->glyph_row. FACE_ID |
| 1853 | is a face ID to be used for the glyph. What actually appended are | 1853 | is a face ID to be used for the glyph. What is actually appended |
| 1854 | glyphs of type CHAR_GLYPH of which characters are in STR | 1854 | are glyphs of type CHAR_GLYPH whose characters are in STR (which |
| 1855 | (it->nglyphs bytes). */ | 1855 | comes from it->nglyphs bytes). */ |
| 1856 | 1856 | ||
| 1857 | static void | 1857 | static void |
| 1858 | append_glyphless_glyph (struct it *it, int face_id, char *str) | 1858 | append_glyphless_glyph (struct it *it, int face_id, char *str) |
| @@ -1923,7 +1923,7 @@ extern Lisp_Object Qglyphless_char; | |||
| 1923 | /* Produce glyphs for a glyphless character for iterator IT. | 1923 | /* Produce glyphs for a glyphless character for iterator IT. |
| 1924 | IT->glyphless_method specifies which method to use for displaying | 1924 | IT->glyphless_method specifies which method to use for displaying |
| 1925 | the character. See the description of enum | 1925 | the character. See the description of enum |
| 1926 | glyphless_display_method in dispextern.h for the detail. | 1926 | glyphless_display_method in dispextern.h for the details. |
| 1927 | 1927 | ||
| 1928 | FOR_NO_FONT is nonzero if and only if this is for a character that | 1928 | FOR_NO_FONT is nonzero if and only if this is for a character that |
| 1929 | is not supproted by the coding system of the terminal. ACRONYM, if | 1929 | is not supproted by the coding system of the terminal. ACRONYM, if |
| @@ -1935,11 +1935,11 @@ static void | |||
| 1935 | produce_glyphless_glyph (struct it *it, int for_no_font, Lisp_Object acronym) | 1935 | produce_glyphless_glyph (struct it *it, int for_no_font, Lisp_Object acronym) |
| 1936 | { | 1936 | { |
| 1937 | int face_id; | 1937 | int face_id; |
| 1938 | int width, len; | 1938 | int len; |
| 1939 | char buf[9], *str = " "; | 1939 | char buf[11], *str = " "; |
| 1940 | 1940 | ||
| 1941 | /* Get a face ID for the glyph by utilizing a cache (the same way as | 1941 | /* Get a face ID for the glyph by utilizing a cache (the same way as |
| 1942 | doen for `escape-glyph' in get_next_display_element). */ | 1942 | done for `escape-glyph' in get_next_display_element). */ |
| 1943 | if (it->f == last_glyphless_glyph_frame | 1943 | if (it->f == last_glyphless_glyph_frame |
| 1944 | && it->face_id == last_glyphless_glyph_face_id) | 1944 | && it->face_id == last_glyphless_glyph_face_id) |
| 1945 | { | 1945 | { |
| @@ -1956,8 +1956,8 @@ produce_glyphless_glyph (struct it *it, int for_no_font, Lisp_Object acronym) | |||
| 1956 | 1956 | ||
| 1957 | if (it->glyphless_method == GLYPHLESS_DISPLAY_THIN_SPACE) | 1957 | if (it->glyphless_method == GLYPHLESS_DISPLAY_THIN_SPACE) |
| 1958 | { | 1958 | { |
| 1959 | /* As there's no way to produce a thin space, we produce | 1959 | /* As there's no way to produce a thin space, we produce a space |
| 1960 | a space of canonical width.. */ | 1960 | of canonical width. */ |
| 1961 | len = 1; | 1961 | len = 1; |
| 1962 | } | 1962 | } |
| 1963 | else if (it->glyphless_method == GLYPHLESS_DISPLAY_EMPTY_BOX) | 1963 | else if (it->glyphless_method == GLYPHLESS_DISPLAY_EMPTY_BOX) |
| @@ -1965,8 +1965,11 @@ produce_glyphless_glyph (struct it *it, int for_no_font, Lisp_Object acronym) | |||
| 1965 | len = CHAR_WIDTH (it->c); | 1965 | len = CHAR_WIDTH (it->c); |
| 1966 | if (len == 0) | 1966 | if (len == 0) |
| 1967 | len = 1; | 1967 | len = 1; |
| 1968 | else if (width > 4) | 1968 | else if (len > 4) |
| 1969 | len = 4; | 1969 | len = 4; |
| 1970 | sprintf (buf, "[%.*s]", len, str); | ||
| 1971 | len += 2; | ||
| 1972 | str = buf; | ||
| 1970 | } | 1973 | } |
| 1971 | else | 1974 | else |
| 1972 | { | 1975 | { |
| @@ -1983,11 +1986,11 @@ produce_glyphless_glyph (struct it *it, int for_no_font, Lisp_Object acronym) | |||
| 1983 | } | 1986 | } |
| 1984 | else | 1987 | else |
| 1985 | { | 1988 | { |
| 1986 | xassert (it->glyphless_method == GLYPHLESS_DISPLAY_HEXA_CODE); | 1989 | xassert (it->glyphless_method == GLYPHLESS_DISPLAY_HEX_CODE); |
| 1987 | len = (it->c < 0x100 ? sprintf (buf, "U+%02X", it->c) | 1990 | len = (it->c < 0x100 ? sprintf (buf, "[U+%02X]", it->c) |
| 1988 | : it->c < 0x10000 ? sprintf (buf, "U+%04X", it->c) | 1991 | : it->c < 0x10000 ? sprintf (buf, "[U+%04X]", it->c) |
| 1989 | : it->c <= MAX_UNICODE_CHAR ? sprintf (buf, "U+%06X", it->c) | 1992 | : it->c <= MAX_UNICODE_CHAR ? sprintf (buf, "[U+%06X]", it->c) |
| 1990 | : sprintf (buf, "E+%06X", it->c)); | 1993 | : sprintf (buf, "[E+%06X]", it->c)); |
| 1991 | } | 1994 | } |
| 1992 | str = buf; | 1995 | str = buf; |
| 1993 | } | 1996 | } |
diff --git a/src/w32term.c b/src/w32term.c index a93bc064c39..33b60c568c0 100644 --- a/src/w32term.c +++ b/src/w32term.c | |||
| @@ -1440,7 +1440,7 @@ x_draw_glyphless_glyph_string_foreground (struct glyph_string *s) | |||
| 1440 | str = (char *) SDATA (acronym); | 1440 | str = (char *) SDATA (acronym); |
| 1441 | } | 1441 | } |
| 1442 | } | 1442 | } |
| 1443 | else if (glyph->u.glyphless.method == GLYPHLESS_DISPLAY_HEXA_CODE) | 1443 | else if (glyph->u.glyphless.method == GLYPHLESS_DISPLAY_HEX_CODE) |
| 1444 | { | 1444 | { |
| 1445 | sprintf ((char *) buf, "%0*X", | 1445 | sprintf ((char *) buf, "%0*X", |
| 1446 | glyph->u.glyphless.ch < 0x10000 ? 4 : 6, | 1446 | glyph->u.glyphless.ch < 0x10000 ? 4 : 6, |
| @@ -1448,6 +1448,11 @@ x_draw_glyphless_glyph_string_foreground (struct glyph_string *s) | |||
| 1448 | str = buf; | 1448 | str = buf; |
| 1449 | } | 1449 | } |
| 1450 | 1450 | ||
| 1451 | if (glyph->u.glyphless.method != GLYPHLESS_DISPLAY_THIN_SPACE) | ||
| 1452 | w32_draw_rectangle (s->hdc, s->gc, | ||
| 1453 | x, s->ybase - glyph->ascent, | ||
| 1454 | glyph->pixel_width - 1, | ||
| 1455 | glyph->ascent + glyph->descent - 1); | ||
| 1451 | if (str) | 1456 | if (str) |
| 1452 | { | 1457 | { |
| 1453 | struct font *font = s->font; | 1458 | struct font *font = s->font; |
| @@ -1456,7 +1461,7 @@ x_draw_glyphless_glyph_string_foreground (struct glyph_string *s) | |||
| 1456 | HFONT old_font; | 1461 | HFONT old_font; |
| 1457 | 1462 | ||
| 1458 | old_font = SelectObject (s->hdc, FONT_HANDLE (font)); | 1463 | old_font = SelectObject (s->hdc, FONT_HANDLE (font)); |
| 1459 | /* It is assured that all LEN characters in STR is ASCII. */ | 1464 | /* It is certain that all LEN characters in STR are ASCII. */ |
| 1460 | for (j = 0; j < len; j++) | 1465 | for (j = 0; j < len; j++) |
| 1461 | { | 1466 | { |
| 1462 | code = font->driver->encode_char (font, str[j]); | 1467 | code = font->driver->encode_char (font, str[j]); |
| @@ -1472,11 +1477,6 @@ x_draw_glyphless_glyph_string_foreground (struct glyph_string *s) | |||
| 1472 | with_background); | 1477 | with_background); |
| 1473 | SelectObject (s->hdc, old_font); | 1478 | SelectObject (s->hdc, old_font); |
| 1474 | } | 1479 | } |
| 1475 | if (glyph->u.glyphless.method != GLYPHLESS_DISPLAY_THIN_SPACE) | ||
| 1476 | w32_draw_rectangle (s->hdc, s->gc, | ||
| 1477 | x, s->ybase - glyph->ascent, | ||
| 1478 | glyph->pixel_width - 1, | ||
| 1479 | glyph->ascent + glyph->descent - 1); | ||
| 1480 | x += glyph->pixel_width; | 1480 | x += glyph->pixel_width; |
| 1481 | } | 1481 | } |
| 1482 | } | 1482 | } |
diff --git a/src/xdisp.c b/src/xdisp.c index 928a37a2b50..21c89088383 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -971,7 +971,7 @@ Lisp_Object Vglyphless_char_display; | |||
| 971 | Lisp_Object Qglyphless_char_display; | 971 | Lisp_Object Qglyphless_char_display; |
| 972 | 972 | ||
| 973 | /* Method symbols for Vglyphless_char_display. */ | 973 | /* Method symbols for Vglyphless_char_display. */ |
| 974 | static Lisp_Object Qhexa_code, Qempty_box, Qthin_space, Qzero_width; | 974 | static Lisp_Object Qhex_code, Qempty_box, Qthin_space, Qzero_width; |
| 975 | 975 | ||
| 976 | /* Default pixel width of `thin-space' display method. */ | 976 | /* Default pixel width of `thin-space' display method. */ |
| 977 | #define THIN_SPACE_WIDTH 1 | 977 | #define THIN_SPACE_WIDTH 1 |
| @@ -5813,8 +5813,8 @@ lookup_glyphless_char_display (int c, struct it *it) | |||
| 5813 | it->glyphless_method = GLYPHLESS_DISPLAY_THIN_SPACE; | 5813 | it->glyphless_method = GLYPHLESS_DISPLAY_THIN_SPACE; |
| 5814 | else if (EQ (glyphless_method, Qempty_box)) | 5814 | else if (EQ (glyphless_method, Qempty_box)) |
| 5815 | it->glyphless_method = GLYPHLESS_DISPLAY_EMPTY_BOX; | 5815 | it->glyphless_method = GLYPHLESS_DISPLAY_EMPTY_BOX; |
| 5816 | else if (EQ (glyphless_method, Qhexa_code)) | 5816 | else if (EQ (glyphless_method, Qhex_code)) |
| 5817 | it->glyphless_method = GLYPHLESS_DISPLAY_HEXA_CODE; | 5817 | it->glyphless_method = GLYPHLESS_DISPLAY_HEX_CODE; |
| 5818 | else if (STRINGP (glyphless_method)) | 5818 | else if (STRINGP (glyphless_method)) |
| 5819 | it->glyphless_method = GLYPHLESS_DISPLAY_ACRONYM; | 5819 | it->glyphless_method = GLYPHLESS_DISPLAY_ACRONYM; |
| 5820 | else | 5820 | else |
| @@ -12871,10 +12871,10 @@ set_cursor_from_row (struct window *w, struct glyph_row *row, | |||
| 12871 | || (row->truncated_on_left_p && pt_old < bpos_min) | 12871 | || (row->truncated_on_left_p && pt_old < bpos_min) |
| 12872 | || (row->truncated_on_right_p && pt_old > bpos_max) | 12872 | || (row->truncated_on_right_p && pt_old > bpos_max) |
| 12873 | /* Zero-width characters produce no glyphs. */ | 12873 | /* Zero-width characters produce no glyphs. */ |
| 12874 | || ((row->reversed_p | 12874 | || (!string_seen |
| 12875 | ? glyph_after > glyphs_end | 12875 | && (row->reversed_p |
| 12876 | : glyph_after < glyphs_end) | 12876 | ? glyph_after > glyphs_end |
| 12877 | && eabs (glyph_after - glyph_before) == 1)) | 12877 | : glyph_after < glyphs_end))) |
| 12878 | { | 12878 | { |
| 12879 | cursor = glyph_after; | 12879 | cursor = glyph_after; |
| 12880 | x = -1; | 12880 | x = -1; |
| @@ -22292,7 +22292,7 @@ calc_line_height_property (struct it *it, Lisp_Object val, struct font *font, | |||
| 22292 | and only if this is for a character for which no font was found. | 22292 | and only if this is for a character for which no font was found. |
| 22293 | 22293 | ||
| 22294 | If the display method (it->glyphless_method) is | 22294 | If the display method (it->glyphless_method) is |
| 22295 | GLYPHLESS_DISPLAY_ACRONYM or GLYPHLESS_DISPLAY_HEXA_CODE, LEN is a | 22295 | GLYPHLESS_DISPLAY_ACRONYM or GLYPHLESS_DISPLAY_HEX_CODE, LEN is a |
| 22296 | length of the acronym or the hexadecimal string, UPPER_XOFF and | 22296 | length of the acronym or the hexadecimal string, UPPER_XOFF and |
| 22297 | UPPER_YOFF are pixel offsets for the upper part of the string, | 22297 | UPPER_YOFF are pixel offsets for the upper part of the string, |
| 22298 | LOWER_XOFF and LOWER_YOFF are for the lower part. | 22298 | LOWER_XOFF and LOWER_YOFF are for the lower part. |
| @@ -22441,7 +22441,7 @@ produce_glyphless_glyph (struct it *it, int for_no_font, Lisp_Object acronym) | |||
| 22441 | } | 22441 | } |
| 22442 | else | 22442 | else |
| 22443 | { | 22443 | { |
| 22444 | xassert (it->glyphless_method == GLYPHLESS_DISPLAY_HEXA_CODE); | 22444 | xassert (it->glyphless_method == GLYPHLESS_DISPLAY_HEX_CODE); |
| 22445 | sprintf (buf, "%0*X", it->c < 0x10000 ? 4 : 6, it->c); | 22445 | sprintf (buf, "%0*X", it->c < 0x10000 ? 4 : 6, it->c); |
| 22446 | str = buf; | 22446 | str = buf; |
| 22447 | } | 22447 | } |
| @@ -27057,7 +27057,7 @@ cursor shapes. */); | |||
| 27057 | hourglass_shown_p = 0; | 27057 | hourglass_shown_p = 0; |
| 27058 | 27058 | ||
| 27059 | DEFSYM (Qglyphless_char, "glyphless-char"); | 27059 | DEFSYM (Qglyphless_char, "glyphless-char"); |
| 27060 | DEFSYM (Qhexa_code, "hexa-code"); | 27060 | DEFSYM (Qhex_code, "hex-code"); |
| 27061 | DEFSYM (Qempty_box, "empty-box"); | 27061 | DEFSYM (Qempty_box, "empty-box"); |
| 27062 | DEFSYM (Qthin_space, "thin-space"); | 27062 | DEFSYM (Qthin_space, "thin-space"); |
| 27063 | DEFSYM (Qzero_width, "zero-width"); | 27063 | DEFSYM (Qzero_width, "zero-width"); |
| @@ -27073,13 +27073,13 @@ cursor shapes. */); | |||
| 27073 | doc: /* Char-table to control displaying of glyphless characters. | 27073 | doc: /* Char-table to control displaying of glyphless characters. |
| 27074 | Each element, if non-nil, is an ASCII acronym string (displayed in a box) | 27074 | Each element, if non-nil, is an ASCII acronym string (displayed in a box) |
| 27075 | or one of these symbols: | 27075 | or one of these symbols: |
| 27076 | hexa-code: display with hexadecimal character code in a box | 27076 | hex-code: display the hexadecimal code of a character in a box |
| 27077 | empty-box: display with an empty box | 27077 | empty-box: display as an empty box |
| 27078 | thin-space: display with 1-pixel width space | 27078 | thin-space: display as 1-pixel width space |
| 27079 | zero-width: don't display | 27079 | zero-width: don't display |
| 27080 | 27080 | ||
| 27081 | It has one extra slot to control the display of a character for which | 27081 | It has one extra slot to control the display of a character for which |
| 27082 | no font is found. The value of the slot is `hexa-code' or `empty-box'. | 27082 | no font is found. The value of the slot is `hex-code' or `empty-box'. |
| 27083 | The default is `empty-box'. */); | 27083 | The default is `empty-box'. */); |
| 27084 | Vglyphless_char_display = Fmake_char_table (Qglyphless_char_display, Qnil); | 27084 | Vglyphless_char_display = Fmake_char_table (Qglyphless_char_display, Qnil); |
| 27085 | Fset_char_table_extra_slot (Vglyphless_char_display, make_number (0), | 27085 | Fset_char_table_extra_slot (Vglyphless_char_display, make_number (0), |
diff --git a/src/xterm.c b/src/xterm.c index e58d072e59f..f8b7b2a630c 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -1369,7 +1369,7 @@ x_draw_glyphless_glyph_string_foreground (struct glyph_string *s) | |||
| 1369 | str = (char *) SDATA (acronym); | 1369 | str = (char *) SDATA (acronym); |
| 1370 | } | 1370 | } |
| 1371 | } | 1371 | } |
| 1372 | else if (glyph->u.glyphless.method == GLYPHLESS_DISPLAY_HEXA_CODE) | 1372 | else if (glyph->u.glyphless.method == GLYPHLESS_DISPLAY_HEX_CODE) |
| 1373 | { | 1373 | { |
| 1374 | sprintf ((char *) buf, "%0*X", | 1374 | sprintf ((char *) buf, "%0*X", |
| 1375 | glyph->u.glyphless.ch < 0x10000 ? 4 : 6, | 1375 | glyph->u.glyphless.ch < 0x10000 ? 4 : 6, |