Με λίγα λόγια
Η ίδια σελίδα κόμικ στα αγγλικά, τα ισπανικά, τα γαλλικά, τα ιαπωνικά, τα κινεζικά και τα αραβικά: αλλάζουν μόνο οι λέξεις, και το Postext ξανασχεδιάζει κάθε συννεφάκι γύρω τους.
Τι θα στοιχειοθετήσετε
Μία σελίδα ενός κόμικ, The Lighthouse Radio: η Maya φτάνει στον φάρο του παππού της καθώς έρχεται μια καταιγίδα, ο ασύρματος είναι νεκρός, και ο ένοχος είναι ο Biscuit, που κοιμάται πάνω στο καλώδιο. Η διαίρεση και οι πέντε εικόνες σε ακουαρέλα είναι σταθερές· αυτό που αλλάζει από έκδοση σε έκδοση είναι ένα σενάριο εννέα γραμμών. Κάθε έκδοση αυτής της συνταγής στοιχειοθετεί τη δική της γλώσσα, και κάθε έκδοση στοιχειοθετεί επίσης τη γαλλική σελίδα δίπλα της: αγγλικά και γαλλικά, ισπανικά και γαλλικά, και ούτω καθεξής ως τα ιαπωνικά, τα κινεζικά και τα αραβικά. Η μηχανή ξανασχεδιάζει κάθε συννεφάκι γύρω από τις λέξεις που κρατά. Τα ιαπωνικά γράφονται σε κατακόρυφες στήλες σε Zen Antique. Οι ιαπωνικές και οι αραβικές σελίδες διαβάζονται από δεξιά, γι' αυτό τα τρία καρέ της μεσαίας σειράς αλλάζουν θέσεις.
Αυτή η συνταγή απαντά
- Πώς ξαναγράφω τα γράμματα ενός κόμικ σε άλλη γλώσσα;
- Πώς γράφω ιαπωνικά κατακόρυφα μέσα σε συννεφάκια;
Η σύντομη απάντηση
const LOCALE = t({ en: 'en-gb', es: 'es', ja: 'ja', zh: 'zh-Hans', ar: 'ar' });
const comics = {
// No fontFamily: each language is lettered in its own comic face (defaultComicFont):
// Comic Neue, Zen Antique for Japanese, Noto Sans SC, Playpen Sans Arabic. The size is
// one for the whole book: a longer translation grows its balloons, never shrinks its text.
lettering: { fontSize: pt(8.5), lineHeight: 1.12, color: col('ink') },
// writingMode 'auto' (the default): Japanese is lettered in vertical columns.
// readingDirection 'auto': a Japanese or Arabic page reads from the right, so the
// tier of three panels is laid out right to left from the same split. The art keeps
// its drawn direction (mirrorArt: false).
panel: { borderWidth: pt(1), borderColor: col('ink') },
gutter: { horizontal: mm(4), vertical: mm(3) },
balloonStyles: [
{ id: 'caption', fill: col('caption'), stroke: col('ink'), strokeWidth: pt(0.6) },
{ id: 'sfx', color: col('red'), halo: pt(1.4), haloColor: col('paper'), rotate: -8 },
],
readingDirection: 'auto', // the default, written out: it is what an edition flips
cast: [{ id: 'maya', name: 'Maya' }, { id: 'tomas', name: 'Tomás' }],
runningHeads: true, // the footer prints on the comic page
};
Υλικά
- Λειτουργίες
- Νέα γράμματα σε άλλες γλώσσεςΚατεύθυνση ανάγνωσης και σειρά mangaΓράμματα κόμικΟμιλητές και άγκυρεςΧωρισμός σε καρέΕικόνες καρέ και περικοπέςΣελίδες κόμικΣτιλ για τα συννεφάκιαΗχητικά εφέΚινεζικές, ιαπωνικές και κορεατικές γραμματοσειρέςΑραβικές γραμματοσειρέςΚείμενο από δεξιά προς τα αριστεράΚατακόρυφο κείμενοΣημασιολογική χρωματική παλέταΣελίδες σε καμβάΕξαγωγή PDF
- Χρησιμοποιεί επίσης
- Περιγράμματα και διάκενα καρέΚεφαλίδες ανά ρόλο σελίδαςΓραμματοσειρές ενσωματωμένες στο PDFΕικόνες και πίνακες ως πόροι
- Γραμματοσειρές
- Comic Neue, Bangers, Zen Antique, Dela Gothic One, Noto Sans SC, ZCOOL KuaiLe, Playpen Sans Arabic, Lalezar (SIL OFL 1.1)
- Αρχεία
lh-arrive.jpglh-beam.jpglh-biscuit.jpglh-maya.jpglh-radio.jpg- A girl in a yellow raincoat walks up a coastal path towards a red-and-white lighthouse, a fat orange cat trotting ahead; storm clouds gather over the sea. (Generated With Diffusion Models, πρωτότυπο)
- The old keeper, white-bearded in a navy sweater and cap, taps a valve radio in the lamp room, microphone in hand; the great lens glows beside him. (Generated With Diffusion Models, πρωτότυπο)
- Close-up of Maya frowning at the floor and pointing down. (Generated With Diffusion Models, πρωτότυπο)
- Under the desk, the fat orange cat sleeps on his back on top of the black radio cable, squashing it flat. (Generated With Diffusion Models, πρωτότυπο)
- Night: the lighthouse beam sweeps over a dark sea; Maya and her grandfather stand on the lantern gallery, and far out a fishing boat shows its lights. (Generated With Diffusion Models, πρωτότυπο)
Προετοιμασία
#1 · Μία ρύθμιση για κάθε γλώσσα
Ο κώδικας είναι η σύντομη απάντηση παραπάνω. Τίποτα στη ρύθμιση δεν ονομάζει γλώσσα εκτός από το locale. Χωρίς fontFamily, τα γράμματα παίρνουν τη γραμματοσειρά κόμικ της γλώσσας του εγγράφου (defaultComicFont): Comic Neue, Zen Antique, Noto Sans SC ή Playpen Sans Arabic, και το ηχητικό εφέ την αντίστοιχη γραμματοσειρά προβολής. Το writingMode: 'auto' κάνει τα ιαπωνικά συννεφάκια κατακόρυφες στήλες· το readingDirection: 'auto' διαβάζει τις ιαπωνικές και τις αραβικές σελίδες από δεξιά, όπως οι γλώσσες τους, έτσι το ίδιο split="30 / 35 [* | * | *] / *" βάζει το καρέ του ασυρμάτου δεξιά και τη γάτα αριστερά. Τα αναγνωριστικά των ομιλητών (maya, tomas) είναι τα ίδια σε κάθε σενάριο, και οι άγκυρες των εικόνων αντιστοιχούν σε αυτά.
Το μέγεθος είναι ένα για όλο το βιβλίο. Το αγγλικό σενάριο έχει 216 γράμματα, το ισπανικό 220, το γαλλικό 224, το κινεζικό 74 χαρακτήρες· τα μεγαλύτερα σενάρια παίρνουν μεγαλύτερα συννεφάκια, ποτέ μικρότερα στοιχεία.
#2 · Τα γαλλικά ακολουθούν σε κάθε έκδοση
const build = (md, cfg) =>
withLoadedFonts(() => buildDocument({ markdown: md, resources }, cfg),
{ ...kitFonts(FONTS), text: md });
const docs = [await build(markdown, config())];
// French is not a site language, so every edition carries its page: the same config
// with another locale.
docs.push(await build(french, { ...config(), locale: 'fr', footer: footerFor('fr', 'fr') }));
Τα γαλλικά δεν είναι μία από τις εκδόσεις αυτής της συνταγής, γι' αυτό κάθε έκδοση κατασκευάζει δύο έγγραφα: τη δική της σελίδα, και έπειτα τη γαλλική από το content.fr.en.md, με την ίδια ρύθμιση και locale ίσο με 'fr'. Το γαλλικό σενάριο χρησιμοποιεί το στενό αδιάσπαστο διάστημα πριν από το ! και το ?, όπως κάνει η γαλλική στοιχειοθεσία.
#3 · Οι εικόνες δεν αλλάζουν
const box = ([x, y, width, height]) => ({ x, y, width, height });
const who = (id, x, y, head, face) => ({ id, x, y,
...(head && { head: { x: head[0], y: head[1] } }), ...(face && { face: box(face) }) });
const ART = {
'lh-arrive': { width: 1100, height: 733, safeArea: box([.22, .08, .4, .64]),
alt: t({ en: 'A girl in a yellow raincoat walks up a coastal path towards a red-and-white '
+ 'lighthouse, a fat orange cat trotting ahead; storm clouds gather over the sea.',
es: 'Una niña con chubasquero amarillo sube por un camino de costa hacia un faro '
+ 'rojo y blanco, con un gato naranja gordo trotando delante; sobre el mar se '
+ 'acumulan nubes de tormenta.',
zh: '一个穿黄色雨衣的女孩沿着海边小路走向红白相间的灯塔,一只胖橘猫小跑在前面;海上聚起了暴风雨的乌云。',
ar: 'فتاة بمعطف مطر أصفر تصعد دربًا ساحليًا نحو منارة حمراء وبيضاء، وأمامها قط '
+ 'برتقالي سمين يهرول، والغيوم تتجمّع فوق البحر.',
ja: '黄色いレインコートの女の子が、赤と白の灯台へ続く海辺の小道をのぼっていく。前を太ったオレンジ色の猫が小走りし、海の上には嵐の雲が集まっている。' }),
anchors: [
who('maya', .29, .52, [.27, .47], [.22, .42, .12, .16]),
who('biscuit', .4, .68, [.4, .66], [.37, .64, .07, .08]),
],
avoid: [box([.51, .09, .1, .43])],
},
'lh-radio': { width: 1000, height: 1000, safeArea: box([.11, .36, .36, .31]),
alt: t({ en: 'The old keeper, white-bearded in a navy sweater and cap, taps a valve radio '
+ 'in the lamp room, microphone in hand; the great lens glows beside him.',
es: 'El viejo farero, de barba blanca, jersey azul marino y gorra, golpea una radio '
+ 'de válvulas en la sala de la lámpara con el micrófono en la mano; a su lado '
+ 'brilla la gran lente.',
zh: '白胡子的老守塔人穿着藏青色毛衣、戴着帽子,在灯室里手握话筒敲着一台电子管收音机;巨大的透镜在他身旁发光。',
ar: 'حارس المنارة العجوز بلحيته البيضاء وكنزته الكحلية وقبعته ينقر على مذياع قديم '
+ 'في غرفة الفانوس والميكروفون في يده، والعدسة الكبيرة تتوهّج بجانبه.',
ja: '白いひげの老灯台守が、紺のセーターに帽子姿で、灯室でマイクを握って真空管ラジオをたたいている。そばで大きなレンズが光っている。' }),
anchors: [
who('tomas', .345, .52, [.38, .44], [.29, .4, .16, .18]),
],
avoid: [box([0, .44, .22, .26])],
},
'lh-maya': { width: 1100, height: 1100, safeArea: box([.25, .27, .41, .68]),
alt: t({ en: 'Close-up of Maya frowning at the floor and pointing down.',
es: 'Primer plano de Maya, que frunce el ceño mirando al suelo y señala hacia abajo.',
zh: '玛雅的特写:她皱着眉头看着地板,手指向下指。',
ar: 'لقطة قريبة لمايا وهي تعقد حاجبيها ناظرةً إلى الأرض وتشير إلى أسفل.',
ja: 'マヤのアップ。眉をひそめて床を見つめ、下を指さしている。' }),
anchors: [
who('maya', .54, .565, [.5, .3], [.4, .33, .24, .29]),
],
avoid: [box([.27, .73, .25, .22])],
},
'lh-biscuit': { width: 1000, height: 1000, safeArea: box([.58, .25, .42, .33]),
alt: t({ en: 'Under the desk, the fat orange cat sleeps on his back on top of the black '
+ 'radio cable, squashing it flat.',
es: 'Bajo la mesa, el gato naranja gordo duerme panza arriba encima del cable negro '
+ 'de la radio y lo aplasta.',
zh: '桌子底下,胖橘猫四脚朝天地睡在收音机的黑色电线上,把电线压得扁扁的。',
ar: 'تحت المكتب ينام القط البرتقالي السمين على ظهره فوق سلك المذياع الأسود ويسحقه.',
ja: '机の下で、太ったオレンジ色の猫がラジオの黒いコードの上にあおむけで眠り、コードをぺしゃんこにしている。' }),
anchors: [
who('biscuit', .72, .355, [.73, .32], [.64, .27, .2, .18]),
],
avoid: [box([.93, .28, .07, .24]), box([0, .72, .4, .1])],
},
'lh-beam': { width: 1200, height: 800, safeArea: box([.15, .01, .25, .3]),
alt: t({ en: 'Night: the lighthouse beam sweeps over a dark sea; Maya and her grandfather '
+ 'stand on the lantern gallery, and far out a fishing boat shows its lights.',
es: 'De noche, el haz del faro barre un mar oscuro; Maya y su abuelo están en la '
+ 'galería de la linterna y a lo lejos se ven las luces de un pesquero.',
zh: '夜里,灯塔的光束扫过漆黑的海面;玛雅和外公站在灯室外的回廊上,远处一艘渔船亮着灯。',
ar: 'ليلًا يمسح شعاع المنارة بحرًا مظلمًا، ومايا وجدّها واقفان على شرفة الفانوس، '
+ 'وفي البعيد قارب صيد بأضوائه.',
ja: '夜。灯台の光の帯が暗い海をなでる。マヤと祖父は灯室の回廊に立ち、沖には漁船の明かりが見える。' }),
anchors: [
who('maya', .235, .15, null, [.21, .11, .05, .07]),
who('tomas', .3, .145, null, [.28, .11, .04, .06]),
],
avoid: [box([.79, .55, .08, .09])],
},
};
Οι ασφαλείς ζώνες είναι στενότερες από τα κελιά αυτής της διαίρεσης: η μεσαία σειρά κρατά τρία καρέ πλάτους περίπου 46 mm και ύψους 80 mm, έτσι κάθε τετράγωνη εικόνα δείχνει μια στήλη περίπου στο 58% του πλάτους της, ενώ η ασφαλής ζώνη της, το πρόσωπο του ομιλητή και αυτό για το οποίο μιλά η ατάκα, πιάνει το 36–42%. Οι εικόνες δεν κατοπτρίζονται για τα ιαπωνικά ή τα αραβικά (το mirrorArt μένει false): η Maya ανεβαίνει ακόμη το μονοπάτι από αριστερά, και μόνο η σειρά των καρέ ακολουθεί την ανάγνωση.
Η πλήρης συνταγή
// ═══ Postext Cookbook · Nº 153 · One page lettered in six languages ═══════════════════
// https://postext.dev/en/cookbook/one-page-six-languages
// Code: MIT · Story: written for the recipe (CC BY 4.0) · Pictures: generated with diffusion models
// Fonts: Comic Neue, Bangers, the comic faces of each script (OFL) · Needs postext ≥ 1.34.0
// One comic page, its split and its five pictures fixed, lettered from a script per
// language: each edition sets its own page, and the French one beside it.
import {
buildDocument, withLoadedFonts, renderPageToCanvas, registerResourceImage, defaultComicFont,
defaultComicSfxFont,
} from 'https://esm.sh/postext';
import { renderToPdf, decompressWoff2 } from 'https://esm.sh/postext-pdf';
const LANG = 'en'; // @lang: the edition: 'en' | 'es' | 'ja' | 'zh' | 'ar' (French rides along)
const RECIPE = 'one-page-six-languages';
// ─── 1 · Design ─────────────────────────────────────────────────────────────
// #region palette: ink and paper, the lighthouse red for the sound effect
const palette = {
ink: '#1b1d22', // borders, lettering
red: '#c23a2b', // the purr (4.9:1 on paper)
caption: '#f3ead2', // narration boxes, the colour of old charts
muted: '#5d6068', // the footer
paper: '#ffffff',
};
const col = (id) => ({ hex: palette[id], model: 'hex', paletteId: id });
const colorPalette = [
...Object.entries(palette).map(([id, hex]) => ({ id, name: id, value: { hex, model: 'hex' } })),
{ id: 'main-color', name: 'red (defaults)', value: { hex: palette.red, model: 'hex' } },
];
// #endregion
// #region answer: one config for every language; the locale picks face, direction and columns
const LOCALE = t({ en: 'en-gb', es: 'es', ja: 'ja', zh: 'zh-Hans', ar: 'ar' });
const comics = {
// No fontFamily: each language is lettered in its own comic face (defaultComicFont):
// Comic Neue, Zen Antique for Japanese, Noto Sans SC, Playpen Sans Arabic. The size is
// one for the whole book: a longer translation grows its balloons, never shrinks its text.
lettering: { fontSize: pt(8.5), lineHeight: 1.12, color: col('ink') },
// writingMode 'auto' (the default): Japanese is lettered in vertical columns.
// readingDirection 'auto': a Japanese or Arabic page reads from the right, so the
// tier of three panels is laid out right to left from the same split. The art keeps
// its drawn direction (mirrorArt: false).
panel: { borderWidth: pt(1), borderColor: col('ink') },
gutter: { horizontal: mm(4), vertical: mm(3) },
balloonStyles: [
{ id: 'caption', fill: col('caption'), stroke: col('ink'), strokeWidth: pt(0.6) },
{ id: 'sfx', color: col('red'), halo: pt(1.4), haloColor: col('paper'), rotate: -8 },
],
Το συντεθειμένο script.js εκτελείται ως έχει: επικολλήστε το στο module script οποιασδήποτε σελίδας ή ανοίξτε τη συνταγή στο CodePen. Φάκελος της συνταγής στο GitHub ↗ (ανοίγει σε νέα καρτέλα)
Παραλλαγές
#Κατοπτρίστε τις εικόνες για τις εκδόσεις από δεξιά προς τα αριστερά
Το mirrorArt: true αναποδογυρίζει κάθε εικόνα όταν η σελίδα διαβάζεται αντίθετα από την κατεύθυνση με την οποία σχεδιάστηκε η εικόνα. Αφήστε χωρίς αναποδογύρισμα ένα καρέ με γράμματα ή ένα ρολόι μέσα του με ::panel{mirror=false}.
readingDirection: 'auto', // the default, written out: it is what an edition flips
+ mirrorArt: true,Συνήθη λάθη
- Μια γραμμή του σεναρίου ονομάζει έναν ομιλητή με το αναγνωριστικό του, όχι με το όνομά του: γράψτε
maya:σε κάθε γλώσσα. Το όνομα που ανακοινώνει ένας αναγνώστης οθόνης είναι τοcast[].name. - Η γαλλική σελίδα μοιράζεται τις εικόνες της έκδοσης, έτσι το εναλλακτικό κείμενο των καρέ της είναι στη γλώσσα της έκδοσης· δώστε
::panel{alt="…"}στοcontent.fr.en.mdγια γαλλικό εναλλακτικό κείμενο.
Ευχαριστίες
- Συνταγή
- Ignacio Ferro
- Κείμενο
- The lighthouse radio, a one-page comic written for this recipe in English, Spanish, French, Japanese, Chinese and Arabic · Postext Cookbook · CC BY 4.0
- Εικόνες
- A girl in a yellow raincoat walks up a coastal path towards a red-and-white lighthouse, a fat orange cat trotting ahead; storm clouds gather over the sea. · Generated With Diffusion Models · πρωτότυπο
- The old keeper, white-bearded in a navy sweater and cap, taps a valve radio in the lamp room, microphone in hand; the great lens glows beside him. · Generated With Diffusion Models · πρωτότυπο
- Close-up of Maya frowning at the floor and pointing down. · Generated With Diffusion Models · πρωτότυπο
- Under the desk, the fat orange cat sleeps on his back on top of the black radio cable, squashing it flat. · Generated With Diffusion Models · πρωτότυπο
- Night: the lighthouse beam sweeps over a dark sea; Maya and her grandfather stand on the lantern gallery, and far out a fishing boat shows its lights. · Generated With Diffusion Models · πρωτότυπο
- Γραμματοσειρές
- Comic Neue (SIL OFL 1.1) · Bangers (SIL OFL 1.1) · Zen Antique (SIL OFL 1.1) · Dela Gothic One (SIL OFL 1.1) · Noto Sans SC (SIL OFL 1.1) · ZCOOL KuaiLe (SIL OFL 1.1) · Playpen Sans Arabic (SIL OFL 1.1) · Lalezar (SIL OFL 1.1)
- Κώδικας
- MIT, όπως το Postext
Επεξεργασία αυτού του κειμένου ↗ (ανοίγει σε νέα καρτέλα)Φάκελος της συνταγής στο GitHub ↗ (ανοίγει σε νέα καρτέλα)


