fallback fonts adopt ribbi formatting

main
Matthew Butterick 6 years ago
parent f9444c7cbb
commit 7330d81763

@ -0,0 +1,9 @@
#lang quadwriter/markdown
Keycap digits & flags don't work because in Noto Emoji, they are encoded using older PUA codepoints rather than the Unicode (Noto Emoji has not been updated in 4 yrs)
󾠬 󾠷 󾠮 󾠯 󾠰 󾠱 󾠲 󾠳 󾠴 󾠵 󾠶 
󾓥󾓦󾓧󾓨󾓩󾓪󾓫󾓬󾓭
🀄 🃏 🅰 🅱 🅾 🅿 🆎 🆑 🆒 🆓 🆔 🆕 🆖 🆗 🆘 🆙 🆚 🇦 🇧 🇨 🇩 🇪 🇫 🇬 🇭 🇮 🇯 🇰 🇱 🇲 🇳 🇴 🇵 🇶 🇷 🇸 🇹 🇺 🇻 🇼 🇽 🇾 🇿 🈁 🈂 🈚 🈯 🈲 🈳 🈴 🈵 🈶 🈷 🉑 🌀 🌁 🌂 🌃 🌄 🌅 🌆 🌇 🌈 🌉 🌊 🌋 🌌 🌏 🌑 🌓 🌔 🌕 🌙 🌛 🌟 🌠 🌰 🌱 🌴 🌵 🌷 🌸 🌹 🌺 🌻 🌼 🌽 🌾 🌿 🍀 🍁 🍂 🍃 🍄 🍅 🍆 🍇 🍈 🍉 🍊 🍌 🍍 🍎 🍏 🍑 🍒 🍓 🍔 🍕 🍖 🍗 🍘 🍙 🍚 🍛 🍜 🍝 🍞 🍟 🍠 🍡 🍢 🍣 🍤 🍥 🍦 🍧 🍨 🍩 🍪 🍫 🍬 🍭 🍮 🍯 🍰 🍱 🍲 🍳 🍴 🍵 🍶 🍷 🍸 🍹 🍺 🍻 🎀 🎁 🎂 🎃 🎄 🎅 🎆 🎇 🎈 🎉 🎊 🎋 🎌 🎍 🎎 🎏 🎐 🎑 🎒 🎓 🎠 🎡 🎢 🎣 🎤 🎥 🎦 🎧 🎨 🎩 🎪 🎫 🎬 🎭 🎮 🎯 🎰 🎱 🎲 🎳 🎴 🎵 🎶 🎷 🎸 🎹 🎺 🎻 🎼 🎽 🎾 🎿 🏀 🏁 🏂 🏃 🏄 🏆 🏈 🏊 🏠 🏡 🏢 🏣 🏥 🏦 🏧 🏨 🏩 🏪 🏫 🏬 🏭 🏮 🏯 🏰 🐌 🐍 🐎 🐑 🐒 🐔 🐗 🐘 🐙 🐚 🐛 🐜 🐝 🐞 🐟 🐠 🐡 🐢 🐣 🐤 🐥 🐦 🐧 🐨 🐩 🐫 🐬 🐭 🐮 🐯 🐰 🐱 🐲 🐳 🐴 🐵 🐶 🐷 🐸 🐹 🐺 🐻 🐼 🐽 🐾 👀 👂 👃 👄 👅 👆 👇 👈 👉 👊 👋 👌 👍 👎 👏 👐 👑 👒 👓 👔 👕 👖 👗 👘 👙 👚 👛 👜 👝 👞 👟 👠 👡 👢 👣 👤 👦 👧 👨 👩 👪 👫 👮 👯 👰 👴 👵 👶 👷 👸 👹 👺 👻 👼 👽 👾 👿 💀 💁 💂 💃 💄 💅 💆 💇 💈 💉 💊 💋 💌 💍 💎 💏 💐 💑 💒 💓 💔 💕 💖 💗 💘 💙 💚 💛 💜 💝 💞 💟 💠 💡 💢 💣 💤 💥 💦 💧 💨 💩 💪 💫 💬 💮 💯 💰 💱 💲 💳 💴 💵 💸 💹 💺 💻 💼 💽 💾 💿 📀 📁 📂 📃 📄 📅 📆 📇 📈 📉 📊 📋 📌 📍 📎 📏 📐 📑 📒 📓 📔 📕 📖 📗 📘 📙 📚 📛 📜 📝 📞 📟 📠 📡 📢 📣 📤 📥 📦 📧 📨 📩 📪 📫 📮 📰 📱 📲 📳 📴 📶 📷 📹 📺 📻 📼 🔃 🔊 🔋 🔌 🔍 🔎 🔏 🔐 🔑 🔒 🔓 🔔 🔖 🔗 🔘 🔙 🔚 🔛 🔜 🔝 🔞 🔟 🔠 🔡 🔢 🔣 🔤 🔥 🔦 🔧 🔨 🔩 🔪 🔫 🔮 🔯 🔰 🔱 🔲 🔳 🔴 🔵 🔶 🔷 🔸 🔹 🔺 🔻 🔼 🔽 🕐 🕑 🕒 🕓 🕔 🕕 🕖 🕗 🕘 🕙 🕚 🕛 🗻 🗼 🗽 🗾 🗿 😁 😂 😃 😄 😅 😆 😉 😊 😋 😌 😍 😏 😒 😓 😔 😖 😘 😚 😜 😝 😞 😠 😡 😢 😣 😤 😥 😨 😩 😪 😫 😭 😰 😱 😲 😳 😵 😷 😸 😹 😺 😻 😼 😽 😾 😿 🙀 🙅 🙆 🙇 🙈 🙉 🙊 🙋 🙌 🙍 🙎 🙏 🚀 🚃 🚄 🚅 🚇 🚉 🚌 🚏 🚑 🚒 🚓 🚕 🚗 🚙 🚚 🚢 🚤 🚥 🚧 🚨 🚩 🚪 🚫 🚬 🚭 🚲 🚶 🚹 🚺 🚻 🚼 🚽 🚾 🛀 🈸 🈹 🈺 🉐 🏇 🏉 🏤 💭 💶 💷 📬 📭 📯 📵 🚠 🚡 🚣 🚦 🚮 🚯 🚰 🚱 🚳 🚴 🚵 🚷 🚸 🚿 🛁 🛂 🛃 🛄 🛅 🌍 🌎 🌚 🌜 🌝 🌞 🍋 🍼 🐊 🐋 🐏 👬 👭 🔬 🔭 🕜 🕝 🕞 🕟 😎 🚊 🚋 🚍 🚎 🚛 🚜 🚝 🚞 🚟 🌐 🌒 🌖 🌗 🌘 🌲 🌳 🍐 🐀 🐁 🐂 🐃 🐄 🐅 🐆 🐇 🐈 🐉 🐐 🐓 🐕 🐖 👥 👱 👲 👳 🔀 🔁 🔂 🔄 🔅 🔆 🔇 🔈 🔉 🔕 🕠 🕡 🕢 🕣 🕤 🕥 🕦 🕧 😇 😈 😐 😶 🚆 🚈 🚐 🚔 🚖 😛 😟 😬 😮 😯 😀 😑 😕 😗 😙 😦 😧 😴 🚁 🚂

