1#include "mupdf/fitz.h"
2#include "mupdf/ucdn.h"
3
4#include <string.h>
5
6/*
7 Base 14 PDF fonts from URW.
8 Noto fonts from Google.
9 Source Han Serif from Adobe for CJK.
10 DroidSansFallback from Android for CJK.
11 Charis SIL from SIL.
12
13 Define TOFU to only include the Base14 and CJK fonts.
14
15 Define TOFU_CJK_LANG to skip Source Han Serif per-language fonts.
16 Define TOFU_CJK_EXT to skip DroidSansFallbackFull (and the above).
17 Define TOFU_CJK to skip DroidSansFallback (and the above).
18
19 Define TOFU_NOTO to skip ALL non-CJK noto fonts.
20 Define TOFU_SYMBOL to skip symbol fonts.
21 Define TOFU_EMOJI to skip emoji/extended symbol font.
22
23 Define TOFU_SIL to skip the SIL fonts (warning: makes EPUB documents ugly).
24 Define TOFU_BASE14 to skip the Base 14 fonts (warning: makes PDF unusable).
25*/
26
27#ifdef NOTO_SMALL
28#define TOFU_CJK_EXT
29#define TOFU_SYMBOL
30#define TOFU_EMOJI
31#define TOFU_SIL
32#endif
33
34#ifdef NO_CJK
35#define TOFU_CJK
36#endif
37
38#ifdef TOFU
39#define TOFU_NOTO
40#define TOFU_SIL
41#endif
42
43#ifdef TOFU_NOTO
44#define TOFU_SYMBOL
45#define TOFU_EMOJI
46#endif
47
48/* This historic script has an unusually large font (2MB), so we skip it by default. */
49#ifndef NOTO_TANGUT
50#define NOTO_TANGUT 0
51#endif
52
53#ifdef HAVE_OBJCOPY
54#define RETURN(FORGE,NAME) \
55 do { \
56 extern unsigned char _binary_resources_fonts_##FORGE##_##NAME##_start; \
57 extern unsigned char _binary_resources_fonts_##FORGE##_##NAME##_end; \
58 return *size = \
59 &_binary_resources_fonts_##FORGE##_##NAME##_end - \
60 &_binary_resources_fonts_##FORGE##_##NAME##_start, \
61 &_binary_resources_fonts_##FORGE##_##NAME##_start; \
62 } while (0)
63#else
64#define RETURN(FORGE,NAME) \
65 do { \
66 extern unsigned char _binary_##NAME[]; \
67 extern unsigned int _binary_##NAME##_size; \
68 return *size = _binary_##NAME##_size, _binary_##NAME; \
69 } while (0)
70#endif
71
72/*
73 Search the builtin base14 fonts for a match.
74 Whether a given font is present or not will depend on the
75 configuration in which MuPDF is built.
76
77 name: The name of the font desired.
78
79 len: Pointer to a place to receive the length of the discovered
80 font buffer.
81
82 Returns a pointer to the font file data, or NULL if not present.
83*/
84const unsigned char *
85fz_lookup_base14_font(fz_context *ctx, const char *name, int *size)
86{
87#ifndef TOFU_BASE14
88 if (!strcmp(name, "Courier")) RETURN(urw,NimbusMonoPS_Regular_cff);
89 if (!strcmp(name, "Courier-Oblique")) RETURN(urw,NimbusMonoPS_Italic_cff);
90 if (!strcmp(name, "Courier-Bold")) RETURN(urw,NimbusMonoPS_Bold_cff);
91 if (!strcmp(name, "Courier-BoldOblique")) RETURN(urw,NimbusMonoPS_BoldItalic_cff);
92 if (!strcmp(name, "Helvetica")) RETURN(urw,NimbusSans_Regular_cff);
93 if (!strcmp(name, "Helvetica-Oblique")) RETURN(urw,NimbusSans_Italic_cff);
94 if (!strcmp(name, "Helvetica-Bold")) RETURN(urw,NimbusSans_Bold_cff);
95 if (!strcmp(name, "Helvetica-BoldOblique")) RETURN(urw,NimbusSans_BoldItalic_cff);
96 if (!strcmp(name, "Times-Roman")) RETURN(urw,NimbusRoman_Regular_cff);
97 if (!strcmp(name, "Times-Italic")) RETURN(urw,NimbusRoman_Italic_cff);
98 if (!strcmp(name, "Times-Bold")) RETURN(urw,NimbusRoman_Bold_cff);
99 if (!strcmp(name, "Times-BoldItalic")) RETURN(urw,NimbusRoman_BoldItalic_cff);
100 if (!strcmp(name, "Symbol")) RETURN(urw,StandardSymbolsPS_cff);
101 if (!strcmp(name, "ZapfDingbats")) RETURN(urw,Dingbats_cff);
102#endif
103 return *size = 0, NULL;
104}
105
106#define FAMILY(F, R, I, B, BI) \
107 if (!is_bold) { \
108 if (!is_italic) RETURN(F, R); else RETURN(F, I); \
109 } else { \
110 if (!is_italic) RETURN(F, B); else RETURN(F, BI); \
111 }
112
113/*
114 Search the builtin fonts for a match.
115 Whether a given font is present or not will depend on the
116 configuration in which MuPDF is built.
117
118 name: The name of the font desired.
119
120 bold: 1 if bold desired, 0 otherwise.
121
122 italic: 1 if italic desired, 0 otherwise.
123
124 len: Pointer to a place to receive the length of the discovered
125 font buffer.
126
127 Returns a pointer to the font file data, or NULL if not present.
128*/
129const unsigned char *
130fz_lookup_builtin_font(fz_context *ctx, const char *name, int is_bold, int is_italic, int *size)
131{
132#ifndef TOFU_BASE14
133 if (!strcmp(name, "Courier")) {
134 FAMILY(urw, NimbusMonoPS_Regular_cff,
135 NimbusMonoPS_Italic_cff,
136 NimbusMonoPS_Bold_cff,
137 NimbusMonoPS_BoldItalic_cff)
138 }
139 if (!strcmp(name, "Helvetica") || !strcmp(name, "Arial")) {
140 FAMILY(urw, NimbusSans_Regular_cff,
141 NimbusSans_Italic_cff,
142 NimbusSans_Bold_cff,
143 NimbusSans_BoldItalic_cff)
144 }
145 if (!strcmp(name, "Times") || !strcmp(name, "Times Roman") || !strcmp(name, "Times New Roman")) {
146 FAMILY(urw, NimbusRoman_Regular_cff,
147 NimbusRoman_Italic_cff,
148 NimbusRoman_Bold_cff,
149 NimbusRoman_BoldItalic_cff)
150 }
151 if (!strcmp(name, "Dingbats") || !strcmp(name, "Zapf Dingbats")) {
152 RETURN(urw, Dingbats_cff);
153 }
154 if (!strcmp(name, "Symbol")) {
155 RETURN(urw, StandardSymbolsPS_cff);
156 }
157#endif
158#ifndef TOFU_SIL
159 if (!strcmp(name, "Charis SIL")) {
160 FAMILY(sil, CharisSIL_cff,
161 CharisSIL_Italic_cff,
162 CharisSIL_Bold_cff,
163 CharisSIL_BoldItalic_cff)
164 }
165#endif
166#ifndef TOFU_NOTO
167 if (!strcmp(name, "Noto Serif")) {
168 RETURN(noto, NotoSerif_Regular_otf);
169 }
170#endif
171 return *size = 0, NULL;
172}
173
174/*
175 Search the builtin cjk fonts for a match.
176 Whether a font is present or not will depend on the
177 configuration in which MuPDF is built.
178
179 ordering: The desired ordering of the font (e.g. FZ_ADOBE_KOREA).
180
181 size: Pointer to a place to receive the length of the discovered font buffer.
182
183 subfont: Pointer to a place to store the subfont index of the discovered font.
184
185 Returns a pointer to the font file data, or NULL if not present.
186*/
187const unsigned char *
188fz_lookup_cjk_font(fz_context *ctx, int ordering, int *size, int *subfont)
189{
190 *subfont = 0;
191#ifndef TOFU_CJK
192#ifndef TOFU_CJK_EXT
193#ifndef TOFU_CJK_LANG
194 switch (ordering) {
195 case FZ_ADOBE_JAPAN: *subfont=0; RETURN(han, SourceHanSerif_Regular_ttc);
196 case FZ_ADOBE_KOREA: *subfont=1; RETURN(han, SourceHanSerif_Regular_ttc);
197 case FZ_ADOBE_GB: *subfont=2; RETURN(han, SourceHanSerif_Regular_ttc);
198 default:
199 case FZ_ADOBE_CNS: *subfont=3; RETURN(han, SourceHanSerif_Regular_ttc);
200 }
201#else
202 RETURN(droid, DroidSansFallbackFull_ttf);
203#endif
204#else
205 RETURN(droid, DroidSansFallback_ttf);
206#endif
207#else
208 return *size = 0, NULL;
209#endif
210}
211
212/*
213 Return the matching FZ_ADOBE_* ordering
214 for the given language tag, such as "zh-Hant", "zh-Hans", "ja", or "ko".
215*/
216int
217fz_lookup_cjk_ordering_by_language(const char *name)
218{
219 if (!strcmp(name, "zh-Hant")) return FZ_ADOBE_CNS;
220 if (!strcmp(name, "zh-TW")) return FZ_ADOBE_CNS;
221 if (!strcmp(name, "zh-HK")) return FZ_ADOBE_CNS;
222 if (!strcmp(name, "zh-Hans")) return FZ_ADOBE_GB;
223 if (!strcmp(name, "zh-CN")) return FZ_ADOBE_GB;
224 if (!strcmp(name, "ja")) return FZ_ADOBE_JAPAN;
225 if (!strcmp(name, "ko")) return FZ_ADOBE_KOREA;
226 return -1;
227}
228
229const unsigned char *
230fz_lookup_cjk_font_by_language(fz_context *ctx, const char *lang, int *size, int *subfont)
231{
232 int ordering = fz_lookup_cjk_ordering_by_language(lang);
233 if (ordering >= 0)
234 return fz_lookup_cjk_font(ctx, ordering, size, subfont);
235 return *size = 0, *subfont = 0, NULL;
236}
237
238/*
239 Search the builtin noto fonts for a match.
240 Whether a font is present or not will depend on the
241 configuration in which MuPDF is built.
242
243 script: The script desired (e.g. UCDN_SCRIPT_KATAKANA).
244
245 lang: The language desired (e.g. FZ_LANG_ja).
246
247 len: Pointer to a place to receive the length of the discovered
248 font buffer.
249
250 Returns a pointer to the font file data, or NULL if not present.
251*/
252const unsigned char *
253fz_lookup_noto_font(fz_context *ctx, int script, int language, int *size, int *subfont)
254{
255 *subfont = 0;
256
257 switch (script)
258 {
259 default:
260 case UCDN_SCRIPT_COMMON:
261 case UCDN_SCRIPT_INHERITED:
262 case UCDN_SCRIPT_UNKNOWN:
263#ifndef TOFU_NOTO
264 RETURN(noto,NotoSerif_Regular_otf);
265#endif
266 break;
267
268 case UCDN_SCRIPT_HANGUL:
269 return fz_lookup_cjk_font(ctx, FZ_ADOBE_KOREA, size, subfont);
270 case UCDN_SCRIPT_HIRAGANA:
271 case UCDN_SCRIPT_KATAKANA:
272 return fz_lookup_cjk_font(ctx, FZ_ADOBE_JAPAN, size, subfont);
273 case UCDN_SCRIPT_BOPOMOFO:
274 return fz_lookup_cjk_font(ctx, FZ_ADOBE_CNS, size, subfont);
275 case UCDN_SCRIPT_HAN:
276 switch (language)
277 {
278 case FZ_LANG_ja: return fz_lookup_cjk_font(ctx, FZ_ADOBE_JAPAN, size, subfont);
279 case FZ_LANG_ko: return fz_lookup_cjk_font(ctx, FZ_ADOBE_KOREA, size, subfont);
280 case FZ_LANG_zh_Hans: return fz_lookup_cjk_font(ctx, FZ_ADOBE_GB, size, subfont);
281 default:
282 case FZ_LANG_zh_Hant: return fz_lookup_cjk_font(ctx, FZ_ADOBE_CNS, size, subfont);
283 }
284
285 case UCDN_SCRIPT_BRAILLE: break; /* no dedicated font; fallback to NotoSansSymbols will cover this */
286
287#ifndef TOFU_NOTO
288 case UCDN_SCRIPT_LATIN:
289 case UCDN_SCRIPT_GREEK:
290 case UCDN_SCRIPT_CYRILLIC:
291 RETURN(noto,NotoSerif_Regular_otf);
292
293 case UCDN_SCRIPT_ARABIC:
294 if (language == FZ_LANG_ur || language == FZ_LANG_urd)
295 RETURN(noto,NotoNastaliqUrdu_Regular_otf);
296 RETURN(noto,NotoNaskhArabic_Regular_ttf);
297
298 case UCDN_SCRIPT_ADLAM: RETURN(noto,NotoSansAdlam_Regular_otf);
299 case UCDN_SCRIPT_AHOM: RETURN(noto,NotoSerifAhom_Regular_otf);
300 case UCDN_SCRIPT_ANATOLIAN_HIEROGLYPHS: RETURN(noto,NotoSansAnatolianHieroglyphs_Regular_otf);
301 case UCDN_SCRIPT_ARMENIAN: RETURN(noto,NotoSerifArmenian_Regular_otf);
302 case UCDN_SCRIPT_AVESTAN: RETURN(noto,NotoSansAvestan_Regular_otf);
303 case UCDN_SCRIPT_BALINESE: RETURN(noto,NotoSerifBalinese_Regular_otf);
304 case UCDN_SCRIPT_BAMUM: RETURN(noto,NotoSansBamum_Regular_otf);
305 case UCDN_SCRIPT_BASSA_VAH: RETURN(noto,NotoSansBassaVah_Regular_otf);
306 case UCDN_SCRIPT_BATAK: RETURN(noto,NotoSansBatak_Regular_otf);
307 case UCDN_SCRIPT_BENGALI: RETURN(noto,NotoSerifBengali_Regular_ttf);
308 case UCDN_SCRIPT_BHAIKSUKI: RETURN(noto,NotoSansBhaiksuki_Regular_otf);
309 case UCDN_SCRIPT_BRAHMI: RETURN(noto,NotoSansBrahmi_Regular_otf);
310 case UCDN_SCRIPT_BUGINESE: RETURN(noto,NotoSansBuginese_Regular_otf);
311 case UCDN_SCRIPT_BUHID: RETURN(noto,NotoSansBuhid_Regular_otf);
312 case UCDN_SCRIPT_CANADIAN_ABORIGINAL: RETURN(noto,NotoSansCanadianAboriginal_Regular_otf);
313 case UCDN_SCRIPT_CARIAN: RETURN(noto,NotoSansCarian_Regular_otf);
314 case UCDN_SCRIPT_CAUCASIAN_ALBANIAN: RETURN(noto,NotoSansCaucasianAlbanian_Regular_otf);
315 case UCDN_SCRIPT_CHAKMA: RETURN(noto,NotoSansChakma_Regular_otf);
316 case UCDN_SCRIPT_CHAM: RETURN(noto,NotoSansCham_Regular_otf);
317 case UCDN_SCRIPT_CHEROKEE: RETURN(noto,NotoSansCherokee_Regular_otf);
318 case UCDN_SCRIPT_COPTIC: RETURN(noto,NotoSansCoptic_Regular_otf);
319 case UCDN_SCRIPT_CUNEIFORM: RETURN(noto,NotoSansCuneiform_Regular_otf);
320 case UCDN_SCRIPT_CYPRIOT: RETURN(noto,NotoSansCypriot_Regular_otf);
321 case UCDN_SCRIPT_DESERET: RETURN(noto,NotoSansDeseret_Regular_otf);
322 case UCDN_SCRIPT_DEVANAGARI: RETURN(noto,NotoSerifDevanagari_Regular_ttf);
323 case UCDN_SCRIPT_DOGRA: break;
324 case UCDN_SCRIPT_DUPLOYAN: RETURN(noto,NotoSansDuployan_Regular_otf);
325 case UCDN_SCRIPT_EGYPTIAN_HIEROGLYPHS: RETURN(noto,NotoSansEgyptianHieroglyphs_Regular_otf);
326 case UCDN_SCRIPT_ELBASAN: RETURN(noto,NotoSansElbasan_Regular_otf);
327 case UCDN_SCRIPT_ELYMAIC: break;
328 case UCDN_SCRIPT_ETHIOPIC: RETURN(noto,NotoSerifEthiopic_Regular_otf);
329 case UCDN_SCRIPT_GEORGIAN: RETURN(noto,NotoSerifGeorgian_Regular_otf);
330 case UCDN_SCRIPT_GLAGOLITIC: RETURN(noto,NotoSansGlagolitic_Regular_otf);
331 case UCDN_SCRIPT_GOTHIC: RETURN(noto,NotoSansGothic_Regular_otf);
332 case UCDN_SCRIPT_GRANTHA: RETURN(noto,NotoSansGrantha_Regular_otf);
333 case UCDN_SCRIPT_GUJARATI: RETURN(noto,NotoSerifGujarati_Regular_otf);
334 case UCDN_SCRIPT_GUNJALA_GONDI: break;
335 case UCDN_SCRIPT_GURMUKHI: RETURN(noto,NotoSerifGurmukhi_Regular_otf);
336 case UCDN_SCRIPT_HANIFI_ROHINGYA: break;
337 case UCDN_SCRIPT_HANUNOO: RETURN(noto,NotoSansHanunoo_Regular_otf);
338 case UCDN_SCRIPT_HATRAN: RETURN(noto,NotoSansHatran_Regular_otf);
339 case UCDN_SCRIPT_HEBREW: RETURN(noto,NotoSerifHebrew_Regular_otf);
340 case UCDN_SCRIPT_IMPERIAL_ARAMAIC: RETURN(noto,NotoSansImperialAramaic_Regular_otf);
341 case UCDN_SCRIPT_INSCRIPTIONAL_PAHLAVI: RETURN(noto,NotoSansInscriptionalPahlavi_Regular_otf);
342 case UCDN_SCRIPT_INSCRIPTIONAL_PARTHIAN: RETURN(noto,NotoSansInscriptionalParthian_Regular_otf);
343 case UCDN_SCRIPT_JAVANESE: RETURN(noto,NotoSansJavanese_Regular_otf);
344 case UCDN_SCRIPT_KAITHI: RETURN(noto,NotoSansKaithi_Regular_otf);
345 case UCDN_SCRIPT_KANNADA: RETURN(noto,NotoSerifKannada_Regular_otf);
346 case UCDN_SCRIPT_KAYAH_LI: RETURN(noto,NotoSansKayahLi_Regular_otf);
347 case UCDN_SCRIPT_KHAROSHTHI: RETURN(noto,NotoSansKharoshthi_Regular_otf);
348 case UCDN_SCRIPT_KHMER: RETURN(noto,NotoSerifKhmer_Regular_otf);
349 case UCDN_SCRIPT_KHOJKI: RETURN(noto,NotoSansKhojki_Regular_otf);;
350 case UCDN_SCRIPT_KHUDAWADI: RETURN(noto,NotoSansKhudawadi_Regular_otf);
351 case UCDN_SCRIPT_LAO: RETURN(noto,NotoSerifLao_Regular_otf);
352 case UCDN_SCRIPT_LEPCHA: RETURN(noto,NotoSansLepcha_Regular_otf);
353 case UCDN_SCRIPT_LIMBU: RETURN(noto,NotoSansLimbu_Regular_otf);
354 case UCDN_SCRIPT_LINEAR_A: RETURN(noto,NotoSansLinearA_Regular_otf);
355 case UCDN_SCRIPT_LINEAR_B: RETURN(noto,NotoSansLinearB_Regular_otf);
356 case UCDN_SCRIPT_LISU: RETURN(noto,NotoSansLisu_Regular_otf);
357 case UCDN_SCRIPT_LYCIAN: RETURN(noto,NotoSansLycian_Regular_otf);
358 case UCDN_SCRIPT_LYDIAN: RETURN(noto,NotoSansLydian_Regular_otf);
359 case UCDN_SCRIPT_MAHAJANI: RETURN(noto,NotoSansMahajani_Regular_otf);
360 case UCDN_SCRIPT_MAKASAR: break;
361 case UCDN_SCRIPT_MALAYALAM: RETURN(noto,NotoSerifMalayalam_Regular_ttf);
362 case UCDN_SCRIPT_MANDAIC: RETURN(noto,NotoSansMandaic_Regular_otf);
363 case UCDN_SCRIPT_MANICHAEAN: RETURN(noto,NotoSansManichaean_Regular_otf);
364 case UCDN_SCRIPT_MARCHEN: RETURN(noto,NotoSansMarchen_Regular_otf);
365 case UCDN_SCRIPT_MASARAM_GONDI: break;
366 case UCDN_SCRIPT_MEDEFAIDRIN: break;
367 case UCDN_SCRIPT_MEETEI_MAYEK: RETURN(noto,NotoSansMeeteiMayek_Regular_otf);
368 case UCDN_SCRIPT_MENDE_KIKAKUI: RETURN(noto,NotoSansMendeKikakui_Regular_otf);
369 case UCDN_SCRIPT_MEROITIC_CURSIVE: RETURN(noto,NotoSansMeroitic_Regular_otf);
370 case UCDN_SCRIPT_MEROITIC_HIEROGLYPHS: RETURN(noto,NotoSansMeroitic_Regular_otf);
371 case UCDN_SCRIPT_MIAO: RETURN(noto,NotoSansMiao_Regular_otf);
372 case UCDN_SCRIPT_MODI: RETURN(noto,NotoSansModi_Regular_otf);
373 case UCDN_SCRIPT_MONGOLIAN: RETURN(noto,NotoSansMongolian_Regular_otf);
374 case UCDN_SCRIPT_MRO: RETURN(noto,NotoSansMro_Regular_otf);
375 case UCDN_SCRIPT_MULTANI: RETURN(noto,NotoSansMultani_Regular_otf);
376 case UCDN_SCRIPT_MYANMAR: RETURN(noto,NotoSerifMyanmar_Regular_otf);
377 case UCDN_SCRIPT_NABATAEAN: RETURN(noto,NotoSansNabataean_Regular_otf);
378 case UCDN_SCRIPT_NANDINAGARI: break;
379 case UCDN_SCRIPT_NEWA: RETURN(noto,NotoSansNewa_Regular_otf);
380 case UCDN_SCRIPT_NEW_TAI_LUE: RETURN(noto,NotoSansNewTaiLue_Regular_otf);
381 case UCDN_SCRIPT_NKO: RETURN(noto,NotoSansNKo_Regular_otf);
382 case UCDN_SCRIPT_NUSHU: break;
383 case UCDN_SCRIPT_NYIAKENG_PUACHUE_HMONG: break;
384 case UCDN_SCRIPT_OGHAM: RETURN(noto,NotoSansOgham_Regular_otf);
385 case UCDN_SCRIPT_OLD_HUNGARIAN: RETURN(noto,NotoSansOldHungarian_Regular_otf);
386 case UCDN_SCRIPT_OLD_ITALIC: RETURN(noto,NotoSansOldItalic_Regular_otf);
387 case UCDN_SCRIPT_OLD_NORTH_ARABIAN: RETURN(noto,NotoSansOldNorthArabian_Regular_otf);
388 case UCDN_SCRIPT_OLD_PERMIC: RETURN(noto,NotoSansOldPermic_Regular_otf);
389 case UCDN_SCRIPT_OLD_PERSIAN: RETURN(noto,NotoSansOldPersian_Regular_otf);
390 case UCDN_SCRIPT_OLD_SOGDIAN: break;
391 case UCDN_SCRIPT_OLD_SOUTH_ARABIAN: RETURN(noto,NotoSansOldSouthArabian_Regular_otf);
392 case UCDN_SCRIPT_OLD_TURKIC: RETURN(noto,NotoSansOldTurkic_Regular_otf);
393 case UCDN_SCRIPT_OL_CHIKI: RETURN(noto,NotoSansOlChiki_Regular_otf);
394 case UCDN_SCRIPT_ORIYA: RETURN(noto,NotoSansOriya_Regular_ttf);
395 case UCDN_SCRIPT_OSAGE: RETURN(noto,NotoSansOsage_Regular_otf);
396 case UCDN_SCRIPT_OSMANYA: RETURN(noto,NotoSansOsmanya_Regular_otf);
397 case UCDN_SCRIPT_PAHAWH_HMONG: RETURN(noto,NotoSansPahawhHmong_Regular_otf);
398 case UCDN_SCRIPT_PALMYRENE: RETURN(noto,NotoSansPalmyrene_Regular_otf);
399 case UCDN_SCRIPT_PAU_CIN_HAU: RETURN(noto,NotoSansPauCinHau_Regular_otf);
400 case UCDN_SCRIPT_PHAGS_PA: RETURN(noto,NotoSansPhagsPa_Regular_otf);
401 case UCDN_SCRIPT_PHOENICIAN: RETURN(noto,NotoSansPhoenician_Regular_otf);
402 case UCDN_SCRIPT_PSALTER_PAHLAVI: RETURN(noto,NotoSansPsalterPahlavi_Regular_otf);
403 case UCDN_SCRIPT_REJANG: RETURN(noto,NotoSansRejang_Regular_otf);
404 case UCDN_SCRIPT_RUNIC: RETURN(noto,NotoSansRunic_Regular_otf);
405 case UCDN_SCRIPT_SAMARITAN: RETURN(noto,NotoSansSamaritan_Regular_otf);
406 case UCDN_SCRIPT_SAURASHTRA: RETURN(noto,NotoSansSaurashtra_Regular_otf);
407 case UCDN_SCRIPT_SHARADA: RETURN(noto,NotoSansSharada_Regular_otf);
408 case UCDN_SCRIPT_SHAVIAN: RETURN(noto,NotoSansShavian_Regular_otf);
409 case UCDN_SCRIPT_SIDDHAM: RETURN(noto,NotoSansSiddham_Regular_otf);
410 case UCDN_SCRIPT_SIGNWRITING: break;
411 case UCDN_SCRIPT_SINHALA: RETURN(noto,NotoSerifSinhala_Regular_otf);
412 case UCDN_SCRIPT_SOGDIAN: break;
413 case UCDN_SCRIPT_SORA_SOMPENG: RETURN(noto,NotoSansSoraSompeng_Regular_otf);
414 case UCDN_SCRIPT_SOYOMBO: break;
415 case UCDN_SCRIPT_SUNDANESE: RETURN(noto,NotoSansSundanese_Regular_otf);
416 case UCDN_SCRIPT_SYLOTI_NAGRI: RETURN(noto,NotoSansSylotiNagri_Regular_otf);
417 case UCDN_SCRIPT_SYRIAC: RETURN(noto,NotoSansSyriac_Regular_otf);
418 case UCDN_SCRIPT_TAGALOG: RETURN(noto,NotoSansTagalog_Regular_otf);
419 case UCDN_SCRIPT_TAGBANWA: RETURN(noto,NotoSansTagbanwa_Regular_otf);
420 case UCDN_SCRIPT_TAI_LE: RETURN(noto,NotoSansTaiLe_Regular_otf);
421 case UCDN_SCRIPT_TAI_THAM: RETURN(noto,NotoSansTaiTham_Regular_ttf);
422 case UCDN_SCRIPT_TAI_VIET: RETURN(noto,NotoSansTaiViet_Regular_otf);
423 case UCDN_SCRIPT_TAKRI: RETURN(noto,NotoSansTakri_Regular_otf);
424 case UCDN_SCRIPT_TAMIL: RETURN(noto,NotoSerifTamil_Regular_otf);
425 case UCDN_SCRIPT_TELUGU: RETURN(noto,NotoSerifTelugu_Regular_ttf);
426 case UCDN_SCRIPT_THAANA: RETURN(noto,NotoSansThaana_Regular_otf);
427 case UCDN_SCRIPT_THAI: RETURN(noto,NotoSerifThai_Regular_otf);
428 case UCDN_SCRIPT_TIBETAN: RETURN(noto,NotoSerifTibetan_Regular_otf);
429 case UCDN_SCRIPT_TIFINAGH: RETURN(noto,NotoSansTifinagh_Regular_otf);
430 case UCDN_SCRIPT_TIRHUTA: RETURN(noto,NotoSansTirhuta_Regular_otf);
431 case UCDN_SCRIPT_UGARITIC: RETURN(noto,NotoSansUgaritic_Regular_otf);
432 case UCDN_SCRIPT_VAI: RETURN(noto,NotoSansVai_Regular_otf);
433 case UCDN_SCRIPT_WANCHO: break;
434 case UCDN_SCRIPT_WARANG_CITI: RETURN(noto,NotoSansWarangCiti_Regular_otf);
435 case UCDN_SCRIPT_YI: RETURN(noto,NotoSansYi_Regular_otf);
436 case UCDN_SCRIPT_ZANABAZAR_SQUARE: break;
437
438#if NOTO_TANGUT
439 case UCDN_SCRIPT_TANGUT: RETURN(noto,NotoSerifTangut_Regular_otf);
440#endif
441
442#endif /* TOFU_NOTO */
443 }
444
445 return *size = 0, NULL;
446}
447
448/*
449 Search the builtin noto fonts specific symbol fonts.
450 Whether a font is present or not will depend on the configuration in
451 which MuPDF is built.
452*/
453const unsigned char *
454fz_lookup_noto_math_font(fz_context *ctx, int *size)
455{
456#ifndef TOFU_SYMBOL
457 RETURN(noto,NotoSansMath_Regular_otf);
458#else
459 return *size = 0, NULL;
460#endif
461}
462
463const unsigned char *
464fz_lookup_noto_music_font(fz_context *ctx, int *size)
465{
466#ifndef TOFU_SYMBOL
467 RETURN(noto,NotoMusic_Regular_otf);
468#else
469 return *size = 0, NULL;
470#endif
471}
472
473const unsigned char *
474fz_lookup_noto_symbol1_font(fz_context *ctx, int *size)
475{
476#ifndef TOFU_SYMBOL
477 RETURN(noto,NotoSansSymbols_Regular_otf);
478#else
479 return *size = 0, NULL;
480#endif
481}
482
483const unsigned char *
484fz_lookup_noto_symbol2_font(fz_context *ctx, int *size)
485{
486#ifndef TOFU_SYMBOL
487 RETURN(noto,NotoSansSymbols2_Regular_otf);
488#else
489 return *size = 0, NULL;
490#endif
491}
492
493const unsigned char *
494fz_lookup_noto_emoji_font(fz_context *ctx, int *size)
495{
496#ifndef TOFU_EMOJI
497 RETURN(noto,NotoEmoji_Regular_ttf);
498#else
499 return *size = 0, NULL;
500#endif
501}
502