forked from mpdf/mpdf-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
example61_new_mPDF_v6-0_features.php
2043 lines (1639 loc) · 128 KB
/
example61_new_mPDF_v6-0_features.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
set_time_limit(600);
$path = (getenv('MPDF_ROOT')) ? getenv('MPDF_ROOT') : __DIR__;
require_once $path . '/vendor/autoload.php';
$mpdf = new \Mpdf\Mpdf();
$mpdf->list_auto_mode = 'mpdf'; // Used for demonstration of lists
//==============================================================
$html = '
<style>
body, div, p {
font-family: \'DejaVu Sans Condensed\';
font-size: 11pt;
}
.gradient {
border:0.1mm solid #220044;
background-color: #f0f2ff;
background-gradient: linear #c7cdde #f0f2ff 0 1 0 0.5;
box-shadow: 0.3em 0.3em #888888;
}
h4 {
font-weight: bold;
margin-top: 1em;
margin-bottom: 0.3em;
margin-top: 0;
}
div.text {
padding:0.8em;
margin-bottom: 0.7em;
}
p { margin: 0.25em 0; }
p.code {
background-color: #e5e5e5;
margin: 1em 1cm;
padding: 0 0.3cm;
border:0.2mm solid #000088;
box-shadow: 0.3em 0.3em #888888;
}
p.example, div.example {
background-color: #eeeeee;
margin: 0.3em 1em 1em 1em;
padding: 0 0.3cm;
border:0.2mm solid #444444;
}
.code {
font-family: monospace;
font-size: 9pt;
}
.shadowtitle {
height: 8mm;
background-color: #EEDDFF;
background-gradient: linear #c7cdde #f0f2ff 0 1 0 0.5;
padding: 0.8em;
padding-left: 3em;
font-family:sans;
font-size: 26pt;
font-weight: bold;
border: 0.2mm solid white;
border-radius: 0.2em;
box-shadow: 0 0 1em 0.5em rgba(0,0,255,0.5);
color: #AAAACC;
text-shadow: 0.03em 0.03em #666, 0.05em 0.05em rgba(127,127,127,0.5), -0.015em -0.015em white;
}
h3 {
margin: 3em 0 2em -15mm;
background-color: #EEDDFF;
background-gradient: linear #c7cdde #f0f2ff 0 1 0 0.5;
padding: 0.5em;
padding-left: 3em;
width: 50%;
font-family:sans;
font-size: 16pt;
font-weight: bold;
border-left: none;
border-radius: 0 2em 2em 0;
box-shadow: 0 0 2em 0.5em rgba(255,0,0,1);
text-shadow: 0.05em 0.04em rgba(127,127,127,0.5);
}
.css {
font-family: arial;
font-style: italic;
color: #000088;
}
table.fontinfo {
border-collapse:collapse;
}
table.fontinfo td {
vertical-align: top;
border: 0.2mm solid #BBBBBB;
padding: 0.2em;
}
table.fontinfo thead td {
text-align: center;
font-weight: bold;
}
</style>
<body>
<htmlpagefooter name="myHTMLarabic">
<table dir="rtl" width="100%" style="border-top: 1px solid #000000; vertical-align: top; font-family: dejavusanscondensed; font-size: 9pt; color: #000088;"><tr>
<td width="33%"></td>
<td width="33%" align="center">Page {PAGENO} of {nbpg}</td>
<td width="33%" style="text-align: left;"><span lang="ar">الصفحة {PAGENO} من {nbpg}</span></td>
</tr></table>
</htmlpagefooter>
<htmlpagefooter name="myHTMLbengali">
<table width="100%" style="border-top: 1px solid #000000; vertical-align: top; font-family: freeserif; font-size: 9pt; color: #000088;"><tr>
<td width="33%"></td>
<td width="33%" align="center">Page {PAGENO} of {nbpg}</td>
<td width="33%" style="text-align: right;"><span lang="bn">{nbpg} পাতা থেকে পাতা {PAGENO}</span></td>
</tr></table>
</htmlpagefooter>
<htmlpagefooter name="myHTMLhebrew">
<table dir="rtl" width="100%" style="border-top: 1px solid #000000; vertical-align: top; font-family: dejavusanscondensed; font-size: 9pt; color: #000088;"><tr>
<td width="33%"></td>
<td width="33%" align="center">Page {PAGENO} of {nbpg}</td>
<td width="33%" style="text-align: left;"><span lang="hr">עמוד {PAGENO} או {nbpg}</span></td>
</tr></table>
</htmlpagefooter>
<sethtmlpagefooter name="myHTMLarabic" page="O" value="on" show-this-page="1" />
<sethtmlpagefooter name="myHTMLarabic" page="E" value="on" />
<div class="shadowtitle">New Features in mPDF v6.0</div>
<h3>Advanced Typography</h3>
<p>Many TrueType fonts contain OpenType Layout (OTL) tables. These Advanced Typographic tables contain additional information that extend the capabilities of the fonts to support high-quality international typography:</p>
<ul>
<li>OTL fonts support ligatures, positional forms, alternates, and other substitutions.</li>
<li>OTL fonts include information to support features for two-dimensional positioning and glyph attachment.</li>
<li>OTL fonts contain explicit script and language information, so a text-processing application can adjust its behavior accordingly.</li>
</ul>
<p>mPDF 6 introduces the power and flexibility of the OpenType Layout font model into PDF.
mPDF 6 supports GSUB, GPOS and GDEF tables for now. mPDF 6 does not support BASE and JSTF at present.</p>
<p>Other mPDF 6 features to enhance complex scripts:</p>
<ul>
<li>improved Bidirectional (Bidi) algorithm for right-to-left (RTL) text</li>
<li>support for Kashida for justification of arabic scripts</li>
<li>partial support for CSS3 optional font features e.g. font-feature-settings, font-variant</li>
<li>improved "autofont" capability to select fonts automatically for any script</li>
<li>support for CSS :lang selector</li>
<li>dictionary-based line-breaking for Lao, Thai and Khmer (U+200B is also supported)</li>
<li>separate algorithm for Tibetan line-breaking</li>
</ul>
<p>Note: There are other smart-font technologies around to deal with complex scripts, namely Graphite fonts (SIL International) and Apple Advanced Typography (AAT by Apple/Mac). mPDF 6 does not support these.</p>
<h3>What can OTL Fonts do?</h3>
<p>Support for OTL fonts allows the faithful display of almost all complex scripts:</p>
<ul>
<li>Arabic (<span lang="ar">السلام عليكم</span>), Hebrew (<span lang="he">שלום</span>), Syriac (<span lang="syr">ܐܣܛܪܢܓܠܐ</span>)</li>
<li>Indic - Bengali (<span lang="bn">স্লামালিকুম</span>), Devanagari (<span lang="hi">नमस्ते</span>), Gujarati (<span lang="gu">નમસ્તે</span>), Punjabi (<span lang="pa">ਸਤਿ ਸ੍ਰੀ ਅਕਾਲ</span>),<br />
Kannada (<span lang="kn">ನಮಸ್ತೆ</span>), Malayalam (<span lang="ml">നമസ്തെ</span>), Oriya (<span lang="or">ନମସ୍କର</span>), Tamil (<span lang="ta">வணக்கம்</span>), Telugu (<span lang="te">నమస్కారం</span>)</li>
<li>Sinhala (<span lang="si">ආයුඛෝවන්</span>),
Thai (<span lang="th">สวัสดี</span>),
Lao (<span lang="lo">ສະບາຍດີ</span>),
Khmer (<span lang="km">ជំរាបសួរ</span>),
Myanmar (<span lang="my">မဂႆလာပၝ</span>),<br />
Tibetan (<span lang="bo">བཀྲ་ཤིས་བདེ་ལེགས།</span>)</li>
</ul>
<h4>Joining and Reordering</h4>
<div class="example" lang="bn" style="font-size: 18pt">
র + ্ + খ + ্ + ম + ্ + ক + ্ + ষ + ্ + র + ি + ু =
র্খ্ম্ক্ষ্রিু
</div>
<p>cf. <a href="http://www.microsoft.com/typography/OpenTypeDev/bengali/intro.htm">http://www.microsoft.com/typography/OpenTypeDev/bengali/intro.htm</a></p>
<h4>Ligatures</h4>
<div class="example" style="font-family:\'Dejavu Sans Condensed\'; font-size: 18pt;">
<span style="font-feature-settings:\'liga\' off">ffi ffl fi</span>
<span>ffi ffl fi</span>
</div>
<h4>Language-dependent substitutions</h4>
<div class="example" style="font-family:xbriyaz">
<p lang="ar">Arabic: <span style="font-size: 18pt;">۴ ۶ ٧</span> Urdu: <span style="font-language-override:URD; font-size: 18pt">۴ ۶ ٧</span> Arabic: <span style="font-size: 18pt;">ه ۈ ۑ ە</span> Kurdish: <span lang="ku" style="font-size: 18pt;">ه ۈ ۑ ە</span></p>
</div>
<h4>Font features - Optional substitutions</h4>
Stylistic Alternatives (salt)
<div class="example" style="font-family:xbriyaz">
<p style="font-family:xbriyaz">Arabic: <span style="font-size: 18pt;">ئ ع ک ـه ـهـ ـۀ </span> Farsi: <span lang="fa" style="font-feature-settings:\'salt\'; font-size: 18pt;">ئ ع ک ـه ـهـ ـۀ </span> Arabic: <span style="font-size: 18pt;">گ</span> Turkish: <span style="font-language-override:TRK; font-feature-settings:\'salt\'; font-size: 18pt;">گ</span></p>
</div>
<h4>CSS control of discretionary OTL features</h4>
<div class="example">
salt: (off) <span style="font-size: 15pt; font-family:\'Dejavu Sans Condensed\';">all</span>
(on)
<span style="font-size: 15pt; font-feature-settings:\'salt\' on; font-family:\'Dejavu Sans Condensed\';">all</span>
</div>
<div class="example">
frac: (off) <span style="font-size: 15pt; font-family:\'Free Serif\';">1/4 3/10</span>
(on)
<span style="font-size: 15pt; font-feature-settings:\'frac\' on; font-family:\'Free Serif\';">1/4 3/10</span>
</div>
<div class="example">
zero: (off) <span style="font-size: 15pt; font-family:\'Free Serif\';">1,000</span>
(on)
<span style="font-size: 15pt; font-feature-settings:\'zero\' on; font-family:\'Free Serif\';">1,000</span>
</div>
<div class="example">
onum: (off) <span style="font-size: 15pt; font-family:\'Free Serif\';">0123456789</span>
(on)
<span style="font-size: 15pt; font-feature-settings:\'onum\' on; font-family:\'Free Serif\';">0123456789</span>
</div>
<div class="example">
sups: (off) <span style="font-size: 15pt; font-family:\'Free Serif\';">(32)</span>
(on)
<span style="font-size: 15pt; font-feature-settings:\'sups\' on; font-family:\'Free Serif\';">(32)</span>
</div>
<div class="example">
Stylistic Alternatives (ss03,ss04): (off) <span style="font-size: 18pt; font-family:\'Free Serif\';">अ झ ण झ ९</span>
(on)
<span style="font-size: 18pt; font-feature-settings:\'ss03\' 1, \'ss04\' 1; font-family:\'Free Serif\';">अ झ ण झ ९</span>
</div>
<p>A full list of feature tags is at <a href="http://www.microsoft.com/typography/otspec/featurelist.htm">http://www.microsoft.com/typography/otspec/featurelist.htm</a></p>
<p>In mPDF, the following features are on by default:</p>
<ul>
<li>GSUB features: locl ccmp pref blwf abvf pstf pres abvs blws psts haln rlig calt liga clig mset (all scripts)</li>
<li>GSUB features: isol fina fin2 fin3 medi med2 init nukt akhn rphf rkrf half vatu cjct cfar (for appropriate scripts e.g. Indic, Arabic)</li>
<li>GPOS features: abvm blwm mark mkmk curs cpsp dist requ [kern]</li>
</ul>
<p>NB \'requ\' is not listed in the Microsoft registry of Feature tags; however it is found in the Arial Unicode MS font (it repositions the baseline for punctuation in Kannada script).</p>
<p>Kern is used in some fonts to reposition marks etc. and is essential for correct display, so in mPDF kern is on by default when any non-Latin script is used.</p>
<!--
<h4>Cursive Repositioning</h4>
(using Arabic Typesetting)
<div class="example" style="font-family:\'arabic typesetting\'; font-size: 28pt;">
<span style="font-feature-settings:\'curs\' off;">
ـىݦـ
ﺌﺌﺌﺌﺌﺌﺌﺌﺌﺌ
</span>
<span>
ـىݦـ
ﺌﺌﺌﺌﺌﺌﺌﺌﺌﺌ
</span>
</div>
-->
<h4>Mark repositioning (and diacritics)</h4>
<div class="example" style="font-family: \'Dejavu Sans\'; font-size: 18pt;">
<span style="font-feature-settings:\'mark\' off;">זֵּ יְּ ךָ</span>
‎
<span>זֵּ יְּ ךָ</span>
</div>
<h4>Mark repositioning (and Contextual substitution)</h4>
<div class="example" style="font-family:\'Dejavu Sans Condensed\'; font-size: 18pt;">
<span style="font-feature-settings:\'mark\' off, \'ccmp\' off">Á á ï</span>
<span >Á á ï</span>
</div>
<h4>Complex syllables</h4>
<div>Note that the text displayed is dependent on the font\'s design/capabilities. These are both "correct" representations of the same string, using:</div>
<div class="example">FreeSerif: <span lang="hi" style="font-size: 18pt">र्द्मि</span>
and FreeSans font:
<span style="font-family:FreeSans; font-size: 18pt">र्द्मि</span>
</div>
<p>cf. <a href="http://www.microsoft.com/typography/OpenTypeDev/devanagari/intro.htm">http://www.microsoft.com/typography/OpenTypeDev/devanagari/intro.htm</a><p>
<h4>Complex Typography</h4>
An example which utilises many different GSUB and GPOS features together - first without GSUB and GPOS:
<div class="example" dir="rtl" style="font-family:\'KFGQPC Uthman Taha Naskh\'; font-size: 26pt; font-feature-settings:\'calt\' off, \'liga\' off, \'curs\' off, \'mark\' off, \'mkmk\' off; margin: 0.3em 0em;">
تَسْـَٔمُوٓا۟ أَوْ كَبِيرًا إِلَىٰٓ ٱللَّهِ وَأَدْنَىٰٓ أَلَّا إِلَّآ بَيْنَكُمْ عَلَيْكُمْ أَلَّا يَعْتُمْ ۚ
</div>
With GSUB and GPOS:
<div class="example" dir="rtl" style="font-family:\'KFGQPC Uthman Taha Naskh\'; font-size: 26pt; margin: 0.3em 0em;">
تَسْـَٔمُوٓا۟ أَوْ كَبِيرًا إِلَىٰٓ ٱللَّهِ وَأَدْنَىٰٓ أَلَّا إِلَّآ بَيْنَكُمْ عَلَيْكُمْ أَلَّا يَعْتُمْ ۚ
</div>
<h4>Text Justification using Kashida</h4>
<div class="example" dir="rtl" style="font-family: \'KFGQPC Uthman Taha Naskh\'; font-size: 29pt; ">
يَـٰٓأَيُّهَا ٱلَّذِينَ ءَامَنُوٓا۟ إِذَا
تَدَايَنتُم بِدَيْنٍ
إِلَىٰٓ أَجَلٍۢ مُّسَمًّۭى فَٱكْتُبُوهُ ۚ
</div>
<div class="example" dir="rtl" style="font-family: \'KFGQPC Uthman Taha Naskh\'; font-size: 29pt; text-align: justify;">
يَـٰٓأَيُّهَا ٱلَّذِينَ ءَامَنُوٓا۟ إِذَا
تَدَايَنتُم بِدَيْنٍ
إِلَىٰٓ أَجَلٍۢ مُّسَمًّۭى فَٱكْتُبُوهُ ۚ
</div>
<pagebreak />
<h3>What is "correct"?</h3>
<p>There are a number of factors which determine how the input text is displayed in an application.</p>
<p>The font\'s capabilities/design (this example shows the same text input shown in 2 fonts):</p>
<div class="example">FreeSerif: <span lang="hi" style="font-size: 18pt">र्द्मि</span>
and FreeSans font:
<span style="font-family:FreeSans; font-size: 18pt">र्द्मि</span>
</div>
<p>Complex scripts require a "shaping engine" to re-order glyphs and apply the OTL features by syllable. MS Word and Wordpad run on the Windows platform use "Uniscribe", whereas some browsers such as FireFox and OpenOffice use Pango/HarfBuzz. The different shaping engines (and indeed different versions of them) can produce different results.</p>
<p>Different applications have different defaults (on/off) for some of the features e.g. kerning.</p>
<p>When testing mPDF 6, if text does not appear as you expect, ensure that the font is installed on your computer, and view the HTML in a browser. Also try copying/pasting the text into Wordpad/Word/OpenOffice and ensure that the correct font has been applied.</p>
<p>Note that Wordpad sometimes substitutes a different font if it does not like the one you have chosen, and does not even indicate that the substitution has occurred.</p>
<h3>CSS control of font features</h3>
<p>See <a href="http://www.w3.org/TR/css3-fonts/#font-rend-props">http://www.w3.org/TR/css3-fonts/#font-rend-props</a> for information about CSS3 and font-features.</p>
<p>The following are supported in mPDF 6:</p>
<ul>
<li>font-variant-position</li>
<li>font-variant-caps</li>
<li>font-variant-ligatures</li>
<li>font-variant-numeric</li>
<li>font-variant-alternates - Only [normal | historical-forms] supported (i.e. most are NOT supported)<br />
e.g. stylistic, styleset, character-variant, swash, ornaments, annotation (use font-feature-settings for these)</li>
<li>font-variant - as above, and except for: east-asian-variant-values, east-asian-width-values, ruby</li>
<li>font-language-override</li>
<li>font-feature-settings</li>
</ul>
<p>font-variant-east-asian is NOT supported</p>
<p>NB @font-face is NOT supported</p>
<p>NB @font-feature-values is NOT supported</p>
<p>Note that font-variant specifies a single property in CSS2, whereas in CSS3 it has become a shorthand for all the other font-variant-* properties. <span class="code">font-variant: small-caps</span> was the only one supported in mPDF <v6, and will still work in mPDF 6.</p>
<p>See notes later about font kerning.</p>
<h4>Some examples</h4>
<p class="code">
/* use small-cap alternate glyphs */<br />
.smallcaps { font-feature-settings: "smcp" on; }<br />
<br />
/* convert both upper and lowercase to small caps (affects punctuation also) */<br />
.allsmallcaps { font-feature-settings: "c2sc", "smcp"; }<br />
<br />
/* enable historical forms */<br />
.hist { font-feature-settings: "hist"; }<br />
<br />
/* disable common ligatures, usually on by default */<br />
.noligs { font-feature-settings: "liga" 0; }<br />
<br />
/* enable tabular (monospaced) figures */<br />
td.tabular { font-feature-settings: "tnum"; }<br />
<br />
/* enable automatic fractions */<br />
.fractions { font-feature-settings: "frac"; }<br />
<br />
/* use the second available swash character */<br />
.swash { font-feature-settings: "swsh" 2; }<br />
<br />
/* enable stylistic set 7 */<br />
.fancystyle {<br />
font-family: Gabriola; /* available on Windows 7, and on Mac OS */<br />
font-feature-settings: "ss07";<br />
}
</p>
<pagebreak />
<h3>More Examples</h3>
<p><i>Note the automatic line breaking used in Lao, Thai, Khmer and Tibetan text.</i></p>
SYRIAC - Estrangelo Edessa
<div style="font-family:\'Estrangelo Edessa\'; font-size: 16pt; direction: rtl;">
ܘܬܘܒ ܐܬܟܢܝܬ ܗܕܐ ܕܝܪܐ ܩܕܝܫܬܐ ܒܫܡ ܩܕܝܫܐ ܥܢܘܝܐ ܡܪܝ ܐܘܓܝܢ ܕܐܬܐ ܗ̱ܘܐ ܡܢ ܡܨܪܝܢ ܆ ܥܠ ܒܙܒܢ ܩܪܒܐ ܐܝܬܝܘ ܕܝܪ̈ܝܐ (ܐܝܟ ܬܫܥܝܬܐ ܬܘܕܝܬܢܝܬܐ) ܚܕܟܡܐ ܓܪ̈ܡܐ ܕܩܕܝܫܐ ܡܢ ܕܝܪܐ ܕܡܪܝ ܐܘܓܝܢ ܒܛܘܪܐ ܕ ܐܝܙܠܐ ܕܢܦܠ ܒܡܕܒܪܐ ܕ ܢܨܝܒܝܢ ܥܠ ܬܚܘܡܐ ܕ ܩܡܫܠܝ. ܘܬܘܒ ܐܬܟܢܝܬ ܕܝܪܐ ܕ ܙܥܦܪܐܢ ܐܘ ܟܘܪܟܡܐ ܒܫܡ ܡܪܝ (ܫܠܝܡܘܢ) ܕܝܪܝܐ ܕܫܬܐܣ ܠܕܝܪܐ ܒܫܢܬ 473 ܡ.
</div>
MYANMAR (Burmese)
Padauk Book (SIL Font)
<div style="font-family:\'Padauk Book\'; font-size: 12pt;">
မြန်​မာအခေါ် တရားဝင်​အား​ဖြင့် ပြည်ထောင်​စု သမ္မတ မြန်မာ​နိုင်​ငံတော်သည် အရှေ့တောင်​အာ​ရှတွင် ဧ​ရိ​ယာ​အား​ဖြင့် ဒုတိယ အကျယ်​ဝန်း​ဆုံး[၁] တိုင်း​ပြည် ဖြစ်​သည်။ ၁၉၄၈ ခု​နှစ် ဇန်နဝါရီ ၄ ရက်​တွင် ဂရိတ်​ဗြိ​တိန်​နိုင်ငံထံ​မှ (အင်္ဂလိပ်​လို "Myanmar" အဖြစ်​နှင့်) ပြည်ထောင်​စု​မြန်မာ​နိုင်​ငံတော်​အဖြစ် လွတ်လပ်​ရေး​ကို ရ​ရှိ​ခဲ့​သည်။ နောက်​ပိုင်း​တွင် ပြည်ထောင်​စု ဆို​ရှယ်​လစ် သမ္မတ​မြန်မာ​နိုင်​ငံတော်​အဖြစ် ၁၉၇၄ ခု​နှစ် ဇန်နဝါရီ ၄ ရက်​တွင်​လည်းကောင်း၊ ပြည်ထောင်​စု မြန်မာ​နိုင်​ငံတော်​အဖြစ် ၁၉၈၈ခု​နှစ် စက်တင်ဘာ ၂​၃ ရက်​တွင်​လည်းကောင်း၊ ပြည်ထောင်​စု မြန်မာ​နိုင်​ငံတော်​အဖြစ် ၁၉၈၉ ခု​နှစ် ဇွန် ၁​၈ ရက်​တွင် လည်းကောင်း အမည်​များ​ပြောင်းလဲ​ခဲ့​သည်။ အာဏာ​ရ​စစ်​အစိုးရ​အား အသိ​အမှတ် မ​ပြု​သော အဖွဲ့​အစည်း​များ​က ဘား​မား ("Burma") ဟု​သာ အသိ​အမှတ်ပြု​ သုံးစွဲခဲ့​​သည်။ နိုင်​ငံတော်​အလံကိုလည်း ယခင် နိုင်ငံတော် အေးချမ်းသာယာရေးနှင့် ဖွံ့ဖြိုးရေးကောင်စီအစိုးရ​လက်ထက် ၂​၀⁠၀​၈ ခု​နှစ် ဖွဲ့​စည်း​ပုံ အခြေ​ခံ ဥပဒေတွင် ပြဋ္ဌာန်း​ထား​သည့် ပြည်ထောင်​စု သမ္မတ မြန်မာ​နိုင်​ငံတော်​အလံ ဖြင့် ၂​၀​၁​၀ ခု​နှစ် အောက်တိုဘာ​လ ၂​၁ ရက်​နေ့​တွင် အလံစတင်​လွှင့်​ထူ​ခြင်း အခမ်းအနား​များ​ကို နိုင်ငံ​တ​ဝှမ်း ကျင်းပ​ကာ အစားထိုး၍ ပြောင်းလဲ အသုံးခဲ့ပြု​သည်။
</div>
KHMER
<div style="font-family:\'Khmer OS\'; ">
ង្គ្រ
ន្រ្តី
ង្គ្រោះ
</div>
<div style="font-family:\'Khmer OS\'; ">
យុវជន​ម្នាក់​បាន​ស្លាប់​ដោយ​គ្រាប់កាំភ្លើង​របស់​ប៉ូលិស និង​បីនាក់​ផ្សេងទៀត​រងរបួស នៅក្នុង​ការប្រឈម​មុខ​ដាក់គ្នា​ដាច់ដោយឡែក​គ្នាមួយ រវាង​ក្រុម​យុវជន​មួយ​ក្រុម ជាមួយ​ប៉ូលិស នៅ​ម្តុំ​ស្ពាន​ក្បាលថ្នល់។ នេះ​បើតាម​ព័ត៌មាន​ពី​លោក​ ចាន់ សាវ៉េត មន្រ្តី​ស៊ើបអង្កេត​របស់​អង្គការ​សិទ្ធិមនុស្ស​អាដហុក ដែល​វត្តមាន​នៅ​កន្លែង​កន្លែង​កើតហេតុ នៅ​យប់​ថ្ងៃ​អាទិត្យ​ទី ១៥ កញ្ញានេះ។
</div>
HEBREW - with Niqud and T\'amim (cantillation)
<div dir="rtl" style="font-size: 14pt; font-family: \'Taamey David CLM\'">
לָכֵ֤ן חַכּוּ־לִי֙ נְאֻם־יְהוָ֔ה לְי֖וֹם קוּמִ֣י לְעַ֑ד כִּ֣י מִשְׁפָּטִי֩ לֶאֱסֹ֨ף גּוֹיִ֜ם לְקָבְצִ֣י מַמְלָכ֗וֹת לִשְׁפֹּ֨ךְ עֲלֵיהֶ֤ם זַעְמִי֙ כֹּ֚ל חֲר֣וֹן אַפִּ֔י כִּ֚י בְּאֵ֣שׁ קִנְאָתִ֔י תֵּאָכֵ֖ל כָּל־הָאָֽרֶץ׃
</div>
NKo
<div style="font-family:DejaVuSans; font-size: 12pt; direction: rtl">
ߟߐ߬ߝߋ߲ ߓߍ߯ ߟߊߝߋ߲ ߊߡߋߙߌߞ ߒߞߏ ߘߌ߲ߞߏ ߓߍ߮ ߛߎ߬ߣߎ߲ߣߌ߲ ߠߋ ߊ߲ ߞߊ߬ߙߊ߲߬ߡߐ߯ ߓߎߓߊߞߊ߯ߙߌ߫ ߖߊ߬ߞߌ߬ߕߋ߫ ߝߊ߬ ߟߊ߫ ߛߏߡߊߦߟߍߡߊ߲ ߠߊ߫ ߑ ߫ߊ߲ ߓߍ߮ ߡߊ߬ߙߌ ߫ ߘߊߟߌߟߊ߫ ߊ߬ ߦߊߝߊ ߞߍ߫ ߊ߬ ߡߊ߬ ߸ ߞ߬߭ ߊ߬ ߟߊߦߙߐ ߛߎߡߊ ߊ߲ ߠߊ߫ ߘߎߓߊ ߦߋ ߕߊߓߊ߯ߕߐ߫ ߓߍ߯ ߦߋ ߫ ߊߟߊ߬ߡߊ ߤߌߣߊ߫ ߘ߭ߵߊߟߎ ߓߍ߯ ߟߊ߬
</div>
THAANA
<div style="font-family:\'Free Serif\'; font-size: 18pt; direction: rtl;">
ދިވެހި ވިކިޕީޑިއާ ގައި ބޭނުންކުރެވޭ ބަސްތައް އެއްގޮތަށް ދެމެހެއްޓޭތޯ މަސައްކަތް ކުރުން
މިސާލަކަށް ޗައިނާ އަށް ސީނުކަރަ އިންޑިޔާ އަށް ހިންދުސްތާން، އަދި ސްރީލަންކާ އަށް އޮޅުދޫކަރަ ކިޔާކިޔުން ދާއިމީ ގޮތެއްގައި ހިފެހެއްޓުމަށް މަސައްކަތްކުރުން! މާނައަކީ އެއްތަނެއްގައި ސީނުކަރަ އަނެއް ތަނެއްގައި ޗައިނާ މިގޮތަށް ބޭނުން ނުކުރުން، އަދި މިނޫން މިފަދަ ބަސްތައް ވެސް މިއުޞޫލާ ޚިލާފުނުވާނޭ ގޮތަށް ބޭނުންކުރުން!
ދިވެހި ވިކިޕީޑިއާގެ ތެރެއިން ދިވެހި ބަސް ކުރިއެރުވުމަށް މަސައްކަތް ކުރުން
</div>
LAO
<div style="font-family:Dhyana; font-size: 12pt;">
ສາທາລະນະລັດ ປະຊາທິປະໄຕ ປະຊາຊົນລາວ (ຄຳເຄົ້າ: ສາທາຣນຣັຖປຊາທິປຕັຍປຊາຊົນລາວ[໑]) ຫຼື ສປປ ລາວ ຕັ້ງຢູ່ທິດຕາເວັນອອກສຽງໃຕ້ຂອງທະວີບອາຊີ, ຢູ່ໃຈກາງຂອງແຫຼມອິນດູຈີນລະຫວ່າງເສັ້ນຂະໜານທີ 14 - 23 ອົງສາເໜືອ ແລະ ເສັ້ນແວງທີ 100-108 ອົງສາ ສປປ ລາວມີເນື້ອທີ່ທັງໝົດ 236.800 ຕາລາງກິໂລແມັດ ເປັນປະເທດທີ່ບໍ່ມີທາງອອກສູ່ທະເລ, ມີຊາຍແດນຕິດກັບ ສາທາລະນະລັດປະຊາຊົນຈີນ (505 ກິໂລແມັດ), ທິດໃຕ້ຕິດກັບລາຊະອານາຈັກກຳປູເຈຍ (435 ກິໂລແມັດ), ທິດຕາເວັນອອກຕິດກັບ ສາທາລະນະລັດສັງຄົມນິຍົມຫວຽດນາມ ( 2.069 ກິໂລແມັດ ), ທິດຕາເວັນຕົກຕິດກັບລາຊະອານາຈັກໄທ ( 1.385 ກິໂລແມັດ ), ແລະ ທິດຕາເວັນຕົກສຽງເໜືອຕິດກັບ ສາທາລະນະລັດແຫ່ງສະຫະພາບມຽນມາ ( 236 ກິໂລແມັດ ), ສ.ປ.ປ.ລາວ ເປັນປະເທດດຽວໃນພາກພື້ນນີ້ທີ່ບໍ່ມີຊາຍແດນຕິດກັບທະເລ.
</div>
THAI
<div style="font-family:Garuda; font-size: 12pt;">
"ซัมติง" เป็นเพลงของวงเดอะบีตเทิลส์ ในปี ค.ศ. 1969 เป็นเพลงที่บรรจุอยู่ในอัลบั้มชุด แอบบีโรด เพลงนี้เป็นเพลงแรกที่ซิงเกิลหน้าเอที่จอร์จ แฮร์ริสันเขียน และถือเป็นซิงเกิลแรกของเดอะบีตเทิลส์ที่มีเพลงที่มีอยู่แล้วในอัลบั้มบรรจุอยู่ด้วย ทั้งเพลง "ซัมติง" และเพลง "คัมทูเกตเตอร์" ที่อยู่ในอัลบั้ม แอบบีโรด และเพลง "ซัมติง" ถือเป็นเพลงเดียวที่แฮร์ริสันแต่งแล้วขึ้นอันดับ 1 บนชาร์ตอเมริกันขณะที่ยังอยู่ในวงเดอะบีตเทิลส์
</div>
SINHALA
<div style="font-family:KaputaUnicode; font-size: 14pt;">
නඩත්තු කාර්යයන් විකිපීඩියාව ප්‍රශස්ත මට්ටමකින් පවත්වා ගැනීම සදහා අත්‍යවශ්‍ය අංගයකි. උපදෙස් රූරාව මගින් තවත් අලුත් නඩත්තු කාර්යයන් තැනීමේදී පරිස්සම් විය යුතුය. ඔබට හැකි විට සංවිධානාත්මක වන්න, එහෙත් සෑමවිටම විශාල පින්තූරය ඇතුලතින් තබා ගන්න: අප මෙතැනට පැමිණ සිටින්නේ විශ්වකෝෂයක් තැනීම සදහායි. ඔබ සිතන්නේ නඩත්තු කිරීම්වලට වඩා අනෙකුත් පැතිවලින් විකිපීඩියාවට දායක වීමට නම්, කරැණාකර විකිපීඩියා:විකිපීඩියාවට දායක වීම බලන්න. ඉක්මනින් අවශ්‍ය සහ ඉතා වැදගත් වන කාර්යයන් විකිපීඩියා:අතපසු වූ වැඩ හීදි සොයාගැනීමට අවස්ථාව ඇත.
</div>
TIBETAN
<div style="font-family:Jomolhari; font-size: 16pt;">
༄།ཏདྱཐཱ།ཨོཾགཏེགཏེཔཱརགཏེཔཱརསཾགཏེབོདྷིསྭཱཧཱ།
ཨོཾམུནིམུནིམཧཱམུནིཡེསྭཱཧཱ།ཨོཾཨཱམིདྷེཝཱཧྲཱི།ཨོཾམཎིཔདྨེཧཱུཾ།ཨོཾཨཱཿཧཱུཾ་
བཛྲགུརུཔདྨསིདྡྷིཧཱུཾ།ཨོཾཨཱམརཱཎིཛྲིཝནཏིཡེསྭཱཧཱ།ཨོཾཝགིཤཱརིམུཾ།ཨོཾ་
མཎིཔདྨེཧཱུཾ།ཨོཾབཛྲཔཱནིཧཱུཾ།ཨོཾཏཱརེཏུཏྟཱརེཏུརེསྭཱཧཱ།ཨོཾབྷྲཱུཾ་
སྭཱཧཱ།ཨོཾཨཱམྲིཏཱཨཱཡུརྡདེསྭཱཧཱ།ཨོཾམརིཙྱེམཾསྭཱཧཱ།
</div>
TAI THAM
<div style="font-family:\'lanna alif\'; font-size: 16pt">
ᨢ᩶ᩣᨧᩮᩢ᩶ᩣᨸᩮᩢ᩠ᨶᩈᩣ᩠ᩅᨩ᩠ᨿᨦᩉ᩠ᨾᩲ᩵ ᩉ᩠ᨾᩯᨷᩴ᩵ᩬᨴᩮᩢ᩵ᩣᨯᩲᨠᩴ᩶ᩬᨧᩡᨸᩮᩢ᩠ᨶᩈᩣ᩠ᩅᩃᩯ᩠᩶ᩅ ᨲᩧ᩠ᨦᩅᩢ᩠ᨶᨾᩦᨷ᩵ᩤ᩠ᩅᨾᩣᩋᩯ᩠᩵ᩅ
ᨾᩣᩋᩪ᩶ᨾᩣᨪᩯ᩠ᩅ ᨸᩮᩢ᩠ᨶᨤᩫ᩠ᨶᩃᨻᩪᩁ ᨢ᩶ᩣᨧᩮᩢ᩶ᩣᨧᩡᩮᩃᩥᩬᨠᩋᩮᩢᩣᨹᩱ ᩋ᩶ᩣ᩠ᨿᨷ᩵ᩤ᩠ᩅᨩ᩠ᨿᨦᩁᩣ᩠ᨿᨩᩨ᩵ᨠᩯ᩠᩶ᩅᨾᩣᩃᩪᩁ ᩋ᩶ᩣ᩠ᨿᨠᩬᨦᨤᩫ᩠ᨶᨻᩯ᩵ᨢ᩠ᨿᩅᨨᩩᨶ ᩋ᩶ᩣ᩠ᨿᨤᩴᩣᩋ᩶ᩣ᩠ᨿᨾᩪᩁ ᩋ᩶ᩣ᩠ᨿᩈᩫ᩠ᨾᩋ᩶ᩣ᩠ᨿᨾᩦ ᨻᩮᩥ᩠᩵ᨶᨷᩬᨠᩅ᩵ᩤᨧᩡᨾᩣᨢᩴᩬᨢ᩶ᩣᨧᩮᩢ᩶ᩣᨠᩴᩬᩁᩴᩬᨾᩣᩃᩯ᩠᩶ᩅᨸᩮᩢ᩠ᨶᨸᩦ
</div>
<pagebreak odd-footer-name="myHTMLbengali" odd-footer-value="1" even-footer-name="myHTMLbengali" even-footer-value="1" pagenumstyle="bengali" />
<h3>Dictionary Line breaking</h3>
<p>Lao, Thai and Khmer text does not have space between words. By default, mPDF 6 uses word dictionaries to determine appropriate opportunites for line-breaks. Users may turn this function off using the configurable variable <span class="code">useDictionaryLBR</span>.</p>
<p>Alternatively users can insert the character U+200B (zero-width space) in the text to mark line-breaking opportunities manually.</p>
<p>Similarly for Tibetan script, mPDF 6 uses a simple algorithm to identify line-breaking opportunities after the characters U+0F0B (Tsheg) or U+0F0D. This can be overriden using the configurable variable <span class="code">useTibetanLBR</span>.</p>
<h3>Myanmar Fonts</h3>
<p>Myanmar (Burmese) on the web is quite frequently written for fonts which are not strictly unicode-compliant. This includes common applications such as WordPress and a number of official Burmese government websites.</p>
<p>Ayar fonts (http://www.ayarunicodegroup.org) are based on text input where the vowel preceeds the consonant (which is contrary to Unicode specification).
</p>
<p>ZawGyi-One is another very common font in use. This font has some characters incorrectly coded e.g. U+103A as U+1039.</p>
<p>There are also fonts available which are fully unicode compliant, such as Padauk, Tharlon, Myanmar3, and Microsoft\'s Myanmar Text.</p>
<p>As long as you select the right font for the input text, all of them work fine in mPDF:</p>
<p class="example" style="font-family: Tharlon; margin-bottom:0;">Tharlon: ဒီရက်ပိုင်းမှာ ဧရာဖောင့်ကို ယူနီကုဒ်အဖြစ် ရည်ညွှန်းပြောဆိုနေကြတာ တွေ့ရလို့ ဧရာဟာ ယူနီကုဒ် မဖြစ်ကြောင်းနဲ့ ဘာလို့မဖြစ်ရတာလဲဆိုတာ အတိုပဲ ရှင်းပါမယ်။ ယူနီကုဒ်ဖြစ်ဖို့ - ၁။ ယူနီကုဒ် ကုဒ်ပွိုင့်နဲ့ ကိုက်ညီရပါမယ်။
၂။ ယူနီကုဒ် စာလုံးစီပုံ (Encoding) နဲ့ ကိုက်ညီရပါမယ်။</p>
<div style="font-size: 0.85em">from http://www.myanmarlanguage.org/unicode</div>
<p class="example" style="font-family: zawgyi-one; margin-bottom:0;">Zawgyi-one: စီးပြားေရးနွင့္ကူးသန္းေရာင္းဝယ္ေရးဝန္ၾကီးဌာန ျပည္ေထာင္စုဝန္ၾကီး မႏၱေလးတုိင္းေဒသၾကီး ေက်းလက္ေဒသ အေသးစား ကုန္ထုတ္လုပ္ငန္းမ်ား ၾကည့္ရွဳအားေပး
</p>
<div style="font-size: 0.85em">from http://www.commerce.gov.mm/</div>
<p class="example" style="font-family: ayar; margin-bottom:0;">Ayar: WordPress တရားဝင် ြမန်မာဘာသာ စာမျက်နှာမှ ြကိုဆိုပါတယ်။ !
ရာနှုန်းြပည့် ဘာသာြပန်ထားသည့် WordPress ြမန်မာ ဘာသာြပန်မူကို ဗားရှင်း ၃.၁ ြဖင့် စတင် ြဖန့်ချိလိုက်ြပီးသည့်ေနာက် ဆက်လက်၍ အဆင့်ြမှင့်တင်မှု ဗားရှင်းများကို အချိန်နှင့်တစ်ေြပးညီ
</p>
<div style="font-size: 0.85em">from https://mya.wordpress.org/</div>
<h3>lang selector</h3>
<p>mPDF 6 supports use of the lang selector in CSS. All of the following are supported:</p>
<ul>
<li>:lang(fr)</li>
<li>p:lang(fr)</li>
<li>span:lang("syr")</li>
<li>[lang="fr"]</li>
<li>[lang=\'fr\']</li>
<li>p[lang=fr]</li>
<li>p[lang="zh-TW"]</li>
</ul>
<p>Note: [lang=zh] will match lang="zh-TW" and lang="zh-HK"</p>
<p>Limitation: class selectors and attribute selectors should be of equal specificity in CSS specification e.g.
<p class="code">
:lang(syr) { color: blue; }<br />
.syriac { color: red; }
</p>
<p>should be of equal specificity, and thus apply whichever comes later in the CSS stylesheet. mPDF 6 however gives :lang priority over .class</p>
<p><b>The use of the lang attribute and CSS selector is now the recommended method for handling multi-lingual documents in mPDF 6.</b></p>
<h3>lang HTML attribute</h3>
<p>The HTML lang attribute has a number of uses:</p>
<ul>
<li>when OTL tables are being used for a font, the language from the lang attribute is used to select which OTL features are applied;</li>
<li>used in conjunction with CSS lang selector to allow CSS styles to be applied;</li>
<li>can be used in conjunction with <span class="code">autoLangToFont</span> and <span class="code">autoScriptToLang</span> (see below)</li>
</ul>
<p>IETF tags should be used for lang which comply with the following:</p>
<ul>
<li>a 2 or 3 letter Language code, followed optionally by</li>
<li>a hyphen and a 4 letter Script code, and or</li>
<li>a hyphen and a 2 letter Region code</li>
<li>i.e. [xx|xxx]{-Xxxx}{-XX}</li>
<li>mPDF deals with IETF tags as case insensitive</li>
</ul>
<pagebreak />
<h3>Automatic font selection</h3>
<p><i>Note: This functionality of mPDF has changed considerably in mPDF v6 and is not backwards compatible.</i></p>
<p>mPDF 6 has two functions which can be used together or separately:</p>
<p><span class="code">autoScriptToLang</span> - marks up HTML text using the lang attribute, based on the Unicode script block in question, and configurable values in <span class="code">config_script2lang.php</span>.</p>
<p><span class="code">autoLangToFont</span> - selects the font to use, based on the HTML lang attribute, using configurable values in <span class="code">config_lang2font.php</span>.</p>
<p>For automatic font selection, ideally we would choose the font based on the language in use. However it is actually impossible to determine the language used from a string of HTML text. The Unicode script block can be ascertained, and sometimes this tells us the language e.g. Telugu. However, Cyrillic script is used for example in many different languages. So the best we can do is base it on the script used. However, mPDF 6 does this in two stages via the "lang" attribute, because this allows the options of using either of the stages alone or together:</p>
<div style="text-align: center;">
<p class="code"><p>English ру́сский язы́к <span lang="ps">پښتو</span></p></p>
<p>↓ <b>autoScriptToLang</b> (config_script2lang.php) ↓</p>
<p class="code"><p>English <span lang="und-Cyrl">ру́сский язы́к</span> <br />
<span lang="ps"><span lang="ps">پښتو</span></span></p></p>
<p>↓ <b>autoLangToFont</b> (config_lang2fonts.php) ↓</p>
<p class="code">Uses "lang" to select font, and to determine OTL features applied</p>
</div>
<h4>autoScriptToLang</h4>
<p class="code">
$mpdf->autoScriptToLang = true;<br />
$mpdf->baseScript = 1;<br />
$mpdf->autoVietnamese = true;<br />
$mpdf->autoArabic = true;
</p>
<p><span class="code">$mpdf->baseScript = 1;</span> tells mPDF which Script to ignore. It is set by default to "1" which is for Latin script. In this mode, all scripts <i>except</i> Latin script are marked up with "lang" attribute. To select other scripts as the base, see the file /classes/ucdn.php</p>
<p>Using autoScriptToLang, mPDF detects text runs based on Unicode script block; using the values in <span class="code">config_script2lang.php</span> it then encloses the text run within a span tag with the appropriate language attribute. For many scripts, the language cannot be determined: see the example above which recognises Cyrillic script and marks it up using und-Cyrl, which is a valid IETF tag, coding for language="undetermined", script="Cyrillic".</p>
<p>Two optional refinements are added: Vietnamese text can often be recognised by the presence of certain characters which do not appear in other Latin script langauges, and similarly analysis of the text can attempt to distinguish Arabic, Farsi, Pashto, Urdu and Sindhi. If active, the text will then be marked with a specific language tag e.g. "vi", "pa", "ur", "fa" etc.</p>
<p>These features can be disabled or enabled (default) using the variables <span class="code">$mpdf->autoVietnamese</span>
<span class="code">$mpdf->autoArabic</span>, either in config.php or at runtime.</p>
<pagebreak />
<h4>autoLangToFont</h4>
<p class="code">
$mpdf->autoLangToFont = true;
</p>
<p>You can edit the values in <span class="code">config_lang2font.php</span> to specify which fonts are used for which "lang".</p>
<h4>Using text with multiple languages</h4>
<p>Recommended ways to use multiple languages in mPDF:</p>
<ol>
<li>If you have full control over the HTML, mark-up the text with the "lang" atribute and use CSS (:lang selector preferably); this method means that the language information can also be used by OTL for language dependent substitutions.</li>
<li>If you have no control over (user) HTML input and want to output faithfully, use both autoScriptToLang and autoLangToFont</li>
</ol>
<p>It is preferable not to use autoScriptToLang and autoLangToFont unless they are necessary: they will result in increased processing time, and OTL tables will not be able to use language dependent substitutions when undefined languages are set e.g "und-Cyrl".</p>
<h4>Updating from previous mPDF versions</h4>
<p>As a brief summary, to update from previous versions of mPDF:<br />
Use $this->autoScriptToLang=true instead of $this->SetAutoFont()<br />
Use $this->autoLangToFont instead of $this->useLang
</p>
<h3>Bidi Bidirectional text</h3>
<p>The algorithm to handle bi-directional text (right to left) has been completely rewritten. Text is now processed across the whole paragraph ignoring inline tags. There is also full support for the methods to control/override the display.</p>
<p>1) The following Unicode characters are supported, and can be inserted directly in the text as HTML entities:</p>
<table style="font-size:85%">
<tr>
<td>LRE</td><td>U+202A</td><td>LEFT-TO-RIGHT EMBEDDING</td><td>&#x202A;</td>
</tr>
<tr>
<td>RLE</td><td>U+202B</td><td>RIGHT-TO-LEFT EMBEDDING</td><td>&#x202B;</td>
</tr>
<tr>
<td>LRO</td><td>U+202D</td><td>LEFT-TO-RIGHT OVERRIDE</td><td>&#x202D;</td>
</tr>
<tr>
<td>RLO</td><td>U+202E</td><td>RIGHT-TO-LEFT OVERRIDE</td><td>&#x202E;</td>
</tr>
<tr>
<td>PDF</td><td>U+202C</td><td>POP DIRECTIONAL FORMATTING</td><td>&#x202C;</td>
</tr>
<tr>
<td></td><td></td><td></td><td></td>
</tr>
<tr>
<td>LRI</td><td>U+2066</td><td>LEFT-TO-RIGHT ISOLATE</td><td>&#x2066;</td>
</tr>
<tr>
<td>RLI</td><td>U+2067</td><td>RIGHT-TO-LEFT ISOLATE</td><td>&#x2067;</td>
</tr>
<tr>
<td>FSI</td><td>U+2068</td><td>FIRST STRONG ISOLATE</td><td>&#x2068;</td>
</tr>
<tr>
<td>PDI</td><td>U+2069</td><td>POP DIRECTIONAL ISOLATE</td><td>&#x2069;</td>
</tr>
<tr>
<td></td><td></td><td></td><td></td>
</tr>
<tr>
<td>LRM</td><td>U+200E</td><td>LEFT-TO-RIGHT MARK</td><td>&#x200E;</td>
</tr>
<tr>
<td>RLM</td><td>U+200F</td><td>RIGHT-TO-LEFT MARK</td><td>&#x200F;</td>
</tr>
</table>
<p>2) The following HTML tags are supported:
<ul>
<li><bdo> (NB the "dir" attribute is mandatory on <bdo>)</li>
<li><bdi> (HTML5)</li>
</ul>
</p>
<p>3) The CSS property "unicode-bidi" is supported with the following (CSS3) values: normal | embed | isolate | bidi-override | isolate-override | plaintext.
<br />
See <a href="http://www.w3.org/TR/css3-writing-modes/#unicode-bidi">http://www.w3.org/TR/css3-writing-modes/#unicode-bidi</a>
for more details.
<br />
"unicode-bidi" is supported on block level elements as well as in-line elements, but note that:
<ul><li>the value is not inherited to child blocks</li>
<li>using "embed" or "isolate" has no effect on block level boxes</li>
<li>"isolate-override" is equivalent to "bidi-override" on block level boxes</li>
</ul>
</p>
<p>NB dir="auto" is not supported generally, but it is supported for <bdi> (has the same effect as if omitted) to use First Strong Isolate (FSI).</p>
<p>Directionality can now be set on individual table cells <td style="direction:rtl;unicode-bidi:embed;"> or <td dir="rtl"></p>
<h4>Equivalent methods</h4>
<p>The following are equivalent methods:</p>
<table>
<tr>
<td>
EMBED
</td></tr>
<tr><td class="code">
<span dir="rtl">...</span><br />
&#x202B;...&#x202C;<br />
<span style="direction: rtl; unicode-bidi: embed">...</span>
</td></tr>
<tr><td>
OVERRIDE
</td></tr>
<tr><td class="code">
<bdo dir="rtl">...</bdo><br />
&#x202E;...&#x202C;<br />
<span dir="rtl" style="unicode-bidi: bidi-override">...</span><br />
<span style="direction: rtl; unicode-bidi: bidi-override">...</span>
</td></tr>
<tr><td>
ISOLATE
</td></tr>
<tr><td class="code">
<bdi dir="ltr">...</bdi><br />
&#x2067;...&#x2069;<br />
<span dir="rtl" style="unicode-bidi: isolate">...</span><br />
<span style="direction: rtl; unicode-bidi: isolate">...</span>
</td></tr>
<tr><td>
First Strong Isolate (FSI)
</td></tr>
<tr><td class="code">
<bdi>...</bdi><br />
<bdi dir="auto">...</bdi><br />
&#x2068;...&#x2069;<br />
<span dir="rtl" style="unicode-bidi: plaintext">...</span><br />
<span style="direction: rtl; unicode-bidi: plaintext">...</span><br />
</tr>
</table>
<h4>First strong isolate (FSI)</h4>
<p>FSI is useful when including text within a paragraph where the directionality of the text is unknown. For example, if you are printing out a catalogue from a database of book titles and the number of readers, when some book titles are in right-to-left script, you may use this template:</p>
<p class="code">
<li>Title: {TITLE} - {READERS} readers</li>
</p>
<p>This would result in the following:</p>
<ul>
<li style="font-family: freesans; direction: ltr;">Title: Alice in Wonderland - 12390 readers</li>
<li style="font-family: freesans; direction: ltr;">Title: עליסה בארץ הפלאות, סיפור-ילדים מאת לואיס קרול - 17890 readers</li>
</ul>
<p class="code">
<li>Title: <bdi>{TITLE}</bdi> - {READERS} readers</li>
</p>
<p>Using BDI will result in the following:</p>
<ul>
<li style="font-family: freesans; direction: ltr;">Title: <bdi>Alice in Wonderland</bdi> - 12390 readers</li>
<li style="font-family: freesans; direction: ltr;">Title: <bdi>עליסה בארץ הפלאות, סיפור-ילדים מאת לואיס קרול</bdi> - 17890 readers</li>
</ul>
<h3>Kerning</h3>
<p>Kerning is a bit complicated! CSS3 allows for 2 methods of specifying kerning. In mPDF 6, these 2 methods have exactly the same effect:</p>
<ul>
<li>font-kerning: normal;</li>
<li>font-feature-settings: \'kern\' on;</li>
</ul>
<p>TrueType fonts allow for 2 possible ways of including kerning data:</p>
<ul>
<li>OTL GPOS table may contain kerning information</li>
<li>A separate kern table</li>
</ul>
<p>Most fonts contain both or none, but they may exist independently.</p>
<p>If kerning is set to be active (by either of the CSS methods):</p>
<ul>
<li>if the useOTL value means that OTL GPOS tables are applied, then this method will be used;</li>
<li>if not, then the separate kern table will be used - if it exists.</li>
</ul>
<p>In Latin script, kerning will only be applied if specified by CSS. The configurable variable <span class="code">useKerning</span> determines behaviour if <span class="code">font-kerning: auto</span> is used (the default).</p>
<p>When using OTL tables, kerning is set to be on by default for non-LATIN script; this is because a number of fonts use information in the kern feature to reposition glyphs which are essential for correct display in complex scripts.</p>
<p><i>Limitation: if useOTL is set, but not for Latin script (e.g. = 0x02), and the text string contains more than one script, then kerning will not be applied to the Latin script text e.g. <span style="font-kerning:normal">[Cyrillic text][Latin text][Cyrillic text]</span>. This is because mPDF uses the presence of any repositioning applied to determine if kerning has been applied, otherwise using the alternative kern tables.</i></p>
<h3>Small-Caps</h3>
<p>Small Caps should be selected using:</p>
<p class="code">
<p style="font-variant-caps:small-caps">This is in small caps</p>
</p>
<p>and will appear as: <span style="font-variant-caps:small-caps">This is in small caps</span></p>
<p>Note: <span class="code">font-variant:small-caps</span> will also be recognised as font-variant is now considered the shorthand version cf. above.</p>
<p>If the font has useOTL enabled (to any value), and the font OTL tables contain the "smcp" feature, then the OTL feature will be used to substitute purpose-designed glyphs from the font. Otherwise, mPDF generates small capitals as in previous version.</p>
<h3>Superscript and Subscript</h3>
<p class="code">
<p>This is in <span style="font-variant-position:super">superscript</span></p>
</p>
<p>will appear as superscript (only) if the font is OTL-capable and contains specific glyphs for superscript.<p>
<p>Note that font-variant:super will also be recognised as font-variant is now considered the shorthand version cf. above.</p>
<p>If the font has useOTL enabled (to any value), and the font OTL tables contain the "sups" feature, then the OTL feature will be used to substitute purpose-designed glyphs from the font.</p>
<p>The same for subscript using <span class="code">font-variant-position:sub</span>. </p>
<p>If you wish to use a superscript/subscript which will work with any font, continue to use the tags <sup> and <sub> which (through the default CSS in config.php) will generate superscript using CSS vertical-align=super and font-size=55%.</p>
<h3>How to use OTL in mPDF</h3>
<p>In <span class="code">config_fonts.php</span> there are 2 new variables which affect OTL features e.g.:</p>
<p class="code">
"dejavusanscondensed" => array(<br />
\'R\' => "DejaVuSansCondensed.ttf",<br />
\'B\' => "DejaVuSansCondensed-Bold.ttf",<br />
\'I\' => "DejaVuSansCondensed-Oblique.ttf",<br />
\'BI\' => "DejaVuSansCondensed-BoldOblique.ttf",<br />
<span style="color: #880000;">\'useOTL\' => 0xFF,<br />
\'useKashida\' => 75,</span><br />
),
</p>
<p>mPDF is published with a large collection of fonts, and all configured to use their full OTL capabilities.</p>
<h4>useOTL</h4>
<p>useOTL should be set to an integer between 0 and 255. Each bit will enable OTL features for a different group of scripts:</p>
<table>
<tr><td>Bit</td> <td>dec</td> <td>hex</td> <td>Enabled</td></tr>
<tr><td>1</td> <td>1</td> <td>0x01</td> <td>GSUB/GPOS - Latin script</td></tr>
<tr><td>2</td> <td>2</td> <td>0x02</td> <td>GSUB/GPOS - Cyrillic script</td></tr>
<tr><td>3</td> <td>4</td> <td>0x04</td> <td>GSUB/GPOS - Greek script</td></tr>
<tr><td>4</td> <td>8</td> <td>0x08</td> <td>GSUB/GPOS - CJK scripts (excluding Hangul-Jamo)</td></tr>
<tr><td>5</td> <td>16</td> <td>0x10</td> <td>(Reserved)</td></tr>
<tr><td>6</td> <td>32</td> <td>0x20</td> <td>(Reserved)</td></tr>
<tr><td>7</td> <td>64</td> <td>0x40</td> <td>(Reserved)</td></tr>
<tr><td>8</td> <td>128</td> <td>0x80</td> <td>GSUB/GPOS - All other scripts (including all RTL scripts, complex scripts etc)</td></tr>
</table>
<p>Setting useOTL to 0 (or omitting it) will disable all OTL features. Setting useOTL to 255 or 0xFF will enable OTL for all scripts. Setting useOTL to 0x82 will enable OTL features for Cyrillic and complex scripts.</p>
<p>In a font like Free Serif, it may be useful to enable OTL features for complex scripts, but disable OTL for Latin scripts (to save processing time). However, see above - this may disable kerning in Latin scripts in certain circumstances.</p>
<h4>useKashida</h4>
<p>useKashida should be set for arabic fonts if you wish to enable text justification using kashida. The value should be an integer between 0 and 100 and represents the percentage of additional space required to justify the text on a line as a ratio of kashida/inter-word spacing.</p>
<h4>Choosing fonts to add to mPDF 6</h4>
<p>Fonts with OTL need to have GDEF, GSUB and GPOS tables in the font file. Although TrueType font files are binary files, the table names and script/feature tags are written as ASCII characters; open the .ttf or .otf file in a text editor such as Windows Notepad, and you will see GDEF, GSUB and GPOS in the first few lines if they are present. You can also search the file to see if the script tags are present for your desired scripts cf. <a href="http://www.microsoft.com/typography/otspec/scripttags.htm">http://www.microsoft.com/typography/otspec/scripttags.htm</a>.</p>
<p>Note: The OTL specification for Indic fonts was updated in 2005 to version 2. The v2 script tag for Bengali is "bng2" whereas prior to this it was "beng". Many open-source font files are still written for the old specification. This is supported by mPDF, although v2 fonts give better results.</p>
<p>Note: mPDF does not support Graphite or AAT font features.</p>
<h4>Configuring new fonts for mPDF 6</h4>
<p>To add a font, first copy the font file to the /ttfonts/ folder.</p>
<p>Then edit config_fonts.php to add. See the manual for details if you are not already familiar with this.</p>
<p>If you wish to use this font with autoLangToFont, you also need to edit config_lang2fonts.php</p>
<h4>Setting OTL use at runtime</h4>
<p>mPDF caches some font information in the /ttfontdata/ folder to improve performance. This is regenerated if you change the value of useOTL for a font.</p>
<p>There may be circumstances when you wish to use OTL features with different scripts depending on the document e.g. for everyday use you may want to disable OTL for FreeSerif to save processing time, but on occasions use OTL for Indic and/or Arabic scripts. The recommended way to do this is to create 2 instances of the font e.g. in config_fonts.php:</p>
<p class="code">
"freeserif" => array(<br />
\'R\' => "FreeSerif.ttf",<br />
\'B\' => "FreeSerifBold.ttf",<br />
\'I\' => "FreeSerifItalic.ttf",<br />
\'BI\' => "FreeSerifBoldItalic.ttf",<br />
\'useOTL\' => 0x00,<br />
),<br />
"freeserif2" => array(<br />
\'R\' => "FreeSerif.ttf",<br />
\'B\' => "FreeSerifBold.ttf",<br />
\'I\' => "FreeSerifItalic.ttf",<br />
\'BI\' => "FreeSerifBoldItalic.ttf",<br />
\'useOTL\' => 0xFF, /* Uses OTL for all scripts */<br />
\'useKashida\' => 75,<br />
),<br />
</p>
<p>You could then either use this second font name in your stylesheets e.g.</p>
<p class="code">
<p style="font-family:freeserif2;">Hallo World (in Arabic)</p>
</p>
<p>or, you could use font translation e.g.</p>
<p class="code">
$mpdf->fonttrans[\'freeserif\'] = \'freeserif2\';
</p>
<pagebreak />
<h3>Page breaking</h3>
<h4>Types of page break</h4>
<p>The handling of borders and padding at page breaks has been updated. mPDF has three types of page breaks:</p>
<p>1) "slice" - no border and no padding are inserted at a break. The effect is as though the element were rendered with no breaks present, and then sliced by the breaks afterward</p>
<p>2) "cloneall" - each page fragment is independently wrapped with the borders and padding of all open elements.</p>
<p>3) "clonebycss" - open elements which have the (custom) CSS property "box-decoration-break" set to "clone" are independently wrapped with their border and padding.</p>
<p>The difference between 2) and 3) is illustrated by this example:</p>
<p class="code">
<style><br />
div { border: 1px solid black; padding: 1em; }<br />
.level1 { box-decoration-break: slice; }<br />
.level2 { box-decoration-break: clone; }<br />
.level3 { box-decoration-break: clone; }<br />
</style><br />
<br />
<br />
<div class="level1"><br />
<div class="level2"><br />
<div class="level3"><br />
<p style="page-break-after:always">...</p><br />
<p>....</p><br />
</div><br />
</div><br />
</div><br />
</p>
<p>At the forced pagebreak which occurs after the P element:</p>
<p>If the page break type is "cloneall" - the three DIV elements will all be closed, by drawing the border and padding for each at the end of the page; the three DIV elements will be re-opened, drawing the borders and padding, at the top of the next page.</p>
<p>If the page break type is "clonebycss" - starting from the innermost element (div.level3) the DIV elements will have a border and padding at the end of the page if "box-decoration-break" is clone. In this case level2 and level 3 will be closed/cloned and level 1 will be sliced; the opposite will occur at the top of the next page.</p>
<h4>Control of page breaks</h4>
<table border="1">
<tr>
<td>Automatic page breaks (in flow of text)</td>
<td>Always "slice"</td>
</tr>
<tr>
<td><tocpagebreak></td>
<td>Always "cloneall"</td>
</tr>
<tr>
<td><formfeed></td>
<td>Always "slice"</td>
</tr>
<tr>
<td>If using columns</td>
<td>Always "cloneall"</td>
</tr>
<tr>
<td>Page break forced by change of @page selector</td>
<td>Always "cloneall"</td>
</tr>
<tr>
<td><pagebreak> </td>
<td>Always "cloneall" if a change in page size or margins is specified.<br />
Otherwise page break type is determined by value of configurable variable: $this->defaultPagebreakType. Default is "cloneall".<br />
Default can be overridden by attribute "page-break-type" e.g. <pagebreak page-break-type="clonebycss" />
</td>
</tr>
<tr>