help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Browsing Unicode Symbols


From: Florian Beck
Subject: Re: Browsing Unicode Symbols
Date: Wed, 09 Jul 2008 16:32:34 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

Peter Dyballa <address@hidden> writes:

>> To see how a specific font renders all characters, dolist the
>> characters
>> defined in the the unicode standard (/admin/unidata/UnicodeData.txt in
>> the emacs sources).
>
> How do *you* see these? The file is just a description of Unicode
> characters in US-ASCII

Well, yes, but you can use it to get the data you need.

I do it with this function:

(defun test-unicode (&optional font)
  (interactive)
  (let (unidata)
    (with-temp-buffer
      (insert-file-contents "/home/fb/src/emacs/admin/unidata/UnicodeData.txt")
      (goto-char (point-min))
      (while (re-search-forward "^\\([[:alnum:]]+\\);\\(.*?\\);" nil t)
        (let* ((code (string-to-number (match-string 1) 16))
               (char (char-to-string code)))
          ;; Symbols the specified font cannot handle may still be
          ;; displayed in another font.
          (if font (setq char (propertize char 'face `(:family ,(format "%s" 
font)))))
          (add-to-list 'unidata
                       (cons code
                             (concat (format "%6x" code) "\t" char "\t" 
(downcase (match-string 2))))))))
    (setq unidata (reverse unidata))
    (switch-to-buffer "*Unicode Test*")
    (erase-buffer)
    (let (done-blocks)
      (dolist (entry unidata)
        ;; group by range
        (let ((ublock (unicode-block (car entry))))
          (unless (member ublock done-blocks)
            (add-to-list 'done-blocks ublock)
            (insert "\n\n" ublock "\n")))
        (insert (cdr entry) "\n")))))

Either comment out the let block that groups by range or use the
following (I have not looked into how describe-char handles this):

(defun unicode-block (char)
  (let ((list unicode-blocks)
        block-name)
    (dolist (i list)
      (if (and (>= char (car i))
               (<= char (cadr i)))
          (setq block-name (nth 2 i))))
    block-name))