@ -0,0 +1,3 @@
#lang quadwriter/markdown
ǰ

@ -57,7 +57,7 @@
(define handle-fallback
(let ([font-cache (make-hash)]
[gid-cache (make-hash)])
(λ (missing-glyph-action str attrs fallback-font emoji-font)
(λ (missing-glyph-action str attrs fallback-font-family emoji-font-family font-path-resolver)
(match missing-glyph-action
;; #false = no op
[#false (list (cons attrs str))]
@ -83,17 +83,19 @@
attrs]
[(eq? action 'error)
(raise-argument-error 'quad (format "glyph that exists in font ~a" (path->string font-path)) str)]
[else (define h (hash-copy attrs))
(hash-set! h 'font-path (if (eq? fallback-val 'emoji)
emoji-font
fallback-font))
h]))
[else (define new-attrs (hash-copy attrs))
(hash-set! new-attrs 'font-family (if (eq? fallback-val 'emoji)
emoji-font-family
fallback-font-family))
(font-path-resolver new-attrs)
new-attrs]))
(cons maybe-fallback-attrs str))]))))
(define (atomize qx #:attrs-proc [attrs-proc values]
#:fallback [fallback-font #f]
#:emoji [emoji-font #f])
#:fallback [fallback-font-family #f]
#:emoji [emoji-font-family #f]
#:font-path-resolver [font-path-resolver values])
;; atomize a quad by reducing it to the smallest indivisible formatting units.
;; which are multi-character quads with the same formatting.
(define missing-glyph-action (current-missing-glyph-action))
@ -127,7 +129,7 @@
(match elem
[(? string? str)
(for/list ([attrstr (in-list
(handle-fallback missing-glyph-action str next-attrs fallback-font emoji-font))])
(handle-fallback missing-glyph-action str next-attrs fallback-font-family emoji-font-family font-path-resolver))])
(match-define (cons attrs str) attrstr)
(apply x-constructor attrs (list str) x-tail))]
[_ (loop elem next-attrs next-key)])))]

File diff suppressed because it is too large Load Diff

@ -596,8 +596,9 @@
(setup-font-path-table! pdf-path)
(parameterize ([current-missing-glyph-action 'fallback])
(time-name atomize (atomize qx #:attrs-proc handle-cascading-attrs
#:fallback (hash-ref font-paths (cons "default-fallback" 'r) #f)
#:emoji (hash-ref font-paths (cons "default-emoji" 'r) #f))))))
#:fallback "default-fallback"
#:emoji "default-emoji"
#:font-path-resolver resolve-font-path)))))
;; page size can be specified by name, or measurements.
;; explicit measurements from page-height and page-width supersede those from page-size.

Loading…
Cancel
Save