12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042 |
- <?php
- set_time_limit(600);
- require_once __DIR__ . '/../vendor/autoload.php';
- $mpdf = new 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>
- <td>Page breaks forced by:<br />
- page-break-before or page-break-after
- </td>
- <td>
- Page break type determined by value of configurable variable: $this->defaultPagebreakType. Default is "cloneall".
- </td>
- </tr>
- </table>
- <h4>Notes on page breaking</h4>
- <p>"box-decoration-break: slice | clone" was proposed for CSS3 in <a href="http://www.w3.org/TR/2012/CR-css3-background-20120417/#the-box-decoration-break">http://www.w3.org/TR/2012/CR-css3-background-20120417/#the-box-decoration-break</a> but it appears that it may be withdrawn. Default is "slice"; it is not inherited.</p>
- <p>"page-break-before" is not supported on <table>.</p>
- <p>"page-break-before|after" is ignored if set on block elements inside a table.</p>
- <p>mPDF functions e.g. AddPage() are not affected by the changes in mPDF 6.</p>
- <p>Background images and gradients are not sliced.</p>
- <p>$this->restoreBlockPagebreaks in config.php is now redundant.</p>
- <h3>Line breaking</h3>
- <p>The algorithm for determining automatic line breaks has been completely rewritten, ignoring inline tags (except for some cases of CJK line-breaking, and autohyphenation).</p>
- <p>Line breaks will be allowed at:</p>
- <ul>
- <li>Spaces U+0020</li>
- <li>Word break U+200B</li>
- <li>Hyphen-minus U+002D when CSS hyphens set to "manual" or "auto", except when in a URL, or when following character is a > or numeral</li>
- <li>Hard hyphen U+2010 when CSS hyphens set to "manual" or "auto"</li>
- <li>Soft hyphen U+00AD "­" when CSS hyphens set to "manual" or "auto"</li>
- <li>Automatic hyphenation when CSS hyphens set to "auto"</li>
- <li>Between CJK characters, except CJK numerals, before "CJK-following" or after "CJK-leading" characters</li>
- </ul>
- <p>See also "Dictionary Line breaking" above.</p>
- <pagebreak />
- <h3>Line-height and Text Baseline</h3>
- <h4>Using font metrics</h4>
- <p>mPDF 6 can (optionally) use font metrics derived from each font file to:</p>
- <ul>
- <li>Determine the height of a line when line-height is set to \'normal\'</li>
- <li>Determine the glyph baseline (previously a fixed value)</li>
- </ul>
- <p>Options are set by configurable variables in the <span class="code">config.php</span> file:</p>
- <p>Default settings in mPDF versions 6 - recommended especially for complex scripts with marks used above or below characters:</p>
- <ul class="code">
- <li>$this->useFixedNormalLineHeight = false;</li>
- <li>$this->useFixedTextBaseline = false;</li>
- <li>$this->adjustFontDescLineheight = 1.14;</li>
- </ul>
- <p>Settings to be backwards compatible with mPDF versions < 6:</p>
- <ul class="code">
- <li>$this->useFixedNormalLineHeight = true;</li>
- <li>$this->useFixedTextBaseline = true;</li>
- <li>$this->normalLineheight = 1.33;</li>
- </ul>
- <h4>Examples</h4>
- <p>Using the font metrics will give approximately the same result as the fixed value for many standard Latin script fonts e.g. DejaVu Sans Condensed:</p>
- <p class="gradient" style="line-height: normal; font-size: 10pt; padding: 0 0.3em;font-family:\'DejaVu Sans Condensed\'; margin-bottom: 1em;">line-height: normal; based on font metrics</p>
- <p class="gradient" style="line-height: 1.33; font-size: 10pt; padding: 0 0.3em;font-family:\'DejaVu Sans Condensed\'; margin-bottom: 1em;">line-height: normal; using fixed value</p>
- <p>However, for some fonts the normal line-height using font metrics will be significantly taller, to account for the design of the font glyphs e.g. Khmer font:</p>
- <p class="gradient" style="font-family:\'Khmer OS\'; line-height: normal; font-size: 10pt; padding: 0 0.3em; margin-bottom: 1em;"><span style="font-family:\'DejaVu Sans Condensed\';">line-height: normal; based on font metrics;</span>
- ង្រ្គ ង្គ្រ ន្រ្តី ន្រ្តី ង្គ្រោះ យុវជន </p>
- <p class="gradient" style="font-family:\'Khmer OS\'; line-height: 1.33; font-size: 10pt; padding: 0 0.3em; margin-bottom: 1em;"><span style="font-family:\'DejaVu Sans Condensed\';">line-height: normal; using fixed value;</span>
- ង្រ្គ ង្គ្រ ន្រ្តី ន្រ្តី ង្គ្រោះ យុវជន </p>
- <p>For more information on how complex normal lineheights are, see Eric Meyers\' website: <a href="http://meyerweb.com/eric/thoughts/2008/05/06/line-height-abnormal/">http://meyerweb.com/eric/thoughts/2008/05/06/line-height-abnormal/</a> and
- <a href="http://typophile.com/node/13081">http://typophile.com/node/13081</a></p>
- <h4>CSS control of line-height</h4>
- <p>There are also new controls for line-height using draft CSS3 properties. These can be set on all block level elements (P, DIV etc) and tables (TABLE/TD/TH).</p>
- <p class="code"><b>line-stacking-strategy</b> = inline-line-height | block-line-height | max-height | grid-height</p>
- <ul>
- <li><span class="code">inline-line-height</span> - [default] lineheight is initially calculated from the block-level font[-size]; the height is expanded by any inline content, including the calculated lineheight of that inline content;</li>
- <li><span class="code">block-line-height</span> - lineheight is fixed as the lineheight of the block-level font[-size];</li>
- <li><span class="code">max-height</span> - lineheight is initially calculated from the block-level font; the height is expanded by any inline content, EXCLUDING the calculated lineheight of that inline content;</li>
- <li><span class="code">grid-height</span> - lineheight is initially calculated from the block-level font; the height is expanded - AS MULTIPLES OF INITIAL LINEHEIGHT - by any inline content, EXCLUDING the calculated lineheight of that inline content;</li>
- </ul>
- <p>Note: XSL has a similar property with the same name, which uses different but equivalent values: <span class="code">line-height</span> instead of <span class="code">inline-line-height</span>, <span class="code">font-height</span> instead of <span class="code">block-line-height</span>. It also uses <span class="code">max-height</span>. The value <span class="code">grid-height</span> is new to the CSS3 property.</p>
- <h4>Examples</h4>
- <p class="gradient" style="line-height: normal; font-size: 10pt; padding: 0 0.3em;font-family:\'DejaVu Sans Condensed\'; margin-bottom: 1em;">line-height: normal; DejaVu Sans Condensed</p>
- <p class="gradient" style="line-height: normal; line-stacking-strategy: inline-line-height; font-size: 10pt; padding: 0 0.3em;font-family:\'DejaVu Sans Condensed\'; margin-bottom: 1em;">line-height: normal; <span style="font-size: 16pt;">16pt font-size Â</span> with line-stacking-strategy: inline-line-height</p>
- <p class="gradient" style="line-height: normal; line-stacking-strategy: block-line-height; font-size: 10pt; padding: 0 0.3em;font-family:\'DejaVu Sans Condensed\'; margin-bottom: 1em;">line-height: normal; <span style="font-size: 16pt;">16pt font-size Â</span> with line-stacking-strategy: block-line-height</p>
- <p class="gradient" style="line-height: normal; line-stacking-strategy: max-height; font-size: 10pt; padding: 0 0.3em;font-family:\'DejaVu Sans Condensed\'; margin-bottom: 1em;">line-height: normal; <span style="font-size: 16pt;">16pt font-size Â</span> with line-stacking-strategy: max-height</p>
- <p class="gradient" style="line-height: normal; line-stacking-strategy: grid-height; font-size: 10pt; padding: 0 0.3em;font-family:\'DejaVu Sans Condensed\'; margin-bottom: 1em;">line-height: normal; <span style="font-size: 16pt;">16pt font-size Â</span> with line-stacking-strategy: grid-height</p>
- <br />
- <br />
- <p class="code"><b>line-stacking-shift</b> = consider-shifts | disregard-shifts</p>
- <p>This property determines whether to include or disregard the adjusted top- and bottom-edge of any characters that have a baseline-shift (e.g. superscript) when calculating lineheight.</p>
- <p>Note: XSL has a similar property with a different name: <span class="code">line-height-shift-adjustment</span> which uses the same values.</p>
- <h4>Examples</h4>
- <p>In the table below, the line-height is set to 1em throughout the table; line-stacking-shift is set as \'disregard-shifts\' in the first row, and has default setting (consider-shifts) in the second row.</p>
- <table style="line-height: 1em;" border="1">
- <tr>
- <td style="\'DejaVu Sans Condensed\'; line-stacking-shift: disregard-shifts; ">
- Normal text DejaVu Sans<sup>[53]</sup> Condensed <br />
- Normal text DejaVu Sans<sup>[53]</sup> Condensed <br />
- Normal text DejaVu Sans<sup>[53]</sup> Condensed <br />
- Normal text DejaVu Sans<sup>[53]</sup> Condensed <br />
- Normal text DejaVu Sans<sup>[53]</sup> Condensed <br />
- Normal text DejaVu Sans<sup>[53]</sup> Condensed <br />
- </td>
- <td style="\'DejaVu Sans Condensed\'; ">
- Normal text DejaVu Sans Condensed <br />
- Normal text DejaVu Sans Condensed <br />
- Normal text DejaVu Sans Condensed <br />
- Normal text DejaVu Sans Condensed <br />
- Normal text DejaVu Sans Condensed <br />
- Normal text DejaVu Sans Condensed <br />
- </td>
- </tr>
- <tr>
- <td style="\'DejaVu Sans Condensed\'; ">
- Normal text DejaVu Sans<sup>[53]</sup> Condensed <br />
- Normal text DejaVu Sans<sup>[53]</sup> Condensed <br />
- Normal text DejaVu Sans<sup>[53]</sup> Condensed <br />
- Normal text DejaVu Sans<sup>[53]</sup> Condensed <br />
- Normal text DejaVu Sans<sup>[53]</sup> Condensed <br />
- Normal text DejaVu Sans<sup>[53]</sup> Condensed <br />
- </td>
- <td style="\'DejaVu Sans Condensed\'; ">
- Normal text DejaVu Sans Condensed <br />
- Normal text DejaVu Sans Condensed <br />
- Normal text DejaVu Sans Condensed <br />
- Normal text DejaVu Sans Condensed <br />
- Normal text DejaVu Sans Condensed <br />
- Normal text DejaVu Sans Condensed <br />
- </td>
- </tr>
- </table>
- <p>For more details see the <a href="http://www.w3.org/TR/css3-linebox/#InlineBoxHeight">CSS3 draft specification</a>.</p>
- <h4>Note for Advanced users</h4>
- <p>There are actually three possible metrics that can be used in a TrueType font file. The differences are summed up quite well in this article at <a href="http://typophile.com/node/13081">http://typophile.com/node/13081</a>. mPDF will by default use the usWinAscent and usWinDescent values to determine a \'normal\' line-height, with two variations:</p>
- <ul>
- <li>if either the usWinAscent or usWinDescent are greater than the font bounding box (yMin yMax), then the values are reduced to equal the yMin/yMax values.
- NB this works as a fix with Myanmar Text (Windows 8 version) to give a line-height normal that is equivalent to that produced in browsers.</li>
- <li>if the USE_TYPO_METRICS bit is set on fsSelection (OS/2 table), this is telling the font to use the sTypo values and not the usWinAscent values.
- NB this works as a fix with Cambria Math font to give a normal line-height; at present, this is the only font I have found with this bit set;
- although note that MS WordPad and Windows FireFox browser use the big line-height from usWinAscent, whilst MS Word 2007 observes the fSelection value.</li>
- </ul>
- <p>You can change the font metrics used by mPDF, by editing the defined constant (_FONT_DESCRIPTOR) at the top of the <span classs="code">mpdf.php</span> file:</p>
- <ul>
- <li>\'winTypo\' uses sTypoAscender etc from the OS/2 table and is the one officially recommended - BUT</li>
- <li>\'win\' use usWinAscent etc from OS/2 and in practice seems to be used most commonly in Windows environment; this is the default in mPDF;</li>
- <li>\'mac\' uses Ascender etc from hhea table, and may be used to give results consistent with a Mac/OSX environment.</li>
- </ul>
- <p>Finally, you can override values for Ascent, Descent and Leading for any specific font, by setting values in <span classs="code">config_font.php</span> e.g.
- <div class="gradient">
- <pre style="font-size: 9pt;"> "cambriamath" => array(
- \'R\' => "cambria.ttc",
- \'useOTL\' => 0xFF,
- \'TTCfontID\' => array(
- \'R\' => 2,
- ),
- \'Ascent\' => 950,
- \'Descent\' => -222,
- \'Leading\' => 0,
- ),
- </pre>
- </div>
- <p>Note - The same values are used for all styles of the font-family. Descent values should be negative. All values should be given using a 1000 units per em scale, regardless of the UnitsPerEm used in the font design.</p>
- <h4>Notes</h4>
- <p>Remember that line-height for a TABLE has a default value (1.2) set in the <span classs="code">config.php</span> default CSS. This is left in for backwards compatability. You can change this value to \'normal\' for results consistent with most browsers.</p>
- <p>Line-height in a <textarea> is fixed and defined in <span class="code">classes/mpdfform.php</span> (= 1.2)</p>
- <p>Details of the font metrics can be seen by inspecting the temporary font files e.g. <span class="code">/ttfontdata/[fontname].mtx.php</span>.
- <pagebreak />
- <h3>Indexes</h3>
- <h4>Index style and layout</h4>
- <p>Indexes have been completely rewritten for mPDF 6, and are not backwards compatible:</p>
- <ul>
- <li>Reference() is now removed - use IndexEntry() instead.</li>
- <li>CreateReference() and CreateIndex() are both removed - replaced by: InsertIndex() [or recommend <indexinsert>] cf. below.</li>
- <li><indexinsert> and InsertIndex() no longer set styles - appearance must be controlled using CSS, even if using function InsertIndex().</li>
- <li><indexinsert> and InsertIndex() no longer control columns - these must be specified separately.</li>
- </ul>
- <p>When an Index is inserted in the PDF document, the Index is now generated (internally) as HTML code in the following format:</p>
- <p class="code">
- <div class="mpdf_index_main"><br />
- <div class="mpdf_index_letter"><b>A</b></div><br />
- <div class="mpdf_index_entry"><b>Aardvark</b><a class="mpdf_index_link" href="#page37">37</a><br />
- </div><br />
- ...<br />
- </div>
- </p>
- <p>CSS stylesheets can thus be used to control the layout of the Index e.g.:</p>
- <p class="code">
- /* For Index */<br />
- div.mpdf_index_main {<br />
- line-height: normal;<br />
- font-family: sans-serif;<br />
- }<br />
- div.mpdf_index_letter {<br />
- line-height: normal;<br />
- font-family: sans-serif;<br />
- font-size: 1.8em;<br />
- font-weight: bold;<br />
- text-transform: uppercase;<br />
- page-break-after: avoid; <br />
- margin-top: 0.3em; <br />
- margin-collapse: collapse;<br />
- }<br />
- div.mpdf_index_entry {<br />
- line-height: normal;<br />
- font-family: sans-serif;<br />
- text-indent: -1.5em;<br />
- }<br />
- a.mpdf_index_link { <br />
- color: #000000; <br />
- text-decoration: none;<br />
- }<br />
- </p>
- <p>A default stylesheet for Indexes is included in mpdf.css (see note later for more information).</p>
- <pagebreak />
- <h4>Index Collation</h4>
- <p>In order to generate an Index with non-ASCII characters, entries need to be sorted accordingly (collation), and non-ASCII characters should map to the appropriate Dividing letter e.g.:</p>
- <div style="border: 1px solid #666666; padding: 0.3em;">
- <div style="font-weight:bold;font-size: 18pt;">A</div>
- <div>Alonso, Fernando</div>
- <div>Ãlvarez, Isaac</div>
- <div>Arroyo Molino, David</div>
- <div style="font-weight:bold;font-size: 18pt;">B</div>
- <div>BenÃtez, Carlos</div>
- </div>
- <p>Entries in an Index can now be sorted using any of the Locale values available on your system. Set it using the "collation" property/parameter e.g.:</p>
- <p class="code">
- <indexinsert usedivletters="on" links="off" <b>collation="es_ES.utf8"</b> collation-group="Spanish_Spain" /><br />
- - or -<br />
- $mpdf->InsertIndex(true, false, <b>"es_ES.utf8"</b>, "Spanish_Spain");
- </p>
- <p>NB You should always choose a UTF-8 collation, even when you are using Core fonts or e.g. charset-in=win-1252, because mPDF handles all text internally as UTF-8 encoded.</p>
- <p>You can see which Locales are available on your (Unix) system: <span class="code"><?php system(\'locale -a\') ?></span></p>
- <p>Note: Index collation will probably not work on Windows servers because of the problems setting Locales under Windows.</p>
- <p>If you have set your index to use Dividing letters, you can also determine how letters are grouped under
- a dividing letter. In the example index above, we want à to be grouped under the letter a/A. Set the "collation-group" using:</p>
- <p class="code">
- <indexinsert usedivletters="on" links="off" collation="es_ES.utf8" <b>collation-group="Spanish_Spain"</b> />
- - or -<br />
- $mpdf->InsertIndex(true, false, "es_ES.utf8", <b>"Spanish_Spain"</b>);
- </p>
- <p>Values should be selected from the available file names in folder /collations/.</p>
- <p>Note: This will not affect the overall order of entries, which is determined by the value of "collation".</p>
- <p>Note: The groupings do not always match the order set by locale. This is because the data for collations has come from different sources. The files in /collations/ can be edited.</p>
- <p>The array consists of [index]: unicode decimal value of character => unicode decimal value of character to group under:
- e.g. Ã [A tilde] (U+00C3) (decimal 195) => a (U+0061) (decimal 97). The target character should always be the lowercase form.</p>
- <h4>Non-ASCII chcracters in Index entries</h4>
- <p>Note: htmlspecials_encode should be used to encode the text of content in <indexentry> - although not when using $mpdf->IndexEntry().</p>
- <h4>Columns</h4>
- <p>Columns are no longer specified as part of the <indexinsert>, so a typical 2-column index might be produced by:</p>
- <p class="code">
- <pagebreak type="next-odd" /><br />
- <h2>Index</h2><br />
- <columns column-count="2" column-gap="5" /><br />
- <indexinsert usedivletters="on" links="on" collation="en_US.utf8" collationgroup="English_United_States" /><br />
- <columns column-count="1" /><br />
- </p>
- <h4>Index Sub-entries</h4>
- <p>Index entries can contain sub-entries, separated by colons e.g.</p>
- <p class="code"><indexentry content="Mammals:elephants" /></p>
- <p>A shorthand way of displaying subentries is set by default, which suppresses the main entry if > 1 subEntry. It can be disabled/enabled using the configurable variable $this->indexUseSubentries in config.php.</p>
- <p>This is the default appearance, with $this->indexUseSubentries = false; -</p>
- <div style="border: 1px solid #666666; padding: 0.3em;">
- Mammals 73<br />
- - elephants 142<br />
- - humans 173<br />
- Marsupials<br />
- - kangaroos 75<br />
- - wombats 86
- </div>
- <p>Index entries can also include simple mark-up tags and/or more than one colon e.g:</p>
- <p class="code"><indexentry content="Mammals:&lt;b&gt;elephants&lt;/b&gt;: breeding" /></p>
- which appears as:
- <div style="border: 1px solid #666666; padding: 0.3em;">
- Mammals<br />
- - <b>elephants</b>: breeding 15
- </div>
- <p>This is the appearance with $this->indexUseSubentries = false; -</p>
- <div style="border: 1px solid #666666; padding: 0.3em;">
- Mammals 73<br />
- Mammals, elephants 142<br />
- Mammals, <b>elephants</b>: breeding 15<br />
- Mammals, humans 173<br />
- Marsupials, kangaroos 75<br />
- Marsupials, wombats 86<br />
- </div>
- <h4>Customised appearance</h4>
- <p>Several variables set at beginning of function InsertIndex() in mpdf.php which could be changed to alter appearance of Index.
- e.g. spacer, and joiner characters.</p>
- <pagebreak />
- <h3>Lists</h3>
- <p>Lists are now handled as for other block level tags, so you can apply any CSS properties usable on blocks (e.g. border, background, padding) to UL/OL and LI tags.</p>
- <p>CSS property "list-style" is now handled properly as a shorthand, and there is full support for "list-style-image", "list-style-type", and "list-style-position".</p>
- <p>There are two modes for lists in mPDF 6: "mpdf" mode and "browser" mode. Mode is set using the configurable variable $this->list_auto_mode in config.php</p>
- <p>1) Browser mode gives the same display as most browsers. In this mode, the default list indentation is set by padding "0 auto" in the default CSS in config.php. "auto" equates to the value of $this->list_indent_default in config.php - this is a "magic" value for padding, which is applied to either left or right depending on directionality of the list (rtl/ltr).</p>
- <p>2) mPDF mode gives results compatible with previous versions of mPDF. In this mode, the indentation is calculated differently: the outside edge of the list item is considered to be the outside edge of the bullet or number. For numbered lists, mPDF calculates the width of the largest number and this width is used to set the outside edge. The default list indentation of "auto" in mPDF mode is set by $this->list_indent_default_mpdf. This value is added to the automatic calculated indentation. For backwards compatibility, $this->list_indent_first_level = 0; can be used to prevent any indentation of the first list level.</p>
- <p>The automatic indentation only works for bullets or numbered lists, and is ignored if "list-style-position: inside" is set, or images are used for markers.</p>
- <p>Browser mode is set as the default - for backwards compatibility, change this to "mpdf".</p>
- <h4>List top & bottom margins</h4>
- <p>The default in browsers is to add a top and bottom margin to the outermost list only. This can be defined using CSS as:</p>
- <p class="code">
- ul, ol { margin-top: 0.83em; margin-bottom: 0.83em; }<br />
- ul ul, ul ol, ol ul, ol ol { margin-top: 0; margin-bottom: 0; }
- </p>
- <p>This style is included in file mpdf.css (see later).</p>
- <p>Previous versions of mPDF always added a top and bottom margin to the outermost list, (but no variation from this was possible). mPDF 6 is therefore backwards compatible re. the margins.</p>
- <p>[NB The CSS styles are included in mpdf.css, because the defaultCSS values set in config.php only works on basic elements, and cannot use selectors such as "ol ol".]</p>
- <h4>Other new configurable variables</h4>
- <p>Configurable variables are used to define size and offset for list bullets (i.e. disc, circle or square).
- The values can be any valid CSS size.</p>
- <p>To specify a fixed bullet size and offset to give a similar appearance to most browsers, the default is set as:</p>
- <ul>
- <li>$this->list_marker_offset = \'5.5pt\';</li>
- <li>$this->list_symbol_size = \'3.6pt\';</li>
- </ul>
- <p>To specify size and offset proportional to the list item\'s font size (compatible with previous versions of mPDF), use:</p>
- <ul>
- <li>$this->list_marker_offset = \'0.45em\';</li>
- <li>$this->list_symbol_size = \'0.31em\';</li>
- </ul>
- <h4>Notes on Lists</h4>
- <p>The attribute type="" is case sensitive (whereas it is case insensitive in CSS). This allows the use of shorthand versions e.g. type="A" for uppercase alpha-numeric.</p>
- <p>"list-style-type" is only inherited to child LI (not to child UL/OL); list-style-image and -position are fully inherited.</p>
- <p>Lists in tables remain basic, as block-level elements are not supported inside tables.</p>
- <p>Properties like text-align:justify will now be inherited from surrounding elements, which will change the appearance of lists designed with earlier versions of mPDF.</p>
- <p>The attribute start="3" (integer) works for "OL"; it is an official (though depracated) HTML attribute.</p>
- <p>List bullets (type = disc, circle or square) are now drawn rather than using font glyphs, for better consistency.</p>
- <h4>List examples</h4>
- <div style="border: 1px solid blue;">This demonstrates the appearance when list_auto_mode is set to \'mpdf\', compatible with previous mPDF versions. Indentation is set to zero (list_indent_default_mpdf). Note the top and bottom margin on the first list level only.
- <ol style="list-style-type:upper-roman; border: 1px solid red;">
- <li style="border: 1px solid #CCCCCC;">First item</li>
- <li style="border: 1px solid #CCCCCC;">Second item
- <ol style="list-style-type:upper-roman; border: 1px solid green;">
- <li style="border: 1px solid #CCCCCC;">Next list level</li>
- <li style="border: 1px solid #CCCCCC;">Second item</li>
- </ol>
- </li>
- </ol>
- </div>
- <div style="border: 1px solid blue;">This demonstrates the same default settings, but list numbering is set to start at 32. Note how the indentation is adjusted to fit the maximum width of the numbering.
- <ol start="32" style="list-style-type:upper-roman; border: 1px solid red;">
- <li style="border: 1px solid #CCCCCC;">First item</li>
- <li style="border: 1px solid #CCCCCC;">Second item
- <ol start="32" style="list-style-type:upper-roman; border: 1px solid green;">
- <li style="border: 1px solid #CCCCCC;">Next list level</li>
- <li style="border: 1px solid #CCCCCC;">Second item</li>
- </ol>
- </li>
- </ol>
- </div>
- <div style="border: 1px solid blue;">This demonstrates the appearance when list_auto_mode is set to \'browser\', compatible with browsers. Indentation is set to 40px (list_indent_default)
- <ol style="list-style-type:upper-roman; border: 1px solid red; padding-left: 40px;">
- <li style="border: 1px solid #CCCCCC;">First item</li>
- <li style="border: 1px solid #CCCCCC;">Second item
- <ol style="list-style-type:upper-roman; border: 1px solid green; padding-left: 40px;">
- <li style="border: 1px solid #CCCCCC;">Next list level</li>
- <li style="border: 1px solid #CCCCCC;">Second item</li>
- </ol>
- </li>
- </ol>
- </div>
- <div style="border: 1px solid blue;">This demonstrates the same as the previous example, but list numbering is set to start at 32. Note that the default indentation remains fixed at 40px (list_indent_default)
- <ol start="32" style="list-style-type:upper-roman; border: 1px solid red; padding-left: 40px;">
- <li style="border: 1px solid #CCCCCC;">First item</li>
- <li style="border: 1px solid #CCCCCC;">Second item
- <ol start="32" style="list-style-type:upper-roman; border: 1px solid green; padding-left: 40px;">
- <li style="border: 1px solid #CCCCCC;">Next list level</li>
- <li style="border: 1px solid #CCCCCC;">Second item</li>
- </ol>
- </li>
- </ol>
- </div>
- <div style="border: 1px solid blue;">This demonstrates control of the list-style-type, list-style-position and list-style-image.
- <ol style="list-style-type:decimal; border: 1px solid red; padding-left: 40px;">
- <li style="border: 1px solid #CCCCCC;">First item in list</li>
- <li style="border: 1px solid #CCCCCC;">Second item</li>
- <li style="border: 1px solid #CCCCCC; list-style-type: disc;">List style set as \'disc\'</li>
- <li style="border: 1px solid #CCCCCC; list-style-type: none;">List style set as \'none\'</li>
- <li style="border: 1px solid #CCCCCC; list-style-image:url(goto2.gif)">Using an image.</li>
- <li style="border: 1px solid #CCCCCC; list-style-position: inside">List-style-position: inside.</li>
- <li style="border: 1px solid #CCCCCC; list-style-type: U+263Argb(255,0,0);">User defined list bullet</li>
- </ol>
- </div>
- <h3>Image transform</h3>
- <p>The CSS property "transform" is supported on images (only). All transform functions are supported except matrix() i.e. translate(), translateX(), translateY(), skew(), skewX(), skewY(), scale(), scaleX(), scaleY(), and rotate()</p>
- <p>Transforms cannot be used when using columns or Keep-with-table (use_kwt).</p>
- <p>The CSS property background-color is now supported on images.</p>
- <p>In the following examples, note the difference between transform (which is applied after layout) and image-orientation (which is applied before layout):</p>
- <div style="border:1px solid red">
- Hallo world
- <img src="bayeux2.jpg" width="30mm" style="border:2px solid blue; padding:0.5em; background-color: yellow" />
- Hallo world
- </div>
- <div style="border:1px solid red">
- Hallo world
- <img src="bayeux2.jpg" width="30mm" style="transform: rotate(30deg);border:2px solid blue; padding:0.5em; background-color: yellow" />
- Hallo world
- </div>
- <div style="border:1px solid red">
- Hallo world
- <img src="bayeux2.jpg" width="30mm" style="transform:scale(0.5,1) skew(45deg,-45deg) translate(80mm,80mm);border:2px solid blue; padding:0.5em; background-color: yellow" />
- Hallo world
- </div>
- <div style="border:1px solid red">
- Hallo world
- <img src="bayeux2.jpg" height="30mm" style="image-orientation:90deg;border:2px solid green; padding:0.5em; background-color: yellow" />
- Hallo world (image-orientation)
- </div>
- <h3>CSS overline</h3>
- <p>The CSS property "text-decoration: overline" is supported. Note that since mPDF 5.7.3 text-decoration use the parent inline block baseline/fontsize/color for child inline elements, and allows nested use of these values and superscript/subscript.</p>
- <div style="font-size: 18pt;"><u>1<sup>st</sup> place</u>
- and compare with
- <u>1<sup><u>st</u></sup></u></div>
- <div style="font-size:18pt">He <span style="text-decoration: line-through;color:green;"><span style="text-decoration:overline;">won</span> <span style="font-size:36pt;color:blue;">1<span style="text-decoration:underline; vertical-align:super;font-size:18pt;color:red;">st</span></span> place</span></div>
- <pagebreak />
- <h3>Headers and Footers</h3>
- <p>Headers and Footers are all now written internally as HTMLheaders/footers. The use of non-HTML headers and footers is depracated, but remains supported. Non-HTML headers and footers are converted in mPDF to HTML equivalents.</p>
- <p>Layout: This may mean that there will be a change in the resulting PDF. The main change is that an HTML table is created with three cells for left, right and middle; if you had a very long Left header item, it will not overwrite the center item, but it may wrap center onto 2 lines.</p>
- <p>Naming: Default non-HTML headers will not clash with HTML headers, but named non-HTML headers WILL clash with (and overwrite) HTML headers of the same (equivalent) name e.g. html_MyFooter == MyFooter (non-HTML).</p>
- <p>Aliases: {nb} or {nbpg} now only work in Headers or Footers, and not in the main text. {PAGENO} and {DATE ...} continue to only work in Headers or Footers.</p>
- <p>ToC: Can now set the pagenumbering/style/reset/suppress for the ToC separately (see section on ToC).</p>
- <p>The following are all depracated (but still supported) in favour of HTMLheader/footers:</p>
- <ul>
- <li>SetHeader()</li>
- <li>SetFooter()</li>
- <li><pageheader></li>
- <li><pagefooter></li>
- <li>DefHeaderByName()</li>
- <li>DefFooterByName()</li>
- <li><setpageheader></li>
- <li><setpagefooter></li>
- <li>SetHeaderByName()</li>
- <li>SetFooterByName()</li>
- </ul>
- <p>If document direction is RTL (body dir=rtl, html dir=rtl), then you need to set directionality before setting non-HTML headers e.g.</p>
- <p class="code">
- $mpdf = new mPDF();<br />
- $mpdf->SetDirectionality(\'rtl\'); // i.e. add this in<br />
- $mpdf->SetHeader($h);<br />
- $mpdf->SetFooter($f);<br />
- $mpdf->WriteHTML(\'<body dir="rtl">...\');<br />
- </p>
- <pagebreak />
- <h3>Table of Contents (ToC)</h3>
- <p>Page numbering can now be applied and controlled for the pages containing a ToC.</p>
- <p>There are three new parameters to control pagenumbering in the ToC: toc-resetpagenum, toc-pagenumstyle, and toc-suppress.
- These are set as attributes in <tocpagebreak> or as the last 3 parameters in TOCpagebreak();
- they set the pagenumbering and pagenumbering style for the ToC, and whether to suppress pagenumbers in ToC.</p>
- <p>The default setting for all is to continue pagenumbering and pagenumstyle (and suppression) from pages preceding the ToC.</p>
- <p>Note: Page numbering will <b>always</b> reset following a ToC. By default it will set it to 1, unless a value for resetpagenum is specified in TOCpagebreak or <tocpagebreak>.</p>
- <p>Backwards compatibility: page numbers are no longer suppressed by default in ToC.</p>
- <p>Although "suppress" and "toc-suppress" are supported, the recommended way to control whether page numbering appears is by using different headers and footers for each section.</p>
- <p>Note: If you have 2 ToCs immediately following each other, and wish to use pagenumstyle or suppress to control the following text, then you need to set those values on both of the <tocpagebreak> elements.</p>
- <p>The default CSS styles for ToCs and Indexes are now set in mpdf.css (see later).</p>
- <p>See notes later on page numbering.</p>
- <pagebreak odd-footer-name="myHTMLhebrew" odd-footer-value="1" even-footer-name="myHTMLhebrew" even-footer-value="1" pagenumstyle="hebrew" />
- <h3>Other changes from mPDF 5</h3>
- <h4>Setting up mPDF 6</h4>
- <p>mPDF 6 has changed significantly from earlier version and it is recommended that a fresh install is used. You may wish to copy your previous config_* files and use them to update the new config files.</p>
- <p><b>config_fonts.php</b> - values of "indic" and "unAglyphs" from previous versions are now redundant.</p>
- <p><b>config_lang2fonts.php</b> - this is similar to the previous config_cp.php file; note however that $unifont (NOT $unifonts) must be only one font (not a comma-separated list as before).</p>
- <p><b>Included fonts</b> - the Indic fonts e.g. ind_bn_001.ttf are no longer required (nor do they work properly with mPDF 6).</p>
- <p><b>useLang</b> - this configurable variable, which used to be true by default, is now redundant. You may need to set: $mpdf->autoLangToFont = true; for the same results.</p>
- <p><b>SetAutoFont()</b> - is now redundant. You may need to set: $mpdf->autoScriptToLang = true; for the same results.</p>
- <p><b>Indexes</b> - have been largely redefined. See the section above.</p>
- <p><b>Lists</b> - have been rewritten. See the section above.</p>
- <p><b>Headers and Footers</b> - have been rewritten. See the section above.</p>
- <div>A number of old depracated aliases will no longer be supported. Warning errors have been added to prompt you to change to the updated form:</div>
- <ul>
- <li>$mpdf->useOddEven - should now use - $mpdf->mirrorMargins</li>
- <li>$mpdf->useSubstitutionsMB - should now use - $mpdf->useSubstitutions</li>
- <li>$mpdf->AliasNbPg - should now use - $mpdf->aliasNbPg</li>
- <li>$mpdf->AliasNbPgGp - should now use - $mpdf->aliasNbPgGp</li>
- <li>$mpdf->BiDirectional - should now use - $mpdf->biDirectional</li>
- <li>$mpdf->Anchor2Bookmark - should now use - $mpdf->anchor2Bookmark</li>
- <li>$mpdf->KeepColumns - should now use - $mpdf->keepColumns</li>
- <li>$mpdf->UnvalidatedText - should now use - $mpdf->watermarkText</li>
- <li>$mpdf->TopicIsUnvalidated - should now use - $mpdf->showWatermarkText</li>
- <li>$mpdf->Reference - should now use - $mpdf->IndexEntry</li>
- </ul>
- <div>The following functions have been removed:</div>
- <ul>
- <li>setUnvalidatedText - should now use - SetWatermarkText() </li>
- <li>AddPages - should now use - AddPage() or HTML code methods </li>
- <li>startPageNums</li>
- <li>CreateReference and CreateIndex - cf. Index section above</li>
- </ul>
- <h4>Default style sheet</h4>
- <p>A new mpdf.css file includes defaults for LISTS top/bottom margins, and also examples for Indexes and ToCs. This now acts like a normal CSS file, including cascading selectors i.e. not just main tags. This is always read (if present), so acts as a secondary default CSS, but one which allows selectors. Styles added to this act like a user stylesheet when considering precedence e.g. cellSpacing and border-spacing.</p>
- <h4>Direct writing methods and OTL</h4>
- <p>WriteText() WriteCell() Watermark() AutoSizeText() and ShadedBox() DO support complex scripts and right-to-left text (RTL).</p>
- <p>Write() does NOT support complex scripts or RTL (NB this is a change - Write() used to support RTL).</p>
- <p>CircularText() does NOT support complex scripts or RTL.</p>
- <p>MultiCell() DOES support complex scripts and RTL, but complex-script line-breaking MAY NOT be accurate.</p>
- MultiCell() does not support kerning and justification. NB This includes <textarea> in forms which uses MultiCell() internally.</p>
- <p><select> form objects also do NOT support kerning.</p>
- <h4>Page numbering</h4>
- <p>Page numbering i.e. by including {PAGENO} or {‌nbpg} in a header/footer, can use any of the number types as used for list-style e.g.</p>
- <p class="code"><pagebreak pagenumstyle="arabic-indic"></p>
- <p>Short codes are recognised for the 5 most common:</p>
- <ul>
- <li>"1" - decimal</li>
- <li>"A" = upper-latin or upper-alpha</li>
- <li>"a" = lower-latin or lower-alpha</li>
- <li>"I" = upper-roman</li>
- <li>"i" = lower-roman</li>
- </ul>
- <p>or any of the following:
- arabic-indic, hebrew, bengali, devanagari, gujarati, gurmukhi, kannada, malayalam, oriya, persian, tamil, telugu, thai, urdu, cambodian, khmer, lao, cjk-decimal
- </p>
- <p>Note: A suitable font must be used in the header/footer in order to display the numbers in the selected script.</p>
- <p>You can now set the pagenumberstyle from the beginning of the document by changing the configurable variable:</p>
- <p class="code">
- $this->defaultPageNumStyle = "arabic-indic"; // in config.php<br />
- $mpdf->defaultPageNumStyle = "arabic-indic"; // at runtime<br />
- </p>
- <h4>Other Minor changes in mPDF 6</h4>
- <p>\'hebrew\', \'khmer\', \'cambodian\', \'lao\', and \'cjk-decimal\' are recognised as values for "list-style-type" in numbered lists.</p>
- <p>CSS "text-outline" is now supported on TD/TH tags</p>
- <p>Text wrapping in tables has been improved when using CJK scripts (chinese-japanese-korean).</p>
- <p>Text underline and strikethrough can be used together: <u><s>Hallo world</s></u>. Either <u><s>...</s></u> or <span style="text-decoration:underline line-through;">...</span> can be used</p>
- <p>Added support for style="opacity:0.6;" in SVG - equivalent to: style="fill-opacity:0.6; stroke-opacity: 0.6;"</p>
- Added support for opacity="0.6" (as attribute) in SVG - previously only supported fill-opacity="0.6" stroke-opacity="0.6"
- <p>CSS position:absolute or fixed - rotate extended now to include rotate: 180; (previously just 90 or -90)</p>
- <p>The default value of $this->keep_table_proportions = true; in config.php has been changed (see effect on Example 6 - nested table in top right cell).</p>
- <p>Limited support has been added for SVG fonts embedded in SVG images (but not using @font-face rules) - see the separate Images demo file.</p>
- <p>When using columns, the top margin is now collapsed at top of every column (not just first column of page).</p>
- <p>The way mPDF handles optional end tags has been updated to be consistent with the <a href="http://www.w3.org/TR/html5/syntax.html#optional-tags">HTML5 specification</a> - previously not well defined for HTML4.</p>
- <p>Changes to the way lists are handled means that text-align:justify may be inherited by lists from surrounding block elements (which did not happen previously). See LISTS above for more information.</p>
- <h3>Backwards Compatibility</h3>
- <p>For maximum backwards comaptibility with older versions of mPDF, change the following configurable variables in the <span class="code">config.php</span> file:</p>
- <table class="fontinfo">
- <thead>
- <tr>
- <td><br /></td>
- <td>mPDF 6.0 Default (Browser compatible)<br /></td>
- <td>Backwards Compatible</td>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>Normal Line-height</td>
- <td>
- <p>$this->useFixedNormalLineHeight = false;<br />$this->useFixedTextBaseline = false;<br />$this->adjustFontDescLineheight = 1.14;</p>
- </td>
- <td>$this->useFixedNormalLineHeight = true;<br />$this->useFixedTextBaseline = true;<br />$this->normalLineheight = 1.33;</td>
- </tr>
- <tr>
- <td>Lists</td>
- <td>
- <p>$this->list_auto_mode = \'browser\';</p>
- $this->list_marker_offset = \'5.5pt\';<br />$this->list_symbol_size = \'3.6pt\';</td>
- <td>
- <p>$this->list_auto_mode = \'mpdf\';</p>
- <p>$this->list_marker_offset = \'0.45em\';<br />$this->list_symbol_size = \'0.31em\';</p>
- </td>
- </tr>
- </tbody>
- </table>
- <h3>More Information</h3>
- <p>For more information, see:</p>
- <ul>
- <li>About OTL: <a href="http://www.microsoft.com/typography/otspec/TTOCHAP1.htm">http://www.microsoft.com/typography/otspec/TTOCHAP1.htm</a></li>
- <li>OTL tag Registry: <a href="http://www.microsoft.com/typography/otspec/ttoreg.htm">http://www.microsoft.com/typography/otspec/ttoreg.htm</a></li>
- <li>OTL Features list: <a href="http://www.microsoft.com/typography/otspec/featurelist.htm">http://www.microsoft.com/typography/otspec/featurelist.htm</a></li>
- <li>CSS3 Font Features: <a href="http://dev.w3.org/csswg/css-fonts/#font-rend-desc">http://dev.w3.org/csswg/css-fonts/#font-rend-desc</a></li>
- </ul>
- <pagebreak />
- <h3>Font Information</h3>
- <p>The following fonts are included with mPDF 6:</p>
- <table class="fontinfo">
- <thead>
- <tr>
- <td>Font(s)</td>
- <td>Download URL</td>
- <td>Copyright / License<br /></td>
- <td>Coverage</td>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>
- <p>DejaVuSans</p>
- <p>DejaVuSansCondensed</p>
- <p>DejaVuSerif</p>
- <p>DejaVuSerifCondensed</p>
- <p>DejaVuSansMono</p>
- </td>
- <td>http://dejavu-fonts.org</td>
- <td>
- <p>© Bitstream</p>
- <p>http://dejavu-fonts.org/wiki/License</p>
- </td>
- <td>[Numerous]</td>
- </tr>
- <tr>
- <td>
- <p>FreeSans</p>
- <p>FreeSerif</p>
- <p>FreeMono</p>
- </td>
- <td>http://www.gnu.org/software/freefont/</td>
- <td>
- <p>GNU GPL v3</p>
- </td>
- <td>
- <p>[Numerous incl. Indic]</p>
- </td>
- </tr>
- <tr>
- <td>Quivira</td>
- <td>http://www.quivira-font.com/</td>
- <td>
- <p><i><span>free for any use</span></i></p>
- </td>
- <td>
- <p>Coptic</p>
- <p>Buhid</p>
- <p>Tagalog</p>
- <p>Tagbanwa</p>
- <p>Lisu</p>
- </td>
- </tr>
- <tr>
- <td>Abyssinica SIL</td>
- <td>http://www.sil.org/resources/software_fonts/abyssinica-sil</td>
- <td><a href="http://scripts.sil.org/ofl" target="_blank">SIL Open Font License</a></td>
- <td>Ethiopic</td>
- </tr>
- <tr>
- <td>XBRiyaz</td>
- <td>
- <p>http://www.redlers.com/downloadfont.html</p>
- <p>(<span>XW Zar fonts)</span></p>
- <p><span>http://wiki.irmug.org/index.php/XWZar</span></p>
- </td>
- <td><a href="http://scripts.sil.org/ofl" target="_blank">SIL Open Font License</a></td>
- <td>Arabic</td>
- </tr>
- <tr>
- <td>Taamey David CLM<br /></td>
- <td>http://opensiddur.org/tools/fonts/</td>
- <td>GNU GPL 2 <br /></td>
- <td>Hebrew</td>
- </tr>
- <tr>
- <td>
- <p>Estrangelo Edessa</p>
- </td>
- <td>
- <p>http://www.bethmardutho.org/index.php/resources/fonts.html</p>
- <p>(SyrCOMEdessa.otf)</p>
- </td>
- <td>Adapted licence (free to use/share)<br /></td>
- <td>Syriac</td>
- </tr>
- <tr>
- <td>Aegean</td>
- <td>http://users.teilar.gr/~g1951d/</td>
- <td><i><span>free for any use</span></i></td>
- <td>
- <p>Carian</p>
- <p>Lycian</p>
- <p>Lydian</p>
- <p>Phoenecian</p>
- <p>Ugaritic</p>
- <p>Linear B</p>
- <p>Old Italic</p>
- </td>
- </tr>
- <tr>
- <td>Jomolhari</td>
- <td>https://sites.google.com/site/chrisfynn2/home/fonts/jomolhari</td>
- <td><a href="http://scripts.sil.org/ofl" target="_blank">SIL Open Font License</a></td>
- <td>Tibetan</td>
- </tr>
- <tr>
- <td>Lohitkannada</td>
- <td>https://fedorahosted.org/lohit/ <br /></td>
- <td><a href="http://scripts.sil.org/ofl" target="_blank">SIL Open Font License</a> <br /></td>
- <td>Kannada</td>
- </tr>
- <tr>
- <td>Kaputaunicode</td>
- <td>
- <p>http://www.kaputa.com/slword/kaputaunicode.htm</p>
- <p>http://www.locallanguages.lk/sinhala_unicode_converters</p>
- </td>
- <td>
- <p>Free</p>
- <p>Sri Lanka Web Community Center</p>
- </td>
- <td>Sinhala</td>
- </tr>
- <tr>
- <td>Pothana2000</td>
- <td>https://fedoraproject.org/wiki/Pothana2000_fonts</td>
- <td>GNU GPL v2+</td>
- <td>Telugu</td>
- </tr>
- <tr>
- <td>Lateef</td>
- <td>http://www.sil.org/resources/software_fonts/lateef</td>
- <td><a href="http://scripts.sil.org/ofl" target="_blank">SIL Open Font License</a></td>
- <td>Sindhi</td>
- </tr>
- <tr>
- <td>Khmeros</td>
- <td>
- <p>http://www.khmeros.info/en/fonts</p>
- <p>(http://www.cambodia.org/fonts/)</p>
- </td>
- <td>LGPL Licence<br /></td>
- <td>Khmer</td>
- </tr>
- <tr>
- <td>Dhyana</td>
- <td>
- <p>Google Fonts</p>
- <p>http://www.google.com/fonts/earlyaccess</p>
- </td>
- <td><a href="http://scripts.sil.org/ofl" target="_blank">SIL Open Font License</a> <br /></td>
- <td>Lao</td>
- </tr>
- <tr>
- <td>Tharlon</td>
- <td>
- <p>Google Fonts</p>
- http://code.google.com/p/tharlon-font/</td>
- <td><a href="http://scripts.sil.org/ofl" target="_blank">SIL Open Font License</a></td>
- <td>
- <p>Myanmar</p>
- <p>Tai Le</p>
- </td>
- </tr>
- <tr>
- <td>Padauk Book<br /></td>
- <td>http://www.sil.org/resources/software_fonts/padauk</td>
- <td><a href="http://scripts.sil.org/ofl" target="_blank">SIL Open Font License</a></td>
- <td>
- <p>Myanmar</p>
- </td>
- </tr>
- <tr>
- <td>Ayar fonts</td>
- <td>http://eng.ayarunicodegroup.org/</td>
- <td><a href="http://scripts.sil.org/ofl" target="_blank">SIL Open Font License</a> <br /></td>
- <td>Myanmar</td>
- </tr>
- <tr>
- <td>ZawgyiOne</td>
- <td>http://code.google.com/p/zawgyi/wiki/MyanmarFontDownload</td>
- <td>
- <p>Freely available.</p>
- <p>No licence information available</p>
- </td>
- <td>
- <p>Myanmar</p>
- </td>
- </tr>
- <tr>
- <td>
- <p>Garuda</p>
- </td>
- <td>http://www.hawaii.edu/thai/thaifonts/</td>
- <td>
- <p>Freely available.</p>
- No licence information available</td>
- <td>Thai</td>
- </tr>
- <tr>
- <td>Sundanese Unicode</td>
- <td>http://sabilulungan.org/aksara/</td>
- <td>GNU GPL<br /></td>
- <td>Sundanese</td>
- </tr>
- <tr>
- <td>Tai Heritage Pro</td>
- <td>http://www.sil.org/resources/software_fonts/tai-heritage-pro</td>
- <td><a href="http://scripts.sil.org/ofl" target="_blank">SIL Open Font License</a></td>
- <td>Tai Viet</td>
- </tr>
- <tr>
- <td>
- <p>Sun-ExtA</p>
- <p>Sun-ExtB</p>
- </td>
- <td>http://www.alanwood.net/downloads/index.html</td>
- <td>Freeware<br />(Beijing ZhongYi Electronics Co)</td>
- <td>
- <p>Chinese</p>
- <p>Japanese</p>
- <p>Runic</p>
- </td>
- </tr>
- <tr>
- <td>Unbatang</td>
- <td>http://kldp.net/projects/unfonts/download</td>
- <td>GNU GPL<br /></td>
- <td>Korean</td>
- </tr>
- <tr>
- <td>
- <p>Aboriginal Sans</p>
- </td>
- <td>http://www.languagegeek.com/font/fontdownload.html <br /></td>
- <td>
- <p>GNU GPL 3</p>
- <p> </p>
- </td>
- <td>
- <p>Cree</p>
- <p>Canadian Aboriginal</p>
- <p>Inuktuit</p>
- </td>
- </tr>
- <tr>
- <td>MPH 2B Damase</td>
- <td>http://www.alanwood.net/downloads/index.html</td>
- <td>(Public domain) <br /></td>
- <td>
- <p>Glagolitic</p>
- <p>Shavian</p>
- <p>Osmanya</p>
- <p>Kharoshthi</p>
- <p>Deseret</p>
- </td>
- </tr>
- <tr>
- <td>Aegyptus</td>
- <td>http://users.teilar.gr/~g1951d/</td>
- <td><i><span>free for any use</span></i></td>
- <td>Egyptian Hieroglyphs</td>
- </tr>
- <tr>
- <td>Akkadian</td>
- <td>http://users.teilar.gr/~g1951d/</td>
- <td><i><span>free for any use</span></i></td>
- <td>Cuneiforn</td>
- </tr>
- <tr>
- <td>Eeyek Unicode</td>
- <td>http://tabish.freeshell.org/eeyek/download.html</td>
- <td>Freeware</td>
- <td>Meetei Mayek</td>
- </tr>
- <tr>
- <td>Lannaalif</td>
- <td>http://www.geocities.jp/simsheart_alif/taithamunicode.html</td>
- <td>(Unclear)</td>
- <td>Tai Tham</td>
- </tr>
- <tr>
- <td>Daibanna SIL Book</td>
- <td>http://www.sil.org/resources/software_fonts/dai-banna-sil</td>
- <td><a href="http://scripts.sil.org/ofl" target="_blank">SIL Open Font License</a></td>
- <td>New Tai Lue</td>
- </tr>
- <tr>
- <td>KFGQPC Uthman Taha Naskh<br /></td>
- <td>http://fonts.qurancomplex.gov.sa/?page_id=42</td>
- <td><a href="http://scripts.sil.org/ofl" target="_blank">https://www.ohloh.net/licenses/KFGQPC</a></td>
- <td>
- <p>Arabic</p>
- <p>(Koran/Quran)</p>
- </td>
- </tr>
- </tbody>
- </table>
- ';
- //==============================================================
- $mpdf->h2bookmarks = array('H3'=>0, 'H4'=>1);
- $mpdf->defaultPageNumStyle = 'arabic-indic';
- $mpdf->autoLangToFont = true;
- $mpdf->WriteHTML($html);
- $mpdf->Output();
- exit;
|