(defvar unicode-blocks
  '((?\x0000 ?\x007F "Basic Latin")
    (?\x0080 ?\x00FF "Latin-1 Supplement")
    (?\x0100 ?\x017F "Latin Extended-A")
    (?\x0180 ?\x024F "Latin Extended-B")
    (?\x0250 ?\x02AF "IPA Extensions")
    (?\x02B0 ?\x02FF "Spacing Modifier Letters")
    (?\x0300 ?\x036F "Combining Diacritical Marks")
    (?\x0370 ?\x03FF "Greek and Coptic")
    (?\x0400 ?\x04FF "Cyrillic")
    (?\x0500 ?\x052F "Cyrillic Supplement")
    (?\x0530 ?\x058F "Armenian")
    (?\x0590 ?\x05FF "Hebrew")
    (?\x0600 ?\x06FF "Arabic")
    (?\x0700 ?\x074F "Syriac")
    (?\x0750 ?\x077F "Arabic Supplement")
    (?\x0780 ?\x07BF "Thaana")
    (?\x07C0 ?\x07FF "NKo")
    (?\x0900 ?\x097F "Devanagari")
    (?\x0980 ?\x09FF "Bengali")
    (?\x0A00 ?\x0A7F "Gurmukhi")
    (?\x0A80 ?\x0AFF "Gujarati")
    (?\x0B00 ?\x0B7F "Oriya")
    (?\x0B80 ?\x0BFF "Tamil")
    (?\x0C00 ?\x0C7F "Telugu")
    (?\x0C80 ?\x0CFF "Kannada")
    (?\x0D00 ?\x0D7F "Malayalam")
    (?\x0D80 ?\x0DFF "Sinhala")
    (?\x0E00 ?\x0E7F "Thai")
    (?\x0E80 ?\x0EFF "Lao")
    (?\x0F00 ?\x0FFF "Tibetan")
    (?\x1000 ?\x109F "Myanmar")
    (?\x10A0 ?\x10FF "Georgian")
    (?\x1100 ?\x11FF "Hangul Jamo")
    (?\x1200 ?\x137F "Ethiopic")
    (?\x1380 ?\x139F "Ethiopic Supplement")
    (?\x13A0 ?\x13FF "Cherokee")
    (?\x1400 ?\x167F "Unified Canadian Aboriginal Syllabics")
    (?\x1680 ?\x169F "Ogham")
    (?\x16A0 ?\x16FF "Runic")
    (?\x1700 ?\x171F "Tagalog")
    (?\x1720 ?\x173F "Hanunoo")
    (?\x1740 ?\x175F "Buhid")
    (?\x1760 ?\x177F "Tagbanwa")
    (?\x1780 ?\x17FF "Khmer")
    (?\x1800 ?\x18AF "Mongolian")
    (?\x1900 ?\x194F "Limbu")
    (?\x1950 ?\x197F "Tai Le")
    (?\x1980 ?\x19DF "New Tai Lue")
    (?\x19E0 ?\x19FF "Khmer Symbols")
    (?\x1A00 ?\x1A1F "Buginese")
    (?\x1B00 ?\x1B7F "Balinese")
    (?\x1B80 ?\x1BBF "Sundanese")
    (?\x1C00 ?\x1C4F "Lepcha")
    (?\x1C50 ?\x1C7F "Ol Chiki")
    (?\x1D00 ?\x1D7F "Phonetic Extensions")
    (?\x1D80 ?\x1DBF "Phonetic Extensions Supplement")
    (?\x1DC0 ?\x1DFF "Combining Diacritical Marks Supplement")
    (?\x1E00 ?\x1EFF "Latin Extended Additional")
    (?\x1F00 ?\x1FFF "Greek Extended")
    (?\x2000 ?\x206F "General Punctuation")
    (?\x2070 ?\x209F "Superscripts and Subscripts")
    (?\x20A0 ?\x20CF "Currency Symbols")
    (?\x20D0 ?\x20FF "Combining Diacritical Marks for Symbols")
    (?\x2100 ?\x214F "Letterlike Symbols")
    (?\x2150 ?\x218F "Number Forms")
    (?\x2190 ?\x21FF "Arrows")
    (?\x2200 ?\x22FF "Mathematical Operators")
    (?\x2300 ?\x23FF "Miscellaneous Technical")
    (?\x2400 ?\x243F "Control Pictures")
    (?\x2440 ?\x245F "Optical Character Recognition")
    (?\x2460 ?\x24FF "Enclosed Alphanumerics")
    (?\x2500 ?\x257F "Box Drawing")
    (?\x2580 ?\x259F "Block Elements")
    (?\x25A0 ?\x25FF "Geometric Shapes")
    (?\x2600 ?\x26FF "Miscellaneous Symbols")
    (?\x2700 ?\x27BF "Dingbats")
    (?\x27C0 ?\x27EF "Miscellaneous Mathematical Symbols-A")
    (?\x27F0 ?\x27FF "Supplemental Arrows-A")
    (?\x2800 ?\x28FF "Braille Patterns")
    (?\x2900 ?\x297F "Supplemental Arrows-B")
    (?\x2980 ?\x29FF "Miscellaneous Mathematical Symbols-B")
    (?\x2A00 ?\x2AFF "Supplemental Mathematical Operators")
    (?\x2B00 ?\x2BFF "Miscellaneous Symbols and Arrows")
    (?\x2C00 ?\x2C5F "Glagolitic")
    (?\x2C60 ?\x2C7F "Latin Extended-C")
    (?\x2C80 ?\x2CFF "Coptic")
    (?\x2D00 ?\x2D2F "Georgian Supplement")
    (?\x2D30 ?\x2D7F "Tifinagh")
    (?\x2D80 ?\x2DDF "Ethiopic Extended")
    (?\x2DE0 ?\x2DFF "Cyrillic Extended-A")
    (?\x2E00 ?\x2E7F "Supplemental Punctuation")
    (?\x2E80 ?\x2EFF "CJK Radicals Supplement")
    (?\x2F00 ?\x2FDF "Kangxi Radicals")
    (?\x2FF0 ?\x2FFF "Ideographic Description Characters")
    (?\x3000 ?\x303F "CJK Symbols and Punctuation")
    (?\x3040 ?\x309F "Hiragana")
    (?\x30A0 ?\x30FF "Katakana")
    (?\x3100 ?\x312F "Bopomofo")
    (?\x3130 ?\x318F "Hangul Compatibility Jamo")
    (?\x3190 ?\x319F "Kanbun")
    (?\x31A0 ?\x31BF "Bopomofo Extended")
    (?\x31C0 ?\x31EF "CJK Strokes")
    (?\x31F0 ?\x31FF "Katakana Phonetic Extensions")
    (?\x3200 ?\x32FF "Enclosed CJK Letters and Months")
    (?\x3300 ?\x33FF "CJK Compatibility")
    (?\x3400 ?\x4DBF "CJK Unified Ideographs Extension A")
    (?\x4DC0 ?\x4DFF "Yijing Hexagram Symbols")
    (?\x4E00 ?\x9FFF "CJK Unified Ideographs")
    (?\xA000 ?\xA48F "Yi Syllables")
    (?\xA490 ?\xA4CF "Yi Radicals")
    (?\xA500 ?\xA63F "Vai")
    (?\xA640 ?\xA69F "Cyrillic Extended-B")
    (?\xA700 ?\xA71F "Modifier Tone Letters")
    (?\xA720 ?\xA7FF "Latin Extended-D")
    (?\xA800 ?\xA82F "Syloti Nagri")
    (?\xA840 ?\xA87F "Phags-pa")
    (?\xA880 ?\xA8DF "Saurashtra")
    (?\xA900 ?\xA92F "Kayah Li")
    (?\xA930 ?\xA95F "Rejang")
    (?\xAA00 ?\xAA5F "Cham")
    (?\xAC00 ?\xD7AF "Hangul Syllables")
    (?\xD800 ?\xDB7F "High Surrogates")
    (?\xDB80 ?\xDBFF "High Private Use Surrogates")
    (?\xDC00 ?\xDFFF "Low Surrogates")
    (?\xE000 ?\xF8FF "Private Use Area")
    (?\xF900 ?\xFAFF "CJK Compatibility Ideographs")
    (?\xFB00 ?\xFB4F "Alphabetic Presentation Forms")
    (?\xFB50 ?\xFDFF "Arabic Presentation Forms-A")
    (?\xFE00 ?\xFE0F "Variation Selectors")
    (?\xFE10 ?\xFE1F "Vertical Forms")
    (?\xFE20 ?\xFE2F "Combining Half Marks")
    (?\xFE30 ?\xFE4F "CJK Compatibility Forms")
    (?\xFE50 ?\xFE6F "Small Form Variants")
    (?\xFE70 ?\xFEFF "Arabic Presentation Forms-B")
    (?\xFF00 ?\xFFEF "Halfwidth and Fullwidth Forms")
    (?\xFFF0 ?\xFFFF "Specials")
    (?\x10000 ?\x1007F "Linear B Syllabary")
    (?\x10080 ?\x100FF "Linear B Ideograms")
    (?\x10100 ?\x1013F "Aegean Numbers")
    (?\x10140 ?\x1018F "Ancient Greek Numbers")
    (?\x10190 ?\x101CF "Ancient Symbols")
    (?\x101D0 ?\x101FF "Phaistos Disc")
    (?\x10280 ?\x1029F "Lycian")
    (?\x102A0 ?\x102DF "Carian")
    (?\x10300 ?\x1032F "Old Italic")
    (?\x10330 ?\x1034F "Gothic")
    (?\x10380 ?\x1039F "Ugaritic")
    (?\x103A0 ?\x103DF "Old Persian")
    (?\x10400 ?\x1044F "Deseret")
    (?\x10450 ?\x1047F "Shavian")
    (?\x10480 ?\x104AF "Osmanya")
    (?\x10800 ?\x1083F "Cypriot Syllabary")
    (?\x10900 ?\x1091F "Phoenician")
    (?\x10920 ?\x1093F "Lydian")
    (?\x10A00 ?\x10A5F "Kharoshthi")
    (?\x12000 ?\x123FF "Cuneiform")
    (?\x12400 ?\x1247F "Cuneiform Numbers and Punctuation")
    (?\x1D000 ?\x1D0FF "Byzantine Musical Symbols")
    (?\x1D100 ?\x1D1FF "Musical Symbols")
    (?\x1D200 ?\x1D24F "Ancient Greek Musical Notation")
    (?\x1D300 ?\x1D35F "Tai Xuan Jing Symbols")
    (?\x1D360 ?\x1D37F "Counting Rod Numerals")
    (?\x1D400 ?\x1D7FF "Mathematical Alphanumeric Symbols")
    (?\x1F000 ?\x1F02F "Mahjong Tiles")
    (?\x1F030 ?\x1F09F "Domino Tiles")
    (?\x20000 ?\x2A6DF "CJK Unified Ideographs Extension B")
    (?\x2F800 ?\x2FA1F "CJK Compatibility Ideographs Supplement")
    (?\xE0000 ?\xE007F "Tags")
    (?\xE0100 ?\xE01EF "Variation Selectors Supplement")
    (?\xF0000 ?\xFFFFF "Supplementary Private Use Area-A")
    (?\x100000 ?\x10FFFF "Supplementary Private Use Area-B")))



-- 
Florian Beck


reply via email to

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