|
| 1 | +import React from 'react'; |
| 2 | +import { |
| 3 | + Document, |
| 4 | + Page, |
| 5 | + View, |
| 6 | + Text, |
| 7 | + Font, |
| 8 | + StyleSheet, |
| 9 | +} from '@react-pdf/renderer'; |
| 10 | + |
| 11 | +import RobotoFont from '../../../public/Roboto-Regular.ttf'; |
| 12 | + |
| 13 | +Font.register({ |
| 14 | + family: 'Roboto', |
| 15 | + fonts: [{ src: RobotoFont }], |
| 16 | +}); |
| 17 | + |
| 18 | +Font.register({ |
| 19 | + family: 'NotoSansBengali', |
| 20 | + src: 'https://fonts.gstatic.com/s/notosansbengali/v20/Cn-SJsCGWQxOjaGwMQ6fIiMywrNJIky6nvd8BjzVMvJx2mcSPVFpVEqE-6KmsolKudCk8izI0lc.ttf', |
| 21 | +}); |
| 22 | + |
| 23 | +Font.register({ |
| 24 | + family: 'NotoSansTamil', |
| 25 | + src: 'https://fonts.gstatic.com/s/notosanstamil/v27/ieVc2YdFI3GCY6SyQy1KfStzYKZgzN1z4LKDbeZce-0429tBManUktuex7vGor0RqKDt_EvT.ttf', |
| 26 | +}); |
| 27 | + |
| 28 | +Font.register({ |
| 29 | + family: 'Sarabun', |
| 30 | + src: 'https://fonts.gstatic.com/s/sarabun/v17/DtVjJx26TKEr37c9WBI.ttf', |
| 31 | +}); |
| 32 | + |
| 33 | +Font.register({ |
| 34 | + family: 'NotoSansArabic', |
| 35 | + src: 'https://fonts.gstatic.com/s/notosansarabic/v18/nwpxtLGrOAZMl5nJ_wfgRg3DrWFZWsnVBJ_sS6tlqHHFlhQ5l3sQWIHPqzCfyGyvu3CBFQLaig.ttf', |
| 36 | +}); |
| 37 | + |
| 38 | +Font.register({ |
| 39 | + family: 'NotoSansDevanagari', |
| 40 | + src: 'https://fonts.gstatic.com/s/notosansdevanagari/v30/TuGoUUFzXI5FBtUq5a8bjKYTZjtRU6Sgv3NaV_SNmI0b8QQCQmHn6B2OHjbL_08AlXQly-A.ttf', |
| 41 | +}); |
| 42 | + |
| 43 | +const styles = StyleSheet.create({ |
| 44 | + page: { |
| 45 | + padding: 40, |
| 46 | + backgroundColor: '#fafafa', |
| 47 | + }, |
| 48 | + title: { |
| 49 | + fontSize: 18, |
| 50 | + fontWeight: 'bold', |
| 51 | + color: '#1a1a1a', |
| 52 | + }, |
| 53 | + subtitle: { |
| 54 | + fontSize: 9, |
| 55 | + color: '#888', |
| 56 | + marginBottom: 20, |
| 57 | + }, |
| 58 | + card: { |
| 59 | + backgroundColor: '#ffffff', |
| 60 | + borderRadius: 5, |
| 61 | + padding: 16, |
| 62 | + borderWidth: 1, |
| 63 | + borderColor: '#e8e8e8', |
| 64 | + marginBottom: 8, |
| 65 | + }, |
| 66 | + row: { |
| 67 | + flexDirection: 'row', |
| 68 | + gap: 8, |
| 69 | + marginBottom: 8, |
| 70 | + }, |
| 71 | + halfCard: { |
| 72 | + flex: 1, |
| 73 | + backgroundColor: '#ffffff', |
| 74 | + borderRadius: 5, |
| 75 | + padding: 12, |
| 76 | + borderWidth: 1, |
| 77 | + borderColor: '#e8e8e8', |
| 78 | + }, |
| 79 | + label: { |
| 80 | + fontSize: 8, |
| 81 | + color: '#999', |
| 82 | + textTransform: 'uppercase', |
| 83 | + letterSpacing: 0.5, |
| 84 | + marginBottom: 10, |
| 85 | + }, |
| 86 | + scriptText: { |
| 87 | + fontSize: 24, |
| 88 | + color: '#1a1a1a', |
| 89 | + marginBottom: 4, |
| 90 | + }, |
| 91 | + scriptTextSmall: { |
| 92 | + fontSize: 14, |
| 93 | + color: '#333', |
| 94 | + lineHeight: 1.6, |
| 95 | + }, |
| 96 | + footer: { |
| 97 | + marginTop: 'auto', |
| 98 | + paddingTop: 12, |
| 99 | + borderTopWidth: 1, |
| 100 | + borderTopColor: '#e8e8e8', |
| 101 | + }, |
| 102 | + footerText: { |
| 103 | + fontSize: 7, |
| 104 | + color: '#aaa', |
| 105 | + }, |
| 106 | +}); |
| 107 | + |
| 108 | +const Scripts = () => ( |
| 109 | + <Document> |
| 110 | + <Page style={styles.page}> |
| 111 | + <Text style={styles.title}>World Scripts</Text> |
| 112 | + <Text style={styles.subtitle}> |
| 113 | + Complex script rendering with Unicode decomposition and shaping |
| 114 | + </Text> |
| 115 | + |
| 116 | + <View style={styles.row}> |
| 117 | + <View style={styles.halfCard}> |
| 118 | + <Text style={styles.label}>Bengali</Text> |
| 119 | + <Text style={[styles.scriptText, { fontFamily: 'NotoSansBengali' }]}> |
| 120 | + বাংলা |
| 121 | + </Text> |
| 122 | + <Text |
| 123 | + style={[styles.scriptTextSmall, { fontFamily: 'NotoSansBengali' }]} |
| 124 | + > |
| 125 | + আমার সোনার বাংলা আমি তোমায় ভালোবাসি |
| 126 | + </Text> |
| 127 | + </View> |
| 128 | + <View style={styles.halfCard}> |
| 129 | + <Text style={styles.label}>Tamil</Text> |
| 130 | + <Text style={[styles.scriptText, { fontFamily: 'NotoSansTamil' }]}> |
| 131 | + தமிழ் |
| 132 | + </Text> |
| 133 | + <Text |
| 134 | + style={[styles.scriptTextSmall, { fontFamily: 'NotoSansTamil' }]} |
| 135 | + > |
| 136 | + யாதும் ஊரே யாவரும் கேளிர் |
| 137 | + </Text> |
| 138 | + </View> |
| 139 | + </View> |
| 140 | + |
| 141 | + <View style={styles.row}> |
| 142 | + <View style={styles.halfCard}> |
| 143 | + <Text style={styles.label}>Thai</Text> |
| 144 | + <Text style={[styles.scriptText, { fontFamily: 'Sarabun' }]}> |
| 145 | + ภาษาไทย |
| 146 | + </Text> |
| 147 | + <Text style={[styles.scriptTextSmall, { fontFamily: 'Sarabun' }]}> |
| 148 | + สวัสดีครับ ยินดีต้อนรับ |
| 149 | + </Text> |
| 150 | + </View> |
| 151 | + <View style={styles.halfCard}> |
| 152 | + <Text style={styles.label}>Arabic</Text> |
| 153 | + <Text style={[styles.scriptText, { fontFamily: 'NotoSansArabic' }]}> |
| 154 | + العربية |
| 155 | + </Text> |
| 156 | + <Text |
| 157 | + style={[styles.scriptTextSmall, { fontFamily: 'NotoSansArabic' }]} |
| 158 | + > |
| 159 | + مرحبا بالعالم |
| 160 | + </Text> |
| 161 | + </View> |
| 162 | + </View> |
| 163 | + |
| 164 | + <View style={styles.row}> |
| 165 | + <View style={styles.halfCard}> |
| 166 | + <Text style={styles.label}>Devanagari</Text> |
| 167 | + <Text |
| 168 | + style={[styles.scriptText, { fontFamily: 'NotoSansDevanagari' }]} |
| 169 | + > |
| 170 | + हिन्दी |
| 171 | + </Text> |
| 172 | + <Text |
| 173 | + style={[ |
| 174 | + styles.scriptTextSmall, |
| 175 | + { fontFamily: 'NotoSansDevanagari' }, |
| 176 | + ]} |
| 177 | + > |
| 178 | + वसुधैव कुटुम्बकम् |
| 179 | + </Text> |
| 180 | + </View> |
| 181 | + <View style={styles.halfCard}> |
| 182 | + <Text style={styles.label}>Latin — Accented</Text> |
| 183 | + <Text style={[styles.scriptText, { fontFamily: 'Roboto' }]}> |
| 184 | + café résumé |
| 185 | + </Text> |
| 186 | + <Text style={[styles.scriptTextSmall, { fontFamily: 'Roboto' }]}> |
| 187 | + naïve François Zürich Ångström |
| 188 | + </Text> |
| 189 | + </View> |
| 190 | + </View> |
| 191 | + |
| 192 | + <View style={styles.card}> |
| 193 | + <Text style={styles.label}>Mixed Scripts</Text> |
| 194 | + <Text |
| 195 | + style={[styles.scriptTextSmall, { fontFamily: 'NotoSansBengali' }]} |
| 196 | + > |
| 197 | + মুফতি ইকবাল হোসেন নাটোরি |
| 198 | + </Text> |
| 199 | + <Text style={[styles.scriptTextSmall, { fontFamily: 'Sarabun' }]}> |
| 200 | + กำกกกำกกก |
| 201 | + </Text> |
| 202 | + <Text style={[styles.scriptTextSmall, { fontFamily: 'NotoSansTamil' }]}> |
| 203 | + சொத்து |
| 204 | + </Text> |
| 205 | + </View> |
| 206 | + |
| 207 | + <View style={styles.footer}> |
| 208 | + <Text style={styles.footerText}> |
| 209 | + Fonts loaded from Google Fonts — requires Unicode decomposition for |
| 210 | + correct glyph shaping |
| 211 | + </Text> |
| 212 | + </View> |
| 213 | + </Page> |
| 214 | + </Document> |
| 215 | +); |
| 216 | + |
| 217 | +export default { |
| 218 | + id: 'scripts', |
| 219 | + name: 'World Scripts', |
| 220 | + description: |
| 221 | + 'Complex script rendering — Bengali, Tamil, Thai, Arabic, Devanagari, and accented Latin', |
| 222 | + Document: Scripts, |
| 223 | +}; |
0 commit comments