- Don't install Install IDS-HZK{01..12}.txt.
authorMORIOKA Tomohiko <tomo.git@chise.org>
Thu, 3 Sep 2020 12:31:02 +0000 (21:31 +0900)
committerMORIOKA Tomohiko <tomo.git@chise.org>
Thu, 3 Sep 2020 12:31:02 +0000 (21:31 +0900)
- Use `functional-ideographic-structure-to-apparent-structure' to
  generate `ideographic-structure@apparent' from
  `ideographic-structure'.

install-ids.el

index 1e5d05d..eb02062 100644 (file)
 (install-ids-read-file "IDS-CBETA.txt" load-ids-simplify t)
 
 (install-ids-read-file "IDS-CDP.txt" load-ids-simplify t)
-(let ((i 1))
-  (while (<= i 12)
-    (install-ids-read-file (format "IDS-HZK%02d.txt" i)
-                          load-ids-simplify t)
-    (setq i (1+ i))))
-
-(princ "Updating char-feature `ideographic-structure'...")
-(save-char-attribute-table 'ideographic-structure)
-(save-char-attribute-table 'ideographic-structure@apparent)
-(princ "done.\n")
+;; (let ((i 1))
+;;   (while (<= i 12)
+;;     (install-ids-read-file (format "IDS-HZK%02d.txt" i)
+;;                            load-ids-simplify t)
+;;     (setq i (1+ i))))
 
-(princ "Updating char-feature `ideographic-products'...")
+(princ "Generating apparent-structure...")
 (let* ((feature-dir
        (expand-file-name
         "feature"
          "character" chise-system-db-directory)))
        (p-file
        (expand-file-name "ideographic-products" feature-dir))
-       old-p-file)
+       old-p-file
+       a-str)
   (when (file-exists-p p-file)
     (setq old-p-file (make-temp-name p-file))
     (rename-file p-file old-p-file))
+  (ids-update-index 'in-memory)
+
+  (map-char-attribute
+   (lambda (c v)
+     (unless (setq a-str (get-char-attribute c 'ideographic-structure@apparent))
+       (when (setq a-str (functional-ideographic-structure-to-apparent-structure v))
+        (put-char-attribute c 'ideographic-structure@apparent
+                            (ideographic-structure-compact a-str))))
+     nil)
+   'ideographic-structure)
+  (princ "done.\n")
+
+  (princ "Updating char-feature `ideographic-structure'...")
+  (save-char-attribute-table 'ideographic-structure)
+  (save-char-attribute-table 'ideographic-structure@apparent)
+  (princ "done.\n")
+
+  (princ "Updating char-feature `ideographic-products'...")
   (ids-update-index)
   (when old-p-file
     (delete-file old-p-file)))