From dda8474928bd7276e1fad8fb7a601e7c83ff2bc2 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sun, 10 Jul 2011 15:17:53 -0500 Subject: Added TQt4 HEAD --- tqtinterface/qt4/include/jri.h | 1 + tqtinterface/qt4/include/jri_md.h | 1 + tqtinterface/qt4/include/jritypes.h | 1 + tqtinterface/qt4/include/npapi.h | 1 + tqtinterface/qt4/include/npupp.h | 1 + tqtinterface/qt4/include/private/qobject_p.h | 1 + .../qt4/include/private/qt4_harfbuzz/AUTHORS | 6 + .../qt4/include/private/qt4_harfbuzz/COPYING | 24 + .../qt4/include/private/qt4_harfbuzz/ChangeLog | 0 .../qt4/include/private/qt4_harfbuzz/Makefile.am | 2 + tqtinterface/qt4/include/private/qt4_harfbuzz/NEWS | 0 .../qt4/include/private/qt4_harfbuzz/README | 7 + .../qt4/include/private/qt4_harfbuzz/autogen.sh | 116 + .../qt4/include/private/qt4_harfbuzz/configure.ac | 54 + .../include/private/qt4_harfbuzz/src/Makefile.am | 69 + .../private/qt4_harfbuzz/src/harfbuzz-arabic.c | 1144 ++++ .../qt4_harfbuzz/src/harfbuzz-buffer-private.h | 107 + .../private/qt4_harfbuzz/src/harfbuzz-buffer.c | 383 ++ .../private/qt4_harfbuzz/src/harfbuzz-buffer.h | 102 + .../private/qt4_harfbuzz/src/harfbuzz-dump-main.c | 97 + .../private/qt4_harfbuzz/src/harfbuzz-dump.c | 767 +++ .../private/qt4_harfbuzz/src/harfbuzz-dump.h | 41 + .../private/qt4_harfbuzz/src/harfbuzz-external.h | 153 + .../qt4_harfbuzz/src/harfbuzz-gdef-private.h | 135 + .../private/qt4_harfbuzz/src/harfbuzz-gdef.c | 1163 ++++ .../private/qt4_harfbuzz/src/harfbuzz-gdef.h | 140 + .../private/qt4_harfbuzz/src/harfbuzz-global.h | 122 + .../qt4_harfbuzz/src/harfbuzz-gpos-private.h | 729 +++ .../private/qt4_harfbuzz/src/harfbuzz-gpos.c | 6091 ++++++++++++++++++++ .../private/qt4_harfbuzz/src/harfbuzz-gpos.h | 155 + .../private/qt4_harfbuzz/src/harfbuzz-greek.c | 447 ++ .../qt4_harfbuzz/src/harfbuzz-gsub-private.h | 483 ++ .../private/qt4_harfbuzz/src/harfbuzz-gsub.c | 4329 ++++++++++++++ .../private/qt4_harfbuzz/src/harfbuzz-gsub.h | 148 + .../private/qt4_harfbuzz/src/harfbuzz-hangul.c | 268 + .../private/qt4_harfbuzz/src/harfbuzz-hebrew.c | 187 + .../private/qt4_harfbuzz/src/harfbuzz-impl.c | 84 + .../private/qt4_harfbuzz/src/harfbuzz-impl.h | 131 + .../private/qt4_harfbuzz/src/harfbuzz-indic.cpp | 1892 ++++++ .../private/qt4_harfbuzz/src/harfbuzz-khmer.c | 667 +++ .../private/qt4_harfbuzz/src/harfbuzz-myanmar.c | 542 ++ .../qt4_harfbuzz/src/harfbuzz-open-private.h | 102 + .../private/qt4_harfbuzz/src/harfbuzz-open.c | 1433 +++++ .../private/qt4_harfbuzz/src/harfbuzz-open.h | 288 + .../private/qt4_harfbuzz/src/harfbuzz-shape.h | 199 + .../qt4_harfbuzz/src/harfbuzz-shaper-all.cpp | 37 + .../qt4_harfbuzz/src/harfbuzz-shaper-private.h | 171 + .../private/qt4_harfbuzz/src/harfbuzz-shaper.cpp | 1338 +++++ .../private/qt4_harfbuzz/src/harfbuzz-shaper.h | 294 + .../qt4_harfbuzz/src/harfbuzz-stream-private.h | 81 + .../private/qt4_harfbuzz/src/harfbuzz-stream.c | 114 + .../private/qt4_harfbuzz/src/harfbuzz-stream.h | 51 + .../private/qt4_harfbuzz/src/harfbuzz-thai.c | 111 + .../private/qt4_harfbuzz/src/harfbuzz-tibetan.c | 274 + .../include/private/qt4_harfbuzz/src/harfbuzz.c | 32 + .../include/private/qt4_harfbuzz/src/harfbuzz.h | 38 + .../include/private/qt4_harfbuzz/tests/Makefile.am | 7 + .../private/qt4_harfbuzz/tests/fuzzing/fuzz.cc | 124 + .../qt4_harfbuzz/tests/linebreaking/Makefile.am | 12 + .../tests/linebreaking/harfbuzz-qt.cpp | 87 + .../qt4_harfbuzz/tests/linebreaking/main.cpp | 230 + .../private/qt4_harfbuzz/tests/shaping/Makefile.am | 14 + .../private/qt4_harfbuzz/tests/shaping/README | 9 + .../private/qt4_harfbuzz/tests/shaping/main.cpp | 1291 +++++ .../qt4/include/private/qt4_qapplication_p.h | 8 + tqtinterface/qt4/include/private/qt4_qbezier_p.h | 274 + tqtinterface/qt4/include/private/qt4_qfixed_p.h | 221 + tqtinterface/qt4/include/private/qt4_qfont_p.h | 278 + tqtinterface/qt4/include/private/qt4_qharfbuzz_p.h | 77 + tqtinterface/qt4/include/private/qt4_qimage_p.h | 114 + .../qt4/include/private/qt4_qmetaobject_p.h | 320 + tqtinterface/qt4/include/private/qt4_qprinter_p.h | 141 + .../qt4/include/private/qt4_qtextengine_p.h | 613 ++ .../qt4/include/private/qt4_qtextimagehandler_p.h | 80 + .../qt4/include/private/qt4_qunicodetables_p.h | 232 + tqtinterface/qt4/include/private/qt4_qwidget_p.h | 334 ++ tqtinterface/qt4/include/private/tqapplication_p.h | 1 + tqtinterface/qt4/include/private/tqcolor_p.h | 1 + tqtinterface/qt4/include/private/tqcom_p.h | 1 + tqtinterface/qt4/include/private/tqcomlibrary_p.h | 1 + .../qt4/include/private/tqcomponentfactory_p.h | 1 + .../qt4/include/private/tqcriticalsection_p.h | 1 + .../qt4/include/private/tqdialogbuttons_p.h | 1 + tqtinterface/qt4/include/private/tqdir_p.h | 1 + tqtinterface/qt4/include/private/tqeffects_p.h | 1 + tqtinterface/qt4/include/private/tqeventloop_p.h | 1 + tqtinterface/qt4/include/private/tqfiledefs_p.h | 1 + tqtinterface/qt4/include/private/tqfontcodecs_p.h | 1 + tqtinterface/qt4/include/private/tqfontdata_p.h | 1 + tqtinterface/qt4/include/private/tqfontengine_p.h | 1 + .../qt4/include/private/tqgfxdriverinterface_p.h | 1 + tqtinterface/qt4/include/private/tqgl_x11_p.h | 1 + .../qt4/include/private/tqgpluginmanager_p.h | 1 + .../qt4/include/private/tqimageformatinterface_p.h | 1 + .../qt4/include/private/tqinputcontext_p.h | 1 + tqtinterface/qt4/include/private/tqinternal_p.h | 1 + tqtinterface/qt4/include/private/tqisciicodec_p.h | 1 + .../qt4/include/private/tqkbddriverinterface_p.h | 1 + .../qt4/include/private/tqlayoutengine_p.h | 1 + tqtinterface/qt4/include/private/tqlibrary_p.h | 1 + tqtinterface/qt4/include/private/tqlocale_p.h | 1 + tqtinterface/qt4/include/private/tqlock_p.h | 1 + .../qt4/include/private/tqmousedriverinterface_p.h | 1 + tqtinterface/qt4/include/private/tqmutex_p.h | 1 + tqtinterface/qt4/include/private/tqmutexpool_p.h | 1 + tqtinterface/qt4/include/private/tqpainter_p.h | 1 + .../qt4/include/private/tqpluginmanager_p.h | 1 + tqtinterface/qt4/include/private/tqprinter_p.h | 1 + tqtinterface/qt4/include/private/tqpsprinter_p.h | 1 + tqtinterface/qt4/include/private/tqrichtext_p.h | 1 + .../qt4/include/private/tqscriptengine_p.h | 1 + tqtinterface/qt4/include/private/tqsettings_p.h | 1 + .../qt4/include/private/tqsharedmemory_p.h | 1 + .../qt4/include/private/tqsqldriverinterface_p.h | 1 + .../qt4/include/private/tqsqlextension_p.h | 1 + tqtinterface/qt4/include/private/tqsqlmanager_p.h | 1 + .../qt4/include/private/tqstyleinterface_p.h | 1 + tqtinterface/qt4/include/private/tqsvgdevice_p.h | 1 + .../qt4/include/private/tqsyntaxhighlighter_p.h | 1 + tqtinterface/qt4/include/private/tqt_x11_p.h | 1 + .../qt4/include/private/tqtextcodecinterface_p.h | 1 + tqtinterface/qt4/include/private/tqtextengine_p.h | 1 + tqtinterface/qt4/include/private/tqtextlayout_p.h | 1 + .../qt4/include/private/tqthreadinstance_p.h | 1 + tqtinterface/qt4/include/private/tqtitlebar_p.h | 1 + tqtinterface/qt4/include/private/tqucom_p.h | 1 + tqtinterface/qt4/include/private/tqucomextra_p.h | 1 + .../qt4/include/private/tqunicodetables_p.h | 1 + tqtinterface/qt4/include/private/tqwidget_p.h | 1 + .../qt4/include/private/tqwidgetinterface_p.h | 1 + .../qt4/include/private/tqwidgetresizehandler_p.h | 1 + tqtinterface/qt4/include/tq1xcompatibility.h | 1 + tqtinterface/qt4/include/tqabstractlayout.h | 1 + tqtinterface/qt4/include/tqaccel.h | 1 + tqtinterface/qt4/include/tqaccessible.h | 1 + tqtinterface/qt4/include/tqaction.h | 1 + tqtinterface/qt4/include/tqapp.h | 1 + tqtinterface/qt4/include/tqapplication.h | 1 + tqtinterface/qt4/include/tqarray.h | 1 + tqtinterface/qt4/include/tqasciicache.h | 1 + tqtinterface/qt4/include/tqasciidict.h | 1 + tqtinterface/qt4/include/tqassistantclient.h | 1 + tqtinterface/qt4/include/tqasyncimageio.h | 1 + tqtinterface/qt4/include/tqasyncio.h | 1 + tqtinterface/qt4/include/tqbig5codec.h | 1 + tqtinterface/qt4/include/tqbitarray.h | 1 + tqtinterface/qt4/include/tqbitarry.h | 1 + tqtinterface/qt4/include/tqbitmap.h | 1 + tqtinterface/qt4/include/tqbrush.h | 1 + tqtinterface/qt4/include/tqbttngrp.h | 1 + tqtinterface/qt4/include/tqbuffer.h | 1 + tqtinterface/qt4/include/tqbutton.h | 1 + tqtinterface/qt4/include/tqbuttongroup.h | 1 + tqtinterface/qt4/include/tqcache.h | 1 + tqtinterface/qt4/include/tqcanvas.h | 1 + tqtinterface/qt4/include/tqcdestyle.h | 1 + tqtinterface/qt4/include/tqcheckbox.h | 1 + tqtinterface/qt4/include/tqchkbox.h | 1 + tqtinterface/qt4/include/tqcleanuphandler.h | 1 + tqtinterface/qt4/include/tqclipboard.h | 1 + tqtinterface/qt4/include/tqclipbrd.h | 1 + tqtinterface/qt4/include/tqcollect.h | 1 + tqtinterface/qt4/include/tqcollection.h | 1 + tqtinterface/qt4/include/tqcolor.h | 1 + tqtinterface/qt4/include/tqcolordialog.h | 1 + tqtinterface/qt4/include/tqcombo.h | 1 + tqtinterface/qt4/include/tqcombobox.h | 1 + tqtinterface/qt4/include/tqcommonstyle.h | 1 + tqtinterface/qt4/include/tqcompactstyle.h | 1 + tqtinterface/qt4/include/tqconfig-dist.h | 1 + tqtinterface/qt4/include/tqconfig-large.h | 1 + tqtinterface/qt4/include/tqconfig-medium.h | 1 + tqtinterface/qt4/include/tqconfig-minimal.h | 1 + tqtinterface/qt4/include/tqconfig-small.h | 1 + tqtinterface/qt4/include/tqconnect.h | 1 + tqtinterface/qt4/include/tqconnection.h | 1 + tqtinterface/qt4/include/tqcstring.h | 1 + tqtinterface/qt4/include/tqcursor.h | 1 + tqtinterface/qt4/include/tqdatabrowser.h | 1 + tqtinterface/qt4/include/tqdatastream.h | 1 + tqtinterface/qt4/include/tqdatatable.h | 1 + tqtinterface/qt4/include/tqdataview.h | 1 + tqtinterface/qt4/include/tqdatetime.h | 1 + tqtinterface/qt4/include/tqdatetimeedit.h | 1 + tqtinterface/qt4/include/tqdatetm.h | 1 + tqtinterface/qt4/include/tqdeepcopy.h | 1 + tqtinterface/qt4/include/tqdesktopwidget.h | 1 + tqtinterface/qt4/include/tqdial.h | 1 + tqtinterface/qt4/include/tqdialog.h | 1 + tqtinterface/qt4/include/tqdict.h | 1 + tqtinterface/qt4/include/tqdir.h | 1 + tqtinterface/qt4/include/tqdns.h | 1 + tqtinterface/qt4/include/tqdockarea.h | 1 + tqtinterface/qt4/include/tqdockwindow.h | 1 + tqtinterface/qt4/include/tqdom.h | 1 + tqtinterface/qt4/include/tqdragobject.h | 1 + tqtinterface/qt4/include/tqdrawutil.h | 1 + tqtinterface/qt4/include/tqdrawutl.h | 1 + tqtinterface/qt4/include/tqdropsite.h | 1 + tqtinterface/qt4/include/tqdstream.h | 1 + tqtinterface/qt4/include/tqeditorfactory.h | 1 + tqtinterface/qt4/include/tqerrormessage.h | 1 + tqtinterface/qt4/include/tqeucjpcodec.h | 1 + tqtinterface/qt4/include/tqeuckrcodec.h | 1 + tqtinterface/qt4/include/tqevent.h | 1 + tqtinterface/qt4/include/tqeventloop.h | 1 + tqtinterface/qt4/include/tqfeatures.h | 1 + tqtinterface/qt4/include/tqfile.h | 1 + tqtinterface/qt4/include/tqfiledef.h | 1 + tqtinterface/qt4/include/tqfiledialog.h | 1 + tqtinterface/qt4/include/tqfiledlg.h | 1 + tqtinterface/qt4/include/tqfileinf.h | 1 + tqtinterface/qt4/include/tqfileinfo.h | 1 + tqtinterface/qt4/include/tqfocusdata.h | 1 + tqtinterface/qt4/include/tqfont.h | 1 + tqtinterface/qt4/include/tqfontdatabase.h | 1 + tqtinterface/qt4/include/tqfontdialog.h | 1 + tqtinterface/qt4/include/tqfontinf.h | 1 + tqtinterface/qt4/include/tqfontinfo.h | 1 + tqtinterface/qt4/include/tqfontmet.h | 1 + tqtinterface/qt4/include/tqfontmetrics.h | 1 + tqtinterface/qt4/include/tqframe.h | 1 + tqtinterface/qt4/include/tqftp.h | 1 + tqtinterface/qt4/include/tqgarray.h | 1 + tqtinterface/qt4/include/tqgb18030codec.h | 1 + tqtinterface/qt4/include/tqgbkcodec.h | 1 + tqtinterface/qt4/include/tqgcache.h | 1 + tqtinterface/qt4/include/tqgdict.h | 1 + tqtinterface/qt4/include/tqgeneric.h | 1 + tqtinterface/qt4/include/tqgif.h | 1 + tqtinterface/qt4/include/tqgl.h | 1 + tqtinterface/qt4/include/tqglcolormap.h | 1 + tqtinterface/qt4/include/tqglist.h | 1 + tqtinterface/qt4/include/tqglobal.h | 1 + tqtinterface/qt4/include/tqgplugin.h | 1 + tqtinterface/qt4/include/tqgrid.h | 1 + tqtinterface/qt4/include/tqgridview.h | 1 + tqtinterface/qt4/include/tqgroupbox.h | 1 + tqtinterface/qt4/include/tqgrpbox.h | 1 + tqtinterface/qt4/include/tqguardedptr.h | 1 + tqtinterface/qt4/include/tqgvector.h | 1 + tqtinterface/qt4/include/tqhbox.h | 1 + tqtinterface/qt4/include/tqhbuttongroup.h | 1 + tqtinterface/qt4/include/tqheader.h | 1 + tqtinterface/qt4/include/tqhgroupbox.h | 1 + tqtinterface/qt4/include/tqhostaddress.h | 1 + tqtinterface/qt4/include/tqhttp.h | 1 + tqtinterface/qt4/include/tqiconset.h | 1 + tqtinterface/qt4/include/tqiconview.h | 1 + tqtinterface/qt4/include/tqimage.h | 1 + tqtinterface/qt4/include/tqimageformatplugin.h | 1 + tqtinterface/qt4/include/tqinputdialog.h | 1 + tqtinterface/qt4/include/tqintcach.h | 1 + tqtinterface/qt4/include/tqintcache.h | 1 + tqtinterface/qt4/include/tqintdict.h | 1 + tqtinterface/qt4/include/tqinterlacestyle.h | 1 + tqtinterface/qt4/include/tqiodev.h | 1 + tqtinterface/qt4/include/tqiodevice.h | 1 + tqtinterface/qt4/include/tqjiscodec.h | 1 + tqtinterface/qt4/include/tqjpegio.h | 1 + tqtinterface/qt4/include/tqjpunicode.h | 1 + tqtinterface/qt4/include/tqkeycode.h | 1 + tqtinterface/qt4/include/tqkeysequence.h | 1 + tqtinterface/qt4/include/tqlabel.h | 1 + tqtinterface/qt4/include/tqlayout.h | 1 + tqtinterface/qt4/include/tqlcdnum.h | 1 + tqtinterface/qt4/include/tqlcdnumber.h | 1 + tqtinterface/qt4/include/tqlibrary.h | 1 + tqtinterface/qt4/include/tqlined.h | 1 + tqtinterface/qt4/include/tqlineedit.h | 1 + tqtinterface/qt4/include/tqlist.h | 1 + tqtinterface/qt4/include/tqlistbox.h | 1 + tqtinterface/qt4/include/tqlistview.h | 1 + tqtinterface/qt4/include/tqlocale.h | 1 + tqtinterface/qt4/include/tqlocalfs.h | 1 + tqtinterface/qt4/include/tqmainwindow.h | 1 + tqtinterface/qt4/include/tqmap.h | 1 + tqtinterface/qt4/include/tqmemarray.h | 1 + tqtinterface/qt4/include/tqmenubar.h | 1 + tqtinterface/qt4/include/tqmenudata.h | 1 + tqtinterface/qt4/include/tqmenudta.h | 1 + tqtinterface/qt4/include/tqmessagebox.h | 1 + tqtinterface/qt4/include/tqmetaobj.h | 1 + tqtinterface/qt4/include/tqmetaobject.h | 1 + tqtinterface/qt4/include/tqmime.h | 1 + tqtinterface/qt4/include/tqmlined.h | 1 + tqtinterface/qt4/include/tqmngio.h | 1 + tqtinterface/qt4/include/tqmotifplusstyle.h | 1 + tqtinterface/qt4/include/tqmotifstyle.h | 1 + tqtinterface/qt4/include/tqmovie.h | 1 + tqtinterface/qt4/include/tqmsgbox.h | 1 + tqtinterface/qt4/include/tqmultilinedit.h | 1 + tqtinterface/qt4/include/tqmultilineedit.h | 1 + tqtinterface/qt4/include/tqmutex.h | 1 + tqtinterface/qt4/include/tqnamespace.h | 1 + tqtinterface/qt4/include/tqnetwork.h | 1 + tqtinterface/qt4/include/tqnetworkprotocol.h | 1 + tqtinterface/qt4/include/tqnp.h | 1 + tqtinterface/qt4/include/tqobjcoll.h | 1 + tqtinterface/qt4/include/tqobjdefs.h | 1 + tqtinterface/qt4/include/tqobject.h | 1 + tqtinterface/qt4/include/tqobjectcleanuphandler.h | 1 + tqtinterface/qt4/include/tqobjectdefs.h | 1 + tqtinterface/qt4/include/tqobjectdict.h | 1 + tqtinterface/qt4/include/tqobjectlist.h | 1 + tqtinterface/qt4/include/tqpaintd.h | 1 + tqtinterface/qt4/include/tqpaintdc.h | 1 + tqtinterface/qt4/include/tqpaintdevice.h | 1 + tqtinterface/qt4/include/tqpaintdevicedefs.h | 1 + tqtinterface/qt4/include/tqpaintdevicemetrics.h | 1 + tqtinterface/qt4/include/tqpainter.h | 1 + tqtinterface/qt4/include/tqpair.h | 1 + tqtinterface/qt4/include/tqpalette.h | 1 + tqtinterface/qt4/include/tqpdevmet.h | 1 + tqtinterface/qt4/include/tqpen.h | 1 + tqtinterface/qt4/include/tqpicture.h | 1 + tqtinterface/qt4/include/tqpixmap.h | 1 + tqtinterface/qt4/include/tqpixmapcache.h | 1 + tqtinterface/qt4/include/tqplatinumstyle.h | 1 + tqtinterface/qt4/include/tqpmcache.h | 1 + tqtinterface/qt4/include/tqpngio.h | 1 + tqtinterface/qt4/include/tqpntarry.h | 1 + tqtinterface/qt4/include/tqpoint.h | 1 + tqtinterface/qt4/include/tqpointarray.h | 1 + tqtinterface/qt4/include/tqpolygonscanner.h | 1 + tqtinterface/qt4/include/tqpopmenu.h | 1 + tqtinterface/qt4/include/tqpopupmenu.h | 1 + tqtinterface/qt4/include/tqprintdialog.h | 1 + tqtinterface/qt4/include/tqprinter.h | 1 + tqtinterface/qt4/include/tqprndlg.h | 1 + tqtinterface/qt4/include/tqprocess.h | 1 + tqtinterface/qt4/include/tqprogbar.h | 1 + tqtinterface/qt4/include/tqprogdlg.h | 1 + tqtinterface/qt4/include/tqprogressbar.h | 1 + tqtinterface/qt4/include/tqprogressdialog.h | 1 + tqtinterface/qt4/include/tqpsprn.h | 1 + tqtinterface/qt4/include/tqptrcollection.h | 1 + tqtinterface/qt4/include/tqptrdict.h | 1 + tqtinterface/qt4/include/tqptrlist.h | 1 + tqtinterface/qt4/include/tqptrqueue.h | 1 + tqtinterface/qt4/include/tqptrstack.h | 1 + tqtinterface/qt4/include/tqptrvector.h | 1 + tqtinterface/qt4/include/tqpushbt.h | 1 + tqtinterface/qt4/include/tqpushbutton.h | 1 + tqtinterface/qt4/include/tqqueue.h | 1 + tqtinterface/qt4/include/tqradiobt.h | 1 + tqtinterface/qt4/include/tqradiobutton.h | 1 + tqtinterface/qt4/include/tqrangecontrol.h | 1 + tqtinterface/qt4/include/tqrangect.h | 1 + tqtinterface/qt4/include/tqrect.h | 1 + tqtinterface/qt4/include/tqregexp.h | 1 + tqtinterface/qt4/include/tqregion.h | 1 + tqtinterface/qt4/include/tqrtlcodec.h | 1 + tqtinterface/qt4/include/tqscrbar.h | 1 + tqtinterface/qt4/include/tqscrollbar.h | 1 + tqtinterface/qt4/include/tqscrollview.h | 1 + tqtinterface/qt4/include/tqsemaphore.h | 1 + tqtinterface/qt4/include/tqsemimodal.h | 1 + tqtinterface/qt4/include/tqserversocket.h | 1 + tqtinterface/qt4/include/tqsession.h | 1 + tqtinterface/qt4/include/tqsessionmanager.h | 1 + tqtinterface/qt4/include/tqsettings.h | 1 + tqtinterface/qt4/include/tqsgistyle.h | 1 + tqtinterface/qt4/include/tqshared.h | 1 + tqtinterface/qt4/include/tqsignal.h | 1 + tqtinterface/qt4/include/tqsignalmapper.h | 1 + tqtinterface/qt4/include/tqsignalslotimp.h | 1 + tqtinterface/qt4/include/tqsimplerichtext.h | 1 + tqtinterface/qt4/include/tqsize.h | 1 + tqtinterface/qt4/include/tqsizegrip.h | 1 + tqtinterface/qt4/include/tqsizepolicy.h | 1 + tqtinterface/qt4/include/tqsjiscodec.h | 1 + tqtinterface/qt4/include/tqslider.h | 1 + tqtinterface/qt4/include/tqsocket.h | 1 + tqtinterface/qt4/include/tqsocketdevice.h | 1 + tqtinterface/qt4/include/tqsocketnotifier.h | 1 + tqtinterface/qt4/include/tqsocknot.h | 1 + tqtinterface/qt4/include/tqsortedlist.h | 1 + tqtinterface/qt4/include/tqsound.h | 1 + tqtinterface/qt4/include/tqspinbox.h | 1 + tqtinterface/qt4/include/tqsplashscreen.h | 1 + tqtinterface/qt4/include/tqsplitter.h | 1 + tqtinterface/qt4/include/tqsql.h | 1 + tqtinterface/qt4/include/tqsqlcursor.h | 1 + tqtinterface/qt4/include/tqsqldatabase.h | 1 + tqtinterface/qt4/include/tqsqldriver.h | 1 + tqtinterface/qt4/include/tqsqldriverplugin.h | 1 + tqtinterface/qt4/include/tqsqleditorfactory.h | 1 + tqtinterface/qt4/include/tqsqlerror.h | 1 + tqtinterface/qt4/include/tqsqlfield.h | 1 + tqtinterface/qt4/include/tqsqlform.h | 1 + tqtinterface/qt4/include/tqsqlindex.h | 1 + tqtinterface/qt4/include/tqsqlpropertymap.h | 1 + tqtinterface/qt4/include/tqsqlquery.h | 1 + tqtinterface/qt4/include/tqsqlrecord.h | 1 + tqtinterface/qt4/include/tqsqlresult.h | 1 + tqtinterface/qt4/include/tqsqlselectcursor.h | 1 + tqtinterface/qt4/include/tqstack.h | 1 + tqtinterface/qt4/include/tqstatusbar.h | 1 + tqtinterface/qt4/include/tqstring.h | 1 + tqtinterface/qt4/include/tqstringlist.h | 1 + tqtinterface/qt4/include/tqstrlist.h | 1 + tqtinterface/qt4/include/tqstrvec.h | 1 + tqtinterface/qt4/include/tqstyle.h | 1 + tqtinterface/qt4/include/tqstylefactory.h | 1 + tqtinterface/qt4/include/tqstyleplugin.h | 1 + tqtinterface/qt4/include/tqstylesheet.h | 1 + tqtinterface/qt4/include/tqsyntaxhighlighter.h | 1 + tqtinterface/qt4/include/tqt.h | 1 + tqtinterface/qt4/include/tqtabbar.h | 1 + tqtinterface/qt4/include/tqtabdialog.h | 1 + tqtinterface/qt4/include/tqtabdlg.h | 1 + tqtinterface/qt4/include/tqtable.h | 1 + tqtinterface/qt4/include/tqtabwidget.h | 1 + tqtinterface/qt4/include/tqtenuminheritance.h | 36 + tqtinterface/qt4/include/tqtextbrowser.h | 1 + tqtinterface/qt4/include/tqtextcodec.h | 1 + tqtinterface/qt4/include/tqtextcodecfactory.h | 1 + tqtinterface/qt4/include/tqtextcodecplugin.h | 1 + tqtinterface/qt4/include/tqtextedit.h | 1 + tqtinterface/qt4/include/tqtextstream.h | 1 + tqtinterface/qt4/include/tqtextview.h | 1 + tqtinterface/qt4/include/tqtglobaldefines.h | 1 + tqtinterface/qt4/include/tqtglobaldefines.h~ | 492 ++ tqtinterface/qt4/include/tqtglobalsettings.h | 1 + tqtinterface/qt4/include/tqthread.h | 1 + tqtinterface/qt4/include/tqthreadstorage.h | 1 + tqtinterface/qt4/include/tqtimer.h | 1 + tqtinterface/qt4/include/tqtl.h | 1 + tqtinterface/qt4/include/tqtoolbar.h | 1 + tqtinterface/qt4/include/tqtoolbox.h | 1 + tqtinterface/qt4/include/tqtoolbutton.h | 1 + tqtinterface/qt4/include/tqtooltip.h | 1 + tqtinterface/qt4/include/tqtranslator.h | 1 + tqtinterface/qt4/include/tqtsciicodec.h | 1 + tqtinterface/qt4/include/tqtstream.h | 1 + tqtinterface/qt4/include/tqurl.h | 1 + tqtinterface/qt4/include/tqurlinfo.h | 1 + tqtinterface/qt4/include/tqurloperator.h | 1 + tqtinterface/qt4/include/tqutfcodec.h | 1 + tqtinterface/qt4/include/tquuid.h | 1 + tqtinterface/qt4/include/tqvalidator.h | 1 + tqtinterface/qt4/include/tqvaluelist.h | 1 + tqtinterface/qt4/include/tqvaluestack.h | 1 + tqtinterface/qt4/include/tqvaluevector.h | 1 + tqtinterface/qt4/include/tqvariant.h | 1 + tqtinterface/qt4/include/tqvbox.h | 1 + tqtinterface/qt4/include/tqvbuttongroup.h | 1 + tqtinterface/qt4/include/tqvector.h | 1 + tqtinterface/qt4/include/tqvfbhdr.h | 1 + tqtinterface/qt4/include/tqvgroupbox.h | 1 + tqtinterface/qt4/include/tqwaitcondition.h | 1 + tqtinterface/qt4/include/tqwhatsthis.h | 1 + tqtinterface/qt4/include/tqwidcoll.h | 1 + tqtinterface/qt4/include/tqwidget.h | 1 + tqtinterface/qt4/include/tqwidgetfactory.h | 1 + tqtinterface/qt4/include/tqwidgetintdict.h | 1 + tqtinterface/qt4/include/tqwidgetlist.h | 1 + tqtinterface/qt4/include/tqwidgetplugin.h | 1 + tqtinterface/qt4/include/tqwidgetstack.h | 1 + tqtinterface/qt4/include/tqwindefs.h | 1 + tqtinterface/qt4/include/tqwindow.h | 1 + tqtinterface/qt4/include/tqwindowdefs.h | 1 + tqtinterface/qt4/include/tqwindowsstyle.h | 1 + tqtinterface/qt4/include/tqwinexport.h | 1 + tqtinterface/qt4/include/tqwizard.h | 1 + tqtinterface/qt4/include/tqwmatrix.h | 1 + tqtinterface/qt4/include/tqworkspace.h | 1 + tqtinterface/qt4/include/tqxml.h | 1 + 469 files changed, 30739 insertions(+) create mode 120000 tqtinterface/qt4/include/jri.h create mode 120000 tqtinterface/qt4/include/jri_md.h create mode 120000 tqtinterface/qt4/include/jritypes.h create mode 120000 tqtinterface/qt4/include/npapi.h create mode 120000 tqtinterface/qt4/include/npupp.h create mode 120000 tqtinterface/qt4/include/private/qobject_p.h create mode 100644 tqtinterface/qt4/include/private/qt4_harfbuzz/AUTHORS create mode 100644 tqtinterface/qt4/include/private/qt4_harfbuzz/COPYING create mode 100644 tqtinterface/qt4/include/private/qt4_harfbuzz/ChangeLog create mode 100644 tqtinterface/qt4/include/private/qt4_harfbuzz/Makefile.am create mode 100644 tqtinterface/qt4/include/private/qt4_harfbuzz/NEWS create mode 100644 tqtinterface/qt4/include/private/qt4_harfbuzz/README create mode 100755 tqtinterface/qt4/include/private/qt4_harfbuzz/autogen.sh create mode 100644 tqtinterface/qt4/include/private/qt4_harfbuzz/configure.ac create mode 100644 tqtinterface/qt4/include/private/qt4_harfbuzz/src/Makefile.am create mode 100644 tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-arabic.c create mode 100644 tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-buffer-private.h create mode 100644 tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-buffer.c create mode 100644 tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-buffer.h create mode 100644 tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-dump-main.c create mode 100644 tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-dump.c create mode 100644 tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-dump.h create mode 100644 tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-external.h create mode 100644 tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-gdef-private.h create mode 100644 tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-gdef.c create mode 100644 tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-gdef.h create mode 100644 tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-global.h create mode 100644 tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-gpos-private.h create mode 100644 tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-gpos.c create mode 100644 tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-gpos.h create mode 100644 tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-greek.c create mode 100644 tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-gsub-private.h create mode 100644 tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-gsub.c create mode 100644 tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-gsub.h create mode 100644 tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-hangul.c create mode 100644 tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-hebrew.c create mode 100644 tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-impl.c create mode 100644 tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-impl.h create mode 100644 tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-indic.cpp create mode 100644 tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-khmer.c create mode 100644 tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-myanmar.c create mode 100644 tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-open-private.h create mode 100644 tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-open.c create mode 100644 tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-open.h create mode 100644 tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-shape.h create mode 100644 tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-shaper-all.cpp create mode 100644 tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-shaper-private.h create mode 100644 tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-shaper.cpp create mode 100644 tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-shaper.h create mode 100644 tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-stream-private.h create mode 100644 tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-stream.c create mode 100644 tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-stream.h create mode 100644 tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-thai.c create mode 100644 tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-tibetan.c create mode 100644 tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz.c create mode 100644 tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz.h create mode 100644 tqtinterface/qt4/include/private/qt4_harfbuzz/tests/Makefile.am create mode 100644 tqtinterface/qt4/include/private/qt4_harfbuzz/tests/fuzzing/fuzz.cc create mode 100644 tqtinterface/qt4/include/private/qt4_harfbuzz/tests/linebreaking/Makefile.am create mode 100644 tqtinterface/qt4/include/private/qt4_harfbuzz/tests/linebreaking/harfbuzz-qt.cpp create mode 100644 tqtinterface/qt4/include/private/qt4_harfbuzz/tests/linebreaking/main.cpp create mode 100644 tqtinterface/qt4/include/private/qt4_harfbuzz/tests/shaping/Makefile.am create mode 100644 tqtinterface/qt4/include/private/qt4_harfbuzz/tests/shaping/README create mode 100644 tqtinterface/qt4/include/private/qt4_harfbuzz/tests/shaping/main.cpp create mode 100644 tqtinterface/qt4/include/private/qt4_qapplication_p.h create mode 100644 tqtinterface/qt4/include/private/qt4_qbezier_p.h create mode 100644 tqtinterface/qt4/include/private/qt4_qfixed_p.h create mode 100644 tqtinterface/qt4/include/private/qt4_qfont_p.h create mode 100644 tqtinterface/qt4/include/private/qt4_qharfbuzz_p.h create mode 100644 tqtinterface/qt4/include/private/qt4_qimage_p.h create mode 100644 tqtinterface/qt4/include/private/qt4_qmetaobject_p.h create mode 100644 tqtinterface/qt4/include/private/qt4_qprinter_p.h create mode 100644 tqtinterface/qt4/include/private/qt4_qtextengine_p.h create mode 100644 tqtinterface/qt4/include/private/qt4_qtextimagehandler_p.h create mode 100644 tqtinterface/qt4/include/private/qt4_qunicodetables_p.h create mode 100644 tqtinterface/qt4/include/private/qt4_qwidget_p.h create mode 120000 tqtinterface/qt4/include/private/tqapplication_p.h create mode 120000 tqtinterface/qt4/include/private/tqcolor_p.h create mode 120000 tqtinterface/qt4/include/private/tqcom_p.h create mode 120000 tqtinterface/qt4/include/private/tqcomlibrary_p.h create mode 120000 tqtinterface/qt4/include/private/tqcomponentfactory_p.h create mode 120000 tqtinterface/qt4/include/private/tqcriticalsection_p.h create mode 120000 tqtinterface/qt4/include/private/tqdialogbuttons_p.h create mode 120000 tqtinterface/qt4/include/private/tqdir_p.h create mode 120000 tqtinterface/qt4/include/private/tqeffects_p.h create mode 120000 tqtinterface/qt4/include/private/tqeventloop_p.h create mode 120000 tqtinterface/qt4/include/private/tqfiledefs_p.h create mode 120000 tqtinterface/qt4/include/private/tqfontcodecs_p.h create mode 120000 tqtinterface/qt4/include/private/tqfontdata_p.h create mode 120000 tqtinterface/qt4/include/private/tqfontengine_p.h create mode 120000 tqtinterface/qt4/include/private/tqgfxdriverinterface_p.h create mode 120000 tqtinterface/qt4/include/private/tqgl_x11_p.h create mode 120000 tqtinterface/qt4/include/private/tqgpluginmanager_p.h create mode 120000 tqtinterface/qt4/include/private/tqimageformatinterface_p.h create mode 120000 tqtinterface/qt4/include/private/tqinputcontext_p.h create mode 120000 tqtinterface/qt4/include/private/tqinternal_p.h create mode 120000 tqtinterface/qt4/include/private/tqisciicodec_p.h create mode 120000 tqtinterface/qt4/include/private/tqkbddriverinterface_p.h create mode 120000 tqtinterface/qt4/include/private/tqlayoutengine_p.h create mode 120000 tqtinterface/qt4/include/private/tqlibrary_p.h create mode 120000 tqtinterface/qt4/include/private/tqlocale_p.h create mode 120000 tqtinterface/qt4/include/private/tqlock_p.h create mode 120000 tqtinterface/qt4/include/private/tqmousedriverinterface_p.h create mode 120000 tqtinterface/qt4/include/private/tqmutex_p.h create mode 120000 tqtinterface/qt4/include/private/tqmutexpool_p.h create mode 120000 tqtinterface/qt4/include/private/tqpainter_p.h create mode 120000 tqtinterface/qt4/include/private/tqpluginmanager_p.h create mode 120000 tqtinterface/qt4/include/private/tqprinter_p.h create mode 120000 tqtinterface/qt4/include/private/tqpsprinter_p.h create mode 120000 tqtinterface/qt4/include/private/tqrichtext_p.h create mode 120000 tqtinterface/qt4/include/private/tqscriptengine_p.h create mode 120000 tqtinterface/qt4/include/private/tqsettings_p.h create mode 120000 tqtinterface/qt4/include/private/tqsharedmemory_p.h create mode 120000 tqtinterface/qt4/include/private/tqsqldriverinterface_p.h create mode 120000 tqtinterface/qt4/include/private/tqsqlextension_p.h create mode 120000 tqtinterface/qt4/include/private/tqsqlmanager_p.h create mode 120000 tqtinterface/qt4/include/private/tqstyleinterface_p.h create mode 120000 tqtinterface/qt4/include/private/tqsvgdevice_p.h create mode 120000 tqtinterface/qt4/include/private/tqsyntaxhighlighter_p.h create mode 120000 tqtinterface/qt4/include/private/tqt_x11_p.h create mode 120000 tqtinterface/qt4/include/private/tqtextcodecinterface_p.h create mode 120000 tqtinterface/qt4/include/private/tqtextengine_p.h create mode 120000 tqtinterface/qt4/include/private/tqtextlayout_p.h create mode 120000 tqtinterface/qt4/include/private/tqthreadinstance_p.h create mode 120000 tqtinterface/qt4/include/private/tqtitlebar_p.h create mode 120000 tqtinterface/qt4/include/private/tqucom_p.h create mode 120000 tqtinterface/qt4/include/private/tqucomextra_p.h create mode 120000 tqtinterface/qt4/include/private/tqunicodetables_p.h create mode 120000 tqtinterface/qt4/include/private/tqwidget_p.h create mode 120000 tqtinterface/qt4/include/private/tqwidgetinterface_p.h create mode 120000 tqtinterface/qt4/include/private/tqwidgetresizehandler_p.h create mode 120000 tqtinterface/qt4/include/tq1xcompatibility.h create mode 120000 tqtinterface/qt4/include/tqabstractlayout.h create mode 120000 tqtinterface/qt4/include/tqaccel.h create mode 120000 tqtinterface/qt4/include/tqaccessible.h create mode 120000 tqtinterface/qt4/include/tqaction.h create mode 120000 tqtinterface/qt4/include/tqapp.h create mode 120000 tqtinterface/qt4/include/tqapplication.h create mode 120000 tqtinterface/qt4/include/tqarray.h create mode 120000 tqtinterface/qt4/include/tqasciicache.h create mode 120000 tqtinterface/qt4/include/tqasciidict.h create mode 120000 tqtinterface/qt4/include/tqassistantclient.h create mode 120000 tqtinterface/qt4/include/tqasyncimageio.h create mode 120000 tqtinterface/qt4/include/tqasyncio.h create mode 120000 tqtinterface/qt4/include/tqbig5codec.h create mode 120000 tqtinterface/qt4/include/tqbitarray.h create mode 120000 tqtinterface/qt4/include/tqbitarry.h create mode 120000 tqtinterface/qt4/include/tqbitmap.h create mode 120000 tqtinterface/qt4/include/tqbrush.h create mode 120000 tqtinterface/qt4/include/tqbttngrp.h create mode 120000 tqtinterface/qt4/include/tqbuffer.h create mode 120000 tqtinterface/qt4/include/tqbutton.h create mode 120000 tqtinterface/qt4/include/tqbuttongroup.h create mode 120000 tqtinterface/qt4/include/tqcache.h create mode 120000 tqtinterface/qt4/include/tqcanvas.h create mode 120000 tqtinterface/qt4/include/tqcdestyle.h create mode 120000 tqtinterface/qt4/include/tqcheckbox.h create mode 120000 tqtinterface/qt4/include/tqchkbox.h create mode 120000 tqtinterface/qt4/include/tqcleanuphandler.h create mode 120000 tqtinterface/qt4/include/tqclipboard.h create mode 120000 tqtinterface/qt4/include/tqclipbrd.h create mode 120000 tqtinterface/qt4/include/tqcollect.h create mode 120000 tqtinterface/qt4/include/tqcollection.h create mode 120000 tqtinterface/qt4/include/tqcolor.h create mode 120000 tqtinterface/qt4/include/tqcolordialog.h create mode 120000 tqtinterface/qt4/include/tqcombo.h create mode 120000 tqtinterface/qt4/include/tqcombobox.h create mode 120000 tqtinterface/qt4/include/tqcommonstyle.h create mode 120000 tqtinterface/qt4/include/tqcompactstyle.h create mode 120000 tqtinterface/qt4/include/tqconfig-dist.h create mode 120000 tqtinterface/qt4/include/tqconfig-large.h create mode 120000 tqtinterface/qt4/include/tqconfig-medium.h create mode 120000 tqtinterface/qt4/include/tqconfig-minimal.h create mode 120000 tqtinterface/qt4/include/tqconfig-small.h create mode 120000 tqtinterface/qt4/include/tqconnect.h create mode 120000 tqtinterface/qt4/include/tqconnection.h create mode 120000 tqtinterface/qt4/include/tqcstring.h create mode 120000 tqtinterface/qt4/include/tqcursor.h create mode 120000 tqtinterface/qt4/include/tqdatabrowser.h create mode 120000 tqtinterface/qt4/include/tqdatastream.h create mode 120000 tqtinterface/qt4/include/tqdatatable.h create mode 120000 tqtinterface/qt4/include/tqdataview.h create mode 120000 tqtinterface/qt4/include/tqdatetime.h create mode 120000 tqtinterface/qt4/include/tqdatetimeedit.h create mode 120000 tqtinterface/qt4/include/tqdatetm.h create mode 120000 tqtinterface/qt4/include/tqdeepcopy.h create mode 120000 tqtinterface/qt4/include/tqdesktopwidget.h create mode 120000 tqtinterface/qt4/include/tqdial.h create mode 120000 tqtinterface/qt4/include/tqdialog.h create mode 120000 tqtinterface/qt4/include/tqdict.h create mode 120000 tqtinterface/qt4/include/tqdir.h create mode 120000 tqtinterface/qt4/include/tqdns.h create mode 120000 tqtinterface/qt4/include/tqdockarea.h create mode 120000 tqtinterface/qt4/include/tqdockwindow.h create mode 120000 tqtinterface/qt4/include/tqdom.h create mode 120000 tqtinterface/qt4/include/tqdragobject.h create mode 120000 tqtinterface/qt4/include/tqdrawutil.h create mode 120000 tqtinterface/qt4/include/tqdrawutl.h create mode 120000 tqtinterface/qt4/include/tqdropsite.h create mode 120000 tqtinterface/qt4/include/tqdstream.h create mode 120000 tqtinterface/qt4/include/tqeditorfactory.h create mode 120000 tqtinterface/qt4/include/tqerrormessage.h create mode 120000 tqtinterface/qt4/include/tqeucjpcodec.h create mode 120000 tqtinterface/qt4/include/tqeuckrcodec.h create mode 120000 tqtinterface/qt4/include/tqevent.h create mode 120000 tqtinterface/qt4/include/tqeventloop.h create mode 120000 tqtinterface/qt4/include/tqfeatures.h create mode 120000 tqtinterface/qt4/include/tqfile.h create mode 120000 tqtinterface/qt4/include/tqfiledef.h create mode 120000 tqtinterface/qt4/include/tqfiledialog.h create mode 120000 tqtinterface/qt4/include/tqfiledlg.h create mode 120000 tqtinterface/qt4/include/tqfileinf.h create mode 120000 tqtinterface/qt4/include/tqfileinfo.h create mode 120000 tqtinterface/qt4/include/tqfocusdata.h create mode 120000 tqtinterface/qt4/include/tqfont.h create mode 120000 tqtinterface/qt4/include/tqfontdatabase.h create mode 120000 tqtinterface/qt4/include/tqfontdialog.h create mode 120000 tqtinterface/qt4/include/tqfontinf.h create mode 120000 tqtinterface/qt4/include/tqfontinfo.h create mode 120000 tqtinterface/qt4/include/tqfontmet.h create mode 120000 tqtinterface/qt4/include/tqfontmetrics.h create mode 120000 tqtinterface/qt4/include/tqframe.h create mode 120000 tqtinterface/qt4/include/tqftp.h create mode 120000 tqtinterface/qt4/include/tqgarray.h create mode 120000 tqtinterface/qt4/include/tqgb18030codec.h create mode 120000 tqtinterface/qt4/include/tqgbkcodec.h create mode 120000 tqtinterface/qt4/include/tqgcache.h create mode 120000 tqtinterface/qt4/include/tqgdict.h create mode 120000 tqtinterface/qt4/include/tqgeneric.h create mode 120000 tqtinterface/qt4/include/tqgif.h create mode 120000 tqtinterface/qt4/include/tqgl.h create mode 120000 tqtinterface/qt4/include/tqglcolormap.h create mode 120000 tqtinterface/qt4/include/tqglist.h create mode 120000 tqtinterface/qt4/include/tqglobal.h create mode 120000 tqtinterface/qt4/include/tqgplugin.h create mode 120000 tqtinterface/qt4/include/tqgrid.h create mode 120000 tqtinterface/qt4/include/tqgridview.h create mode 120000 tqtinterface/qt4/include/tqgroupbox.h create mode 120000 tqtinterface/qt4/include/tqgrpbox.h create mode 120000 tqtinterface/qt4/include/tqguardedptr.h create mode 120000 tqtinterface/qt4/include/tqgvector.h create mode 120000 tqtinterface/qt4/include/tqhbox.h create mode 120000 tqtinterface/qt4/include/tqhbuttongroup.h create mode 120000 tqtinterface/qt4/include/tqheader.h create mode 120000 tqtinterface/qt4/include/tqhgroupbox.h create mode 120000 tqtinterface/qt4/include/tqhostaddress.h create mode 120000 tqtinterface/qt4/include/tqhttp.h create mode 120000 tqtinterface/qt4/include/tqiconset.h create mode 120000 tqtinterface/qt4/include/tqiconview.h create mode 120000 tqtinterface/qt4/include/tqimage.h create mode 120000 tqtinterface/qt4/include/tqimageformatplugin.h create mode 120000 tqtinterface/qt4/include/tqinputdialog.h create mode 120000 tqtinterface/qt4/include/tqintcach.h create mode 120000 tqtinterface/qt4/include/tqintcache.h create mode 120000 tqtinterface/qt4/include/tqintdict.h create mode 120000 tqtinterface/qt4/include/tqinterlacestyle.h create mode 120000 tqtinterface/qt4/include/tqiodev.h create mode 120000 tqtinterface/qt4/include/tqiodevice.h create mode 120000 tqtinterface/qt4/include/tqjiscodec.h create mode 120000 tqtinterface/qt4/include/tqjpegio.h create mode 120000 tqtinterface/qt4/include/tqjpunicode.h create mode 120000 tqtinterface/qt4/include/tqkeycode.h create mode 120000 tqtinterface/qt4/include/tqkeysequence.h create mode 120000 tqtinterface/qt4/include/tqlabel.h create mode 120000 tqtinterface/qt4/include/tqlayout.h create mode 120000 tqtinterface/qt4/include/tqlcdnum.h create mode 120000 tqtinterface/qt4/include/tqlcdnumber.h create mode 120000 tqtinterface/qt4/include/tqlibrary.h create mode 120000 tqtinterface/qt4/include/tqlined.h create mode 120000 tqtinterface/qt4/include/tqlineedit.h create mode 120000 tqtinterface/qt4/include/tqlist.h create mode 120000 tqtinterface/qt4/include/tqlistbox.h create mode 120000 tqtinterface/qt4/include/tqlistview.h create mode 120000 tqtinterface/qt4/include/tqlocale.h create mode 120000 tqtinterface/qt4/include/tqlocalfs.h create mode 120000 tqtinterface/qt4/include/tqmainwindow.h create mode 120000 tqtinterface/qt4/include/tqmap.h create mode 120000 tqtinterface/qt4/include/tqmemarray.h create mode 120000 tqtinterface/qt4/include/tqmenubar.h create mode 120000 tqtinterface/qt4/include/tqmenudata.h create mode 120000 tqtinterface/qt4/include/tqmenudta.h create mode 120000 tqtinterface/qt4/include/tqmessagebox.h create mode 120000 tqtinterface/qt4/include/tqmetaobj.h create mode 120000 tqtinterface/qt4/include/tqmetaobject.h create mode 120000 tqtinterface/qt4/include/tqmime.h create mode 120000 tqtinterface/qt4/include/tqmlined.h create mode 120000 tqtinterface/qt4/include/tqmngio.h create mode 120000 tqtinterface/qt4/include/tqmotifplusstyle.h create mode 120000 tqtinterface/qt4/include/tqmotifstyle.h create mode 120000 tqtinterface/qt4/include/tqmovie.h create mode 120000 tqtinterface/qt4/include/tqmsgbox.h create mode 120000 tqtinterface/qt4/include/tqmultilinedit.h create mode 120000 tqtinterface/qt4/include/tqmultilineedit.h create mode 120000 tqtinterface/qt4/include/tqmutex.h create mode 120000 tqtinterface/qt4/include/tqnamespace.h create mode 120000 tqtinterface/qt4/include/tqnetwork.h create mode 120000 tqtinterface/qt4/include/tqnetworkprotocol.h create mode 120000 tqtinterface/qt4/include/tqnp.h create mode 120000 tqtinterface/qt4/include/tqobjcoll.h create mode 120000 tqtinterface/qt4/include/tqobjdefs.h create mode 120000 tqtinterface/qt4/include/tqobject.h create mode 120000 tqtinterface/qt4/include/tqobjectcleanuphandler.h create mode 120000 tqtinterface/qt4/include/tqobjectdefs.h create mode 120000 tqtinterface/qt4/include/tqobjectdict.h create mode 120000 tqtinterface/qt4/include/tqobjectlist.h create mode 120000 tqtinterface/qt4/include/tqpaintd.h create mode 120000 tqtinterface/qt4/include/tqpaintdc.h create mode 120000 tqtinterface/qt4/include/tqpaintdevice.h create mode 120000 tqtinterface/qt4/include/tqpaintdevicedefs.h create mode 120000 tqtinterface/qt4/include/tqpaintdevicemetrics.h create mode 120000 tqtinterface/qt4/include/tqpainter.h create mode 120000 tqtinterface/qt4/include/tqpair.h create mode 120000 tqtinterface/qt4/include/tqpalette.h create mode 120000 tqtinterface/qt4/include/tqpdevmet.h create mode 120000 tqtinterface/qt4/include/tqpen.h create mode 120000 tqtinterface/qt4/include/tqpicture.h create mode 120000 tqtinterface/qt4/include/tqpixmap.h create mode 120000 tqtinterface/qt4/include/tqpixmapcache.h create mode 120000 tqtinterface/qt4/include/tqplatinumstyle.h create mode 120000 tqtinterface/qt4/include/tqpmcache.h create mode 120000 tqtinterface/qt4/include/tqpngio.h create mode 120000 tqtinterface/qt4/include/tqpntarry.h create mode 120000 tqtinterface/qt4/include/tqpoint.h create mode 120000 tqtinterface/qt4/include/tqpointarray.h create mode 120000 tqtinterface/qt4/include/tqpolygonscanner.h create mode 120000 tqtinterface/qt4/include/tqpopmenu.h create mode 120000 tqtinterface/qt4/include/tqpopupmenu.h create mode 120000 tqtinterface/qt4/include/tqprintdialog.h create mode 120000 tqtinterface/qt4/include/tqprinter.h create mode 120000 tqtinterface/qt4/include/tqprndlg.h create mode 120000 tqtinterface/qt4/include/tqprocess.h create mode 120000 tqtinterface/qt4/include/tqprogbar.h create mode 120000 tqtinterface/qt4/include/tqprogdlg.h create mode 120000 tqtinterface/qt4/include/tqprogressbar.h create mode 120000 tqtinterface/qt4/include/tqprogressdialog.h create mode 120000 tqtinterface/qt4/include/tqpsprn.h create mode 120000 tqtinterface/qt4/include/tqptrcollection.h create mode 120000 tqtinterface/qt4/include/tqptrdict.h create mode 120000 tqtinterface/qt4/include/tqptrlist.h create mode 120000 tqtinterface/qt4/include/tqptrqueue.h create mode 120000 tqtinterface/qt4/include/tqptrstack.h create mode 120000 tqtinterface/qt4/include/tqptrvector.h create mode 120000 tqtinterface/qt4/include/tqpushbt.h create mode 120000 tqtinterface/qt4/include/tqpushbutton.h create mode 120000 tqtinterface/qt4/include/tqqueue.h create mode 120000 tqtinterface/qt4/include/tqradiobt.h create mode 120000 tqtinterface/qt4/include/tqradiobutton.h create mode 120000 tqtinterface/qt4/include/tqrangecontrol.h create mode 120000 tqtinterface/qt4/include/tqrangect.h create mode 120000 tqtinterface/qt4/include/tqrect.h create mode 120000 tqtinterface/qt4/include/tqregexp.h create mode 120000 tqtinterface/qt4/include/tqregion.h create mode 120000 tqtinterface/qt4/include/tqrtlcodec.h create mode 120000 tqtinterface/qt4/include/tqscrbar.h create mode 120000 tqtinterface/qt4/include/tqscrollbar.h create mode 120000 tqtinterface/qt4/include/tqscrollview.h create mode 120000 tqtinterface/qt4/include/tqsemaphore.h create mode 120000 tqtinterface/qt4/include/tqsemimodal.h create mode 120000 tqtinterface/qt4/include/tqserversocket.h create mode 120000 tqtinterface/qt4/include/tqsession.h create mode 120000 tqtinterface/qt4/include/tqsessionmanager.h create mode 120000 tqtinterface/qt4/include/tqsettings.h create mode 120000 tqtinterface/qt4/include/tqsgistyle.h create mode 120000 tqtinterface/qt4/include/tqshared.h create mode 120000 tqtinterface/qt4/include/tqsignal.h create mode 120000 tqtinterface/qt4/include/tqsignalmapper.h create mode 120000 tqtinterface/qt4/include/tqsignalslotimp.h create mode 120000 tqtinterface/qt4/include/tqsimplerichtext.h create mode 120000 tqtinterface/qt4/include/tqsize.h create mode 120000 tqtinterface/qt4/include/tqsizegrip.h create mode 120000 tqtinterface/qt4/include/tqsizepolicy.h create mode 120000 tqtinterface/qt4/include/tqsjiscodec.h create mode 120000 tqtinterface/qt4/include/tqslider.h create mode 120000 tqtinterface/qt4/include/tqsocket.h create mode 120000 tqtinterface/qt4/include/tqsocketdevice.h create mode 120000 tqtinterface/qt4/include/tqsocketnotifier.h create mode 120000 tqtinterface/qt4/include/tqsocknot.h create mode 120000 tqtinterface/qt4/include/tqsortedlist.h create mode 120000 tqtinterface/qt4/include/tqsound.h create mode 120000 tqtinterface/qt4/include/tqspinbox.h create mode 120000 tqtinterface/qt4/include/tqsplashscreen.h create mode 120000 tqtinterface/qt4/include/tqsplitter.h create mode 120000 tqtinterface/qt4/include/tqsql.h create mode 120000 tqtinterface/qt4/include/tqsqlcursor.h create mode 120000 tqtinterface/qt4/include/tqsqldatabase.h create mode 120000 tqtinterface/qt4/include/tqsqldriver.h create mode 120000 tqtinterface/qt4/include/tqsqldriverplugin.h create mode 120000 tqtinterface/qt4/include/tqsqleditorfactory.h create mode 120000 tqtinterface/qt4/include/tqsqlerror.h create mode 120000 tqtinterface/qt4/include/tqsqlfield.h create mode 120000 tqtinterface/qt4/include/tqsqlform.h create mode 120000 tqtinterface/qt4/include/tqsqlindex.h create mode 120000 tqtinterface/qt4/include/tqsqlpropertymap.h create mode 120000 tqtinterface/qt4/include/tqsqlquery.h create mode 120000 tqtinterface/qt4/include/tqsqlrecord.h create mode 120000 tqtinterface/qt4/include/tqsqlresult.h create mode 120000 tqtinterface/qt4/include/tqsqlselectcursor.h create mode 120000 tqtinterface/qt4/include/tqstack.h create mode 120000 tqtinterface/qt4/include/tqstatusbar.h create mode 120000 tqtinterface/qt4/include/tqstring.h create mode 120000 tqtinterface/qt4/include/tqstringlist.h create mode 120000 tqtinterface/qt4/include/tqstrlist.h create mode 120000 tqtinterface/qt4/include/tqstrvec.h create mode 120000 tqtinterface/qt4/include/tqstyle.h create mode 120000 tqtinterface/qt4/include/tqstylefactory.h create mode 120000 tqtinterface/qt4/include/tqstyleplugin.h create mode 120000 tqtinterface/qt4/include/tqstylesheet.h create mode 120000 tqtinterface/qt4/include/tqsyntaxhighlighter.h create mode 120000 tqtinterface/qt4/include/tqt.h create mode 120000 tqtinterface/qt4/include/tqtabbar.h create mode 120000 tqtinterface/qt4/include/tqtabdialog.h create mode 120000 tqtinterface/qt4/include/tqtabdlg.h create mode 120000 tqtinterface/qt4/include/tqtable.h create mode 120000 tqtinterface/qt4/include/tqtabwidget.h create mode 100644 tqtinterface/qt4/include/tqtenuminheritance.h create mode 120000 tqtinterface/qt4/include/tqtextbrowser.h create mode 120000 tqtinterface/qt4/include/tqtextcodec.h create mode 120000 tqtinterface/qt4/include/tqtextcodecfactory.h create mode 120000 tqtinterface/qt4/include/tqtextcodecplugin.h create mode 120000 tqtinterface/qt4/include/tqtextedit.h create mode 120000 tqtinterface/qt4/include/tqtextstream.h create mode 120000 tqtinterface/qt4/include/tqtextview.h create mode 120000 tqtinterface/qt4/include/tqtglobaldefines.h create mode 100644 tqtinterface/qt4/include/tqtglobaldefines.h~ create mode 120000 tqtinterface/qt4/include/tqtglobalsettings.h create mode 120000 tqtinterface/qt4/include/tqthread.h create mode 120000 tqtinterface/qt4/include/tqthreadstorage.h create mode 120000 tqtinterface/qt4/include/tqtimer.h create mode 120000 tqtinterface/qt4/include/tqtl.h create mode 120000 tqtinterface/qt4/include/tqtoolbar.h create mode 120000 tqtinterface/qt4/include/tqtoolbox.h create mode 120000 tqtinterface/qt4/include/tqtoolbutton.h create mode 120000 tqtinterface/qt4/include/tqtooltip.h create mode 120000 tqtinterface/qt4/include/tqtranslator.h create mode 120000 tqtinterface/qt4/include/tqtsciicodec.h create mode 120000 tqtinterface/qt4/include/tqtstream.h create mode 120000 tqtinterface/qt4/include/tqurl.h create mode 120000 tqtinterface/qt4/include/tqurlinfo.h create mode 120000 tqtinterface/qt4/include/tqurloperator.h create mode 120000 tqtinterface/qt4/include/tqutfcodec.h create mode 120000 tqtinterface/qt4/include/tquuid.h create mode 120000 tqtinterface/qt4/include/tqvalidator.h create mode 120000 tqtinterface/qt4/include/tqvaluelist.h create mode 120000 tqtinterface/qt4/include/tqvaluestack.h create mode 120000 tqtinterface/qt4/include/tqvaluevector.h create mode 120000 tqtinterface/qt4/include/tqvariant.h create mode 120000 tqtinterface/qt4/include/tqvbox.h create mode 120000 tqtinterface/qt4/include/tqvbuttongroup.h create mode 120000 tqtinterface/qt4/include/tqvector.h create mode 120000 tqtinterface/qt4/include/tqvfbhdr.h create mode 120000 tqtinterface/qt4/include/tqvgroupbox.h create mode 120000 tqtinterface/qt4/include/tqwaitcondition.h create mode 120000 tqtinterface/qt4/include/tqwhatsthis.h create mode 120000 tqtinterface/qt4/include/tqwidcoll.h create mode 120000 tqtinterface/qt4/include/tqwidget.h create mode 120000 tqtinterface/qt4/include/tqwidgetfactory.h create mode 120000 tqtinterface/qt4/include/tqwidgetintdict.h create mode 120000 tqtinterface/qt4/include/tqwidgetlist.h create mode 120000 tqtinterface/qt4/include/tqwidgetplugin.h create mode 120000 tqtinterface/qt4/include/tqwidgetstack.h create mode 120000 tqtinterface/qt4/include/tqwindefs.h create mode 120000 tqtinterface/qt4/include/tqwindow.h create mode 120000 tqtinterface/qt4/include/tqwindowdefs.h create mode 120000 tqtinterface/qt4/include/tqwindowsstyle.h create mode 120000 tqtinterface/qt4/include/tqwinexport.h create mode 120000 tqtinterface/qt4/include/tqwizard.h create mode 120000 tqtinterface/qt4/include/tqwmatrix.h create mode 120000 tqtinterface/qt4/include/tqworkspace.h create mode 120000 tqtinterface/qt4/include/tqxml.h (limited to 'tqtinterface/qt4/include') diff --git a/tqtinterface/qt4/include/jri.h b/tqtinterface/qt4/include/jri.h new file mode 120000 index 0000000..c0d02a5 --- /dev/null +++ b/tqtinterface/qt4/include/jri.h @@ -0,0 +1 @@ +../extensions/nsplugin/src/jri.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/jri_md.h b/tqtinterface/qt4/include/jri_md.h new file mode 120000 index 0000000..f7e6f03 --- /dev/null +++ b/tqtinterface/qt4/include/jri_md.h @@ -0,0 +1 @@ +../extensions/nsplugin/src/jri_md.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/jritypes.h b/tqtinterface/qt4/include/jritypes.h new file mode 120000 index 0000000..149937a --- /dev/null +++ b/tqtinterface/qt4/include/jritypes.h @@ -0,0 +1 @@ +../extensions/nsplugin/src/jritypes.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/npapi.h b/tqtinterface/qt4/include/npapi.h new file mode 120000 index 0000000..92fb86c --- /dev/null +++ b/tqtinterface/qt4/include/npapi.h @@ -0,0 +1 @@ +../extensions/nsplugin/src/npapi.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/npupp.h b/tqtinterface/qt4/include/npupp.h new file mode 120000 index 0000000..8f117d2 --- /dev/null +++ b/tqtinterface/qt4/include/npupp.h @@ -0,0 +1 @@ +../extensions/nsplugin/src/npupp.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/private/qobject_p.h b/tqtinterface/qt4/include/private/qobject_p.h new file mode 120000 index 0000000..4d326e4 --- /dev/null +++ b/tqtinterface/qt4/include/private/qobject_p.h @@ -0,0 +1 @@ +../qt4private/qobject_p.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/private/qt4_harfbuzz/AUTHORS b/tqtinterface/qt4/include/private/qt4_harfbuzz/AUTHORS new file mode 100644 index 0000000..023488a --- /dev/null +++ b/tqtinterface/qt4/include/private/qt4_harfbuzz/AUTHORS @@ -0,0 +1,6 @@ +David Turner +Werner Lemberg +Owen Taylor +Behdad Esfahbod +Lars Knoll +Simon Hausmann diff --git a/tqtinterface/qt4/include/private/qt4_harfbuzz/COPYING b/tqtinterface/qt4/include/private/qt4_harfbuzz/COPYING new file mode 100644 index 0000000..820a9e6 --- /dev/null +++ b/tqtinterface/qt4/include/private/qt4_harfbuzz/COPYING @@ -0,0 +1,24 @@ +HarfBuzz was previously licensed under different licenses. This was +changed in January 2008. If you need to relicense your old copies, +consult the announcement of the license change on the internet. +Other than that, each copy of HarfBuzz is licensed under the COPYING +file included with it. The actual license follows: + + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. diff --git a/tqtinterface/qt4/include/private/qt4_harfbuzz/ChangeLog b/tqtinterface/qt4/include/private/qt4_harfbuzz/ChangeLog new file mode 100644 index 0000000..e69de29 diff --git a/tqtinterface/qt4/include/private/qt4_harfbuzz/Makefile.am b/tqtinterface/qt4/include/private/qt4_harfbuzz/Makefile.am new file mode 100644 index 0000000..776b947 --- /dev/null +++ b/tqtinterface/qt4/include/private/qt4_harfbuzz/Makefile.am @@ -0,0 +1,2 @@ + +SUBDIRS = src tests diff --git a/tqtinterface/qt4/include/private/qt4_harfbuzz/NEWS b/tqtinterface/qt4/include/private/qt4_harfbuzz/NEWS new file mode 100644 index 0000000..e69de29 diff --git a/tqtinterface/qt4/include/private/qt4_harfbuzz/README b/tqtinterface/qt4/include/private/qt4_harfbuzz/README new file mode 100644 index 0000000..ca2546a --- /dev/null +++ b/tqtinterface/qt4/include/private/qt4_harfbuzz/README @@ -0,0 +1,7 @@ +This is HarfBuzz, an OpenType Layout engine library. + +To report bugs or post to discussion mailing list, see: + + http://freedesktop.org/wiki/Software/HarfBuzz + +For license information, see the file COPYING. diff --git a/tqtinterface/qt4/include/private/qt4_harfbuzz/autogen.sh b/tqtinterface/qt4/include/private/qt4_harfbuzz/autogen.sh new file mode 100755 index 0000000..7fa1c3d --- /dev/null +++ b/tqtinterface/qt4/include/private/qt4_harfbuzz/autogen.sh @@ -0,0 +1,116 @@ +#!/bin/sh +# Run this to generate all the initial makefiles, etc. + +set -e + +srcdir=`dirname $0` +test -z "$srcdir" && srcdir=. + +ORIGDIR=`pwd` +cd $srcdir +PROJECT=harfbuzz +TEST_TYPE=-f +FILE=src/harfbuzz.h +ACLOCAL=${ACLOCAL-aclocal} +LIBTOOLIZE=${LIBTOOLIZE-libtoolize} +AUTOMAKE=${AUTOMAKE-automake} +AUTOHEADER=${AUTOHEADER-autoheader} +AUTOCONF=${AUTOCONF-autoconf} +LIBTOOLIZE_FLAGS="--copy --force" + +DIE=0 + +have_libtool=false +if $LIBTOOLIZE --version < /dev/null > /dev/null 2>&1 ; then + libtool_version=`$LIBTOOLIZE --version | sed 's/^[^0-9]*\([0-9].[0-9.]*\).*/\1/'` + case $libtool_version in + 1.4*|1.5*|1.6*|1.7*|2*) + have_libtool=true + ;; + esac +fi +if $have_libtool ; then : ; else + echo + echo "You must have libtool 1.4 installed to compile $PROJECT." + echo "Install the appropriate package for your distribution," + echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/" + DIE=1 +fi + +($AUTOCONF --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "You must have autoconf installed to compile $PROJECT." + echo "libtool the appropriate package for your distribution," + echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/" + DIE=1 +} + +have_automake=false +need_libtoolize=true +if $AUTOMAKE --version < /dev/null > /dev/null 2>&1 ; then + automake_version=`$AUTOMAKE --version | grep 'automake (GNU automake)' | sed 's/^[^0-9]*\(.*\)/\1/'` + case $automake_version in + 1.2*|1.3*|1.4) + ;; + 1.4*) + have_automake=true + need_libtoolize=false + ;; + *) + have_automake=true + ;; + esac +fi +if $have_automake ; then : ; else + echo + echo "You must have automake 1.4-p1 installed to compile $PROJECT." + echo "Get ftp://ftp.gnu.org/pub/gnu/automake/automake-1.4-p1.tar.gz" + echo "(or a newer version if it is available)" + DIE=1 +fi + +if test "$DIE" -eq 1; then + exit 1 +fi + +test $TEST_TYPE $FILE || { + echo "You must run this script in the top-level $PROJECT directory" + exit 1 +} + +if test -z "$AUTOGEN_SUBDIR_MODE"; then + if test -z "$*"; then + echo "I am going to run ./configure with no arguments - if you wish " + echo "to pass any to it, please specify them on the $0 command line." + fi +fi + +echo Running $ACLOCAL $ACLOCAL_FLAGS +$ACLOCAL $ACLOCAL_FLAGS + +# optionally run autoheader +if $AUTOHEADER --version < /dev/null > /dev/null 2>&1; then + echo Running $AUTOHEADER + $AUTOHEADER +fi + +case $need_libtoolize in + true) + echo Running $LIBTOOLIZE $LIBTOOLIZE_FLAGS + $LIBTOOLIZE $LIBTOOLIZE_FLAGS + ;; +esac + +echo Running $AUTOMAKE -a $am_opt +$AUTOMAKE -a $am_opt +echo Running $AUTOCONF +$AUTOCONF +cd $ORIGDIR + +if test -z "$AUTOGEN_SUBDIR_MODE"; then + echo Running $srcdir/configure "$@" + $srcdir/configure "$@" + + echo + echo "Now type 'make' to compile $PROJECT." +fi diff --git a/tqtinterface/qt4/include/private/qt4_harfbuzz/configure.ac b/tqtinterface/qt4/include/private/qt4_harfbuzz/configure.ac new file mode 100644 index 0000000..8519279 --- /dev/null +++ b/tqtinterface/qt4/include/private/qt4_harfbuzz/configure.ac @@ -0,0 +1,54 @@ +AC_INIT(README) +AM_INIT_AUTOMAKE(harfbuzz, 0.1) +AC_PROG_CC +AC_PROG_CXX +AM_PROG_LIBTOOL +PKG_PROG_PKG_CONFIG +AM_CONFIG_HEADER(config.h) + +if test "x$ac_compiler_gnu" = xyes; then + CFLAGS="$CFLAGS -Wall -W -pedantic -ansi" + CXXFLAGS="$CXXFLAGS -Wall -W" +fi + +AC_PATH_PROG(ft_config,freetype-config,no) +if test "$ft_config" = "no"; then + AC_MSG_ERROR([You must have freetype installed; see http://www.freetype.org/]) +fi + +FREETYPE_CFLAGS="`$ft_config --cflags`" +FREETYPE_LIBS="`$ft_config --libs`" + +AC_SUBST(FREETYPE_LIBS) +AC_SUBST(FREETYPE_CFLAGS) + +AC_ARG_ENABLE(qt, AS_HELP_STRING([--disable-qt], [Build Qt support (default: auto)]), [QT=$enableval], [QT=auto]) + +if test "x$QT" = xauto; then + PKG_CHECK_MODULES(QT, [QtGui >= 4.3], [QT=yes], [QT=no]) +fi +if test "x$QT" = xyes; then + PKG_CHECK_MODULES(QT_GUI, [QtGui >= 4.3]) + PKG_CHECK_MODULES(QT_QTEST, [QtTest >= 4.3]) + + _PKG_CONFIG(QT_INCDIR, [variable=includedir], [QtGui >= 4.3]) + QT_GUI_CFLAGS="$QT_GUI_CFLAGS -I$pkg_cv_QT_INCDIR/../Qt" + + AC_SUBST(QT_GUI_CFLAGS) + AC_SUBST(QT_GUI_LIBS) + AC_SUBST(QT_QTEST_CFLAGS) + AC_SUBST(QT_QTEST_LIBS) + + _PKG_CONFIG(QT_MOC, [variable=moc_location], [QtGui >= 4.3]) + QT_MOC=$pkg_cv_QT_MOC + AC_SUBST(QT_MOC) +fi +AM_CONDITIONAL(QT, [test "x$QT" = xyes]) + +AC_OUTPUT([ +Makefile +src/Makefile +tests/Makefile +tests/linebreaking/Makefile +tests/shaping/Makefile +]) diff --git a/tqtinterface/qt4/include/private/qt4_harfbuzz/src/Makefile.am b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/Makefile.am new file mode 100644 index 0000000..51d0652 --- /dev/null +++ b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/Makefile.am @@ -0,0 +1,69 @@ +## Process this file with automake to produce Makefile.in + +noinst_LTLIBRARIES = libharfbuzz-1.la + +MAINSOURCES = \ + harfbuzz-buffer.c \ + harfbuzz-stream.c \ + harfbuzz-dump.c \ + harfbuzz-gdef.c \ + harfbuzz-gpos.c \ + harfbuzz-gsub.c \ + harfbuzz-impl.c \ + harfbuzz-open.c \ + harfbuzz-shaper.cpp \ + harfbuzz-greek.c \ + harfbuzz-tibetan.c \ + harfbuzz-khmer.c \ + harfbuzz-indic.cpp \ + harfbuzz-hebrew.c \ + harfbuzz-arabic.c \ + harfbuzz-hangul.c \ + harfbuzz-myanmar.c \ + harfbuzz-thai.c + +EXTRA_SOURCES = harfbuzz.c + +PUBLICHEADERS = \ + harfbuzz.h \ + harfbuzz-buffer.h \ + harfbuzz-dump.h \ + harfbuzz-gdef.h \ + harfbuzz-gpos.h \ + harfbuzz-gsub.h \ + harfbuzz-open.h \ + harfbuzz-global.h \ + harfbuzz-external.h \ + harfbuzz-shaper.h \ + harfbuzz-stream.h + +PRIVATEHEADERS = \ + harfbuzz-impl.h \ + harfbuzz-buffer-private.h \ + harfbuzz-stream-private.h \ + harfbuzz-gdef-private.h \ + harfbuzz-gpos-private.h \ + harfbuzz-gsub-private.h \ + harfbuzz-open-private.h \ + harfbuzz-shaper-private.h + +libharfbuzz_1_la_SOURCES = \ + $(MAINSOURCES) \ + $(PUBLICHEADERS) \ + $(PRIVATEHEADERS) + +#noinst_PROGRAMS = harfbuzz-dump +# +#harfbuzz_dump_SOURCES = \ +# harfbuzz-dump-main.c +# +#harfbuzz_dump_LDADD = \ +# libharfbuzz-1.la + +EXTRA_DIST = \ + README \ + COPYING.FTL \ + COPYING.GPL \ + COPYING \ + $(EXTRA_SOURCES) + diff --git a/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-arabic.c b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-arabic.c new file mode 100644 index 0000000..3837087 --- /dev/null +++ b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-arabic.c @@ -0,0 +1,1144 @@ +/* + * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) + * + * This is part of HarfBuzz, an OpenType Layout engine library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#include "harfbuzz-shaper.h" +#include "harfbuzz-shaper-private.h" + +#include + +static const HB_UChar16 ReplacementCharacter = 0xfffd; + +typedef struct { + unsigned char shape; + unsigned char justification; +} HB_ArabicProperties; + +typedef enum { + XIsolated, + XFinal, + XInitial, + XMedial, + /* intermediate state */ + XCausing +} ArabicShape; + +/* +// these groups correspond to the groups defined in the Unicode standard. +// Some of these groups are equal with regards to both joining and line breaking behaviour, +// and thus have the same enum value +// +// I'm not sure the mapping of syriac to arabic enums is correct with regards to justification, but as +// I couldn't find any better document I'll hope for the best. +*/ +typedef enum { + /* NonJoining */ + ArabicNone, + ArabicSpace, + /* Transparent */ + Transparent, + /* Causing */ + Center, + Kashida, + + /* Arabic */ + /* Dual */ + Beh, + Noon, + Meem = Noon, + Heh = Noon, + KnottedHeh = Noon, + HehGoal = Noon, + SwashKaf = Noon, + Yeh, + Hah, + Seen, + Sad = Seen, + Tah, + Kaf = Tah, + Gaf = Tah, + Lam = Tah, + Ain, + Feh = Ain, + Qaf = Ain, + /* Right */ + Alef, + Waw, + Dal, + TehMarbuta = Dal, + Reh, + HamzaOnHehGoal, + YehWithTail = HamzaOnHehGoal, + YehBarre = HamzaOnHehGoal, + + /* Syriac */ + /* Dual */ + Beth = Beh, + Gamal = Ain, + Heth = Noon, + Teth = Hah, + Yudh = Noon, + Kaph = Noon, + Lamadh = Lam, + Mim = Noon, + Nun = Noon, + Semakh = Noon, + FinalSemakh = Noon, + SyriacE = Ain, + Pe = Ain, + ReversedPe = Hah, + Qaph = Noon, + Shin = Noon, + Fe = Ain, + + /* Right */ + Alaph = Alef, + Dalath = Dal, + He = Dal, + SyriacWaw = Waw, + Zain = Alef, + YudhHe = Waw, + Sadhe = HamzaOnHehGoal, + Taw = Dal, + + /* Compiler bug? Otherwise ArabicGroupsEnd would be equal to Dal + 1. */ + Dummy = HamzaOnHehGoal, + ArabicGroupsEnd +} ArabicGroup; + +static const unsigned char arabic_group[0x150] = { + ArabicNone, ArabicNone, ArabicNone, ArabicNone, + ArabicNone, ArabicNone, ArabicNone, ArabicNone, + ArabicNone, ArabicNone, ArabicNone, ArabicNone, + ArabicNone, ArabicNone, ArabicNone, ArabicNone, + + Transparent, Transparent, Transparent, Transparent, + Transparent, Transparent, ArabicNone, ArabicNone, + ArabicNone, ArabicNone, ArabicNone, ArabicNone, + ArabicNone, ArabicNone, ArabicNone, ArabicNone, + + ArabicNone, ArabicNone, Alef, Alef, + Waw, Alef, Yeh, Alef, + Beh, TehMarbuta, Beh, Beh, + Hah, Hah, Hah, Dal, + + Dal, Reh, Reh, Seen, + Seen, Sad, Sad, Tah, + Tah, Ain, Ain, ArabicNone, + ArabicNone, ArabicNone, ArabicNone, ArabicNone, + + /* 0x640 */ + Kashida, Feh, Qaf, Kaf, + Lam, Meem, Noon, Heh, + Waw, Yeh, Yeh, Transparent, + Transparent, Transparent, Transparent, Transparent, + + Transparent, Transparent, Transparent, Transparent, + Transparent, Transparent, Transparent, Transparent, + Transparent, ArabicNone, ArabicNone, ArabicNone, + ArabicNone, ArabicNone, ArabicNone, ArabicNone, + + ArabicNone, ArabicNone, ArabicNone, ArabicNone, + ArabicNone, ArabicNone, ArabicNone, ArabicNone, + ArabicNone, ArabicNone, ArabicNone, ArabicNone, + ArabicNone, ArabicNone, Beh, Qaf, + + Transparent, Alef, Alef, Alef, + ArabicNone, Alef, Waw, Waw, + Yeh, Beh, Beh, Beh, + Beh, Beh, Beh, Beh, + + /* 0x680 */ + Beh, Hah, Hah, Hah, + Hah, Hah, Hah, Hah, + Dal, Dal, Dal, Dal, + Dal, Dal, Dal, Dal, + + Dal, Reh, Reh, Reh, + Reh, Reh, Reh, Reh, + Reh, Reh, Seen, Seen, + Seen, Sad, Sad, Tah, + + Ain, Feh, Feh, Feh, + Feh, Feh, Feh, Qaf, + Qaf, Gaf, SwashKaf, Gaf, + Kaf, Kaf, Kaf, Gaf, + + Gaf, Gaf, Gaf, Gaf, + Gaf, Lam, Lam, Lam, + Lam, Noon, Noon, Noon, + Noon, Noon, KnottedHeh, Hah, + + /* 0x6c0 */ + TehMarbuta, HehGoal, HamzaOnHehGoal, HamzaOnHehGoal, + Waw, Waw, Waw, Waw, + Waw, Waw, Waw, Waw, + Yeh, YehWithTail, Yeh, Waw, + + Yeh, Yeh, YehBarre, YehBarre, + ArabicNone, TehMarbuta, Transparent, Transparent, + Transparent, Transparent, Transparent, Transparent, + Transparent, ArabicNone, ArabicNone, Transparent, + + Transparent, Transparent, Transparent, Transparent, + Transparent, ArabicNone, ArabicNone, Transparent, + Transparent, ArabicNone, Transparent, Transparent, + Transparent, Transparent, Dal, Reh, + + ArabicNone, ArabicNone, ArabicNone, ArabicNone, + ArabicNone, ArabicNone, ArabicNone, ArabicNone, + ArabicNone, ArabicNone, Seen, Sad, + Ain, ArabicNone, ArabicNone, KnottedHeh, + + /* 0x700 */ + ArabicNone, ArabicNone, ArabicNone, ArabicNone, + ArabicNone, ArabicNone, ArabicNone, ArabicNone, + ArabicNone, ArabicNone, ArabicNone, ArabicNone, + ArabicNone, ArabicNone, ArabicNone, ArabicNone, + + Alaph, Transparent, Beth, Gamal, + Gamal, Dalath, Dalath, He, + SyriacWaw, Zain, Heth, Teth, + Teth, Yudh, YudhHe, Kaph, + + Lamadh, Mim, Nun, Semakh, + FinalSemakh, SyriacE, Pe, ReversedPe, + Sadhe, Qaph, Dalath, Shin, + Taw, Beth, Gamal, Dalath, + + Transparent, Transparent, Transparent, Transparent, + Transparent, Transparent, Transparent, Transparent, + Transparent, Transparent, Transparent, Transparent, + Transparent, Transparent, Transparent, Transparent, + + Transparent, Transparent, Transparent, Transparent, + Transparent, Transparent, Transparent, Transparent, + Transparent, Transparent, Transparent, ArabicNone, + ArabicNone, Zain, Kaph, Fe, +}; + +static ArabicGroup arabicGroup(unsigned short uc) +{ + if (uc >= 0x0600 && uc < 0x750) + return (ArabicGroup) arabic_group[uc-0x600]; + else if (uc == 0x200d) + return Center; + else if (HB_GetUnicodeCharCategory(uc) == HB_Separator_Space) + return ArabicSpace; + else + return ArabicNone; +} + + +/* + Arabic shaping obeys a number of rules according to the joining classes (see Unicode book, section on + arabic). + + Each unicode char has a joining class (right, dual (left&right), center (joincausing) or transparent). + transparent joining is not encoded in HB_UChar16::joining(), but applies to all combining marks and format marks. + + Right join-causing: dual + center + Left join-causing: dual + right + center + + Rules are as follows (for a string already in visual order, as we have it here): + + R1 Transparent characters do not affect joining behaviour. + R2 A right joining character, that has a right join-causing char on the right will get form XRight + (R3 A left joining character, that has a left join-causing char on the left will get form XLeft) + Note: the above rule is meaningless, as there are no pure left joining characters defined in Unicode + R4 A dual joining character, that has a left join-causing char on the left and a right join-causing char on + the right will get form XMedial + R5 A dual joining character, that has a right join causing char on the right, and no left join causing char on the left + will get form XRight + R6 A dual joining character, that has a left join causing char on the left, and no right join causing char on the right + will get form XLeft + R7 Otherwise the character will get form XIsolated + + Additionally we have to do the minimal ligature support for lam-alef ligatures: + + L1 Transparent characters do not affect ligature behaviour. + L2 Any sequence of Alef(XRight) + Lam(XMedial) will form the ligature Alef.Lam(XLeft) + L3 Any sequence of Alef(XRight) + Lam(XLeft) will form the ligature Alef.Lam(XIsolated) + + The state table below handles rules R1-R7. +*/ + +typedef enum { + JNone, + JCausing, + JDual, + JRight, + JTransparent +} Joining; + +static const Joining joining_for_group[ArabicGroupsEnd] = { + /* NonJoining */ + JNone, /* ArabicNone */ + JNone, /* ArabicSpace */ + /* Transparent */ + JTransparent, /* Transparent */ + /* Causing */ + JCausing, /* Center */ + JCausing, /* Kashida */ + /* Dual */ + JDual, /* Beh */ + JDual, /* Noon */ + JDual, /* Yeh */ + JDual, /* Hah */ + JDual, /* Seen */ + JDual, /* Tah */ + JDual, /* Ain */ + /* Right */ + JRight, /* Alef */ + JRight, /* Waw */ + JRight, /* Dal */ + JRight, /* Reh */ + JRight /* HamzaOnHehGoal */ +}; + + +typedef struct { + ArabicShape form1; + ArabicShape form2; +} JoiningPair; + +static const JoiningPair joining_table[5][4] = +/* None, Causing, Dual, Right */ +{ + { { XIsolated, XIsolated }, { XIsolated, XCausing }, { XIsolated, XInitial }, { XIsolated, XIsolated } }, /* XIsolated */ + { { XFinal, XIsolated }, { XFinal, XCausing }, { XFinal, XInitial }, { XFinal, XIsolated } }, /* XFinal */ + { { XIsolated, XIsolated }, { XInitial, XCausing }, { XInitial, XMedial }, { XInitial, XFinal } }, /* XInitial */ + { { XFinal, XIsolated }, { XMedial, XCausing }, { XMedial, XMedial }, { XMedial, XFinal } }, /* XMedial */ + { { XIsolated, XIsolated }, { XIsolated, XCausing }, { XIsolated, XMedial }, { XIsolated, XFinal } }, /* XCausing */ +}; + + +/* +According to http://www.microsoft.com/middleeast/Arabicdev/IE6/KBase.asp + +1. Find the priority of the connecting opportunities in each word +2. Add expansion at the highest priority connection opportunity +3. If more than one connection opportunity have the same highest value, + use the opportunity closest to the end of the word. + +Following is a chart that provides the priority for connection +opportunities and where expansion occurs. The character group names +are those in table 6.6 of the UNICODE 2.0 book. + + +PrioritY Glyph Condition Kashida Location + +Arabic_Kashida User inserted Kashida The user entered a Kashida in a position. After the user + (Shift+j or Shift+[E with hat]) Thus, it is the highest priority to insert an inserted kashida + automatic kashida. + +Arabic_Seen Seen, Sad Connecting to the next character. After the character. + (Initial or medial form). + +Arabic_HaaDal Teh Marbutah, Haa, Dal Connecting to previous character. Before the final form + of these characters. + +Arabic_Alef Alef, Tah, Lam, Connecting to previous character. Before the final form + Kaf and Gaf of these characters. + +Arabic_BaRa Reh, Yeh Connected to medial Beh Before preceding medial Baa + +Arabic_Waw Waw, Ain, Qaf, Feh Connecting to previous character. Before the final form of + these characters. + +Arabic_Normal Other connecting Connecting to previous character. Before the final form + characters of these characters. + + + +This seems to imply that we have at most one kashida point per arabic word. + +*/ + +static void getArabicProperties(const unsigned short *chars, int len, HB_ArabicProperties *properties) +{ +/* qDebug("arabicSyriacOpenTypeShape: properties:"); */ + int lastPos = 0; + int lastGroup = ArabicNone; + int i = 0; + + ArabicGroup group = arabicGroup(chars[0]); + Joining j = joining_for_group[group]; + ArabicShape shape = joining_table[XIsolated][j].form2; + properties[0].justification = HB_NoJustification; + + for (i = 1; i < len; ++i) { + /* #### fix handling for spaces and punktuation */ + properties[i].justification = HB_NoJustification; + + group = arabicGroup(chars[i]); + j = joining_for_group[group]; + + if (j == JTransparent) { + properties[i].shape = XIsolated; + continue; + } + + properties[lastPos].shape = joining_table[shape][j].form1; + shape = joining_table[shape][j].form2; + + switch(lastGroup) { + case Seen: + if (properties[lastPos].shape == XInitial || properties[lastPos].shape == XMedial) + properties[i-1].justification = HB_Arabic_Seen; + break; + case Hah: + if (properties[lastPos].shape == XFinal) + properties[lastPos-1].justification = HB_Arabic_HaaDal; + break; + case Alef: + if (properties[lastPos].shape == XFinal) + properties[lastPos-1].justification = HB_Arabic_Alef; + break; + case Ain: + if (properties[lastPos].shape == XFinal) + properties[lastPos-1].justification = HB_Arabic_Waw; + break; + case Noon: + if (properties[lastPos].shape == XFinal) + properties[lastPos-1].justification = HB_Arabic_Normal; + break; + case ArabicNone: + break; + + default: + assert(FALSE); + } + + lastGroup = ArabicNone; + + switch(group) { + case ArabicNone: + case Transparent: + /* ### Center should probably be treated as transparent when it comes to justification. */ + case Center: + break; + case ArabicSpace: + properties[i].justification = HB_Arabic_Space; + break; + case Kashida: + properties[i].justification = HB_Arabic_Kashida; + break; + case Seen: + lastGroup = Seen; + break; + + case Hah: + case Dal: + lastGroup = Hah; + break; + + case Alef: + case Tah: + lastGroup = Alef; + break; + + case Yeh: + case Reh: + if (properties[lastPos].shape == XMedial && arabicGroup(chars[lastPos]) == Beh) + properties[lastPos-1].justification = HB_Arabic_BaRa; + break; + + case Ain: + case Waw: + lastGroup = Ain; + break; + + case Noon: + case Beh: + case HamzaOnHehGoal: + lastGroup = Noon; + break; + case ArabicGroupsEnd: + assert(FALSE); + } + + lastPos = i; + } + properties[lastPos].shape = joining_table[shape][JNone].form1; + + + /* + for (int i = 0; i < len; ++i) + qDebug("arabic properties(%d): uc=%x shape=%d, justification=%d", i, chars[i], properties[i].shape, properties[i].justification); + */ +} + +static Joining getNkoJoining(unsigned short uc) +{ + if (uc < 0x7ca) + return JNone; + if (uc <= 0x7ea) + return JDual; + if (uc <= 0x7f3) + return JTransparent; + if (uc <= 0x7f9) + return JNone; + if (uc == 0x7fa) + return JCausing; + return JNone; +} + +static void getNkoProperties(const unsigned short *chars, int len, HB_ArabicProperties *properties) +{ + int lastPos = 0; + int i = 0; + + Joining j = getNkoJoining(chars[0]); + ArabicShape shape = joining_table[XIsolated][j].form2; + properties[0].justification = HB_NoJustification; + + for (i = 1; i < len; ++i) { + properties[i].justification = (HB_GetUnicodeCharCategory(chars[i]) == HB_Separator_Space) ? + ArabicSpace : ArabicNone; + + j = getNkoJoining(chars[i]); + + if (j == JTransparent) { + properties[i].shape = XIsolated; + continue; + } + + properties[lastPos].shape = joining_table[shape][j].form1; + shape = joining_table[shape][j].form2; + + + lastPos = i; + } + properties[lastPos].shape = joining_table[shape][JNone].form1; + + + /* + for (int i = 0; i < len; ++i) + qDebug("nko properties(%d): uc=%x shape=%d, justification=%d", i, chars[i], properties[i].shape, properties[i].justification); + */ +} + +/* +// The unicode to unicode shaping codec. +// does only presentation forms B at the moment, but that should be enough for +// simple display +*/ +static const hb_uint16 arabicUnicodeMapping[256][2] = { + /* base of shaped forms, and number-1 of them (0 for non shaping, + 1 for right binding and 3 for dual binding */ + + /* These are just the glyphs available in Unicode, + some characters are in R class, but have no glyphs in Unicode. */ + + { 0x0600, 0 }, /* 0x0600 */ + { 0x0601, 0 }, /* 0x0601 */ + { 0x0602, 0 }, /* 0x0602 */ + { 0x0603, 0 }, /* 0x0603 */ + { 0x0604, 0 }, /* 0x0604 */ + { 0x0605, 0 }, /* 0x0605 */ + { 0x0606, 0 }, /* 0x0606 */ + { 0x0607, 0 }, /* 0x0607 */ + { 0x0608, 0 }, /* 0x0608 */ + { 0x0609, 0 }, /* 0x0609 */ + { 0x060A, 0 }, /* 0x060A */ + { 0x060B, 0 }, /* 0x060B */ + { 0x060C, 0 }, /* 0x060C */ + { 0x060D, 0 }, /* 0x060D */ + { 0x060E, 0 }, /* 0x060E */ + { 0x060F, 0 }, /* 0x060F */ + + { 0x0610, 0 }, /* 0x0610 */ + { 0x0611, 0 }, /* 0x0611 */ + { 0x0612, 0 }, /* 0x0612 */ + { 0x0613, 0 }, /* 0x0613 */ + { 0x0614, 0 }, /* 0x0614 */ + { 0x0615, 0 }, /* 0x0615 */ + { 0x0616, 0 }, /* 0x0616 */ + { 0x0617, 0 }, /* 0x0617 */ + { 0x0618, 0 }, /* 0x0618 */ + { 0x0619, 0 }, /* 0x0619 */ + { 0x061A, 0 }, /* 0x061A */ + { 0x061B, 0 }, /* 0x061B */ + { 0x061C, 0 }, /* 0x061C */ + { 0x061D, 0 }, /* 0x061D */ + { 0x061E, 0 }, /* 0x061E */ + { 0x061F, 0 }, /* 0x061F */ + + { 0x0620, 0 }, /* 0x0620 */ + { 0xFE80, 0 }, /* 0x0621 HAMZA */ + { 0xFE81, 1 }, /* 0x0622 R ALEF WITH MADDA ABOVE */ + { 0xFE83, 1 }, /* 0x0623 R ALEF WITH HAMZA ABOVE */ + { 0xFE85, 1 }, /* 0x0624 R WAW WITH HAMZA ABOVE */ + { 0xFE87, 1 }, /* 0x0625 R ALEF WITH HAMZA BELOW */ + { 0xFE89, 3 }, /* 0x0626 D YEH WITH HAMZA ABOVE */ + { 0xFE8D, 1 }, /* 0x0627 R ALEF */ + { 0xFE8F, 3 }, /* 0x0628 D BEH */ + { 0xFE93, 1 }, /* 0x0629 R TEH MARBUTA */ + { 0xFE95, 3 }, /* 0x062A D TEH */ + { 0xFE99, 3 }, /* 0x062B D THEH */ + { 0xFE9D, 3 }, /* 0x062C D JEEM */ + { 0xFEA1, 3 }, /* 0x062D D HAH */ + { 0xFEA5, 3 }, /* 0x062E D KHAH */ + { 0xFEA9, 1 }, /* 0x062F R DAL */ + + { 0xFEAB, 1 }, /* 0x0630 R THAL */ + { 0xFEAD, 1 }, /* 0x0631 R REH */ + { 0xFEAF, 1 }, /* 0x0632 R ZAIN */ + { 0xFEB1, 3 }, /* 0x0633 D SEEN */ + { 0xFEB5, 3 }, /* 0x0634 D SHEEN */ + { 0xFEB9, 3 }, /* 0x0635 D SAD */ + { 0xFEBD, 3 }, /* 0x0636 D DAD */ + { 0xFEC1, 3 }, /* 0x0637 D TAH */ + { 0xFEC5, 3 }, /* 0x0638 D ZAH */ + { 0xFEC9, 3 }, /* 0x0639 D AIN */ + { 0xFECD, 3 }, /* 0x063A D GHAIN */ + { 0x063B, 0 }, /* 0x063B */ + { 0x063C, 0 }, /* 0x063C */ + { 0x063D, 0 }, /* 0x063D */ + { 0x063E, 0 }, /* 0x063E */ + { 0x063F, 0 }, /* 0x063F */ + + { 0x0640, 0 }, /* 0x0640 C TATWEEL // ### Join Causing, only one glyph */ + { 0xFED1, 3 }, /* 0x0641 D FEH */ + { 0xFED5, 3 }, /* 0x0642 D QAF */ + { 0xFED9, 3 }, /* 0x0643 D KAF */ + { 0xFEDD, 3 }, /* 0x0644 D LAM */ + { 0xFEE1, 3 }, /* 0x0645 D MEEM */ + { 0xFEE5, 3 }, /* 0x0646 D NOON */ + { 0xFEE9, 3 }, /* 0x0647 D HEH */ + { 0xFEED, 1 }, /* 0x0648 R WAW */ + { 0x0649, 3 }, /* 0x0649 ALEF MAKSURA // ### Dual, glyphs not consecutive, handle in code. */ + { 0xFEF1, 3 }, /* 0x064A D YEH */ + { 0x064B, 0 }, /* 0x064B */ + { 0x064C, 0 }, /* 0x064C */ + { 0x064D, 0 }, /* 0x064D */ + { 0x064E, 0 }, /* 0x064E */ + { 0x064F, 0 }, /* 0x064F */ + + { 0x0650, 0 }, /* 0x0650 */ + { 0x0651, 0 }, /* 0x0651 */ + { 0x0652, 0 }, /* 0x0652 */ + { 0x0653, 0 }, /* 0x0653 */ + { 0x0654, 0 }, /* 0x0654 */ + { 0x0655, 0 }, /* 0x0655 */ + { 0x0656, 0 }, /* 0x0656 */ + { 0x0657, 0 }, /* 0x0657 */ + { 0x0658, 0 }, /* 0x0658 */ + { 0x0659, 0 }, /* 0x0659 */ + { 0x065A, 0 }, /* 0x065A */ + { 0x065B, 0 }, /* 0x065B */ + { 0x065C, 0 }, /* 0x065C */ + { 0x065D, 0 }, /* 0x065D */ + { 0x065E, 0 }, /* 0x065E */ + { 0x065F, 0 }, /* 0x065F */ + + { 0x0660, 0 }, /* 0x0660 */ + { 0x0661, 0 }, /* 0x0661 */ + { 0x0662, 0 }, /* 0x0662 */ + { 0x0663, 0 }, /* 0x0663 */ + { 0x0664, 0 }, /* 0x0664 */ + { 0x0665, 0 }, /* 0x0665 */ + { 0x0666, 0 }, /* 0x0666 */ + { 0x0667, 0 }, /* 0x0667 */ + { 0x0668, 0 }, /* 0x0668 */ + { 0x0669, 0 }, /* 0x0669 */ + { 0x066A, 0 }, /* 0x066A */ + { 0x066B, 0 }, /* 0x066B */ + { 0x066C, 0 }, /* 0x066C */ + { 0x066D, 0 }, /* 0x066D */ + { 0x066E, 0 }, /* 0x066E */ + { 0x066F, 0 }, /* 0x066F */ + + { 0x0670, 0 }, /* 0x0670 */ + { 0xFB50, 1 }, /* 0x0671 R ALEF WASLA */ + { 0x0672, 0 }, /* 0x0672 */ + { 0x0673, 0 }, /* 0x0673 */ + { 0x0674, 0 }, /* 0x0674 */ + { 0x0675, 0 }, /* 0x0675 */ + { 0x0676, 0 }, /* 0x0676 */ + { 0x0677, 0 }, /* 0x0677 */ + { 0x0678, 0 }, /* 0x0678 */ + { 0xFB66, 3 }, /* 0x0679 D TTEH */ + { 0xFB5E, 3 }, /* 0x067A D TTEHEH */ + { 0xFB52, 3 }, /* 0x067B D BEEH */ + { 0x067C, 0 }, /* 0x067C */ + { 0x067D, 0 }, /* 0x067D */ + { 0xFB56, 3 }, /* 0x067E D PEH */ + { 0xFB62, 3 }, /* 0x067F D TEHEH */ + + { 0xFB5A, 3 }, /* 0x0680 D BEHEH */ + { 0x0681, 0 }, /* 0x0681 */ + { 0x0682, 0 }, /* 0x0682 */ + { 0xFB76, 3 }, /* 0x0683 D NYEH */ + { 0xFB72, 3 }, /* 0x0684 D DYEH */ + { 0x0685, 0 }, /* 0x0685 */ + { 0xFB7A, 3 }, /* 0x0686 D TCHEH */ + { 0xFB7E, 3 }, /* 0x0687 D TCHEHEH */ + { 0xFB88, 1 }, /* 0x0688 R DDAL */ + { 0x0689, 0 }, /* 0x0689 */ + { 0x068A, 0 }, /* 0x068A */ + { 0x068B, 0 }, /* 0x068B */ + { 0xFB84, 1 }, /* 0x068C R DAHAL */ + { 0xFB82, 1 }, /* 0x068D R DDAHAL */ + { 0xFB86, 1 }, /* 0x068E R DUL */ + { 0x068F, 0 }, /* 0x068F */ + + { 0x0690, 0 }, /* 0x0690 */ + { 0xFB8C, 1 }, /* 0x0691 R RREH */ + { 0x0692, 0 }, /* 0x0692 */ + { 0x0693, 0 }, /* 0x0693 */ + { 0x0694, 0 }, /* 0x0694 */ + { 0x0695, 0 }, /* 0x0695 */ + { 0x0696, 0 }, /* 0x0696 */ + { 0x0697, 0 }, /* 0x0697 */ + { 0xFB8A, 1 }, /* 0x0698 R JEH */ + { 0x0699, 0 }, /* 0x0699 */ + { 0x069A, 0 }, /* 0x069A */ + { 0x069B, 0 }, /* 0x069B */ + { 0x069C, 0 }, /* 0x069C */ + { 0x069D, 0 }, /* 0x069D */ + { 0x069E, 0 }, /* 0x069E */ + { 0x069F, 0 }, /* 0x069F */ + + { 0x06A0, 0 }, /* 0x06A0 */ + { 0x06A1, 0 }, /* 0x06A1 */ + { 0x06A2, 0 }, /* 0x06A2 */ + { 0x06A3, 0 }, /* 0x06A3 */ + { 0xFB6A, 3 }, /* 0x06A4 D VEH */ + { 0x06A5, 0 }, /* 0x06A5 */ + { 0xFB6E, 3 }, /* 0x06A6 D PEHEH */ + { 0x06A7, 0 }, /* 0x06A7 */ + { 0x06A8, 0 }, /* 0x06A8 */ + { 0xFB8E, 3 }, /* 0x06A9 D KEHEH */ + { 0x06AA, 0 }, /* 0x06AA */ + { 0x06AB, 0 }, /* 0x06AB */ + { 0x06AC, 0 }, /* 0x06AC */ + { 0xFBD3, 3 }, /* 0x06AD D NG */ + { 0x06AE, 0 }, /* 0x06AE */ + { 0xFB92, 3 }, /* 0x06AF D GAF */ + + { 0x06B0, 0 }, /* 0x06B0 */ + { 0xFB9A, 3 }, /* 0x06B1 D NGOEH */ + { 0x06B2, 0 }, /* 0x06B2 */ + { 0xFB96, 3 }, /* 0x06B3 D GUEH */ + { 0x06B4, 0 }, /* 0x06B4 */ + { 0x06B5, 0 }, /* 0x06B5 */ + { 0x06B6, 0 }, /* 0x06B6 */ + { 0x06B7, 0 }, /* 0x06B7 */ + { 0x06B8, 0 }, /* 0x06B8 */ + { 0x06B9, 0 }, /* 0x06B9 */ + { 0xFB9E, 1 }, /* 0x06BA R NOON GHUNNA */ + { 0xFBA0, 3 }, /* 0x06BB D RNOON */ + { 0x06BC, 0 }, /* 0x06BC */ + { 0x06BD, 0 }, /* 0x06BD */ + { 0xFBAA, 3 }, /* 0x06BE D HEH DOACHASHMEE */ + { 0x06BF, 0 }, /* 0x06BF */ + + { 0xFBA4, 1 }, /* 0x06C0 R HEH WITH YEH ABOVE */ + { 0xFBA6, 3 }, /* 0x06C1 D HEH GOAL */ + { 0x06C2, 0 }, /* 0x06C2 */ + { 0x06C3, 0 }, /* 0x06C3 */ + { 0x06C4, 0 }, /* 0x06C4 */ + { 0xFBE0, 1 }, /* 0x06C5 R KIRGHIZ OE */ + { 0xFBD9, 1 }, /* 0x06C6 R OE */ + { 0xFBD7, 1 }, /* 0x06C7 R U */ + { 0xFBDB, 1 }, /* 0x06C8 R YU */ + { 0xFBE2, 1 }, /* 0x06C9 R KIRGHIZ YU */ + { 0x06CA, 0 }, /* 0x06CA */ + { 0xFBDE, 1 }, /* 0x06CB R VE */ + { 0xFBFC, 3 }, /* 0x06CC D FARSI YEH */ + { 0x06CD, 0 }, /* 0x06CD */ + { 0x06CE, 0 }, /* 0x06CE */ + { 0x06CF, 0 }, /* 0x06CF */ + + { 0xFBE4, 3 }, /* 0x06D0 D E */ + { 0x06D1, 0 }, /* 0x06D1 */ + { 0xFBAE, 1 }, /* 0x06D2 R YEH BARREE */ + { 0xFBB0, 1 }, /* 0x06D3 R YEH BARREE WITH HAMZA ABOVE */ + { 0x06D4, 0 }, /* 0x06D4 */ + { 0x06D5, 0 }, /* 0x06D5 */ + { 0x06D6, 0 }, /* 0x06D6 */ + { 0x06D7, 0 }, /* 0x06D7 */ + { 0x06D8, 0 }, /* 0x06D8 */ + { 0x06D9, 0 }, /* 0x06D9 */ + { 0x06DA, 0 }, /* 0x06DA */ + { 0x06DB, 0 }, /* 0x06DB */ + { 0x06DC, 0 }, /* 0x06DC */ + { 0x06DD, 0 }, /* 0x06DD */ + { 0x06DE, 0 }, /* 0x06DE */ + { 0x06DF, 0 }, /* 0x06DF */ + + { 0x06E0, 0 }, /* 0x06E0 */ + { 0x06E1, 0 }, /* 0x06E1 */ + { 0x06E2, 0 }, /* 0x06E2 */ + { 0x06E3, 0 }, /* 0x06E3 */ + { 0x06E4, 0 }, /* 0x06E4 */ + { 0x06E5, 0 }, /* 0x06E5 */ + { 0x06E6, 0 }, /* 0x06E6 */ + { 0x06E7, 0 }, /* 0x06E7 */ + { 0x06E8, 0 }, /* 0x06E8 */ + { 0x06E9, 0 }, /* 0x06E9 */ + { 0x06EA, 0 }, /* 0x06EA */ + { 0x06EB, 0 }, /* 0x06EB */ + { 0x06EC, 0 }, /* 0x06EC */ + { 0x06ED, 0 }, /* 0x06ED */ + { 0x06EE, 0 }, /* 0x06EE */ + { 0x06EF, 0 }, /* 0x06EF */ + + { 0x06F0, 0 }, /* 0x06F0 */ + { 0x06F1, 0 }, /* 0x06F1 */ + { 0x06F2, 0 }, /* 0x06F2 */ + { 0x06F3, 0 }, /* 0x06F3 */ + { 0x06F4, 0 }, /* 0x06F4 */ + { 0x06F5, 0 }, /* 0x06F5 */ + { 0x06F6, 0 }, /* 0x06F6 */ + { 0x06F7, 0 }, /* 0x06F7 */ + { 0x06F8, 0 }, /* 0x06F8 */ + { 0x06F9, 0 }, /* 0x06F9 */ + { 0x06FA, 0 }, /* 0x06FA */ + { 0x06FB, 0 }, /* 0x06FB */ + { 0x06FC, 0 }, /* 0x06FC */ + { 0x06FD, 0 }, /* 0x06FD */ + { 0x06FE, 0 }, /* 0x06FE */ + { 0x06FF, 0 } /* 0x06FF */ +}; + +/* the arabicUnicodeMapping does not work for U+0649 ALEF MAKSURA, this table does */ +static const hb_uint16 alefMaksura[4] = {0xFEEF, 0xFEF0, 0xFBE8, 0xFBE9}; + +/* +// this is a bit tricky. Alef always binds to the right, so the second parameter descibing the shape +// of the lam can be either initial of medial. So initial maps to the isolated form of the ligature, +// medial to the final form +*/ +static const hb_uint16 arabicUnicodeLamAlefMapping[6][4] = { + { 0xfffd, 0xfffd, 0xfef5, 0xfef6 }, /* 0x622 R Alef with Madda above */ + { 0xfffd, 0xfffd, 0xfef7, 0xfef8 }, /* 0x623 R Alef with Hamza above */ + { 0xfffd, 0xfffd, 0xfffd, 0xfffd }, /* 0x624 // Just to fill the table ;-) */ + { 0xfffd, 0xfffd, 0xfef9, 0xfefa }, /* 0x625 R Alef with Hamza below */ + { 0xfffd, 0xfffd, 0xfffd, 0xfffd }, /* 0x626 // Just to fill the table ;-) */ + { 0xfffd, 0xfffd, 0xfefb, 0xfefc } /* 0x627 R Alef */ +}; + +static int getShape(hb_uint8 cell, int shape) +{ + /* the arabicUnicodeMapping does not work for U+0649 ALEF MAKSURA, handle this here */ + int ch = (cell != 0x49) + ? (shape ? arabicUnicodeMapping[cell][0] + shape : 0x600+cell) + : alefMaksura[shape] ; + return ch; +} + + +/* + Two small helper functions for arabic shaping. +*/ +static HB_UChar16 prevChar(const HB_UChar16 *str, int pos) +{ + /*qDebug("leftChar: pos=%d", pos); */ + const HB_UChar16 *ch = str + pos - 1; + pos--; + while(pos > -1) { + if(HB_GetUnicodeCharCategory(*ch) != HB_Mark_NonSpacing) + return *ch; + pos--; + ch--; + } + return ReplacementCharacter; +} + +static HB_UChar16 nextChar(const HB_UChar16 *str, hb_uint32 len, hb_uint32 pos) +{ + const HB_UChar16 *ch = str + pos + 1; + pos++; + while(pos < len) { + /*qDebug("rightChar: %d isLetter=%d, joining=%d", pos, ch.isLetter(), ch.joining()); */ + if(HB_GetUnicodeCharCategory(*ch) != HB_Mark_NonSpacing) + return *ch; + /* assume it's a transparent char, this might not be 100% correct */ + pos++; + ch++; + } + return ReplacementCharacter; +} + +static void shapedString(const HB_UChar16 *uc, hb_uint32 stringLength, hb_uint32 from, hb_uint32 len, HB_UChar16 *shapeBuffer, int *shapedLength, + HB_Bool reverse, HB_GlyphAttributes *attributes, unsigned short *logClusters) +{ + HB_ArabicProperties *properties; + hb_int32 f = from; + hb_uint32 l = len; + const HB_UChar16 *ch; + HB_UChar16 *data; + int clusterStart; + hb_uint32 i; + HB_STACKARRAY(HB_ArabicProperties, props, len + 2); + properties = props; + + assert(stringLength >= from + len); + + if(len == 0) { + *shapedLength = 0; + return; + } + + if (from > 0) { + --f; + ++l; + ++properties; + } + if (f + l < stringLength) + ++l; + getArabicProperties(uc+f, l, props); + + ch = uc + from; + data = shapeBuffer; + clusterStart = 0; + + for (i = 0; i < len; i++) { + hb_uint8 r = *ch >> 8; + int gpos = data - shapeBuffer; + + if (r != 0x06) { + if (r == 0x20) { + if (*ch == 0x200c || *ch == 0x200d) + /* remove ZWJ and ZWNJ */ + goto skip; + } + if (reverse) + *data = HB_GetMirroredChar(*ch); + else + *data = *ch; + } else { + hb_uint8 c = *ch & 0xff; + int pos = i + from; + int shape = properties[i].shape; +/* qDebug("mapping U+%x to shape %d glyph=0x%x", ch->unicode(), shape, getShape(c, shape)); */ + /* take care of lam-alef ligatures (lam right of alef) */ + hb_uint16 map; + switch (c) { + case 0x44: { /* lam */ + const HB_UChar16 pch = nextChar(uc, stringLength, pos); + if ((pch >> 8) == 0x06) { + switch (pch & 0xff) { + case 0x22: + case 0x23: + case 0x25: + case 0x27: +/* qDebug(" lam of lam-alef ligature"); */ + map = arabicUnicodeLamAlefMapping[(pch & 0xff) - 0x22][shape]; + goto next; + default: + break; + } + } + break; + } + case 0x22: /* alef with madda */ + case 0x23: /* alef with hamza above */ + case 0x25: /* alef with hamza below */ + case 0x27: /* alef */ + if (prevChar(uc, pos) == 0x0644) { + /* have a lam alef ligature */ + /*qDebug(" alef of lam-alef ligature"); */ + goto skip; + } + default: + break; + } + map = getShape(c, shape); + next: + *data = map; + } + /* ##### Fixme */ + /*glyphs[gpos].attributes.zeroWidth = zeroWidth; */ + if (HB_GetUnicodeCharCategory(*ch) == HB_Mark_NonSpacing) { + attributes[gpos].mark = TRUE; +/* qDebug("glyph %d (char %d) is mark!", gpos, i); */ + } else { + attributes[gpos].mark = FALSE; + clusterStart = data - shapeBuffer; + } + attributes[gpos].clusterStart = !attributes[gpos].mark; + attributes[gpos].combiningClass = HB_GetUnicodeCharCombiningClass(*ch); + attributes[gpos].justification = properties[i].justification; +/* qDebug("data[%d] = %x (from %x)", gpos, (uint)data->unicode(), ch->unicode());*/ + data++; + skip: + ch++; + logClusters[i] = clusterStart; + } + *shapedLength = data - shapeBuffer; + + HB_FREE_STACKARRAY(props); +} + +#ifndef NO_OPENTYPE + +static const HB_OpenTypeFeature arabic_features[] = { + { HB_MAKE_TAG('c', 'c', 'm', 'p'), CcmpProperty }, + { HB_MAKE_TAG('i', 's', 'o', 'l'), IsolProperty }, + { HB_MAKE_TAG('f', 'i', 'n', 'a'), FinaProperty }, + { HB_MAKE_TAG('m', 'e', 'd', 'i'), MediProperty }, + { HB_MAKE_TAG('i', 'n', 'i', 't'), InitProperty }, + { HB_MAKE_TAG('r', 'l', 'i', 'g'), RligProperty }, + { HB_MAKE_TAG('c', 'a', 'l', 't'), CaltProperty }, + { HB_MAKE_TAG('l', 'i', 'g', 'a'), LigaProperty }, + { HB_MAKE_TAG('d', 'l', 'i', 'g'), DligProperty }, + { HB_MAKE_TAG('c', 's', 'w', 'h'), CswhProperty }, + /* mset is used in old Win95 fonts that don't have a 'mark' positioning table. */ + { HB_MAKE_TAG('m', 's', 'e', 't'), MsetProperty }, + {0, 0} +}; + +static const HB_OpenTypeFeature syriac_features[] = { + { HB_MAKE_TAG('c', 'c', 'm', 'p'), CcmpProperty }, + { HB_MAKE_TAG('i', 's', 'o', 'l'), IsolProperty }, + { HB_MAKE_TAG('f', 'i', 'n', 'a'), FinaProperty }, + { HB_MAKE_TAG('f', 'i', 'n', '2'), FinaProperty }, + { HB_MAKE_TAG('f', 'i', 'n', '3'), FinaProperty }, + { HB_MAKE_TAG('m', 'e', 'd', 'i'), MediProperty }, + { HB_MAKE_TAG('m', 'e', 'd', '2'), MediProperty }, + { HB_MAKE_TAG('i', 'n', 'i', 't'), InitProperty }, + { HB_MAKE_TAG('r', 'l', 'i', 'g'), RligProperty }, + { HB_MAKE_TAG('c', 'a', 'l', 't'), CaltProperty }, + { HB_MAKE_TAG('l', 'i', 'g', 'a'), LigaProperty }, + { HB_MAKE_TAG('d', 'l', 'i', 'g'), DligProperty }, + {0, 0} +}; + +static HB_Bool arabicSyriacOpenTypeShape(HB_ShaperItem *item, HB_Bool *ot_ok) +{ + const HB_UChar16 *uc; + const int nglyphs = item->num_glyphs; + hb_int32 f; + hb_uint32 l; + HB_ArabicProperties *properties; + HB_DECLARE_STACKARRAY(HB_ArabicProperties, props) + HB_DECLARE_STACKARRAY(hb_uint32, apply) + HB_Bool shaped; + int i = 0; + + *ot_ok = TRUE; + + if (!HB_ConvertStringToGlyphIndices(item)) + return FALSE; + HB_HeuristicSetGlyphAttributes(item); + + HB_INIT_STACKARRAY(HB_ArabicProperties, props, item->item.length + 2); + HB_INIT_STACKARRAY(hb_uint32, apply, item->num_glyphs); + + uc = item->string + item->item.pos; + + properties = props; + f = 0; + l = item->item.length; + if (item->item.pos > 0) { + --f; + ++l; + ++properties; + } + if (f + l + item->item.pos < item->stringLength) { + ++l; + } + if (item->item.script == HB_Script_Nko) + getNkoProperties(uc+f, l, props); + else + getArabicProperties(uc+f, l, props); + + for (i = 0; i < (int)item->num_glyphs; i++) { + apply[i] = 0; + + if (properties[i].shape == XIsolated) + apply[i] |= MediProperty|FinaProperty|InitProperty; + else if (properties[i].shape == XMedial) + apply[i] |= IsolProperty|FinaProperty|InitProperty; + else if (properties[i].shape == XFinal) + apply[i] |= IsolProperty|MediProperty|InitProperty; + else if (properties[i].shape == XInitial) + apply[i] |= IsolProperty|MediProperty|FinaProperty; + + item->attributes[i].justification = properties[i].justification; + } + + HB_FREE_STACKARRAY(props); + + shaped = HB_OpenTypeShape(item, apply); + + HB_FREE_STACKARRAY(apply); + + if (!shaped) { + *ot_ok = FALSE; + return FALSE; + } + return HB_OpenTypePosition(item, nglyphs, /*doLogClusters*/TRUE); +} + +#endif + +/* #### stil missing: identify invalid character combinations */ +HB_Bool HB_ArabicShape(HB_ShaperItem *item) +{ + int slen; + HB_Bool haveGlyphs; + HB_STACKARRAY(HB_UChar16, shapedChars, item->item.length); + + assert(item->item.script == HB_Script_Arabic || item->item.script == HB_Script_Syriac + || item->item.script == HB_Script_Nko); + +#ifndef NO_OPENTYPE + + if (HB_SelectScript(item, item->item.script == HB_Script_Arabic ? arabic_features : syriac_features)) { + HB_Bool ot_ok; + if (arabicSyriacOpenTypeShape(item, &ot_ok)) + return TRUE; + if (ot_ok) + return FALSE; + /* fall through to the non OT code*/ + } +#endif + + if (item->item.script != HB_Script_Arabic) + return HB_BasicShape(item); + + shapedString(item->string, item->stringLength, item->item.pos, item->item.length, shapedChars, &slen, + item->item.bidiLevel % 2, + item->attributes, item->log_clusters); + + haveGlyphs = item->font->klass + ->convertStringToGlyphIndices(item->font, + shapedChars, slen, + item->glyphs, &item->num_glyphs, + item->item.bidiLevel % 2); + + HB_FREE_STACKARRAY(shapedChars); + + if (!haveGlyphs) + return FALSE; + + HB_HeuristicPosition(item); + return TRUE; +} + + diff --git a/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-buffer-private.h b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-buffer-private.h new file mode 100644 index 0000000..5065f2e --- /dev/null +++ b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-buffer-private.h @@ -0,0 +1,107 @@ +/* + * Copyright (C) 1998-2004 David Turner and Werner Lemberg + * Copyright (C) 2004,2007 Red Hat, Inc. + * + * This is part of HarfBuzz, an OpenType Layout engine library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + * + * Red Hat Author(s): Owen Taylor, Behdad Esfahbod + */ + +#ifndef HARFBUZZ_BUFFER_PRIVATE_H +#define HARFBUZZ_BUFFER_PRIVATE_H + +#include "harfbuzz-impl.h" +#include "harfbuzz-buffer.h" + +HB_BEGIN_HEADER + +#define HB_GLYPH_PROPERTIES_UNKNOWN 0xFFFF + +HB_INTERNAL void +_hb_buffer_swap( HB_Buffer buffer ); + +HB_INTERNAL void +_hb_buffer_clear_output( HB_Buffer buffer ); + +HB_INTERNAL HB_Error +_hb_buffer_clear_positions( HB_Buffer buffer ); + +HB_INTERNAL HB_Error +_hb_buffer_add_output_glyphs( HB_Buffer buffer, + HB_UShort num_in, + HB_UShort num_out, + HB_UShort *glyph_data, + HB_UShort component, + HB_UShort ligID ); + +HB_INTERNAL HB_Error +_hb_buffer_add_output_glyph ( HB_Buffer buffer, + HB_UInt glyph_index, + HB_UShort component, + HB_UShort ligID ); + +HB_INTERNAL HB_Error +_hb_buffer_copy_output_glyph ( HB_Buffer buffer ); + +HB_INTERNAL HB_Error +_hb_buffer_replace_output_glyph ( HB_Buffer buffer, + HB_UInt glyph_index, + HB_Bool inplace ); + +HB_INTERNAL HB_UShort +_hb_buffer_allocate_ligid( HB_Buffer buffer ); + + +/* convenience macros */ + +#define IN_GLYPH( pos ) (buffer->in_string[(pos)].gindex) +#define IN_ITEM( pos ) (&buffer->in_string[(pos)]) +#define IN_CURGLYPH() (buffer->in_string[buffer->in_pos].gindex) +#define IN_CURITEM() (&buffer->in_string[buffer->in_pos]) +#define IN_PROPERTIES( pos ) (buffer->in_string[(pos)].properties) +#define IN_LIGID( pos ) (buffer->in_string[(pos)].ligID) +#define IN_COMPONENT( pos ) (buffer->in_string[(pos)].component) +#define POSITION( pos ) (&buffer->positions[(pos)]) +#define OUT_GLYPH( pos ) (buffer->out_string[(pos)].gindex) +#define OUT_ITEM( pos ) (&buffer->out_string[(pos)]) + +#define CHECK_Property( gdef, index, flags, property ) \ + ( ( error = _HB_GDEF_Check_Property( (gdef), (index), (flags), \ + (property) ) ) != HB_Err_Ok ) + +#define ADD_String( buffer, num_in, num_out, glyph_data, component, ligID ) \ + ( ( error = _hb_buffer_add_output_glyphs( (buffer), \ + (num_in), (num_out), \ + (glyph_data), (component), (ligID) \ + ) ) != HB_Err_Ok ) +#define ADD_Glyph( buffer, glyph_index, component, ligID ) \ + ( ( error = _hb_buffer_add_output_glyph( (buffer), \ + (glyph_index), (component), (ligID) \ + ) ) != HB_Err_Ok ) +#define REPLACE_Glyph( buffer, glyph_index, nesting_level ) \ + ( ( error = _hb_buffer_replace_output_glyph( (buffer), (glyph_index), \ + (nesting_level) == 1 ) ) != HB_Err_Ok ) +#define COPY_Glyph( buffer ) \ + ( (error = _hb_buffer_copy_output_glyph ( buffer ) ) != HB_Err_Ok ) + +HB_END_HEADER + +#endif /* HARFBUZZ_BUFFER_PRIVATE_H */ diff --git a/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-buffer.c b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-buffer.c new file mode 100644 index 0000000..4d4c167 --- /dev/null +++ b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-buffer.c @@ -0,0 +1,383 @@ +/* + * Copyright (C) 1998-2004 David Turner and Werner Lemberg + * Copyright (C) 2004,2007 Red Hat, Inc. + * + * This is part of HarfBuzz, an OpenType Layout engine library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + * + * Red Hat Author(s): Owen Taylor, Behdad Esfahbod + */ + +#include "harfbuzz-impl.h" +#include "harfbuzz-buffer-private.h" +#include "harfbuzz-gsub-private.h" +#include "harfbuzz-gpos-private.h" + +/* Here is how the buffer works internally: + * + * There are two string pointers: in_string and out_string. They + * always have same allocated size, but different length and positions. + * + * As an optimization, both in_string and out_string may point to the + * same piece of memory, which is owned by in_string. This remains the + * case as long as: + * + * - copy_glyph() is called + * - replace_glyph() is called with inplace=TRUE + * - add_output_glyph() and add_output_glyphs() are not called + * + * In that case swap(), and copy_glyph(), and replace_glyph() are all + * mostly no-op. + * + * As soon an add_output_glyph[s]() or replace_glyph() with inplace=FALSE is + * called, out_string is moved over to an alternate buffer (alt_string), and + * its current contents (out_length entries) are copied to the alt buffer. + * This should all remain transparent to the user. swap() then switches + * in_string and alt_string. alt_string is not allocated until its needed, + * but after that it's grown with in_string unconditionally. + * + * The buffer->separate_out boolean keeps status of whether out_string points + * to in_string (FALSE) or alt_string (TRUE). + */ + +/* Internal API */ + +static HB_Error +hb_buffer_ensure( HB_Buffer buffer, + HB_UInt size ) +{ + HB_UInt new_allocated = buffer->allocated; + + if (size > new_allocated) + { + HB_Error error; + + while (size > new_allocated) + new_allocated += (new_allocated >> 1) + 8; + + if ( buffer->positions ) + { + if ( REALLOC_ARRAY( buffer->positions, new_allocated, HB_PositionRec ) ) + return error; + } + + if ( REALLOC_ARRAY( buffer->in_string, new_allocated, HB_GlyphItemRec ) ) + return error; + + if ( buffer->separate_out ) + { + if ( REALLOC_ARRAY( buffer->alt_string, new_allocated, HB_GlyphItemRec ) ) + return error; + + buffer->out_string = buffer->alt_string; + } + else + { + buffer->out_string = buffer->in_string; + + if ( buffer->alt_string ) + { + if ( REALLOC_ARRAY( buffer->alt_string, new_allocated, HB_GlyphItemRec ) ) + return error; + } + } + + buffer->allocated = new_allocated; + } + + return HB_Err_Ok; +} + +static HB_Error +hb_buffer_duplicate_out_buffer( HB_Buffer buffer ) +{ + if ( !buffer->alt_string ) + { + HB_Error error; + + if ( ALLOC_ARRAY( buffer->alt_string, buffer->allocated, HB_GlyphItemRec ) ) + return error; + } + + buffer->out_string = buffer->alt_string; + memcpy( buffer->out_string, buffer->in_string, buffer->out_length * sizeof (buffer->out_string[0]) ); + buffer->separate_out = TRUE; + + return HB_Err_Ok; +} + +/* Public API */ + +HB_Error +hb_buffer_new( HB_Buffer *pbuffer ) +{ + HB_Buffer buffer; + HB_Error error; + + if ( ALLOC( buffer, sizeof( HB_BufferRec ) ) ) + return error; + + buffer->allocated = 0; + buffer->in_string = NULL; + buffer->alt_string = NULL; + buffer->positions = NULL; + + hb_buffer_clear( buffer ); + + *pbuffer = buffer; + + return HB_Err_Ok; +} + +void +hb_buffer_free( HB_Buffer buffer ) +{ + FREE( buffer->in_string ); + FREE( buffer->alt_string ); + buffer->out_string = NULL; + FREE( buffer->positions ); + FREE( buffer ); +} + +void +hb_buffer_clear( HB_Buffer buffer ) +{ + buffer->in_length = 0; + buffer->out_length = 0; + buffer->in_pos = 0; + buffer->out_pos = 0; + buffer->out_string = buffer->in_string; + buffer->separate_out = FALSE; + buffer->max_ligID = 0; +} + +HB_Error +hb_buffer_add_glyph( HB_Buffer buffer, + HB_UInt glyph_index, + HB_UInt properties, + HB_UInt cluster ) +{ + HB_Error error; + HB_GlyphItem glyph; + + error = hb_buffer_ensure( buffer, buffer->in_length + 1 ); + if ( error ) + return error; + + glyph = &buffer->in_string[buffer->in_length]; + glyph->gindex = glyph_index; + glyph->properties = properties; + glyph->cluster = cluster; + glyph->component = 0; + glyph->ligID = 0; + glyph->gproperties = HB_GLYPH_PROPERTIES_UNKNOWN; + + buffer->in_length++; + + return HB_Err_Ok; +} + +/* HarfBuzz-Internal API */ + +HB_INTERNAL void +_hb_buffer_clear_output( HB_Buffer buffer ) +{ + buffer->out_length = 0; + buffer->out_pos = 0; + buffer->out_string = buffer->in_string; + buffer->separate_out = FALSE; +} + +HB_INTERNAL HB_Error +_hb_buffer_clear_positions( HB_Buffer buffer ) +{ + if ( !buffer->positions ) + { + HB_Error error; + + if ( ALLOC_ARRAY( buffer->positions, buffer->allocated, HB_PositionRec ) ) + return error; + } + + memset (buffer->positions, 0, sizeof (buffer->positions[0]) * buffer->in_length); + + return HB_Err_Ok; +} + +HB_INTERNAL void +_hb_buffer_swap( HB_Buffer buffer ) +{ + HB_GlyphItem tmp_string; + int tmp_length; + int tmp_pos; + + if ( buffer->separate_out ) + { + tmp_string = buffer->in_string; + buffer->in_string = buffer->out_string; + buffer->out_string = tmp_string; + buffer->alt_string = buffer->out_string; + } + + tmp_length = buffer->in_length; + buffer->in_length = buffer->out_length; + buffer->out_length = tmp_length; + + tmp_pos = buffer->in_pos; + buffer->in_pos = buffer->out_pos; + buffer->out_pos = tmp_pos; +} + +/* The following function copies `num_out' elements from `glyph_data' + to `buffer->out_string', advancing the in array pointer in the structure + by `num_in' elements, and the out array pointer by `num_out' elements. + Finally, it sets the `length' field of `out' equal to + `pos' of the `out' structure. + + If `component' is 0xFFFF, the component value from buffer->in_pos + will copied `num_out' times, otherwise `component' itself will + be used to fill the `component' fields. + + If `ligID' is 0xFFFF, the ligID value from buffer->in_pos + will copied `num_out' times, otherwise `ligID' itself will + be used to fill the `ligID' fields. + + The properties for all replacement glyphs are taken + from the glyph at position `buffer->in_pos'. + + The cluster value for the glyph at position buffer->in_pos is used + for all replacement glyphs */ +HB_INTERNAL HB_Error +_hb_buffer_add_output_glyphs( HB_Buffer buffer, + HB_UShort num_in, + HB_UShort num_out, + HB_UShort *glyph_data, + HB_UShort component, + HB_UShort ligID ) +{ + HB_Error error; + HB_UShort i; + HB_UInt properties; + HB_UInt cluster; + + error = hb_buffer_ensure( buffer, buffer->out_pos + num_out ); + if ( error ) + return error; + + if ( !buffer->separate_out ) + { + error = hb_buffer_duplicate_out_buffer( buffer ); + if ( error ) + return error; + } + + properties = buffer->in_string[buffer->in_pos].properties; + cluster = buffer->in_string[buffer->in_pos].cluster; + if ( component == 0xFFFF ) + component = buffer->in_string[buffer->in_pos].component; + if ( ligID == 0xFFFF ) + ligID = buffer->in_string[buffer->in_pos].ligID; + + for ( i = 0; i < num_out; i++ ) + { + HB_GlyphItem item = &buffer->out_string[buffer->out_pos + i]; + + item->gindex = glyph_data[i]; + item->properties = properties; + item->cluster = cluster; + item->component = component; + item->ligID = ligID; + item->gproperties = HB_GLYPH_PROPERTIES_UNKNOWN; + } + + buffer->in_pos += num_in; + buffer->out_pos += num_out; + + buffer->out_length = buffer->out_pos; + + return HB_Err_Ok; +} + +HB_INTERNAL HB_Error +_hb_buffer_add_output_glyph( HB_Buffer buffer, + HB_UInt glyph_index, + HB_UShort component, + HB_UShort ligID ) +{ + HB_UShort glyph_data = glyph_index; + + return _hb_buffer_add_output_glyphs ( buffer, 1, 1, + &glyph_data, component, ligID ); +} + +HB_INTERNAL HB_Error +_hb_buffer_copy_output_glyph ( HB_Buffer buffer ) +{ + HB_Error error; + + error = hb_buffer_ensure( buffer, buffer->out_pos + 1 ); + if ( error ) + return error; + + if ( buffer->separate_out ) + { + buffer->out_string[buffer->out_pos] = buffer->in_string[buffer->in_pos]; + } + + buffer->in_pos++; + buffer->out_pos++; + buffer->out_length = buffer->out_pos; + + return HB_Err_Ok; +} + +HB_INTERNAL HB_Error +_hb_buffer_replace_output_glyph( HB_Buffer buffer, + HB_UInt glyph_index, + HB_Bool inplace ) +{ + + HB_Error error; + + if ( inplace ) + { + error = _hb_buffer_copy_output_glyph ( buffer ); + if ( error ) + return error; + + buffer->out_string[buffer->out_pos-1].gindex = glyph_index; + } + else + { + return _hb_buffer_add_output_glyph( buffer, glyph_index, 0xFFFF, 0xFFFF ); + } + + return HB_Err_Ok; +} + +HB_INTERNAL HB_UShort +_hb_buffer_allocate_ligid( HB_Buffer buffer ) +{ + buffer->max_ligID++; + if (HB_UNLIKELY (buffer->max_ligID == 0)) + buffer->max_ligID++; + + return buffer->max_ligID; +} diff --git a/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-buffer.h b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-buffer.h new file mode 100644 index 0000000..0d7c2c2 --- /dev/null +++ b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-buffer.h @@ -0,0 +1,102 @@ +/* + * Copyright (C) 1998-2004 David Turner and Werner Lemberg + * Copyright (C) 2004,2007 Red Hat, Inc. + * + * This is part of HarfBuzz, an OpenType Layout engine library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + * + * Red Hat Author(s): Owen Taylor, Behdad Esfahbod + */ + +#ifndef HARFBUZZ_BUFFER_H +#define HARFBUZZ_BUFFER_H + +#include "harfbuzz-global.h" + +HB_BEGIN_HEADER + +#ifdef HB_USE_PACKED_STRUCTS +#pragma pack(push, 1) +#endif + +typedef struct HB_GlyphItemRec_ { + HB_UInt gindex; + HB_UInt properties; + HB_UInt cluster; + HB_UShort component; + HB_UShort ligID; + HB_UShort gproperties; +} HB_GlyphItemRec, *HB_GlyphItem; + +typedef struct HB_PositionRec_ { + HB_Fixed x_pos; + HB_Fixed y_pos; + HB_Fixed x_advance; + HB_Fixed y_advance; + HB_UShort back; /* number of glyphs to go back + for drawing current glyph */ + HB_Short cursive_chain; /* character to which this connects, + may be positive or negative; used + only internally */ + HB_Bool new_advance; /* if set, the advance width values are + absolute, i.e., they won't be + added to the original glyph's value + but rather replace them. */ +} HB_PositionRec, *HB_Position; + + +typedef struct HB_BufferRec_{ + HB_UInt allocated; + + HB_UInt in_length; + HB_UInt out_length; + HB_UInt in_pos; + HB_UInt out_pos; + + HB_GlyphItem in_string; + HB_GlyphItem out_string; + HB_GlyphItem alt_string; + HB_Position positions; + HB_UShort max_ligID; + HB_Bool separate_out; +} HB_BufferRec, *HB_Buffer; + +HB_Error +hb_buffer_new( HB_Buffer *buffer ); + +void +hb_buffer_free( HB_Buffer buffer ); + +void +hb_buffer_clear( HB_Buffer buffer ); + +HB_Error +hb_buffer_add_glyph( HB_Buffer buffer, + HB_UInt glyph_index, + HB_UInt properties, + HB_UInt cluster ); + +#ifdef HB_USE_PACKED_STRUCTS +#pragma pack(pop) +#endif + +HB_END_HEADER + +#endif /* HARFBUZZ_BUFFER_H */ diff --git a/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-dump-main.c b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-dump-main.c new file mode 100644 index 0000000..dfb35fb --- /dev/null +++ b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-dump-main.c @@ -0,0 +1,97 @@ +/* + * Copyright (C) 2000 Red Hat, Inc. + * + * This is part of HarfBuzz, an OpenType Layout engine library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + * + * Red Hat Author(s): Owen Taylor + */ + +#include +#include + +#include "harfbuzz.h" +#include "harfbuzz-dump.h" + +#define N_ELEMENTS(arr) (sizeof(arr)/ sizeof((arr)[0])) + +static int +croak (const char *situation, HB_Error error) +{ + fprintf (stderr, "%s: Error %d\n", situation, error); + + exit (1); +} + +int +main (int argc, char **argv) +{ + HB_Error error; + FT_Library library; + HB_Font font; + HB_GSUB gsub; + HB_GPOS gpos; + + if (argc != 2) + { + fprintf (stderr, "Usage: harfbuzz-dump MYFONT.TTF\n"); + exit(1); + } + + if ((error = FT_Init_FreeType (&library))) + croak ("FT_Init_FreeType", error); + + if ((error = FT_New_Face (library, argv[1], 0, &font))) + croak ("FT_New_Face", error); + + printf ("\n"); + printf ("\n"); + + if (!(error = HB_Load_GSUB_Table (font, &gsub, NULL))) + { + HB_Dump_GSUB_Table (gsub, stdout); + + if ((error = HB_Done_GSUB_Table (gsub))) + croak ("HB_Done_GSUB_Table", error); + } + else if (error != HB_Err_Not_Covered) + fprintf (stderr, "HB_Load_GSUB_Table: error 0x%x\n", error); + + if (!(error = HB_Load_GPOS_Table (font, &gpos, NULL))) + { + HB_Dump_GPOS_Table (gpos, stdout); + + if ((error = HB_Done_GPOS_Table (gpos))) + croak ("HB_Done_GPOS_Table", error); + } + else if (error != HB_Err_Not_Covered) + fprintf (stderr, "HB_Load_GPOS_Table: error 0x%x\n", error); + + printf ("\n"); + + if ((error = FT_Done_Face (font))) + croak ("FT_Done_Face", error); + + if ((error = FT_Done_FreeType (library))) + croak ("FT_Done_FreeType", error); + + return 0; +} + diff --git a/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-dump.c b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-dump.c new file mode 100644 index 0000000..54d42e9 --- /dev/null +++ b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-dump.c @@ -0,0 +1,767 @@ +/* + * Copyright (C) 2000, 2007 Red Hat, Inc. + * + * This is part of HarfBuzz, an OpenType Layout engine library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + * + * Red Hat Author(s): Owen Taylor, Behdad Esfahbod + */ + +#include "harfbuzz-impl.h" +#include "harfbuzz-dump.h" +#include "harfbuzz-gdef-private.h" +#include "harfbuzz-gsub-private.h" +#include "harfbuzz-gpos-private.h" +#include "harfbuzz-open-private.h" +#include + +#define DUMP(format) dump (stream, indent, format) +#define DUMP1(format, arg1) dump (stream, indent, format, arg1) +#define DUMP2(format, arg1, arg2) dump (stream, indent, format, arg1, arg2) +#define DUMP3(format, arg1, arg2, arg3) dump (stream, indent, format, arg1, arg2, arg3) + +#define DUMP_FINT(strct,fld) dump (stream, indent, "<" #fld ">%d\n", (strct)->fld) +#define DUMP_FUINT(strct,fld) dump (stream, indent, "<" #fld ">%u\n", (strct)->fld) +#define DUMP_FGLYPH(strct,fld) dump (stream, indent, "<" #fld ">%#06x\n", (strct)->fld) +#define DUMP_FGLYPH(strct,fld) dump (stream, indent, "<" #fld ">%#06x\n", (strct)->fld) +#define DUMP_USHORT_ARRAY(strct,fld,cnt) Dump_UShort_Array ((strct)->fld, cnt, #fld, stream, indent); + +#define DEF_DUMP(type) static void Dump_ ## type (HB_ ## type *type, FILE *stream, int indent, HB_Type hb_type) +#define RECURSE(name, type, val) do { DUMP ("<" #name ">\n"); Dump_ ## type (val, stream, indent + 1, hb_type); DUMP ("\n"); } while (0) +#define RECURSE_NUM(name, i, type, val) do { DUMP1 ("<" #name "> \n", i); Dump_ ## type (val, stream, indent + 1, hb_type); DUMP ("\n"); } while (0) +#define DUMP_VALUE_RECORD(val, frmt) do { DUMP ("\n"); Dump_ValueRecord (val, stream, indent + 1, hb_type, frmt); DUMP ("\n"); } while (0) + +static void +do_indent (FILE *stream, int indent) +{ + fprintf (stream, "%*s", indent * 3, ""); +} + +static void +dump (FILE *stream, int indent, const char *format, ...) +{ + va_list list; + + do_indent (stream, indent); + + va_start (list, format); + vfprintf (stream, format, list); + va_end (list); +} + +static void +Dump_UShort_Array (HB_UShort *array, int count, const char *name, FILE *stream, int indent) +{ + int i; + + do_indent (stream, indent); + + fprintf (stream, "<%s>", name); + for (i = 0; i < count; i++) + fprintf (stream, "%d%s", array[i], i == 0 ? "" : " "); + fprintf (stream, "\n", name); +} + +static void +Print_Tag (HB_UInt tag, FILE *stream) +{ + fprintf (stream, "%c%c%c%c", + (unsigned char)(tag >> 24), + (unsigned char)((tag >> 16) & 0xff), + (unsigned char)((tag >> 8) & 0xff), + (unsigned char)(tag & 0xff)); +} + +DEF_DUMP (LangSys) +{ + int i; + + HB_UNUSED(hb_type); + + DUMP_FUINT (LangSys, LookupOrderOffset); + DUMP_FUINT (LangSys, ReqFeatureIndex); + DUMP_FUINT (LangSys, FeatureCount); + + for (i=0; i < LangSys->FeatureCount; i++) + DUMP1("%d\n", LangSys->FeatureIndex[i]); +} + +DEF_DUMP (ScriptTable) +{ + int i; + + RECURSE (DefaultLangSys, LangSys, &ScriptTable->DefaultLangSys); + + DUMP_FUINT (ScriptTable, LangSysCount); + + for (i=0; i < ScriptTable->LangSysCount; i++) + { + do_indent (stream, indent); + fprintf (stream, ""); + Print_Tag (ScriptTable->LangSysRecord[i].LangSysTag, stream); + fprintf (stream, "\n"); + RECURSE_NUM (LangSys, i, LangSys, &ScriptTable->LangSysRecord[i].LangSys); + } +} + +DEF_DUMP (ScriptList) +{ + int i; + + DUMP_FUINT (ScriptList, ScriptCount); + + for (i=0; i < ScriptList->ScriptCount; i++) + { + do_indent (stream, indent); + fprintf (stream, ""); + Print_Tag (ScriptList->ScriptRecord[i].ScriptTag, stream); + fprintf (stream, "\n"); + RECURSE_NUM (Script, i, ScriptTable, &ScriptList->ScriptRecord[i].Script); + } +} + +DEF_DUMP (Feature) +{ + int i; + + HB_UNUSED(hb_type); + + DUMP_FUINT (Feature, FeatureParams); + DUMP_FUINT (Feature, LookupListCount); + + for (i=0; i < Feature->LookupListCount; i++) + DUMP1("%d\n", Feature->LookupListIndex[i]); +} + +DEF_DUMP (MarkRecord) +{ + HB_UNUSED(hb_type); + + DUMP_FUINT (MarkRecord, Class); + DUMP1("%d\n", MarkRecord->MarkAnchor.PosFormat ); +} + +DEF_DUMP (MarkArray) +{ + int i; + + DUMP_FUINT (MarkArray, MarkCount); + + for (i=0; i < MarkArray->MarkCount; i++) + RECURSE_NUM (MarkRecord, i, MarkRecord, &MarkArray->MarkRecord[i]); +} + +DEF_DUMP (FeatureList) +{ + int i; + + DUMP_FUINT (FeatureList, FeatureCount); + + for (i=0; i < FeatureList->FeatureCount; i++) + { + do_indent (stream, indent); + fprintf (stream, ""); + Print_Tag (FeatureList->FeatureRecord[i].FeatureTag, stream); + fprintf (stream, " \n", i); + RECURSE_NUM (Feature, i, Feature, &FeatureList->FeatureRecord[i].Feature); + } +} + +DEF_DUMP (Coverage) +{ + HB_UNUSED(hb_type); + + DUMP_FUINT (Coverage, CoverageFormat); + + if (Coverage->CoverageFormat == 1) + { + int i; + DUMP_FUINT (&Coverage->cf.cf1, GlyphCount); + + for (i = 0; i < Coverage->cf.cf1.GlyphCount; i++) + DUMP2("%#06x \n", + Coverage->cf.cf1.GlyphArray[i], i); + } + else + { + int i; + DUMP_FUINT (&Coverage->cf.cf2, RangeCount); + + for ( i = 0; i < Coverage->cf.cf2.RangeCount; i++ ) + DUMP3("%#06x - %#06x \n", + Coverage->cf.cf2.RangeRecord[i].Start, + Coverage->cf.cf2.RangeRecord[i].End, i); + } +} + +DEF_DUMP (ClassRangeRecord) +{ + HB_UNUSED(hb_type); + + DUMP_FGLYPH (ClassRangeRecord, Start); + DUMP_FGLYPH (ClassRangeRecord, End); + DUMP_FUINT (ClassRangeRecord, Class); +} + +DEF_DUMP (ClassDefinition) +{ + HB_UNUSED(hb_type); + + DUMP_FUINT( ClassDefinition, ClassFormat); + DUMP_FUINT( ClassDefinition, loaded); + + if (ClassDefinition->ClassFormat == 1) + { + int i; + HB_ClassDefFormat1 *ClassDefFormat1 = &ClassDefinition->cd.cd1; + DUMP("\n"); + DUMP_FUINT (ClassDefFormat1, StartGlyph ); + DUMP_FUINT (ClassDefFormat1, GlyphCount ); + for (i = 0; i < ClassDefFormat1->GlyphCount; i++) + DUMP2(" %d ", ClassDefFormat1->ClassValueArray[i], + ClassDefFormat1->StartGlyph+i ); + } + else if (ClassDefinition->ClassFormat == 2) + { + int i; + HB_ClassDefFormat2 *ClassDefFormat2 = &ClassDefinition->cd.cd2; + DUMP_FUINT (ClassDefFormat2, ClassRangeCount); + + for (i = 0; i < ClassDefFormat2->ClassRangeCount; i++) + RECURSE_NUM (ClassRangeRecord, i, ClassRangeRecord, &ClassDefFormat2->ClassRangeRecord[i]); + } + else + fprintf(stderr, "invalid class def table!!!\n"); +} + +DEF_DUMP (SubstLookupRecord) +{ + HB_UNUSED(hb_type); + + DUMP_FUINT (SubstLookupRecord, SequenceIndex); + DUMP_FUINT (SubstLookupRecord, LookupListIndex); +} + +DEF_DUMP (ChainSubClassRule) +{ + int i; + + DUMP_USHORT_ARRAY (ChainSubClassRule, Backtrack, ChainSubClassRule->BacktrackGlyphCount); + DUMP_USHORT_ARRAY (ChainSubClassRule, Input, ChainSubClassRule->InputGlyphCount - 1); + DUMP_USHORT_ARRAY (ChainSubClassRule, Lookahead, ChainSubClassRule->LookaheadGlyphCount); + + for (i = 0; i < ChainSubClassRule->SubstCount; i++) + RECURSE_NUM (SubstLookupRecord, i, SubstLookupRecord, &ChainSubClassRule->SubstLookupRecord[i]); + + indent--; +} + +DEF_DUMP (ChainSubClassSet) +{ + int i; + + DUMP_FUINT( ChainSubClassSet, ChainSubClassRuleCount ); + for (i = 0; i < ChainSubClassSet->ChainSubClassRuleCount; i++) + RECURSE_NUM (ChainSubClassRule, i, ChainSubClassRule, &ChainSubClassSet->ChainSubClassRule[i]); +} + +static void +Dump_GSUB_Lookup_Single (HB_SubTable *subtable, FILE *stream, int indent, HB_Type hb_type) +{ + HB_SingleSubst *SingleSubst = &subtable->st.gsub.single; + + DUMP_FUINT (SingleSubst, SubstFormat); + RECURSE (Coverage, Coverage, &SingleSubst->Coverage); + + if (SingleSubst->SubstFormat == 1) + { + DUMP_FINT (&SingleSubst->ssf.ssf1, DeltaGlyphID); + } + else + { + int i; + + DUMP_FINT (&SingleSubst->ssf.ssf2, GlyphCount); + for (i=0; i < SingleSubst->ssf.ssf2.GlyphCount; i++) + DUMP2("%#06x \n", SingleSubst->ssf.ssf2.Substitute[i], i); + } +} + +DEF_DUMP (Ligature) +{ + int i; + + HB_UNUSED(hb_type); + + DUMP_FGLYPH (Ligature, LigGlyph); + DUMP_FUINT (Ligature, ComponentCount); + + for (i=0; i < Ligature->ComponentCount - 1; i++) + DUMP1("%#06x\n", Ligature->Component[i]); +} + +DEF_DUMP (LigatureSet) +{ + int i; + + DUMP_FUINT (LigatureSet, LigatureCount); + + for (i=0; i < LigatureSet->LigatureCount; i++) + RECURSE_NUM (Ligature, i, Ligature, &LigatureSet->Ligature[i]); +} + +static void +Dump_GSUB_Lookup_Ligature (HB_SubTable *subtable, FILE *stream, int indent, HB_Type hb_type) +{ + int i; + HB_LigatureSubst *LigatureSubst = &subtable->st.gsub.ligature; + + DUMP_FUINT (LigatureSubst, SubstFormat); + RECURSE (Coverage, Coverage, &LigatureSubst->Coverage); + + DUMP_FUINT (LigatureSubst, LigatureSetCount); + + for (i=0; i < LigatureSubst->LigatureSetCount; i++) + RECURSE_NUM (LigatureSet, i, LigatureSet, &LigatureSubst->LigatureSet[i]); +} + +DEF_DUMP (ContextSubstFormat1) +{ + HB_UNUSED(hb_type); + HB_UNUSED(ContextSubstFormat1); + + + DUMP("\n"); +} + +DEF_DUMP (ContextSubstFormat2) +{ + DUMP_FUINT (ContextSubstFormat2, MaxContextLength); + RECURSE (Coverage, Coverage, &ContextSubstFormat2->Coverage); + RECURSE (ClassDefinition, ClassDefinition, &ContextSubstFormat2->ClassDef); +} + +DEF_DUMP (ContextSubstFormat3) +{ + HB_UNUSED(hb_type); + HB_UNUSED(ContextSubstFormat3); + + DUMP("\n"); +} + +static void +Dump_GSUB_Lookup_Context (HB_SubTable *subtable, FILE *stream, int indent, HB_Type hb_type) +{ + HB_ContextSubst *ContextSubst = &subtable->st.gsub.context; + + DUMP_FUINT (ContextSubst, SubstFormat); + switch( ContextSubst->SubstFormat ) + { + case 1: + Dump_ContextSubstFormat1 (&ContextSubst->csf.csf1, stream, indent+2, hb_type); + break; + case 2: + Dump_ContextSubstFormat2 (&ContextSubst->csf.csf2, stream, indent+2, hb_type); + break; + case 3: + Dump_ContextSubstFormat3 (&ContextSubst->csf.csf3, stream, indent+2, hb_type); + break; + default: + fprintf(stderr, "invalid subformat!!!!!\n"); + } +} + +DEF_DUMP (ChainContextSubstFormat1) +{ + HB_UNUSED(hb_type); + HB_UNUSED(ChainContextSubstFormat1); + + DUMP("\n"); +} + +DEF_DUMP (ChainContextSubstFormat2) +{ + int i; + + RECURSE (Coverage, Coverage, &ChainContextSubstFormat2->Coverage); + DUMP_FUINT (ChainContextSubstFormat2, MaxBacktrackLength); + RECURSE (ClassDefinition, ClassDefinition, &ChainContextSubstFormat2->BacktrackClassDef); + DUMP_FUINT (ChainContextSubstFormat2, MaxInputLength); + RECURSE (ClassDefinition, ClassDefinition, &ChainContextSubstFormat2->InputClassDef); + DUMP_FUINT (ChainContextSubstFormat2, MaxLookaheadLength); + RECURSE (ClassDefinition, ClassDefinition, &ChainContextSubstFormat2->LookaheadClassDef); + + DUMP_FUINT (ChainContextSubstFormat2, ChainSubClassSetCount); + for (i = 0; i < ChainContextSubstFormat2->ChainSubClassSetCount; i++) + RECURSE (ChainSubClassSet, ChainSubClassSet, &ChainContextSubstFormat2->ChainSubClassSet[i]); +} + +DEF_DUMP (ChainContextSubstFormat3) +{ + int i; + + DUMP_FUINT (ChainContextSubstFormat3, BacktrackGlyphCount); + for (i = 0; i < ChainContextSubstFormat3->BacktrackGlyphCount; i++) + RECURSE (BacktrackCoverage, Coverage, &ChainContextSubstFormat3->BacktrackCoverage[i]); + DUMP_FUINT (ChainContextSubstFormat3, InputGlyphCount); + for (i = 0; i < ChainContextSubstFormat3->InputGlyphCount; i++) + RECURSE (InputCoverage, Coverage, &ChainContextSubstFormat3->InputCoverage[i]); + DUMP_FUINT (ChainContextSubstFormat3, LookaheadGlyphCount); + for (i = 0; i < ChainContextSubstFormat3->LookaheadGlyphCount; i++) + RECURSE (LookaheadCoverage, Coverage, &ChainContextSubstFormat3->LookaheadCoverage[i]); + + for (i = 0; i < ChainContextSubstFormat3->SubstCount; i++) + RECURSE_NUM (SubstLookupRecord, i, SubstLookupRecord, &ChainContextSubstFormat3->SubstLookupRecord[i]); + +} + +static void +Dump_GSUB_Lookup_Chain (HB_SubTable *subtable, FILE *stream, int indent, HB_Type hb_type) +{ + HB_ChainContextSubst *chain = &subtable->st.gsub.chain; + + DUMP_FUINT (chain, SubstFormat); + switch (chain->SubstFormat) + { + case 1: + Dump_ChainContextSubstFormat1 (&chain->ccsf.ccsf1, stream, indent+2, hb_type); + break; + case 2: + Dump_ChainContextSubstFormat2 (&chain->ccsf.ccsf2, stream, indent+2, hb_type); + break; + case 3: + Dump_ChainContextSubstFormat3 (&chain->ccsf.ccsf3, stream, indent+2, hb_type); + break; + default: + fprintf(stderr, "invalid subformat!!!!!\n"); + } +} + +static void +Dump_Device (HB_Device *Device, FILE *stream, int indent, HB_Type hb_type) +{ + int i; + int bits; + int n_per; + unsigned int mask; + + HB_UNUSED(hb_type); + + DUMP_FUINT (Device, StartSize); + DUMP_FUINT (Device, EndSize); + DUMP_FUINT (Device, DeltaFormat); + switch (Device->DeltaFormat) + { + case 1: + bits = 2; + break; + case 2: + bits = 4; + break; + case 3: + bits = 8; + break; + default: + bits = 0; + break; + } + + DUMP (""); + if (!bits) + { + + fprintf(stderr, "invalid DeltaFormat!!!!!\n"); + } + else + { + n_per = 16 / bits; + mask = (1 << bits) - 1; + mask = mask << (16 - bits); + + for (i = Device->StartSize; i <= Device->EndSize ; i++) + { + HB_UShort val = Device->DeltaValue[i / n_per]; + HB_Short signed_val = ((val << ((i % n_per) * bits)) & mask); + dump (stream, indent, "%d", signed_val >> (16 - bits)); + if (i != Device->EndSize) + DUMP (", "); + } + } + DUMP ("\n"); +} + +static void +Dump_ValueRecord (HB_ValueRecord *ValueRecord, FILE *stream, int indent, HB_Type hb_type, HB_UShort value_format) +{ + if (value_format & HB_GPOS_FORMAT_HAVE_X_PLACEMENT) + DUMP_FINT (ValueRecord, XPlacement); + if (value_format & HB_GPOS_FORMAT_HAVE_Y_PLACEMENT) + DUMP_FINT (ValueRecord, YPlacement); + if (value_format & HB_GPOS_FORMAT_HAVE_X_ADVANCE) + DUMP_FINT (ValueRecord, XAdvance); + if (value_format & HB_GPOS_FORMAT_HAVE_Y_ADVANCE) + DUMP_FINT (ValueRecord, XAdvance); + if (value_format & HB_GPOS_FORMAT_HAVE_X_PLACEMENT_DEVICE) + RECURSE (Device, Device, &*ValueRecord->DeviceTables[VR_X_PLACEMENT_DEVICE]); + if (value_format & HB_GPOS_FORMAT_HAVE_Y_PLACEMENT_DEVICE) + RECURSE (Device, Device, &*ValueRecord->DeviceTables[VR_Y_PLACEMENT_DEVICE]); + if (value_format & HB_GPOS_FORMAT_HAVE_X_ADVANCE_DEVICE) + RECURSE (Device, Device, &*ValueRecord->DeviceTables[VR_X_ADVANCE_DEVICE]); + if (value_format & HB_GPOS_FORMAT_HAVE_Y_ADVANCE_DEVICE) + RECURSE (Device, Device, &*ValueRecord->DeviceTables[VR_Y_ADVANCE_DEVICE]); +#ifdef HB_SUPPORT_MULTIPLE_MASTER + if (value_format & HB_GPOS_FORMAT_HAVE_X_ID_PLACEMENT) + DUMP_FUINT (ValueRecord, XIdPlacement); + if (value_format & HB_GPOS_FORMAT_HAVE_Y_ID_PLACEMENT) + DUMP_FUINT (ValueRecord, YIdPlacement); + if (value_format & HB_GPOS_FORMAT_HAVE_X_ID_ADVANCE) + DUMP_FUINT (ValueRecord, XIdAdvance); + if (value_format & HB_GPOS_FORMAT_HAVE_Y_ID_ADVANCE) + DUMP_FUINT (ValueRecord, XIdAdvance); +#endif +} + +static void +Dump_GPOS_Lookup_Single (HB_SubTable *subtable, FILE *stream, int indent, HB_Type hb_type) +{ + HB_SinglePos *SinglePos = &subtable->st.gpos.single; + + DUMP_FUINT (SinglePos, PosFormat); + RECURSE (Coverage, Coverage, &SinglePos->Coverage); + + DUMP_FUINT (SinglePos, ValueFormat); + + if (SinglePos->PosFormat == 1) + { + DUMP_VALUE_RECORD (&SinglePos->spf.spf1.Value, SinglePos->ValueFormat); + } + else + { + int i; + + DUMP_FUINT (&SinglePos->spf.spf2, ValueCount); + for (i = 0; i < SinglePos->spf.spf2.ValueCount; i++) + DUMP_VALUE_RECORD (&SinglePos->spf.spf2.Value[i], SinglePos->ValueFormat); + } +} + +static void +Dump_PairValueRecord (HB_PairValueRecord *PairValueRecord, FILE *stream, int indent, HB_Type hb_type, HB_UShort ValueFormat1, HB_UShort ValueFormat2) +{ + DUMP_FUINT (PairValueRecord, SecondGlyph); + DUMP_VALUE_RECORD (&PairValueRecord->Value1, ValueFormat1); + DUMP_VALUE_RECORD (&PairValueRecord->Value2, ValueFormat2); +} + +static void +Dump_PairSet (HB_PairSet *PairSet, FILE *stream, int indent, HB_Type hb_type, HB_UShort ValueFormat1, HB_UShort ValueFormat2) +{ + int i; + DUMP_FUINT (PairSet, PairValueCount); + + for (i = 0; i < PairSet->PairValueCount; i++) + { + DUMP ("\n"); + Dump_PairValueRecord (&PairSet->PairValueRecord[i], stream, indent + 1, hb_type, ValueFormat1, ValueFormat2); + DUMP ("\n"); + } +} + +static void +Dump_GPOS_Lookup_Pair (HB_SubTable *subtable, FILE *stream, int indent, HB_Type hb_type) +{ + HB_PairPos *PairPos = &subtable->st.gpos.pair; + + DUMP_FUINT (PairPos, PosFormat); + RECURSE (Coverage, Coverage, &PairPos->Coverage); + + DUMP_FUINT (PairPos, ValueFormat1); + DUMP_FUINT (PairPos, ValueFormat2); + + if (PairPos->PosFormat == 1) + { + int i; + + DUMP_FUINT (&PairPos->ppf.ppf1, PairSetCount); + for (i = 0; i < PairPos->ppf.ppf1.PairSetCount; i++) + { + DUMP ("\n"); + Dump_PairSet (&PairPos->ppf.ppf1.PairSet[i], stream, indent + 1, hb_type, PairPos->ValueFormat1, PairPos->ValueFormat2); + DUMP ("\n"); + } + } + else + { + } +} + +static void +Dump_GPOS_Lookup_Markbase (HB_SubTable *subtable, FILE *stream, int indent, HB_Type hb_type) +{ + int i; + HB_MarkBasePos *markbase = &subtable->st.gpos.markbase; + + DUMP_FUINT (markbase, PosFormat); + RECURSE (Coverage, Coverage, &markbase->MarkCoverage); + RECURSE (Coverage, Coverage, &markbase->BaseCoverage); + DUMP_FUINT (markbase, ClassCount); + RECURSE (MarkArray, MarkArray, &markbase->MarkArray); + + DUMP ("\n"); + indent++; + + DUMP_FUINT (&markbase->BaseArray, BaseCount); + for (i = 0; i < markbase->BaseArray.BaseCount; i++) + { + int j; + HB_BaseRecord *r = &markbase->BaseArray.BaseRecord[i]; + DUMP1 (" \n", i); + for (j = 0; j < markbase->ClassCount; j++) + DUMP1 (" %d\n", r->BaseAnchor->PosFormat); + DUMP ("\n"); + } + + indent--; + DUMP ("\n"); +} + +DEF_DUMP (Lookup) +{ + int i; + const char *lookup_name; + void (*lookup_func) (HB_SubTable *subtable, FILE *stream, int indent, HB_Type hb_type) = NULL; + + if (hb_type == HB_Type_GSUB) + { + switch (Lookup->LookupType) + { + case HB_GSUB_LOOKUP_SINGLE: + lookup_name = "SINGLE"; + lookup_func = Dump_GSUB_Lookup_Single; + break; + case HB_GSUB_LOOKUP_MULTIPLE: + lookup_name = "MULTIPLE"; + break; + case HB_GSUB_LOOKUP_ALTERNATE: + lookup_name = "ALTERNATE"; + break; + case HB_GSUB_LOOKUP_LIGATURE: + lookup_name = "LIGATURE"; + lookup_func = Dump_GSUB_Lookup_Ligature; + break; + case HB_GSUB_LOOKUP_CONTEXT: + lookup_name = "CONTEXT"; + lookup_func = Dump_GSUB_Lookup_Context; + break; + case HB_GSUB_LOOKUP_CHAIN: + lookup_name = "CHAIN"; + lookup_func = Dump_GSUB_Lookup_Chain; + break; + default: + lookup_name = "(unknown)"; + lookup_func = NULL; + break; + } + } + else + { + switch (Lookup->LookupType) + { + case HB_GPOS_LOOKUP_SINGLE: + lookup_name = "SINGLE"; + lookup_func = Dump_GPOS_Lookup_Single; + break; + case HB_GPOS_LOOKUP_PAIR: + lookup_name = "PAIR"; + lookup_func = Dump_GPOS_Lookup_Pair; + break; + case HB_GPOS_LOOKUP_CURSIVE: + lookup_name = "CURSIVE"; + break; + case HB_GPOS_LOOKUP_MARKBASE: + lookup_name = "MARKBASE"; + lookup_func = Dump_GPOS_Lookup_Markbase; + break; + case HB_GPOS_LOOKUP_MARKLIG: + lookup_name = "MARKLIG"; + break; + case HB_GPOS_LOOKUP_MARKMARK: + lookup_name = "MARKMARK"; + break; + case HB_GPOS_LOOKUP_CONTEXT: + lookup_name = "CONTEXT"; + break; + case HB_GPOS_LOOKUP_CHAIN: + lookup_name = "CHAIN"; + break; + default: + lookup_name = "(unknown)"; + lookup_func = NULL; + break; + } + } + + DUMP2("%s \n", lookup_name, Lookup->LookupType); + DUMP1("%#06x\n", Lookup->LookupFlag); + + for (i=0; i < Lookup->SubTableCount; i++) + { + DUMP ("\n"); + if (lookup_func) + (*lookup_func) (&Lookup->SubTable[i], stream, indent + 1, hb_type); + DUMP ("\n"); + } +} + +DEF_DUMP (LookupList) +{ + int i; + + DUMP_FUINT (LookupList, LookupCount); + + for (i=0; i < LookupList->LookupCount; i++) + RECURSE_NUM (Lookup, i, Lookup, &LookupList->Lookup[i]); +} + +void +HB_Dump_GSUB_Table (HB_GSUB gsub, FILE *stream) +{ + int indent = 1; + HB_Type hb_type = HB_Type_GSUB; + + do_indent (stream, indent); + fprintf(stream, "\n"); + RECURSE (ScriptList, ScriptList, &gsub->ScriptList); + RECURSE (FeatureList, FeatureList, &gsub->FeatureList); + RECURSE (LookupList, LookupList, &gsub->LookupList); +} + +void +HB_Dump_GPOS_Table (HB_GPOS gpos, FILE *stream) +{ + int indent = 1; + HB_Type hb_type = HB_Type_GPOS; + + do_indent (stream, indent); + fprintf(stream, "\n"); + RECURSE (ScriptList, ScriptList, &gpos->ScriptList); + RECURSE (FeatureList, FeatureList, &gpos->FeatureList); + RECURSE (LookupList, LookupList, &gpos->LookupList); +} diff --git a/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-dump.h b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-dump.h new file mode 100644 index 0000000..ea4a62b --- /dev/null +++ b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-dump.h @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2000, 2007 Red Hat, Inc. + * + * This is part of HarfBuzz, an OpenType Layout engine library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + * + * Red Hat Author(s): Owen Taylor, Behdad Esfahbod + */ + +#ifndef HARFBUZZ_DUMP_H +#define HARFBUZZ_DUMP_H + +#include +#include "harfbuzz-gsub.h" +#include "harfbuzz-gpos.h" + +HB_BEGIN_HEADER + +void HB_Dump_GSUB_Table (HB_GSUB gsub, FILE *stream); +void HB_Dump_GPOS_Table (HB_GPOS gpos, FILE *stream); + +HB_END_HEADER + +#endif /* HARFBUZZ_DUMP_H */ diff --git a/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-external.h b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-external.h new file mode 100644 index 0000000..7644f0d --- /dev/null +++ b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-external.h @@ -0,0 +1,153 @@ +/* + * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) + * + * This is part of HarfBuzz, an OpenType Layout engine library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#ifndef HARFBUZZ_EXTERNAL_H +#define HARFBUZZ_EXTERNAL_H + +#include "harfbuzz-global.h" + +HB_BEGIN_HEADER + +/* This header contains some methods that are not part of + Harfbuzz itself, but referenced by it. + They need to be provided by the application/library +*/ + + +/* + see http://www.unicode.org/reports/tr14/tr14-19.html + we don't use the XX, AI and CB properties and map them to AL instead. + as we don't support any EBDIC based OS'es, NL is ignored and mapped to AL as well. +*/ +typedef enum { + HB_LineBreak_OP, HB_LineBreak_CL, HB_LineBreak_QU, HB_LineBreak_GL, HB_LineBreak_NS, + HB_LineBreak_EX, HB_LineBreak_SY, HB_LineBreak_IS, HB_LineBreak_PR, HB_LineBreak_PO, + HB_LineBreak_NU, HB_LineBreak_AL, HB_LineBreak_ID, HB_LineBreak_IN, HB_LineBreak_HY, + HB_LineBreak_BA, HB_LineBreak_BB, HB_LineBreak_B2, HB_LineBreak_ZW, HB_LineBreak_CM, + HB_LineBreak_WJ, HB_LineBreak_H2, HB_LineBreak_H3, HB_LineBreak_JL, HB_LineBreak_JV, + HB_LineBreak_JT, HB_LineBreak_SA, HB_LineBreak_SG, + HB_LineBreak_SP, HB_LineBreak_CR, HB_LineBreak_LF, HB_LineBreak_BK +} HB_LineBreakClass; + +typedef enum +{ + HB_NoCategory, + + HB_Mark_NonSpacing, /* Mn */ + HB_Mark_SpacingCombining, /* Mc */ + HB_Mark_Enclosing, /* Me */ + + HB_Number_DecimalDigit, /* Nd */ + HB_Number_Letter, /* Nl */ + HB_Number_Other, /* No */ + + HB_Separator_Space, /* Zs */ + HB_Separator_Line, /* Zl */ + HB_Separator_Paragraph, /* Zp */ + + HB_Other_Control, /* Cc */ + HB_Other_Format, /* Cf */ + HB_Other_Surrogate, /* Cs */ + HB_Other_PrivateUse, /* Co */ + HB_Other_NotAssigned, /* Cn */ + + HB_Letter_Uppercase, /* Lu */ + HB_Letter_Lowercase, /* Ll */ + HB_Letter_Titlecase, /* Lt */ + HB_Letter_Modifier, /* Lm */ + HB_Letter_Other, /* Lo */ + + HB_Punctuation_Connector, /* Pc */ + HB_Punctuation_Dash, /* Pd */ + HB_Punctuation_Open, /* Ps */ + HB_Punctuation_Close, /* Pe */ + HB_Punctuation_InitialQuote, /* Pi */ + HB_Punctuation_FinalQuote, /* Pf */ + HB_Punctuation_Other, /* Po */ + + HB_Symbol_Math, /* Sm */ + HB_Symbol_Currency, /* Sc */ + HB_Symbol_Modifier, /* Sk */ + HB_Symbol_Other /* So */ +} HB_CharCategory; + +typedef enum +{ + HB_Grapheme_Other, + HB_Grapheme_CR, + HB_Grapheme_LF, + HB_Grapheme_Control, + HB_Grapheme_Extend, + HB_Grapheme_L, + HB_Grapheme_V, + HB_Grapheme_T, + HB_Grapheme_LV, + HB_Grapheme_LVT +} HB_GraphemeClass; + + +typedef enum +{ + HB_Word_Other, + HB_Word_Format, + HB_Word_Katakana, + HB_Word_ALetter, + HB_Word_MidLetter, + HB_Word_MidNum, + HB_Word_Numeric, + HB_Word_ExtendNumLet +} HB_WordClass; + + +typedef enum +{ + HB_Sentence_Other, + HB_Sentence_Sep, + HB_Sentence_Format, + HB_Sentence_Sp, + HB_Sentence_Lower, + HB_Sentence_Upper, + HB_Sentence_OLetter, + HB_Sentence_Numeric, + HB_Sentence_ATerm, + HB_Sentence_STerm, + HB_Sentence_Close +} HB_SentenceClass; + +HB_GraphemeClass HB_GetGraphemeClass(HB_UChar32 ch); +HB_WordClass HB_GetWordClass(HB_UChar32 ch); +HB_SentenceClass HB_GetSentenceClass(HB_UChar32 ch); +HB_LineBreakClass HB_GetLineBreakClass(HB_UChar32 ch); + +void HB_GetGraphemeAndLineBreakClass(HB_UChar32 ch, HB_GraphemeClass *grapheme, HB_LineBreakClass *lineBreak); +void HB_GetUnicodeCharProperties(HB_UChar32 ch, HB_CharCategory *category, int *combiningClass); +HB_CharCategory HB_GetUnicodeCharCategory(HB_UChar32 ch); +int HB_GetUnicodeCharCombiningClass(HB_UChar32 ch); +HB_UChar16 HB_GetMirroredChar(HB_UChar16 ch); + +void *HB_Library_Resolve(const char *library, int version, const char *symbol); + +HB_END_HEADER + +#endif diff --git a/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-gdef-private.h b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-gdef-private.h new file mode 100644 index 0000000..2a6d958 --- /dev/null +++ b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-gdef-private.h @@ -0,0 +1,135 @@ +/* + * Copyright (C) 1998-2004 David Turner and Werner Lemberg + * Copyright (C) 2006 Behdad Esfahbod + * + * This is part of HarfBuzz, an OpenType Layout engine library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#ifndef HARFBUZZ_GDEF_PRIVATE_H +#define HARFBUZZ_GDEF_PRIVATE_H + +#include "harfbuzz-impl.h" +#include "harfbuzz-stream-private.h" +#include "harfbuzz-buffer-private.h" +#include "harfbuzz-gdef.h" + +HB_BEGIN_HEADER + + +#ifdef HB_USE_PACKED_STRUCTS +#pragma pack(push, 1) +#endif + +/* Attachment related structures */ + +struct HB_AttachPoint_ +{ + HB_UShort* PointIndex; /* array of contour points */ + HB_UShort PointCount; /* size of the PointIndex array */ +}; + +/* Ligature Caret related structures */ + +struct HB_CaretValueFormat1_ +{ + HB_Short Coordinate; /* x or y value (in design units) */ +}; + +typedef struct HB_CaretValueFormat1_ HB_CaretValueFormat1; + + +struct HB_CaretValueFormat2_ +{ + HB_UShort CaretValuePoint; /* contour point index on glyph */ +}; + +typedef struct HB_CaretValueFormat2_ HB_CaretValueFormat2; + + +struct HB_CaretValueFormat3_ +{ + HB_Device* Device; /* Device table for x or y value */ + HB_Short Coordinate; /* x or y value (in design units) */ +}; + +typedef struct HB_CaretValueFormat3_ HB_CaretValueFormat3; + + +#ifdef HB_SUPPORT_MULTIPLE_MASTER +struct HB_CaretValueFormat4_ +{ + HB_UShort IdCaretValue; /* metric ID */ +}; + +typedef struct HB_CaretValueFormat4_ HB_CaretValueFormat4; +#endif + + +struct HB_CaretValue_ +{ + union + { + HB_CaretValueFormat1 cvf1; + HB_CaretValueFormat2 cvf2; + HB_CaretValueFormat3 cvf3; +#ifdef HB_SUPPORT_MULTIPLE_MASTER + HB_CaretValueFormat4 cvf4; +#endif + } cvf; + + HB_Byte CaretValueFormat; /* 1, 2, 3, or 4 */ +}; + +typedef struct HB_CaretValue_ HB_CaretValue; + + +struct HB_LigGlyph_ +{ + HB_CaretValue* CaretValue; /* array of caret values */ + HB_UShort CaretCount; /* number of caret values */ + HB_Bool loaded; +}; + + +HB_INTERNAL HB_Error +_HB_GDEF_Add_Glyph_Property( HB_GDEFHeader* gdef, + HB_UShort glyphID, + HB_UShort property ); + +HB_INTERNAL HB_Error +_HB_GDEF_Check_Property( HB_GDEFHeader* gdef, + HB_GlyphItem item, + HB_UShort flags, + HB_UShort* property ); + +HB_INTERNAL HB_Error +_HB_GDEF_LoadMarkAttachClassDef_From_LookupFlags( HB_GDEFHeader* gdef, + HB_Stream input, + HB_Lookup* lo, + HB_UShort num_lookups ); + +#ifdef HB_USE_PACKED_STRUCTS +#pragma pack(pop) +#endif + +HB_END_HEADER + +#endif /* HARFBUZZ_GDEF_PRIVATE_H */ diff --git a/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-gdef.c b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-gdef.c new file mode 100644 index 0000000..966b167 --- /dev/null +++ b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-gdef.c @@ -0,0 +1,1163 @@ +/* + * Copyright (C) 1998-2004 David Turner and Werner Lemberg + * Copyright (C) 2006 Behdad Esfahbod + * + * This is part of HarfBuzz, an OpenType Layout engine library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#include "harfbuzz-impl.h" +#include "harfbuzz-gdef-private.h" +#include "harfbuzz-open-private.h" + +static HB_Error Load_AttachList( HB_AttachList* al, + HB_Stream stream ); +static HB_Error Load_LigCaretList( HB_LigCaretList* lcl, + HB_Stream stream ); + +static void Free_AttachList( HB_AttachList* al); +static void Free_LigCaretList( HB_LigCaretList* lcl); + +static void Free_NewGlyphClasses( HB_GDEFHeader* gdef); + + + +/* GDEF glyph classes */ + +#define UNCLASSIFIED_GLYPH 0 +#define SIMPLE_GLYPH 1 +#define LIGATURE_GLYPH 2 +#define MARK_GLYPH 3 +#define COMPONENT_GLYPH 4 + + + + + + +HB_Error HB_New_GDEF_Table( HB_GDEFHeader** retptr ) +{ + HB_Error error; + + HB_GDEFHeader* gdef; + + if ( !retptr ) + return ERR(HB_Err_Invalid_Argument); + + if ( ALLOC( gdef, sizeof( *gdef ) ) ) + return error; + + gdef->GlyphClassDef.loaded = FALSE; + gdef->AttachList.loaded = FALSE; + gdef->LigCaretList.loaded = FALSE; + gdef->MarkAttachClassDef_offset = 0; + gdef->MarkAttachClassDef.loaded = FALSE; + + gdef->LastGlyph = 0; + gdef->NewGlyphClasses = NULL; + + *retptr = gdef; + + return HB_Err_Ok; +} + + +HB_Error HB_Load_GDEF_Table( HB_Stream stream, + HB_GDEFHeader** retptr ) +{ + HB_Error error; + HB_UInt cur_offset, new_offset, base_offset; + + HB_GDEFHeader* gdef; + + + if ( !retptr ) + return ERR(HB_Err_Invalid_Argument); + + if ( GOTO_Table( TTAG_GDEF ) ) + return error; + + if (( error = HB_New_GDEF_Table ( &gdef ) )) + return error; + + base_offset = FILE_Pos(); + + /* skip version */ + + if ( FILE_Seek( base_offset + 4L ) || + ACCESS_Frame( 2L ) ) + goto Fail0; + + new_offset = GET_UShort(); + + FORGET_Frame(); + + /* all GDEF subtables are optional */ + + if ( new_offset ) + { + new_offset += base_offset; + + /* only classes 1-4 are allowed here */ + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = _HB_OPEN_Load_ClassDefinition( &gdef->GlyphClassDef, 5, + stream ) ) != HB_Err_Ok ) + goto Fail0; + (void)FILE_Seek( cur_offset ); + } + + if ( ACCESS_Frame( 2L ) ) + goto Fail1; + + new_offset = GET_UShort(); + + FORGET_Frame(); + + if ( new_offset ) + { + new_offset += base_offset; + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = Load_AttachList( &gdef->AttachList, + stream ) ) != HB_Err_Ok ) + goto Fail1; + (void)FILE_Seek( cur_offset ); + } + + if ( ACCESS_Frame( 2L ) ) + goto Fail2; + + new_offset = GET_UShort(); + + FORGET_Frame(); + + if ( new_offset ) + { + new_offset += base_offset; + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = Load_LigCaretList( &gdef->LigCaretList, + stream ) ) != HB_Err_Ok ) + goto Fail2; + (void)FILE_Seek( cur_offset ); + } + + /* OpenType 1.2 has introduced the `MarkAttachClassDef' field. We + first have to scan the LookupFlag values to find out whether we + must load it or not. Here we only store the offset of the table. */ + + if ( ACCESS_Frame( 2L ) ) + goto Fail3; + + new_offset = GET_UShort(); + + FORGET_Frame(); + + if ( new_offset ) + gdef->MarkAttachClassDef_offset = new_offset + base_offset; + else + gdef->MarkAttachClassDef_offset = 0; + + *retptr = gdef; + + return HB_Err_Ok; + +Fail3: + Free_LigCaretList( &gdef->LigCaretList ); + +Fail2: + Free_AttachList( &gdef->AttachList ); + +Fail1: + _HB_OPEN_Free_ClassDefinition( &gdef->GlyphClassDef ); + +Fail0: + FREE( gdef ); + + return error; +} + + +HB_Error HB_Done_GDEF_Table ( HB_GDEFHeader* gdef ) +{ + Free_LigCaretList( &gdef->LigCaretList ); + Free_AttachList( &gdef->AttachList ); + _HB_OPEN_Free_ClassDefinition( &gdef->GlyphClassDef ); + _HB_OPEN_Free_ClassDefinition( &gdef->MarkAttachClassDef ); + + Free_NewGlyphClasses( gdef ); + + FREE( gdef ); + + return HB_Err_Ok; +} + + + + +/******************************* + * AttachList related functions + *******************************/ + + +/* AttachPoint */ + +static HB_Error Load_AttachPoint( HB_AttachPoint* ap, + HB_Stream stream ) +{ + HB_Error error; + + HB_UShort n, count; + HB_UShort* pi; + + + if ( ACCESS_Frame( 2L ) ) + return error; + + count = ap->PointCount = GET_UShort(); + + FORGET_Frame(); + + ap->PointIndex = NULL; + + if ( count ) + { + if ( ALLOC_ARRAY( ap->PointIndex, count, HB_UShort ) ) + return error; + + pi = ap->PointIndex; + + if ( ACCESS_Frame( count * 2L ) ) + { + FREE( pi ); + return error; + } + + for ( n = 0; n < count; n++ ) + pi[n] = GET_UShort(); + + FORGET_Frame(); + } + + return HB_Err_Ok; +} + + +static void Free_AttachPoint( HB_AttachPoint* ap ) +{ + FREE( ap->PointIndex ); +} + + +/* AttachList */ + +static HB_Error Load_AttachList( HB_AttachList* al, + HB_Stream stream ) +{ + HB_Error error; + + HB_UShort n, m, count; + HB_UInt cur_offset, new_offset, base_offset; + + HB_AttachPoint* ap; + + + base_offset = FILE_Pos(); + + if ( ACCESS_Frame( 2L ) ) + return error; + + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = _HB_OPEN_Load_Coverage( &al->Coverage, stream ) ) != HB_Err_Ok ) + return error; + (void)FILE_Seek( cur_offset ); + + if ( ACCESS_Frame( 2L ) ) + goto Fail2; + + count = al->GlyphCount = GET_UShort(); + + FORGET_Frame(); + + al->AttachPoint = NULL; + + if ( ALLOC_ARRAY( al->AttachPoint, count, HB_AttachPoint ) ) + goto Fail2; + + ap = al->AttachPoint; + + for ( n = 0; n < count; n++ ) + { + if ( ACCESS_Frame( 2L ) ) + goto Fail1; + + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = Load_AttachPoint( &ap[n], stream ) ) != HB_Err_Ok ) + goto Fail1; + (void)FILE_Seek( cur_offset ); + } + + al->loaded = TRUE; + + return HB_Err_Ok; + +Fail1: + for ( m = 0; m < n; m++ ) + Free_AttachPoint( &ap[m] ); + + FREE( ap ); + +Fail2: + _HB_OPEN_Free_Coverage( &al->Coverage ); + return error; +} + + +static void Free_AttachList( HB_AttachList* al) +{ + HB_UShort n, count; + + HB_AttachPoint* ap; + + + if ( !al->loaded ) + return; + + if ( al->AttachPoint ) + { + count = al->GlyphCount; + ap = al->AttachPoint; + + for ( n = 0; n < count; n++ ) + Free_AttachPoint( &ap[n] ); + + FREE( ap ); + } + + _HB_OPEN_Free_Coverage( &al->Coverage ); +} + + + +/********************************* + * LigCaretList related functions + *********************************/ + + +/* CaretValueFormat1 */ +/* CaretValueFormat2 */ +/* CaretValueFormat3 */ +/* CaretValueFormat4 */ + +static HB_Error Load_CaretValue( HB_CaretValue* cv, + HB_Stream stream ) +{ + HB_Error error; + + HB_UInt cur_offset, new_offset, base_offset; + + + base_offset = FILE_Pos(); + + if ( ACCESS_Frame( 2L ) ) + return error; + + cv->CaretValueFormat = GET_UShort(); + + FORGET_Frame(); + + switch ( cv->CaretValueFormat ) + { + case 1: + if ( ACCESS_Frame( 2L ) ) + return error; + + cv->cvf.cvf1.Coordinate = GET_Short(); + + FORGET_Frame(); + + break; + + case 2: + if ( ACCESS_Frame( 2L ) ) + return error; + + cv->cvf.cvf2.CaretValuePoint = GET_UShort(); + + FORGET_Frame(); + + break; + + case 3: + if ( ACCESS_Frame( 4L ) ) + return error; + + cv->cvf.cvf3.Coordinate = GET_Short(); + + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = _HB_OPEN_Load_Device( &cv->cvf.cvf3.Device, + stream ) ) != HB_Err_Ok ) + return error; + (void)FILE_Seek( cur_offset ); + + break; + + case 4: + if ( ACCESS_Frame( 2L ) ) + return error; + +#ifdef HB_SUPPORT_MULTIPLE_MASTER + cv->cvf.cvf4.IdCaretValue = GET_UShort(); +#else + (void) GET_UShort(); +#endif + + FORGET_Frame(); + break; + + default: + return ERR(HB_Err_Invalid_SubTable_Format); + } + + return HB_Err_Ok; +} + + +static void Free_CaretValue( HB_CaretValue* cv) +{ + if ( cv->CaretValueFormat == 3 ) + _HB_OPEN_Free_Device( cv->cvf.cvf3.Device ); +} + + +/* LigGlyph */ + +static HB_Error Load_LigGlyph( HB_LigGlyph* lg, + HB_Stream stream ) +{ + HB_Error error; + + HB_UShort n, m, count; + HB_UInt cur_offset, new_offset, base_offset; + + HB_CaretValue* cv; + + + base_offset = FILE_Pos(); + + if ( ACCESS_Frame( 2L ) ) + return error; + + count = lg->CaretCount = GET_UShort(); + + FORGET_Frame(); + + lg->CaretValue = NULL; + + if ( ALLOC_ARRAY( lg->CaretValue, count, HB_CaretValue ) ) + return error; + + cv = lg->CaretValue; + + for ( n = 0; n < count; n++ ) + { + if ( ACCESS_Frame( 2L ) ) + goto Fail; + + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = Load_CaretValue( &cv[n], stream ) ) != HB_Err_Ok ) + goto Fail; + (void)FILE_Seek( cur_offset ); + } + + return HB_Err_Ok; + +Fail: + for ( m = 0; m < n; m++ ) + Free_CaretValue( &cv[m] ); + + FREE( cv ); + return error; +} + + +static void Free_LigGlyph( HB_LigGlyph* lg) +{ + HB_UShort n, count; + + HB_CaretValue* cv; + + + if ( lg->CaretValue ) + { + count = lg->CaretCount; + cv = lg->CaretValue; + + for ( n = 0; n < count; n++ ) + Free_CaretValue( &cv[n] ); + + FREE( cv ); + } +} + + +/* LigCaretList */ + +static HB_Error Load_LigCaretList( HB_LigCaretList* lcl, + HB_Stream stream ) +{ + HB_Error error; + + HB_UShort m, n, count; + HB_UInt cur_offset, new_offset, base_offset; + + HB_LigGlyph* lg; + + + base_offset = FILE_Pos(); + + if ( ACCESS_Frame( 2L ) ) + return error; + + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = _HB_OPEN_Load_Coverage( &lcl->Coverage, stream ) ) != HB_Err_Ok ) + return error; + (void)FILE_Seek( cur_offset ); + + if ( ACCESS_Frame( 2L ) ) + goto Fail2; + + count = lcl->LigGlyphCount = GET_UShort(); + + FORGET_Frame(); + + lcl->LigGlyph = NULL; + + if ( ALLOC_ARRAY( lcl->LigGlyph, count, HB_LigGlyph ) ) + goto Fail2; + + lg = lcl->LigGlyph; + + for ( n = 0; n < count; n++ ) + { + if ( ACCESS_Frame( 2L ) ) + goto Fail1; + + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = Load_LigGlyph( &lg[n], stream ) ) != HB_Err_Ok ) + goto Fail1; + (void)FILE_Seek( cur_offset ); + } + + lcl->loaded = TRUE; + + return HB_Err_Ok; + +Fail1: + for ( m = 0; m < n; m++ ) + Free_LigGlyph( &lg[m] ); + + FREE( lg ); + +Fail2: + _HB_OPEN_Free_Coverage( &lcl->Coverage ); + return error; +} + + +static void Free_LigCaretList( HB_LigCaretList* lcl ) +{ + HB_UShort n, count; + + HB_LigGlyph* lg; + + + if ( !lcl->loaded ) + return; + + if ( lcl->LigGlyph ) + { + count = lcl->LigGlyphCount; + lg = lcl->LigGlyph; + + for ( n = 0; n < count; n++ ) + Free_LigGlyph( &lg[n] ); + + FREE( lg ); + } + + _HB_OPEN_Free_Coverage( &lcl->Coverage ); +} + + + +/*********** + * GDEF API + ***********/ + + +static HB_UShort Get_New_Class( HB_GDEFHeader* gdef, + HB_UShort glyphID, + HB_UShort index ) +{ + HB_UShort glyph_index, array_index, count; + HB_UShort byte, bits; + + HB_ClassRangeRecord* gcrr; + HB_UShort** ngc; + + + if ( glyphID >= gdef->LastGlyph ) + return 0; + + count = gdef->GlyphClassDef.cd.cd2.ClassRangeCount; + gcrr = gdef->GlyphClassDef.cd.cd2.ClassRangeRecord; + ngc = gdef->NewGlyphClasses; + + if ( index < count && glyphID < gcrr[index].Start ) + { + array_index = index; + if ( index == 0 ) + glyph_index = glyphID; + else + glyph_index = glyphID - gcrr[index - 1].End - 1; + } + else + { + array_index = index + 1; + glyph_index = glyphID - gcrr[index].End - 1; + } + + byte = ngc[array_index][glyph_index / 4]; + bits = byte >> ( 16 - ( glyph_index % 4 + 1 ) * 4 ); + + return bits & 0x000F; +} + + + +HB_Error HB_GDEF_Get_Glyph_Property( HB_GDEFHeader* gdef, + HB_UShort glyphID, + HB_UShort* property ) +{ + HB_UShort class = 0, index = 0; /* shut compiler up */ + + HB_Error error; + + + if ( !gdef || !property ) + return ERR(HB_Err_Invalid_Argument); + + /* first, we check for mark attach classes */ + + if ( gdef->MarkAttachClassDef.loaded ) + { + error = _HB_OPEN_Get_Class( &gdef->MarkAttachClassDef, glyphID, &class, &index ); + if ( error && error != HB_Err_Not_Covered ) + return error; + if ( !error ) + { + *property = class << 8; + return HB_Err_Ok; + } + } + + error = _HB_OPEN_Get_Class( &gdef->GlyphClassDef, glyphID, &class, &index ); + if ( error && error != HB_Err_Not_Covered ) + return error; + + /* if we have a constructed class table, check whether additional + values have been assigned */ + + if ( error == HB_Err_Not_Covered && gdef->NewGlyphClasses ) + class = Get_New_Class( gdef, glyphID, index ); + + switch ( class ) + { + default: + case UNCLASSIFIED_GLYPH: + *property = 0; + break; + + case SIMPLE_GLYPH: + *property = HB_GDEF_BASE_GLYPH; + break; + + case LIGATURE_GLYPH: + *property = HB_GDEF_LIGATURE; + break; + + case MARK_GLYPH: + *property = HB_GDEF_MARK; + break; + + case COMPONENT_GLYPH: + *property = HB_GDEF_COMPONENT; + break; + } + + return HB_Err_Ok; +} + + +static HB_Error Make_ClassRange( HB_ClassDefinition* cd, + HB_UShort start, + HB_UShort end, + HB_UShort class ) +{ + HB_Error error; + HB_UShort index; + + HB_ClassDefFormat2* cdf2; + HB_ClassRangeRecord* crr; + + + cdf2 = &cd->cd.cd2; + + if ( REALLOC_ARRAY( cdf2->ClassRangeRecord, + cdf2->ClassRangeCount + 1 , + HB_ClassRangeRecord ) ) + return error; + + cdf2->ClassRangeCount++; + + crr = cdf2->ClassRangeRecord; + index = cdf2->ClassRangeCount - 1; + + crr[index].Start = start; + crr[index].End = end; + crr[index].Class = class; + + return HB_Err_Ok; +} + + + +HB_Error HB_GDEF_Build_ClassDefinition( HB_GDEFHeader* gdef, + HB_UShort num_glyphs, + HB_UShort glyph_count, + HB_UShort* glyph_array, + HB_UShort* class_array ) +{ + HB_UShort start, curr_glyph, curr_class; + HB_UShort n, m, count; + HB_Error error; + + HB_ClassDefinition* gcd; + HB_ClassRangeRecord* gcrr; + HB_UShort** ngc; + + + if ( !gdef || !glyph_array || !class_array ) + return ERR(HB_Err_Invalid_Argument); + + gcd = &gdef->GlyphClassDef; + + /* We build a format 2 table */ + + gcd->ClassFormat = 2; + + gcd->cd.cd2.ClassRangeCount = 0; + gcd->cd.cd2.ClassRangeRecord = NULL; + + start = glyph_array[0]; + curr_class = class_array[0]; + curr_glyph = start; + + if ( curr_class >= 5 ) + { + error = ERR(HB_Err_Invalid_Argument); + goto Fail4; + } + + glyph_count--; + + for ( n = 0; n < glyph_count + 1; n++ ) + { + if ( curr_glyph == glyph_array[n] && curr_class == class_array[n] ) + { + if ( n == glyph_count ) + { + if ( ( error = Make_ClassRange( gcd, start, + curr_glyph, + curr_class) ) != HB_Err_Ok ) + goto Fail3; + } + else + { + if ( curr_glyph == 0xFFFF ) + { + error = ERR(HB_Err_Invalid_Argument); + goto Fail3; + } + else + curr_glyph++; + } + } + else + { + if ( ( error = Make_ClassRange( gcd, start, + curr_glyph - 1, + curr_class) ) != HB_Err_Ok ) + goto Fail3; + + if ( curr_glyph > glyph_array[n] ) + { + error = ERR(HB_Err_Invalid_Argument); + goto Fail3; + } + + start = glyph_array[n]; + curr_class = class_array[n]; + curr_glyph = start; + + if ( curr_class >= 5 ) + { + error = ERR(HB_Err_Invalid_Argument); + goto Fail3; + } + + if ( n == glyph_count ) + { + if ( ( error = Make_ClassRange( gcd, start, + curr_glyph, + curr_class) ) != HB_Err_Ok ) + goto Fail3; + } + else + { + if ( curr_glyph == 0xFFFF ) + { + error = ERR(HB_Err_Invalid_Argument); + goto Fail3; + } + else + curr_glyph++; + } + } + } + + /* now prepare the arrays for class values assigned during the lookup + process */ + + if ( ALLOC_ARRAY( gdef->NewGlyphClasses, + gcd->cd.cd2.ClassRangeCount + 1, HB_UShort* ) ) + goto Fail3; + + count = gcd->cd.cd2.ClassRangeCount; + gcrr = gcd->cd.cd2.ClassRangeRecord; + ngc = gdef->NewGlyphClasses; + + /* We allocate arrays for all glyphs not covered by the class range + records. Each element holds four class values. */ + + if ( count > 0 ) + { + if ( gcrr[0].Start ) + { + if ( ALLOC_ARRAY( ngc[0], ( gcrr[0].Start + 3 ) / 4, HB_UShort ) ) + goto Fail2; + } + + for ( n = 1; n < count; n++ ) + { + if ( gcrr[n].Start - gcrr[n - 1].End > 1 ) + if ( ALLOC_ARRAY( ngc[n], + ( gcrr[n].Start - gcrr[n - 1].End + 2 ) / 4, + HB_UShort ) ) + goto Fail1; + } + + if ( gcrr[count - 1].End != num_glyphs - 1 ) + { + if ( ALLOC_ARRAY( ngc[count], + ( num_glyphs - gcrr[count - 1].End + 2 ) / 4, + HB_UShort ) ) + goto Fail1; + } + } + else if ( num_glyphs > 0 ) + { + if ( ALLOC_ARRAY( ngc[count], + ( num_glyphs + 3 ) / 4, + HB_UShort ) ) + goto Fail2; + } + + gdef->LastGlyph = num_glyphs - 1; + + gdef->MarkAttachClassDef_offset = 0L; + gdef->MarkAttachClassDef.loaded = FALSE; + + gcd->loaded = TRUE; + + return HB_Err_Ok; + +Fail1: + for ( m = 0; m < n; m++ ) + FREE( ngc[m] ); + +Fail2: + FREE( gdef->NewGlyphClasses ); + +Fail3: + FREE( gcd->cd.cd2.ClassRangeRecord ); + +Fail4: + return error; +} + + +static void Free_NewGlyphClasses( HB_GDEFHeader* gdef ) +{ + HB_UShort** ngc; + HB_UShort n, count; + + + if ( gdef->NewGlyphClasses ) + { + count = gdef->GlyphClassDef.cd.cd2.ClassRangeCount + 1; + ngc = gdef->NewGlyphClasses; + + for ( n = 0; n < count; n++ ) + FREE( ngc[n] ); + + FREE( ngc ); + } +} + + +HB_INTERNAL HB_Error +_HB_GDEF_Add_Glyph_Property( HB_GDEFHeader* gdef, + HB_UShort glyphID, + HB_UShort property ) +{ + HB_Error error; + HB_UShort class, new_class, index = 0; /* shut compiler up */ + HB_UShort byte, bits, mask; + HB_UShort array_index, glyph_index, count; + + HB_ClassRangeRecord* gcrr; + HB_UShort** ngc; + + + error = _HB_OPEN_Get_Class( &gdef->GlyphClassDef, glyphID, &class, &index ); + if ( error && error != HB_Err_Not_Covered ) + return error; + + /* we don't accept glyphs covered in `GlyphClassDef' */ + + if ( !error ) + return HB_Err_Not_Covered; + + switch ( property ) + { + case 0: + new_class = UNCLASSIFIED_GLYPH; + break; + + case HB_GDEF_BASE_GLYPH: + new_class = SIMPLE_GLYPH; + break; + + case HB_GDEF_LIGATURE: + new_class = LIGATURE_GLYPH; + break; + + case HB_GDEF_MARK: + new_class = MARK_GLYPH; + break; + + case HB_GDEF_COMPONENT: + new_class = COMPONENT_GLYPH; + break; + + default: + return ERR(HB_Err_Invalid_Argument); + } + + count = gdef->GlyphClassDef.cd.cd2.ClassRangeCount; + gcrr = gdef->GlyphClassDef.cd.cd2.ClassRangeRecord; + ngc = gdef->NewGlyphClasses; + + if ( index < count && glyphID < gcrr[index].Start ) + { + array_index = index; + if ( index == 0 ) + glyph_index = glyphID; + else + glyph_index = glyphID - gcrr[index - 1].End - 1; + } + else + { + array_index = index + 1; + glyph_index = glyphID - gcrr[index].End - 1; + } + + byte = ngc[array_index][glyph_index / 4]; + bits = byte >> ( 16 - ( glyph_index % 4 + 1 ) * 4 ); + class = bits & 0x000F; + + /* we don't overwrite existing entries */ + + if ( !class ) + { + bits = new_class << ( 16 - ( glyph_index % 4 + 1 ) * 4 ); + mask = ~( 0x000F << ( 16 - ( glyph_index % 4 + 1 ) * 4 ) ); + + ngc[array_index][glyph_index / 4] &= mask; + ngc[array_index][glyph_index / 4] |= bits; + } + + return HB_Err_Ok; +} + + +HB_INTERNAL HB_Error +_HB_GDEF_Check_Property( HB_GDEFHeader* gdef, + HB_GlyphItem gitem, + HB_UShort flags, + HB_UShort* property ) +{ + HB_Error error; + + if ( gdef ) + { + HB_UShort basic_glyph_class; + HB_UShort desired_attachment_class; + + if ( gitem->gproperties == HB_GLYPH_PROPERTIES_UNKNOWN ) + { + error = HB_GDEF_Get_Glyph_Property( gdef, gitem->gindex, &gitem->gproperties ); + if ( error ) + return error; + } + + *property = gitem->gproperties; + + /* If the glyph was found in the MarkAttachmentClass table, + * then that class value is the high byte of the result, + * otherwise the low byte contains the basic type of the glyph + * as defined by the GlyphClassDef table. + */ + if ( *property & HB_LOOKUP_FLAG_IGNORE_SPECIAL_MARKS ) + basic_glyph_class = HB_GDEF_MARK; + else + basic_glyph_class = *property; + + /* Return Not_Covered, if, for example, basic_glyph_class + * is HB_GDEF_LIGATURE and LookFlags includes HB_LOOKUP_FLAG_IGNORE_LIGATURES + */ + if ( flags & basic_glyph_class ) + return HB_Err_Not_Covered; + + /* The high byte of LookupFlags has the meaning + * "ignore marks of attachment type different than + * the attachment type specified." + */ + desired_attachment_class = flags & HB_LOOKUP_FLAG_IGNORE_SPECIAL_MARKS; + if ( desired_attachment_class ) + { + if ( basic_glyph_class == HB_GDEF_MARK && + *property != desired_attachment_class ) + return HB_Err_Not_Covered; + } + } else { + *property = 0; + } + + return HB_Err_Ok; +} + +HB_INTERNAL HB_Error +_HB_GDEF_LoadMarkAttachClassDef_From_LookupFlags( HB_GDEFHeader* gdef, + HB_Stream stream, + HB_Lookup* lo, + HB_UShort num_lookups) +{ + HB_Error error = HB_Err_Ok; + HB_UShort i; + + /* We now check the LookupFlags for values larger than 0xFF to find + out whether we need to load the `MarkAttachClassDef' field of the + GDEF table -- this hack is necessary for OpenType 1.2 tables since + the version field of the GDEF table hasn't been incremented. + + For constructed GDEF tables, we only load it if + `MarkAttachClassDef_offset' is not zero (nevertheless, a build of + a constructed mark attach table is not supported currently). */ + + if ( gdef && + gdef->MarkAttachClassDef_offset && !gdef->MarkAttachClassDef.loaded ) + { + for ( i = 0; i < num_lookups; i++ ) + { + + if ( lo[i].LookupFlag & HB_LOOKUP_FLAG_IGNORE_SPECIAL_MARKS ) + { + if ( FILE_Seek( gdef->MarkAttachClassDef_offset ) || + ( error = _HB_OPEN_Load_ClassDefinition( &gdef->MarkAttachClassDef, + 256, stream ) ) != HB_Err_Ok ) + goto Done; + + break; + } + } + } + +Done: + return error; +} + +/* END */ diff --git a/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-gdef.h b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-gdef.h new file mode 100644 index 0000000..f9a03dd --- /dev/null +++ b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-gdef.h @@ -0,0 +1,140 @@ +/* + * Copyright (C) 1998-2004 David Turner and Werner Lemberg + * Copyright (C) 2006 Behdad Esfahbod + * + * This is part of HarfBuzz, an OpenType Layout engine library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#ifndef HARFBUZZ_GDEF_H +#define HARFBUZZ_GDEF_H + +#include "harfbuzz-open.h" +#include "harfbuzz-stream.h" + +HB_BEGIN_HEADER + +#ifdef HB_USE_PACKED_STRUCTS +#pragma pack(push, 1) +#endif + +/* GDEF glyph properties. Note that HB_GDEF_COMPONENT has no corresponding + * flag in the LookupFlag field. */ +#define HB_GDEF_BASE_GLYPH 0x0002 +#define HB_GDEF_LIGATURE 0x0004 +#define HB_GDEF_MARK 0x0008 +#define HB_GDEF_COMPONENT 0x0010 + + +typedef struct HB_AttachPoint_ HB_AttachPoint; + + +struct HB_AttachList_ +{ + HB_AttachPoint* AttachPoint; /* array of AttachPoint tables */ + HB_Coverage Coverage; /* Coverage table */ + HB_UShort GlyphCount; /* number of glyphs with + attachments */ + HB_Bool loaded; +}; + +typedef struct HB_AttachList_ HB_AttachList; + +typedef struct HB_LigGlyph_ HB_LigGlyph; + +struct HB_LigCaretList_ +{ + HB_LigGlyph* LigGlyph; /* array of LigGlyph tables */ + HB_Coverage Coverage; /* Coverage table */ + HB_UShort LigGlyphCount; /* number of ligature glyphs */ + HB_Bool loaded; +}; + +typedef struct HB_LigCaretList_ HB_LigCaretList; + + + +/* The `NewGlyphClasses' field is not defined in the TTO specification. + We use it for fonts with a constructed `GlyphClassDef' structure + (i.e., which don't have a GDEF table) to collect glyph classes + assigned during the lookup process. The number of arrays in this + pointer array is GlyphClassDef->cd.cd2.ClassRangeCount+1; the nth + array then contains the glyph class values of the glyphs not covered + by the ClassRangeRecords structures with index n-1 and n. We store + glyph class values for four glyphs in a single array element. + + `LastGlyph' is identical to the number of glyphs minus one in the + font; we need it only if `NewGlyphClasses' is not NULL (to have an + upper bound for the last array). + + Note that we first store the file offset to the `MarkAttachClassDef' + field (which has been introduced in OpenType 1.2) -- since the + `Version' field value hasn't been increased to indicate that we have + one more field for some obscure reason, we must parse the GSUB table + to find out whether class values refer to this table. Only then we + can finally load the MarkAttachClassDef structure if necessary. */ + +struct HB_GDEFHeader_ +{ + HB_UShort** NewGlyphClasses; + HB_UInt offset; + HB_UInt MarkAttachClassDef_offset; + + HB_16Dot16 Version; + + HB_ClassDefinition GlyphClassDef; + HB_AttachList AttachList; + HB_LigCaretList LigCaretList; + HB_ClassDefinition MarkAttachClassDef; /* new in OT 1.2 */ + + HB_UShort LastGlyph; +}; + +typedef struct HB_GDEFHeader_ HB_GDEFHeader; +typedef struct HB_GDEFHeader_* HB_GDEF; + + +HB_Error HB_New_GDEF_Table( HB_GDEFHeader** retptr ); + + +HB_Error HB_Load_GDEF_Table( HB_Stream stream, + HB_GDEFHeader** gdef ); + + +HB_Error HB_Done_GDEF_Table ( HB_GDEFHeader* gdef ); + + +HB_Error HB_GDEF_Get_Glyph_Property( HB_GDEFHeader* gdef, + HB_UShort glyphID, + HB_UShort* property ); + +HB_Error HB_GDEF_Build_ClassDefinition( HB_GDEFHeader* gdef, + HB_UShort num_glyphs, + HB_UShort glyph_count, + HB_UShort* glyph_array, + HB_UShort* class_array ); + +#ifdef HB_USE_PACKED_STRUCTS +#pragma pack(pop) +#endif + +HB_END_HEADER + +#endif /* HARFBUZZ_GDEF_H */ diff --git a/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-global.h b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-global.h new file mode 100644 index 0000000..bccd6a2 --- /dev/null +++ b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-global.h @@ -0,0 +1,122 @@ +/* + * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) + * Copyright (C) 2007 Red Hat, Inc. + * + * This is part of HarfBuzz, an OpenType Layout engine library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + * + * Red Hat Author(s): Behdad Esfahbod + */ + +#ifndef HARFBUZZ_GLOBAL_H +#define HARFBUZZ_GLOBAL_H + +#include +#include + +#ifdef __cplusplus +#define HB_BEGIN_HEADER extern "C" { +#define HB_END_HEADER } +#else +#define HB_BEGIN_HEADER /* nothing */ +#define HB_END_HEADER /* nothing */ +#endif + +#if defined(__GNUC__) || defined(_MSC_VER) +#define HB_USE_PACKED_STRUCTS +#endif + +HB_BEGIN_HEADER + +#ifndef FALSE +#define FALSE 0 +#endif + +#ifndef TRUE +#define TRUE (!FALSE) +#endif + +#define HB_MAKE_TAG( _x1, _x2, _x3, _x4 ) \ + ( ( (HB_UInt)_x1 << 24 ) | \ + ( (HB_UInt)_x2 << 16 ) | \ + ( (HB_UInt)_x3 << 8 ) | \ + (HB_UInt)_x4 ) + +typedef char hb_int8; +typedef unsigned char hb_uint8; +typedef short hb_int16; +typedef unsigned short hb_uint16; +typedef int hb_int32; +typedef unsigned int hb_uint32; + +typedef hb_uint8 HB_Bool; + +typedef hb_uint8 HB_Byte; +typedef hb_uint16 HB_UShort; +typedef hb_uint32 HB_UInt; +typedef hb_int8 HB_Char; +typedef hb_int16 HB_Short; +typedef hb_int32 HB_Int; + +typedef hb_uint16 HB_UChar16; +typedef hb_uint32 HB_UChar32; +typedef hb_uint32 HB_Glyph; +typedef hb_int32 HB_Fixed; /* 26.6 */ + +#define HB_FIXED_CONSTANT(v) ((v) * 64) +#define HB_FIXED_ROUND(v) (((v)+32) & -64) + +typedef hb_int32 HB_16Dot16; /* 16.16 */ + +typedef void * HB_Pointer; +typedef hb_uint32 HB_Tag; + +typedef enum { + /* no error */ + HB_Err_Ok = 0x0000, + HB_Err_Not_Covered = 0xFFFF, + + /* _hb_err() is called whenever returning the following errors, + * and in a couple places for HB_Err_Not_Covered too. */ + + /* programmer error */ + HB_Err_Invalid_Argument = 0x1A66, + + /* font error */ + HB_Err_Invalid_SubTable_Format = 0x157F, + HB_Err_Invalid_SubTable = 0x1570, + HB_Err_Read_Error = 0x6EAD, + + /* system error */ + HB_Err_Out_Of_Memory = 0xDEAD +} HB_Error; + +typedef struct { + HB_Fixed x; + HB_Fixed y; +} HB_FixedPoint; + +typedef struct HB_Font_ *HB_Font; +typedef struct HB_StreamRec_ *HB_Stream; +typedef struct HB_FaceRec_ *HB_Face; + +HB_END_HEADER + +#endif diff --git a/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-gpos-private.h b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-gpos-private.h new file mode 100644 index 0000000..39f3159 --- /dev/null +++ b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-gpos-private.h @@ -0,0 +1,729 @@ +/* + * Copyright (C) 1998-2004 David Turner and Werner Lemberg + * Copyright (C) 2006 Behdad Esfahbod + * + * This is part of HarfBuzz, an OpenType Layout engine library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#ifndef HARFBUZZ_GPOS_PRIVATE_H +#define HARFBUZZ_GPOS_PRIVATE_H + +#include "harfbuzz-impl.h" +#include "harfbuzz-stream-private.h" +#include "harfbuzz-gpos.h" + +HB_BEGIN_HEADER + +#ifdef HB_USE_PACKED_STRUCTS +#pragma pack(push, 1) +#endif + +/* shared tables */ + +#define VR_X_PLACEMENT_DEVICE 0 +#define VR_Y_PLACEMENT_DEVICE 1 +#define VR_X_ADVANCE_DEVICE 2 +#define VR_Y_ADVANCE_DEVICE 3 + +struct HB_ValueRecord_ +{ + HB_Short XPlacement; /* horizontal adjustment for + placement */ + HB_Short YPlacement; /* vertical adjustment for + placement */ + HB_Short XAdvance; /* horizontal adjustment for + advance */ + HB_Short YAdvance; /* vertical adjustment for + advance */ + + HB_Device** DeviceTables; /* device tables for placement + and advance */ + +#ifdef HB_SUPPORT_MULTIPLE_MASTER + HB_UShort XIdPlacement; /* horizontal placement metric ID */ + HB_UShort YIdPlacement; /* vertical placement metric ID */ + HB_UShort XIdAdvance; /* horizontal advance metric ID */ + HB_UShort YIdAdvance; /* vertical advance metric ID */ +#endif +}; + +typedef struct HB_ValueRecord_ HB_ValueRecord; + + +/* Mask values to scan the value format of the ValueRecord structure. + We always expand compressed ValueRecords of the font. */ + +#define HB_GPOS_FORMAT_HAVE_DEVICE_TABLES 0x00F0 + +#define HB_GPOS_FORMAT_HAVE_X_PLACEMENT 0x0001 +#define HB_GPOS_FORMAT_HAVE_Y_PLACEMENT 0x0002 +#define HB_GPOS_FORMAT_HAVE_X_ADVANCE 0x0004 +#define HB_GPOS_FORMAT_HAVE_Y_ADVANCE 0x0008 +#define HB_GPOS_FORMAT_HAVE_X_PLACEMENT_DEVICE 0x0010 +#define HB_GPOS_FORMAT_HAVE_Y_PLACEMENT_DEVICE 0x0020 +#define HB_GPOS_FORMAT_HAVE_X_ADVANCE_DEVICE 0x0040 +#define HB_GPOS_FORMAT_HAVE_Y_ADVANCE_DEVICE 0x0080 +#define HB_GPOS_FORMAT_HAVE_X_ID_PLACEMENT 0x0100 +#define HB_GPOS_FORMAT_HAVE_Y_ID_PLACEMENT 0x0200 +#define HB_GPOS_FORMAT_HAVE_X_ID_ADVANCE 0x0400 +#define HB_GPOS_FORMAT_HAVE_Y_ID_ADVANCE 0x0800 + + +struct HB_AnchorFormat1_ +{ + HB_Short XCoordinate; /* horizontal value */ + HB_Short YCoordinate; /* vertical value */ +}; + +typedef struct HB_AnchorFormat1_ HB_AnchorFormat1; + + +struct HB_AnchorFormat2_ +{ + HB_Short XCoordinate; /* horizontal value */ + HB_Short YCoordinate; /* vertical value */ + HB_UShort AnchorPoint; /* index to glyph contour point */ +}; + +typedef struct HB_AnchorFormat2_ HB_AnchorFormat2; + +#define AF3_X_DEVICE_TABLE 0 +#define AF3_Y_DEVICE_TABLE 1 + +struct HB_AnchorFormat3_ +{ + HB_Short XCoordinate; /* horizontal value */ + HB_Short YCoordinate; /* vertical value */ + HB_Device** DeviceTables; /* device tables for coordinates */ +}; + +typedef struct HB_AnchorFormat3_ HB_AnchorFormat3; + + +#ifdef HB_SUPPORT_MULTIPLE_MASTER +struct HB_AnchorFormat4_ +{ + HB_UShort XIdAnchor; /* horizontal metric ID */ + HB_UShort YIdAnchor; /* vertical metric ID */ +}; + +typedef struct HB_AnchorFormat4_ HB_AnchorFormat4; +#endif + + +struct HB_Anchor_ +{ + HB_Byte PosFormat; /* 1, 2, 3, or 4 -- 0 indicates + that there is no Anchor table */ + + union + { + HB_AnchorFormat1 af1; + HB_AnchorFormat2 af2; + HB_AnchorFormat3 af3; +#ifdef HB_SUPPORT_MULTIPLE_MASTER + HB_AnchorFormat4 af4; +#endif + } af; +}; + +typedef struct HB_Anchor_ HB_Anchor; + + +struct HB_MarkRecord_ +{ + HB_UShort Class; /* mark class */ + HB_Anchor MarkAnchor; /* anchor table */ +}; + +typedef struct HB_MarkRecord_ HB_MarkRecord; + + +struct HB_MarkArray_ +{ + HB_UShort MarkCount; /* number of MarkRecord tables */ + HB_MarkRecord* MarkRecord; /* array of MarkRecord tables */ +}; + +typedef struct HB_MarkArray_ HB_MarkArray; + + +/* LookupType 1 */ + +struct HB_SinglePosFormat1_ +{ + HB_ValueRecord Value; /* ValueRecord for all covered + glyphs */ +}; + +typedef struct HB_SinglePosFormat1_ HB_SinglePosFormat1; + + +struct HB_SinglePosFormat2_ +{ + HB_UShort ValueCount; /* number of ValueRecord tables */ + HB_ValueRecord* Value; /* array of ValueRecord tables */ +}; + +typedef struct HB_SinglePosFormat2_ HB_SinglePosFormat2; + + +struct HB_SinglePos_ +{ + HB_Byte PosFormat; /* 1 or 2 */ + HB_Coverage Coverage; /* Coverage table */ + + HB_UShort ValueFormat; /* format of ValueRecord table */ + + union + { + HB_SinglePosFormat1 spf1; + HB_SinglePosFormat2 spf2; + } spf; +}; + +typedef struct HB_SinglePos_ HB_SinglePos; + + +/* LookupType 2 */ + +struct HB_PairValueRecord_ +{ + HB_UShort SecondGlyph; /* glyph ID for second glyph */ + HB_ValueRecord Value1; /* pos. data for first glyph */ + HB_ValueRecord Value2; /* pos. data for second glyph */ +}; + +typedef struct HB_PairValueRecord_ HB_PairValueRecord; + + +struct HB_PairSet_ +{ + HB_UShort PairValueCount; + /* number of PairValueRecord tables */ + HB_PairValueRecord* PairValueRecord; + /* array of PairValueRecord tables */ +}; + +typedef struct HB_PairSet_ HB_PairSet; + + +struct HB_PairPosFormat1_ +{ + HB_UShort PairSetCount; /* number of PairSet tables */ + HB_PairSet* PairSet; /* array of PairSet tables */ +}; + +typedef struct HB_PairPosFormat1_ HB_PairPosFormat1; + + +struct HB_Class2Record_ +{ + HB_ValueRecord Value1; /* pos. data for first glyph */ + HB_ValueRecord Value2; /* pos. data for second glyph */ +}; + +typedef struct HB_Class2Record_ HB_Class2Record; + + +struct HB_Class1Record_ +{ + HB_Class2Record* Class2Record; /* array of Class2Record tables */ +}; + +typedef struct HB_Class1Record_ HB_Class1Record; + + +struct HB_PairPosFormat2_ +{ + HB_ClassDefinition ClassDef1; /* class def. for first glyph */ + HB_ClassDefinition ClassDef2; /* class def. for second glyph */ + HB_UShort Class1Count; /* number of classes in ClassDef1 + table */ + HB_UShort Class2Count; /* number of classes in ClassDef2 + table */ + HB_Class1Record* Class1Record; /* array of Class1Record tables */ +}; + +typedef struct HB_PairPosFormat2_ HB_PairPosFormat2; + + +struct HB_PairPos_ +{ + HB_Byte PosFormat; /* 1 or 2 */ + HB_Coverage Coverage; /* Coverage table */ + HB_UShort ValueFormat1; /* format of ValueRecord table + for first glyph */ + HB_UShort ValueFormat2; /* format of ValueRecord table + for second glyph */ + + union + { + HB_PairPosFormat1 ppf1; + HB_PairPosFormat2 ppf2; + } ppf; +}; + +typedef struct HB_PairPos_ HB_PairPos; + + +/* LookupType 3 */ + +struct HB_EntryExitRecord_ +{ + HB_Anchor EntryAnchor; /* entry Anchor table */ + HB_Anchor ExitAnchor; /* exit Anchor table */ +}; + + +typedef struct HB_EntryExitRecord_ HB_EntryExitRecord; + +struct HB_CursivePos_ +{ + HB_UShort PosFormat; /* always 1 */ + HB_Coverage Coverage; /* Coverage table */ + HB_UShort EntryExitCount; + /* number of EntryExitRecord tables */ + HB_EntryExitRecord* EntryExitRecord; + /* array of EntryExitRecord tables */ +}; + +typedef struct HB_CursivePos_ HB_CursivePos; + + +/* LookupType 4 */ + +struct HB_BaseRecord_ +{ + HB_Anchor* BaseAnchor; /* array of base glyph anchor + tables */ +}; + +typedef struct HB_BaseRecord_ HB_BaseRecord; + + +struct HB_BaseArray_ +{ + HB_UShort BaseCount; /* number of BaseRecord tables */ + HB_BaseRecord* BaseRecord; /* array of BaseRecord tables */ +}; + +typedef struct HB_BaseArray_ HB_BaseArray; + + +struct HB_MarkBasePos_ +{ + HB_UShort PosFormat; /* always 1 */ + HB_Coverage MarkCoverage; /* mark glyph coverage table */ + HB_Coverage BaseCoverage; /* base glyph coverage table */ + HB_UShort ClassCount; /* number of mark classes */ + HB_MarkArray MarkArray; /* mark array table */ + HB_BaseArray BaseArray; /* base array table */ +}; + +typedef struct HB_MarkBasePos_ HB_MarkBasePos; + + +/* LookupType 5 */ + +struct HB_ComponentRecord_ +{ + HB_Anchor* LigatureAnchor; /* array of ligature glyph anchor + tables */ +}; + +typedef struct HB_ComponentRecord_ HB_ComponentRecord; + + +struct HB_LigatureAttach_ +{ + HB_UShort ComponentCount; + /* number of ComponentRecord tables */ + HB_ComponentRecord* ComponentRecord; + /* array of ComponentRecord tables */ +}; + +typedef struct HB_LigatureAttach_ HB_LigatureAttach; + + +struct HB_LigatureArray_ +{ + HB_UShort LigatureCount; /* number of LigatureAttach tables */ + HB_LigatureAttach* LigatureAttach; + /* array of LigatureAttach tables */ +}; + +typedef struct HB_LigatureArray_ HB_LigatureArray; + + +struct HB_MarkLigPos_ +{ + HB_UShort PosFormat; /* always 1 */ + HB_Coverage MarkCoverage; /* mark glyph coverage table */ + HB_Coverage LigatureCoverage; + /* ligature glyph coverage table */ + HB_UShort ClassCount; /* number of mark classes */ + HB_MarkArray MarkArray; /* mark array table */ + HB_LigatureArray LigatureArray; /* ligature array table */ +}; + +typedef struct HB_MarkLigPos_ HB_MarkLigPos; + + +/* LookupType 6 */ + +struct HB_Mark2Record_ +{ + HB_Anchor* Mark2Anchor; /* array of mark glyph anchor + tables */ +}; + +typedef struct HB_Mark2Record_ HB_Mark2Record; + + +struct HB_Mark2Array_ +{ + HB_UShort Mark2Count; /* number of Mark2Record tables */ + HB_Mark2Record* Mark2Record; /* array of Mark2Record tables */ +}; + +typedef struct HB_Mark2Array_ HB_Mark2Array; + + +struct HB_MarkMarkPos_ +{ + HB_UShort PosFormat; /* always 1 */ + HB_Coverage Mark1Coverage; /* first mark glyph coverage table */ + HB_Coverage Mark2Coverage; /* second mark glyph coverave table */ + HB_UShort ClassCount; /* number of combining mark classes */ + HB_MarkArray Mark1Array; /* MarkArray table for first mark */ + HB_Mark2Array Mark2Array; /* MarkArray table for second mark */ +}; + +typedef struct HB_MarkMarkPos_ HB_MarkMarkPos; + + +/* needed by both lookup type 7 and 8 */ + +struct HB_PosLookupRecord_ +{ + HB_UShort SequenceIndex; /* index into current + glyph sequence */ + HB_UShort LookupListIndex; /* Lookup to apply to that pos. */ +}; + +typedef struct HB_PosLookupRecord_ HB_PosLookupRecord; + + +/* LookupType 7 */ + +struct HB_PosRule_ +{ + HB_UShort GlyphCount; /* total number of input glyphs */ + HB_UShort PosCount; /* number of PosLookupRecord tables */ + HB_UShort* Input; /* array of input glyph IDs */ + HB_PosLookupRecord* PosLookupRecord; + /* array of PosLookupRecord tables */ +}; + +typedef struct HB_PosRule_ HB_PosRule; + + +struct HB_PosRuleSet_ +{ + HB_UShort PosRuleCount; /* number of PosRule tables */ + HB_PosRule* PosRule; /* array of PosRule tables */ +}; + +typedef struct HB_PosRuleSet_ HB_PosRuleSet; + + +struct HB_ContextPosFormat1_ +{ + HB_Coverage Coverage; /* Coverage table */ + HB_UShort PosRuleSetCount; /* number of PosRuleSet tables */ + HB_PosRuleSet* PosRuleSet; /* array of PosRuleSet tables */ +}; + +typedef struct HB_ContextPosFormat1_ HB_ContextPosFormat1; + + +struct HB_PosClassRule_ +{ + HB_UShort GlyphCount; /* total number of context classes */ + HB_UShort PosCount; /* number of PosLookupRecord tables */ + HB_UShort* Class; /* array of classes */ + HB_PosLookupRecord* PosLookupRecord; + /* array of PosLookupRecord tables */ +}; + +typedef struct HB_PosClassRule_ HB_PosClassRule; + + +struct HB_PosClassSet_ +{ + HB_UShort PosClassRuleCount; + /* number of PosClassRule tables */ + HB_PosClassRule* PosClassRule; /* array of PosClassRule tables */ +}; + +typedef struct HB_PosClassSet_ HB_PosClassSet; + + +/* The `MaxContextLength' field is not defined in the TTO specification + but simplifies the implementation of this format. It holds the + maximal context length used in the context rules. */ + +struct HB_ContextPosFormat2_ +{ + HB_UShort MaxContextLength; + /* maximal context length */ + HB_Coverage Coverage; /* Coverage table */ + HB_ClassDefinition ClassDef; /* ClassDef table */ + HB_UShort PosClassSetCount; + /* number of PosClassSet tables */ + HB_PosClassSet* PosClassSet; /* array of PosClassSet tables */ +}; + +typedef struct HB_ContextPosFormat2_ HB_ContextPosFormat2; + + +struct HB_ContextPosFormat3_ +{ + HB_UShort GlyphCount; /* number of input glyphs */ + HB_UShort PosCount; /* number of PosLookupRecord tables */ + HB_Coverage* Coverage; /* array of Coverage tables */ + HB_PosLookupRecord* PosLookupRecord; + /* array of PosLookupRecord tables */ +}; + +typedef struct HB_ContextPosFormat3_ HB_ContextPosFormat3; + + +struct HB_ContextPos_ +{ + HB_Byte PosFormat; /* 1, 2, or 3 */ + + union + { + HB_ContextPosFormat1 cpf1; + HB_ContextPosFormat2 cpf2; + HB_ContextPosFormat3 cpf3; + } cpf; +}; + +typedef struct HB_ContextPos_ HB_ContextPos; + + +/* LookupType 8 */ + +struct HB_ChainPosRule_ +{ + HB_UShort* Backtrack; /* array of backtrack glyph IDs */ + HB_UShort* Input; /* array of input glyph IDs */ + HB_UShort* Lookahead; /* array of lookahead glyph IDs */ + HB_PosLookupRecord* PosLookupRecord; + /* array of PosLookupRecords */ + HB_UShort BacktrackGlyphCount; + /* total number of backtrack glyphs */ + HB_UShort InputGlyphCount; + /* total number of input glyphs */ + HB_UShort LookaheadGlyphCount; + /* total number of lookahead glyphs */ + HB_UShort PosCount; /* number of PosLookupRecords */ +}; + +typedef struct HB_ChainPosRule_ HB_ChainPosRule; + + +struct HB_ChainPosRuleSet_ +{ + HB_UShort ChainPosRuleCount; + /* number of ChainPosRule tables */ + HB_ChainPosRule* ChainPosRule; /* array of ChainPosRule tables */ +}; + +typedef struct HB_ChainPosRuleSet_ HB_ChainPosRuleSet; + + +struct HB_ChainContextPosFormat1_ +{ + HB_Coverage Coverage; /* Coverage table */ + HB_UShort ChainPosRuleSetCount; + /* number of ChainPosRuleSet tables */ + HB_ChainPosRuleSet* ChainPosRuleSet; + /* array of ChainPosRuleSet tables */ +}; + +typedef struct HB_ChainContextPosFormat1_ HB_ChainContextPosFormat1; + + +struct HB_ChainPosClassRule_ +{ + HB_UShort* Backtrack; /* array of backtrack classes */ + HB_UShort* Input; /* array of context classes */ + HB_UShort* Lookahead; /* array of lookahead classes */ + HB_PosLookupRecord* PosLookupRecord; + /* array of substitution lookups */ + HB_UShort BacktrackGlyphCount; + /* total number of backtrack + classes */ + HB_UShort InputGlyphCount; + /* total number of context classes */ + HB_UShort LookaheadGlyphCount; + /* total number of lookahead + classes */ + HB_UShort PosCount; /* number of PosLookupRecords */ +}; + +typedef struct HB_ChainPosClassRule_ HB_ChainPosClassRule; + + +struct HB_ChainPosClassSet_ +{ + HB_UShort ChainPosClassRuleCount; + /* number of ChainPosClassRule + tables */ + HB_ChainPosClassRule* ChainPosClassRule; + /* array of ChainPosClassRule + tables */ +}; + +typedef struct HB_ChainPosClassSet_ HB_ChainPosClassSet; + + +/* The `MaxXXXLength' fields are not defined in the TTO specification + but simplifies the implementation of this format. It holds the + maximal context length used in the specific context rules. */ + +struct HB_ChainContextPosFormat2_ +{ + HB_Coverage Coverage; /* Coverage table */ + + HB_UShort MaxBacktrackLength; + /* maximal backtrack length */ + HB_ClassDefinition BacktrackClassDef; + /* BacktrackClassDef table */ + HB_UShort MaxInputLength; + /* maximal input length */ + HB_ClassDefinition InputClassDef; + /* InputClassDef table */ + HB_UShort MaxLookaheadLength; + /* maximal lookahead length */ + HB_ClassDefinition LookaheadClassDef; + /* LookaheadClassDef table */ + + HB_UShort ChainPosClassSetCount; + /* number of ChainPosClassSet + tables */ + HB_ChainPosClassSet* ChainPosClassSet; + /* array of ChainPosClassSet + tables */ +}; + +typedef struct HB_ChainContextPosFormat2_ HB_ChainContextPosFormat2; + + +struct HB_ChainContextPosFormat3_ +{ + HB_UShort BacktrackGlyphCount; + /* number of backtrack glyphs */ + HB_Coverage* BacktrackCoverage; + /* array of backtrack Coverage + tables */ + HB_UShort InputGlyphCount; + /* number of input glyphs */ + HB_Coverage* InputCoverage; + /* array of input coverage + tables */ + HB_UShort LookaheadGlyphCount; + /* number of lookahead glyphs */ + HB_Coverage* LookaheadCoverage; + /* array of lookahead coverage + tables */ + HB_UShort PosCount; /* number of PosLookupRecords */ + HB_PosLookupRecord* PosLookupRecord; + /* array of substitution lookups */ +}; + +typedef struct HB_ChainContextPosFormat3_ HB_ChainContextPosFormat3; + + +struct HB_ChainContextPos_ +{ + HB_Byte PosFormat; /* 1, 2, or 3 */ + + union + { + HB_ChainContextPosFormat1 ccpf1; + HB_ChainContextPosFormat2 ccpf2; + HB_ChainContextPosFormat3 ccpf3; + } ccpf; +}; + +typedef struct HB_ChainContextPos_ HB_ChainContextPos; + + +#if 0 +/* LookupType 10 */ +struct HB_ExtensionPos_ +{ + HB_UShort PosFormat; /* always 1 */ + HB_UShort LookuptType; /* lookup-type of referenced subtable */ + HB_GPOS_SubTable *subtable; /* referenced subtable */ +}; + +typedef struct HB_ExtensionPos_ HB_ExtensionPos; +#endif + + +union HB_GPOS_SubTable_ +{ + HB_SinglePos single; + HB_PairPos pair; + HB_CursivePos cursive; + HB_MarkBasePos markbase; + HB_MarkLigPos marklig; + HB_MarkMarkPos markmark; + HB_ContextPos context; + HB_ChainContextPos chain; +}; + +typedef union HB_GPOS_SubTable_ HB_GPOS_SubTable; + + + +HB_INTERNAL HB_Error +_HB_GPOS_Load_SubTable( HB_GPOS_SubTable* st, + HB_Stream stream, + HB_UShort lookup_type ); + +HB_INTERNAL void +_HB_GPOS_Free_SubTable( HB_GPOS_SubTable* st, + HB_UShort lookup_type ); + +#ifdef HB_USE_PACKED_STRUCTS +#pragma pack(pop) +#endif + +HB_END_HEADER + +#endif /* HARFBUZZ_GPOS_PRIVATE_H */ diff --git a/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-gpos.c b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-gpos.c new file mode 100644 index 0000000..a216005 --- /dev/null +++ b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-gpos.c @@ -0,0 +1,6091 @@ +/* + * Copyright (C) 1998-2004 David Turner and Werner Lemberg + * Copyright (C) 2006 Behdad Esfahbod + * Copyright (C) 2007 Red Hat, Inc. + * + * This is part of HarfBuzz, an OpenType Layout engine library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + * + * Red Hat Author(s): Behdad Esfahbod + */ + +#include "harfbuzz-impl.h" +#include "harfbuzz-gpos-private.h" +#include "harfbuzz-open-private.h" +#include "harfbuzz-gdef-private.h" +#include "harfbuzz-shaper.h" + +struct GPOS_Instance_ +{ + HB_GPOSHeader* gpos; + HB_Font font; + HB_Bool dvi; + HB_UShort load_flags; /* how the glyph should be loaded */ + HB_Bool r2l; + + HB_UShort last; /* the last valid glyph -- used + with cursive positioning */ + HB_Fixed anchor_x; /* the coordinates of the anchor point */ + HB_Fixed anchor_y; /* of the last valid glyph */ +}; + +typedef struct GPOS_Instance_ GPOS_Instance; + + +static HB_Error GPOS_Do_Glyph_Lookup( GPOS_Instance* gpi, + HB_UShort lookup_index, + HB_Buffer buffer, + HB_UShort context_length, + int nesting_level ); + + + +#ifdef HB_SUPPORT_MULTIPLE_MASTER +/* the client application must replace this with something more + meaningful if multiple master fonts are to be supported. */ + +static HB_Error default_mmfunc( HB_Font font, + HB_UShort metric_id, + HB_Fixed* metric_value, + void* data ) +{ + HB_UNUSED(font); + HB_UNUSED(metric_id); + HB_UNUSED(metric_value); + HB_UNUSED(data); + return ERR(HB_Err_Not_Covered); /* ERR() call intended */ +} +#endif + + + +HB_Error HB_Load_GPOS_Table( HB_Stream stream, + HB_GPOSHeader** retptr, + HB_GDEFHeader* gdef, + HB_Stream gdefStream ) +{ + HB_UInt cur_offset, new_offset, base_offset; + + HB_GPOSHeader* gpos; + + HB_Error error; + + + if ( !retptr ) + return ERR(HB_Err_Invalid_Argument); + + if ( GOTO_Table( TTAG_GPOS ) ) + return error; + + base_offset = FILE_Pos(); + + if ( ALLOC ( gpos, sizeof( *gpos ) ) ) + return error; + +#ifdef HB_SUPPORT_MULTIPLE_MASTER + gpos->mmfunc = default_mmfunc; +#endif + + /* skip version */ + + if ( FILE_Seek( base_offset + 4L ) || + ACCESS_Frame( 2L ) ) + goto Fail4; + + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = _HB_OPEN_Load_ScriptList( &gpos->ScriptList, + stream ) ) != HB_Err_Ok ) + goto Fail4; + (void)FILE_Seek( cur_offset ); + + if ( ACCESS_Frame( 2L ) ) + goto Fail3; + + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = _HB_OPEN_Load_FeatureList( &gpos->FeatureList, + stream ) ) != HB_Err_Ok ) + goto Fail3; + (void)FILE_Seek( cur_offset ); + + if ( ACCESS_Frame( 2L ) ) + goto Fail2; + + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = _HB_OPEN_Load_LookupList( &gpos->LookupList, + stream, HB_Type_GPOS ) ) != HB_Err_Ok ) + goto Fail2; + + gpos->gdef = gdef; /* can be NULL */ + + if ( ( error = _HB_GDEF_LoadMarkAttachClassDef_From_LookupFlags( gdef, gdefStream, + gpos->LookupList.Lookup, + gpos->LookupList.LookupCount ) ) ) + goto Fail1; + + *retptr = gpos; + + return HB_Err_Ok; + +Fail1: + _HB_OPEN_Free_LookupList( &gpos->LookupList, HB_Type_GPOS ); + +Fail2: + _HB_OPEN_Free_FeatureList( &gpos->FeatureList ); + +Fail3: + _HB_OPEN_Free_ScriptList( &gpos->ScriptList ); + +Fail4: + FREE( gpos ); + + return error; +} + + +HB_Error HB_Done_GPOS_Table( HB_GPOSHeader* gpos ) +{ + _HB_OPEN_Free_LookupList( &gpos->LookupList, HB_Type_GPOS ); + _HB_OPEN_Free_FeatureList( &gpos->FeatureList ); + _HB_OPEN_Free_ScriptList( &gpos->ScriptList ); + + FREE( gpos ); + + return HB_Err_Ok; +} + + +/***************************** + * SubTable related functions + *****************************/ + +/* shared tables */ + +/* ValueRecord */ + +/* There is a subtle difference in the specs between a `table' and a + `record' -- offsets for device tables in ValueRecords are taken from + the parent table and not the parent record. */ + +static HB_Error Load_ValueRecord( HB_ValueRecord* vr, + HB_UShort format, + HB_UInt base_offset, + HB_Stream stream ) +{ + HB_Error error; + + HB_UInt cur_offset, new_offset; + + + if ( format & HB_GPOS_FORMAT_HAVE_X_PLACEMENT ) + { + if ( ACCESS_Frame( 2L ) ) + return error; + + vr->XPlacement = GET_Short(); + + FORGET_Frame(); + } + else + vr->XPlacement = 0; + + if ( format & HB_GPOS_FORMAT_HAVE_Y_PLACEMENT ) + { + if ( ACCESS_Frame( 2L ) ) + return error; + + vr->YPlacement = GET_Short(); + + FORGET_Frame(); + } + else + vr->YPlacement = 0; + + if ( format & HB_GPOS_FORMAT_HAVE_X_ADVANCE ) + { + if ( ACCESS_Frame( 2L ) ) + return error; + + vr->XAdvance = GET_Short(); + + FORGET_Frame(); + } + else + vr->XAdvance = 0; + + if ( format & HB_GPOS_FORMAT_HAVE_Y_ADVANCE ) + { + if ( ACCESS_Frame( 2L ) ) + return error; + + vr->YAdvance = GET_Short(); + + FORGET_Frame(); + } + else + vr->YAdvance = 0; + + if ( format & HB_GPOS_FORMAT_HAVE_DEVICE_TABLES ) + { + if ( ALLOC_ARRAY( vr->DeviceTables, 4, HB_Device ) ) + return error; + vr->DeviceTables[VR_X_ADVANCE_DEVICE] = 0; + vr->DeviceTables[VR_Y_ADVANCE_DEVICE] = 0; + vr->DeviceTables[VR_X_PLACEMENT_DEVICE] = 0; + vr->DeviceTables[VR_Y_PLACEMENT_DEVICE] = 0; + } + else + { + vr->DeviceTables = 0; + } + + if ( format & HB_GPOS_FORMAT_HAVE_X_PLACEMENT_DEVICE ) + { + if ( ACCESS_Frame( 2L ) ) + goto Fail4; + + new_offset = GET_UShort(); + + FORGET_Frame(); + + if ( new_offset ) + { + new_offset += base_offset; + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = _HB_OPEN_Load_Device( &vr->DeviceTables[VR_X_PLACEMENT_DEVICE], + stream ) ) != HB_Err_Ok ) + goto Fail4; + (void)FILE_Seek( cur_offset ); + } + } + + if ( format & HB_GPOS_FORMAT_HAVE_Y_PLACEMENT_DEVICE ) + { + if ( ACCESS_Frame( 2L ) ) + goto Fail3; + + new_offset = GET_UShort(); + + FORGET_Frame(); + + if ( new_offset ) + { + new_offset += base_offset; + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = _HB_OPEN_Load_Device( &vr->DeviceTables[VR_Y_PLACEMENT_DEVICE], + stream ) ) != HB_Err_Ok ) + goto Fail3; + (void)FILE_Seek( cur_offset ); + } + } + + if ( format & HB_GPOS_FORMAT_HAVE_X_ADVANCE_DEVICE ) + { + if ( ACCESS_Frame( 2L ) ) + goto Fail2; + + new_offset = GET_UShort(); + + FORGET_Frame(); + + if ( new_offset ) + { + new_offset += base_offset; + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = _HB_OPEN_Load_Device( &vr->DeviceTables[VR_X_ADVANCE_DEVICE], + stream ) ) != HB_Err_Ok ) + goto Fail2; + (void)FILE_Seek( cur_offset ); + } + } + + if ( format & HB_GPOS_FORMAT_HAVE_Y_ADVANCE_DEVICE ) + { + if ( ACCESS_Frame( 2L ) ) + goto Fail1; + + new_offset = GET_UShort(); + + FORGET_Frame(); + + if ( new_offset ) + { + new_offset += base_offset; + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = _HB_OPEN_Load_Device( &vr->DeviceTables[VR_Y_ADVANCE_DEVICE], + stream ) ) != HB_Err_Ok ) + goto Fail1; + (void)FILE_Seek( cur_offset ); + } + } + + if ( format & HB_GPOS_FORMAT_HAVE_X_ID_PLACEMENT ) + { + if ( ACCESS_Frame( 2L ) ) + goto Fail1; + +#ifdef HB_SUPPORT_MULTIPLE_MASTER + vr->XIdPlacement = GET_UShort(); +#else + (void) GET_UShort(); +#endif + + FORGET_Frame(); + } +#ifdef HB_SUPPORT_MULTIPLE_MASTER + else + vr->XIdPlacement = 0; +#endif + + if ( format & HB_GPOS_FORMAT_HAVE_Y_ID_PLACEMENT ) + { + if ( ACCESS_Frame( 2L ) ) + goto Fail1; + +#ifdef HB_SUPPORT_MULTIPLE_MASTER + vr->YIdPlacement = GET_UShort(); +#else + (void) GET_UShort(); +#endif + + FORGET_Frame(); + } +#ifdef HB_SUPPORT_MULTIPLE_MASTER + else + vr->YIdPlacement = 0; +#endif + + if ( format & HB_GPOS_FORMAT_HAVE_X_ID_ADVANCE ) + { + if ( ACCESS_Frame( 2L ) ) + goto Fail1; + +#ifdef HB_SUPPORT_MULTIPLE_MASTER + vr->XIdAdvance = GET_UShort(); +#else + (void) GET_UShort(); +#endif + + FORGET_Frame(); + } +#ifdef HB_SUPPORT_MULTIPLE_MASTER + else + vr->XIdAdvance = 0; +#endif + + if ( format & HB_GPOS_FORMAT_HAVE_Y_ID_ADVANCE ) + { + if ( ACCESS_Frame( 2L ) ) + goto Fail1; + +#ifdef HB_SUPPORT_MULTIPLE_MASTER + vr->YIdAdvance = GET_UShort(); +#else + (void) GET_UShort(); +#endif + + FORGET_Frame(); + } +#ifdef HB_SUPPORT_MULTIPLE_MASTER + else + vr->YIdAdvance = 0; +#endif + + return HB_Err_Ok; + +Fail1: + if ( vr->DeviceTables ) + _HB_OPEN_Free_Device( vr->DeviceTables[VR_Y_ADVANCE_DEVICE] ); + +Fail2: + if ( vr->DeviceTables ) + _HB_OPEN_Free_Device( vr->DeviceTables[VR_X_ADVANCE_DEVICE] ); + +Fail3: + if ( vr->DeviceTables ) + _HB_OPEN_Free_Device( vr->DeviceTables[VR_Y_PLACEMENT_DEVICE] ); + +Fail4: + FREE( vr->DeviceTables ); + return error; +} + + +static void Free_ValueRecord( HB_ValueRecord* vr, + HB_UShort format ) +{ + if ( format & HB_GPOS_FORMAT_HAVE_Y_ADVANCE_DEVICE ) + _HB_OPEN_Free_Device( vr->DeviceTables[VR_Y_ADVANCE_DEVICE] ); + if ( format & HB_GPOS_FORMAT_HAVE_X_ADVANCE_DEVICE ) + _HB_OPEN_Free_Device( vr->DeviceTables[VR_X_ADVANCE_DEVICE] ); + if ( format & HB_GPOS_FORMAT_HAVE_Y_PLACEMENT_DEVICE ) + _HB_OPEN_Free_Device( vr->DeviceTables[VR_Y_PLACEMENT_DEVICE] ); + if ( format & HB_GPOS_FORMAT_HAVE_X_PLACEMENT_DEVICE ) + _HB_OPEN_Free_Device( vr->DeviceTables[VR_X_PLACEMENT_DEVICE] ); + FREE( vr->DeviceTables ); +} + + +static HB_Error Get_ValueRecord( GPOS_Instance* gpi, + HB_ValueRecord* vr, + HB_UShort format, + HB_Position gd ) +{ + HB_Short pixel_value; + HB_Error error = HB_Err_Ok; +#ifdef HB_SUPPORT_MULTIPLE_MASTER + HB_GPOSHeader* gpos = gpi->gpos; + HB_Fixed value; +#endif + + HB_UShort x_ppem, y_ppem; + HB_16Dot16 x_scale, y_scale; + + + if ( !format ) + return HB_Err_Ok; + + x_ppem = gpi->font->x_ppem; + y_ppem = gpi->font->y_ppem; + x_scale = gpi->font->x_scale; + y_scale = gpi->font->y_scale; + + /* design units -> fractional pixel */ + + if ( format & HB_GPOS_FORMAT_HAVE_X_PLACEMENT ) + gd->x_pos += x_scale * vr->XPlacement / 0x10000; + if ( format & HB_GPOS_FORMAT_HAVE_Y_PLACEMENT ) + gd->y_pos += y_scale * vr->YPlacement / 0x10000; + if ( format & HB_GPOS_FORMAT_HAVE_X_ADVANCE ) + gd->x_advance += x_scale * vr->XAdvance / 0x10000; + if ( format & HB_GPOS_FORMAT_HAVE_Y_ADVANCE ) + gd->y_advance += y_scale * vr->YAdvance / 0x10000; + + if ( !gpi->dvi ) + { + /* pixel -> fractional pixel */ + + if ( format & HB_GPOS_FORMAT_HAVE_X_PLACEMENT_DEVICE ) + { + _HB_OPEN_Get_Device( vr->DeviceTables[VR_X_PLACEMENT_DEVICE], x_ppem, &pixel_value ); + gd->x_pos += pixel_value << 6; + } + if ( format & HB_GPOS_FORMAT_HAVE_Y_PLACEMENT_DEVICE ) + { + _HB_OPEN_Get_Device( vr->DeviceTables[VR_Y_PLACEMENT_DEVICE], y_ppem, &pixel_value ); + gd->y_pos += pixel_value << 6; + } + if ( format & HB_GPOS_FORMAT_HAVE_X_ADVANCE_DEVICE ) + { + _HB_OPEN_Get_Device( vr->DeviceTables[VR_X_ADVANCE_DEVICE], x_ppem, &pixel_value ); + gd->x_advance += pixel_value << 6; + } + if ( format & HB_GPOS_FORMAT_HAVE_Y_ADVANCE_DEVICE ) + { + _HB_OPEN_Get_Device( vr->DeviceTables[VR_Y_ADVANCE_DEVICE], y_ppem, &pixel_value ); + gd->y_advance += pixel_value << 6; + } + } + +#ifdef HB_SUPPORT_MULTIPLE_MASTER + /* values returned from mmfunc() are already in fractional pixels */ + + if ( format & HB_GPOS_FORMAT_HAVE_X_ID_PLACEMENT ) + { + error = (gpos->mmfunc)( gpi->font, vr->XIdPlacement, + &value, gpos->data ); + if ( error ) + return error; + gd->x_pos += value; + } + if ( format & HB_GPOS_FORMAT_HAVE_Y_ID_PLACEMENT ) + { + error = (gpos->mmfunc)( gpi->font, vr->YIdPlacement, + &value, gpos->data ); + if ( error ) + return error; + gd->y_pos += value; + } + if ( format & HB_GPOS_FORMAT_HAVE_X_ID_ADVANCE ) + { + error = (gpos->mmfunc)( gpi->font, vr->XIdAdvance, + &value, gpos->data ); + if ( error ) + return error; + gd->x_advance += value; + } + if ( format & HB_GPOS_FORMAT_HAVE_Y_ID_ADVANCE ) + { + error = (gpos->mmfunc)( gpi->font, vr->YIdAdvance, + &value, gpos->data ); + if ( error ) + return error; + gd->y_advance += value; + } +#endif + + return error; +} + + +/* AnchorFormat1 */ +/* AnchorFormat2 */ +/* AnchorFormat3 */ +/* AnchorFormat4 */ + +static HB_Error Load_Anchor( HB_Anchor* an, + HB_Stream stream ) +{ + HB_Error error; + + HB_UInt cur_offset, new_offset, base_offset; + + + base_offset = FILE_Pos(); + + if ( ACCESS_Frame( 2L ) ) + return error; + + an->PosFormat = GET_UShort(); + + FORGET_Frame(); + + switch ( an->PosFormat ) + { + case 1: + if ( ACCESS_Frame( 4L ) ) + return error; + + an->af.af1.XCoordinate = GET_Short(); + an->af.af1.YCoordinate = GET_Short(); + + FORGET_Frame(); + break; + + case 2: + if ( ACCESS_Frame( 6L ) ) + return error; + + an->af.af2.XCoordinate = GET_Short(); + an->af.af2.YCoordinate = GET_Short(); + an->af.af2.AnchorPoint = GET_UShort(); + + FORGET_Frame(); + break; + + case 3: + if ( ACCESS_Frame( 6L ) ) + return error; + + an->af.af3.XCoordinate = GET_Short(); + an->af.af3.YCoordinate = GET_Short(); + + new_offset = GET_UShort(); + + FORGET_Frame(); + + if ( new_offset ) + { + if ( ALLOC_ARRAY( an->af.af3.DeviceTables, 2, HB_Device ) ) + return error; + + an->af.af3.DeviceTables[AF3_X_DEVICE_TABLE] = 0; + an->af.af3.DeviceTables[AF3_Y_DEVICE_TABLE] = 0; + + new_offset += base_offset; + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = _HB_OPEN_Load_Device( &an->af.af3.DeviceTables[AF3_X_DEVICE_TABLE], + stream ) ) != HB_Err_Ok ) + goto Fail2; + (void)FILE_Seek( cur_offset ); + } + + if ( ACCESS_Frame( 2L ) ) + goto Fail; + + new_offset = GET_UShort(); + + FORGET_Frame(); + + if ( new_offset ) + { + if ( !an->af.af3.DeviceTables ) + { + if ( ALLOC_ARRAY( an->af.af3.DeviceTables, 2, HB_Device ) ) + return error; + + an->af.af3.DeviceTables[AF3_X_DEVICE_TABLE] = 0; + an->af.af3.DeviceTables[AF3_Y_DEVICE_TABLE] = 0; + } + + new_offset += base_offset; + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = _HB_OPEN_Load_Device( &an->af.af3.DeviceTables[AF3_Y_DEVICE_TABLE], + stream ) ) != HB_Err_Ok ) + goto Fail; + (void)FILE_Seek( cur_offset ); + } + break; + + case 4: + if ( ACCESS_Frame( 4L ) ) + return error; + +#ifdef HB_SUPPORT_MULTIPLE_MASTER + an->af.af4.XIdAnchor = GET_UShort(); + an->af.af4.YIdAnchor = GET_UShort(); +#else + (void) GET_UShort(); + (void) GET_UShort(); +#endif + + FORGET_Frame(); + break; + + default: + return ERR(HB_Err_Invalid_SubTable_Format); + } + + return HB_Err_Ok; + +Fail: + if ( an->af.af3.DeviceTables ) + _HB_OPEN_Free_Device( an->af.af3.DeviceTables[AF3_X_DEVICE_TABLE] ); + +Fail2: + FREE( an->af.af3.DeviceTables ); + return error; +} + + +static void Free_Anchor( HB_Anchor* an) +{ + if ( an->PosFormat == 3 && an->af.af3.DeviceTables ) + { + _HB_OPEN_Free_Device( an->af.af3.DeviceTables[AF3_X_DEVICE_TABLE] ); + _HB_OPEN_Free_Device( an->af.af3.DeviceTables[AF3_Y_DEVICE_TABLE] ); + FREE( an->af.af3.DeviceTables ); + } +} + + +static HB_Error Get_Anchor( GPOS_Instance* gpi, + HB_Anchor* an, + HB_UShort glyph_index, + HB_Fixed* x_value, + HB_Fixed* y_value ) +{ + HB_Error error = HB_Err_Ok; + +#ifdef HB_SUPPORT_MULTIPLE_MASTER + HB_GPOSHeader* gpos = gpi->gpos; +#endif + HB_UShort ap; + + HB_Short pixel_value; + + HB_UShort x_ppem, y_ppem; + HB_16Dot16 x_scale, y_scale; + + + x_ppem = gpi->font->x_ppem; + y_ppem = gpi->font->y_ppem; + x_scale = gpi->font->x_scale; + y_scale = gpi->font->y_scale; + + switch ( an->PosFormat ) + { + case 0: + /* The special case of an empty AnchorTable */ + default: + + return HB_Err_Not_Covered; + + case 1: + *x_value = x_scale * an->af.af1.XCoordinate / 0x10000; + *y_value = y_scale * an->af.af1.YCoordinate / 0x10000; + break; + + case 2: + if ( !gpi->dvi ) + { + hb_uint32 n_points = 0; + ap = an->af.af2.AnchorPoint; + if (!gpi->font->klass->getPointInOutline) + goto no_contour_point; + error = gpi->font->klass->getPointInOutline(gpi->font, glyph_index, gpi->load_flags, ap, x_value, y_value, &n_points); + if (error) + return error; + /* if n_points is set to zero, we use the design coordinate value pair. + * This can happen e.g. for sbit glyphs. */ + if (!n_points) + goto no_contour_point; + } + else + { + no_contour_point: + *x_value = x_scale * an->af.af3.XCoordinate / 0x10000; + *y_value = y_scale * an->af.af3.YCoordinate / 0x10000; + } + break; + + case 3: + if ( !gpi->dvi ) + { + _HB_OPEN_Get_Device( an->af.af3.DeviceTables[AF3_X_DEVICE_TABLE], x_ppem, &pixel_value ); + *x_value = pixel_value << 6; + _HB_OPEN_Get_Device( an->af.af3.DeviceTables[AF3_Y_DEVICE_TABLE], y_ppem, &pixel_value ); + *y_value = pixel_value << 6; + } + else + *x_value = *y_value = 0; + + *x_value += x_scale * an->af.af3.XCoordinate / 0x10000; + *y_value += y_scale * an->af.af3.YCoordinate / 0x10000; + break; + + case 4: +#ifdef HB_SUPPORT_MULTIPLE_MASTER + error = (gpos->mmfunc)( gpi->font, an->af.af4.XIdAnchor, + x_value, gpos->data ); + if ( error ) + return error; + + error = (gpos->mmfunc)( gpi->font, an->af.af4.YIdAnchor, + y_value, gpos->data ); + if ( error ) + return error; + break; +#else + return ERR(HB_Err_Not_Covered); +#endif + } + + return error; +} + + +/* MarkArray */ + +static HB_Error Load_MarkArray ( HB_MarkArray* ma, + HB_Stream stream ) +{ + HB_Error error; + + HB_UShort n, m, count; + HB_UInt cur_offset, new_offset, base_offset; + + HB_MarkRecord* mr; + + + base_offset = FILE_Pos(); + + if ( ACCESS_Frame( 2L ) ) + return error; + + count = ma->MarkCount = GET_UShort(); + + FORGET_Frame(); + + ma->MarkRecord = NULL; + + if ( ALLOC_ARRAY( ma->MarkRecord, count, HB_MarkRecord ) ) + return error; + + mr = ma->MarkRecord; + + for ( n = 0; n < count; n++ ) + { + if ( ACCESS_Frame( 4L ) ) + goto Fail; + + mr[n].Class = GET_UShort(); + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = Load_Anchor( &mr[n].MarkAnchor, stream ) ) != HB_Err_Ok ) + goto Fail; + (void)FILE_Seek( cur_offset ); + } + + return HB_Err_Ok; + +Fail: + for ( m = 0; m < n; m++ ) + Free_Anchor( &mr[m].MarkAnchor ); + + FREE( mr ); + return error; +} + + +static void Free_MarkArray( HB_MarkArray* ma ) +{ + HB_UShort n, count; + + HB_MarkRecord* mr; + + + if ( ma->MarkRecord ) + { + count = ma->MarkCount; + mr = ma->MarkRecord; + + for ( n = 0; n < count; n++ ) + Free_Anchor( &mr[n].MarkAnchor ); + + FREE( mr ); + } +} + + +/* LookupType 1 */ + +/* SinglePosFormat1 */ +/* SinglePosFormat2 */ + +static HB_Error Load_SinglePos( HB_GPOS_SubTable* st, + HB_Stream stream ) +{ + HB_Error error; + HB_SinglePos* sp = &st->single; + + HB_UShort n, m, count, format; + HB_UInt cur_offset, new_offset, base_offset; + + HB_ValueRecord* vr; + + + base_offset = FILE_Pos(); + + if ( ACCESS_Frame( 6L ) ) + return error; + + sp->PosFormat = GET_UShort(); + new_offset = GET_UShort() + base_offset; + + format = sp->ValueFormat = GET_UShort(); + + FORGET_Frame(); + + if ( !format ) + return ERR(HB_Err_Invalid_SubTable); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = _HB_OPEN_Load_Coverage( &sp->Coverage, stream ) ) != HB_Err_Ok ) + return error; + (void)FILE_Seek( cur_offset ); + + switch ( sp->PosFormat ) + { + case 1: + error = Load_ValueRecord( &sp->spf.spf1.Value, format, + base_offset, stream ); + if ( error ) + goto Fail2; + break; + + case 2: + if ( ACCESS_Frame( 2L ) ) + goto Fail2; + + count = sp->spf.spf2.ValueCount = GET_UShort(); + + FORGET_Frame(); + + sp->spf.spf2.Value = NULL; + + if ( ALLOC_ARRAY( sp->spf.spf2.Value, count, HB_ValueRecord ) ) + goto Fail2; + + vr = sp->spf.spf2.Value; + + for ( n = 0; n < count; n++ ) + { + error = Load_ValueRecord( &vr[n], format, base_offset, stream ); + if ( error ) + goto Fail1; + } + break; + + default: + return ERR(HB_Err_Invalid_SubTable_Format); + } + + return HB_Err_Ok; + +Fail1: + for ( m = 0; m < n; m++ ) + Free_ValueRecord( &vr[m], format ); + + FREE( vr ); + +Fail2: + _HB_OPEN_Free_Coverage( &sp->Coverage ); + return error; +} + + +static void Free_SinglePos( HB_GPOS_SubTable* st ) +{ + HB_UShort n, count, format; + HB_SinglePos* sp = &st->single; + + HB_ValueRecord* v; + + + format = sp->ValueFormat; + + switch ( sp->PosFormat ) + { + case 1: + Free_ValueRecord( &sp->spf.spf1.Value, format ); + break; + + case 2: + if ( sp->spf.spf2.Value ) + { + count = sp->spf.spf2.ValueCount; + v = sp->spf.spf2.Value; + + for ( n = 0; n < count; n++ ) + Free_ValueRecord( &v[n], format ); + + FREE( v ); + } + break; + default: + break; + } + + _HB_OPEN_Free_Coverage( &sp->Coverage ); +} + +static HB_Error Lookup_SinglePos( GPOS_Instance* gpi, + HB_GPOS_SubTable* st, + HB_Buffer buffer, + HB_UShort flags, + HB_UShort context_length, + int nesting_level ) +{ + HB_UShort index, property; + HB_Error error; + HB_GPOSHeader* gpos = gpi->gpos; + HB_SinglePos* sp = &st->single; + + HB_UNUSED(nesting_level); + + if ( context_length != 0xFFFF && context_length < 1 ) + return HB_Err_Not_Covered; + + if ( CHECK_Property( gpos->gdef, IN_CURITEM(), flags, &property ) ) + return error; + + error = _HB_OPEN_Coverage_Index( &sp->Coverage, IN_CURGLYPH(), &index ); + if ( error ) + return error; + + switch ( sp->PosFormat ) + { + case 1: + error = Get_ValueRecord( gpi, &sp->spf.spf1.Value, + sp->ValueFormat, POSITION( buffer->in_pos ) ); + if ( error ) + return error; + break; + + case 2: + if ( index >= sp->spf.spf2.ValueCount ) + return ERR(HB_Err_Invalid_SubTable); + error = Get_ValueRecord( gpi, &sp->spf.spf2.Value[index], + sp->ValueFormat, POSITION( buffer->in_pos ) ); + if ( error ) + return error; + break; + + default: + return ERR(HB_Err_Invalid_SubTable); + } + + (buffer->in_pos)++; + + return HB_Err_Ok; +} + + +/* LookupType 2 */ + +/* PairSet */ + +static HB_Error Load_PairSet ( HB_PairSet* ps, + HB_UShort format1, + HB_UShort format2, + HB_Stream stream ) +{ + HB_Error error; + + HB_UShort n, m, count; + HB_UInt base_offset; + + HB_PairValueRecord* pvr; + + + base_offset = FILE_Pos(); + + if ( ACCESS_Frame( 2L ) ) + return error; + + count = ps->PairValueCount = GET_UShort(); + + FORGET_Frame(); + + ps->PairValueRecord = NULL; + + if ( ALLOC_ARRAY( ps->PairValueRecord, count, HB_PairValueRecord ) ) + return error; + + pvr = ps->PairValueRecord; + + for ( n = 0; n < count; n++ ) + { + if ( ACCESS_Frame( 2L ) ) + goto Fail; + + pvr[n].SecondGlyph = GET_UShort(); + + FORGET_Frame(); + + if ( format1 ) + { + error = Load_ValueRecord( &pvr[n].Value1, format1, + base_offset, stream ); + if ( error ) + goto Fail; + } + if ( format2 ) + { + error = Load_ValueRecord( &pvr[n].Value2, format2, + base_offset, stream ); + if ( error ) + { + if ( format1 ) + Free_ValueRecord( &pvr[n].Value1, format1 ); + goto Fail; + } + } + } + + return HB_Err_Ok; + +Fail: + for ( m = 0; m < n; m++ ) + { + if ( format1 ) + Free_ValueRecord( &pvr[m].Value1, format1 ); + if ( format2 ) + Free_ValueRecord( &pvr[m].Value2, format2 ); + } + + FREE( pvr ); + return error; +} + + +static void Free_PairSet( HB_PairSet* ps, + HB_UShort format1, + HB_UShort format2 ) +{ + HB_UShort n, count; + + HB_PairValueRecord* pvr; + + + if ( ps->PairValueRecord ) + { + count = ps->PairValueCount; + pvr = ps->PairValueRecord; + + for ( n = 0; n < count; n++ ) + { + if ( format1 ) + Free_ValueRecord( &pvr[n].Value1, format1 ); + if ( format2 ) + Free_ValueRecord( &pvr[n].Value2, format2 ); + } + + FREE( pvr ); + } +} + + +/* PairPosFormat1 */ + +static HB_Error Load_PairPos1( HB_PairPosFormat1* ppf1, + HB_UShort format1, + HB_UShort format2, + HB_Stream stream ) +{ + HB_Error error; + + HB_UShort n, m, count; + HB_UInt cur_offset, new_offset, base_offset; + + HB_PairSet* ps; + + + base_offset = FILE_Pos() - 8L; + + if ( ACCESS_Frame( 2L ) ) + return error; + + count = ppf1->PairSetCount = GET_UShort(); + + FORGET_Frame(); + + ppf1->PairSet = NULL; + + if ( ALLOC_ARRAY( ppf1->PairSet, count, HB_PairSet ) ) + return error; + + ps = ppf1->PairSet; + + for ( n = 0; n < count; n++ ) + { + if ( ACCESS_Frame( 2L ) ) + goto Fail; + + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = Load_PairSet( &ps[n], format1, + format2, stream ) ) != HB_Err_Ok ) + goto Fail; + (void)FILE_Seek( cur_offset ); + } + + return HB_Err_Ok; + +Fail: + for ( m = 0; m < n; m++ ) + Free_PairSet( &ps[m], format1, format2 ); + + FREE( ps ); + return error; +} + + +static void Free_PairPos1( HB_PairPosFormat1* ppf1, + HB_UShort format1, + HB_UShort format2 ) +{ + HB_UShort n, count; + + HB_PairSet* ps; + + + if ( ppf1->PairSet ) + { + count = ppf1->PairSetCount; + ps = ppf1->PairSet; + + for ( n = 0; n < count; n++ ) + Free_PairSet( &ps[n], format1, format2 ); + + FREE( ps ); + } +} + + +/* PairPosFormat2 */ + +static HB_Error Load_PairPos2( HB_PairPosFormat2* ppf2, + HB_UShort format1, + HB_UShort format2, + HB_Stream stream ) +{ + HB_Error error; + + HB_UShort m, n, k, count1, count2; + HB_UInt cur_offset, new_offset1, new_offset2, base_offset; + + HB_Class1Record* c1r; + HB_Class2Record* c2r; + + + base_offset = FILE_Pos() - 8L; + + if ( ACCESS_Frame( 8L ) ) + return error; + + new_offset1 = GET_UShort() + base_offset; + new_offset2 = GET_UShort() + base_offset; + + /* `Class1Count' and `Class2Count' are the upper limits for class + values, thus we read it now to make additional safety checks. */ + + count1 = ppf2->Class1Count = GET_UShort(); + count2 = ppf2->Class2Count = GET_UShort(); + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset1 ) || + ( error = _HB_OPEN_Load_ClassDefinition( &ppf2->ClassDef1, count1, + stream ) ) != HB_Err_Ok ) + return error; + if ( FILE_Seek( new_offset2 ) || + ( error = _HB_OPEN_Load_ClassDefinition( &ppf2->ClassDef2, count2, + stream ) ) != HB_Err_Ok ) + goto Fail3; + (void)FILE_Seek( cur_offset ); + + ppf2->Class1Record = NULL; + + if ( ALLOC_ARRAY( ppf2->Class1Record, count1, HB_Class1Record ) ) + goto Fail2; + + c1r = ppf2->Class1Record; + + for ( m = 0; m < count1; m++ ) + { + c1r[m].Class2Record = NULL; + + if ( ALLOC_ARRAY( c1r[m].Class2Record, count2, HB_Class2Record ) ) + goto Fail1; + + c2r = c1r[m].Class2Record; + + for ( n = 0; n < count2; n++ ) + { + if ( format1 ) + { + error = Load_ValueRecord( &c2r[n].Value1, format1, + base_offset, stream ); + if ( error ) + goto Fail0; + } + if ( format2 ) + { + error = Load_ValueRecord( &c2r[n].Value2, format2, + base_offset, stream ); + if ( error ) + { + if ( format1 ) + Free_ValueRecord( &c2r[n].Value1, format1 ); + goto Fail0; + } + } + } + + continue; + + Fail0: + for ( k = 0; k < n; k++ ) + { + if ( format1 ) + Free_ValueRecord( &c2r[k].Value1, format1 ); + if ( format2 ) + Free_ValueRecord( &c2r[k].Value2, format2 ); + } + goto Fail1; + } + + return HB_Err_Ok; + +Fail1: + for ( k = 0; k < m; k++ ) + { + c2r = c1r[k].Class2Record; + + for ( n = 0; n < count2; n++ ) + { + if ( format1 ) + Free_ValueRecord( &c2r[n].Value1, format1 ); + if ( format2 ) + Free_ValueRecord( &c2r[n].Value2, format2 ); + } + + FREE( c2r ); + } + + FREE( c1r ); +Fail2: + + _HB_OPEN_Free_ClassDefinition( &ppf2->ClassDef2 ); + +Fail3: + _HB_OPEN_Free_ClassDefinition( &ppf2->ClassDef1 ); + return error; +} + + +static void Free_PairPos2( HB_PairPosFormat2* ppf2, + HB_UShort format1, + HB_UShort format2) +{ + HB_UShort m, n, count1, count2; + + HB_Class1Record* c1r; + HB_Class2Record* c2r; + + + if ( ppf2->Class1Record ) + { + c1r = ppf2->Class1Record; + count1 = ppf2->Class1Count; + count2 = ppf2->Class2Count; + + for ( m = 0; m < count1; m++ ) + { + c2r = c1r[m].Class2Record; + + for ( n = 0; n < count2; n++ ) + { + if ( format1 ) + Free_ValueRecord( &c2r[n].Value1, format1 ); + if ( format2 ) + Free_ValueRecord( &c2r[n].Value2, format2 ); + } + + FREE( c2r ); + } + + FREE( c1r ); + + _HB_OPEN_Free_ClassDefinition( &ppf2->ClassDef2 ); + _HB_OPEN_Free_ClassDefinition( &ppf2->ClassDef1 ); + } +} + + +static HB_Error Load_PairPos( HB_GPOS_SubTable* st, + HB_Stream stream ) +{ + HB_Error error; + HB_PairPos* pp = &st->pair; + + HB_UShort format1, format2; + HB_UInt cur_offset, new_offset, base_offset; + + + base_offset = FILE_Pos(); + + if ( ACCESS_Frame( 8L ) ) + return error; + + pp->PosFormat = GET_UShort(); + new_offset = GET_UShort() + base_offset; + + format1 = pp->ValueFormat1 = GET_UShort(); + format2 = pp->ValueFormat2 = GET_UShort(); + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = _HB_OPEN_Load_Coverage( &pp->Coverage, stream ) ) != HB_Err_Ok ) + return error; + (void)FILE_Seek( cur_offset ); + + switch ( pp->PosFormat ) + { + case 1: + error = Load_PairPos1( &pp->ppf.ppf1, format1, format2, stream ); + if ( error ) + goto Fail; + break; + + case 2: + error = Load_PairPos2( &pp->ppf.ppf2, format1, format2, stream ); + if ( error ) + goto Fail; + break; + + default: + return ERR(HB_Err_Invalid_SubTable_Format); + } + + return HB_Err_Ok; + +Fail: + _HB_OPEN_Free_Coverage( &pp->Coverage ); + return error; +} + + +static void Free_PairPos( HB_GPOS_SubTable* st ) +{ + HB_UShort format1, format2; + HB_PairPos* pp = &st->pair; + + + format1 = pp->ValueFormat1; + format2 = pp->ValueFormat2; + + switch ( pp->PosFormat ) + { + case 1: + Free_PairPos1( &pp->ppf.ppf1, format1, format2 ); + break; + + case 2: + Free_PairPos2( &pp->ppf.ppf2, format1, format2 ); + break; + + default: + break; + } + + _HB_OPEN_Free_Coverage( &pp->Coverage ); +} + + +static HB_Error Lookup_PairPos1( GPOS_Instance* gpi, + HB_PairPosFormat1* ppf1, + HB_Buffer buffer, + HB_UInt first_pos, + HB_UShort index, + HB_UShort format1, + HB_UShort format2 ) +{ + HB_Error error; + HB_UShort numpvr, glyph2; + + HB_PairValueRecord* pvr; + + + if ( index >= ppf1->PairSetCount ) + return ERR(HB_Err_Invalid_SubTable); + + pvr = ppf1->PairSet[index].PairValueRecord; + if ( !pvr ) + return ERR(HB_Err_Invalid_SubTable); + + glyph2 = IN_CURGLYPH(); + + for ( numpvr = ppf1->PairSet[index].PairValueCount; + numpvr; + numpvr--, pvr++ ) + { + if ( glyph2 == pvr->SecondGlyph ) + { + error = Get_ValueRecord( gpi, &pvr->Value1, format1, + POSITION( first_pos ) ); + if ( error ) + return error; + return Get_ValueRecord( gpi, &pvr->Value2, format2, + POSITION( buffer->in_pos ) ); + } + } + + return HB_Err_Not_Covered; +} + + +static HB_Error Lookup_PairPos2( GPOS_Instance* gpi, + HB_PairPosFormat2* ppf2, + HB_Buffer buffer, + HB_UInt first_pos, + HB_UShort format1, + HB_UShort format2 ) +{ + HB_Error error; + HB_UShort cl1 = 0, cl2 = 0; /* shut compiler up */ + + HB_Class1Record* c1r; + HB_Class2Record* c2r; + + + error = _HB_OPEN_Get_Class( &ppf2->ClassDef1, IN_GLYPH( first_pos ), + &cl1, NULL ); + if ( error && error != HB_Err_Not_Covered ) + return error; + error = _HB_OPEN_Get_Class( &ppf2->ClassDef2, IN_CURGLYPH(), + &cl2, NULL ); + if ( error && error != HB_Err_Not_Covered ) + return error; + + c1r = &ppf2->Class1Record[cl1]; + if ( !c1r ) + return ERR(HB_Err_Invalid_SubTable); + c2r = &c1r->Class2Record[cl2]; + + error = Get_ValueRecord( gpi, &c2r->Value1, format1, POSITION( first_pos ) ); + if ( error ) + return error; + return Get_ValueRecord( gpi, &c2r->Value2, format2, POSITION( buffer->in_pos ) ); +} + + +static HB_Error Lookup_PairPos( GPOS_Instance* gpi, + HB_GPOS_SubTable* st, + HB_Buffer buffer, + HB_UShort flags, + HB_UShort context_length, + int nesting_level ) +{ + HB_Error error; + HB_UShort index, property; + HB_UInt first_pos; + HB_GPOSHeader* gpos = gpi->gpos; + HB_PairPos* pp = &st->pair; + + HB_UNUSED(nesting_level); + + if ( buffer->in_pos >= buffer->in_length - 1 ) + return HB_Err_Not_Covered; /* Not enough glyphs in stream */ + + if ( context_length != 0xFFFF && context_length < 2 ) + return HB_Err_Not_Covered; + + if ( CHECK_Property( gpos->gdef, IN_CURITEM(), flags, &property ) ) + return error; + + error = _HB_OPEN_Coverage_Index( &pp->Coverage, IN_CURGLYPH(), &index ); + if ( error ) + return error; + + /* second glyph */ + + first_pos = buffer->in_pos; + (buffer->in_pos)++; + + while ( CHECK_Property( gpos->gdef, IN_CURITEM(), + flags, &property ) ) + { + if ( error && error != HB_Err_Not_Covered ) + return error; + + if ( buffer->in_pos == buffer->in_length ) + { + buffer->in_pos = first_pos; + return HB_Err_Not_Covered; + } + (buffer->in_pos)++; + + } + + switch ( pp->PosFormat ) + { + case 1: + error = Lookup_PairPos1( gpi, &pp->ppf.ppf1, buffer, + first_pos, index, + pp->ValueFormat1, pp->ValueFormat2 ); + break; + + case 2: + error = Lookup_PairPos2( gpi, &pp->ppf.ppf2, buffer, first_pos, + pp->ValueFormat1, pp->ValueFormat2 ); + break; + + default: + return ERR(HB_Err_Invalid_SubTable_Format); + } + + /* if we don't have coverage for the second glyph don't skip it for + further lookups but reset in_pos back to the first_glyph and let + the caller in Do_String_Lookup increment in_pos */ + if ( error == HB_Err_Not_Covered ) + buffer->in_pos = first_pos; + + /* adjusting the `next' glyph */ + + if ( pp->ValueFormat2 ) + (buffer->in_pos)++; + + return error; +} + + +/* LookupType 3 */ + +/* CursivePosFormat1 */ + +static HB_Error Load_CursivePos( HB_GPOS_SubTable* st, + HB_Stream stream ) +{ + HB_Error error; + HB_CursivePos* cp = &st->cursive; + + HB_UShort n, m, count; + HB_UInt cur_offset, new_offset, base_offset; + + HB_EntryExitRecord* eer; + + + base_offset = FILE_Pos(); + + if ( ACCESS_Frame( 4L ) ) + return error; + + cp->PosFormat = GET_UShort(); + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = _HB_OPEN_Load_Coverage( &cp->Coverage, stream ) ) != HB_Err_Ok ) + return error; + (void)FILE_Seek( cur_offset ); + + if ( ACCESS_Frame( 2L ) ) + goto Fail2; + + count = cp->EntryExitCount = GET_UShort(); + + FORGET_Frame(); + + cp->EntryExitRecord = NULL; + + if ( ALLOC_ARRAY( cp->EntryExitRecord, count, HB_EntryExitRecord ) ) + goto Fail2; + + eer = cp->EntryExitRecord; + + for ( n = 0; n < count; n++ ) + { + HB_UInt entry_offset; + + if ( ACCESS_Frame( 2L ) ) + return error; + + entry_offset = new_offset = GET_UShort(); + + FORGET_Frame(); + + if ( new_offset ) + { + new_offset += base_offset; + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = Load_Anchor( &eer[n].EntryAnchor, + stream ) ) != HB_Err_Ok ) + goto Fail1; + (void)FILE_Seek( cur_offset ); + } + else + eer[n].EntryAnchor.PosFormat = 0; + + if ( ACCESS_Frame( 2L ) ) + return error; + + new_offset = GET_UShort(); + + FORGET_Frame(); + + if ( new_offset ) + { + new_offset += base_offset; + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = Load_Anchor( &eer[n].ExitAnchor, + stream ) ) != HB_Err_Ok ) + { + if ( entry_offset ) + Free_Anchor( &eer[n].EntryAnchor ); + goto Fail1; + } + (void)FILE_Seek( cur_offset ); + } + else + eer[n].ExitAnchor.PosFormat = 0; + } + + return HB_Err_Ok; + +Fail1: + for ( m = 0; m < n; m++ ) + { + Free_Anchor( &eer[m].EntryAnchor ); + Free_Anchor( &eer[m].ExitAnchor ); + } + + FREE( eer ); + +Fail2: + _HB_OPEN_Free_Coverage( &cp->Coverage ); + return error; +} + + +static void Free_CursivePos( HB_GPOS_SubTable* st ) +{ + HB_UShort n, count; + HB_CursivePos* cp = &st->cursive; + + HB_EntryExitRecord* eer; + + + if ( cp->EntryExitRecord ) + { + count = cp->EntryExitCount; + eer = cp->EntryExitRecord; + + for ( n = 0; n < count; n++ ) + { + Free_Anchor( &eer[n].EntryAnchor ); + Free_Anchor( &eer[n].ExitAnchor ); + } + + FREE( eer ); + } + + _HB_OPEN_Free_Coverage( &cp->Coverage ); +} + + +static HB_Error Lookup_CursivePos( GPOS_Instance* gpi, + HB_GPOS_SubTable* st, + HB_Buffer buffer, + HB_UShort flags, + HB_UShort context_length, + int nesting_level ) +{ + HB_UShort index, property; + HB_Error error; + HB_GPOSHeader* gpos = gpi->gpos; + HB_CursivePos* cp = &st->cursive; + + HB_EntryExitRecord* eer; + HB_Fixed entry_x, entry_y; + HB_Fixed exit_x, exit_y; + + HB_UNUSED(nesting_level); + + if ( context_length != 0xFFFF && context_length < 1 ) + { + gpi->last = 0xFFFF; + return HB_Err_Not_Covered; + } + + /* Glyphs not having the right GDEF properties will be ignored, i.e., + gpi->last won't be reset (contrary to user defined properties). */ + + if ( CHECK_Property( gpos->gdef, IN_CURITEM(), flags, &property ) ) + return error; + + /* We don't handle mark glyphs here. According to Andrei, this isn't + possible, but who knows... */ + + if ( property == HB_GDEF_MARK ) + { + gpi->last = 0xFFFF; + return HB_Err_Not_Covered; + } + + error = _HB_OPEN_Coverage_Index( &cp->Coverage, IN_CURGLYPH(), &index ); + if ( error ) + { + gpi->last = 0xFFFF; + return error; + } + + if ( index >= cp->EntryExitCount ) + return ERR(HB_Err_Invalid_SubTable); + + eer = &cp->EntryExitRecord[index]; + + /* Now comes the messiest part of the whole OpenType + specification. At first glance, cursive connections seem easy + to understand, but there are pitfalls! The reason is that + the specs don't mention how to compute the advance values + resp. glyph offsets. I was told it would be an omission, to + be fixed in the next OpenType version... Again many thanks to + Andrei Burago for clarifications. + + Consider the following example: + + | xadv1 | + +---------+ + | | + +-----+--+ 1 | + | | .| | + | 0+--+------+ + | 2 | + | | + 0+--------+ + | xadv2 | + + glyph1: advance width = 12 + anchor point = (3,1) + + glyph2: advance width = 11 + anchor point = (9,4) + + LSB is 1 for both glyphs (so the boxes drawn above are glyph + bboxes). Writing direction is R2L; `0' denotes the glyph's + coordinate origin. + + Now the surprising part: The advance width of the *left* glyph + (resp. of the *bottom* glyph) will be modified, no matter + whether the writing direction is L2R or R2L (resp. T2B or + B2T)! This assymetry is caused by the fact that the glyph's + coordinate origin is always the lower left corner for all + writing directions. + + Continuing the above example, we can compute the new + (horizontal) advance width of glyph2 as + + 9 - 3 = 6 , + + and the new vertical offset of glyph2 as + + 1 - 4 = -3 . + + + Vertical writing direction is far more complicated: + + a) Assuming that we recompute the advance height of the lower glyph: + + -- + +---------+ + -- | | + +-----+--+ 1 | yadv1 + | | .| | + yadv2 | 0+--+------+ -- BSB1 -- + | 2 | -- -- y_offset + | | + BSB2 -- 0+--------+ -- + -- -- + + glyph1: advance height = 6 + anchor point = (3,1) + + glyph2: advance height = 7 + anchor point = (9,4) + + TSB is 1 for both glyphs; writing direction is T2B. + + + BSB1 = yadv1 - (TSB1 + ymax1) + BSB2 = yadv2 - (TSB2 + ymax2) + y_offset = y2 - y1 + + vertical advance width of glyph2 + = y_offset + BSB2 - BSB1 + = (y2 - y1) + (yadv2 - (TSB2 + ymax2)) - (yadv1 - (TSB1 + ymax1)) + = y2 - y1 + yadv2 - TSB2 - ymax2 - (yadv1 - TSB1 - ymax1) + = y2 - y1 + yadv2 - TSB2 - ymax2 - yadv1 + TSB1 + ymax1 + + + b) Assuming that we recompute the advance height of the upper glyph: + + -- -- + +---------+ -- TSB1 + -- -- | | + TSB2 -- +-----+--+ 1 | yadv1 ymax1 + | | .| | + yadv2 | 0+--+------+ -- -- + ymax2 | 2 | -- y_offset + | | + -- 0+--------+ -- + -- + + glyph1: advance height = 6 + anchor point = (3,1) + + glyph2: advance height = 7 + anchor point = (9,4) + + TSB is 1 for both glyphs; writing direction is T2B. + + y_offset = y2 - y1 + + vertical advance width of glyph2 + = TSB1 + ymax1 + y_offset - (TSB2 + ymax2) + = TSB1 + ymax1 + y2 - y1 - TSB2 - ymax2 + + + Comparing a) with b) shows that b) is easier to compute. I'll wait + for a reply from Andrei to see what should really be implemented... + + Since horizontal advance widths or vertical advance heights + can be used alone but not together, no ambiguity occurs. */ + + if ( gpi->last == 0xFFFF ) + goto end; + + /* Get_Anchor() returns HB_Err_Not_Covered if there is no anchor + table. */ + + error = Get_Anchor( gpi, &eer->EntryAnchor, IN_CURGLYPH(), + &entry_x, &entry_y ); + if ( error == HB_Err_Not_Covered ) + goto end; + if ( error ) + return error; + + if ( gpi->r2l ) + { + POSITION( buffer->in_pos )->x_advance = entry_x - gpi->anchor_x; + POSITION( buffer->in_pos )->new_advance = TRUE; + } + else + { + POSITION( gpi->last )->x_advance = gpi->anchor_x - entry_x; + POSITION( gpi->last )->new_advance = TRUE; + } + + if ( flags & HB_LOOKUP_FLAG_RIGHT_TO_LEFT ) + { + POSITION( gpi->last )->cursive_chain = gpi->last - buffer->in_pos; + POSITION( gpi->last )->y_pos = entry_y - gpi->anchor_y; + } + else + { + POSITION( buffer->in_pos )->cursive_chain = buffer->in_pos - gpi->last; + POSITION( buffer->in_pos )->y_pos = gpi->anchor_y - entry_y; + } + +end: + error = Get_Anchor( gpi, &eer->ExitAnchor, IN_CURGLYPH(), + &exit_x, &exit_y ); + if ( error == HB_Err_Not_Covered ) + gpi->last = 0xFFFF; + else + { + gpi->last = buffer->in_pos; + gpi->anchor_x = exit_x; + gpi->anchor_y = exit_y; + } + if ( error ) + return error; + + (buffer->in_pos)++; + + return HB_Err_Ok; +} + + +/* LookupType 4 */ + +/* BaseArray */ + +static HB_Error Load_BaseArray( HB_BaseArray* ba, + HB_UShort num_classes, + HB_Stream stream ) +{ + HB_Error error; + + HB_UShort m, n, count; + HB_UInt cur_offset, new_offset, base_offset; + + HB_BaseRecord *br; + HB_Anchor *ban, *bans; + + + base_offset = FILE_Pos(); + + if ( ACCESS_Frame( 2L ) ) + return error; + + count = ba->BaseCount = GET_UShort(); + + FORGET_Frame(); + + ba->BaseRecord = NULL; + + if ( ALLOC_ARRAY( ba->BaseRecord, count, HB_BaseRecord ) ) + return error; + + br = ba->BaseRecord; + + bans = NULL; + + if ( ALLOC_ARRAY( bans, count * num_classes, HB_Anchor ) ) + goto Fail; + + for ( m = 0; m < count; m++ ) + { + br[m].BaseAnchor = NULL; + + ban = br[m].BaseAnchor = bans + m * num_classes; + + for ( n = 0; n < num_classes; n++ ) + { + if ( ACCESS_Frame( 2L ) ) + goto Fail; + + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + if (new_offset == base_offset) { + /* XXX + * Doulos SIL Regular is buggy and has zero offsets here. + * Skip it + */ + ban[n].PosFormat = 0; + continue; + } + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = Load_Anchor( &ban[n], stream ) ) != HB_Err_Ok ) + goto Fail; + (void)FILE_Seek( cur_offset ); + } + } + + return HB_Err_Ok; + +Fail: + FREE( bans ); + FREE( br ); + return error; +} + + +static void Free_BaseArray( HB_BaseArray* ba, + HB_UShort num_classes ) +{ + HB_BaseRecord *br; + HB_Anchor *bans; + + if ( ba->BaseRecord ) + { + br = ba->BaseRecord; + + if ( ba->BaseCount ) + { + HB_UShort i, count; + count = num_classes * ba->BaseCount; + bans = br[0].BaseAnchor; + for (i = 0; i < count; i++) + Free_Anchor (&bans[i]); + FREE( bans ); + } + + FREE( br ); + } +} + + +/* MarkBasePosFormat1 */ + +static HB_Error Load_MarkBasePos( HB_GPOS_SubTable* st, + HB_Stream stream ) +{ + HB_Error error; + HB_MarkBasePos* mbp = &st->markbase; + + HB_UInt cur_offset, new_offset, base_offset; + + + base_offset = FILE_Pos(); + + if ( ACCESS_Frame( 4L ) ) + return error; + + mbp->PosFormat = GET_UShort(); + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + if (mbp->PosFormat != 1) + return ERR(HB_Err_Invalid_SubTable_Format); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = _HB_OPEN_Load_Coverage( &mbp->MarkCoverage, stream ) ) != HB_Err_Ok ) + return error; + (void)FILE_Seek( cur_offset ); + + if ( ACCESS_Frame( 2L ) ) + goto Fail3; + + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = _HB_OPEN_Load_Coverage( &mbp->BaseCoverage, stream ) ) != HB_Err_Ok ) + goto Fail3; + (void)FILE_Seek( cur_offset ); + + if ( ACCESS_Frame( 4L ) ) + goto Fail2; + + mbp->ClassCount = GET_UShort(); + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = Load_MarkArray( &mbp->MarkArray, stream ) ) != HB_Err_Ok ) + goto Fail2; + (void)FILE_Seek( cur_offset ); + + if ( ACCESS_Frame( 2L ) ) + goto Fail1; + + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = Load_BaseArray( &mbp->BaseArray, mbp->ClassCount, + stream ) ) != HB_Err_Ok ) + goto Fail1; + + return HB_Err_Ok; + +Fail1: + Free_MarkArray( &mbp->MarkArray ); + +Fail2: + _HB_OPEN_Free_Coverage( &mbp->BaseCoverage ); + +Fail3: + _HB_OPEN_Free_Coverage( &mbp->MarkCoverage ); + return error; +} + + +static void Free_MarkBasePos( HB_GPOS_SubTable* st ) +{ + HB_MarkBasePos* mbp = &st->markbase; + + Free_BaseArray( &mbp->BaseArray, mbp->ClassCount ); + Free_MarkArray( &mbp->MarkArray ); + _HB_OPEN_Free_Coverage( &mbp->BaseCoverage ); + _HB_OPEN_Free_Coverage( &mbp->MarkCoverage ); +} + + +static HB_Error Lookup_MarkBasePos( GPOS_Instance* gpi, + HB_GPOS_SubTable* st, + HB_Buffer buffer, + HB_UShort flags, + HB_UShort context_length, + int nesting_level ) +{ + HB_UShort i, j, mark_index, base_index, property, class; + HB_Fixed x_mark_value, y_mark_value, x_base_value, y_base_value; + HB_Error error; + HB_GPOSHeader* gpos = gpi->gpos; + HB_MarkBasePos* mbp = &st->markbase; + + HB_MarkArray* ma; + HB_BaseArray* ba; + HB_BaseRecord* br; + HB_Anchor* mark_anchor; + HB_Anchor* base_anchor; + + HB_Position o; + + HB_UNUSED(nesting_level); + + if ( context_length != 0xFFFF && context_length < 1 ) + return HB_Err_Not_Covered; + + if ( flags & HB_LOOKUP_FLAG_IGNORE_BASE_GLYPHS ) + return HB_Err_Not_Covered; + + if ( CHECK_Property( gpos->gdef, IN_CURITEM(), + flags, &property ) ) + return error; + + error = _HB_OPEN_Coverage_Index( &mbp->MarkCoverage, IN_CURGLYPH(), + &mark_index ); + if ( error ) + return error; + + /* now we search backwards for a non-mark glyph */ + + i = 1; + j = buffer->in_pos - 1; + + while ( i <= buffer->in_pos ) + { + error = HB_GDEF_Get_Glyph_Property( gpos->gdef, IN_GLYPH( j ), + &property ); + if ( error ) + return error; + + if ( !( property == HB_GDEF_MARK || property & HB_LOOKUP_FLAG_IGNORE_SPECIAL_MARKS ) ) + break; + + i++; + j--; + } + + /* The following assertion is too strong -- at least for mangal.ttf. */ +#if 0 + if ( property != HB_GDEF_BASE_GLYPH ) + return HB_Err_Not_Covered; +#endif + + if ( i > buffer->in_pos ) + return HB_Err_Not_Covered; + + error = _HB_OPEN_Coverage_Index( &mbp->BaseCoverage, IN_GLYPH( j ), + &base_index ); + if ( error ) + return error; + + ma = &mbp->MarkArray; + + if ( mark_index >= ma->MarkCount ) + return ERR(HB_Err_Invalid_SubTable); + + class = ma->MarkRecord[mark_index].Class; + mark_anchor = &ma->MarkRecord[mark_index].MarkAnchor; + + if ( class >= mbp->ClassCount ) + return ERR(HB_Err_Invalid_SubTable); + + ba = &mbp->BaseArray; + + if ( base_index >= ba->BaseCount ) + return ERR(HB_Err_Invalid_SubTable); + + br = &ba->BaseRecord[base_index]; + base_anchor = &br->BaseAnchor[class]; + + error = Get_Anchor( gpi, mark_anchor, IN_CURGLYPH(), + &x_mark_value, &y_mark_value ); + if ( error ) + return error; + + error = Get_Anchor( gpi, base_anchor, IN_GLYPH( j ), + &x_base_value, &y_base_value ); + if ( error ) + return error; + + /* anchor points are not cumulative */ + + o = POSITION( buffer->in_pos ); + + o->x_pos = x_base_value - x_mark_value; + o->y_pos = y_base_value - y_mark_value; + o->x_advance = 0; + o->y_advance = 0; + o->back = i; + + (buffer->in_pos)++; + + return HB_Err_Ok; +} + + +/* LookupType 5 */ + +/* LigatureAttach */ + +static HB_Error Load_LigatureAttach( HB_LigatureAttach* lat, + HB_UShort num_classes, + HB_Stream stream ) +{ + HB_Error error; + + HB_UShort m, n, k, count; + HB_UInt cur_offset, new_offset, base_offset; + + HB_ComponentRecord* cr; + HB_Anchor* lan; + + + base_offset = FILE_Pos(); + + if ( ACCESS_Frame( 2L ) ) + return error; + + count = lat->ComponentCount = GET_UShort(); + + FORGET_Frame(); + + lat->ComponentRecord = NULL; + + if ( ALLOC_ARRAY( lat->ComponentRecord, count, HB_ComponentRecord ) ) + return error; + + cr = lat->ComponentRecord; + + for ( m = 0; m < count; m++ ) + { + cr[m].LigatureAnchor = NULL; + + if ( ALLOC_ARRAY( cr[m].LigatureAnchor, num_classes, HB_Anchor ) ) + goto Fail; + + lan = cr[m].LigatureAnchor; + + for ( n = 0; n < num_classes; n++ ) + { + if ( ACCESS_Frame( 2L ) ) + goto Fail0; + + new_offset = GET_UShort(); + + FORGET_Frame(); + + if ( new_offset ) + { + new_offset += base_offset; + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = Load_Anchor( &lan[n], stream ) ) != HB_Err_Ok ) + goto Fail0; + (void)FILE_Seek( cur_offset ); + } + else + lan[n].PosFormat = 0; + } + + continue; + Fail0: + for ( k = 0; k < n; k++ ) + Free_Anchor( &lan[k] ); + goto Fail; + } + + return HB_Err_Ok; + +Fail: + for ( k = 0; k < m; k++ ) + { + lan = cr[k].LigatureAnchor; + + for ( n = 0; n < num_classes; n++ ) + Free_Anchor( &lan[n] ); + + FREE( lan ); + } + + FREE( cr ); + return error; +} + + +static void Free_LigatureAttach( HB_LigatureAttach* lat, + HB_UShort num_classes ) +{ + HB_UShort m, n, count; + + HB_ComponentRecord* cr; + HB_Anchor* lan; + + + if ( lat->ComponentRecord ) + { + count = lat->ComponentCount; + cr = lat->ComponentRecord; + + for ( m = 0; m < count; m++ ) + { + lan = cr[m].LigatureAnchor; + + for ( n = 0; n < num_classes; n++ ) + Free_Anchor( &lan[n] ); + + FREE( lan ); + } + + FREE( cr ); + } +} + + +/* LigatureArray */ + +static HB_Error Load_LigatureArray( HB_LigatureArray* la, + HB_UShort num_classes, + HB_Stream stream ) +{ + HB_Error error; + + HB_UShort n, m, count; + HB_UInt cur_offset, new_offset, base_offset; + + HB_LigatureAttach* lat; + + + base_offset = FILE_Pos(); + + if ( ACCESS_Frame( 2L ) ) + return error; + + count = la->LigatureCount = GET_UShort(); + + FORGET_Frame(); + + la->LigatureAttach = NULL; + + if ( ALLOC_ARRAY( la->LigatureAttach, count, HB_LigatureAttach ) ) + return error; + + lat = la->LigatureAttach; + + for ( n = 0; n < count; n++ ) + { + if ( ACCESS_Frame( 2L ) ) + goto Fail; + + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = Load_LigatureAttach( &lat[n], num_classes, + stream ) ) != HB_Err_Ok ) + goto Fail; + (void)FILE_Seek( cur_offset ); + } + + return HB_Err_Ok; + +Fail: + for ( m = 0; m < n; m++ ) + Free_LigatureAttach( &lat[m], num_classes ); + + FREE( lat ); + return error; +} + + +static void Free_LigatureArray( HB_LigatureArray* la, + HB_UShort num_classes ) +{ + HB_UShort n, count; + + HB_LigatureAttach* lat; + + + if ( la->LigatureAttach ) + { + count = la->LigatureCount; + lat = la->LigatureAttach; + + for ( n = 0; n < count; n++ ) + Free_LigatureAttach( &lat[n], num_classes ); + + FREE( lat ); + } +} + + +/* MarkLigPosFormat1 */ + +static HB_Error Load_MarkLigPos( HB_GPOS_SubTable* st, + HB_Stream stream ) +{ + HB_Error error; + HB_MarkLigPos* mlp = &st->marklig; + + HB_UInt cur_offset, new_offset, base_offset; + + + base_offset = FILE_Pos(); + + if ( ACCESS_Frame( 4L ) ) + return error; + + mlp->PosFormat = GET_UShort(); + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = _HB_OPEN_Load_Coverage( &mlp->MarkCoverage, stream ) ) != HB_Err_Ok ) + return error; + (void)FILE_Seek( cur_offset ); + + if ( ACCESS_Frame( 2L ) ) + goto Fail3; + + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = _HB_OPEN_Load_Coverage( &mlp->LigatureCoverage, + stream ) ) != HB_Err_Ok ) + goto Fail3; + (void)FILE_Seek( cur_offset ); + + if ( ACCESS_Frame( 4L ) ) + goto Fail2; + + mlp->ClassCount = GET_UShort(); + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = Load_MarkArray( &mlp->MarkArray, stream ) ) != HB_Err_Ok ) + goto Fail2; + (void)FILE_Seek( cur_offset ); + + if ( ACCESS_Frame( 2L ) ) + goto Fail1; + + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = Load_LigatureArray( &mlp->LigatureArray, mlp->ClassCount, + stream ) ) != HB_Err_Ok ) + goto Fail1; + + return HB_Err_Ok; + +Fail1: + Free_MarkArray( &mlp->MarkArray ); + +Fail2: + _HB_OPEN_Free_Coverage( &mlp->LigatureCoverage ); + +Fail3: + _HB_OPEN_Free_Coverage( &mlp->MarkCoverage ); + return error; +} + + +static void Free_MarkLigPos( HB_GPOS_SubTable* st) +{ + HB_MarkLigPos* mlp = &st->marklig; + + Free_LigatureArray( &mlp->LigatureArray, mlp->ClassCount ); + Free_MarkArray( &mlp->MarkArray ); + _HB_OPEN_Free_Coverage( &mlp->LigatureCoverage ); + _HB_OPEN_Free_Coverage( &mlp->MarkCoverage ); +} + + +static HB_Error Lookup_MarkLigPos( GPOS_Instance* gpi, + HB_GPOS_SubTable* st, + HB_Buffer buffer, + HB_UShort flags, + HB_UShort context_length, + int nesting_level ) +{ + HB_UShort i, j, mark_index, lig_index, property, class; + HB_UShort mark_glyph; + HB_Fixed x_mark_value, y_mark_value, x_lig_value, y_lig_value; + HB_Error error; + HB_GPOSHeader* gpos = gpi->gpos; + HB_MarkLigPos* mlp = &st->marklig; + + HB_MarkArray* ma; + HB_LigatureArray* la; + HB_LigatureAttach* lat; + HB_ComponentRecord* cr; + HB_UShort comp_index; + HB_Anchor* mark_anchor; + HB_Anchor* lig_anchor; + + HB_Position o; + + HB_UNUSED(nesting_level); + + if ( context_length != 0xFFFF && context_length < 1 ) + return HB_Err_Not_Covered; + + if ( flags & HB_LOOKUP_FLAG_IGNORE_LIGATURES ) + return HB_Err_Not_Covered; + + mark_glyph = IN_CURGLYPH(); + + if ( CHECK_Property( gpos->gdef, IN_CURITEM(), flags, &property ) ) + return error; + + error = _HB_OPEN_Coverage_Index( &mlp->MarkCoverage, mark_glyph, &mark_index ); + if ( error ) + return error; + + /* now we search backwards for a non-mark glyph */ + + i = 1; + j = buffer->in_pos - 1; + + while ( i <= buffer->in_pos ) + { + error = HB_GDEF_Get_Glyph_Property( gpos->gdef, IN_GLYPH( j ), + &property ); + if ( error ) + return error; + + if ( !( property == HB_GDEF_MARK || property & HB_LOOKUP_FLAG_IGNORE_SPECIAL_MARKS ) ) + break; + + i++; + j--; + } + + /* Similar to Lookup_MarkBasePos(), I suspect that this assertion is + too strong, thus it is commented out. */ +#if 0 + if ( property != HB_GDEF_LIGATURE ) + return HB_Err_Not_Covered; +#endif + + if ( i > buffer->in_pos ) + return HB_Err_Not_Covered; + + error = _HB_OPEN_Coverage_Index( &mlp->LigatureCoverage, IN_GLYPH( j ), + &lig_index ); + if ( error ) + return error; + + ma = &mlp->MarkArray; + + if ( mark_index >= ma->MarkCount ) + return ERR(HB_Err_Invalid_SubTable); + + class = ma->MarkRecord[mark_index].Class; + mark_anchor = &ma->MarkRecord[mark_index].MarkAnchor; + + if ( class >= mlp->ClassCount ) + return ERR(HB_Err_Invalid_SubTable); + + la = &mlp->LigatureArray; + + if ( lig_index >= la->LigatureCount ) + return ERR(HB_Err_Invalid_SubTable); + + lat = &la->LigatureAttach[lig_index]; + + /* We must now check whether the ligature ID of the current mark glyph + is identical to the ligature ID of the found ligature. If yes, we + can directly use the component index. If not, we attach the mark + glyph to the last component of the ligature. */ + + if ( IN_LIGID( j ) == IN_LIGID( buffer->in_pos) ) + { + comp_index = IN_COMPONENT( buffer->in_pos ); + if ( comp_index >= lat->ComponentCount ) + return HB_Err_Not_Covered; + } + else + comp_index = lat->ComponentCount - 1; + + cr = &lat->ComponentRecord[comp_index]; + lig_anchor = &cr->LigatureAnchor[class]; + + error = Get_Anchor( gpi, mark_anchor, IN_CURGLYPH(), + &x_mark_value, &y_mark_value ); + if ( error ) + return error; + error = Get_Anchor( gpi, lig_anchor, IN_GLYPH( j ), + &x_lig_value, &y_lig_value ); + if ( error ) + return error; + + /* anchor points are not cumulative */ + + o = POSITION( buffer->in_pos ); + + o->x_pos = x_lig_value - x_mark_value; + o->y_pos = y_lig_value - y_mark_value; + o->x_advance = 0; + o->y_advance = 0; + o->back = i; + + (buffer->in_pos)++; + + return HB_Err_Ok; +} + + +/* LookupType 6 */ + +/* Mark2Array */ + +static HB_Error Load_Mark2Array( HB_Mark2Array* m2a, + HB_UShort num_classes, + HB_Stream stream ) +{ + HB_Error error; + + HB_UShort m, n, count; + HB_UInt cur_offset, new_offset, base_offset; + + HB_Mark2Record *m2r; + HB_Anchor *m2an, *m2ans; + + + base_offset = FILE_Pos(); + + if ( ACCESS_Frame( 2L ) ) + return error; + + count = m2a->Mark2Count = GET_UShort(); + + FORGET_Frame(); + + m2a->Mark2Record = NULL; + + if ( ALLOC_ARRAY( m2a->Mark2Record, count, HB_Mark2Record ) ) + return error; + + m2r = m2a->Mark2Record; + + m2ans = NULL; + + if ( ALLOC_ARRAY( m2ans, count * num_classes, HB_Anchor ) ) + goto Fail; + + for ( m = 0; m < count; m++ ) + { + m2an = m2r[m].Mark2Anchor = m2ans + m * num_classes; + + for ( n = 0; n < num_classes; n++ ) + { + if ( ACCESS_Frame( 2L ) ) + goto Fail; + + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + if (new_offset == base_offset) { + /* Anchor table not provided. Skip loading. + * Some versions of FreeSans hit this. */ + m2an[n].PosFormat = 0; + continue; + } + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = Load_Anchor( &m2an[n], stream ) ) != HB_Err_Ok ) + goto Fail; + (void)FILE_Seek( cur_offset ); + } + } + + return HB_Err_Ok; + +Fail: + FREE( m2ans ); + FREE( m2r ); + return error; +} + + +static void Free_Mark2Array( HB_Mark2Array* m2a, + HB_UShort num_classes ) +{ + HB_Mark2Record *m2r; + HB_Anchor *m2ans; + + HB_UNUSED(num_classes); + + if ( m2a->Mark2Record ) + { + m2r = m2a->Mark2Record; + + if ( m2a->Mark2Count ) + { + m2ans = m2r[0].Mark2Anchor; + FREE( m2ans ); + } + + FREE( m2r ); + } +} + + +/* MarkMarkPosFormat1 */ + +static HB_Error Load_MarkMarkPos( HB_GPOS_SubTable* st, + HB_Stream stream ) +{ + HB_Error error; + HB_MarkMarkPos* mmp = &st->markmark; + + HB_UInt cur_offset, new_offset, base_offset; + + + base_offset = FILE_Pos(); + + if ( ACCESS_Frame( 4L ) ) + return error; + + mmp->PosFormat = GET_UShort(); + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = _HB_OPEN_Load_Coverage( &mmp->Mark1Coverage, + stream ) ) != HB_Err_Ok ) + return error; + (void)FILE_Seek( cur_offset ); + + if ( ACCESS_Frame( 2L ) ) + goto Fail3; + + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = _HB_OPEN_Load_Coverage( &mmp->Mark2Coverage, + stream ) ) != HB_Err_Ok ) + goto Fail3; + (void)FILE_Seek( cur_offset ); + + if ( ACCESS_Frame( 4L ) ) + goto Fail2; + + mmp->ClassCount = GET_UShort(); + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = Load_MarkArray( &mmp->Mark1Array, stream ) ) != HB_Err_Ok ) + goto Fail2; + (void)FILE_Seek( cur_offset ); + + if ( ACCESS_Frame( 2L ) ) + goto Fail1; + + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = Load_Mark2Array( &mmp->Mark2Array, mmp->ClassCount, + stream ) ) != HB_Err_Ok ) + goto Fail1; + + return HB_Err_Ok; + +Fail1: + Free_MarkArray( &mmp->Mark1Array ); + +Fail2: + _HB_OPEN_Free_Coverage( &mmp->Mark2Coverage ); + +Fail3: + _HB_OPEN_Free_Coverage( &mmp->Mark1Coverage ); + return error; +} + + +static void Free_MarkMarkPos( HB_GPOS_SubTable* st) +{ + HB_MarkMarkPos* mmp = &st->markmark; + + Free_Mark2Array( &mmp->Mark2Array, mmp->ClassCount ); + Free_MarkArray( &mmp->Mark1Array ); + _HB_OPEN_Free_Coverage( &mmp->Mark2Coverage ); + _HB_OPEN_Free_Coverage( &mmp->Mark1Coverage ); +} + + +static HB_Error Lookup_MarkMarkPos( GPOS_Instance* gpi, + HB_GPOS_SubTable* st, + HB_Buffer buffer, + HB_UShort flags, + HB_UShort context_length, + int nesting_level ) +{ + HB_UShort i, j, mark1_index, mark2_index, property, class; + HB_Fixed x_mark1_value, y_mark1_value, + x_mark2_value, y_mark2_value; + HB_Error error; + HB_GPOSHeader* gpos = gpi->gpos; + HB_MarkMarkPos* mmp = &st->markmark; + + HB_MarkArray* ma1; + HB_Mark2Array* ma2; + HB_Mark2Record* m2r; + HB_Anchor* mark1_anchor; + HB_Anchor* mark2_anchor; + + HB_Position o; + + HB_UNUSED(nesting_level); + + if ( context_length != 0xFFFF && context_length < 1 ) + return HB_Err_Not_Covered; + + if ( flags & HB_LOOKUP_FLAG_IGNORE_MARKS ) + return HB_Err_Not_Covered; + + if ( CHECK_Property( gpos->gdef, IN_CURITEM(), + flags, &property ) ) + return error; + + error = _HB_OPEN_Coverage_Index( &mmp->Mark1Coverage, IN_CURGLYPH(), + &mark1_index ); + if ( error ) + return error; + + /* now we search backwards for a suitable mark glyph until a non-mark + glyph */ + + if ( buffer->in_pos == 0 ) + return HB_Err_Not_Covered; + + i = 1; + j = buffer->in_pos - 1; + while ( i <= buffer->in_pos ) + { + error = HB_GDEF_Get_Glyph_Property( gpos->gdef, IN_GLYPH( j ), + &property ); + if ( error ) + return error; + + if ( !( property == HB_GDEF_MARK || property & HB_LOOKUP_FLAG_IGNORE_SPECIAL_MARKS ) ) + return HB_Err_Not_Covered; + + if ( flags & HB_LOOKUP_FLAG_IGNORE_SPECIAL_MARKS ) + { + if ( property == (flags & 0xFF00) ) + break; + } + else + break; + + i++; + j--; + } + + error = _HB_OPEN_Coverage_Index( &mmp->Mark2Coverage, IN_GLYPH( j ), + &mark2_index ); + if ( error ) + return error; + + ma1 = &mmp->Mark1Array; + + if ( mark1_index >= ma1->MarkCount ) + return ERR(HB_Err_Invalid_SubTable); + + class = ma1->MarkRecord[mark1_index].Class; + mark1_anchor = &ma1->MarkRecord[mark1_index].MarkAnchor; + + if ( class >= mmp->ClassCount ) + return ERR(HB_Err_Invalid_SubTable); + + ma2 = &mmp->Mark2Array; + + if ( mark2_index >= ma2->Mark2Count ) + return ERR(HB_Err_Invalid_SubTable); + + m2r = &ma2->Mark2Record[mark2_index]; + mark2_anchor = &m2r->Mark2Anchor[class]; + + error = Get_Anchor( gpi, mark1_anchor, IN_CURGLYPH(), + &x_mark1_value, &y_mark1_value ); + if ( error ) + return error; + error = Get_Anchor( gpi, mark2_anchor, IN_GLYPH( j ), + &x_mark2_value, &y_mark2_value ); + if ( error ) + return error; + + /* anchor points are not cumulative */ + + o = POSITION( buffer->in_pos ); + + o->x_pos = x_mark2_value - x_mark1_value; + o->y_pos = y_mark2_value - y_mark1_value; + o->x_advance = 0; + o->y_advance = 0; + o->back = 1; + + (buffer->in_pos)++; + + return HB_Err_Ok; +} + + +/* Do the actual positioning for a context positioning (either format + 7 or 8). This is only called after we've determined that the stream + matches the subrule. */ + +static HB_Error Do_ContextPos( GPOS_Instance* gpi, + HB_UShort GlyphCount, + HB_UShort PosCount, + HB_PosLookupRecord* pos, + HB_Buffer buffer, + int nesting_level ) +{ + HB_Error error; + HB_UInt i, old_pos; + + + i = 0; + + while ( i < GlyphCount ) + { + if ( PosCount && i == pos->SequenceIndex ) + { + old_pos = buffer->in_pos; + + /* Do a positioning */ + + error = GPOS_Do_Glyph_Lookup( gpi, pos->LookupListIndex, buffer, + GlyphCount, nesting_level ); + + if ( error ) + return error; + + pos++; + PosCount--; + i += buffer->in_pos - old_pos; + } + else + { + i++; + (buffer->in_pos)++; + } + } + + return HB_Err_Ok; +} + + +/* LookupType 7 */ + +/* PosRule */ + +static HB_Error Load_PosRule( HB_PosRule* pr, + HB_Stream stream ) +{ + HB_Error error; + + HB_UShort n, count; + HB_UShort* i; + + HB_PosLookupRecord* plr; + + + if ( ACCESS_Frame( 4L ) ) + return error; + + pr->GlyphCount = GET_UShort(); + pr->PosCount = GET_UShort(); + + FORGET_Frame(); + + pr->Input = NULL; + + count = pr->GlyphCount - 1; /* only GlyphCount - 1 elements */ + + if ( ALLOC_ARRAY( pr->Input, count, HB_UShort ) ) + return error; + + i = pr->Input; + + if ( ACCESS_Frame( count * 2L ) ) + goto Fail2; + + for ( n = 0; n < count; n++ ) + i[n] = GET_UShort(); + + FORGET_Frame(); + + pr->PosLookupRecord = NULL; + + count = pr->PosCount; + + if ( ALLOC_ARRAY( pr->PosLookupRecord, count, HB_PosLookupRecord ) ) + goto Fail2; + + plr = pr->PosLookupRecord; + + if ( ACCESS_Frame( count * 4L ) ) + goto Fail1; + + for ( n = 0; n < count; n++ ) + { + plr[n].SequenceIndex = GET_UShort(); + plr[n].LookupListIndex = GET_UShort(); + } + + FORGET_Frame(); + + return HB_Err_Ok; + +Fail1: + FREE( plr ); + +Fail2: + FREE( i ); + return error; +} + + +static void Free_PosRule( HB_PosRule* pr ) +{ + FREE( pr->PosLookupRecord ); + FREE( pr->Input ); +} + + +/* PosRuleSet */ + +static HB_Error Load_PosRuleSet( HB_PosRuleSet* prs, + HB_Stream stream ) +{ + HB_Error error; + + HB_UShort n, m, count; + HB_UInt cur_offset, new_offset, base_offset; + + HB_PosRule* pr; + + + base_offset = FILE_Pos(); + + if ( ACCESS_Frame( 2L ) ) + return error; + + count = prs->PosRuleCount = GET_UShort(); + + FORGET_Frame(); + + prs->PosRule = NULL; + + if ( ALLOC_ARRAY( prs->PosRule, count, HB_PosRule ) ) + return error; + + pr = prs->PosRule; + + for ( n = 0; n < count; n++ ) + { + if ( ACCESS_Frame( 2L ) ) + goto Fail; + + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = Load_PosRule( &pr[n], stream ) ) != HB_Err_Ok ) + goto Fail; + (void)FILE_Seek( cur_offset ); + } + + return HB_Err_Ok; + +Fail: + for ( m = 0; m < n; m++ ) + Free_PosRule( &pr[m] ); + + FREE( pr ); + return error; +} + + +static void Free_PosRuleSet( HB_PosRuleSet* prs ) +{ + HB_UShort n, count; + + HB_PosRule* pr; + + + if ( prs->PosRule ) + { + count = prs->PosRuleCount; + pr = prs->PosRule; + + for ( n = 0; n < count; n++ ) + Free_PosRule( &pr[n] ); + + FREE( pr ); + } +} + + +/* ContextPosFormat1 */ + +static HB_Error Load_ContextPos1( HB_ContextPosFormat1* cpf1, + HB_Stream stream ) +{ + HB_Error error; + + HB_UShort n, m, count; + HB_UInt cur_offset, new_offset, base_offset; + + HB_PosRuleSet* prs; + + + base_offset = FILE_Pos() - 2L; + + if ( ACCESS_Frame( 2L ) ) + return error; + + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = _HB_OPEN_Load_Coverage( &cpf1->Coverage, stream ) ) != HB_Err_Ok ) + return error; + (void)FILE_Seek( cur_offset ); + + if ( ACCESS_Frame( 2L ) ) + goto Fail2; + + count = cpf1->PosRuleSetCount = GET_UShort(); + + FORGET_Frame(); + + cpf1->PosRuleSet = NULL; + + if ( ALLOC_ARRAY( cpf1->PosRuleSet, count, HB_PosRuleSet ) ) + goto Fail2; + + prs = cpf1->PosRuleSet; + + for ( n = 0; n < count; n++ ) + { + if ( ACCESS_Frame( 2L ) ) + goto Fail1; + + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = Load_PosRuleSet( &prs[n], stream ) ) != HB_Err_Ok ) + goto Fail1; + (void)FILE_Seek( cur_offset ); + } + + return HB_Err_Ok; + +Fail1: + for ( m = 0; m < n; m++ ) + Free_PosRuleSet( &prs[m] ); + + FREE( prs ); + +Fail2: + _HB_OPEN_Free_Coverage( &cpf1->Coverage ); + return error; +} + + +static void Free_ContextPos1( HB_ContextPosFormat1* cpf1 ) +{ + HB_UShort n, count; + + HB_PosRuleSet* prs; + + + if ( cpf1->PosRuleSet ) + { + count = cpf1->PosRuleSetCount; + prs = cpf1->PosRuleSet; + + for ( n = 0; n < count; n++ ) + Free_PosRuleSet( &prs[n] ); + + FREE( prs ); + } + + _HB_OPEN_Free_Coverage( &cpf1->Coverage ); +} + + +/* PosClassRule */ + +static HB_Error Load_PosClassRule( HB_ContextPosFormat2* cpf2, + HB_PosClassRule* pcr, + HB_Stream stream ) +{ + HB_Error error; + + HB_UShort n, count; + + HB_UShort* c; + HB_PosLookupRecord* plr; + + + if ( ACCESS_Frame( 4L ) ) + return error; + + pcr->GlyphCount = GET_UShort(); + pcr->PosCount = GET_UShort(); + + FORGET_Frame(); + + if ( pcr->GlyphCount > cpf2->MaxContextLength ) + cpf2->MaxContextLength = pcr->GlyphCount; + + pcr->Class = NULL; + + count = pcr->GlyphCount - 1; /* only GlyphCount - 1 elements */ + + if ( ALLOC_ARRAY( pcr->Class, count, HB_UShort ) ) + return error; + + c = pcr->Class; + + if ( ACCESS_Frame( count * 2L ) ) + goto Fail2; + + for ( n = 0; n < count; n++ ) + c[n] = GET_UShort(); + + FORGET_Frame(); + + pcr->PosLookupRecord = NULL; + + count = pcr->PosCount; + + if ( ALLOC_ARRAY( pcr->PosLookupRecord, count, HB_PosLookupRecord ) ) + goto Fail2; + + plr = pcr->PosLookupRecord; + + if ( ACCESS_Frame( count * 4L ) ) + goto Fail1; + + for ( n = 0; n < count; n++ ) + { + plr[n].SequenceIndex = GET_UShort(); + plr[n].LookupListIndex = GET_UShort(); + } + + FORGET_Frame(); + + return HB_Err_Ok; + +Fail1: + FREE( plr ); + +Fail2: + FREE( c ); + return error; +} + + +static void Free_PosClassRule( HB_PosClassRule* pcr ) +{ + FREE( pcr->PosLookupRecord ); + FREE( pcr->Class ); +} + + +/* PosClassSet */ + +static HB_Error Load_PosClassSet( HB_ContextPosFormat2* cpf2, + HB_PosClassSet* pcs, + HB_Stream stream ) +{ + HB_Error error; + + HB_UShort n, m, count; + HB_UInt cur_offset, new_offset, base_offset; + + HB_PosClassRule* pcr; + + + base_offset = FILE_Pos(); + + if ( ACCESS_Frame( 2L ) ) + return error; + + count = pcs->PosClassRuleCount = GET_UShort(); + + FORGET_Frame(); + + pcs->PosClassRule = NULL; + + if ( ALLOC_ARRAY( pcs->PosClassRule, count, HB_PosClassRule ) ) + return error; + + pcr = pcs->PosClassRule; + + for ( n = 0; n < count; n++ ) + { + if ( ACCESS_Frame( 2L ) ) + goto Fail; + + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = Load_PosClassRule( cpf2, &pcr[n], + stream ) ) != HB_Err_Ok ) + goto Fail; + (void)FILE_Seek( cur_offset ); + } + + return HB_Err_Ok; + +Fail: + for ( m = 0; m < n; m++ ) + Free_PosClassRule( &pcr[m] ); + + FREE( pcr ); + return error; +} + + +static void Free_PosClassSet( HB_PosClassSet* pcs ) +{ + HB_UShort n, count; + + HB_PosClassRule* pcr; + + + if ( pcs->PosClassRule ) + { + count = pcs->PosClassRuleCount; + pcr = pcs->PosClassRule; + + for ( n = 0; n < count; n++ ) + Free_PosClassRule( &pcr[n] ); + + FREE( pcr ); + } +} + + +/* ContextPosFormat2 */ + +static HB_Error Load_ContextPos2( HB_ContextPosFormat2* cpf2, + HB_Stream stream ) +{ + HB_Error error; + + HB_UShort n, m, count; + HB_UInt cur_offset, new_offset, base_offset; + + HB_PosClassSet* pcs; + + + base_offset = FILE_Pos() - 2; + + if ( ACCESS_Frame( 2L ) ) + return error; + + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = _HB_OPEN_Load_Coverage( &cpf2->Coverage, stream ) ) != HB_Err_Ok ) + return error; + (void)FILE_Seek( cur_offset ); + + if ( ACCESS_Frame( 4L ) ) + goto Fail3; + + new_offset = GET_UShort() + base_offset; + + /* `PosClassSetCount' is the upper limit for class values, thus we + read it now to make an additional safety check. */ + + count = cpf2->PosClassSetCount = GET_UShort(); + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = _HB_OPEN_Load_ClassDefinition( &cpf2->ClassDef, count, + stream ) ) != HB_Err_Ok ) + goto Fail3; + (void)FILE_Seek( cur_offset ); + + cpf2->PosClassSet = NULL; + cpf2->MaxContextLength = 0; + + if ( ALLOC_ARRAY( cpf2->PosClassSet, count, HB_PosClassSet ) ) + goto Fail2; + + pcs = cpf2->PosClassSet; + + for ( n = 0; n < count; n++ ) + { + if ( ACCESS_Frame( 2L ) ) + goto Fail1; + + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + if ( new_offset != base_offset ) /* not a NULL offset */ + { + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = Load_PosClassSet( cpf2, &pcs[n], + stream ) ) != HB_Err_Ok ) + goto Fail1; + (void)FILE_Seek( cur_offset ); + } + else + { + /* we create a PosClassSet table with no entries */ + + cpf2->PosClassSet[n].PosClassRuleCount = 0; + cpf2->PosClassSet[n].PosClassRule = NULL; + } + } + + return HB_Err_Ok; + +Fail1: + for ( m = 0; m < n; n++ ) + Free_PosClassSet( &pcs[m] ); + + FREE( pcs ); + +Fail2: + _HB_OPEN_Free_ClassDefinition( &cpf2->ClassDef ); + +Fail3: + _HB_OPEN_Free_Coverage( &cpf2->Coverage ); + return error; +} + + +static void Free_ContextPos2( HB_ContextPosFormat2* cpf2 ) +{ + HB_UShort n, count; + + HB_PosClassSet* pcs; + + + if ( cpf2->PosClassSet ) + { + count = cpf2->PosClassSetCount; + pcs = cpf2->PosClassSet; + + for ( n = 0; n < count; n++ ) + Free_PosClassSet( &pcs[n] ); + + FREE( pcs ); + } + + _HB_OPEN_Free_ClassDefinition( &cpf2->ClassDef ); + _HB_OPEN_Free_Coverage( &cpf2->Coverage ); +} + + +/* ContextPosFormat3 */ + +static HB_Error Load_ContextPos3( HB_ContextPosFormat3* cpf3, + HB_Stream stream ) +{ + HB_Error error; + + HB_UShort n, count; + HB_UInt cur_offset, new_offset, base_offset; + + HB_Coverage* c; + HB_PosLookupRecord* plr; + + + base_offset = FILE_Pos() - 2L; + + if ( ACCESS_Frame( 4L ) ) + return error; + + cpf3->GlyphCount = GET_UShort(); + cpf3->PosCount = GET_UShort(); + + FORGET_Frame(); + + cpf3->Coverage = NULL; + + count = cpf3->GlyphCount; + + if ( ALLOC_ARRAY( cpf3->Coverage, count, HB_Coverage ) ) + return error; + + c = cpf3->Coverage; + + for ( n = 0; n < count; n++ ) + { + if ( ACCESS_Frame( 2L ) ) + goto Fail2; + + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = _HB_OPEN_Load_Coverage( &c[n], stream ) ) != HB_Err_Ok ) + goto Fail2; + (void)FILE_Seek( cur_offset ); + } + + cpf3->PosLookupRecord = NULL; + + count = cpf3->PosCount; + + if ( ALLOC_ARRAY( cpf3->PosLookupRecord, count, HB_PosLookupRecord ) ) + goto Fail2; + + plr = cpf3->PosLookupRecord; + + if ( ACCESS_Frame( count * 4L ) ) + goto Fail1; + + for ( n = 0; n < count; n++ ) + { + plr[n].SequenceIndex = GET_UShort(); + plr[n].LookupListIndex = GET_UShort(); + } + + FORGET_Frame(); + + return HB_Err_Ok; + +Fail1: + FREE( plr ); + +Fail2: + for ( n = 0; n < count; n++ ) + _HB_OPEN_Free_Coverage( &c[n] ); + + FREE( c ); + return error; +} + + +static void Free_ContextPos3( HB_ContextPosFormat3* cpf3 ) +{ + HB_UShort n, count; + + HB_Coverage* c; + + + FREE( cpf3->PosLookupRecord ); + + if ( cpf3->Coverage ) + { + count = cpf3->GlyphCount; + c = cpf3->Coverage; + + for ( n = 0; n < count; n++ ) + _HB_OPEN_Free_Coverage( &c[n] ); + + FREE( c ); + } +} + + +/* ContextPos */ + +static HB_Error Load_ContextPos( HB_GPOS_SubTable* st, + HB_Stream stream ) +{ + HB_Error error; + HB_ContextPos* cp = &st->context; + + + if ( ACCESS_Frame( 2L ) ) + return error; + + cp->PosFormat = GET_UShort(); + + FORGET_Frame(); + + switch ( cp->PosFormat ) + { + case 1: + return Load_ContextPos1( &cp->cpf.cpf1, stream ); + + case 2: + return Load_ContextPos2( &cp->cpf.cpf2, stream ); + + case 3: + return Load_ContextPos3( &cp->cpf.cpf3, stream ); + + default: + return ERR(HB_Err_Invalid_SubTable_Format); + } + + return HB_Err_Ok; /* never reached */ +} + + +static void Free_ContextPos( HB_GPOS_SubTable* st ) +{ + HB_ContextPos* cp = &st->context; + + switch ( cp->PosFormat ) + { + case 1: Free_ContextPos1( &cp->cpf.cpf1 ); break; + case 2: Free_ContextPos2( &cp->cpf.cpf2 ); break; + case 3: Free_ContextPos3( &cp->cpf.cpf3 ); break; + default: break; + } +} + + +static HB_Error Lookup_ContextPos1( GPOS_Instance* gpi, + HB_ContextPosFormat1* cpf1, + HB_Buffer buffer, + HB_UShort flags, + HB_UShort context_length, + int nesting_level ) +{ + HB_UShort index, property; + HB_UShort i, j, k, numpr; + HB_Error error; + HB_GPOSHeader* gpos = gpi->gpos; + + HB_PosRule* pr; + HB_GDEFHeader* gdef; + + + gdef = gpos->gdef; + + if ( CHECK_Property( gdef, IN_CURITEM(), flags, &property ) ) + return error; + + error = _HB_OPEN_Coverage_Index( &cpf1->Coverage, IN_CURGLYPH(), &index ); + if ( error ) + return error; + + pr = cpf1->PosRuleSet[index].PosRule; + numpr = cpf1->PosRuleSet[index].PosRuleCount; + + for ( k = 0; k < numpr; k++ ) + { + if ( context_length != 0xFFFF && context_length < pr[k].GlyphCount ) + goto next_posrule; + + if ( buffer->in_pos + pr[k].GlyphCount > buffer->in_length ) + goto next_posrule; /* context is too long */ + + for ( i = 1, j = buffer->in_pos + 1; i < pr[k].GlyphCount; i++, j++ ) + { + while ( CHECK_Property( gdef, IN_ITEM( j ), flags, &property ) ) + { + if ( error && error != HB_Err_Not_Covered ) + return error; + + if ( j + pr[k].GlyphCount - i == (HB_Int)buffer->in_length ) + goto next_posrule; + j++; + } + + if ( IN_GLYPH( j ) != pr[k].Input[i - 1] ) + goto next_posrule; + } + + return Do_ContextPos( gpi, pr[k].GlyphCount, + pr[k].PosCount, pr[k].PosLookupRecord, + buffer, + nesting_level ); + + next_posrule: + ; + } + + return HB_Err_Not_Covered; +} + + +static HB_Error Lookup_ContextPos2( GPOS_Instance* gpi, + HB_ContextPosFormat2* cpf2, + HB_Buffer buffer, + HB_UShort flags, + HB_UShort context_length, + int nesting_level ) +{ + HB_UShort index, property; + HB_Error error; + HB_UShort i, j, k, known_classes; + + HB_UShort* classes; + HB_UShort* cl; + HB_GPOSHeader* gpos = gpi->gpos; + + HB_PosClassSet* pcs; + HB_PosClassRule* pr; + HB_GDEFHeader* gdef; + + + gdef = gpos->gdef; + + if ( CHECK_Property( gdef, IN_CURITEM(), flags, &property ) ) + return error; + + /* Note: The coverage table in format 2 doesn't give an index into + anything. It just lets us know whether or not we need to + do any lookup at all. */ + + error = _HB_OPEN_Coverage_Index( &cpf2->Coverage, IN_CURGLYPH(), &index ); + if ( error ) + return error; + + if (cpf2->MaxContextLength < 1) + return HB_Err_Not_Covered; + + if ( ALLOC_ARRAY( classes, cpf2->MaxContextLength, HB_UShort ) ) + return error; + + error = _HB_OPEN_Get_Class( &cpf2->ClassDef, IN_CURGLYPH(), + &classes[0], NULL ); + if ( error && error != HB_Err_Not_Covered ) + goto End; + known_classes = 0; + + pcs = &cpf2->PosClassSet[classes[0]]; + if ( !pcs ) + { + error = ERR(HB_Err_Invalid_SubTable); + goto End; + } + + for ( k = 0; k < pcs->PosClassRuleCount; k++ ) + { + pr = &pcs->PosClassRule[k]; + + if ( context_length != 0xFFFF && context_length < pr->GlyphCount ) + goto next_posclassrule; + + if ( buffer->in_pos + pr->GlyphCount > buffer->in_length ) + goto next_posclassrule; /* context is too long */ + + cl = pr->Class; + + /* Start at 1 because [0] is implied */ + + for ( i = 1, j = buffer->in_pos + 1; i < pr->GlyphCount; i++, j++ ) + { + while ( CHECK_Property( gdef, IN_ITEM( j ), flags, &property ) ) + { + if ( error && error != HB_Err_Not_Covered ) + goto End; + + if ( j + pr->GlyphCount - i == (HB_Int)buffer->in_length ) + goto next_posclassrule; + j++; + } + + if ( i > known_classes ) + { + /* Keeps us from having to do this for each rule */ + + error = _HB_OPEN_Get_Class( &cpf2->ClassDef, IN_GLYPH( j ), &classes[i], NULL ); + if ( error && error != HB_Err_Not_Covered ) + goto End; + known_classes = i; + } + + if ( cl[i - 1] != classes[i] ) + goto next_posclassrule; + } + + error = Do_ContextPos( gpi, pr->GlyphCount, + pr->PosCount, pr->PosLookupRecord, + buffer, + nesting_level ); + goto End; + + next_posclassrule: + ; + } + + error = HB_Err_Not_Covered; + +End: + FREE( classes ); + return error; +} + + +static HB_Error Lookup_ContextPos3( GPOS_Instance* gpi, + HB_ContextPosFormat3* cpf3, + HB_Buffer buffer, + HB_UShort flags, + HB_UShort context_length, + int nesting_level ) +{ + HB_Error error; + HB_UShort index, i, j, property; + HB_GPOSHeader* gpos = gpi->gpos; + + HB_Coverage* c; + HB_GDEFHeader* gdef; + + + gdef = gpos->gdef; + + if ( CHECK_Property( gdef, IN_CURITEM(), flags, &property ) ) + return error; + + if ( context_length != 0xFFFF && context_length < cpf3->GlyphCount ) + return HB_Err_Not_Covered; + + if ( buffer->in_pos + cpf3->GlyphCount > buffer->in_length ) + return HB_Err_Not_Covered; /* context is too long */ + + c = cpf3->Coverage; + + for ( i = 1, j = 1; i < cpf3->GlyphCount; i++, j++ ) + { + while ( CHECK_Property( gdef, IN_ITEM( j ), flags, &property ) ) + { + if ( error && error != HB_Err_Not_Covered ) + return error; + + if ( j + cpf3->GlyphCount - i == (HB_Int)buffer->in_length ) + return HB_Err_Not_Covered; + j++; + } + + error = _HB_OPEN_Coverage_Index( &c[i], IN_GLYPH( j ), &index ); + if ( error ) + return error; + } + + return Do_ContextPos( gpi, cpf3->GlyphCount, + cpf3->PosCount, cpf3->PosLookupRecord, + buffer, + nesting_level ); +} + + +static HB_Error Lookup_ContextPos( GPOS_Instance* gpi, + HB_GPOS_SubTable* st, + HB_Buffer buffer, + HB_UShort flags, + HB_UShort context_length, + int nesting_level ) +{ + HB_ContextPos* cp = &st->context; + + switch ( cp->PosFormat ) + { + case 1: + return Lookup_ContextPos1( gpi, &cp->cpf.cpf1, buffer, + flags, context_length, nesting_level ); + + case 2: + return Lookup_ContextPos2( gpi, &cp->cpf.cpf2, buffer, + flags, context_length, nesting_level ); + + case 3: + return Lookup_ContextPos3( gpi, &cp->cpf.cpf3, buffer, + flags, context_length, nesting_level ); + + default: + return ERR(HB_Err_Invalid_SubTable_Format); + } + + return HB_Err_Ok; /* never reached */ +} + + +/* LookupType 8 */ + +/* ChainPosRule */ + +static HB_Error Load_ChainPosRule( HB_ChainPosRule* cpr, + HB_Stream stream ) +{ + HB_Error error; + + HB_UShort n, count; + HB_UShort* b; + HB_UShort* i; + HB_UShort* l; + + HB_PosLookupRecord* plr; + + + if ( ACCESS_Frame( 2L ) ) + return error; + + cpr->BacktrackGlyphCount = GET_UShort(); + + FORGET_Frame(); + + cpr->Backtrack = NULL; + + count = cpr->BacktrackGlyphCount; + + if ( ALLOC_ARRAY( cpr->Backtrack, count, HB_UShort ) ) + return error; + + b = cpr->Backtrack; + + if ( ACCESS_Frame( count * 2L ) ) + goto Fail4; + + for ( n = 0; n < count; n++ ) + b[n] = GET_UShort(); + + FORGET_Frame(); + + if ( ACCESS_Frame( 2L ) ) + goto Fail4; + + cpr->InputGlyphCount = GET_UShort(); + + FORGET_Frame(); + + cpr->Input = NULL; + + count = cpr->InputGlyphCount - 1; /* only InputGlyphCount - 1 elements */ + + if ( ALLOC_ARRAY( cpr->Input, count, HB_UShort ) ) + goto Fail4; + + i = cpr->Input; + + if ( ACCESS_Frame( count * 2L ) ) + goto Fail3; + + for ( n = 0; n < count; n++ ) + i[n] = GET_UShort(); + + FORGET_Frame(); + + if ( ACCESS_Frame( 2L ) ) + goto Fail3; + + cpr->LookaheadGlyphCount = GET_UShort(); + + FORGET_Frame(); + + cpr->Lookahead = NULL; + + count = cpr->LookaheadGlyphCount; + + if ( ALLOC_ARRAY( cpr->Lookahead, count, HB_UShort ) ) + goto Fail3; + + l = cpr->Lookahead; + + if ( ACCESS_Frame( count * 2L ) ) + goto Fail2; + + for ( n = 0; n < count; n++ ) + l[n] = GET_UShort(); + + FORGET_Frame(); + + if ( ACCESS_Frame( 2L ) ) + goto Fail2; + + cpr->PosCount = GET_UShort(); + + FORGET_Frame(); + + cpr->PosLookupRecord = NULL; + + count = cpr->PosCount; + + if ( ALLOC_ARRAY( cpr->PosLookupRecord, count, HB_PosLookupRecord ) ) + goto Fail2; + + plr = cpr->PosLookupRecord; + + if ( ACCESS_Frame( count * 4L ) ) + goto Fail1; + + for ( n = 0; n < count; n++ ) + { + plr[n].SequenceIndex = GET_UShort(); + plr[n].LookupListIndex = GET_UShort(); + } + + FORGET_Frame(); + + return HB_Err_Ok; + +Fail1: + FREE( plr ); + +Fail2: + FREE( l ); + +Fail3: + FREE( i ); + +Fail4: + FREE( b ); + return error; +} + + +static void Free_ChainPosRule( HB_ChainPosRule* cpr ) +{ + FREE( cpr->PosLookupRecord ); + FREE( cpr->Lookahead ); + FREE( cpr->Input ); + FREE( cpr->Backtrack ); +} + + +/* ChainPosRuleSet */ + +static HB_Error Load_ChainPosRuleSet( HB_ChainPosRuleSet* cprs, + HB_Stream stream ) +{ + HB_Error error; + + HB_UShort n, m, count; + HB_UInt cur_offset, new_offset, base_offset; + + HB_ChainPosRule* cpr; + + + base_offset = FILE_Pos(); + + if ( ACCESS_Frame( 2L ) ) + return error; + + count = cprs->ChainPosRuleCount = GET_UShort(); + + FORGET_Frame(); + + cprs->ChainPosRule = NULL; + + if ( ALLOC_ARRAY( cprs->ChainPosRule, count, HB_ChainPosRule ) ) + return error; + + cpr = cprs->ChainPosRule; + + for ( n = 0; n < count; n++ ) + { + if ( ACCESS_Frame( 2L ) ) + goto Fail; + + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = Load_ChainPosRule( &cpr[n], stream ) ) != HB_Err_Ok ) + goto Fail; + (void)FILE_Seek( cur_offset ); + } + + return HB_Err_Ok; + +Fail: + for ( m = 0; m < n; m++ ) + Free_ChainPosRule( &cpr[m] ); + + FREE( cpr ); + return error; +} + + +static void Free_ChainPosRuleSet( HB_ChainPosRuleSet* cprs ) +{ + HB_UShort n, count; + + HB_ChainPosRule* cpr; + + + if ( cprs->ChainPosRule ) + { + count = cprs->ChainPosRuleCount; + cpr = cprs->ChainPosRule; + + for ( n = 0; n < count; n++ ) + Free_ChainPosRule( &cpr[n] ); + + FREE( cpr ); + } +} + + +/* ChainContextPosFormat1 */ + +static HB_Error Load_ChainContextPos1( HB_ChainContextPosFormat1* ccpf1, + HB_Stream stream ) +{ + HB_Error error; + + HB_UShort n, m, count; + HB_UInt cur_offset, new_offset, base_offset; + + HB_ChainPosRuleSet* cprs; + + + base_offset = FILE_Pos() - 2L; + + if ( ACCESS_Frame( 2L ) ) + return error; + + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = _HB_OPEN_Load_Coverage( &ccpf1->Coverage, stream ) ) != HB_Err_Ok ) + return error; + (void)FILE_Seek( cur_offset ); + + if ( ACCESS_Frame( 2L ) ) + goto Fail2; + + count = ccpf1->ChainPosRuleSetCount = GET_UShort(); + + FORGET_Frame(); + + ccpf1->ChainPosRuleSet = NULL; + + if ( ALLOC_ARRAY( ccpf1->ChainPosRuleSet, count, HB_ChainPosRuleSet ) ) + goto Fail2; + + cprs = ccpf1->ChainPosRuleSet; + + for ( n = 0; n < count; n++ ) + { + if ( ACCESS_Frame( 2L ) ) + goto Fail1; + + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = Load_ChainPosRuleSet( &cprs[n], stream ) ) != HB_Err_Ok ) + goto Fail1; + (void)FILE_Seek( cur_offset ); + } + + return HB_Err_Ok; + +Fail1: + for ( m = 0; m < n; m++ ) + Free_ChainPosRuleSet( &cprs[m] ); + + FREE( cprs ); + +Fail2: + _HB_OPEN_Free_Coverage( &ccpf1->Coverage ); + return error; +} + + +static void Free_ChainContextPos1( HB_ChainContextPosFormat1* ccpf1 ) +{ + HB_UShort n, count; + + HB_ChainPosRuleSet* cprs; + + + if ( ccpf1->ChainPosRuleSet ) + { + count = ccpf1->ChainPosRuleSetCount; + cprs = ccpf1->ChainPosRuleSet; + + for ( n = 0; n < count; n++ ) + Free_ChainPosRuleSet( &cprs[n] ); + + FREE( cprs ); + } + + _HB_OPEN_Free_Coverage( &ccpf1->Coverage ); +} + + +/* ChainPosClassRule */ + +static HB_Error Load_ChainPosClassRule( + HB_ChainContextPosFormat2* ccpf2, + HB_ChainPosClassRule* cpcr, + HB_Stream stream ) +{ + HB_Error error; + + HB_UShort n, count; + + HB_UShort* b; + HB_UShort* i; + HB_UShort* l; + HB_PosLookupRecord* plr; + + + if ( ACCESS_Frame( 2L ) ) + return error; + + cpcr->BacktrackGlyphCount = GET_UShort(); + + FORGET_Frame(); + + if ( cpcr->BacktrackGlyphCount > ccpf2->MaxBacktrackLength ) + ccpf2->MaxBacktrackLength = cpcr->BacktrackGlyphCount; + + cpcr->Backtrack = NULL; + + count = cpcr->BacktrackGlyphCount; + + if ( ALLOC_ARRAY( cpcr->Backtrack, count, HB_UShort ) ) + return error; + + b = cpcr->Backtrack; + + if ( ACCESS_Frame( count * 2L ) ) + goto Fail4; + + for ( n = 0; n < count; n++ ) + b[n] = GET_UShort(); + + FORGET_Frame(); + + if ( ACCESS_Frame( 2L ) ) + goto Fail4; + + cpcr->InputGlyphCount = GET_UShort(); + + if ( cpcr->InputGlyphCount > ccpf2->MaxInputLength ) + ccpf2->MaxInputLength = cpcr->InputGlyphCount; + + FORGET_Frame(); + + cpcr->Input = NULL; + + count = cpcr->InputGlyphCount - 1; /* only InputGlyphCount - 1 elements */ + + if ( ALLOC_ARRAY( cpcr->Input, count, HB_UShort ) ) + goto Fail4; + + i = cpcr->Input; + + if ( ACCESS_Frame( count * 2L ) ) + goto Fail3; + + for ( n = 0; n < count; n++ ) + i[n] = GET_UShort(); + + FORGET_Frame(); + + if ( ACCESS_Frame( 2L ) ) + goto Fail3; + + cpcr->LookaheadGlyphCount = GET_UShort(); + + FORGET_Frame(); + + if ( cpcr->LookaheadGlyphCount > ccpf2->MaxLookaheadLength ) + ccpf2->MaxLookaheadLength = cpcr->LookaheadGlyphCount; + + cpcr->Lookahead = NULL; + + count = cpcr->LookaheadGlyphCount; + + if ( ALLOC_ARRAY( cpcr->Lookahead, count, HB_UShort ) ) + goto Fail3; + + l = cpcr->Lookahead; + + if ( ACCESS_Frame( count * 2L ) ) + goto Fail2; + + for ( n = 0; n < count; n++ ) + l[n] = GET_UShort(); + + FORGET_Frame(); + + if ( ACCESS_Frame( 2L ) ) + goto Fail2; + + cpcr->PosCount = GET_UShort(); + + FORGET_Frame(); + + cpcr->PosLookupRecord = NULL; + + count = cpcr->PosCount; + + if ( ALLOC_ARRAY( cpcr->PosLookupRecord, count, HB_PosLookupRecord ) ) + goto Fail2; + + plr = cpcr->PosLookupRecord; + + if ( ACCESS_Frame( count * 4L ) ) + goto Fail1; + + for ( n = 0; n < count; n++ ) + { + plr[n].SequenceIndex = GET_UShort(); + plr[n].LookupListIndex = GET_UShort(); + } + + FORGET_Frame(); + + return HB_Err_Ok; + +Fail1: + FREE( plr ); + +Fail2: + FREE( l ); + +Fail3: + FREE( i ); + +Fail4: + FREE( b ); + return error; +} + + +static void Free_ChainPosClassRule( HB_ChainPosClassRule* cpcr ) +{ + FREE( cpcr->PosLookupRecord ); + FREE( cpcr->Lookahead ); + FREE( cpcr->Input ); + FREE( cpcr->Backtrack ); +} + + +/* PosClassSet */ + +static HB_Error Load_ChainPosClassSet( + HB_ChainContextPosFormat2* ccpf2, + HB_ChainPosClassSet* cpcs, + HB_Stream stream ) +{ + HB_Error error; + + HB_UShort n, m, count; + HB_UInt cur_offset, new_offset, base_offset; + + HB_ChainPosClassRule* cpcr; + + + base_offset = FILE_Pos(); + + if ( ACCESS_Frame( 2L ) ) + return error; + + count = cpcs->ChainPosClassRuleCount = GET_UShort(); + + FORGET_Frame(); + + cpcs->ChainPosClassRule = NULL; + + if ( ALLOC_ARRAY( cpcs->ChainPosClassRule, count, + HB_ChainPosClassRule ) ) + return error; + + cpcr = cpcs->ChainPosClassRule; + + for ( n = 0; n < count; n++ ) + { + if ( ACCESS_Frame( 2L ) ) + goto Fail; + + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = Load_ChainPosClassRule( ccpf2, &cpcr[n], + stream ) ) != HB_Err_Ok ) + goto Fail; + (void)FILE_Seek( cur_offset ); + } + + return HB_Err_Ok; + +Fail: + for ( m = 0; m < n; m++ ) + Free_ChainPosClassRule( &cpcr[m] ); + + FREE( cpcr ); + return error; +} + + +static void Free_ChainPosClassSet( HB_ChainPosClassSet* cpcs ) +{ + HB_UShort n, count; + + HB_ChainPosClassRule* cpcr; + + + if ( cpcs->ChainPosClassRule ) + { + count = cpcs->ChainPosClassRuleCount; + cpcr = cpcs->ChainPosClassRule; + + for ( n = 0; n < count; n++ ) + Free_ChainPosClassRule( &cpcr[n] ); + + FREE( cpcr ); + } +} + + +/* ChainContextPosFormat2 */ + +static HB_Error Load_ChainContextPos2( HB_ChainContextPosFormat2* ccpf2, + HB_Stream stream ) +{ + HB_Error error; + + HB_UShort n, m, count; + HB_UInt cur_offset, new_offset, base_offset; + HB_UInt backtrack_offset, input_offset, lookahead_offset; + + HB_ChainPosClassSet* cpcs; + + + base_offset = FILE_Pos() - 2; + + if ( ACCESS_Frame( 2L ) ) + return error; + + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = _HB_OPEN_Load_Coverage( &ccpf2->Coverage, stream ) ) != HB_Err_Ok ) + return error; + (void)FILE_Seek( cur_offset ); + + if ( ACCESS_Frame( 8L ) ) + goto Fail5; + + backtrack_offset = GET_UShort(); + input_offset = GET_UShort(); + lookahead_offset = GET_UShort(); + + /* `ChainPosClassSetCount' is the upper limit for input class values, + thus we read it now to make an additional safety check. No limit + is known or needed for the other two class definitions */ + + count = ccpf2->ChainPosClassSetCount = GET_UShort(); + + FORGET_Frame(); + + if ( ( error = _HB_OPEN_Load_EmptyOrClassDefinition( &ccpf2->BacktrackClassDef, 65535, + backtrack_offset, base_offset, + stream ) ) != HB_Err_Ok ) + goto Fail5; + if ( ( error = _HB_OPEN_Load_EmptyOrClassDefinition( &ccpf2->InputClassDef, count, + input_offset, base_offset, + stream ) ) != HB_Err_Ok ) + goto Fail4; + if ( ( error = _HB_OPEN_Load_EmptyOrClassDefinition( &ccpf2->LookaheadClassDef, 65535, + lookahead_offset, base_offset, + stream ) ) != HB_Err_Ok ) + goto Fail3; + + ccpf2->ChainPosClassSet = NULL; + ccpf2->MaxBacktrackLength = 0; + ccpf2->MaxInputLength = 0; + ccpf2->MaxLookaheadLength = 0; + + if ( ALLOC_ARRAY( ccpf2->ChainPosClassSet, count, HB_ChainPosClassSet ) ) + goto Fail2; + + cpcs = ccpf2->ChainPosClassSet; + + for ( n = 0; n < count; n++ ) + { + if ( ACCESS_Frame( 2L ) ) + goto Fail1; + + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + if ( new_offset != base_offset ) /* not a NULL offset */ + { + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = Load_ChainPosClassSet( ccpf2, &cpcs[n], + stream ) ) != HB_Err_Ok ) + goto Fail1; + (void)FILE_Seek( cur_offset ); + } + else + { + /* we create a ChainPosClassSet table with no entries */ + + ccpf2->ChainPosClassSet[n].ChainPosClassRuleCount = 0; + ccpf2->ChainPosClassSet[n].ChainPosClassRule = NULL; + } + } + + return HB_Err_Ok; + +Fail1: + for ( m = 0; m < n; m++ ) + Free_ChainPosClassSet( &cpcs[m] ); + + FREE( cpcs ); + +Fail2: + _HB_OPEN_Free_ClassDefinition( &ccpf2->LookaheadClassDef ); + +Fail3: + _HB_OPEN_Free_ClassDefinition( &ccpf2->InputClassDef ); + +Fail4: + _HB_OPEN_Free_ClassDefinition( &ccpf2->BacktrackClassDef ); + +Fail5: + _HB_OPEN_Free_Coverage( &ccpf2->Coverage ); + return error; +} + + +static void Free_ChainContextPos2( HB_ChainContextPosFormat2* ccpf2 ) +{ + HB_UShort n, count; + + HB_ChainPosClassSet* cpcs; + + + if ( ccpf2->ChainPosClassSet ) + { + count = ccpf2->ChainPosClassSetCount; + cpcs = ccpf2->ChainPosClassSet; + + for ( n = 0; n < count; n++ ) + Free_ChainPosClassSet( &cpcs[n] ); + + FREE( cpcs ); + } + + _HB_OPEN_Free_ClassDefinition( &ccpf2->LookaheadClassDef ); + _HB_OPEN_Free_ClassDefinition( &ccpf2->InputClassDef ); + _HB_OPEN_Free_ClassDefinition( &ccpf2->BacktrackClassDef ); + + _HB_OPEN_Free_Coverage( &ccpf2->Coverage ); +} + + +/* ChainContextPosFormat3 */ + +static HB_Error Load_ChainContextPos3( HB_ChainContextPosFormat3* ccpf3, + HB_Stream stream ) +{ + HB_Error error; + + HB_UShort n, nb, ni, nl, m, count; + HB_UShort backtrack_count, input_count, lookahead_count; + HB_UInt cur_offset, new_offset, base_offset; + + HB_Coverage* b; + HB_Coverage* i; + HB_Coverage* l; + HB_PosLookupRecord* plr; + + + base_offset = FILE_Pos() - 2L; + + if ( ACCESS_Frame( 2L ) ) + return error; + + ccpf3->BacktrackGlyphCount = GET_UShort(); + + FORGET_Frame(); + + ccpf3->BacktrackCoverage = NULL; + + backtrack_count = ccpf3->BacktrackGlyphCount; + + if ( ALLOC_ARRAY( ccpf3->BacktrackCoverage, backtrack_count, + HB_Coverage ) ) + return error; + + b = ccpf3->BacktrackCoverage; + + for ( nb = 0; nb < backtrack_count; nb++ ) + { + if ( ACCESS_Frame( 2L ) ) + goto Fail4; + + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = _HB_OPEN_Load_Coverage( &b[nb], stream ) ) != HB_Err_Ok ) + goto Fail4; + (void)FILE_Seek( cur_offset ); + } + + if ( ACCESS_Frame( 2L ) ) + goto Fail4; + + ccpf3->InputGlyphCount = GET_UShort(); + + FORGET_Frame(); + + ccpf3->InputCoverage = NULL; + + input_count = ccpf3->InputGlyphCount; + + if ( ALLOC_ARRAY( ccpf3->InputCoverage, input_count, HB_Coverage ) ) + goto Fail4; + + i = ccpf3->InputCoverage; + + for ( ni = 0; ni < input_count; ni++ ) + { + if ( ACCESS_Frame( 2L ) ) + goto Fail3; + + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = _HB_OPEN_Load_Coverage( &i[ni], stream ) ) != HB_Err_Ok ) + goto Fail3; + (void)FILE_Seek( cur_offset ); + } + + if ( ACCESS_Frame( 2L ) ) + goto Fail3; + + ccpf3->LookaheadGlyphCount = GET_UShort(); + + FORGET_Frame(); + + ccpf3->LookaheadCoverage = NULL; + + lookahead_count = ccpf3->LookaheadGlyphCount; + + if ( ALLOC_ARRAY( ccpf3->LookaheadCoverage, lookahead_count, + HB_Coverage ) ) + goto Fail3; + + l = ccpf3->LookaheadCoverage; + + for ( nl = 0; nl < lookahead_count; nl++ ) + { + if ( ACCESS_Frame( 2L ) ) + goto Fail2; + + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = _HB_OPEN_Load_Coverage( &l[nl], stream ) ) != HB_Err_Ok ) + goto Fail2; + (void)FILE_Seek( cur_offset ); + } + + if ( ACCESS_Frame( 2L ) ) + goto Fail2; + + ccpf3->PosCount = GET_UShort(); + + FORGET_Frame(); + + ccpf3->PosLookupRecord = NULL; + + count = ccpf3->PosCount; + + if ( ALLOC_ARRAY( ccpf3->PosLookupRecord, count, HB_PosLookupRecord ) ) + goto Fail2; + + plr = ccpf3->PosLookupRecord; + + if ( ACCESS_Frame( count * 4L ) ) + goto Fail1; + + for ( n = 0; n < count; n++ ) + { + plr[n].SequenceIndex = GET_UShort(); + plr[n].LookupListIndex = GET_UShort(); + } + + FORGET_Frame(); + + return HB_Err_Ok; + +Fail1: + FREE( plr ); + +Fail2: + for ( m = 0; m < nl; m++ ) + _HB_OPEN_Free_Coverage( &l[m] ); + + FREE( l ); + +Fail3: + for ( m = 0; m < ni; m++ ) + _HB_OPEN_Free_Coverage( &i[m] ); + + FREE( i ); + +Fail4: + for ( m = 0; m < nb; m++ ) + _HB_OPEN_Free_Coverage( &b[m] ); + + FREE( b ); + return error; +} + + +static void Free_ChainContextPos3( HB_ChainContextPosFormat3* ccpf3 ) +{ + HB_UShort n, count; + + HB_Coverage* c; + + + FREE( ccpf3->PosLookupRecord ); + + if ( ccpf3->LookaheadCoverage ) + { + count = ccpf3->LookaheadGlyphCount; + c = ccpf3->LookaheadCoverage; + + for ( n = 0; n < count; n++ ) + _HB_OPEN_Free_Coverage( &c[n] ); + + FREE( c ); + } + + if ( ccpf3->InputCoverage ) + { + count = ccpf3->InputGlyphCount; + c = ccpf3->InputCoverage; + + for ( n = 0; n < count; n++ ) + _HB_OPEN_Free_Coverage( &c[n] ); + + FREE( c ); + } + + if ( ccpf3->BacktrackCoverage ) + { + count = ccpf3->BacktrackGlyphCount; + c = ccpf3->BacktrackCoverage; + + for ( n = 0; n < count; n++ ) + _HB_OPEN_Free_Coverage( &c[n] ); + + FREE( c ); + } +} + + +/* ChainContextPos */ + +static HB_Error Load_ChainContextPos( HB_GPOS_SubTable* st, + HB_Stream stream ) +{ + HB_Error error; + HB_ChainContextPos* ccp = &st->chain; + + + if ( ACCESS_Frame( 2L ) ) + return error; + + ccp->PosFormat = GET_UShort(); + + FORGET_Frame(); + + switch ( ccp->PosFormat ) + { + case 1: + return Load_ChainContextPos1( &ccp->ccpf.ccpf1, stream ); + + case 2: + return Load_ChainContextPos2( &ccp->ccpf.ccpf2, stream ); + + case 3: + return Load_ChainContextPos3( &ccp->ccpf.ccpf3, stream ); + + default: + return ERR(HB_Err_Invalid_SubTable_Format); + } + + return HB_Err_Ok; /* never reached */ +} + + +static void Free_ChainContextPos( HB_GPOS_SubTable* st ) +{ + HB_ChainContextPos* ccp = &st->chain; + + switch ( ccp->PosFormat ) + { + case 1: Free_ChainContextPos1( &ccp->ccpf.ccpf1 ); break; + case 2: Free_ChainContextPos2( &ccp->ccpf.ccpf2 ); break; + case 3: Free_ChainContextPos3( &ccp->ccpf.ccpf3 ); break; + default: break; + } +} + + +static HB_Error Lookup_ChainContextPos1( + GPOS_Instance* gpi, + HB_ChainContextPosFormat1* ccpf1, + HB_Buffer buffer, + HB_UShort flags, + HB_UShort context_length, + int nesting_level ) +{ + HB_UShort index, property; + HB_UShort i, j, k, num_cpr; + HB_UShort bgc, igc, lgc; + HB_Error error; + HB_GPOSHeader* gpos = gpi->gpos; + + HB_ChainPosRule* cpr; + HB_ChainPosRule curr_cpr; + HB_GDEFHeader* gdef; + + + gdef = gpos->gdef; + + if ( CHECK_Property( gdef, IN_CURITEM(), flags, &property ) ) + return error; + + error = _HB_OPEN_Coverage_Index( &ccpf1->Coverage, IN_CURGLYPH(), &index ); + if ( error ) + return error; + + cpr = ccpf1->ChainPosRuleSet[index].ChainPosRule; + num_cpr = ccpf1->ChainPosRuleSet[index].ChainPosRuleCount; + + for ( k = 0; k < num_cpr; k++ ) + { + curr_cpr = cpr[k]; + bgc = curr_cpr.BacktrackGlyphCount; + igc = curr_cpr.InputGlyphCount; + lgc = curr_cpr.LookaheadGlyphCount; + + if ( context_length != 0xFFFF && context_length < igc ) + goto next_chainposrule; + + /* check whether context is too long; it is a first guess only */ + + if ( bgc > buffer->in_pos || buffer->in_pos + igc + lgc > buffer->in_length ) + goto next_chainposrule; + + if ( bgc ) + { + /* Since we don't know in advance the number of glyphs to inspect, + we search backwards for matches in the backtrack glyph array */ + + for ( i = 0, j = buffer->in_pos - 1; i < bgc; i++, j-- ) + { + while ( CHECK_Property( gdef, IN_ITEM( j ), flags, &property ) ) + { + if ( error && error != HB_Err_Not_Covered ) + return error; + + if ( j + 1 == bgc - i ) + goto next_chainposrule; + j--; + } + + /* In OpenType 1.3, it is undefined whether the offsets of + backtrack glyphs is in logical order or not. Version 1.4 + will clarify this: + + Logical order - a b c d e f g h i j + i + Input offsets - 0 1 + Backtrack offsets - 3 2 1 0 + Lookahead offsets - 0 1 2 3 */ + + if ( IN_GLYPH( j ) != curr_cpr.Backtrack[i] ) + goto next_chainposrule; + } + } + + /* Start at 1 because [0] is implied */ + + for ( i = 1, j = buffer->in_pos + 1; i < igc; i++, j++ ) + { + while ( CHECK_Property( gdef, IN_ITEM( j ), flags, &property ) ) + { + if ( error && error != HB_Err_Not_Covered ) + return error; + + if ( j + igc - i + lgc == (HB_Int)buffer->in_length ) + goto next_chainposrule; + j++; + } + + if ( IN_GLYPH( j ) != curr_cpr.Input[i - 1] ) + goto next_chainposrule; + } + + /* we are starting to check for lookahead glyphs right after the + last context glyph */ + + for ( i = 0; i < lgc; i++, j++ ) + { + while ( CHECK_Property( gdef, IN_ITEM( j ), flags, &property ) ) + { + if ( error && error != HB_Err_Not_Covered ) + return error; + + if ( j + lgc - i == (HB_Int)buffer->in_length ) + goto next_chainposrule; + j++; + } + + if ( IN_GLYPH( j ) != curr_cpr.Lookahead[i] ) + goto next_chainposrule; + } + + return Do_ContextPos( gpi, igc, + curr_cpr.PosCount, + curr_cpr.PosLookupRecord, + buffer, + nesting_level ); + + next_chainposrule: + ; + } + + return HB_Err_Not_Covered; +} + + +static HB_Error Lookup_ChainContextPos2( + GPOS_Instance* gpi, + HB_ChainContextPosFormat2* ccpf2, + HB_Buffer buffer, + HB_UShort flags, + HB_UShort context_length, + int nesting_level ) +{ + HB_UShort index, property; + HB_Error error; + HB_UShort i, j, k; + HB_UShort bgc, igc, lgc; + HB_UShort known_backtrack_classes, + known_input_classes, + known_lookahead_classes; + + HB_UShort* backtrack_classes; + HB_UShort* input_classes; + HB_UShort* lookahead_classes; + + HB_UShort* bc; + HB_UShort* ic; + HB_UShort* lc; + HB_GPOSHeader* gpos = gpi->gpos; + + HB_ChainPosClassSet* cpcs; + HB_ChainPosClassRule cpcr; + HB_GDEFHeader* gdef; + + + gdef = gpos->gdef; + + if ( CHECK_Property( gdef, IN_CURITEM(), flags, &property ) ) + return error; + + /* Note: The coverage table in format 2 doesn't give an index into + anything. It just lets us know whether or not we need to + do any lookup at all. */ + + error = _HB_OPEN_Coverage_Index( &ccpf2->Coverage, IN_CURGLYPH(), &index ); + if ( error ) + return error; + + if ( ALLOC_ARRAY( backtrack_classes, ccpf2->MaxBacktrackLength, HB_UShort ) ) + return error; + known_backtrack_classes = 0; + + if (ccpf2->MaxInputLength < 1) + return HB_Err_Not_Covered; + + if ( ALLOC_ARRAY( input_classes, ccpf2->MaxInputLength, HB_UShort ) ) + goto End3; + known_input_classes = 1; + + if ( ALLOC_ARRAY( lookahead_classes, ccpf2->MaxLookaheadLength, HB_UShort ) ) + goto End2; + known_lookahead_classes = 0; + + error = _HB_OPEN_Get_Class( &ccpf2->InputClassDef, IN_CURGLYPH(), + &input_classes[0], NULL ); + if ( error && error != HB_Err_Not_Covered ) + goto End1; + + cpcs = &ccpf2->ChainPosClassSet[input_classes[0]]; + if ( !cpcs ) + { + error = ERR(HB_Err_Invalid_SubTable); + goto End1; + } + + for ( k = 0; k < cpcs->ChainPosClassRuleCount; k++ ) + { + cpcr = cpcs->ChainPosClassRule[k]; + bgc = cpcr.BacktrackGlyphCount; + igc = cpcr.InputGlyphCount; + lgc = cpcr.LookaheadGlyphCount; + + if ( context_length != 0xFFFF && context_length < igc ) + goto next_chainposclassrule; + + /* check whether context is too long; it is a first guess only */ + + if ( bgc > buffer->in_pos || buffer->in_pos + igc + lgc > buffer->in_length ) + goto next_chainposclassrule; + + if ( bgc ) + { + /* Since we don't know in advance the number of glyphs to inspect, + we search backwards for matches in the backtrack glyph array. + Note that `known_backtrack_classes' starts at index 0. */ + + bc = cpcr.Backtrack; + + for ( i = 0, j = buffer->in_pos - 1; i < bgc; i++, j-- ) + { + while ( CHECK_Property( gdef, IN_ITEM( j ), flags, &property ) ) + { + if ( error && error != HB_Err_Not_Covered ) + goto End1; + + if ( j + 1 == bgc - i ) + goto next_chainposclassrule; + j++; + } + + if ( i >= known_backtrack_classes ) + { + /* Keeps us from having to do this for each rule */ + + error = _HB_OPEN_Get_Class( &ccpf2->BacktrackClassDef, IN_GLYPH( j ), + &backtrack_classes[i], NULL ); + if ( error && error != HB_Err_Not_Covered ) + goto End1; + known_backtrack_classes = i; + } + + if ( bc[i] != backtrack_classes[i] ) + goto next_chainposclassrule; + } + } + + ic = cpcr.Input; + + /* Start at 1 because [0] is implied */ + + for ( i = 1, j = buffer->in_pos + 1; i < igc; i++, j++ ) + { + while ( CHECK_Property( gdef, IN_ITEM( j ), flags, &property ) ) + { + if ( error && error != HB_Err_Not_Covered ) + goto End1; + + if ( j + igc - i + lgc == (HB_Int)buffer->in_length ) + goto next_chainposclassrule; + j++; + } + + if ( i >= known_input_classes ) + { + error = _HB_OPEN_Get_Class( &ccpf2->InputClassDef, IN_GLYPH( j ), + &input_classes[i], NULL ); + if ( error && error != HB_Err_Not_Covered ) + goto End1; + known_input_classes = i; + } + + if ( ic[i - 1] != input_classes[i] ) + goto next_chainposclassrule; + } + + /* we are starting to check for lookahead glyphs right after the + last context glyph */ + + lc = cpcr.Lookahead; + + for ( i = 0; i < lgc; i++, j++ ) + { + while ( CHECK_Property( gdef, IN_ITEM( j ), flags, &property ) ) + { + if ( error && error != HB_Err_Not_Covered ) + goto End1; + + if ( j + lgc - i == (HB_Int)buffer->in_length ) + goto next_chainposclassrule; + j++; + } + + if ( i >= known_lookahead_classes ) + { + error = _HB_OPEN_Get_Class( &ccpf2->LookaheadClassDef, IN_GLYPH( j ), + &lookahead_classes[i], NULL ); + if ( error && error != HB_Err_Not_Covered ) + goto End1; + known_lookahead_classes = i; + } + + if ( lc[i] != lookahead_classes[i] ) + goto next_chainposclassrule; + } + + error = Do_ContextPos( gpi, igc, + cpcr.PosCount, + cpcr.PosLookupRecord, + buffer, + nesting_level ); + goto End1; + + next_chainposclassrule: + ; + } + + error = HB_Err_Not_Covered; + +End1: + FREE( lookahead_classes ); + +End2: + FREE( input_classes ); + +End3: + FREE( backtrack_classes ); + return error; +} + + +static HB_Error Lookup_ChainContextPos3( + GPOS_Instance* gpi, + HB_ChainContextPosFormat3* ccpf3, + HB_Buffer buffer, + HB_UShort flags, + HB_UShort context_length, + int nesting_level ) +{ + HB_UShort index, i, j, property; + HB_UShort bgc, igc, lgc; + HB_Error error; + HB_GPOSHeader* gpos = gpi->gpos; + + HB_Coverage* bc; + HB_Coverage* ic; + HB_Coverage* lc; + HB_GDEFHeader* gdef; + + + gdef = gpos->gdef; + + if ( CHECK_Property( gdef, IN_CURITEM(), flags, &property ) ) + return error; + + bgc = ccpf3->BacktrackGlyphCount; + igc = ccpf3->InputGlyphCount; + lgc = ccpf3->LookaheadGlyphCount; + + if ( context_length != 0xFFFF && context_length < igc ) + return HB_Err_Not_Covered; + + /* check whether context is too long; it is a first guess only */ + + if ( bgc > buffer->in_pos || buffer->in_pos + igc + lgc > buffer->in_length ) + return HB_Err_Not_Covered; + + if ( bgc ) + { + /* Since we don't know in advance the number of glyphs to inspect, + we search backwards for matches in the backtrack glyph array */ + + bc = ccpf3->BacktrackCoverage; + + for ( i = 0, j = buffer->in_pos - 1; i < bgc; i++, j-- ) + { + while ( CHECK_Property( gdef, IN_ITEM( j ), flags, &property ) ) + { + if ( error && error != HB_Err_Not_Covered ) + return error; + + if ( j + 1 == bgc - i ) + return HB_Err_Not_Covered; + j--; + } + + error = _HB_OPEN_Coverage_Index( &bc[i], IN_GLYPH( j ), &index ); + if ( error ) + return error; + } + } + + ic = ccpf3->InputCoverage; + + for ( i = 0, j = buffer->in_pos; i < igc; i++, j++ ) + { + /* We already called CHECK_Property for IN_GLYPH ( buffer->in_pos ) */ + while ( j > buffer->in_pos && CHECK_Property( gdef, IN_ITEM( j ), flags, &property ) ) + { + if ( error && error != HB_Err_Not_Covered ) + return error; + + if ( j + igc - i + lgc == (HB_Int)buffer->in_length ) + return HB_Err_Not_Covered; + j++; + } + + error = _HB_OPEN_Coverage_Index( &ic[i], IN_GLYPH( j ), &index ); + if ( error ) + return error; + } + + /* we are starting to check for lookahead glyphs right after the + last context glyph */ + + lc = ccpf3->LookaheadCoverage; + + for ( i = 0; i < lgc; i++, j++ ) + { + while ( CHECK_Property( gdef, IN_ITEM( j ), flags, &property ) ) + { + if ( error && error != HB_Err_Not_Covered ) + return error; + + if ( j + lgc - i == (HB_Int)buffer->in_length ) + return HB_Err_Not_Covered; + j++; + } + + error = _HB_OPEN_Coverage_Index( &lc[i], IN_GLYPH( j ), &index ); + if ( error ) + return error; + } + + return Do_ContextPos( gpi, igc, + ccpf3->PosCount, + ccpf3->PosLookupRecord, + buffer, + nesting_level ); +} + + +static HB_Error Lookup_ChainContextPos( + GPOS_Instance* gpi, + HB_GPOS_SubTable* st, + HB_Buffer buffer, + HB_UShort flags, + HB_UShort context_length, + int nesting_level ) +{ + HB_ChainContextPos* ccp = &st->chain; + + switch ( ccp->PosFormat ) + { + case 1: + return Lookup_ChainContextPos1( gpi, &ccp->ccpf.ccpf1, buffer, + flags, context_length, + nesting_level ); + + case 2: + return Lookup_ChainContextPos2( gpi, &ccp->ccpf.ccpf2, buffer, + flags, context_length, + nesting_level ); + + case 3: + return Lookup_ChainContextPos3( gpi, &ccp->ccpf.ccpf3, buffer, + flags, context_length, + nesting_level ); + + default: + return ERR(HB_Err_Invalid_SubTable_Format); + } + + return HB_Err_Ok; /* never reached */ +} + + + +/*********** + * GPOS API + ***********/ + + + +HB_Error HB_GPOS_Select_Script( HB_GPOSHeader* gpos, + HB_UInt script_tag, + HB_UShort* script_index ) +{ + HB_UShort n; + + HB_ScriptList* sl; + HB_ScriptRecord* sr; + + + if ( !gpos || !script_index ) + return ERR(HB_Err_Invalid_Argument); + + sl = &gpos->ScriptList; + sr = sl->ScriptRecord; + + for ( n = 0; n < sl->ScriptCount; n++ ) + if ( script_tag == sr[n].ScriptTag ) + { + *script_index = n; + + return HB_Err_Ok; + } + + return HB_Err_Not_Covered; +} + + + +HB_Error HB_GPOS_Select_Language( HB_GPOSHeader* gpos, + HB_UInt language_tag, + HB_UShort script_index, + HB_UShort* language_index, + HB_UShort* req_feature_index ) +{ + HB_UShort n; + + HB_ScriptList* sl; + HB_ScriptRecord* sr; + HB_ScriptTable* s; + HB_LangSysRecord* lsr; + + + if ( !gpos || !language_index || !req_feature_index ) + return ERR(HB_Err_Invalid_Argument); + + sl = &gpos->ScriptList; + sr = sl->ScriptRecord; + + if ( script_index >= sl->ScriptCount ) + return ERR(HB_Err_Invalid_Argument); + + s = &sr[script_index].Script; + lsr = s->LangSysRecord; + + for ( n = 0; n < s->LangSysCount; n++ ) + if ( language_tag == lsr[n].LangSysTag ) + { + *language_index = n; + *req_feature_index = lsr[n].LangSys.ReqFeatureIndex; + + return HB_Err_Ok; + } + + return HB_Err_Not_Covered; +} + + +/* selecting 0xFFFF for language_index asks for the values of the + default language (DefaultLangSys) */ + + +HB_Error HB_GPOS_Select_Feature( HB_GPOSHeader* gpos, + HB_UInt feature_tag, + HB_UShort script_index, + HB_UShort language_index, + HB_UShort* feature_index ) +{ + HB_UShort n; + + HB_ScriptList* sl; + HB_ScriptRecord* sr; + HB_ScriptTable* s; + HB_LangSysRecord* lsr; + HB_LangSys* ls; + HB_UShort* fi; + + HB_FeatureList* fl; + HB_FeatureRecord* fr; + + + if ( !gpos || !feature_index ) + return ERR(HB_Err_Invalid_Argument); + + sl = &gpos->ScriptList; + sr = sl->ScriptRecord; + + fl = &gpos->FeatureList; + fr = fl->FeatureRecord; + + if ( script_index >= sl->ScriptCount ) + return ERR(HB_Err_Invalid_Argument); + + s = &sr[script_index].Script; + lsr = s->LangSysRecord; + + if ( language_index == 0xFFFF ) + ls = &s->DefaultLangSys; + else + { + if ( language_index >= s->LangSysCount ) + return ERR(HB_Err_Invalid_Argument); + + ls = &lsr[language_index].LangSys; + } + + fi = ls->FeatureIndex; + + for ( n = 0; n < ls->FeatureCount; n++ ) + { + if ( fi[n] >= fl->FeatureCount ) + return ERR(HB_Err_Invalid_SubTable_Format); + + if ( feature_tag == fr[fi[n]].FeatureTag ) + { + *feature_index = fi[n]; + + return HB_Err_Ok; + } + } + + return HB_Err_Not_Covered; +} + + +/* The next three functions return a null-terminated list */ + + +HB_Error HB_GPOS_Query_Scripts( HB_GPOSHeader* gpos, + HB_UInt** script_tag_list ) +{ + HB_Error error; + HB_UShort n; + HB_UInt* stl; + + HB_ScriptList* sl; + HB_ScriptRecord* sr; + + + if ( !gpos || !script_tag_list ) + return ERR(HB_Err_Invalid_Argument); + + sl = &gpos->ScriptList; + sr = sl->ScriptRecord; + + if ( ALLOC_ARRAY( stl, sl->ScriptCount + 1, HB_UInt ) ) + return error; + + for ( n = 0; n < sl->ScriptCount; n++ ) + stl[n] = sr[n].ScriptTag; + stl[n] = 0; + + *script_tag_list = stl; + + return HB_Err_Ok; +} + + + +HB_Error HB_GPOS_Query_Languages( HB_GPOSHeader* gpos, + HB_UShort script_index, + HB_UInt** language_tag_list ) +{ + HB_Error error; + HB_UShort n; + HB_UInt* ltl; + + HB_ScriptList* sl; + HB_ScriptRecord* sr; + HB_ScriptTable* s; + HB_LangSysRecord* lsr; + + + if ( !gpos || !language_tag_list ) + return ERR(HB_Err_Invalid_Argument); + + sl = &gpos->ScriptList; + sr = sl->ScriptRecord; + + if ( script_index >= sl->ScriptCount ) + return ERR(HB_Err_Invalid_Argument); + + s = &sr[script_index].Script; + lsr = s->LangSysRecord; + + if ( ALLOC_ARRAY( ltl, s->LangSysCount + 1, HB_UInt ) ) + return error; + + for ( n = 0; n < s->LangSysCount; n++ ) + ltl[n] = lsr[n].LangSysTag; + ltl[n] = 0; + + *language_tag_list = ltl; + + return HB_Err_Ok; +} + + +/* selecting 0xFFFF for language_index asks for the values of the + default language (DefaultLangSys) */ + + +HB_Error HB_GPOS_Query_Features( HB_GPOSHeader* gpos, + HB_UShort script_index, + HB_UShort language_index, + HB_UInt** feature_tag_list ) +{ + HB_UShort n; + HB_Error error; + HB_UInt* ftl; + + HB_ScriptList* sl; + HB_ScriptRecord* sr; + HB_ScriptTable* s; + HB_LangSysRecord* lsr; + HB_LangSys* ls; + HB_UShort* fi; + + HB_FeatureList* fl; + HB_FeatureRecord* fr; + + + if ( !gpos || !feature_tag_list ) + return ERR(HB_Err_Invalid_Argument); + + sl = &gpos->ScriptList; + sr = sl->ScriptRecord; + + fl = &gpos->FeatureList; + fr = fl->FeatureRecord; + + if ( script_index >= sl->ScriptCount ) + return ERR(HB_Err_Invalid_Argument); + + s = &sr[script_index].Script; + lsr = s->LangSysRecord; + + if ( language_index == 0xFFFF ) + ls = &s->DefaultLangSys; + else + { + if ( language_index >= s->LangSysCount ) + return ERR(HB_Err_Invalid_Argument); + + ls = &lsr[language_index].LangSys; + } + + fi = ls->FeatureIndex; + + if ( ALLOC_ARRAY( ftl, ls->FeatureCount + 1, HB_UInt ) ) + return error; + + for ( n = 0; n < ls->FeatureCount; n++ ) + { + if ( fi[n] >= fl->FeatureCount ) + { + FREE( ftl ); + return ERR(HB_Err_Invalid_SubTable_Format); + } + ftl[n] = fr[fi[n]].FeatureTag; + } + ftl[n] = 0; + + *feature_tag_list = ftl; + + return HB_Err_Ok; +} + + +/* Do an individual subtable lookup. Returns HB_Err_Ok if positioning + has been done, or HB_Err_Not_Covered if not. */ +static HB_Error GPOS_Do_Glyph_Lookup( GPOS_Instance* gpi, + HB_UShort lookup_index, + HB_Buffer buffer, + HB_UShort context_length, + int nesting_level ) +{ + HB_Error error = HB_Err_Not_Covered; + HB_UShort i, flags, lookup_count; + HB_GPOSHeader* gpos = gpi->gpos; + HB_Lookup* lo; + int lookup_type; + + + nesting_level++; + + if ( nesting_level > HB_MAX_NESTING_LEVEL ) + return ERR(HB_Err_Not_Covered); /* ERR() call intended */ + + lookup_count = gpos->LookupList.LookupCount; + if (lookup_index >= lookup_count) + return error; + + lo = &gpos->LookupList.Lookup[lookup_index]; + flags = lo->LookupFlag; + lookup_type = lo->LookupType; + + for ( i = 0; i < lo->SubTableCount; i++ ) + { + HB_GPOS_SubTable *st = &lo->SubTable[i].st.gpos; + + switch (lookup_type) { + case HB_GPOS_LOOKUP_SINGLE: + error = Lookup_SinglePos ( gpi, st, buffer, flags, context_length, nesting_level ); break; + case HB_GPOS_LOOKUP_PAIR: + error = Lookup_PairPos ( gpi, st, buffer, flags, context_length, nesting_level ); break; + case HB_GPOS_LOOKUP_CURSIVE: + error = Lookup_CursivePos ( gpi, st, buffer, flags, context_length, nesting_level ); break; + case HB_GPOS_LOOKUP_MARKBASE: + error = Lookup_MarkBasePos ( gpi, st, buffer, flags, context_length, nesting_level ); break; + case HB_GPOS_LOOKUP_MARKLIG: + error = Lookup_MarkLigPos ( gpi, st, buffer, flags, context_length, nesting_level ); break; + case HB_GPOS_LOOKUP_MARKMARK: + error = Lookup_MarkMarkPos ( gpi, st, buffer, flags, context_length, nesting_level ); break; + case HB_GPOS_LOOKUP_CONTEXT: + error = Lookup_ContextPos ( gpi, st, buffer, flags, context_length, nesting_level ); break; + case HB_GPOS_LOOKUP_CHAIN: + error = Lookup_ChainContextPos ( gpi, st, buffer, flags, context_length, nesting_level ); break; + /*case HB_GPOS_LOOKUP_EXTENSION: + error = Lookup_ExtensionPos ( gpi, st, buffer, flags, context_length, nesting_level ); break;*/ + default: + error = HB_Err_Not_Covered; + } + + /* Check whether we have a successful positioning or an error other + than HB_Err_Not_Covered */ + if ( error != HB_Err_Not_Covered ) + return error; + } + + return HB_Err_Not_Covered; +} + + +HB_INTERNAL HB_Error +_HB_GPOS_Load_SubTable( HB_GPOS_SubTable* st, + HB_Stream stream, + HB_UShort lookup_type ) +{ + switch ( lookup_type ) { + case HB_GPOS_LOOKUP_SINGLE: return Load_SinglePos ( st, stream ); + case HB_GPOS_LOOKUP_PAIR: return Load_PairPos ( st, stream ); + case HB_GPOS_LOOKUP_CURSIVE: return Load_CursivePos ( st, stream ); + case HB_GPOS_LOOKUP_MARKBASE: return Load_MarkBasePos ( st, stream ); + case HB_GPOS_LOOKUP_MARKLIG: return Load_MarkLigPos ( st, stream ); + case HB_GPOS_LOOKUP_MARKMARK: return Load_MarkMarkPos ( st, stream ); + case HB_GPOS_LOOKUP_CONTEXT: return Load_ContextPos ( st, stream ); + case HB_GPOS_LOOKUP_CHAIN: return Load_ChainContextPos ( st, stream ); + /*case HB_GPOS_LOOKUP_EXTENSION: return Load_ExtensionPos ( st, stream );*/ + default: return ERR(HB_Err_Invalid_SubTable_Format); + } +} + + +HB_INTERNAL void +_HB_GPOS_Free_SubTable( HB_GPOS_SubTable* st, + HB_UShort lookup_type ) +{ + switch ( lookup_type ) { + case HB_GPOS_LOOKUP_SINGLE: Free_SinglePos ( st ); return; + case HB_GPOS_LOOKUP_PAIR: Free_PairPos ( st ); return; + case HB_GPOS_LOOKUP_CURSIVE: Free_CursivePos ( st ); return; + case HB_GPOS_LOOKUP_MARKBASE: Free_MarkBasePos ( st ); return; + case HB_GPOS_LOOKUP_MARKLIG: Free_MarkLigPos ( st ); return; + case HB_GPOS_LOOKUP_MARKMARK: Free_MarkMarkPos ( st ); return; + case HB_GPOS_LOOKUP_CONTEXT: Free_ContextPos ( st ); return; + case HB_GPOS_LOOKUP_CHAIN: Free_ChainContextPos ( st ); return; + /*case HB_GPOS_LOOKUP_EXTENSION: Free_ExtensionPos ( st ); return;*/ + default: return; + } +} + + +/* apply one lookup to the input string object */ + +static HB_Error GPOS_Do_String_Lookup( GPOS_Instance* gpi, + HB_UShort lookup_index, + HB_Buffer buffer ) +{ + HB_Error error, retError = HB_Err_Not_Covered; + HB_GPOSHeader* gpos = gpi->gpos; + + HB_UInt* properties = gpos->LookupList.Properties; + + const int nesting_level = 0; + /* 0xFFFF indicates that we don't have a context length yet */ + const HB_UShort context_length = 0xFFFF; + + + gpi->last = 0xFFFF; /* no last valid glyph for cursive pos. */ + + buffer->in_pos = 0; + while ( buffer->in_pos < buffer->in_length ) + { + if ( ~IN_PROPERTIES( buffer->in_pos ) & properties[lookup_index] ) + { + /* Note that the connection between mark and base glyphs hold + exactly one (string) lookup. For example, it would be possible + that in the first lookup, mark glyph X is attached to base + glyph A, and in the next lookup it is attached to base glyph B. + It is up to the font designer to provide meaningful lookups and + lookup order. */ + + error = GPOS_Do_Glyph_Lookup( gpi, lookup_index, buffer, context_length, nesting_level ); + if ( error && error != HB_Err_Not_Covered ) + return error; + } + else + { + /* Contrary to properties defined in GDEF, user-defined properties + will always stop a possible cursive positioning. */ + gpi->last = 0xFFFF; + + error = HB_Err_Not_Covered; + } + + if ( error == HB_Err_Not_Covered ) + (buffer->in_pos)++; + else + retError = error; + } + + return retError; +} + + +static HB_Error Position_CursiveChain ( HB_Buffer buffer ) +{ + HB_UInt i, j; + HB_Position positions = buffer->positions; + + /* First handle all left-to-right connections */ + for (j = 0; j < buffer->in_length; j++) + { + if (positions[j].cursive_chain > 0) + positions[j].y_pos += positions[j - positions[j].cursive_chain].y_pos; + } + + /* Then handle all right-to-left connections */ + for (i = buffer->in_length; i > 0; i--) + { + j = i - 1; + + if (positions[j].cursive_chain < 0) + positions[j].y_pos += positions[j - positions[j].cursive_chain].y_pos; + } + + return HB_Err_Ok; +} + + +HB_Error HB_GPOS_Add_Feature( HB_GPOSHeader* gpos, + HB_UShort feature_index, + HB_UInt property ) +{ + HB_UShort i; + + HB_Feature feature; + HB_UInt* properties; + HB_UShort* index; + HB_UShort lookup_count; + + /* Each feature can only be added once */ + + if ( !gpos || + feature_index >= gpos->FeatureList.FeatureCount || + gpos->FeatureList.ApplyCount == gpos->FeatureList.FeatureCount ) + return ERR(HB_Err_Invalid_Argument); + + gpos->FeatureList.ApplyOrder[gpos->FeatureList.ApplyCount++] = feature_index; + + properties = gpos->LookupList.Properties; + + feature = gpos->FeatureList.FeatureRecord[feature_index].Feature; + index = feature.LookupListIndex; + lookup_count = gpos->LookupList.LookupCount; + + for ( i = 0; i < feature.LookupListCount; i++ ) + { + HB_UShort lookup_index = index[i]; + if (lookup_index < lookup_count) + properties[lookup_index] |= property; + } + + return HB_Err_Ok; +} + + + +HB_Error HB_GPOS_Clear_Features( HB_GPOSHeader* gpos ) +{ + HB_UShort i; + + HB_UInt* properties; + + + if ( !gpos ) + return ERR(HB_Err_Invalid_Argument); + + gpos->FeatureList.ApplyCount = 0; + + properties = gpos->LookupList.Properties; + + for ( i = 0; i < gpos->LookupList.LookupCount; i++ ) + properties[i] = 0; + + return HB_Err_Ok; +} + +#ifdef HB_SUPPORT_MULTIPLE_MASTER +HB_Error HB_GPOS_Register_MM_Function( HB_GPOSHeader* gpos, + HB_MMFunction mmfunc, + void* data ) +{ + if ( !gpos ) + return ERR(HB_Err_Invalid_Argument); + + gpos->mmfunc = mmfunc; + gpos->data = data; + + return HB_Err_Ok; +} +#endif + +/* If `dvi' is TRUE, glyph contour points for anchor points and device + tables are ignored -- you will get device independent values. */ + + +HB_Error HB_GPOS_Apply_String( HB_Font font, + HB_GPOSHeader* gpos, + HB_UShort load_flags, + HB_Buffer buffer, + HB_Bool dvi, + HB_Bool r2l ) +{ + HB_Error error, retError = HB_Err_Not_Covered; + GPOS_Instance gpi; + int i, j, lookup_count, num_features; + + if ( !font || !gpos || !buffer ) + return ERR(HB_Err_Invalid_Argument); + + if ( buffer->in_length == 0 ) + return HB_Err_Not_Covered; + + gpi.font = font; + gpi.gpos = gpos; + gpi.load_flags = load_flags; + gpi.r2l = r2l; + gpi.dvi = dvi; + + lookup_count = gpos->LookupList.LookupCount; + num_features = gpos->FeatureList.ApplyCount; + + if ( num_features ) + { + error = _hb_buffer_clear_positions( buffer ); + if ( error ) + return error; + } + + for ( i = 0; i < num_features; i++ ) + { + HB_UShort feature_index = gpos->FeatureList.ApplyOrder[i]; + HB_Feature feature = gpos->FeatureList.FeatureRecord[feature_index].Feature; + + for ( j = 0; j < feature.LookupListCount; j++ ) + { + HB_UShort lookup_index = feature.LookupListIndex[j]; + + /* Skip nonexistant lookups */ + if (lookup_index >= lookup_count) + continue; + + error = GPOS_Do_String_Lookup( &gpi, lookup_index, buffer ); + if ( error ) + { + if ( error != HB_Err_Not_Covered ) + return error; + } + else + retError = error; + } + } + + if ( num_features ) + { + error = Position_CursiveChain ( buffer ); + if ( error ) + return error; + } + + return retError; +} + +/* END */ diff --git a/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-gpos.h b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-gpos.h new file mode 100644 index 0000000..92bff84 --- /dev/null +++ b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-gpos.h @@ -0,0 +1,155 @@ +/* + * Copyright (C) 1998-2004 David Turner and Werner Lemberg + * Copyright (C) 2006 Behdad Esfahbod + * + * This is part of HarfBuzz, an OpenType Layout engine library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#ifndef HARFBUZZ_GPOS_H +#define HARFBUZZ_GPOS_H + +#include "harfbuzz-gdef.h" +#include "harfbuzz-buffer.h" + +HB_BEGIN_HEADER + + +/* Lookup types for glyph positioning */ + +#define HB_GPOS_LOOKUP_SINGLE 1 +#define HB_GPOS_LOOKUP_PAIR 2 +#define HB_GPOS_LOOKUP_CURSIVE 3 +#define HB_GPOS_LOOKUP_MARKBASE 4 +#define HB_GPOS_LOOKUP_MARKLIG 5 +#define HB_GPOS_LOOKUP_MARKMARK 6 +#define HB_GPOS_LOOKUP_CONTEXT 7 +#define HB_GPOS_LOOKUP_CHAIN 8 +#define HB_GPOS_LOOKUP_EXTENSION 9 + +#ifdef HB_SUPPORT_MULTIPLE_MASTER +/* A pointer to a function which accesses the PostScript interpreter. + Multiple Master fonts need this interface to convert a metric ID + (as stored in an OpenType font version 1.2 or higher) `metric_id' + into a metric value (returned in `metric_value'). + + `data' points to the user-defined structure specified during a + call to HB_GPOS_Register_MM_Function(). + + `metric_value' must be returned as a scaled value (but shouldn't + be rounded). */ + +typedef HB_Error (*HB_MMFunction)(HB_Font font, + HB_UShort metric_id, + HB_Fixed* metric_value, + void* data ); +#endif + + +struct HB_GPOSHeader_ +{ + HB_16Dot16 Version; + + HB_ScriptList ScriptList; + HB_FeatureList FeatureList; + HB_LookupList LookupList; + + HB_GDEFHeader* gdef; + +#ifdef HB_SUPPORT_MULTIPLE_MASTER + /* this is OpenType 1.2 -- Multiple Master fonts need this + callback function to get various metric values from the + PostScript interpreter. */ + + HB_MMFunction mmfunc; + void* data; +#endif +}; + +typedef struct HB_GPOSHeader_ HB_GPOSHeader; +typedef HB_GPOSHeader* HB_GPOS; + + +HB_Error HB_Load_GPOS_Table( HB_Stream stream, + HB_GPOSHeader** gpos, + HB_GDEFHeader* gdef, + HB_Stream gdefStream ); + + +HB_Error HB_Done_GPOS_Table( HB_GPOSHeader* gpos ); + + +HB_Error HB_GPOS_Select_Script( HB_GPOSHeader* gpos, + HB_UInt script_tag, + HB_UShort* script_index ); + +HB_Error HB_GPOS_Select_Language( HB_GPOSHeader* gpos, + HB_UInt language_tag, + HB_UShort script_index, + HB_UShort* language_index, + HB_UShort* req_feature_index ); + +HB_Error HB_GPOS_Select_Feature( HB_GPOSHeader* gpos, + HB_UInt feature_tag, + HB_UShort script_index, + HB_UShort language_index, + HB_UShort* feature_index ); + + +HB_Error HB_GPOS_Query_Scripts( HB_GPOSHeader* gpos, + HB_UInt** script_tag_list ); + +HB_Error HB_GPOS_Query_Languages( HB_GPOSHeader* gpos, + HB_UShort script_index, + HB_UInt** language_tag_list ); + +HB_Error HB_GPOS_Query_Features( HB_GPOSHeader* gpos, + HB_UShort script_index, + HB_UShort language_index, + HB_UInt** feature_tag_list ); + + +HB_Error HB_GPOS_Add_Feature( HB_GPOSHeader* gpos, + HB_UShort feature_index, + HB_UInt property ); + +HB_Error HB_GPOS_Clear_Features( HB_GPOSHeader* gpos ); + + +#ifdef HB_SUPPORT_MULTIPLE_MASTER +HB_Error HB_GPOS_Register_MM_Function( HB_GPOSHeader* gpos, + HB_MMFunction mmfunc, + void* data ); +#endif + +/* If `dvi' is TRUE, glyph contour points for anchor points and device + tables are ignored -- you will get device independent values. */ + + +HB_Error HB_GPOS_Apply_String( HB_Font font, + HB_GPOSHeader* gpos, + HB_UShort load_flags, + HB_Buffer buffer, + HB_Bool dvi, + HB_Bool r2l ); + +HB_END_HEADER + +#endif /* HARFBUZZ_GPOS_H */ diff --git a/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-greek.c b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-greek.c new file mode 100644 index 0000000..2e9b858 --- /dev/null +++ b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-greek.c @@ -0,0 +1,447 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + * + * This is part of HarfBuzz, an OpenType Layout engine library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#include "harfbuzz-shaper.h" +#include "harfbuzz-shaper-private.h" +#include + +#ifndef NO_OPENTYPE +static const HB_OpenTypeFeature greek_features[] = { + { HB_MAKE_TAG('c', 'c', 'm', 'p'), CcmpProperty }, + { HB_MAKE_TAG('l', 'i', 'g', 'a'), CcmpProperty }, + { HB_MAKE_TAG('c', 'l', 'i', 'g'), CcmpProperty }, + {0, 0} +}; +#endif + +/* + Greek decompositions +*/ + + +typedef struct _hb_greek_decomposition { + HB_UChar16 composed; + HB_UChar16 base; +} hb_greek_decomposition; + +static const hb_greek_decomposition decompose_0x300[] = { + { 0x1FBA, 0x0391 }, + { 0x1FC8, 0x0395 }, + { 0x1FCA, 0x0397 }, + { 0x1FDA, 0x0399 }, + { 0x1FF8, 0x039F }, + { 0x1FEA, 0x03A5 }, + { 0x1FFA, 0x03A9 }, + { 0x1F70, 0x03B1 }, + { 0x1F72, 0x03B5 }, + { 0x1F74, 0x03B7 }, + { 0x1F76, 0x03B9 }, + { 0x1F78, 0x03BF }, + { 0x1F7A, 0x03C5 }, + { 0x1F7C, 0x03C9 }, + { 0x1FD2, 0x03CA }, + { 0x1FE2, 0x03CB }, + { 0x1F02, 0x1F00 }, + { 0, 0 } +}; + +static HB_UChar16 compose_0x300(HB_UChar16 base) +{ + if ((base ^ 0x1f00) < 0x100) { + if (base <= 0x1f69 && !(base & 0x6)) + return base + 2; + if (base == 0x1fbf) + return 0x1fcd; + if (base == 0x1ffe) + return 0x1fdd; + return 0; + } + { + const hb_greek_decomposition *d = decompose_0x300; + while (d->base && d->base != base) + ++d; + return d->composed; + } +} + +static const hb_greek_decomposition decompose_0x301[] = { + { 0x0386, 0x0391 }, + { 0x0388, 0x0395 }, + { 0x0389, 0x0397 }, + { 0x038A, 0x0399 }, + { 0x038C, 0x039F }, + { 0x038E, 0x03A5 }, + { 0x038F, 0x03A9 }, + { 0x03AC, 0x03B1 }, + { 0x03AD, 0x03B5 }, + { 0x03AE, 0x03B7 }, + { 0x03AF, 0x03B9 }, + { 0x03CC, 0x03BF }, + { 0x03CD, 0x03C5 }, + { 0x03CE, 0x03C9 }, + { 0x0390, 0x03CA }, + { 0x03B0, 0x03CB }, + { 0x03D3, 0x03D2 }, + { 0, 0 } +}; + + +static HB_UChar16 compose_0x301(HB_UChar16 base) +{ + if ((base ^ 0x1f00) < 0x100) { + if (base <= 0x1f69 && !(base & 0x6)) + return base + 4; + if (base == 0x1fbf) + return 0x1fce; + if (base == 0x1ffe) + return 0x1fde; + } + { + const hb_greek_decomposition *d = decompose_0x301; + while (d->base && d->base != base) + ++d; + return d->composed; + } +} + +static const hb_greek_decomposition decompose_0x304[] = { + { 0x1FB9, 0x0391 }, + { 0x1FD9, 0x0399 }, + { 0x1FE9, 0x03A5 }, + { 0x1FB1, 0x03B1 }, + { 0x1FD1, 0x03B9 }, + { 0x1FE1, 0x03C5 }, + { 0, 0 } +}; + +static HB_UChar16 compose_0x304(HB_UChar16 base) +{ + const hb_greek_decomposition *d = decompose_0x304; + while (d->base && d->base != base) + ++d; + return d->composed; +} + +static const hb_greek_decomposition decompose_0x306[] = { + { 0x1FB8, 0x0391 }, + { 0x1FD8, 0x0399 }, + { 0x1FE8, 0x03A5 }, + { 0x1FB0, 0x03B1 }, + { 0x1FD0, 0x03B9 }, + { 0x1FE0, 0x03C5 }, + { 0, 0 } +}; + +static HB_UChar16 compose_0x306(HB_UChar16 base) +{ + const hb_greek_decomposition *d = decompose_0x306; + while (d->base && d->base != base) + ++d; + return d->composed; +} + +static const hb_greek_decomposition decompose_0x308[] = { + { 0x03AA, 0x0399 }, + { 0x03AB, 0x03A5 }, + { 0x03CA, 0x03B9 }, + { 0x03CB, 0x03C5 }, + { 0x03D4, 0x03D2 }, + { 0, 0 } +}; + +static HB_UChar16 compose_0x308(HB_UChar16 base) +{ + const hb_greek_decomposition *d = decompose_0x308; + while (d->base && d->base != base) + ++d; + return d->composed; +} + + +static const hb_greek_decomposition decompose_0x313[] = { + { 0x1F08, 0x0391 }, + { 0x1F18, 0x0395 }, + { 0x1F28, 0x0397 }, + { 0x1F38, 0x0399 }, + { 0x1F48, 0x039F }, + { 0x1F68, 0x03A9 }, + { 0x1F00, 0x03B1 }, + { 0x1F10, 0x03B5 }, + { 0x1F20, 0x03B7 }, + { 0x1F30, 0x03B9 }, + { 0x1F40, 0x03BF }, + { 0x1FE4, 0x03C1 }, + { 0x1F50, 0x03C5 }, + { 0x1F60, 0x03C9 }, + { 0, 0 } +}; + +static HB_UChar16 compose_0x313(HB_UChar16 base) +{ + const hb_greek_decomposition *d = decompose_0x313; + while (d->base && d->base != base) + ++d; + return d->composed; +} + +static const hb_greek_decomposition decompose_0x314[] = { + { 0x1F09, 0x0391 }, + { 0x1F19, 0x0395 }, + { 0x1F29, 0x0397 }, + { 0x1F39, 0x0399 }, + { 0x1F49, 0x039F }, + { 0x1FEC, 0x03A1 }, + { 0x1F59, 0x03A5 }, + { 0x1F69, 0x03A9 }, + { 0x1F01, 0x03B1 }, + { 0x1F11, 0x03B5 }, + { 0x1F21, 0x03B7 }, + { 0x1F31, 0x03B9 }, + { 0x1F41, 0x03BF }, + { 0x1FE5, 0x03C1 }, + { 0x1F51, 0x03C5 }, + { 0x1F61, 0x03C9 }, + { 0, 0 } +}; + +static HB_UChar16 compose_0x314(HB_UChar16 base) +{ + const hb_greek_decomposition *d = decompose_0x314; + while (d->base && d->base != base) + ++d; + return d->composed; +} + +static const hb_greek_decomposition decompose_0x342[] = { + { 0x1FB6, 0x03B1 }, + { 0x1FC6, 0x03B7 }, + { 0x1FD6, 0x03B9 }, + { 0x1FE6, 0x03C5 }, + { 0x1FF6, 0x03C9 }, + { 0x1FD7, 0x03CA }, + { 0x1FE7, 0x03CB }, + { 0x1F06, 0x1F00 }, + { 0x1F07, 0x1F01 }, + { 0x1F0E, 0x1F08 }, + { 0x1F0F, 0x1F09 }, + { 0x1F26, 0x1F20 }, + { 0x1F27, 0x1F21 }, + { 0x1F2E, 0x1F28 }, + { 0x1F2F, 0x1F29 }, + { 0x1F36, 0x1F30 }, + { 0x1F37, 0x1F31 }, + { 0x1F3E, 0x1F38 }, + { 0x1F3F, 0x1F39 }, + { 0x1F56, 0x1F50 }, + { 0x1F57, 0x1F51 }, + { 0x1F5F, 0x1F59 }, + { 0x1F66, 0x1F60 }, + { 0x1F67, 0x1F61 }, + { 0x1F6E, 0x1F68 }, + { 0x1F6F, 0x1F69 }, + { 0x1FCF, 0x1FBF }, + { 0x1FDF, 0x1FFE }, + { 0, 0 } +}; + +static HB_UChar16 compose_0x342(HB_UChar16 base) +{ + const hb_greek_decomposition *d = decompose_0x342; + while (d->base && d->base != base) + ++d; + return d->composed; +} + +static const hb_greek_decomposition decompose_0x345[] = { + { 0x1FBC, 0x0391 }, + { 0x1FCC, 0x0397 }, + { 0x1FFC, 0x03A9 }, + { 0x1FB4, 0x03AC }, + { 0x1FC4, 0x03AE }, + { 0x1FB3, 0x03B1 }, + { 0x1FC3, 0x03B7 }, + { 0x1FF3, 0x03C9 }, + { 0x1FF4, 0x03CE }, + { 0x1F80, 0x1F00 }, + { 0x1F81, 0x1F01 }, + { 0x1F82, 0x1F02 }, + { 0x1F83, 0x1F03 }, + { 0x1F84, 0x1F04 }, + { 0x1F85, 0x1F05 }, + { 0x1F86, 0x1F06 }, + { 0x1F87, 0x1F07 }, + { 0x1F88, 0x1F08 }, + { 0x1F89, 0x1F09 }, + { 0x1F8A, 0x1F0A }, + { 0x1F8B, 0x1F0B }, + { 0x1F8C, 0x1F0C }, + { 0x1F8D, 0x1F0D }, + { 0x1F8E, 0x1F0E }, + { 0x1F8F, 0x1F0F }, + { 0x1F90, 0x1F20 }, + { 0x1F91, 0x1F21 }, + { 0x1F92, 0x1F22 }, + { 0x1F93, 0x1F23 }, + { 0x1F94, 0x1F24 }, + { 0x1F95, 0x1F25 }, + { 0x1F96, 0x1F26 }, + { 0x1F97, 0x1F27 }, + { 0x1F98, 0x1F28 }, + { 0x1F99, 0x1F29 }, + { 0x1F9A, 0x1F2A }, + { 0x1F9B, 0x1F2B }, + { 0x1F9C, 0x1F2C }, + { 0x1F9D, 0x1F2D }, + { 0x1F9E, 0x1F2E }, + { 0x1F9F, 0x1F2F }, + { 0x1FA0, 0x1F60 }, + { 0x1FA1, 0x1F61 }, + { 0x1FA2, 0x1F62 }, + { 0x1FA3, 0x1F63 }, + { 0x1FA4, 0x1F64 }, + { 0x1FA5, 0x1F65 }, + { 0x1FA6, 0x1F66 }, + { 0x1FA7, 0x1F67 }, + { 0x1FA8, 0x1F68 }, + { 0x1FA9, 0x1F69 }, + { 0x1FAA, 0x1F6A }, + { 0x1FAB, 0x1F6B }, + { 0x1FAC, 0x1F6C }, + { 0x1FAD, 0x1F6D }, + { 0x1FAE, 0x1F6E }, + { 0x1FAF, 0x1F6F }, + { 0x1FB2, 0x1F70 }, + { 0x1FC2, 0x1F74 }, + { 0x1FF2, 0x1F7C }, + { 0x1FB7, 0x1FB6 }, + { 0x1FC7, 0x1FC6 }, + { 0x1FF7, 0x1FF6 }, + { 0, 0 } +}; + +static HB_UChar16 compose_0x345(HB_UChar16 base) +{ + const hb_greek_decomposition *d = decompose_0x345; + while (d->base && d->base != base) + ++d; + return d->composed; +} + +/* + Greek shaping. Heuristic positioning can't render polytonic greek correctly. We're a lot + better off mapping greek chars with diacritics to the characters in the extended greek + region in Unicode if possible. +*/ +HB_Bool HB_GreekShape(HB_ShaperItem *shaper_item) +{ + const int availableGlyphs = shaper_item->num_glyphs; + const HB_UChar16 *uc = shaper_item->string + shaper_item->item.pos; + unsigned short *logClusters = shaper_item->log_clusters; + HB_GlyphAttributes *attributes = shaper_item->attributes; + + HB_Bool haveGlyphs; + int slen = 1; + int cluster_start = 0; + hb_uint32 i; + + HB_STACKARRAY(HB_UChar16, shapedChars, 2 * shaper_item->item.length); + + assert(shaper_item->item.script == HB_Script_Greek); + + *shapedChars = *uc; + logClusters[0] = 0; + + for (i = 1; i < shaper_item->item.length; ++i) { + hb_uint16 base = shapedChars[slen-1]; + hb_uint16 shaped = 0; + if (uc[i] == 0x300) + shaped = compose_0x300(base); + else if (uc[i] == 0x301) + shaped = compose_0x301(base); + else if (uc[i] == 0x304) + shaped = compose_0x304(base); + else if (uc[i] == 0x306) + shaped = compose_0x306(base); + else if (uc[i] == 0x308) + shaped = compose_0x308(base); + else if (uc[i] == 0x313) + shaped = compose_0x313(base); + else if (uc[i] == 0x314) + shaped = compose_0x314(base); + else if (uc[i] == 0x342) + shaped = compose_0x342(base); + else if (uc[i] == 0x345) + shaped = compose_0x345(base); + + if (shaped) { + if (shaper_item->font->klass->canRender(shaper_item->font, (HB_UChar16 *)&shaped, 1)) { + shapedChars[slen-1] = shaped; + } else { + shaped = 0; + } + } + + if (!shaped) { + HB_CharCategory category; + int cmb; + shapedChars[slen] = uc[i]; + HB_GetUnicodeCharProperties(uc[i], &category, &cmb); + if (category != HB_Mark_NonSpacing) { + attributes[slen].clusterStart = TRUE; + attributes[slen].mark = FALSE; + attributes[slen].combiningClass = 0; + attributes[slen].dontPrint = HB_IsControlChar(uc[i]); + cluster_start = slen; + } else { + attributes[slen].clusterStart = FALSE; + attributes[slen].mark = TRUE; + attributes[slen].combiningClass = cmb; + } + ++slen; + } + logClusters[i] = cluster_start; + } + + haveGlyphs = shaper_item->font->klass + ->convertStringToGlyphIndices(shaper_item->font, + shapedChars, slen, + shaper_item->glyphs, &shaper_item->num_glyphs, + shaper_item->item.bidiLevel % 2); + + HB_FREE_STACKARRAY(shapedChars); + + if (!haveGlyphs) + return FALSE; + +#ifndef NO_OPENTYPE + if (HB_SelectScript(shaper_item, greek_features)) { + HB_OpenTypeShape(shaper_item, /*properties*/0); + return HB_OpenTypePosition(shaper_item, availableGlyphs, /*doLogClusters*/TRUE); + } +#endif + HB_HeuristicPosition(shaper_item); + + return TRUE; +} + diff --git a/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-gsub-private.h b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-gsub-private.h new file mode 100644 index 0000000..7eb329e --- /dev/null +++ b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-gsub-private.h @@ -0,0 +1,483 @@ +/* + * Copyright (C) 1998-2004 David Turner and Werner Lemberg + * Copyright (C) 2006 Behdad Esfahbod + * + * This is part of HarfBuzz, an OpenType Layout engine library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#ifndef HARFBUZZ_GSUB_PRIVATE_H +#define HARFBUZZ_GSUB_PRIVATE_H + +#include "harfbuzz-impl.h" +#include "harfbuzz-stream-private.h" +#include "harfbuzz-gsub.h" + +HB_BEGIN_HEADER + +#ifdef HB_USE_PACKED_STRUCTS +#pragma pack(push, 1) +#endif + +typedef union HB_GSUB_SubTable_ HB_GSUB_SubTable; + +/* LookupType 1 */ + +struct HB_SingleSubstFormat1_ +{ + HB_Short DeltaGlyphID; /* constant added to get + substitution glyph index */ +}; + +typedef struct HB_SingleSubstFormat1_ HB_SingleSubstFormat1; + + +struct HB_SingleSubstFormat2_ +{ + HB_UShort* Substitute; /* array of substitute glyph IDs */ + HB_UShort GlyphCount; /* number of glyph IDs in + Substitute array */ +}; + +typedef struct HB_SingleSubstFormat2_ HB_SingleSubstFormat2; + + +struct HB_SingleSubst_ +{ + union + { + HB_SingleSubstFormat1 ssf1; + HB_SingleSubstFormat2 ssf2; + } ssf; + + HB_Coverage Coverage; /* Coverage table */ + HB_Byte SubstFormat; /* 1 or 2 */ +}; + +typedef struct HB_SingleSubst_ HB_SingleSubst; + + +/* LookupType 2 */ + +struct HB_Sequence_ +{ + HB_UShort* Substitute; /* string of glyph IDs to + substitute */ + HB_UShort GlyphCount; /* number of glyph IDs in the + Substitute array */ +}; + +typedef struct HB_Sequence_ HB_Sequence; + + +struct HB_MultipleSubst_ +{ + HB_Sequence* Sequence; /* array of Sequence tables */ + HB_Coverage Coverage; /* Coverage table */ + HB_UShort SubstFormat; /* always 1 */ + HB_UShort SequenceCount; /* number of Sequence tables */ +}; + +typedef struct HB_MultipleSubst_ HB_MultipleSubst; + + +/* LookupType 3 */ + +struct HB_AlternateSet_ +{ + HB_UShort* Alternate; /* array of alternate glyph IDs */ + HB_UShort GlyphCount; /* number of glyph IDs in the + Alternate array */ +}; + +typedef struct HB_AlternateSet_ HB_AlternateSet; + + +struct HB_AlternateSubst_ +{ + HB_AlternateSet* AlternateSet; /* array of AlternateSet tables */ + HB_Coverage Coverage; /* Coverage table */ + HB_UShort SubstFormat; /* always 1 */ + HB_UShort AlternateSetCount; + /* number of AlternateSet tables */ +}; + +typedef struct HB_AlternateSubst_ HB_AlternateSubst; + + +/* LookupType 4 */ + +struct HB_Ligature_ +{ + HB_UShort* Component; /* array of component glyph IDs */ + HB_UShort LigGlyph; /* glyphID of ligature + to substitute */ + HB_UShort ComponentCount; /* number of components in ligature */ +}; + +typedef struct HB_Ligature_ HB_Ligature; + + +struct HB_LigatureSet_ +{ + HB_Ligature* Ligature; /* array of Ligature tables */ + HB_UShort LigatureCount; /* number of Ligature tables */ +}; + +typedef struct HB_LigatureSet_ HB_LigatureSet; + + +struct HB_LigatureSubst_ +{ + HB_LigatureSet* LigatureSet; /* array of LigatureSet tables */ + HB_Coverage Coverage; /* Coverage table */ + HB_UShort SubstFormat; /* always 1 */ + HB_UShort LigatureSetCount; /* number of LigatureSet tables */ +}; + +typedef struct HB_LigatureSubst_ HB_LigatureSubst; + + +/* needed by both lookup type 5 and 6 */ + +struct HB_SubstLookupRecord_ +{ + HB_UShort SequenceIndex; /* index into current + glyph sequence */ + HB_UShort LookupListIndex; /* Lookup to apply to that pos. */ +}; + +typedef struct HB_SubstLookupRecord_ HB_SubstLookupRecord; + + +/* LookupType 5 */ + +struct HB_SubRule_ +{ + HB_UShort* Input; /* array of input glyph IDs */ + HB_SubstLookupRecord* SubstLookupRecord; + /* array of SubstLookupRecord + tables */ + HB_UShort GlyphCount; /* total number of input glyphs */ + HB_UShort SubstCount; /* number of SubstLookupRecord + tables */ +}; + +typedef struct HB_SubRule_ HB_SubRule; + + +struct HB_SubRuleSet_ +{ + HB_SubRule* SubRule; /* array of SubRule tables */ + HB_UShort SubRuleCount; /* number of SubRule tables */ +}; + +typedef struct HB_SubRuleSet_ HB_SubRuleSet; + + +struct HB_ContextSubstFormat1_ +{ + HB_SubRuleSet* SubRuleSet; /* array of SubRuleSet tables */ + HB_Coverage Coverage; /* Coverage table */ + HB_UShort SubRuleSetCount; /* number of SubRuleSet tables */ +}; + +typedef struct HB_ContextSubstFormat1_ HB_ContextSubstFormat1; + + +struct HB_SubClassRule_ +{ + HB_UShort* Class; /* array of classes */ + HB_SubstLookupRecord* SubstLookupRecord; + /* array of SubstLookupRecord + tables */ + HB_UShort GlyphCount; /* total number of context classes */ + HB_UShort SubstCount; /* number of SubstLookupRecord + tables */ +}; + +typedef struct HB_SubClassRule_ HB_SubClassRule; + + +struct HB_SubClassSet_ +{ + HB_SubClassRule* SubClassRule; /* array of SubClassRule tables */ + HB_UShort SubClassRuleCount; + /* number of SubClassRule tables */ +}; + +typedef struct HB_SubClassSet_ HB_SubClassSet; + + +/* The `MaxContextLength' field is not defined in the TTO specification + but simplifies the implementation of this format. It holds the + maximal context length used in the context rules. */ + +struct HB_ContextSubstFormat2_ +{ + HB_SubClassSet* SubClassSet; /* array of SubClassSet tables */ + HB_Coverage Coverage; /* Coverage table */ + HB_ClassDefinition ClassDef; /* ClassDef table */ + HB_UShort SubClassSetCount; + /* number of SubClassSet tables */ + HB_UShort MaxContextLength; + /* maximal context length */ +}; + +typedef struct HB_ContextSubstFormat2_ HB_ContextSubstFormat2; + + +struct HB_ContextSubstFormat3_ +{ + HB_Coverage* Coverage; /* array of Coverage tables */ + HB_SubstLookupRecord* SubstLookupRecord; + /* array of substitution lookups */ + HB_UShort GlyphCount; /* number of input glyphs */ + HB_UShort SubstCount; /* number of SubstLookupRecords */ +}; + +typedef struct HB_ContextSubstFormat3_ HB_ContextSubstFormat3; + + +struct HB_ContextSubst_ +{ + union + { + HB_ContextSubstFormat1 csf1; + HB_ContextSubstFormat2 csf2; + HB_ContextSubstFormat3 csf3; + } csf; + + HB_Byte SubstFormat; /* 1, 2, or 3 */ +}; + +typedef struct HB_ContextSubst_ HB_ContextSubst; + + +/* LookupType 6 */ + +struct HB_ChainSubRule_ +{ + HB_UShort* Backtrack; /* array of backtrack glyph IDs */ + HB_UShort* Input; /* array of input glyph IDs */ + HB_UShort* Lookahead; /* array of lookahead glyph IDs */ + HB_SubstLookupRecord* SubstLookupRecord; + /* array of SubstLookupRecords */ + HB_UShort BacktrackGlyphCount; + /* total number of backtrack glyphs */ + HB_UShort InputGlyphCount; + /* total number of input glyphs */ + HB_UShort LookaheadGlyphCount; + /* total number of lookahead glyphs */ + HB_UShort SubstCount; /* number of SubstLookupRecords */ +}; + +typedef struct HB_ChainSubRule_ HB_ChainSubRule; + + +struct HB_ChainSubRuleSet_ +{ + HB_ChainSubRule* ChainSubRule; /* array of ChainSubRule tables */ + HB_UShort ChainSubRuleCount; + /* number of ChainSubRule tables */ +}; + +typedef struct HB_ChainSubRuleSet_ HB_ChainSubRuleSet; + + +struct HB_ChainContextSubstFormat1_ +{ + HB_ChainSubRuleSet* ChainSubRuleSet; + /* array of ChainSubRuleSet tables */ + HB_Coverage Coverage; /* Coverage table */ + HB_UShort ChainSubRuleSetCount; + /* number of ChainSubRuleSet tables */ +}; + +typedef struct HB_ChainContextSubstFormat1_ HB_ChainContextSubstFormat1; + + +struct HB_ChainSubClassRule_ +{ + HB_UShort* Backtrack; /* array of backtrack classes */ + HB_UShort* Input; /* array of context classes */ + HB_UShort* Lookahead; /* array of lookahead classes */ + HB_SubstLookupRecord* SubstLookupRecord; + /* array of substitution lookups */ + HB_UShort BacktrackGlyphCount; + /* total number of backtrack + classes */ + HB_UShort InputGlyphCount; + /* total number of context classes */ + HB_UShort LookaheadGlyphCount; + /* total number of lookahead + classes */ + HB_UShort SubstCount; /* number of SubstLookupRecords */ +}; + +typedef struct HB_ChainSubClassRule_ HB_ChainSubClassRule; + + +struct HB_ChainSubClassSet_ +{ + HB_ChainSubClassRule* ChainSubClassRule; + /* array of ChainSubClassRule + tables */ + HB_UShort ChainSubClassRuleCount; + /* number of ChainSubClassRule + tables */ +}; + +typedef struct HB_ChainSubClassSet_ HB_ChainSubClassSet; + + +/* The `MaxXXXLength' fields are not defined in the TTO specification + but simplifies the implementation of this format. It holds the + maximal context length used in the specific context rules. */ + +struct HB_ChainContextSubstFormat2_ +{ + HB_ChainSubClassSet* ChainSubClassSet; + /* array of ChainSubClassSet + tables */ + HB_Coverage Coverage; /* Coverage table */ + + HB_ClassDefinition BacktrackClassDef; + /* BacktrackClassDef table */ + HB_ClassDefinition InputClassDef; + /* InputClassDef table */ + HB_ClassDefinition LookaheadClassDef; + /* LookaheadClassDef table */ + + HB_UShort ChainSubClassSetCount; + /* number of ChainSubClassSet + tables */ + HB_UShort MaxBacktrackLength; + /* maximal backtrack length */ + HB_UShort MaxLookaheadLength; + /* maximal lookahead length */ + HB_UShort MaxInputLength; + /* maximal input length */ +}; + +typedef struct HB_ChainContextSubstFormat2_ HB_ChainContextSubstFormat2; + + +struct HB_ChainContextSubstFormat3_ +{ + HB_Coverage* BacktrackCoverage; + /* array of backtrack Coverage + tables */ + HB_Coverage* InputCoverage; + /* array of input coverage + tables */ + HB_Coverage* LookaheadCoverage; + /* array of lookahead coverage + tables */ + HB_SubstLookupRecord* SubstLookupRecord; + /* array of substitution lookups */ + HB_UShort BacktrackGlyphCount; + /* number of backtrack glyphs */ + HB_UShort InputGlyphCount; + /* number of input glyphs */ + HB_UShort LookaheadGlyphCount; + /* number of lookahead glyphs */ + HB_UShort SubstCount; /* number of SubstLookupRecords */ +}; + +typedef struct HB_ChainContextSubstFormat3_ HB_ChainContextSubstFormat3; + + +struct HB_ChainContextSubst_ +{ + union + { + HB_ChainContextSubstFormat1 ccsf1; + HB_ChainContextSubstFormat2 ccsf2; + HB_ChainContextSubstFormat3 ccsf3; + } ccsf; + + HB_Byte SubstFormat; /* 1, 2, or 3 */ +}; + +typedef struct HB_ChainContextSubst_ HB_ChainContextSubst; + + +#if 0 +/* LookupType 7 */ +struct HB_ExtensionSubst_ +{ + HB_GSUB_SubTable *subtable; /* referenced subtable */ + HB_UShort SubstFormat; /* always 1 */ + HB_UShort LookuptType; /* lookup-type of referenced subtable */ +}; + +typedef struct HB_ExtensionSubst_ HB_ExtensionSubst; +#endif + + +/* LookupType 8 */ +struct HB_ReverseChainContextSubst_ +{ + HB_Coverage* LookaheadCoverage; /* array of lookahead Coverage + tables */ + HB_UShort* Substitute; /* array of substitute Glyph ID */ + HB_Coverage* BacktrackCoverage; /* array of backtrack Coverage + tables */ + HB_Coverage Coverage; /* coverage table for input glyphs */ + HB_UShort SubstFormat; /* always 1 */ + HB_UShort BacktrackGlyphCount; /* number of backtrack glyphs */ + HB_UShort LookaheadGlyphCount; /* number of lookahead glyphs */ + HB_UShort GlyphCount; /* number of Glyph IDs */ +}; + +typedef struct HB_ReverseChainContextSubst_ HB_ReverseChainContextSubst; + + +union HB_GSUB_SubTable_ +{ + HB_SingleSubst single; + HB_MultipleSubst multiple; + HB_AlternateSubst alternate; + HB_LigatureSubst ligature; + HB_ContextSubst context; + HB_ChainContextSubst chain; + HB_ReverseChainContextSubst reverse; +}; + + + + +HB_INTERNAL HB_Error +_HB_GSUB_Load_SubTable( HB_GSUB_SubTable* st, + HB_Stream stream, + HB_UShort lookup_type ); + +HB_INTERNAL void +_HB_GSUB_Free_SubTable( HB_GSUB_SubTable* st, + HB_UShort lookup_type ); + +#ifdef HB_USE_PACKED_STRUCTS +#pragma pack(pop) +#endif + +HB_END_HEADER + +#endif /* HARFBUZZ_GSUB_PRIVATE_H */ diff --git a/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-gsub.c b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-gsub.c new file mode 100644 index 0000000..21fec51 --- /dev/null +++ b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-gsub.c @@ -0,0 +1,4329 @@ +/* + * Copyright (C) 1998-2004 David Turner and Werner Lemberg + * Copyright (C) 2006 Behdad Esfahbod + * Copyright (C) 2007 Red Hat, Inc. + * + * This is part of HarfBuzz, an OpenType Layout engine library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + * + * Red Hat Author(s): Behdad Esfahbod + */ + +#include "harfbuzz-impl.h" +#include "harfbuzz-gsub-private.h" +#include "harfbuzz-open-private.h" +#include "harfbuzz-gdef-private.h" + +static HB_Error GSUB_Do_Glyph_Lookup( HB_GSUBHeader* gsub, + HB_UShort lookup_index, + HB_Buffer buffer, + HB_UShort context_length, + int nesting_level ); + + + +/********************** + * Auxiliary functions + **********************/ + + + +HB_Error HB_Load_GSUB_Table( HB_Stream stream, + HB_GSUBHeader** retptr, + HB_GDEFHeader* gdef, + HB_Stream gdefStream ) +{ + HB_Error error; + HB_UInt cur_offset, new_offset, base_offset; + + HB_GSUBHeader* gsub; + + if ( !retptr ) + return ERR(HB_Err_Invalid_Argument); + + if ( GOTO_Table( TTAG_GSUB ) ) + return error; + + base_offset = FILE_Pos(); + + if ( ALLOC ( gsub, sizeof( *gsub ) ) ) + return error; + + + /* skip version */ + + if ( FILE_Seek( base_offset + 4L ) || + ACCESS_Frame( 2L ) ) + goto Fail4; + + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = _HB_OPEN_Load_ScriptList( &gsub->ScriptList, + stream ) ) != HB_Err_Ok ) + goto Fail4; + (void)FILE_Seek( cur_offset ); + + if ( ACCESS_Frame( 2L ) ) + goto Fail3; + + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = _HB_OPEN_Load_FeatureList( &gsub->FeatureList, + stream ) ) != HB_Err_Ok ) + goto Fail3; + (void)FILE_Seek( cur_offset ); + + if ( ACCESS_Frame( 2L ) ) + goto Fail2; + + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = _HB_OPEN_Load_LookupList( &gsub->LookupList, + stream, HB_Type_GSUB ) ) != HB_Err_Ok ) + goto Fail2; + + gsub->gdef = gdef; /* can be NULL */ + + if ( ( error = _HB_GDEF_LoadMarkAttachClassDef_From_LookupFlags( gdef, gdefStream, + gsub->LookupList.Lookup, + gsub->LookupList.LookupCount ) ) ) + goto Fail1; + + *retptr = gsub; + + return HB_Err_Ok; + +Fail1: + _HB_OPEN_Free_LookupList( &gsub->LookupList, HB_Type_GSUB ); + +Fail2: + _HB_OPEN_Free_FeatureList( &gsub->FeatureList ); + +Fail3: + _HB_OPEN_Free_ScriptList( &gsub->ScriptList ); + +Fail4: + FREE ( gsub ); + + + return error; +} + + +HB_Error HB_Done_GSUB_Table( HB_GSUBHeader* gsub ) +{ + _HB_OPEN_Free_LookupList( &gsub->LookupList, HB_Type_GSUB ); + _HB_OPEN_Free_FeatureList( &gsub->FeatureList ); + _HB_OPEN_Free_ScriptList( &gsub->ScriptList ); + + FREE( gsub ); + + return HB_Err_Ok; +} + +/***************************** + * SubTable related functions + *****************************/ + + +/* LookupType 1 */ + +/* SingleSubstFormat1 */ +/* SingleSubstFormat2 */ + +static HB_Error Load_SingleSubst( HB_GSUB_SubTable* st, + HB_Stream stream ) +{ + HB_Error error; + HB_SingleSubst* ss = &st->single; + + HB_UShort n, count; + HB_UInt cur_offset, new_offset, base_offset; + + HB_UShort* s; + + + base_offset = FILE_Pos(); + + if ( ACCESS_Frame( 4L ) ) + return error; + + ss->SubstFormat = GET_UShort(); + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = _HB_OPEN_Load_Coverage( &ss->Coverage, stream ) ) != HB_Err_Ok ) + return error; + (void)FILE_Seek( cur_offset ); + + switch ( ss->SubstFormat ) + { + case 1: + if ( ACCESS_Frame( 2L ) ) + goto Fail2; + + ss->ssf.ssf1.DeltaGlyphID = GET_UShort(); + + FORGET_Frame(); + + break; + + case 2: + if ( ACCESS_Frame( 2L ) ) + goto Fail2; + + count = ss->ssf.ssf2.GlyphCount = GET_UShort(); + + FORGET_Frame(); + + ss->ssf.ssf2.Substitute = NULL; + + if ( ALLOC_ARRAY( ss->ssf.ssf2.Substitute, count, HB_UShort ) ) + goto Fail2; + + s = ss->ssf.ssf2.Substitute; + + if ( ACCESS_Frame( count * 2L ) ) + goto Fail1; + + for ( n = 0; n < count; n++ ) + s[n] = GET_UShort(); + + FORGET_Frame(); + + break; + + default: + return ERR(HB_Err_Invalid_SubTable_Format); + } + + return HB_Err_Ok; + +Fail1: + FREE( s ); + +Fail2: + _HB_OPEN_Free_Coverage( &ss->Coverage ); + return error; +} + + +static void Free_SingleSubst( HB_GSUB_SubTable* st ) +{ + HB_SingleSubst* ss = &st->single; + + switch ( ss->SubstFormat ) + { + case 1: + break; + + case 2: + FREE( ss->ssf.ssf2.Substitute ); + break; + + default: + break; + } + + _HB_OPEN_Free_Coverage( &ss->Coverage ); +} + + +static HB_Error Lookup_SingleSubst( HB_GSUBHeader* gsub, + HB_GSUB_SubTable* st, + HB_Buffer buffer, + HB_UShort flags, + HB_UShort context_length, + int nesting_level ) +{ + HB_UShort index, value, property; + HB_Error error; + HB_SingleSubst* ss = &st->single; + HB_GDEFHeader* gdef = gsub->gdef; + + HB_UNUSED(nesting_level); + + if ( context_length != 0xFFFF && context_length < 1 ) + return HB_Err_Not_Covered; + + if ( CHECK_Property( gdef, IN_CURITEM(), flags, &property ) ) + return error; + + error = _HB_OPEN_Coverage_Index( &ss->Coverage, IN_CURGLYPH(), &index ); + if ( error ) + return error; + + switch ( ss->SubstFormat ) + { + case 1: + value = ( IN_CURGLYPH() + ss->ssf.ssf1.DeltaGlyphID ) & 0xFFFF; + if ( REPLACE_Glyph( buffer, value, nesting_level ) ) + return error; + break; + + case 2: + if ( index >= ss->ssf.ssf2.GlyphCount ) + return ERR(HB_Err_Invalid_SubTable); + value = ss->ssf.ssf2.Substitute[index]; + if ( REPLACE_Glyph( buffer, value, nesting_level ) ) + return error; + break; + + default: + return ERR(HB_Err_Invalid_SubTable); + } + + if ( gdef && gdef->NewGlyphClasses ) + { + /* we inherit the old glyph class to the substituted glyph */ + + error = _HB_GDEF_Add_Glyph_Property( gdef, value, property ); + if ( error && error != HB_Err_Not_Covered ) + return error; + } + + return HB_Err_Ok; +} + + +/* LookupType 2 */ + +/* Sequence */ + +static HB_Error Load_Sequence( HB_Sequence* s, + HB_Stream stream ) +{ + HB_Error error; + + HB_UShort n, count; + HB_UShort* sub; + + + if ( ACCESS_Frame( 2L ) ) + return error; + + count = s->GlyphCount = GET_UShort(); + + FORGET_Frame(); + + s->Substitute = NULL; + + if ( count ) + { + if ( ALLOC_ARRAY( s->Substitute, count, HB_UShort ) ) + return error; + + sub = s->Substitute; + + if ( ACCESS_Frame( count * 2L ) ) + { + FREE( sub ); + return error; + } + + for ( n = 0; n < count; n++ ) + sub[n] = GET_UShort(); + + FORGET_Frame(); + } + + return HB_Err_Ok; +} + + +static void Free_Sequence( HB_Sequence* s ) +{ + FREE( s->Substitute ); +} + + +/* MultipleSubstFormat1 */ + +static HB_Error Load_MultipleSubst( HB_GSUB_SubTable* st, + HB_Stream stream ) +{ + HB_Error error; + HB_MultipleSubst* ms = &st->multiple; + + HB_UShort n = 0, m, count; + HB_UInt cur_offset, new_offset, base_offset; + + HB_Sequence* s; + + + base_offset = FILE_Pos(); + + if ( ACCESS_Frame( 4L ) ) + return error; + + ms->SubstFormat = GET_UShort(); /* should be 1 */ + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = _HB_OPEN_Load_Coverage( &ms->Coverage, stream ) ) != HB_Err_Ok ) + return error; + (void)FILE_Seek( cur_offset ); + + if ( ACCESS_Frame( 2L ) ) + goto Fail2; + + count = ms->SequenceCount = GET_UShort(); + + FORGET_Frame(); + + ms->Sequence = NULL; + + if ( ALLOC_ARRAY( ms->Sequence, count, HB_Sequence ) ) + goto Fail2; + + s = ms->Sequence; + + for ( n = 0; n < count; n++ ) + { + if ( ACCESS_Frame( 2L ) ) + goto Fail1; + + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = Load_Sequence( &s[n], stream ) ) != HB_Err_Ok ) + goto Fail1; + (void)FILE_Seek( cur_offset ); + } + + return HB_Err_Ok; + +Fail1: + for ( m = 0; m < n; m++ ) + Free_Sequence( &s[m] ); + + FREE( s ); + +Fail2: + _HB_OPEN_Free_Coverage( &ms->Coverage ); + return error; +} + + +static void Free_MultipleSubst( HB_GSUB_SubTable* st ) +{ + HB_UShort n, count; + HB_MultipleSubst* ms = &st->multiple; + + HB_Sequence* s; + + + if ( ms->Sequence ) + { + count = ms->SequenceCount; + s = ms->Sequence; + + for ( n = 0; n < count; n++ ) + Free_Sequence( &s[n] ); + + FREE( s ); + } + + _HB_OPEN_Free_Coverage( &ms->Coverage ); +} + + +static HB_Error Lookup_MultipleSubst( HB_GSUBHeader* gsub, + HB_GSUB_SubTable* st, + HB_Buffer buffer, + HB_UShort flags, + HB_UShort context_length, + int nesting_level ) +{ + HB_Error error; + HB_UShort index, property, n, count; + HB_UShort*s; + HB_MultipleSubst* ms = &st->multiple; + HB_GDEFHeader* gdef = gsub->gdef; + + HB_UNUSED(nesting_level); + + if ( context_length != 0xFFFF && context_length < 1 ) + return HB_Err_Not_Covered; + + if ( CHECK_Property( gdef, IN_CURITEM(), flags, &property ) ) + return error; + + error = _HB_OPEN_Coverage_Index( &ms->Coverage, IN_CURGLYPH(), &index ); + if ( error ) + return error; + + if ( index >= ms->SequenceCount ) + return ERR(HB_Err_Invalid_SubTable); + + count = ms->Sequence[index].GlyphCount; + s = ms->Sequence[index].Substitute; + + if ( ADD_String( buffer, 1, count, s, 0xFFFF, 0xFFFF ) ) + return error; + + if ( gdef && gdef->NewGlyphClasses ) + { + /* this is a guess only ... */ + + if ( property == HB_GDEF_LIGATURE ) + property = HB_GDEF_BASE_GLYPH; + + for ( n = 0; n < count; n++ ) + { + error = _HB_GDEF_Add_Glyph_Property( gdef, s[n], property ); + if ( error && error != HB_Err_Not_Covered ) + return error; + } + } + + return HB_Err_Ok; +} + + +/* LookupType 3 */ + +/* AlternateSet */ + +static HB_Error Load_AlternateSet( HB_AlternateSet* as, + HB_Stream stream ) +{ + HB_Error error; + + HB_UShort n, count; + HB_UShort* a; + + + if ( ACCESS_Frame( 2L ) ) + return error; + + count = as->GlyphCount = GET_UShort(); + + FORGET_Frame(); + + as->Alternate = NULL; + + if ( ALLOC_ARRAY( as->Alternate, count, HB_UShort ) ) + return error; + + a = as->Alternate; + + if ( ACCESS_Frame( count * 2L ) ) + { + FREE( a ); + return error; + } + + for ( n = 0; n < count; n++ ) + a[n] = GET_UShort(); + + FORGET_Frame(); + + return HB_Err_Ok; +} + + +static void Free_AlternateSet( HB_AlternateSet* as ) +{ + FREE( as->Alternate ); +} + + +/* AlternateSubstFormat1 */ + +static HB_Error Load_AlternateSubst( HB_GSUB_SubTable* st, + HB_Stream stream ) +{ + HB_Error error; + HB_AlternateSubst* as = &st->alternate; + + HB_UShort n = 0, m, count; + HB_UInt cur_offset, new_offset, base_offset; + + HB_AlternateSet* aset; + + + base_offset = FILE_Pos(); + + if ( ACCESS_Frame( 4L ) ) + return error; + + as->SubstFormat = GET_UShort(); /* should be 1 */ + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = _HB_OPEN_Load_Coverage( &as->Coverage, stream ) ) != HB_Err_Ok ) + return error; + (void)FILE_Seek( cur_offset ); + + if ( ACCESS_Frame( 2L ) ) + goto Fail2; + + count = as->AlternateSetCount = GET_UShort(); + + FORGET_Frame(); + + as->AlternateSet = NULL; + + if ( ALLOC_ARRAY( as->AlternateSet, count, HB_AlternateSet ) ) + goto Fail2; + + aset = as->AlternateSet; + + for ( n = 0; n < count; n++ ) + { + if ( ACCESS_Frame( 2L ) ) + goto Fail1; + + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = Load_AlternateSet( &aset[n], stream ) ) != HB_Err_Ok ) + goto Fail1; + (void)FILE_Seek( cur_offset ); + } + + return HB_Err_Ok; + +Fail1: + for ( m = 0; m < n; m++ ) + Free_AlternateSet( &aset[m] ); + + FREE( aset ); + +Fail2: + _HB_OPEN_Free_Coverage( &as->Coverage ); + return error; +} + + +static void Free_AlternateSubst( HB_GSUB_SubTable* st ) +{ + HB_UShort n, count; + HB_AlternateSubst* as = &st->alternate; + + HB_AlternateSet* aset; + + + if ( as->AlternateSet ) + { + count = as->AlternateSetCount; + aset = as->AlternateSet; + + for ( n = 0; n < count; n++ ) + Free_AlternateSet( &aset[n] ); + + FREE( aset ); + } + + _HB_OPEN_Free_Coverage( &as->Coverage ); +} + + +static HB_Error Lookup_AlternateSubst( HB_GSUBHeader* gsub, + HB_GSUB_SubTable* st, + HB_Buffer buffer, + HB_UShort flags, + HB_UShort context_length, + int nesting_level ) +{ + HB_Error error; + HB_UShort index, value, alt_index, property; + HB_AlternateSubst* as = &st->alternate; + HB_GDEFHeader* gdef = gsub->gdef; + HB_AlternateSet aset; + + HB_UNUSED(nesting_level); + + if ( context_length != 0xFFFF && context_length < 1 ) + return HB_Err_Not_Covered; + + if ( CHECK_Property( gdef, IN_CURITEM(), flags, &property ) ) + return error; + + error = _HB_OPEN_Coverage_Index( &as->Coverage, IN_CURGLYPH(), &index ); + if ( error ) + return error; + + aset = as->AlternateSet[index]; + + /* we use a user-defined callback function to get the alternate index */ + + if ( gsub->altfunc ) + alt_index = (gsub->altfunc)( buffer->out_pos, IN_CURGLYPH(), + aset.GlyphCount, aset.Alternate, + gsub->data ); + else + alt_index = 0; + + value = aset.Alternate[alt_index]; + if ( REPLACE_Glyph( buffer, value, nesting_level ) ) + return error; + + if ( gdef && gdef->NewGlyphClasses ) + { + /* we inherit the old glyph class to the substituted glyph */ + + error = _HB_GDEF_Add_Glyph_Property( gdef, value, property ); + if ( error && error != HB_Err_Not_Covered ) + return error; + } + + return HB_Err_Ok; +} + + +/* LookupType 4 */ + +/* Ligature */ + +static HB_Error Load_Ligature( HB_Ligature* l, + HB_Stream stream ) +{ + HB_Error error; + + HB_UShort n, count; + HB_UShort* c; + + + if ( ACCESS_Frame( 4L ) ) + return error; + + l->LigGlyph = GET_UShort(); + l->ComponentCount = GET_UShort(); + + FORGET_Frame(); + + l->Component = NULL; + + count = l->ComponentCount - 1; /* only ComponentCount - 1 elements */ + + if ( ALLOC_ARRAY( l->Component, count, HB_UShort ) ) + return error; + + c = l->Component; + + if ( ACCESS_Frame( count * 2L ) ) + { + FREE( c ); + return error; + } + + for ( n = 0; n < count; n++ ) + c[n] = GET_UShort(); + + FORGET_Frame(); + + return HB_Err_Ok; +} + + +static void Free_Ligature( HB_Ligature* l ) +{ + FREE( l->Component ); +} + + +/* LigatureSet */ + +static HB_Error Load_LigatureSet( HB_LigatureSet* ls, + HB_Stream stream ) +{ + HB_Error error; + + HB_UShort n = 0, m, count; + HB_UInt cur_offset, new_offset, base_offset; + + HB_Ligature* l; + + + base_offset = FILE_Pos(); + + if ( ACCESS_Frame( 2L ) ) + return error; + + count = ls->LigatureCount = GET_UShort(); + + FORGET_Frame(); + + ls->Ligature = NULL; + + if ( ALLOC_ARRAY( ls->Ligature, count, HB_Ligature ) ) + return error; + + l = ls->Ligature; + + for ( n = 0; n < count; n++ ) + { + if ( ACCESS_Frame( 2L ) ) + goto Fail; + + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = Load_Ligature( &l[n], stream ) ) != HB_Err_Ok ) + goto Fail; + (void)FILE_Seek( cur_offset ); + } + + return HB_Err_Ok; + +Fail: + for ( m = 0; m < n; m++ ) + Free_Ligature( &l[m] ); + + FREE( l ); + return error; +} + + +static void Free_LigatureSet( HB_LigatureSet* ls ) +{ + HB_UShort n, count; + + HB_Ligature* l; + + + if ( ls->Ligature ) + { + count = ls->LigatureCount; + l = ls->Ligature; + + for ( n = 0; n < count; n++ ) + Free_Ligature( &l[n] ); + + FREE( l ); + } +} + + +/* LigatureSubstFormat1 */ + +static HB_Error Load_LigatureSubst( HB_GSUB_SubTable* st, + HB_Stream stream ) +{ + HB_Error error; + HB_LigatureSubst* ls = &st->ligature; + + HB_UShort n = 0, m, count; + HB_UInt cur_offset, new_offset, base_offset; + + HB_LigatureSet* lset; + + + base_offset = FILE_Pos(); + + if ( ACCESS_Frame( 4L ) ) + return error; + + ls->SubstFormat = GET_UShort(); /* should be 1 */ + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = _HB_OPEN_Load_Coverage( &ls->Coverage, stream ) ) != HB_Err_Ok ) + return error; + (void)FILE_Seek( cur_offset ); + + if ( ACCESS_Frame( 2L ) ) + goto Fail2; + + count = ls->LigatureSetCount = GET_UShort(); + + FORGET_Frame(); + + ls->LigatureSet = NULL; + + if ( ALLOC_ARRAY( ls->LigatureSet, count, HB_LigatureSet ) ) + goto Fail2; + + lset = ls->LigatureSet; + + for ( n = 0; n < count; n++ ) + { + if ( ACCESS_Frame( 2L ) ) + goto Fail1; + + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = Load_LigatureSet( &lset[n], stream ) ) != HB_Err_Ok ) + goto Fail1; + (void)FILE_Seek( cur_offset ); + } + + return HB_Err_Ok; + +Fail1: + for ( m = 0; m < n; m++ ) + Free_LigatureSet( &lset[m] ); + + FREE( lset ); + +Fail2: + _HB_OPEN_Free_Coverage( &ls->Coverage ); + return error; +} + + +static void Free_LigatureSubst( HB_GSUB_SubTable* st ) +{ + HB_UShort n, count; + HB_LigatureSubst* ls = &st->ligature; + + HB_LigatureSet* lset; + + + if ( ls->LigatureSet ) + { + count = ls->LigatureSetCount; + lset = ls->LigatureSet; + + for ( n = 0; n < count; n++ ) + Free_LigatureSet( &lset[n] ); + + FREE( lset ); + } + + _HB_OPEN_Free_Coverage( &ls->Coverage ); +} + + +static HB_Error Lookup_LigatureSubst( HB_GSUBHeader* gsub, + HB_GSUB_SubTable* st, + HB_Buffer buffer, + HB_UShort flags, + HB_UShort context_length, + int nesting_level ) +{ + HB_UShort index, property; + HB_Error error; + HB_UShort numlig, i, j, is_mark, first_is_mark = FALSE; + HB_UShort* c; + HB_LigatureSubst* ls = &st->ligature; + HB_GDEFHeader* gdef = gsub->gdef; + + HB_Ligature* lig; + + HB_UNUSED(nesting_level); + + if ( CHECK_Property( gdef, IN_CURITEM(), flags, &property ) ) + return error; + + if ( property == HB_GDEF_MARK || property & HB_LOOKUP_FLAG_IGNORE_SPECIAL_MARKS ) + first_is_mark = TRUE; + + error = _HB_OPEN_Coverage_Index( &ls->Coverage, IN_CURGLYPH(), &index ); + if ( error ) + return error; + + if ( index >= ls->LigatureSetCount ) + return ERR(HB_Err_Invalid_SubTable); + + lig = ls->LigatureSet[index].Ligature; + + for ( numlig = ls->LigatureSet[index].LigatureCount; + numlig; + numlig--, lig++ ) + { + if ( buffer->in_pos + lig->ComponentCount > buffer->in_length ) + goto next_ligature; /* Not enough glyphs in input */ + + c = lig->Component; + + is_mark = first_is_mark; + + if ( context_length != 0xFFFF && context_length < lig->ComponentCount ) + break; + + for ( i = 1, j = buffer->in_pos + 1; i < lig->ComponentCount; i++, j++ ) + { + while ( CHECK_Property( gdef, IN_ITEM( j ), flags, &property ) ) + { + if ( error && error != HB_Err_Not_Covered ) + return error; + + if ( j + lig->ComponentCount - i == (HB_Int)buffer->in_length ) + goto next_ligature; + j++; + } + + if ( !( property == HB_GDEF_MARK || property & HB_LOOKUP_FLAG_IGNORE_SPECIAL_MARKS ) ) + is_mark = FALSE; + + if ( IN_GLYPH( j ) != c[i - 1] ) + goto next_ligature; + } + + if ( gdef && gdef->NewGlyphClasses ) + { + /* this is just a guess ... */ + + error = _HB_GDEF_Add_Glyph_Property( gdef, lig->LigGlyph, + is_mark ? HB_GDEF_MARK : HB_GDEF_LIGATURE ); + if ( error && error != HB_Err_Not_Covered ) + return error; + } + + if ( j == buffer->in_pos + i ) /* No input glyphs skipped */ + { + /* We don't use a new ligature ID if there are no skipped + glyphs and the ligature already has an ID. */ + + if ( IN_LIGID( buffer->in_pos ) ) + { + if ( ADD_String( buffer, i, 1, &lig->LigGlyph, + 0xFFFF, 0xFFFF ) ) + return error; + } + else + { + HB_UShort ligID = _hb_buffer_allocate_ligid( buffer ); + if ( ADD_String( buffer, i, 1, &lig->LigGlyph, + 0xFFFF, ligID ) ) + return error; + } + } + else + { + HB_UShort ligID = _hb_buffer_allocate_ligid( buffer ); + if ( ADD_Glyph( buffer, lig->LigGlyph, 0xFFFF, ligID ) ) + return error; + + /* Now we must do a second loop to copy the skipped glyphs to + `out' and assign component values to it. We start with the + glyph after the first component. Glyphs between component + i and i+1 belong to component i. Together with the ligID + value it is later possible to check whether a specific + component value really belongs to a given ligature. */ + + for ( i = 0; i < lig->ComponentCount - 1; i++ ) + { + while ( CHECK_Property( gdef, IN_CURITEM(), + flags, &property ) ) + if ( ADD_Glyph( buffer, IN_CURGLYPH(), i, ligID ) ) + return error; + + (buffer->in_pos)++; + } + } + + return HB_Err_Ok; + + next_ligature: + ; + } + + return HB_Err_Not_Covered; +} + + +/* Do the actual substitution for a context substitution (either format + 5 or 6). This is only called after we've determined that the input + matches the subrule. */ + +static HB_Error Do_ContextSubst( HB_GSUBHeader* gsub, + HB_UShort GlyphCount, + HB_UShort SubstCount, + HB_SubstLookupRecord* subst, + HB_Buffer buffer, + int nesting_level ) +{ + HB_Error error; + HB_UInt i, old_pos; + + + i = 0; + + while ( i < GlyphCount ) + { + if ( SubstCount && i == subst->SequenceIndex ) + { + old_pos = buffer->in_pos; + + /* Do a substitution */ + + error = GSUB_Do_Glyph_Lookup( gsub, subst->LookupListIndex, buffer, + GlyphCount, nesting_level ); + + subst++; + SubstCount--; + i += buffer->in_pos - old_pos; + + if ( error == HB_Err_Not_Covered ) + { + if ( COPY_Glyph( buffer ) ) + return error; + i++; + } + else if ( error ) + return error; + } + else + { + /* No substitution for this index */ + + if ( COPY_Glyph( buffer ) ) + return error; + i++; + } + } + + return HB_Err_Ok; +} + + +/* LookupType 5 */ + +/* SubRule */ + +static HB_Error Load_SubRule( HB_SubRule* sr, + HB_Stream stream ) +{ + HB_Error error; + + HB_UShort n, count; + HB_UShort* i; + + HB_SubstLookupRecord* slr; + + + if ( ACCESS_Frame( 4L ) ) + return error; + + sr->GlyphCount = GET_UShort(); + sr->SubstCount = GET_UShort(); + + FORGET_Frame(); + + sr->Input = NULL; + + count = sr->GlyphCount - 1; /* only GlyphCount - 1 elements */ + + if ( ALLOC_ARRAY( sr->Input, count, HB_UShort ) ) + return error; + + i = sr->Input; + + if ( ACCESS_Frame( count * 2L ) ) + goto Fail2; + + for ( n = 0; n < count; n++ ) + i[n] = GET_UShort(); + + FORGET_Frame(); + + sr->SubstLookupRecord = NULL; + + count = sr->SubstCount; + + if ( ALLOC_ARRAY( sr->SubstLookupRecord, count, HB_SubstLookupRecord ) ) + goto Fail2; + + slr = sr->SubstLookupRecord; + + if ( ACCESS_Frame( count * 4L ) ) + goto Fail1; + + for ( n = 0; n < count; n++ ) + { + slr[n].SequenceIndex = GET_UShort(); + slr[n].LookupListIndex = GET_UShort(); + } + + FORGET_Frame(); + + return HB_Err_Ok; + +Fail1: + FREE( slr ); + +Fail2: + FREE( i ); + return error; +} + + +static void Free_SubRule( HB_SubRule* sr ) +{ + FREE( sr->SubstLookupRecord ); + FREE( sr->Input ); +} + + +/* SubRuleSet */ + +static HB_Error Load_SubRuleSet( HB_SubRuleSet* srs, + HB_Stream stream ) +{ + HB_Error error; + + HB_UShort n = 0, m, count; + HB_UInt cur_offset, new_offset, base_offset; + + HB_SubRule* sr; + + + base_offset = FILE_Pos(); + + if ( ACCESS_Frame( 2L ) ) + return error; + + count = srs->SubRuleCount = GET_UShort(); + + FORGET_Frame(); + + srs->SubRule = NULL; + + if ( ALLOC_ARRAY( srs->SubRule, count, HB_SubRule ) ) + return error; + + sr = srs->SubRule; + + for ( n = 0; n < count; n++ ) + { + if ( ACCESS_Frame( 2L ) ) + goto Fail; + + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = Load_SubRule( &sr[n], stream ) ) != HB_Err_Ok ) + goto Fail; + (void)FILE_Seek( cur_offset ); + } + + return HB_Err_Ok; + +Fail: + for ( m = 0; m < n; m++ ) + Free_SubRule( &sr[m] ); + + FREE( sr ); + return error; +} + + +static void Free_SubRuleSet( HB_SubRuleSet* srs ) +{ + HB_UShort n, count; + + HB_SubRule* sr; + + + if ( srs->SubRule ) + { + count = srs->SubRuleCount; + sr = srs->SubRule; + + for ( n = 0; n < count; n++ ) + Free_SubRule( &sr[n] ); + + FREE( sr ); + } +} + + +/* ContextSubstFormat1 */ + +static HB_Error Load_ContextSubst1( HB_ContextSubstFormat1* csf1, + HB_Stream stream ) +{ + HB_Error error; + + HB_UShort n = 0, m, count; + HB_UInt cur_offset, new_offset, base_offset; + + HB_SubRuleSet* srs; + + + base_offset = FILE_Pos() - 2L; + + if ( ACCESS_Frame( 2L ) ) + return error; + + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = _HB_OPEN_Load_Coverage( &csf1->Coverage, stream ) ) != HB_Err_Ok ) + return error; + (void)FILE_Seek( cur_offset ); + + if ( ACCESS_Frame( 2L ) ) + goto Fail2; + + count = csf1->SubRuleSetCount = GET_UShort(); + + FORGET_Frame(); + + csf1->SubRuleSet = NULL; + + if ( ALLOC_ARRAY( csf1->SubRuleSet, count, HB_SubRuleSet ) ) + goto Fail2; + + srs = csf1->SubRuleSet; + + for ( n = 0; n < count; n++ ) + { + if ( ACCESS_Frame( 2L ) ) + goto Fail1; + + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = Load_SubRuleSet( &srs[n], stream ) ) != HB_Err_Ok ) + goto Fail1; + (void)FILE_Seek( cur_offset ); + } + + return HB_Err_Ok; + +Fail1: + for ( m = 0; m < n; m++ ) + Free_SubRuleSet( &srs[m] ); + + FREE( srs ); + +Fail2: + _HB_OPEN_Free_Coverage( &csf1->Coverage ); + return error; +} + + +static void Free_ContextSubst1( HB_ContextSubstFormat1* csf1 ) +{ + HB_UShort n, count; + + HB_SubRuleSet* srs; + + + if ( csf1->SubRuleSet ) + { + count = csf1->SubRuleSetCount; + srs = csf1->SubRuleSet; + + for ( n = 0; n < count; n++ ) + Free_SubRuleSet( &srs[n] ); + + FREE( srs ); + } + + _HB_OPEN_Free_Coverage( &csf1->Coverage ); +} + + +/* SubClassRule */ + +static HB_Error Load_SubClassRule( HB_ContextSubstFormat2* csf2, + HB_SubClassRule* scr, + HB_Stream stream ) +{ + HB_Error error; + + HB_UShort n, count; + + HB_UShort* c; + HB_SubstLookupRecord* slr; + + + if ( ACCESS_Frame( 4L ) ) + return error; + + scr->GlyphCount = GET_UShort(); + scr->SubstCount = GET_UShort(); + + if ( scr->GlyphCount > csf2->MaxContextLength ) + csf2->MaxContextLength = scr->GlyphCount; + + FORGET_Frame(); + + scr->Class = NULL; + + count = scr->GlyphCount - 1; /* only GlyphCount - 1 elements */ + + if ( ALLOC_ARRAY( scr->Class, count, HB_UShort ) ) + return error; + + c = scr->Class; + + if ( ACCESS_Frame( count * 2L ) ) + goto Fail2; + + for ( n = 0; n < count; n++ ) + c[n] = GET_UShort(); + + FORGET_Frame(); + + scr->SubstLookupRecord = NULL; + + count = scr->SubstCount; + + if ( ALLOC_ARRAY( scr->SubstLookupRecord, count, HB_SubstLookupRecord ) ) + goto Fail2; + + slr = scr->SubstLookupRecord; + + if ( ACCESS_Frame( count * 4L ) ) + goto Fail1; + + for ( n = 0; n < count; n++ ) + { + slr[n].SequenceIndex = GET_UShort(); + slr[n].LookupListIndex = GET_UShort(); + } + + FORGET_Frame(); + + return HB_Err_Ok; + +Fail1: + FREE( slr ); + +Fail2: + FREE( c ); + return error; +} + + +static void Free_SubClassRule( HB_SubClassRule* scr ) +{ + FREE( scr->SubstLookupRecord ); + FREE( scr->Class ); +} + + +/* SubClassSet */ + +static HB_Error Load_SubClassSet( HB_ContextSubstFormat2* csf2, + HB_SubClassSet* scs, + HB_Stream stream ) +{ + HB_Error error; + + HB_UShort n = 0, m, count; + HB_UInt cur_offset, new_offset, base_offset; + + HB_SubClassRule* scr; + + + base_offset = FILE_Pos(); + + if ( ACCESS_Frame( 2L ) ) + return error; + + count = scs->SubClassRuleCount = GET_UShort(); + + FORGET_Frame(); + + scs->SubClassRule = NULL; + + if ( ALLOC_ARRAY( scs->SubClassRule, count, HB_SubClassRule ) ) + return error; + + scr = scs->SubClassRule; + + for ( n = 0; n < count; n++ ) + { + if ( ACCESS_Frame( 2L ) ) + goto Fail; + + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = Load_SubClassRule( csf2, &scr[n], + stream ) ) != HB_Err_Ok ) + goto Fail; + (void)FILE_Seek( cur_offset ); + } + + return HB_Err_Ok; + +Fail: + for ( m = 0; m < n; m++ ) + Free_SubClassRule( &scr[m] ); + + FREE( scr ); + return error; +} + + +static void Free_SubClassSet( HB_SubClassSet* scs ) +{ + HB_UShort n, count; + + HB_SubClassRule* scr; + + + if ( scs->SubClassRule ) + { + count = scs->SubClassRuleCount; + scr = scs->SubClassRule; + + for ( n = 0; n < count; n++ ) + Free_SubClassRule( &scr[n] ); + + FREE( scr ); + } +} + + +/* ContextSubstFormat2 */ + +static HB_Error Load_ContextSubst2( HB_ContextSubstFormat2* csf2, + HB_Stream stream ) +{ + HB_Error error; + + HB_UShort n = 0, m, count; + HB_UInt cur_offset, new_offset, base_offset; + + HB_SubClassSet* scs; + + + base_offset = FILE_Pos() - 2; + + if ( ACCESS_Frame( 2L ) ) + return error; + + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = _HB_OPEN_Load_Coverage( &csf2->Coverage, stream ) ) != HB_Err_Ok ) + return error; + (void)FILE_Seek( cur_offset ); + + if ( ACCESS_Frame( 4L ) ) + goto Fail3; + + new_offset = GET_UShort() + base_offset; + + /* `SubClassSetCount' is the upper limit for class values, thus we + read it now to make an additional safety check. */ + + count = csf2->SubClassSetCount = GET_UShort(); + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = _HB_OPEN_Load_ClassDefinition( &csf2->ClassDef, count, + stream ) ) != HB_Err_Ok ) + goto Fail3; + (void)FILE_Seek( cur_offset ); + + csf2->SubClassSet = NULL; + csf2->MaxContextLength = 0; + + if ( ALLOC_ARRAY( csf2->SubClassSet, count, HB_SubClassSet ) ) + goto Fail2; + + scs = csf2->SubClassSet; + + for ( n = 0; n < count; n++ ) + { + if ( ACCESS_Frame( 2L ) ) + goto Fail1; + + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + if ( new_offset != base_offset ) /* not a NULL offset */ + { + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = Load_SubClassSet( csf2, &scs[n], + stream ) ) != HB_Err_Ok ) + goto Fail1; + (void)FILE_Seek( cur_offset ); + } + else + { + /* we create a SubClassSet table with no entries */ + + csf2->SubClassSet[n].SubClassRuleCount = 0; + csf2->SubClassSet[n].SubClassRule = NULL; + } + } + + return HB_Err_Ok; + +Fail1: + for ( m = 0; m < n; m++ ) + Free_SubClassSet( &scs[m] ); + + FREE( scs ); + +Fail2: + _HB_OPEN_Free_ClassDefinition( &csf2->ClassDef ); + +Fail3: + _HB_OPEN_Free_Coverage( &csf2->Coverage ); + return error; +} + + +static void Free_ContextSubst2( HB_ContextSubstFormat2* csf2 ) +{ + HB_UShort n, count; + + HB_SubClassSet* scs; + + + if ( csf2->SubClassSet ) + { + count = csf2->SubClassSetCount; + scs = csf2->SubClassSet; + + for ( n = 0; n < count; n++ ) + Free_SubClassSet( &scs[n] ); + + FREE( scs ); + } + + _HB_OPEN_Free_ClassDefinition( &csf2->ClassDef ); + _HB_OPEN_Free_Coverage( &csf2->Coverage ); +} + + +/* ContextSubstFormat3 */ + +static HB_Error Load_ContextSubst3( HB_ContextSubstFormat3* csf3, + HB_Stream stream ) +{ + HB_Error error; + + HB_UShort n = 0, m, count; + HB_UInt cur_offset, new_offset, base_offset; + + HB_Coverage* c; + HB_SubstLookupRecord* slr; + + + base_offset = FILE_Pos() - 2L; + + if ( ACCESS_Frame( 4L ) ) + return error; + + csf3->GlyphCount = GET_UShort(); + csf3->SubstCount = GET_UShort(); + + FORGET_Frame(); + + csf3->Coverage = NULL; + + count = csf3->GlyphCount; + + if ( ALLOC_ARRAY( csf3->Coverage, count, HB_Coverage ) ) + return error; + + c = csf3->Coverage; + + for ( n = 0; n < count; n++ ) + { + if ( ACCESS_Frame( 2L ) ) + goto Fail2; + + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = _HB_OPEN_Load_Coverage( &c[n], stream ) ) != HB_Err_Ok ) + goto Fail2; + (void)FILE_Seek( cur_offset ); + } + + csf3->SubstLookupRecord = NULL; + + count = csf3->SubstCount; + + if ( ALLOC_ARRAY( csf3->SubstLookupRecord, count, + HB_SubstLookupRecord ) ) + goto Fail2; + + slr = csf3->SubstLookupRecord; + + if ( ACCESS_Frame( count * 4L ) ) + goto Fail1; + + for ( n = 0; n < count; n++ ) + { + slr[n].SequenceIndex = GET_UShort(); + slr[n].LookupListIndex = GET_UShort(); + } + + FORGET_Frame(); + + return HB_Err_Ok; + +Fail1: + FREE( slr ); + +Fail2: + for ( m = 0; m < n; m++ ) + _HB_OPEN_Free_Coverage( &c[m] ); + + FREE( c ); + return error; +} + + +static void Free_ContextSubst3( HB_ContextSubstFormat3* csf3 ) +{ + HB_UShort n, count; + + HB_Coverage* c; + + + FREE( csf3->SubstLookupRecord ); + + if ( csf3->Coverage ) + { + count = csf3->GlyphCount; + c = csf3->Coverage; + + for ( n = 0; n < count; n++ ) + _HB_OPEN_Free_Coverage( &c[n] ); + + FREE( c ); + } +} + + +/* ContextSubst */ + +static HB_Error Load_ContextSubst( HB_GSUB_SubTable* st, + HB_Stream stream ) +{ + HB_Error error; + HB_ContextSubst* cs = &st->context; + + + if ( ACCESS_Frame( 2L ) ) + return error; + + cs->SubstFormat = GET_UShort(); + + FORGET_Frame(); + + switch ( cs->SubstFormat ) + { + case 1: return Load_ContextSubst1( &cs->csf.csf1, stream ); + case 2: return Load_ContextSubst2( &cs->csf.csf2, stream ); + case 3: return Load_ContextSubst3( &cs->csf.csf3, stream ); + default: return ERR(HB_Err_Invalid_SubTable_Format); + } + + return HB_Err_Ok; /* never reached */ +} + + +static void Free_ContextSubst( HB_GSUB_SubTable* st ) +{ + HB_ContextSubst* cs = &st->context; + + switch ( cs->SubstFormat ) + { + case 1: Free_ContextSubst1( &cs->csf.csf1 ); break; + case 2: Free_ContextSubst2( &cs->csf.csf2 ); break; + case 3: Free_ContextSubst3( &cs->csf.csf3 ); break; + default: break; + } +} + + +static HB_Error Lookup_ContextSubst1( HB_GSUBHeader* gsub, + HB_ContextSubstFormat1* csf1, + HB_Buffer buffer, + HB_UShort flags, + HB_UShort context_length, + int nesting_level ) +{ + HB_UShort index, property; + HB_UShort i, j, k, numsr; + HB_Error error; + + HB_SubRule* sr; + HB_GDEFHeader* gdef; + + + gdef = gsub->gdef; + + if ( CHECK_Property( gdef, IN_CURITEM(), flags, &property ) ) + return error; + + error = _HB_OPEN_Coverage_Index( &csf1->Coverage, IN_CURGLYPH(), &index ); + if ( error ) + return error; + + sr = csf1->SubRuleSet[index].SubRule; + numsr = csf1->SubRuleSet[index].SubRuleCount; + + for ( k = 0; k < numsr; k++ ) + { + if ( context_length != 0xFFFF && context_length < sr[k].GlyphCount ) + goto next_subrule; + + if ( buffer->in_pos + sr[k].GlyphCount > buffer->in_length ) + goto next_subrule; /* context is too long */ + + for ( i = 1, j = buffer->in_pos + 1; i < sr[k].GlyphCount; i++, j++ ) + { + while ( CHECK_Property( gdef, IN_ITEM( j ), flags, &property ) ) + { + if ( error && error != HB_Err_Not_Covered ) + return error; + + if ( j + sr[k].GlyphCount - i == (HB_Int)buffer->in_length ) + goto next_subrule; + j++; + } + + if ( IN_GLYPH( j ) != sr[k].Input[i - 1] ) + goto next_subrule; + } + + return Do_ContextSubst( gsub, sr[k].GlyphCount, + sr[k].SubstCount, sr[k].SubstLookupRecord, + buffer, + nesting_level ); + next_subrule: + ; + } + + return HB_Err_Not_Covered; +} + + +static HB_Error Lookup_ContextSubst2( HB_GSUBHeader* gsub, + HB_ContextSubstFormat2* csf2, + HB_Buffer buffer, + HB_UShort flags, + HB_UShort context_length, + int nesting_level ) +{ + HB_UShort index, property; + HB_Error error; + HB_UShort i, j, k, known_classes; + + HB_UShort* classes; + HB_UShort* cl; + + HB_SubClassSet* scs; + HB_SubClassRule* sr; + HB_GDEFHeader* gdef; + + + gdef = gsub->gdef; + + if ( CHECK_Property( gdef, IN_CURITEM(), flags, &property ) ) + return error; + + /* Note: The coverage table in format 2 doesn't give an index into + anything. It just lets us know whether or not we need to + do any lookup at all. */ + + error = _HB_OPEN_Coverage_Index( &csf2->Coverage, IN_CURGLYPH(), &index ); + if ( error ) + return error; + + if (csf2->MaxContextLength < 1) + return HB_Err_Not_Covered; + + if ( ALLOC_ARRAY( classes, csf2->MaxContextLength, HB_UShort ) ) + return error; + + error = _HB_OPEN_Get_Class( &csf2->ClassDef, IN_CURGLYPH(), + &classes[0], NULL ); + if ( error && error != HB_Err_Not_Covered ) + goto End; + known_classes = 0; + + scs = &csf2->SubClassSet[classes[0]]; + if ( !scs ) + { + error = ERR(HB_Err_Invalid_SubTable); + goto End; + } + + for ( k = 0; k < scs->SubClassRuleCount; k++ ) + { + sr = &scs->SubClassRule[k]; + + if ( context_length != 0xFFFF && context_length < sr->GlyphCount ) + goto next_subclassrule; + + if ( buffer->in_pos + sr->GlyphCount > buffer->in_length ) + goto next_subclassrule; /* context is too long */ + + cl = sr->Class; + + /* Start at 1 because [0] is implied */ + + for ( i = 1, j = buffer->in_pos + 1; i < sr->GlyphCount; i++, j++ ) + { + while ( CHECK_Property( gdef, IN_ITEM( j ), flags, &property ) ) + { + if ( error && error != HB_Err_Not_Covered ) + goto End; + + if ( j + sr->GlyphCount - i < (HB_Int)buffer->in_length ) + goto next_subclassrule; + j++; + } + + if ( i > known_classes ) + { + /* Keeps us from having to do this for each rule */ + + error = _HB_OPEN_Get_Class( &csf2->ClassDef, IN_GLYPH( j ), &classes[i], NULL ); + if ( error && error != HB_Err_Not_Covered ) + goto End; + known_classes = i; + } + + if ( cl[i - 1] != classes[i] ) + goto next_subclassrule; + } + + error = Do_ContextSubst( gsub, sr->GlyphCount, + sr->SubstCount, sr->SubstLookupRecord, + buffer, + nesting_level ); + goto End; + + next_subclassrule: + ; + } + + error = HB_Err_Not_Covered; + +End: + FREE( classes ); + return error; +} + + +static HB_Error Lookup_ContextSubst3( HB_GSUBHeader* gsub, + HB_ContextSubstFormat3* csf3, + HB_Buffer buffer, + HB_UShort flags, + HB_UShort context_length, + int nesting_level ) +{ + HB_Error error; + HB_UShort index, i, j, property; + + HB_Coverage* c; + HB_GDEFHeader* gdef; + + + gdef = gsub->gdef; + + if ( CHECK_Property( gdef, IN_CURITEM(), flags, &property ) ) + return error; + + if ( context_length != 0xFFFF && context_length < csf3->GlyphCount ) + return HB_Err_Not_Covered; + + if ( buffer->in_pos + csf3->GlyphCount > buffer->in_length ) + return HB_Err_Not_Covered; /* context is too long */ + + c = csf3->Coverage; + + for ( i = 1, j = buffer->in_pos + 1; i < csf3->GlyphCount; i++, j++ ) + { + while ( CHECK_Property( gdef, IN_ITEM( j ), flags, &property ) ) + { + if ( error && error != HB_Err_Not_Covered ) + return error; + + if ( j + csf3->GlyphCount - i == (HB_Int)buffer->in_length ) + return HB_Err_Not_Covered; + j++; + } + + error = _HB_OPEN_Coverage_Index( &c[i], IN_GLYPH( j ), &index ); + if ( error ) + return error; + } + + return Do_ContextSubst( gsub, csf3->GlyphCount, + csf3->SubstCount, csf3->SubstLookupRecord, + buffer, + nesting_level ); +} + + +static HB_Error Lookup_ContextSubst( HB_GSUBHeader* gsub, + HB_GSUB_SubTable* st, + HB_Buffer buffer, + HB_UShort flags, + HB_UShort context_length, + int nesting_level ) +{ + HB_ContextSubst* cs = &st->context; + + switch ( cs->SubstFormat ) + { + case 1: return Lookup_ContextSubst1( gsub, &cs->csf.csf1, buffer, flags, context_length, nesting_level ); + case 2: return Lookup_ContextSubst2( gsub, &cs->csf.csf2, buffer, flags, context_length, nesting_level ); + case 3: return Lookup_ContextSubst3( gsub, &cs->csf.csf3, buffer, flags, context_length, nesting_level ); + default: return ERR(HB_Err_Invalid_SubTable_Format); + } + + return HB_Err_Ok; /* never reached */ +} + + +/* LookupType 6 */ + +/* ChainSubRule */ + +static HB_Error Load_ChainSubRule( HB_ChainSubRule* csr, + HB_Stream stream ) +{ + HB_Error error; + + HB_UShort n, count; + HB_UShort* b; + HB_UShort* i; + HB_UShort* l; + + HB_SubstLookupRecord* slr; + + + if ( ACCESS_Frame( 2L ) ) + return error; + + csr->BacktrackGlyphCount = GET_UShort(); + + FORGET_Frame(); + + csr->Backtrack = NULL; + + count = csr->BacktrackGlyphCount; + + if ( ALLOC_ARRAY( csr->Backtrack, count, HB_UShort ) ) + return error; + + b = csr->Backtrack; + + if ( ACCESS_Frame( count * 2L ) ) + goto Fail4; + + for ( n = 0; n < count; n++ ) + b[n] = GET_UShort(); + + FORGET_Frame(); + + if ( ACCESS_Frame( 2L ) ) + goto Fail4; + + csr->InputGlyphCount = GET_UShort(); + + FORGET_Frame(); + + csr->Input = NULL; + + count = csr->InputGlyphCount - 1; /* only InputGlyphCount - 1 elements */ + + if ( ALLOC_ARRAY( csr->Input, count, HB_UShort ) ) + goto Fail4; + + i = csr->Input; + + if ( ACCESS_Frame( count * 2L ) ) + goto Fail3; + + for ( n = 0; n < count; n++ ) + i[n] = GET_UShort(); + + FORGET_Frame(); + + if ( ACCESS_Frame( 2L ) ) + goto Fail3; + + csr->LookaheadGlyphCount = GET_UShort(); + + FORGET_Frame(); + + csr->Lookahead = NULL; + + count = csr->LookaheadGlyphCount; + + if ( ALLOC_ARRAY( csr->Lookahead, count, HB_UShort ) ) + goto Fail3; + + l = csr->Lookahead; + + if ( ACCESS_Frame( count * 2L ) ) + goto Fail2; + + for ( n = 0; n < count; n++ ) + l[n] = GET_UShort(); + + FORGET_Frame(); + + if ( ACCESS_Frame( 2L ) ) + goto Fail2; + + csr->SubstCount = GET_UShort(); + + FORGET_Frame(); + + csr->SubstLookupRecord = NULL; + + count = csr->SubstCount; + + if ( ALLOC_ARRAY( csr->SubstLookupRecord, count, HB_SubstLookupRecord ) ) + goto Fail2; + + slr = csr->SubstLookupRecord; + + if ( ACCESS_Frame( count * 4L ) ) + goto Fail1; + + for ( n = 0; n < count; n++ ) + { + slr[n].SequenceIndex = GET_UShort(); + slr[n].LookupListIndex = GET_UShort(); + } + + FORGET_Frame(); + + return HB_Err_Ok; + +Fail1: + FREE( slr ); + +Fail2: + FREE( l ); + +Fail3: + FREE( i ); + +Fail4: + FREE( b ); + return error; +} + + +static void Free_ChainSubRule( HB_ChainSubRule* csr ) +{ + FREE( csr->SubstLookupRecord ); + FREE( csr->Lookahead ); + FREE( csr->Input ); + FREE( csr->Backtrack ); +} + + +/* ChainSubRuleSet */ + +static HB_Error Load_ChainSubRuleSet( HB_ChainSubRuleSet* csrs, + HB_Stream stream ) +{ + HB_Error error; + + HB_UShort n = 0, m, count; + HB_UInt cur_offset, new_offset, base_offset; + + HB_ChainSubRule* csr; + + + base_offset = FILE_Pos(); + + if ( ACCESS_Frame( 2L ) ) + return error; + + count = csrs->ChainSubRuleCount = GET_UShort(); + + FORGET_Frame(); + + csrs->ChainSubRule = NULL; + + if ( ALLOC_ARRAY( csrs->ChainSubRule, count, HB_ChainSubRule ) ) + return error; + + csr = csrs->ChainSubRule; + + for ( n = 0; n < count; n++ ) + { + if ( ACCESS_Frame( 2L ) ) + goto Fail; + + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = Load_ChainSubRule( &csr[n], stream ) ) != HB_Err_Ok ) + goto Fail; + (void)FILE_Seek( cur_offset ); + } + + return HB_Err_Ok; + +Fail: + for ( m = 0; m < n; m++ ) + Free_ChainSubRule( &csr[m] ); + + FREE( csr ); + return error; +} + + +static void Free_ChainSubRuleSet( HB_ChainSubRuleSet* csrs ) +{ + HB_UShort n, count; + + HB_ChainSubRule* csr; + + + if ( csrs->ChainSubRule ) + { + count = csrs->ChainSubRuleCount; + csr = csrs->ChainSubRule; + + for ( n = 0; n < count; n++ ) + Free_ChainSubRule( &csr[n] ); + + FREE( csr ); + } +} + + +/* ChainContextSubstFormat1 */ + +static HB_Error Load_ChainContextSubst1( + HB_ChainContextSubstFormat1* ccsf1, + HB_Stream stream ) +{ + HB_Error error; + + HB_UShort n = 0, m, count; + HB_UInt cur_offset, new_offset, base_offset; + + HB_ChainSubRuleSet* csrs; + + + base_offset = FILE_Pos() - 2L; + + if ( ACCESS_Frame( 2L ) ) + return error; + + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = _HB_OPEN_Load_Coverage( &ccsf1->Coverage, stream ) ) != HB_Err_Ok ) + return error; + (void)FILE_Seek( cur_offset ); + + if ( ACCESS_Frame( 2L ) ) + goto Fail2; + + count = ccsf1->ChainSubRuleSetCount = GET_UShort(); + + FORGET_Frame(); + + ccsf1->ChainSubRuleSet = NULL; + + if ( ALLOC_ARRAY( ccsf1->ChainSubRuleSet, count, HB_ChainSubRuleSet ) ) + goto Fail2; + + csrs = ccsf1->ChainSubRuleSet; + + for ( n = 0; n < count; n++ ) + { + if ( ACCESS_Frame( 2L ) ) + goto Fail1; + + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = Load_ChainSubRuleSet( &csrs[n], stream ) ) != HB_Err_Ok ) + goto Fail1; + (void)FILE_Seek( cur_offset ); + } + + return HB_Err_Ok; + +Fail1: + for ( m = 0; m < n; m++ ) + Free_ChainSubRuleSet( &csrs[m] ); + + FREE( csrs ); + +Fail2: + _HB_OPEN_Free_Coverage( &ccsf1->Coverage ); + return error; +} + + +static void Free_ChainContextSubst1( HB_ChainContextSubstFormat1* ccsf1 ) +{ + HB_UShort n, count; + + HB_ChainSubRuleSet* csrs; + + + if ( ccsf1->ChainSubRuleSet ) + { + count = ccsf1->ChainSubRuleSetCount; + csrs = ccsf1->ChainSubRuleSet; + + for ( n = 0; n < count; n++ ) + Free_ChainSubRuleSet( &csrs[n] ); + + FREE( csrs ); + } + + _HB_OPEN_Free_Coverage( &ccsf1->Coverage ); +} + + +/* ChainSubClassRule */ + +static HB_Error Load_ChainSubClassRule( + HB_ChainContextSubstFormat2* ccsf2, + HB_ChainSubClassRule* cscr, + HB_Stream stream ) +{ + HB_Error error; + + HB_UShort n, count; + + HB_UShort* b; + HB_UShort* i; + HB_UShort* l; + HB_SubstLookupRecord* slr; + + + if ( ACCESS_Frame( 2L ) ) + return error; + + cscr->BacktrackGlyphCount = GET_UShort(); + + FORGET_Frame(); + + if ( cscr->BacktrackGlyphCount > ccsf2->MaxBacktrackLength ) + ccsf2->MaxBacktrackLength = cscr->BacktrackGlyphCount; + + cscr->Backtrack = NULL; + + count = cscr->BacktrackGlyphCount; + + if ( ALLOC_ARRAY( cscr->Backtrack, count, HB_UShort ) ) + return error; + + b = cscr->Backtrack; + + if ( ACCESS_Frame( count * 2L ) ) + goto Fail4; + + for ( n = 0; n < count; n++ ) + b[n] = GET_UShort(); + + FORGET_Frame(); + + if ( ACCESS_Frame( 2L ) ) + goto Fail4; + + cscr->InputGlyphCount = GET_UShort(); + + FORGET_Frame(); + + if ( cscr->InputGlyphCount > ccsf2->MaxInputLength ) + ccsf2->MaxInputLength = cscr->InputGlyphCount; + + cscr->Input = NULL; + + count = cscr->InputGlyphCount - 1; /* only InputGlyphCount - 1 elements */ + + if ( ALLOC_ARRAY( cscr->Input, count, HB_UShort ) ) + goto Fail4; + + i = cscr->Input; + + if ( ACCESS_Frame( count * 2L ) ) + goto Fail3; + + for ( n = 0; n < count; n++ ) + i[n] = GET_UShort(); + + FORGET_Frame(); + + if ( ACCESS_Frame( 2L ) ) + goto Fail3; + + cscr->LookaheadGlyphCount = GET_UShort(); + + FORGET_Frame(); + + if ( cscr->LookaheadGlyphCount > ccsf2->MaxLookaheadLength ) + ccsf2->MaxLookaheadLength = cscr->LookaheadGlyphCount; + + cscr->Lookahead = NULL; + + count = cscr->LookaheadGlyphCount; + + if ( ALLOC_ARRAY( cscr->Lookahead, count, HB_UShort ) ) + goto Fail3; + + l = cscr->Lookahead; + + if ( ACCESS_Frame( count * 2L ) ) + goto Fail2; + + for ( n = 0; n < count; n++ ) + l[n] = GET_UShort(); + + FORGET_Frame(); + + if ( ACCESS_Frame( 2L ) ) + goto Fail2; + + cscr->SubstCount = GET_UShort(); + + FORGET_Frame(); + + cscr->SubstLookupRecord = NULL; + + count = cscr->SubstCount; + + if ( ALLOC_ARRAY( cscr->SubstLookupRecord, count, + HB_SubstLookupRecord ) ) + goto Fail2; + + slr = cscr->SubstLookupRecord; + + if ( ACCESS_Frame( count * 4L ) ) + goto Fail1; + + for ( n = 0; n < count; n++ ) + { + slr[n].SequenceIndex = GET_UShort(); + slr[n].LookupListIndex = GET_UShort(); + } + + FORGET_Frame(); + + return HB_Err_Ok; + +Fail1: + FREE( slr ); + +Fail2: + FREE( l ); + +Fail3: + FREE( i ); + +Fail4: + FREE( b ); + return error; +} + + +static void Free_ChainSubClassRule( HB_ChainSubClassRule* cscr ) +{ + FREE( cscr->SubstLookupRecord ); + FREE( cscr->Lookahead ); + FREE( cscr->Input ); + FREE( cscr->Backtrack ); +} + + +/* SubClassSet */ + +static HB_Error Load_ChainSubClassSet( + HB_ChainContextSubstFormat2* ccsf2, + HB_ChainSubClassSet* cscs, + HB_Stream stream ) +{ + HB_Error error; + + HB_UShort n = 0, m, count; + HB_UInt cur_offset, new_offset, base_offset; + + HB_ChainSubClassRule* cscr; + + + base_offset = FILE_Pos(); + + if ( ACCESS_Frame( 2L ) ) + return error; + + count = cscs->ChainSubClassRuleCount = GET_UShort(); + + FORGET_Frame(); + + cscs->ChainSubClassRule = NULL; + + if ( ALLOC_ARRAY( cscs->ChainSubClassRule, count, + HB_ChainSubClassRule ) ) + return error; + + cscr = cscs->ChainSubClassRule; + + for ( n = 0; n < count; n++ ) + { + if ( ACCESS_Frame( 2L ) ) + goto Fail; + + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = Load_ChainSubClassRule( ccsf2, &cscr[n], + stream ) ) != HB_Err_Ok ) + goto Fail; + (void)FILE_Seek( cur_offset ); + } + + return HB_Err_Ok; + +Fail: + for ( m = 0; m < n; m++ ) + Free_ChainSubClassRule( &cscr[m] ); + + FREE( cscr ); + return error; +} + + +static void Free_ChainSubClassSet( HB_ChainSubClassSet* cscs ) +{ + HB_UShort n, count; + + HB_ChainSubClassRule* cscr; + + + if ( cscs->ChainSubClassRule ) + { + count = cscs->ChainSubClassRuleCount; + cscr = cscs->ChainSubClassRule; + + for ( n = 0; n < count; n++ ) + Free_ChainSubClassRule( &cscr[n] ); + + FREE( cscr ); + } +} + + +/* ChainContextSubstFormat2 */ + +static HB_Error Load_ChainContextSubst2( + HB_ChainContextSubstFormat2* ccsf2, + HB_Stream stream ) +{ + HB_Error error; + + HB_UShort n = 0, m, count; + HB_UInt cur_offset, new_offset, base_offset; + HB_UInt backtrack_offset, input_offset, lookahead_offset; + + HB_ChainSubClassSet* cscs; + + + base_offset = FILE_Pos() - 2; + + if ( ACCESS_Frame( 2L ) ) + return error; + + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = _HB_OPEN_Load_Coverage( &ccsf2->Coverage, stream ) ) != HB_Err_Ok ) + return error; + (void)FILE_Seek( cur_offset ); + + if ( ACCESS_Frame( 8L ) ) + goto Fail5; + + backtrack_offset = GET_UShort(); + input_offset = GET_UShort(); + lookahead_offset = GET_UShort(); + + /* `ChainSubClassSetCount' is the upper limit for input class values, + thus we read it now to make an additional safety check. No limit + is known or needed for the other two class definitions */ + + count = ccsf2->ChainSubClassSetCount = GET_UShort(); + + FORGET_Frame(); + + if ( ( error = _HB_OPEN_Load_EmptyOrClassDefinition( &ccsf2->BacktrackClassDef, 65535, + backtrack_offset, base_offset, + stream ) ) != HB_Err_Ok ) + goto Fail5; + + if ( ( error = _HB_OPEN_Load_EmptyOrClassDefinition( &ccsf2->InputClassDef, count, + input_offset, base_offset, + stream ) ) != HB_Err_Ok ) + goto Fail4; + if ( ( error = _HB_OPEN_Load_EmptyOrClassDefinition( &ccsf2->LookaheadClassDef, 65535, + lookahead_offset, base_offset, + stream ) ) != HB_Err_Ok ) + goto Fail3; + + ccsf2->ChainSubClassSet = NULL; + ccsf2->MaxBacktrackLength = 0; + ccsf2->MaxInputLength = 0; + ccsf2->MaxLookaheadLength = 0; + + if ( ALLOC_ARRAY( ccsf2->ChainSubClassSet, count, HB_ChainSubClassSet ) ) + goto Fail2; + + cscs = ccsf2->ChainSubClassSet; + + for ( n = 0; n < count; n++ ) + { + if ( ACCESS_Frame( 2L ) ) + goto Fail1; + + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + if ( new_offset != base_offset ) /* not a NULL offset */ + { + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = Load_ChainSubClassSet( ccsf2, &cscs[n], + stream ) ) != HB_Err_Ok ) + goto Fail1; + (void)FILE_Seek( cur_offset ); + } + else + { + /* we create a ChainSubClassSet table with no entries */ + + ccsf2->ChainSubClassSet[n].ChainSubClassRuleCount = 0; + ccsf2->ChainSubClassSet[n].ChainSubClassRule = NULL; + } + } + + return HB_Err_Ok; + +Fail1: + for ( m = 0; m < n; m++ ) + Free_ChainSubClassSet( &cscs[m] ); + + FREE( cscs ); + +Fail2: + _HB_OPEN_Free_ClassDefinition( &ccsf2->LookaheadClassDef ); + +Fail3: + _HB_OPEN_Free_ClassDefinition( &ccsf2->InputClassDef ); + +Fail4: + _HB_OPEN_Free_ClassDefinition( &ccsf2->BacktrackClassDef ); + +Fail5: + _HB_OPEN_Free_Coverage( &ccsf2->Coverage ); + return error; +} + + +static void Free_ChainContextSubst2( HB_ChainContextSubstFormat2* ccsf2 ) +{ + HB_UShort n, count; + + HB_ChainSubClassSet* cscs; + + + if ( ccsf2->ChainSubClassSet ) + { + count = ccsf2->ChainSubClassSetCount; + cscs = ccsf2->ChainSubClassSet; + + for ( n = 0; n < count; n++ ) + Free_ChainSubClassSet( &cscs[n] ); + + FREE( cscs ); + } + + _HB_OPEN_Free_ClassDefinition( &ccsf2->LookaheadClassDef ); + _HB_OPEN_Free_ClassDefinition( &ccsf2->InputClassDef ); + _HB_OPEN_Free_ClassDefinition( &ccsf2->BacktrackClassDef ); + + _HB_OPEN_Free_Coverage( &ccsf2->Coverage ); +} + + +/* ChainContextSubstFormat3 */ + +static HB_Error Load_ChainContextSubst3( + HB_ChainContextSubstFormat3* ccsf3, + HB_Stream stream ) +{ + HB_Error error; + + HB_UShort n, nb = 0, ni =0, nl = 0, m, count; + HB_UShort backtrack_count, input_count, lookahead_count; + HB_UInt cur_offset, new_offset, base_offset; + + HB_Coverage* b; + HB_Coverage* i; + HB_Coverage* l; + HB_SubstLookupRecord* slr; + + + base_offset = FILE_Pos() - 2L; + + if ( ACCESS_Frame( 2L ) ) + return error; + + ccsf3->BacktrackGlyphCount = GET_UShort(); + + FORGET_Frame(); + + ccsf3->BacktrackCoverage = NULL; + + backtrack_count = ccsf3->BacktrackGlyphCount; + + if ( ALLOC_ARRAY( ccsf3->BacktrackCoverage, backtrack_count, + HB_Coverage ) ) + return error; + + b = ccsf3->BacktrackCoverage; + + for ( nb = 0; nb < backtrack_count; nb++ ) + { + if ( ACCESS_Frame( 2L ) ) + goto Fail4; + + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = _HB_OPEN_Load_Coverage( &b[nb], stream ) ) != HB_Err_Ok ) + goto Fail4; + (void)FILE_Seek( cur_offset ); + } + + if ( ACCESS_Frame( 2L ) ) + goto Fail4; + + ccsf3->InputGlyphCount = GET_UShort(); + + FORGET_Frame(); + + ccsf3->InputCoverage = NULL; + + input_count = ccsf3->InputGlyphCount; + + if ( ALLOC_ARRAY( ccsf3->InputCoverage, input_count, HB_Coverage ) ) + goto Fail4; + + i = ccsf3->InputCoverage; + + for ( ni = 0; ni < input_count; ni++ ) + { + if ( ACCESS_Frame( 2L ) ) + goto Fail3; + + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = _HB_OPEN_Load_Coverage( &i[ni], stream ) ) != HB_Err_Ok ) + goto Fail3; + (void)FILE_Seek( cur_offset ); + } + + if ( ACCESS_Frame( 2L ) ) + goto Fail3; + + ccsf3->LookaheadGlyphCount = GET_UShort(); + + FORGET_Frame(); + + ccsf3->LookaheadCoverage = NULL; + + lookahead_count = ccsf3->LookaheadGlyphCount; + + if ( ALLOC_ARRAY( ccsf3->LookaheadCoverage, lookahead_count, + HB_Coverage ) ) + goto Fail3; + + l = ccsf3->LookaheadCoverage; + + for ( nl = 0; nl < lookahead_count; nl++ ) + { + if ( ACCESS_Frame( 2L ) ) + goto Fail2; + + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = _HB_OPEN_Load_Coverage( &l[nl], stream ) ) != HB_Err_Ok ) + goto Fail2; + (void)FILE_Seek( cur_offset ); + } + + if ( ACCESS_Frame( 2L ) ) + goto Fail2; + + ccsf3->SubstCount = GET_UShort(); + + FORGET_Frame(); + + ccsf3->SubstLookupRecord = NULL; + + count = ccsf3->SubstCount; + + if ( ALLOC_ARRAY( ccsf3->SubstLookupRecord, count, + HB_SubstLookupRecord ) ) + goto Fail2; + + slr = ccsf3->SubstLookupRecord; + + if ( ACCESS_Frame( count * 4L ) ) + goto Fail1; + + for ( n = 0; n < count; n++ ) + { + slr[n].SequenceIndex = GET_UShort(); + slr[n].LookupListIndex = GET_UShort(); + } + + FORGET_Frame(); + + return HB_Err_Ok; + +Fail1: + FREE( slr ); + +Fail2: + for ( m = 0; m < nl; m++ ) + _HB_OPEN_Free_Coverage( &l[m] ); + + FREE( l ); + +Fail3: + for ( m = 0; m < ni; m++ ) + _HB_OPEN_Free_Coverage( &i[m] ); + + FREE( i ); + +Fail4: + for ( m = 0; m < nb; m++ ) + _HB_OPEN_Free_Coverage( &b[m] ); + + FREE( b ); + return error; +} + + +static void Free_ChainContextSubst3( HB_ChainContextSubstFormat3* ccsf3 ) +{ + HB_UShort n, count; + + HB_Coverage* c; + + + FREE( ccsf3->SubstLookupRecord ); + + if ( ccsf3->LookaheadCoverage ) + { + count = ccsf3->LookaheadGlyphCount; + c = ccsf3->LookaheadCoverage; + + for ( n = 0; n < count; n++ ) + _HB_OPEN_Free_Coverage( &c[n] ); + + FREE( c ); + } + + if ( ccsf3->InputCoverage ) + { + count = ccsf3->InputGlyphCount; + c = ccsf3->InputCoverage; + + for ( n = 0; n < count; n++ ) + _HB_OPEN_Free_Coverage( &c[n] ); + + FREE( c ); + } + + if ( ccsf3->BacktrackCoverage ) + { + count = ccsf3->BacktrackGlyphCount; + c = ccsf3->BacktrackCoverage; + + for ( n = 0; n < count; n++ ) + _HB_OPEN_Free_Coverage( &c[n] ); + + FREE( c ); + } +} + + +/* ChainContextSubst */ + +static HB_Error Load_ChainContextSubst( HB_GSUB_SubTable* st, + HB_Stream stream ) +{ + HB_Error error; + HB_ChainContextSubst* ccs = &st->chain; + + if ( ACCESS_Frame( 2L ) ) + return error; + + ccs->SubstFormat = GET_UShort(); + + FORGET_Frame(); + + switch ( ccs->SubstFormat ) { + case 1: return Load_ChainContextSubst1( &ccs->ccsf.ccsf1, stream ); + case 2: return Load_ChainContextSubst2( &ccs->ccsf.ccsf2, stream ); + case 3: return Load_ChainContextSubst3( &ccs->ccsf.ccsf3, stream ); + default: return ERR(HB_Err_Invalid_SubTable_Format); + } + + return HB_Err_Ok; /* never reached */ +} + + +static void Free_ChainContextSubst( HB_GSUB_SubTable* st ) +{ + HB_ChainContextSubst* ccs = &st->chain; + + switch ( ccs->SubstFormat ) { + case 1: Free_ChainContextSubst1( &ccs->ccsf.ccsf1 ); break; + case 2: Free_ChainContextSubst2( &ccs->ccsf.ccsf2 ); break; + case 3: Free_ChainContextSubst3( &ccs->ccsf.ccsf3 ); break; + default: break; + } +} + + +static HB_Error Lookup_ChainContextSubst1( HB_GSUBHeader* gsub, + HB_ChainContextSubstFormat1* ccsf1, + HB_Buffer buffer, + HB_UShort flags, + HB_UShort context_length, + int nesting_level ) +{ + HB_UShort index, property; + HB_UShort i, j, k, num_csr; + HB_UShort bgc, igc, lgc; + HB_Error error; + + HB_ChainSubRule* csr; + HB_ChainSubRule curr_csr; + HB_GDEFHeader* gdef; + + + gdef = gsub->gdef; + + if ( CHECK_Property( gdef, IN_CURITEM(), flags, &property ) ) + return error; + + error = _HB_OPEN_Coverage_Index( &ccsf1->Coverage, IN_CURGLYPH(), &index ); + if ( error ) + return error; + + csr = ccsf1->ChainSubRuleSet[index].ChainSubRule; + num_csr = ccsf1->ChainSubRuleSet[index].ChainSubRuleCount; + + for ( k = 0; k < num_csr; k++ ) + { + curr_csr = csr[k]; + bgc = curr_csr.BacktrackGlyphCount; + igc = curr_csr.InputGlyphCount; + lgc = curr_csr.LookaheadGlyphCount; + + if ( context_length != 0xFFFF && context_length < igc ) + goto next_chainsubrule; + + /* check whether context is too long; it is a first guess only */ + + if ( bgc > buffer->out_pos || buffer->in_pos + igc + lgc > buffer->in_length ) + goto next_chainsubrule; + + if ( bgc ) + { + /* since we don't know in advance the number of glyphs to inspect, + we search backwards for matches in the backtrack glyph array */ + + for ( i = 0, j = buffer->out_pos - 1; i < bgc; i++, j-- ) + { + while ( CHECK_Property( gdef, OUT_ITEM( j ), flags, &property ) ) + { + if ( error && error != HB_Err_Not_Covered ) + return error; + + if ( j + 1 == bgc - i ) + goto next_chainsubrule; + j--; + } + + /* In OpenType 1.3, it is undefined whether the offsets of + backtrack glyphs is in logical order or not. Version 1.4 + will clarify this: + + Logical order - a b c d e f g h i j + i + Input offsets - 0 1 + Backtrack offsets - 3 2 1 0 + Lookahead offsets - 0 1 2 3 */ + + if ( OUT_GLYPH( j ) != curr_csr.Backtrack[i] ) + goto next_chainsubrule; + } + } + + /* Start at 1 because [0] is implied */ + + for ( i = 1, j = buffer->in_pos + 1; i < igc; i++, j++ ) + { + while ( CHECK_Property( gdef, IN_ITEM( j ), flags, &property ) ) + { + if ( error && error != HB_Err_Not_Covered ) + return error; + + if ( j + igc - i + lgc == (HB_Int)buffer->in_length ) + goto next_chainsubrule; + j++; + } + + if ( IN_GLYPH( j ) != curr_csr.Input[i - 1] ) + goto next_chainsubrule; + } + + /* we are starting to check for lookahead glyphs right after the + last context glyph */ + + for ( i = 0; i < lgc; i++, j++ ) + { + while ( CHECK_Property( gdef, IN_ITEM( j ), flags, &property ) ) + { + if ( error && error != HB_Err_Not_Covered ) + return error; + + if ( j + lgc - i == (HB_Int)buffer->in_length ) + goto next_chainsubrule; + j++; + } + + if ( IN_GLYPH( j ) != curr_csr.Lookahead[i] ) + goto next_chainsubrule; + } + + return Do_ContextSubst( gsub, igc, + curr_csr.SubstCount, + curr_csr.SubstLookupRecord, + buffer, + nesting_level ); + + next_chainsubrule: + ; + } + + return HB_Err_Not_Covered; +} + + +static HB_Error Lookup_ChainContextSubst2( HB_GSUBHeader* gsub, + HB_ChainContextSubstFormat2* ccsf2, + HB_Buffer buffer, + HB_UShort flags, + HB_UShort context_length, + int nesting_level ) +{ + HB_UShort index, property; + HB_Error error; + HB_UShort i, j, k; + HB_UShort bgc, igc, lgc; + HB_UShort known_backtrack_classes, + known_input_classes, + known_lookahead_classes; + + HB_UShort* backtrack_classes; + HB_UShort* input_classes; + HB_UShort* lookahead_classes; + + HB_UShort* bc; + HB_UShort* ic; + HB_UShort* lc; + + HB_ChainSubClassSet* cscs; + HB_ChainSubClassRule ccsr; + HB_GDEFHeader* gdef; + + + gdef = gsub->gdef; + + if ( CHECK_Property( gdef, IN_CURITEM(), flags, &property ) ) + return error; + + /* Note: The coverage table in format 2 doesn't give an index into + anything. It just lets us know whether or not we need to + do any lookup at all. */ + + error = _HB_OPEN_Coverage_Index( &ccsf2->Coverage, IN_CURGLYPH(), &index ); + if ( error ) + return error; + + if ( ALLOC_ARRAY( backtrack_classes, ccsf2->MaxBacktrackLength, HB_UShort ) ) + return error; + known_backtrack_classes = 0; + + if (ccsf2->MaxInputLength < 1) + return HB_Err_Not_Covered; + + if ( ALLOC_ARRAY( input_classes, ccsf2->MaxInputLength, HB_UShort ) ) + goto End3; + known_input_classes = 1; + + if ( ALLOC_ARRAY( lookahead_classes, ccsf2->MaxLookaheadLength, HB_UShort ) ) + goto End2; + known_lookahead_classes = 0; + + error = _HB_OPEN_Get_Class( &ccsf2->InputClassDef, IN_CURGLYPH(), + &input_classes[0], NULL ); + if ( error && error != HB_Err_Not_Covered ) + goto End1; + + cscs = &ccsf2->ChainSubClassSet[input_classes[0]]; + if ( !cscs ) + { + error = ERR(HB_Err_Invalid_SubTable); + goto End1; + } + + for ( k = 0; k < cscs->ChainSubClassRuleCount; k++ ) + { + ccsr = cscs->ChainSubClassRule[k]; + bgc = ccsr.BacktrackGlyphCount; + igc = ccsr.InputGlyphCount; + lgc = ccsr.LookaheadGlyphCount; + + if ( context_length != 0xFFFF && context_length < igc ) + goto next_chainsubclassrule; + + /* check whether context is too long; it is a first guess only */ + + if ( bgc > buffer->out_pos || buffer->in_pos + igc + lgc > buffer->in_length ) + goto next_chainsubclassrule; + + if ( bgc ) + { + /* Since we don't know in advance the number of glyphs to inspect, + we search backwards for matches in the backtrack glyph array. + Note that `known_backtrack_classes' starts at index 0. */ + + bc = ccsr.Backtrack; + + for ( i = 0, j = buffer->out_pos - 1; i < bgc; i++, j-- ) + { + while ( CHECK_Property( gdef, OUT_ITEM( j ), flags, &property ) ) + { + if ( error && error != HB_Err_Not_Covered ) + goto End1; + + if ( j + 1 == bgc - i ) + goto next_chainsubclassrule; + j--; + } + + if ( i >= known_backtrack_classes ) + { + /* Keeps us from having to do this for each rule */ + + error = _HB_OPEN_Get_Class( &ccsf2->BacktrackClassDef, OUT_GLYPH( j ), + &backtrack_classes[i], NULL ); + if ( error && error != HB_Err_Not_Covered ) + goto End1; + known_backtrack_classes = i; + } + + if ( bc[i] != backtrack_classes[i] ) + goto next_chainsubclassrule; + } + } + + ic = ccsr.Input; + + /* Start at 1 because [0] is implied */ + + for ( i = 1, j = buffer->in_pos + 1; i < igc; i++, j++ ) + { + while ( CHECK_Property( gdef, IN_ITEM( j ), flags, &property ) ) + { + if ( error && error != HB_Err_Not_Covered ) + goto End1; + + if ( j + igc - i + lgc == (HB_Int)buffer->in_length ) + goto next_chainsubclassrule; + j++; + } + + if ( i >= known_input_classes ) + { + error = _HB_OPEN_Get_Class( &ccsf2->InputClassDef, IN_GLYPH( j ), + &input_classes[i], NULL ); + if ( error && error != HB_Err_Not_Covered ) + goto End1; + known_input_classes = i; + } + + if ( ic[i - 1] != input_classes[i] ) + goto next_chainsubclassrule; + } + + /* we are starting to check for lookahead glyphs right after the + last context glyph */ + + lc = ccsr.Lookahead; + + for ( i = 0; i < lgc; i++, j++ ) + { + while ( CHECK_Property( gdef, IN_ITEM( j ), flags, &property ) ) + { + if ( error && error != HB_Err_Not_Covered ) + goto End1; + + if ( j + lgc - i == (HB_Int)buffer->in_length ) + goto next_chainsubclassrule; + j++; + } + + if ( i >= known_lookahead_classes ) + { + error = _HB_OPEN_Get_Class( &ccsf2->LookaheadClassDef, IN_GLYPH( j ), + &lookahead_classes[i], NULL ); + if ( error && error != HB_Err_Not_Covered ) + goto End1; + known_lookahead_classes = i; + } + + if ( lc[i] != lookahead_classes[i] ) + goto next_chainsubclassrule; + } + + error = Do_ContextSubst( gsub, igc, + ccsr.SubstCount, + ccsr.SubstLookupRecord, + buffer, + nesting_level ); + goto End1; + + next_chainsubclassrule: + ; + } + + error = HB_Err_Not_Covered; + +End1: + FREE( lookahead_classes ); + +End2: + FREE( input_classes ); + +End3: + FREE( backtrack_classes ); + return error; +} + + +static HB_Error Lookup_ChainContextSubst3( HB_GSUBHeader* gsub, + HB_ChainContextSubstFormat3* ccsf3, + HB_Buffer buffer, + HB_UShort flags, + HB_UShort context_length, + int nesting_level ) +{ + HB_UShort index, i, j, property; + HB_UShort bgc, igc, lgc; + HB_Error error; + + HB_Coverage* bc; + HB_Coverage* ic; + HB_Coverage* lc; + HB_GDEFHeader* gdef; + + + gdef = gsub->gdef; + + if ( CHECK_Property( gdef, IN_CURITEM(), flags, &property ) ) + return error; + + bgc = ccsf3->BacktrackGlyphCount; + igc = ccsf3->InputGlyphCount; + lgc = ccsf3->LookaheadGlyphCount; + + if ( context_length != 0xFFFF && context_length < igc ) + return HB_Err_Not_Covered; + + /* check whether context is too long; it is a first guess only */ + + if ( bgc > buffer->out_pos || buffer->in_pos + igc + lgc > buffer->in_length ) + return HB_Err_Not_Covered; + + if ( bgc ) + { + /* Since we don't know in advance the number of glyphs to inspect, + we search backwards for matches in the backtrack glyph array */ + + bc = ccsf3->BacktrackCoverage; + + for ( i = 0, j = buffer->out_pos - 1; i < bgc; i++, j-- ) + { + while ( CHECK_Property( gdef, OUT_ITEM( j ), flags, &property ) ) + { + if ( error && error != HB_Err_Not_Covered ) + return error; + + if ( j + 1 == bgc - i ) + return HB_Err_Not_Covered; + j--; + } + + error = _HB_OPEN_Coverage_Index( &bc[i], OUT_GLYPH( j ), &index ); + if ( error ) + return error; + } + } + + ic = ccsf3->InputCoverage; + + for ( i = 0, j = buffer->in_pos; i < igc; i++, j++ ) + { + /* We already called CHECK_Property for IN_GLYPH( buffer->in_pos ) */ + while ( j > buffer->in_pos && CHECK_Property( gdef, IN_ITEM( j ), flags, &property ) ) + { + if ( error && error != HB_Err_Not_Covered ) + return error; + + if ( j + igc - i + lgc == (HB_Int)buffer->in_length ) + return HB_Err_Not_Covered; + j++; + } + + error = _HB_OPEN_Coverage_Index( &ic[i], IN_GLYPH( j ), &index ); + if ( error ) + return error; + } + + /* we are starting for lookahead glyphs right after the last context + glyph */ + + lc = ccsf3->LookaheadCoverage; + + for ( i = 0; i < lgc; i++, j++ ) + { + while ( CHECK_Property( gdef, IN_ITEM( j ), flags, &property ) ) + { + if ( error && error != HB_Err_Not_Covered ) + return error; + + if ( j + lgc - i == (HB_Int)buffer->in_length ) + return HB_Err_Not_Covered; + j++; + } + + error = _HB_OPEN_Coverage_Index( &lc[i], IN_GLYPH( j ), &index ); + if ( error ) + return error; + } + + return Do_ContextSubst( gsub, igc, + ccsf3->SubstCount, + ccsf3->SubstLookupRecord, + buffer, + nesting_level ); +} + + +static HB_Error Lookup_ChainContextSubst( HB_GSUBHeader* gsub, + HB_GSUB_SubTable* st, + HB_Buffer buffer, + HB_UShort flags, + HB_UShort context_length, + int nesting_level ) +{ + HB_ChainContextSubst* ccs = &st->chain; + + switch ( ccs->SubstFormat ) { + case 1: return Lookup_ChainContextSubst1( gsub, &ccs->ccsf.ccsf1, buffer, flags, context_length, nesting_level ); + case 2: return Lookup_ChainContextSubst2( gsub, &ccs->ccsf.ccsf2, buffer, flags, context_length, nesting_level ); + case 3: return Lookup_ChainContextSubst3( gsub, &ccs->ccsf.ccsf3, buffer, flags, context_length, nesting_level ); + default: return ERR(HB_Err_Invalid_SubTable_Format); + } +} + + +static HB_Error Load_ReverseChainContextSubst( HB_GSUB_SubTable* st, + HB_Stream stream ) +{ + HB_Error error; + HB_ReverseChainContextSubst* rccs = &st->reverse; + + HB_UShort m, count; + + HB_UShort nb = 0, nl = 0, n; + HB_UShort backtrack_count, lookahead_count; + HB_UInt cur_offset, new_offset, base_offset; + + HB_Coverage* b; + HB_Coverage* l; + HB_UShort* sub; + + base_offset = FILE_Pos(); + + if ( ACCESS_Frame( 2L ) ) + return error; + + rccs->SubstFormat = GET_UShort(); + + if ( rccs->SubstFormat != 1 ) + return ERR(HB_Err_Invalid_SubTable_Format); + + FORGET_Frame(); + + if ( ACCESS_Frame( 2L ) ) + return error; + + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = _HB_OPEN_Load_Coverage( &rccs->Coverage, stream ) ) != HB_Err_Ok ) + return error; + (void)FILE_Seek( cur_offset ); + + + if ( ACCESS_Frame( 2L ) ) + goto Fail4; + + rccs->BacktrackGlyphCount = GET_UShort(); + + FORGET_Frame(); + + rccs->BacktrackCoverage = NULL; + + backtrack_count = rccs->BacktrackGlyphCount; + + if ( ALLOC_ARRAY( rccs->BacktrackCoverage, backtrack_count, + HB_Coverage ) ) + goto Fail4; + + b = rccs->BacktrackCoverage; + + for ( nb = 0; nb < backtrack_count; nb++ ) + { + if ( ACCESS_Frame( 2L ) ) + goto Fail3; + + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = _HB_OPEN_Load_Coverage( &b[nb], stream ) ) != HB_Err_Ok ) + goto Fail3; + (void)FILE_Seek( cur_offset ); + } + + + if ( ACCESS_Frame( 2L ) ) + goto Fail3; + + rccs->LookaheadGlyphCount = GET_UShort(); + + FORGET_Frame(); + + rccs->LookaheadCoverage = NULL; + + lookahead_count = rccs->LookaheadGlyphCount; + + if ( ALLOC_ARRAY( rccs->LookaheadCoverage, lookahead_count, + HB_Coverage ) ) + goto Fail3; + + l = rccs->LookaheadCoverage; + + for ( nl = 0; nl < lookahead_count; nl++ ) + { + if ( ACCESS_Frame( 2L ) ) + goto Fail2; + + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = _HB_OPEN_Load_Coverage( &l[nl], stream ) ) != HB_Err_Ok ) + goto Fail2; + (void)FILE_Seek( cur_offset ); + } + + if ( ACCESS_Frame( 2L ) ) + goto Fail2; + + rccs->GlyphCount = GET_UShort(); + + FORGET_Frame(); + + rccs->Substitute = NULL; + + count = rccs->GlyphCount; + + if ( ALLOC_ARRAY( rccs->Substitute, count, + HB_UShort ) ) + goto Fail2; + + sub = rccs->Substitute; + + if ( ACCESS_Frame( count * 2L ) ) + goto Fail1; + + for ( n = 0; n < count; n++ ) + sub[n] = GET_UShort(); + + FORGET_Frame(); + + return HB_Err_Ok; + +Fail1: + FREE( sub ); + +Fail2: + for ( m = 0; m < nl; m++ ) + _HB_OPEN_Free_Coverage( &l[m] ); + + FREE( l ); + +Fail3: + for ( m = 0; m < nb; m++ ) + _HB_OPEN_Free_Coverage( &b[m] ); + + FREE( b ); + +Fail4: + _HB_OPEN_Free_Coverage( &rccs->Coverage ); + return error; +} + + +static void Free_ReverseChainContextSubst( HB_GSUB_SubTable* st ) +{ + HB_UShort n, count; + HB_ReverseChainContextSubst* rccs = &st->reverse; + + HB_Coverage* c; + + _HB_OPEN_Free_Coverage( &rccs->Coverage ); + + if ( rccs->LookaheadCoverage ) + { + count = rccs->LookaheadGlyphCount; + c = rccs->LookaheadCoverage; + + for ( n = 0; n < count; n++ ) + _HB_OPEN_Free_Coverage( &c[n] ); + + FREE( c ); + } + + if ( rccs->BacktrackCoverage ) + { + count = rccs->BacktrackGlyphCount; + c = rccs->BacktrackCoverage; + + for ( n = 0; n < count; n++ ) + _HB_OPEN_Free_Coverage( &c[n] ); + + FREE( c ); + } + + FREE ( rccs->Substitute ); +} + + +static HB_Error Lookup_ReverseChainContextSubst( HB_GSUBHeader* gsub, + HB_GSUB_SubTable* st, + HB_Buffer buffer, + HB_UShort flags, + HB_UShort context_length, + int nesting_level ) +{ + HB_UShort index, input_index, i, j, property; + HB_UShort bgc, lgc; + HB_Error error; + + HB_ReverseChainContextSubst* rccs = &st->reverse; + HB_Coverage* bc; + HB_Coverage* lc; + HB_GDEFHeader* gdef; + + if ( nesting_level != 1 || context_length != 0xFFFF ) + return HB_Err_Not_Covered; + + gdef = gsub->gdef; + + if ( CHECK_Property( gdef, IN_CURITEM(), flags, &property ) ) + return error; + + bgc = rccs->BacktrackGlyphCount; + lgc = rccs->LookaheadGlyphCount; + + /* check whether context is too long; it is a first guess only */ + + if ( bgc > buffer->in_pos || buffer->in_pos + 1 + lgc > buffer->in_length ) + return HB_Err_Not_Covered; + + if ( bgc ) + { + /* Since we don't know in advance the number of glyphs to inspect, + we search backwards for matches in the backtrack glyph array */ + + bc = rccs->BacktrackCoverage; + + for ( i = 0, j = buffer->in_pos - 1; i < bgc; i++, j-- ) + { + while ( CHECK_Property( gdef, IN_ITEM( j ), flags, &property ) ) + { + if ( error && error != HB_Err_Not_Covered ) + return error; + + if ( j + 1 == bgc - i ) + return HB_Err_Not_Covered; + j--; + } + + error = _HB_OPEN_Coverage_Index( &bc[i], IN_GLYPH( j ), &index ); + if ( error ) + return error; + } + } + + j = buffer->in_pos; + + error = _HB_OPEN_Coverage_Index( &rccs->Coverage, IN_GLYPH( j ), &input_index ); + if ( error ) + return error; + + lc = rccs->LookaheadCoverage; + + for ( i = 0, j = buffer->in_pos + 1; i < lgc; i++, j++ ) + { + while ( CHECK_Property( gdef, IN_ITEM( j ), flags, &property ) ) + { + if ( error && error != HB_Err_Not_Covered ) + return error; + + if ( j + lgc - i == (HB_Int)buffer->in_length ) + return HB_Err_Not_Covered; + j++; + } + + error = _HB_OPEN_Coverage_Index( &lc[i], IN_GLYPH( j ), &index ); + if ( error ) + return error; + } + + IN_CURGLYPH() = rccs->Substitute[input_index]; + buffer->in_pos--; /* Reverse! */ + + return error; +} + + + +/*********** + * GSUB API + ***********/ + + + +HB_Error HB_GSUB_Select_Script( HB_GSUBHeader* gsub, + HB_UInt script_tag, + HB_UShort* script_index ) +{ + HB_UShort n; + + HB_ScriptList* sl; + HB_ScriptRecord* sr; + + + if ( !gsub || !script_index ) + return ERR(HB_Err_Invalid_Argument); + + sl = &gsub->ScriptList; + sr = sl->ScriptRecord; + + for ( n = 0; n < sl->ScriptCount; n++ ) + if ( script_tag == sr[n].ScriptTag ) + { + *script_index = n; + + return HB_Err_Ok; + } + + return HB_Err_Not_Covered; +} + + + +HB_Error HB_GSUB_Select_Language( HB_GSUBHeader* gsub, + HB_UInt language_tag, + HB_UShort script_index, + HB_UShort* language_index, + HB_UShort* req_feature_index ) +{ + HB_UShort n; + + HB_ScriptList* sl; + HB_ScriptRecord* sr; + HB_ScriptTable* s; + HB_LangSysRecord* lsr; + + + if ( !gsub || !language_index || !req_feature_index ) + return ERR(HB_Err_Invalid_Argument); + + sl = &gsub->ScriptList; + sr = sl->ScriptRecord; + + if ( script_index >= sl->ScriptCount ) + return ERR(HB_Err_Invalid_Argument); + + s = &sr[script_index].Script; + lsr = s->LangSysRecord; + + for ( n = 0; n < s->LangSysCount; n++ ) + if ( language_tag == lsr[n].LangSysTag ) + { + *language_index = n; + *req_feature_index = lsr[n].LangSys.ReqFeatureIndex; + + return HB_Err_Ok; + } + + return HB_Err_Not_Covered; +} + + +/* selecting 0xFFFF for language_index asks for the values of the + default language (DefaultLangSys) */ + + +HB_Error HB_GSUB_Select_Feature( HB_GSUBHeader* gsub, + HB_UInt feature_tag, + HB_UShort script_index, + HB_UShort language_index, + HB_UShort* feature_index ) +{ + HB_UShort n; + + HB_ScriptList* sl; + HB_ScriptRecord* sr; + HB_ScriptTable* s; + HB_LangSysRecord* lsr; + HB_LangSys* ls; + HB_UShort* fi; + + HB_FeatureList* fl; + HB_FeatureRecord* fr; + + + if ( !gsub || !feature_index ) + return ERR(HB_Err_Invalid_Argument); + + sl = &gsub->ScriptList; + sr = sl->ScriptRecord; + + fl = &gsub->FeatureList; + fr = fl->FeatureRecord; + + if ( script_index >= sl->ScriptCount ) + return ERR(HB_Err_Invalid_Argument); + + s = &sr[script_index].Script; + lsr = s->LangSysRecord; + + if ( language_index == 0xFFFF ) + ls = &s->DefaultLangSys; + else + { + if ( language_index >= s->LangSysCount ) + return ERR(HB_Err_Invalid_Argument); + + ls = &lsr[language_index].LangSys; + } + + fi = ls->FeatureIndex; + + for ( n = 0; n < ls->FeatureCount; n++ ) + { + if ( fi[n] >= fl->FeatureCount ) + return ERR(HB_Err_Invalid_SubTable_Format); + + if ( feature_tag == fr[fi[n]].FeatureTag ) + { + *feature_index = fi[n]; + + return HB_Err_Ok; + } + } + + return HB_Err_Not_Covered; +} + + +/* The next three functions return a null-terminated list */ + + +HB_Error HB_GSUB_Query_Scripts( HB_GSUBHeader* gsub, + HB_UInt** script_tag_list ) +{ + HB_UShort n; + HB_Error error; + HB_UInt* stl; + + HB_ScriptList* sl; + HB_ScriptRecord* sr; + + + if ( !gsub || !script_tag_list ) + return ERR(HB_Err_Invalid_Argument); + + sl = &gsub->ScriptList; + sr = sl->ScriptRecord; + + if ( ALLOC_ARRAY( stl, sl->ScriptCount + 1, HB_UInt ) ) + return error; + + for ( n = 0; n < sl->ScriptCount; n++ ) + stl[n] = sr[n].ScriptTag; + stl[n] = 0; + + *script_tag_list = stl; + + return HB_Err_Ok; +} + + + +HB_Error HB_GSUB_Query_Languages( HB_GSUBHeader* gsub, + HB_UShort script_index, + HB_UInt** language_tag_list ) +{ + HB_UShort n; + HB_Error error; + HB_UInt* ltl; + + HB_ScriptList* sl; + HB_ScriptRecord* sr; + HB_ScriptTable* s; + HB_LangSysRecord* lsr; + + + if ( !gsub || !language_tag_list ) + return ERR(HB_Err_Invalid_Argument); + + sl = &gsub->ScriptList; + sr = sl->ScriptRecord; + + if ( script_index >= sl->ScriptCount ) + return ERR(HB_Err_Invalid_Argument); + + s = &sr[script_index].Script; + lsr = s->LangSysRecord; + + if ( ALLOC_ARRAY( ltl, s->LangSysCount + 1, HB_UInt ) ) + return error; + + for ( n = 0; n < s->LangSysCount; n++ ) + ltl[n] = lsr[n].LangSysTag; + ltl[n] = 0; + + *language_tag_list = ltl; + + return HB_Err_Ok; +} + + +/* selecting 0xFFFF for language_index asks for the values of the + default language (DefaultLangSys) */ + + +HB_Error HB_GSUB_Query_Features( HB_GSUBHeader* gsub, + HB_UShort script_index, + HB_UShort language_index, + HB_UInt** feature_tag_list ) +{ + HB_UShort n; + HB_Error error; + HB_UInt* ftl; + + HB_ScriptList* sl; + HB_ScriptRecord* sr; + HB_ScriptTable* s; + HB_LangSysRecord* lsr; + HB_LangSys* ls; + HB_UShort* fi; + + HB_FeatureList* fl; + HB_FeatureRecord* fr; + + + if ( !gsub || !feature_tag_list ) + return ERR(HB_Err_Invalid_Argument); + + sl = &gsub->ScriptList; + sr = sl->ScriptRecord; + + fl = &gsub->FeatureList; + fr = fl->FeatureRecord; + + if ( script_index >= sl->ScriptCount ) + return ERR(HB_Err_Invalid_Argument); + + s = &sr[script_index].Script; + lsr = s->LangSysRecord; + + if ( language_index == 0xFFFF ) + ls = &s->DefaultLangSys; + else + { + if ( language_index >= s->LangSysCount ) + return ERR(HB_Err_Invalid_Argument); + + ls = &lsr[language_index].LangSys; + } + + fi = ls->FeatureIndex; + + if ( ALLOC_ARRAY( ftl, ls->FeatureCount + 1, HB_UInt ) ) + return error; + + for ( n = 0; n < ls->FeatureCount; n++ ) + { + if ( fi[n] >= fl->FeatureCount ) + { + FREE( ftl ); + return ERR(HB_Err_Invalid_SubTable_Format); + } + ftl[n] = fr[fi[n]].FeatureTag; + } + ftl[n] = 0; + + *feature_tag_list = ftl; + + return HB_Err_Ok; +} + + +/* Do an individual subtable lookup. Returns HB_Err_Ok if substitution + has been done, or HB_Err_Not_Covered if not. */ +static HB_Error GSUB_Do_Glyph_Lookup( HB_GSUBHeader* gsub, + HB_UShort lookup_index, + HB_Buffer buffer, + HB_UShort context_length, + int nesting_level ) +{ + HB_Error error = HB_Err_Not_Covered; + HB_UShort i, flags, lookup_count; + HB_Lookup* lo; + int lookup_type; + + nesting_level++; + + if ( nesting_level > HB_MAX_NESTING_LEVEL ) + return ERR(HB_Err_Not_Covered); /* ERR() call intended */ + + lookup_count = gsub->LookupList.LookupCount; + if (lookup_index >= lookup_count) + return error; + + lo = &gsub->LookupList.Lookup[lookup_index]; + flags = lo->LookupFlag; + lookup_type = lo->LookupType; + + for ( i = 0; i < lo->SubTableCount; i++ ) + { + HB_GSUB_SubTable *st = &lo->SubTable[i].st.gsub; + + switch (lookup_type) { + case HB_GSUB_LOOKUP_SINGLE: + error = Lookup_SingleSubst ( gsub, st, buffer, flags, context_length, nesting_level ); break; + case HB_GSUB_LOOKUP_MULTIPLE: + error = Lookup_MultipleSubst ( gsub, st, buffer, flags, context_length, nesting_level ); break; + case HB_GSUB_LOOKUP_ALTERNATE: + error = Lookup_AlternateSubst ( gsub, st, buffer, flags, context_length, nesting_level ); break; + case HB_GSUB_LOOKUP_LIGATURE: + error = Lookup_LigatureSubst ( gsub, st, buffer, flags, context_length, nesting_level ); break; + case HB_GSUB_LOOKUP_CONTEXT: + error = Lookup_ContextSubst ( gsub, st, buffer, flags, context_length, nesting_level ); break; + case HB_GSUB_LOOKUP_CHAIN: + error = Lookup_ChainContextSubst ( gsub, st, buffer, flags, context_length, nesting_level ); break; + /*case HB_GSUB_LOOKUP_EXTENSION: + error = Lookup_ExtensionSubst ( gsub, st, buffer, flags, context_length, nesting_level ); break;*/ + case HB_GSUB_LOOKUP_REVERSE_CHAIN: + error = Lookup_ReverseChainContextSubst ( gsub, st, buffer, flags, context_length, nesting_level ); break; + default: + error = HB_Err_Not_Covered; + }; + + /* Check whether we have a successful substitution or an error other + than HB_Err_Not_Covered */ + if ( error != HB_Err_Not_Covered ) + return error; + } + + return HB_Err_Not_Covered; +} + + +HB_INTERNAL HB_Error +_HB_GSUB_Load_SubTable( HB_GSUB_SubTable* st, + HB_Stream stream, + HB_UShort lookup_type ) +{ + switch (lookup_type) { + case HB_GSUB_LOOKUP_SINGLE: return Load_SingleSubst ( st, stream ); + case HB_GSUB_LOOKUP_MULTIPLE: return Load_MultipleSubst ( st, stream ); + case HB_GSUB_LOOKUP_ALTERNATE: return Load_AlternateSubst ( st, stream ); + case HB_GSUB_LOOKUP_LIGATURE: return Load_LigatureSubst ( st, stream ); + case HB_GSUB_LOOKUP_CONTEXT: return Load_ContextSubst ( st, stream ); + case HB_GSUB_LOOKUP_CHAIN: return Load_ChainContextSubst ( st, stream ); + /*case HB_GSUB_LOOKUP_EXTENSION: return Load_ExtensionSubst ( st, stream );*/ + case HB_GSUB_LOOKUP_REVERSE_CHAIN: return Load_ReverseChainContextSubst ( st, stream ); + default: return ERR(HB_Err_Invalid_SubTable_Format); + }; +} + + +HB_INTERNAL void +_HB_GSUB_Free_SubTable( HB_GSUB_SubTable* st, + HB_UShort lookup_type ) +{ + switch ( lookup_type ) { + case HB_GSUB_LOOKUP_SINGLE: Free_SingleSubst ( st ); return; + case HB_GSUB_LOOKUP_MULTIPLE: Free_MultipleSubst ( st ); return; + case HB_GSUB_LOOKUP_ALTERNATE: Free_AlternateSubst ( st ); return; + case HB_GSUB_LOOKUP_LIGATURE: Free_LigatureSubst ( st ); return; + case HB_GSUB_LOOKUP_CONTEXT: Free_ContextSubst ( st ); return; + case HB_GSUB_LOOKUP_CHAIN: Free_ChainContextSubst ( st ); return; + /*case HB_GSUB_LOOKUP_EXTENSION: Free_ExtensionSubst ( st ); return;*/ + case HB_GSUB_LOOKUP_REVERSE_CHAIN: Free_ReverseChainContextSubst ( st ); return; + default: return; + }; +} + + + +/* apply one lookup to the input string object */ + +static HB_Error GSUB_Do_String_Lookup( HB_GSUBHeader* gsub, + HB_UShort lookup_index, + HB_Buffer buffer ) +{ + HB_Error error, retError = HB_Err_Not_Covered; + + HB_UInt* properties = gsub->LookupList.Properties; + int lookup_type = gsub->LookupList.Lookup[lookup_index].LookupType; + + const int nesting_level = 0; + /* 0xFFFF indicates that we don't have a context length yet */ + const HB_UShort context_length = 0xFFFF; + + switch (lookup_type) { + + case HB_GSUB_LOOKUP_SINGLE: + case HB_GSUB_LOOKUP_MULTIPLE: + case HB_GSUB_LOOKUP_ALTERNATE: + case HB_GSUB_LOOKUP_LIGATURE: + case HB_GSUB_LOOKUP_CONTEXT: + case HB_GSUB_LOOKUP_CHAIN: + /* in/out forward substitution (implemented lazy) */ + + _hb_buffer_clear_output ( buffer ); + buffer->in_pos = 0; + while ( buffer->in_pos < buffer->in_length ) + { + if ( ~IN_PROPERTIES( buffer->in_pos ) & properties[lookup_index] ) + { + error = GSUB_Do_Glyph_Lookup( gsub, lookup_index, buffer, context_length, nesting_level ); + if ( error ) + { + if ( error != HB_Err_Not_Covered ) + return error; + } + else + retError = error; + } + else + error = HB_Err_Not_Covered; + + if ( error == HB_Err_Not_Covered ) + if ( COPY_Glyph ( buffer ) ) + return error; + } + /* we shouldn't swap if error occurred. + * + * also don't swap if nothing changed (ie HB_Err_Not_Covered). + * shouldn't matter in that case though. + */ + if ( retError == HB_Err_Ok ) + _hb_buffer_swap( buffer ); + + return retError; + + case HB_GSUB_LOOKUP_REVERSE_CHAIN: + /* in-place backward substitution */ + + buffer->in_pos = buffer->in_length - 1; + do + { + if ( ~IN_PROPERTIES( buffer->in_pos ) & properties[lookup_index] ) + { + error = GSUB_Do_Glyph_Lookup( gsub, lookup_index, buffer, context_length, nesting_level ); + if ( error ) + { + if ( error != HB_Err_Not_Covered ) + return error; + } + else + retError = error; + } + else + error = HB_Err_Not_Covered; + + if ( error == HB_Err_Not_Covered ) + buffer->in_pos--; + } + while ((HB_Int) buffer->in_pos >= 0); + + return retError; + + /*case HB_GSUB_LOOKUP_EXTENSION:*/ + default: + return retError; + }; +} + + +HB_Error HB_GSUB_Add_Feature( HB_GSUBHeader* gsub, + HB_UShort feature_index, + HB_UInt property ) +{ + HB_UShort i; + + HB_Feature feature; + HB_UInt* properties; + HB_UShort* index; + HB_UShort lookup_count; + + /* Each feature can only be added once */ + + if ( !gsub || + feature_index >= gsub->FeatureList.FeatureCount || + gsub->FeatureList.ApplyCount == gsub->FeatureList.FeatureCount ) + return ERR(HB_Err_Invalid_Argument); + + gsub->FeatureList.ApplyOrder[gsub->FeatureList.ApplyCount++] = feature_index; + + properties = gsub->LookupList.Properties; + + feature = gsub->FeatureList.FeatureRecord[feature_index].Feature; + index = feature.LookupListIndex; + lookup_count = gsub->LookupList.LookupCount; + + for ( i = 0; i < feature.LookupListCount; i++ ) + { + HB_UShort lookup_index = index[i]; + if (lookup_index < lookup_count) + properties[lookup_index] |= property; + } + + return HB_Err_Ok; +} + + + +HB_Error HB_GSUB_Clear_Features( HB_GSUBHeader* gsub ) +{ + HB_UShort i; + + HB_UInt* properties; + + + if ( !gsub ) + return ERR(HB_Err_Invalid_Argument); + + gsub->FeatureList.ApplyCount = 0; + + properties = gsub->LookupList.Properties; + + for ( i = 0; i < gsub->LookupList.LookupCount; i++ ) + properties[i] = 0; + + return HB_Err_Ok; +} + + + +HB_Error HB_GSUB_Register_Alternate_Function( HB_GSUBHeader* gsub, + HB_AltFunction altfunc, + void* data ) +{ + if ( !gsub ) + return ERR(HB_Err_Invalid_Argument); + + gsub->altfunc = altfunc; + gsub->data = data; + + return HB_Err_Ok; +} + +/* returns error if one happened, otherwise returns HB_Err_Not_Covered if no + * feature were applied, or HB_Err_Ok otherwise. + */ +HB_Error HB_GSUB_Apply_String( HB_GSUBHeader* gsub, + HB_Buffer buffer ) +{ + HB_Error error, retError = HB_Err_Not_Covered; + int i, j, lookup_count, num_features; + + if ( !gsub || + !buffer) + return ERR(HB_Err_Invalid_Argument); + + if ( buffer->in_length == 0 ) + return retError; + + lookup_count = gsub->LookupList.LookupCount; + num_features = gsub->FeatureList.ApplyCount; + + for ( i = 0; i < num_features; i++) + { + HB_UShort feature_index = gsub->FeatureList.ApplyOrder[i]; + HB_Feature feature = gsub->FeatureList.FeatureRecord[feature_index].Feature; + + for ( j = 0; j < feature.LookupListCount; j++ ) + { + HB_UShort lookup_index = feature.LookupListIndex[j]; + + /* Skip nonexistant lookups */ + if (lookup_index >= lookup_count) + continue; + + error = GSUB_Do_String_Lookup( gsub, lookup_index, buffer ); + if ( error ) + { + if ( error != HB_Err_Not_Covered ) + return error; + } + else + retError = error; + } + } + + error = retError; + + return error; +} + + +/* END */ diff --git a/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-gsub.h b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-gsub.h new file mode 100644 index 0000000..b00df44 --- /dev/null +++ b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-gsub.h @@ -0,0 +1,148 @@ +/* + * Copyright (C) 1998-2004 David Turner and Werner Lemberg + * Copyright (C) 2006 Behdad Esfahbod + * + * This is part of HarfBuzz, an OpenType Layout engine library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#ifndef HARFBUZZ_GSUB_H +#define HARFBUZZ_GSUB_H + +#include "harfbuzz-gdef.h" +#include "harfbuzz-buffer.h" + +HB_BEGIN_HEADER + + +#ifdef HB_USE_PACKED_STRUCTS +#pragma pack(push, 1) +#endif + +/* Lookup types for glyph substitution */ + +#define HB_GSUB_LOOKUP_SINGLE 1 +#define HB_GSUB_LOOKUP_MULTIPLE 2 +#define HB_GSUB_LOOKUP_ALTERNATE 3 +#define HB_GSUB_LOOKUP_LIGATURE 4 +#define HB_GSUB_LOOKUP_CONTEXT 5 +#define HB_GSUB_LOOKUP_CHAIN 6 +#define HB_GSUB_LOOKUP_EXTENSION 7 +#define HB_GSUB_LOOKUP_REVERSE_CHAIN 8 + + +/* A pointer to a function which selects the alternate glyph. `pos' is + the position of the glyph with index `glyphID', `num_alternates' + gives the number of alternates in the `alternates' array. `data' + points to the user-defined structure specified during a call to + HB_GSUB_Register_Alternate_Function(). The function must return an + index into the `alternates' array. */ + +typedef HB_UShort (*HB_AltFunction)(HB_UInt pos, + HB_UShort glyphID, + HB_UShort num_alternates, + HB_UShort* alternates, + void* data ); + + +struct HB_GSUBHeader_ +{ + HB_GDEFHeader* gdef; + + /* the next two fields are used for an alternate substitution callback + function to select the proper alternate glyph. */ + + void* data; + HB_AltFunction altfunc; + + HB_UInt offset; + + HB_16Dot16 Version; + + HB_ScriptList ScriptList; + HB_FeatureList FeatureList; + HB_LookupList LookupList; +}; + +typedef struct HB_GSUBHeader_ HB_GSUBHeader; +typedef HB_GSUBHeader* HB_GSUB; + + +HB_Error HB_Load_GSUB_Table( HB_Stream stream, + HB_GSUBHeader** gsub, + HB_GDEFHeader* gdef, + HB_Stream gdefStream ); + + +HB_Error HB_Done_GSUB_Table( HB_GSUBHeader* gsub ); + + +HB_Error HB_GSUB_Select_Script( HB_GSUBHeader* gsub, + HB_UInt script_tag, + HB_UShort* script_index ); + +HB_Error HB_GSUB_Select_Language( HB_GSUBHeader* gsub, + HB_UInt language_tag, + HB_UShort script_index, + HB_UShort* language_index, + HB_UShort* req_feature_index ); + +HB_Error HB_GSUB_Select_Feature( HB_GSUBHeader* gsub, + HB_UInt feature_tag, + HB_UShort script_index, + HB_UShort language_index, + HB_UShort* feature_index ); + + +HB_Error HB_GSUB_Query_Scripts( HB_GSUBHeader* gsub, + HB_UInt** script_tag_list ); + +HB_Error HB_GSUB_Query_Languages( HB_GSUBHeader* gsub, + HB_UShort script_index, + HB_UInt** language_tag_list ); + +HB_Error HB_GSUB_Query_Features( HB_GSUBHeader* gsub, + HB_UShort script_index, + HB_UShort language_index, + HB_UInt** feature_tag_list ); + + +HB_Error HB_GSUB_Add_Feature( HB_GSUBHeader* gsub, + HB_UShort feature_index, + HB_UInt property ); + +HB_Error HB_GSUB_Clear_Features( HB_GSUBHeader* gsub ); + + +HB_Error HB_GSUB_Register_Alternate_Function( HB_GSUBHeader* gsub, + HB_AltFunction altfunc, + void* data ); + + +HB_Error HB_GSUB_Apply_String( HB_GSUBHeader* gsub, + HB_Buffer buffer ); + +#ifdef HB_USE_PACKED_STRUCTS +#pragma pack(pop) +#endif + +HB_END_HEADER + +#endif /* HARFBUZZ_GSUB_H */ diff --git a/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-hangul.c b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-hangul.c new file mode 100644 index 0000000..6f89ed6 --- /dev/null +++ b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-hangul.c @@ -0,0 +1,268 @@ +/* + * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) + * + * This is part of HarfBuzz, an OpenType Layout engine library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#include "harfbuzz-shaper.h" +#include "harfbuzz-shaper-private.h" + +#include + +/* +// Hangul is a syllable based script. Unicode reserves a large range +// for precomposed hangul, where syllables are already precomposed to +// their final glyph shape. In addition, a so called jamo range is +// defined, that can be used to express old Hangul. Modern hangul +// syllables can also be expressed as jamo, and should be composed +// into syllables. The operation is rather simple and mathematical. + +// Every hangul jamo is classified as being either a Leading consonant +// (L), and intermediat Vowel (V) or a trailing consonant (T). Modern +// hangul syllables (the ones in the precomposed area can be of type +// LV or LVT. +// +// Syllable breaks do _not_ occur between: +// +// L L, V or precomposed +// V, LV V, T +// LVT, T T +// +// A standard syllable is of the form L+V+T*. The above rules allow +// nonstandard syllables L*V*T*. To transform them into standard +// syllables fill characters L_f and V_f can be inserted. +*/ + +enum { + Hangul_SBase = 0xac00, + Hangul_LBase = 0x1100, + Hangul_VBase = 0x1161, + Hangul_TBase = 0x11a7, + Hangul_SCount = 11172, + Hangul_LCount = 19, + Hangul_VCount = 21, + Hangul_TCount = 28, + Hangul_NCount = 21*28 +}; + +#define hangul_isPrecomposed(uc) \ + (uc >= Hangul_SBase && uc < Hangul_SBase + Hangul_SCount) + +#define hangul_isLV(uc) \ + ((uc - Hangul_SBase) % Hangul_TCount == 0) + +typedef enum { + L, + V, + T, + LV, + LVT, + X +} HangulType; + +static HangulType hangul_type(unsigned short uc) { + if (uc > Hangul_SBase && uc < Hangul_SBase + Hangul_SCount) + return hangul_isLV(uc) ? LV : LVT; + if (uc < Hangul_LBase || uc > 0x11ff) + return X; + if (uc < Hangul_VBase) + return L; + if (uc < Hangul_TBase) + return V; + return T; +} + +static int hangul_nextSyllableBoundary(const HB_UChar16 *s, int start, int end) +{ + const HB_UChar16 *uc = s + start; + + HangulType state = hangul_type(*uc); + int pos = 1; + + while (pos < end - start) { + HangulType newState = hangul_type(uc[pos]); + switch(newState) { + case X: + goto finish; + case L: + case V: + case T: + if (state > newState) + goto finish; + state = newState; + break; + case LV: + if (state > L) + goto finish; + state = V; + break; + case LVT: + if (state > L) + goto finish; + state = T; + } + ++pos; + } + + finish: + return start+pos; +} + +#ifndef NO_OPENTYPE +static const HB_OpenTypeFeature hangul_features [] = { + { HB_MAKE_TAG('c', 'c', 'm', 'p'), CcmpProperty }, + { HB_MAKE_TAG('l', 'j', 'm', 'o'), CcmpProperty }, + { HB_MAKE_TAG('v', 'j', 'm', 'o'), CcmpProperty }, + { HB_MAKE_TAG('t', 'j', 'm', 'o'), CcmpProperty }, + { 0, 0 } +}; +#endif + +static HB_Bool hangul_shape_syllable(HB_ShaperItem *item, HB_Bool openType) +{ + const HB_UChar16 *ch = item->string + item->item.pos; + int len = item->item.length; +#ifndef NO_OPENTYPE + const int availableGlyphs = item->num_glyphs; +#endif + + int i; + HB_UChar16 composed = 0; + /* see if we can compose the syllable into a modern hangul */ + if (item->item.length == 2) { + int LIndex = ch[0] - Hangul_LBase; + int VIndex = ch[1] - Hangul_VBase; + if (LIndex >= 0 && LIndex < Hangul_LCount && + VIndex >= 0 && VIndex < Hangul_VCount) + composed = (LIndex * Hangul_VCount + VIndex) * Hangul_TCount + Hangul_SBase; + } else if (item->item.length == 3) { + int LIndex = ch[0] - Hangul_LBase; + int VIndex = ch[1] - Hangul_VBase; + int TIndex = ch[2] - Hangul_TBase; + if (LIndex >= 0 && LIndex < Hangul_LCount && + VIndex >= 0 && VIndex < Hangul_VCount && + TIndex >= 0 && TIndex < Hangul_TCount) + composed = (LIndex * Hangul_VCount + VIndex) * Hangul_TCount + TIndex + Hangul_SBase; + } + + + + /* if we have a modern hangul use the composed form */ + if (composed) { + ch = &composed; + len = 1; + } + + if (!item->font->klass->convertStringToGlyphIndices(item->font, + ch, len, + item->glyphs, &item->num_glyphs, + item->item.bidiLevel % 2)) + return FALSE; + for (i = 0; i < len; i++) { + item->attributes[i].mark = FALSE; + item->attributes[i].clusterStart = FALSE; + item->attributes[i].justification = 0; + item->attributes[i].zeroWidth = FALSE; + /*IDEBUG(" %d: %4x", i, ch[i].unicode()); */ + } + +#ifndef NO_OPENTYPE + if (!composed && openType) { + HB_Bool positioned; + + HB_STACKARRAY(unsigned short, logClusters, len); + for (i = 0; i < len; ++i) + logClusters[i] = i; + item->log_clusters = logClusters; + + HB_OpenTypeShape(item, /*properties*/0); + + positioned = HB_OpenTypePosition(item, availableGlyphs, /*doLogClusters*/FALSE); + + HB_FREE_STACKARRAY(logClusters); + + if (!positioned) + return FALSE; + } else { + HB_HeuristicPosition(item); + } +#endif + + item->attributes[0].clusterStart = TRUE; + return TRUE; +} + +HB_Bool HB_HangulShape(HB_ShaperItem *item) +{ + const HB_UChar16 *uc = item->string + item->item.pos; + HB_Bool allPrecomposed = TRUE; + int i; + + assert(item->item.script == HB_Script_Hangul); + + for (i = 0; i < (int)item->item.length; ++i) { + if (!hangul_isPrecomposed(uc[i])) { + allPrecomposed = FALSE; + break; + } + } + + if (!allPrecomposed) { + HB_Bool openType = FALSE; + unsigned short *logClusters = item->log_clusters; + HB_ShaperItem syllable; + int first_glyph = 0; + int sstart = item->item.pos; + int end = sstart + item->item.length; + +#ifndef NO_OPENTYPE + openType = HB_SelectScript(item, hangul_features); +#endif + syllable = *item; + + while (sstart < end) { + int send = hangul_nextSyllableBoundary(item->string, sstart, end); + + syllable.item.pos = sstart; + syllable.item.length = send-sstart; + syllable.glyphs = item->glyphs + first_glyph; + syllable.attributes = item->attributes + first_glyph; + syllable.offsets = item->offsets + first_glyph; + syllable.advances = item->advances + first_glyph; + syllable.num_glyphs = item->num_glyphs - first_glyph; + if (!hangul_shape_syllable(&syllable, openType)) { + item->num_glyphs += syllable.num_glyphs; + return FALSE; + } + /* fix logcluster array */ + for (i = sstart; i < send; ++i) + logClusters[i-item->item.pos] = first_glyph; + sstart = send; + first_glyph += syllable.num_glyphs; + } + item->num_glyphs = first_glyph; + return TRUE; + } + + return HB_BasicShape(item); +} + + diff --git a/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-hebrew.c b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-hebrew.c new file mode 100644 index 0000000..67029be --- /dev/null +++ b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-hebrew.c @@ -0,0 +1,187 @@ +/* + * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) + * + * This is part of HarfBuzz, an OpenType Layout engine library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#include "harfbuzz-shaper.h" +#include "harfbuzz-shaper-private.h" +#include + +/* +// Uniscribe also defines dlig for Hebrew, but we leave this out for now, as it's mostly +// ligatures one does not want in modern Hebrew (as lam-alef ligatures). +*/ +#ifndef NO_OPENTYPE +static const HB_OpenTypeFeature hebrew_features[] = { + { HB_MAKE_TAG('c', 'c', 'm', 'p'), CcmpProperty }, + {0, 0} +}; +#endif + +/* Hebrew shaping. In the non opentype case we try to use the + presentation forms specified for Hebrew. Especially for the + ligatures with Dagesh this gives much better results than we could + achieve manually. +*/ +HB_Bool HB_HebrewShape(HB_ShaperItem *shaper_item) +{ + enum { + Dagesh = 0x5bc, + ShinDot = 0x5c1, + SinDot = 0x5c2, + Patah = 0x5b7, + Qamats = 0x5b8, + Holam = 0x5b9, + Rafe = 0x5bf + }; + + assert(shaper_item->item.script == HB_Script_Hebrew); + +#ifndef NO_OPENTYPE + if (HB_SelectScript(shaper_item, hebrew_features)) { + + const int availableGlyphs = shaper_item->num_glyphs; + if (!HB_ConvertStringToGlyphIndices(shaper_item)) + return FALSE; + + HB_HeuristicSetGlyphAttributes(shaper_item); + HB_OpenTypeShape(shaper_item, /*properties*/0); + return HB_OpenTypePosition(shaper_item, availableGlyphs, /*doLogClusters*/TRUE); + } +#endif + + { + const HB_UChar16 *uc = shaper_item->string + shaper_item->item.pos; + unsigned short *logClusters = shaper_item->log_clusters; + HB_GlyphAttributes *attributes = shaper_item->attributes; + + HB_Bool haveGlyphs; + int slen = 1; + int cluster_start = 0; + hb_uint32 i; + + HB_STACKARRAY(HB_UChar16, shapedChars, 2 * shaper_item->item.length); + *shapedChars = *uc; + logClusters[0] = 0; + + for (i = 1; i < shaper_item->item.length; ++i) { + hb_uint16 base = shapedChars[slen-1]; + hb_uint16 shaped = 0; + HB_Bool invalid = FALSE; + if (uc[i] == Dagesh) { + if (base >= 0x5d0 + && base <= 0x5ea + && base != 0x5d7 + && base != 0x5dd + && base != 0x5df + && base != 0x5e2 + && base != 0x5e5) { + shaped = base - 0x5d0 + 0xfb30; + } else if (base == 0xfb2a || base == 0xfb2b /* Shin with Shin or Sin dot */) { + shaped = base + 2; + } else { + invalid = TRUE; + } + } else if (uc[i] == ShinDot) { + if (base == 0x05e9) + shaped = 0xfb2a; + else if (base == 0xfb49) + shaped = 0xfb2c; + else + invalid = TRUE; + } else if (uc[i] == SinDot) { + if (base == 0x05e9) + shaped = 0xfb2b; + else if (base == 0xfb49) + shaped = 0xfb2d; + else + invalid = TRUE; + } else if (uc[i] == Patah) { + if (base == 0x5d0) + shaped = 0xfb2e; + } else if (uc[i] == Qamats) { + if (base == 0x5d0) + shaped = 0xfb2f; + } else if (uc[i] == Holam) { + if (base == 0x5d5) + shaped = 0xfb4b; + } else if (uc[i] == Rafe) { + if (base == 0x5d1) + shaped = 0xfb4c; + else if (base == 0x5db) + shaped = 0xfb4d; + else if (base == 0x5e4) + shaped = 0xfb4e; + } + + if (invalid) { + shapedChars[slen] = 0x25cc; + attributes[slen].clusterStart = TRUE; + attributes[slen].mark = FALSE; + attributes[slen].combiningClass = 0; + cluster_start = slen; + ++slen; + } + if (shaped) { + if (shaper_item->font->klass->canRender(shaper_item->font, (HB_UChar16 *)&shaped, 1)) { + shapedChars[slen-1] = shaped; + } else + shaped = 0; + } + if (!shaped) { + HB_CharCategory category; + int cmb; + shapedChars[slen] = uc[i]; + HB_GetUnicodeCharProperties(uc[i], &category, &cmb); + if (category != HB_Mark_NonSpacing) { + attributes[slen].clusterStart = TRUE; + attributes[slen].mark = FALSE; + attributes[slen].combiningClass = 0; + attributes[slen].dontPrint = HB_IsControlChar(uc[i]); + cluster_start = slen; + } else { + attributes[slen].clusterStart = FALSE; + attributes[slen].mark = TRUE; + attributes[slen].combiningClass = cmb; + } + ++slen; + } + logClusters[i] = cluster_start; + } + + haveGlyphs = shaper_item->font->klass + ->convertStringToGlyphIndices(shaper_item->font, + shapedChars, slen, + shaper_item->glyphs, &shaper_item->num_glyphs, + shaper_item->item.bidiLevel % 2); + + HB_FREE_STACKARRAY(shapedChars); + + if (!haveGlyphs) + return FALSE; + + HB_HeuristicPosition(shaper_item); + } + + return TRUE; +} + diff --git a/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-impl.c b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-impl.c new file mode 100644 index 0000000..ddbf36b --- /dev/null +++ b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-impl.c @@ -0,0 +1,84 @@ +/* + * Copyright (C) 1998-2004 David Turner and Werner Lemberg + * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) + * Copyright (C) 2007 Red Hat, Inc. + * + * This is part of HarfBuzz, an OpenType Layout engine library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + * + * Red Hat Author(s): Behdad Esfahbod + */ + +#include "harfbuzz-impl.h" + + +HB_INTERNAL HB_Pointer +_hb_alloc(size_t size, + HB_Error *perror ) +{ + HB_Error error = (HB_Error)0; + HB_Pointer block = NULL; + + if ( size > 0 ) + { + block = calloc( 1, size ); + if ( !block ) + error = ERR(HB_Err_Out_Of_Memory); + } + + *perror = error; + return block; +} + + +HB_INTERNAL HB_Pointer +_hb_realloc(HB_Pointer block, + size_t new_size, + HB_Error *perror ) +{ + HB_Pointer block2 = NULL; + HB_Error error = (HB_Error)0; + + block2 = realloc( block, new_size ); + if ( block2 == NULL && new_size != 0 ) + error = ERR(HB_Err_Out_Of_Memory); + + if ( !error ) + block = block2; + + *perror = error; + return block; +} + + +HB_INTERNAL void +_hb_free( HB_Pointer block ) +{ + if ( block ) + free( block ); +} + + +/* helper func to set a breakpoint on */ +HB_INTERNAL HB_Error +_hb_err (HB_Error code) +{ + return code; +} diff --git a/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-impl.h b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-impl.h new file mode 100644 index 0000000..5f43049 --- /dev/null +++ b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-impl.h @@ -0,0 +1,131 @@ +/* + * Copyright (C) 1998-2004 David Turner and Werner Lemberg + * Copyright (C) 2006 Behdad Esfahbod + * + * This is part of HarfBuzz, an OpenType Layout engine library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#ifndef HARFBUZZ_IMPL_H +#define HARFBUZZ_IMPL_H + +#include "harfbuzz-global.h" + +#include + +HB_BEGIN_HEADER + +#ifndef HB_INTERNAL +# define HB_INTERNAL +#endif + +#ifndef NULL +# define NULL ((void *)0) +#endif + +#ifndef FALSE +# define FALSE 0 +#endif + +#ifndef TRUE +# define TRUE 1 +#endif + +#ifndef TTAG_GDEF +# define TTAG_GDEF HB_MAKE_TAG( 'G', 'D', 'E', 'F' ) +#endif +#ifndef TTAG_GPOS +# define TTAG_GPOS HB_MAKE_TAG( 'G', 'P', 'O', 'S' ) +#endif +#ifndef TTAG_GSUB +# define TTAG_GSUB HB_MAKE_TAG( 'G', 'S', 'U', 'B' ) +#endif + +#ifndef HB_UNUSED +# define HB_UNUSED(arg) ((arg) = (arg)) +#endif + +#define HB_LIKELY(cond) (cond) +#define HB_UNLIKELY(cond) (cond) + +#define ARRAY_LEN(Array) ((int)(sizeof (Array) / sizeof (Array)[0])) + + + +#define HB_IsHighSurrogate(ucs) \ + (((ucs) & 0xfc00) == 0xd800) + +#define HB_IsLowSurrogate(ucs) \ + (((ucs) & 0xfc00) == 0xdc00) + +#define HB_SurrogateToUcs4(high, low) \ + (((HB_UChar32)(high))<<10) + (low) - 0x35fdc00; + + + + + +#define ALLOC(_ptr,_size) \ + ( (_ptr) = _hb_alloc( _size, &error ), error != 0 ) + +#define REALLOC(_ptr,_newsz) \ + ( (_ptr) = _hb_realloc( (_ptr), (_newsz), &error ), error != 0 ) + +#define FREE(_ptr) \ + do { \ + if ( (_ptr) ) \ + { \ + _hb_free( _ptr ); \ + _ptr = NULL; \ + } \ + } while (0) + +#define ALLOC_ARRAY(_ptr,_count,_type) \ + ALLOC(_ptr,(_count)*sizeof(_type)) + +#define REALLOC_ARRAY(_ptr,_newcnt,_type) \ + REALLOC(_ptr,(_newcnt)*sizeof(_type)) + +#define MEM_Copy(dest,source,count) memcpy( (char*)(dest), (const char*)(source), (size_t)(count) ) + +#define ERR(err) _hb_err (err) + + +HB_INTERNAL HB_Pointer +_hb_alloc( size_t size, + HB_Error *perror_ ); + +HB_INTERNAL HB_Pointer +_hb_realloc( HB_Pointer block, + size_t new_size, + HB_Error *perror_ ); + +HB_INTERNAL void +_hb_free( HB_Pointer block ); + + +/* helper func to set a breakpoint on */ +HB_INTERNAL HB_Error +_hb_err (HB_Error code); + + +HB_END_HEADER + +#endif /* HARFBUZZ_IMPL_H */ diff --git a/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-indic.cpp b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-indic.cpp new file mode 100644 index 0000000..4d8418b --- /dev/null +++ b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-indic.cpp @@ -0,0 +1,1892 @@ +/* + * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) + * + * This is part of HarfBuzz, an OpenType Layout engine library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#include "harfbuzz-shaper.h" +#include "harfbuzz-shaper-private.h" + +#include +#include + +#define FLAG(x) (1 << (x)) + +static HB_Bool isLetter(HB_UChar16 ucs) +{ + const int test = FLAG(HB_Letter_Uppercase) | + FLAG(HB_Letter_Lowercase) | + FLAG(HB_Letter_Titlecase) | + FLAG(HB_Letter_Modifier) | + FLAG(HB_Letter_Other); + return FLAG(HB_GetUnicodeCharCategory(ucs)) & test; +} + +static HB_Bool isMark(HB_UChar16 ucs) +{ + const int test = FLAG(HB_Mark_NonSpacing) | + FLAG(HB_Mark_SpacingCombining) | + FLAG(HB_Mark_Enclosing); + return FLAG(HB_GetUnicodeCharCategory(ucs)) & test; +} + +enum Form { + Invalid = 0x0, + UnknownForm = Invalid, + Consonant, + Nukta, + Halant, + Matra, + VowelMark, + StressMark, + IndependentVowel, + LengthMark, + Control, + Other +}; + +static const unsigned char indicForms[0xe00-0x900] = { + // Devangari + Invalid, VowelMark, VowelMark, VowelMark, + IndependentVowel, IndependentVowel, IndependentVowel, IndependentVowel, + IndependentVowel, IndependentVowel, IndependentVowel, IndependentVowel, + IndependentVowel, IndependentVowel, IndependentVowel, IndependentVowel, + + IndependentVowel, IndependentVowel, IndependentVowel, IndependentVowel, + IndependentVowel, Consonant, Consonant, Consonant, + Consonant, Consonant, Consonant, Consonant, + Consonant, Consonant, Consonant, Consonant, + + Consonant, Consonant, Consonant, Consonant, + Consonant, Consonant, Consonant, Consonant, + Consonant, Consonant, Consonant, Consonant, + Consonant, Consonant, Consonant, Consonant, + + Consonant, Consonant, Consonant, Consonant, + Consonant, Consonant, Consonant, Consonant, + Consonant, Consonant, UnknownForm, UnknownForm, + Nukta, Other, Matra, Matra, + + Matra, Matra, Matra, Matra, + Matra, Matra, Matra, Matra, + Matra, Matra, Matra, Matra, + Matra, Halant, UnknownForm, UnknownForm, + + Other, StressMark, StressMark, StressMark, + StressMark, UnknownForm, UnknownForm, UnknownForm, + Consonant, Consonant, Consonant, Consonant, + Consonant, Consonant, Consonant, Consonant, + + IndependentVowel, IndependentVowel, VowelMark, VowelMark, + Other, Other, Other, Other, + Other, Other, Other, Other, + Other, Other, Other, Other, + + Other, Other, Other, Other, + Other, Other, Other, Other, + Other, Other, Other, Consonant, + Consonant, Consonant /* ??? */, Consonant, Consonant, + + // Bengali + Invalid, VowelMark, VowelMark, VowelMark, + Invalid, IndependentVowel, IndependentVowel, IndependentVowel, + IndependentVowel, IndependentVowel, IndependentVowel, IndependentVowel, + IndependentVowel, Invalid, Invalid, IndependentVowel, + + IndependentVowel, Invalid, Invalid, IndependentVowel, + IndependentVowel, Consonant, Consonant, Consonant, + Consonant, Consonant, Consonant, Consonant, + Consonant, Consonant, Consonant, Consonant, + + Consonant, Consonant, Consonant, Consonant, + Consonant, Consonant, Consonant, Consonant, + Consonant, Invalid, Consonant, Consonant, + Consonant, Consonant, Consonant, Consonant, + + Consonant, Invalid, Consonant, Invalid, + Invalid, Invalid, Consonant, Consonant, + Consonant, Consonant, UnknownForm, UnknownForm, + Nukta, Other, Matra, Matra, + + Matra, Matra, Matra, Matra, + Matra, Invalid, Invalid, Matra, + Matra, Invalid, Invalid, Matra, + Matra, Halant, Consonant, UnknownForm, + + Invalid, Invalid, Invalid, Invalid, + Invalid, Invalid, Invalid, VowelMark, + Invalid, Invalid, Invalid, Invalid, + Consonant, Consonant, Invalid, Consonant, + + IndependentVowel, IndependentVowel, VowelMark, VowelMark, + Other, Other, Other, Other, + Other, Other, Other, Other, + Other, Other, Other, Other, + + Consonant, Consonant, Other, Other, + Other, Other, Other, Other, + Other, Other, Other, Other, + Other, Other, Other, Other, + + // Gurmukhi + Invalid, VowelMark, VowelMark, VowelMark, + Invalid, IndependentVowel, IndependentVowel, IndependentVowel, + IndependentVowel, IndependentVowel, IndependentVowel, Invalid, + Invalid, Invalid, Invalid, IndependentVowel, + + IndependentVowel, Invalid, Invalid, IndependentVowel, + IndependentVowel, Consonant, Consonant, Consonant, + Consonant, Consonant, Consonant, Consonant, + Consonant, Consonant, Consonant, Consonant, + + Consonant, Consonant, Consonant, Consonant, + Consonant, Consonant, Consonant, Consonant, + Consonant, Invalid, Consonant, Consonant, + Consonant, Consonant, Consonant, Consonant, + + Consonant, Invalid, Consonant, Consonant, + Invalid, Consonant, Consonant, Invalid, + Consonant, Consonant, UnknownForm, UnknownForm, + Nukta, Other, Matra, Matra, + + Matra, Matra, Matra, Invalid, + Invalid, Invalid, Invalid, Matra, + Matra, Invalid, Invalid, Matra, + Matra, Halant, UnknownForm, UnknownForm, + + Invalid, Invalid, Invalid, Invalid, + Invalid, UnknownForm, UnknownForm, UnknownForm, + Invalid, Consonant, Consonant, Consonant, + Consonant, Invalid, Consonant, Invalid, + + Other, Other, Invalid, Invalid, + Other, Other, Other, Other, + Other, Other, Other, Other, + Other, Other, Other, Other, + + StressMark, StressMark, Consonant, Consonant, + Other, Other, Other, Other, + Other, Other, Other, Other, + Other, Other, Other, Other, + + // Gujarati + Invalid, VowelMark, VowelMark, VowelMark, + Invalid, IndependentVowel, IndependentVowel, IndependentVowel, + IndependentVowel, IndependentVowel, IndependentVowel, IndependentVowel, + IndependentVowel, IndependentVowel, Invalid, IndependentVowel, + + IndependentVowel, IndependentVowel, Invalid, IndependentVowel, + IndependentVowel, Consonant, Consonant, Consonant, + Consonant, Consonant, Consonant, Consonant, + Consonant, Consonant, Consonant, Consonant, + + Consonant, Consonant, Consonant, Consonant, + Consonant, Consonant, Consonant, Consonant, + Consonant, Invalid, Consonant, Consonant, + Consonant, Consonant, Consonant, Consonant, + + Consonant, Invalid, Consonant, Consonant, + Invalid, Consonant, Consonant, Consonant, + Consonant, Consonant, UnknownForm, UnknownForm, + Nukta, Other, Matra, Matra, + + Matra, Matra, Matra, Matra, + Matra, Matra, Invalid, Matra, + Matra, Matra, Invalid, Matra, + Matra, Halant, UnknownForm, UnknownForm, + + Other, UnknownForm, UnknownForm, UnknownForm, + UnknownForm, UnknownForm, UnknownForm, UnknownForm, + UnknownForm, UnknownForm, UnknownForm, UnknownForm, + UnknownForm, UnknownForm, UnknownForm, UnknownForm, + + IndependentVowel, IndependentVowel, VowelMark, VowelMark, + Other, Other, Other, Other, + Other, Other, Other, Other, + Other, Other, Other, Other, + + Other, Other, Other, Other, + Other, Other, Other, Other, + Other, Other, Other, Other, + Other, Other, Other, Other, + + // Oriya + Invalid, VowelMark, VowelMark, VowelMark, + Invalid, IndependentVowel, IndependentVowel, IndependentVowel, + IndependentVowel, IndependentVowel, IndependentVowel, IndependentVowel, + IndependentVowel, Invalid, Invalid, IndependentVowel, + + IndependentVowel, Invalid, Invalid, IndependentVowel, + IndependentVowel, Consonant, Consonant, Consonant, + Consonant, Consonant, Consonant, Consonant, + Consonant, Consonant, Consonant, Consonant, + + Consonant, Consonant, Consonant, Consonant, + Consonant, Consonant, Consonant, Consonant, + Consonant, Invalid, Consonant, Consonant, + Consonant, Consonant, Consonant, Consonant, + + Consonant, Invalid, Consonant, Consonant, + Invalid, Consonant, Consonant, Consonant, + Consonant, Consonant, UnknownForm, UnknownForm, + Nukta, Other, Matra, Matra, + + Matra, Matra, Matra, Matra, + Invalid, Invalid, Invalid, Matra, + Matra, Invalid, Invalid, Matra, + Matra, Halant, UnknownForm, UnknownForm, + + Other, Invalid, Invalid, Invalid, + Invalid, UnknownForm, LengthMark, LengthMark, + Invalid, Invalid, Invalid, Invalid, + Consonant, Consonant, Invalid, Consonant, + + IndependentVowel, IndependentVowel, Invalid, Invalid, + Invalid, Invalid, Other, Other, + Other, Other, Other, Other, + Other, Other, Other, Other, + + Other, Consonant, Other, Other, + Other, Other, Other, Other, + Other, Other, Other, Other, + Other, Other, Other, Other, + + //Tamil + Invalid, Invalid, VowelMark, Other, + Invalid, IndependentVowel, IndependentVowel, IndependentVowel, + IndependentVowel, IndependentVowel, IndependentVowel, Invalid, + Invalid, Invalid, IndependentVowel, IndependentVowel, + + IndependentVowel, Invalid, IndependentVowel, IndependentVowel, + IndependentVowel, Consonant, Invalid, Invalid, + Invalid, Consonant, Consonant, Invalid, + Consonant, Invalid, Consonant, Consonant, + + Invalid, Invalid, Invalid, Consonant, + Consonant, Invalid, Invalid, Invalid, + Consonant, Consonant, Consonant, Invalid, + Invalid, Invalid, Consonant, Consonant, + + Consonant, Consonant, Consonant, Consonant, + Consonant, Consonant, Consonant, Consonant, + Consonant, Consonant, UnknownForm, UnknownForm, + Invalid, Invalid, Matra, Matra, + + Matra, Matra, Matra, Invalid, + Invalid, Invalid, Matra, Matra, + Matra, Invalid, Matra, Matra, + Matra, Halant, Invalid, Invalid, + + Invalid, Invalid, Invalid, Invalid, + Invalid, Invalid, Invalid, LengthMark, + Invalid, Invalid, Invalid, Invalid, + Invalid, Invalid, Invalid, Invalid, + + Invalid, Invalid, Invalid, Invalid, + Invalid, Invalid, Other, Other, + Other, Other, Other, Other, + Other, Other, Other, Other, + + Other, Other, Other, Other, + Other, Other, Other, Other, + Other, Other, Other, Other, + Other, Other, Other, Other, + + // Telugu + Invalid, VowelMark, VowelMark, VowelMark, + Invalid, IndependentVowel, IndependentVowel, IndependentVowel, + IndependentVowel, IndependentVowel, IndependentVowel, IndependentVowel, + IndependentVowel, Invalid, IndependentVowel, IndependentVowel, + + IndependentVowel, Invalid, IndependentVowel, IndependentVowel, + IndependentVowel, Consonant, Consonant, Consonant, + Consonant, Consonant, Consonant, Consonant, + Consonant, Consonant, Consonant, Consonant, + + Consonant, Consonant, Consonant, Consonant, + Consonant, Consonant, Consonant, Consonant, + Consonant, Invalid, Consonant, Consonant, + Consonant, Consonant, Consonant, Consonant, + + Consonant, Consonant, Consonant, Consonant, + Invalid, Consonant, Consonant, Consonant, + Consonant, Consonant, UnknownForm, UnknownForm, + Invalid, Invalid, Matra, Matra, + + Matra, Matra, Matra, Matra, + Matra, Invalid, Matra, Matra, + Matra, Invalid, Matra, Matra, + Matra, Halant, Invalid, Invalid, + + Invalid, Invalid, Invalid, Invalid, + Invalid, LengthMark, Matra, Invalid, + Invalid, Invalid, Invalid, Invalid, + Invalid, Invalid, Invalid, Invalid, + + IndependentVowel, IndependentVowel, Invalid, Invalid, + Invalid, Invalid, Other, Other, + Other, Other, Other, Other, + Other, Other, Other, Other, + + Other, Other, Other, Other, + Other, Other, Other, Other, + Other, Other, Other, Other, + Other, Other, Other, Other, + + // Kannada + Invalid, Invalid, VowelMark, VowelMark, + Invalid, IndependentVowel, IndependentVowel, IndependentVowel, + IndependentVowel, IndependentVowel, IndependentVowel, IndependentVowel, + IndependentVowel, Invalid, IndependentVowel, IndependentVowel, + + IndependentVowel, Invalid, IndependentVowel, IndependentVowel, + IndependentVowel, Consonant, Consonant, Consonant, + Consonant, Consonant, Consonant, Consonant, + Consonant, Consonant, Consonant, Consonant, + + Consonant, Consonant, Consonant, Consonant, + Consonant, Consonant, Consonant, Consonant, + Consonant, Invalid, Consonant, Consonant, + Consonant, Consonant, Consonant, Consonant, + + Consonant, Consonant, Consonant, Consonant, + Invalid, Consonant, Consonant, Consonant, + Consonant, Consonant, UnknownForm, UnknownForm, + Nukta, Other, Matra, Matra, + + Matra, Matra, Matra, Matra, + Matra, Invalid, Matra, Matra, + Matra, Invalid, Matra, Matra, + Matra, Halant, Invalid, Invalid, + + Invalid, Invalid, Invalid, Invalid, + Invalid, LengthMark, LengthMark, Invalid, + Invalid, Invalid, Invalid, Invalid, + Invalid, Invalid, Consonant, Invalid, + + IndependentVowel, IndependentVowel, VowelMark, VowelMark, + Invalid, Invalid, Other, Other, + Other, Other, Other, Other, + Other, Other, Other, Other, + + Other, Other, Other, Other, + Other, Other, Other, Other, + Other, Other, Other, Other, + Other, Other, Other, Other, + + // Malayalam + Invalid, Invalid, VowelMark, VowelMark, + Invalid, IndependentVowel, IndependentVowel, IndependentVowel, + IndependentVowel, IndependentVowel, IndependentVowel, IndependentVowel, + IndependentVowel, Invalid, IndependentVowel, IndependentVowel, + + IndependentVowel, Invalid, IndependentVowel, IndependentVowel, + IndependentVowel, Consonant, Consonant, Consonant, + Consonant, Consonant, Consonant, Consonant, + Consonant, Consonant, Consonant, Consonant, + + Consonant, Consonant, Consonant, Consonant, + Consonant, Consonant, Consonant, Consonant, + Consonant, Invalid, Consonant, Consonant, + Consonant, Consonant, Consonant, Consonant, + + Consonant, Consonant, Consonant, Consonant, + Consonant, Consonant, Consonant, Consonant, + Consonant, Consonant, UnknownForm, UnknownForm, + Invalid, Invalid, Matra, Matra, + + Matra, Matra, Matra, Matra, + Invalid, Invalid, Matra, Matra, + Matra, Invalid, Matra, Matra, + Matra, Halant, Invalid, Invalid, + + Invalid, Invalid, Invalid, Invalid, + Invalid, Invalid, Invalid, Matra, + Invalid, Invalid, Invalid, Invalid, + Invalid, Invalid, Invalid, Invalid, + + IndependentVowel, IndependentVowel, Invalid, Invalid, + Invalid, Invalid, Other, Other, + Other, Other, Other, Other, + Other, Other, Other, Other, + + Other, Other, Other, Other, + Other, Other, Other, Other, + Other, Other, Other, Other, + Other, Other, Other, Other, + + // Sinhala + Invalid, Invalid, VowelMark, VowelMark, + Invalid, IndependentVowel, IndependentVowel, IndependentVowel, + IndependentVowel, IndependentVowel, IndependentVowel, IndependentVowel, + IndependentVowel, IndependentVowel, IndependentVowel, IndependentVowel, + + IndependentVowel, IndependentVowel, IndependentVowel, IndependentVowel, + IndependentVowel, IndependentVowel, IndependentVowel, Invalid, + Invalid, Invalid, Consonant, Consonant, + Consonant, Consonant, Consonant, Consonant, + + Consonant, Consonant, Consonant, Consonant, + Consonant, Consonant, Consonant, Consonant, + Consonant, Consonant, Consonant, Consonant, + Consonant, Consonant, Consonant, Consonant, + + Consonant, Consonant, Invalid, Consonant, + Consonant, Consonant, Consonant, Consonant, + Consonant, Consonant, Consonant, Consonant, + Invalid, Consonant, Invalid, Invalid, + + Consonant, Consonant, Consonant, Consonant, + Consonant, Consonant, Consonant, Invalid, + Invalid, Invalid, Halant, Invalid, + Invalid, Invalid, Invalid, Matra, + + Matra, Matra, Matra, Matra, + Matra, Invalid, Matra, Invalid, + Matra, Matra, Matra, Matra, + Matra, Matra, Matra, Matra, + + Invalid, Invalid, Invalid, Invalid, + Invalid, Invalid, Invalid, Invalid, + Invalid, Invalid, Invalid, Invalid, + Invalid, Invalid, Invalid, Invalid, + + Invalid, Invalid, Matra, Matra, + Other, Other, Other, Other, + Other, Other, Other, Other, + Other, Other, Other, Other, +}; + +enum Position { + None, + Pre, + Above, + Below, + Post, + Split, + Base, + Reph, + Vattu, + Inherit +}; + +static const unsigned char indicPosition[0xe00-0x900] = { + // Devanagari + None, Above, Above, Post, + None, None, None, None, + None, None, None, None, + None, None, None, None, + + None, None, None, None, + None, None, None, None, + None, None, None, None, + None, None, None, None, + + None, None, None, None, + None, None, None, None, + None, None, None, None, + None, None, None, None, + + Below, None, None, None, + None, None, None, None, + None, None, None, None, + None, None, Post, Pre, + + Post, Below, Below, Below, + Below, Above, Above, Above, + Above, Post, Post, Post, + Post, None, None, None, + + None, Above, Below, Above, + Above, None, None, None, + None, None, None, None, + None, None, None, None, + + None, None, Below, Below, + None, None, None, None, + None, None, None, None, + None, None, None, None, + + None, None, None, None, + None, None, None, None, + None, None, None, None, + None, None, None, None, + + // Bengali + None, Above, Post, Post, + None, None, None, None, + None, None, None, None, + None, None, None, None, + + None, None, None, None, + None, None, None, None, + None, None, None, None, + None, None, None, None, + + None, None, None, None, + None, None, None, None, + None, None, None, None, + Below, None, None, Post, + + Below, None, None, None, + None, None, None, None, + None, None, None, None, + Below, None, Post, Pre, + + Post, Below, Below, Below, + Below, None, None, Pre, + Pre, None, None, Split, + Split, Below, None, None, + + None, None, None, None, + None, None, None, Post, + None, None, None, None, + None, None, None, None, + + None, None, Below, Below, + None, None, None, None, + None, None, None, None, + None, None, None, None, + + Below, None, None, None, + None, None, None, None, + None, None, None, None, + None, None, None, None, + + // Gurmukhi + None, Above, Above, Post, + None, None, None, None, + None, None, None, None, + None, None, None, None, + + None, None, None, None, + None, None, None, None, + None, None, None, None, + None, None, None, None, + + None, None, None, None, + None, None, None, None, + None, None, None, None, + None, None, None, Post, + + Below, None, None, None, + None, Below, None, None, + None, Below, None, None, + Below, None, Post, Pre, + + Post, Below, Below, None, + None, None, None, Above, + Above, None, None, Above, + Above, None, None, None, + + None, None, None, None, + None, None, None, None, + None, None, None, None, + None, None, None, None, + + None, None, None, None, + None, None, None, None, + None, None, None, None, + None, None, None, None, + + Above, Above, None, None, + None, None, None, None, + None, None, None, None, + None, None, None, None, + + // Gujarati + None, Above, Above, Post, + None, None, None, None, + None, None, None, None, + None, None, None, None, + + None, None, None, None, + None, None, None, None, + None, None, None, None, + None, None, None, None, + + None, None, None, None, + None, None, None, None, + None, None, None, None, + None, None, None, None, + + Below, None, None, None, + None, None, None, None, + None, None, None, None, + None, None, Post, Pre, + + Post, Below, Below, Below, + Below, Above, None, Above, + Above, Post, None, Post, + Post, None, None, None, + + None, None, None, None, + None, None, None, None, + None, None, None, None, + None, None, None, None, + + None, None, Below, Below, + None, None, None, None, + None, None, None, None, + None, None, None, None, + + None, None, None, None, + None, None, None, None, + None, None, None, None, + None, None, None, None, + + // Oriya + None, Above, Post, Post, + None, None, None, None, + None, None, None, None, + None, None, None, None, + + None, None, None, None, + None, None, None, None, + None, None, None, None, + None, None, None, None, + + None, None, None, None, + Below, None, None, None, + Below, None, None, None, + Below, Below, Below, Post, + + Below, None, Below, Below, + None, None, None, None, + None, None, None, None, + None, None, Post, Above, + + Post, Below, Below, Below, + None, None, None, Pre, + Split, None, None, Split, + Split, None, None, None, + + None, None, None, None, + None, None, Above, Post, + None, None, None, None, + None, None, None, Post, + + None, None, None, None, + None, None, None, None, + None, None, None, None, + None, None, None, None, + + None, Below, None, None, + None, None, None, None, + None, None, None, None, + None, None, None, None, + + // Tamil + None, None, Above, None, + None, None, None, None, + None, None, None, None, + None, None, None, None, + + None, None, None, None, + None, None, None, None, + None, None, None, None, + None, None, None, None, + + None, None, None, None, + None, None, None, None, + None, None, None, None, + None, None, None, None, + + None, None, None, None, + None, None, None, None, + None, None, None, None, + None, None, Post, Post, + + Above, Below, Below, None, + None, None, Pre, Pre, + Pre, None, Split, Split, + Split, Halant, None, None, + + None, None, None, None, + None, None, None, Post, + None, None, None, None, + None, None, None, None, + + None, None, None, None, + None, None, None, None, + None, None, None, None, + None, None, None, None, + + None, None, None, None, + None, None, None, None, + None, None, None, None, + None, None, None, None, + + // Telugu + None, Post, Post, Post, + None, None, None, None, + None, None, None, None, + None, None, None, None, + + None, None, None, None, + None, Below, Below, Below, + Below, Below, Below, Below, + Below, Below, Below, Below, + + Below, Below, Below, Below, + Below, Below, Below, Below, + Below, None, Below, Below, + Below, Below, Below, Below, + + Below, None, Below, Below, + None, Below, Below, Below, + Below, Below, None, None, + None, None, Post, Above, + + Above, Post, Post, Post, + Post, None, Above, Above, + Split, None, Post, Above, + Above, Halant, None, None, + + None, None, None, None, + None, Above, Below, None, + None, None, None, None, + None, None, None, None, + + None, None, None, None, + None, None, None, None, + None, None, None, None, + None, None, None, None, + + None, None, None, None, + None, None, None, None, + None, None, None, None, + None, None, None, None, + + // Kannada + None, None, Post, Post, + None, None, None, None, + None, None, None, None, + None, None, None, None, + + None, None, None, None, + None, Below, Below, Below, + Below, Below, Below, Below, + Below, Below, Below, Below, + + Below, Below, Below, Below, + Below, Below, Below, Below, + Below, Below, Below, Below, + Below, Below, Below, Below, + + Below, None, Below, Below, + None, Below, Below, Below, + Below, Below, None, None, + None, None, Post, Above, + + Split, Post, Post, Post, + Post, None, Above, Split, + Split, None, Split, Split, + Above, Halant, None, None, + + None, None, None, None, + None, Post, Post, None, + None, None, None, None, + None, None, Below, None, + + None, None, Below, Below, + None, None, None, None, + None, None, None, None, + None, None, None, None, + + None, None, None, None, + None, None, None, None, + None, None, None, None, + None, None, None, None, + + // Malayalam + None, None, Post, Post, + None, None, None, None, + None, None, None, None, + None, None, None, None, + + None, None, None, None, + None, None, None, None, + None, None, None, None, + None, None, None, None, + + None, None, None, None, + None, None, None, None, + None, None, None, None, + None, None, None, Post, + + Post, None, Below, None, + None, Post, None, None, + None, None, None, None, + None, None, Post, Post, + + Post, Post, Post, Post, + None, None, Pre, Pre, + Pre, None, Split, Split, + Split, Halant, None, None, + + None, None, None, None, + None, None, None, Post, + None, None, None, None, + None, None, None, None, + + None, None, None, None, + None, None, None, None, + None, None, None, None, + None, None, None, None, + + None, None, None, None, + None, None, None, None, + None, None, None, None, + None, None, None, None, + + // Sinhala + None, None, Post, Post, + None, None, None, None, + None, None, None, None, + None, None, None, None, + + None, None, None, None, + None, None, None, None, + None, None, None, None, + None, None, None, None, + + None, None, None, None, + None, None, None, None, + None, None, None, None, + None, None, None, None, + + None, None, None, None, + None, None, None, None, + None, None, None, None, + None, None, None, None, + + None, None, None, None, + None, None, None, None, + None, None, None, None, + None, None, None, Post, + + Post, Post, Above, Above, + Below, None, Below, None, + Post, Pre, Split, Pre, + Split, Split, Split, Post, + + None, None, None, None, + None, None, None, None, + None, None, None, None, + None, None, None, None, + + None, None, Post, Post, + None, None, None, None, + None, None, None, None, + None, None, None, None +}; + +static inline Form form(unsigned short uc) { + if (uc < 0x900 || uc > 0xdff) { + if (uc == 0x25cc) + return Consonant; + if (uc == 0x200c || uc == 0x200d) + return Control; + return Other; + } + return (Form)indicForms[uc-0x900]; +} + +static inline Position indic_position(unsigned short uc) { + if (uc < 0x900 || uc > 0xdff) + return None; + return (Position) indicPosition[uc-0x900]; +} + + +enum IndicScriptProperties { + HasReph = 0x01, + HasSplit = 0x02 +}; + +const hb_uint8 scriptProperties[10] = { + // Devanagari, + HasReph, + // Bengali, + HasReph|HasSplit, + // Gurmukhi, + 0, + // Gujarati, + HasReph, + // Oriya, + HasReph|HasSplit, + // Tamil, + HasSplit, + // Telugu, + HasSplit, + // Kannada, + HasSplit|HasReph, + // Malayalam, + HasSplit, + // Sinhala, + HasSplit +}; + +struct IndicOrdering { + Form form; + Position position; +}; + +static const IndicOrdering devanagari_order [] = { + { Consonant, Below }, + { Matra, Below }, + { VowelMark, Below }, + { StressMark, Below }, + { Matra, Above }, + { Matra, Post }, + { Consonant, Reph }, + { VowelMark, Above }, + { StressMark, Above }, + { VowelMark, Post }, + { (Form)0, None } +}; + +static const IndicOrdering bengali_order [] = { + { Consonant, Below }, + { Matra, Below }, + { Matra, Above }, + { Consonant, Reph }, + { VowelMark, Above }, + { Consonant, Post }, + { Matra, Post }, + { VowelMark, Post }, + { (Form)0, None } +}; + +static const IndicOrdering gurmukhi_order [] = { + { Consonant, Below }, + { Matra, Below }, + { Matra, Above }, + { Consonant, Post }, + { Matra, Post }, + { VowelMark, Above }, + { (Form)0, None } +}; + +static const IndicOrdering tamil_order [] = { + { Matra, Above }, + { Matra, Post }, + { VowelMark, Post }, + { (Form)0, None } +}; + +static const IndicOrdering telugu_order [] = { + { Matra, Above }, + { Matra, Below }, + { Matra, Post }, + { Consonant, Below }, + { Consonant, Post }, + { VowelMark, Post }, + { (Form)0, None } +}; + +static const IndicOrdering kannada_order [] = { + { Matra, Above }, + { Matra, Post }, + { Consonant, Below }, + { Consonant, Post }, + { LengthMark, Post }, + { Consonant, Reph }, + { VowelMark, Post }, + { (Form)0, None } +}; + +static const IndicOrdering malayalam_order [] = { + { Consonant, Below }, + { Matra, Below }, + { Consonant, Reph }, + { Consonant, Post }, + { Matra, Post }, + { VowelMark, Post }, + { (Form)0, None } +}; + +static const IndicOrdering sinhala_order [] = { + { Matra, Below }, + { Matra, Above }, + { Matra, Post }, + { VowelMark, Post }, + { (Form)0, None } +}; + +static const IndicOrdering * const indic_order[] = { + devanagari_order, // Devanagari + bengali_order, // Bengali + gurmukhi_order, // Gurmukhi + devanagari_order, // Gujarati + bengali_order, // Oriya + tamil_order, // Tamil + telugu_order, // Telugu + kannada_order, // Kannada + malayalam_order, // Malayalam + sinhala_order // Sinhala +}; + + + +// vowel matras that have to be split into two parts. +static const unsigned short split_matras[] = { + // matra, split1, split2, split3 + + // bengalis + 0x9cb, 0x9c7, 0x9be, 0x0, + 0x9cc, 0x9c7, 0x9d7, 0x0, + // oriya + 0xb48, 0xb47, 0xb56, 0x0, + 0xb4b, 0xb47, 0xb3e, 0x0, + 0xb4c, 0xb47, 0xb57, 0x0, + // tamil + 0xbca, 0xbc6, 0xbbe, 0x0, + 0xbcb, 0xbc7, 0xbbe, 0x0, + 0xbcc, 0xbc6, 0xbd7, 0x0, + // telugu + 0xc48, 0xc46, 0xc56, 0x0, + // kannada + 0xcc0, 0xcbf, 0xcd5, 0x0, + 0xcc7, 0xcc6, 0xcd5, 0x0, + 0xcc8, 0xcc6, 0xcd6, 0x0, + 0xcca, 0xcc6, 0xcc2, 0x0, + 0xccb, 0xcc6, 0xcc2, 0xcd5, + // malayalam + 0xd4a, 0xd46, 0xd3e, 0x0, + 0xd4b, 0xd47, 0xd3e, 0x0, + 0xd4c, 0xd46, 0xd57, 0x0, + // sinhala + 0xdda, 0xdd9, 0xdca, 0x0, + 0xddc, 0xdd9, 0xdcf, 0x0, + 0xddd, 0xdd9, 0xdcf, 0xdca, + 0xdde, 0xdd9, 0xddf, 0x0, + 0xffff +}; + +static inline void splitMatra(unsigned short *reordered, int matra, int &len) +{ + unsigned short matra_uc = reordered[matra]; + //qDebug("matra=%d, reordered[matra]=%x", matra, reordered[matra]); + + const unsigned short *split = split_matras; + while (split[0] < matra_uc) + split += 4; + + assert(*split == matra_uc); + ++split; + + int added_chars = split[2] == 0x0 ? 1 : 2; + + memmove(reordered + matra + added_chars, reordered + matra, (len-matra)*sizeof(unsigned short)); + reordered[matra] = split[0]; + reordered[matra+1] = split[1]; + if(added_chars == 2) + reordered[matra+2] = split[2]; + len += added_chars; +} + +#ifndef NO_OPENTYPE +static const HB_OpenTypeFeature indic_features[] = { + { HB_MAKE_TAG('l', 'o', 'c', 'a'), LocaProperty }, + { HB_MAKE_TAG('c', 'c', 'm', 'p'), CcmpProperty }, + { HB_MAKE_TAG('i', 'n', 'i', 't'), InitProperty }, + { HB_MAKE_TAG('n', 'u', 'k', 't'), NuktaProperty }, + { HB_MAKE_TAG('a', 'k', 'h', 'n'), AkhantProperty }, + { HB_MAKE_TAG('r', 'p', 'h', 'f'), RephProperty }, + { HB_MAKE_TAG('b', 'l', 'w', 'f'), BelowFormProperty }, + { HB_MAKE_TAG('h', 'a', 'l', 'f'), HalfFormProperty }, + { HB_MAKE_TAG('p', 's', 't', 'f'), PostFormProperty }, + { HB_MAKE_TAG('c', 'j', 'c', 't'), ConjunctFormProperty }, + { HB_MAKE_TAG('v', 'a', 't', 'u'), VattuProperty }, + { HB_MAKE_TAG('p', 'r', 'e', 's'), PreSubstProperty }, + { HB_MAKE_TAG('b', 'l', 'w', 's'), BelowSubstProperty }, + { HB_MAKE_TAG('a', 'b', 'v', 's'), AboveSubstProperty }, + { HB_MAKE_TAG('p', 's', 't', 's'), PostSubstProperty }, + { HB_MAKE_TAG('h', 'a', 'l', 'n'), HalantProperty }, + { HB_MAKE_TAG('c', 'a', 'l', 't'), IndicCaltProperty }, + { 0, 0 } +}; +#endif + +// #define INDIC_DEBUG +#ifdef INDIC_DEBUG +#define IDEBUG hb_debug +#include + +static void hb_debug(const char *msg, ...) +{ + va_list ap; + va_start(ap, msg); // use variable arg list + vfprintf(stderr, msg, ap); + va_end(ap); + fprintf(stderr, "\n"); +} + +#else +#define IDEBUG if(0) printf +#endif + +#if 0 //def INDIC_DEBUG +static QString propertiesToString(int properties) +{ + QString res; + properties = ~properties; + if (properties & LocaProperty) + res += "Loca "; + if (properties & CcmpProperty) + res += "Ccmp "; + if (properties & InitProperty) + res += "Init "; + if (properties & NuktaProperty) + res += "Nukta "; + if (properties & AkhantProperty) + res += "Akhant "; + if (properties & RephProperty) + res += "Reph "; + if (properties & PreFormProperty) + res += "PreForm "; + if (properties & BelowFormProperty) + res += "BelowForm "; + if (properties & AboveFormProperty) + res += "AboveForm "; + if (properties & HalfFormProperty) + res += "HalfForm "; + if (properties & PostFormProperty) + res += "PostForm "; + if (properties & ConjunctFormProperty) + res += "PostForm "; + if (properties & VattuProperty) + res += "Vattu "; + if (properties & PreSubstProperty) + res += "PreSubst "; + if (properties & BelowSubstProperty) + res += "BelowSubst "; + if (properties & AboveSubstProperty) + res += "AboveSubst "; + if (properties & PostSubstProperty) + res += "PostSubst "; + if (properties & HalantProperty) + res += "Halant "; + if (properties & CligProperty) + res += "Clig "; + if (properties & IndicCaltProperty) + res += "Calt "; + return res; +} +#endif + +static bool indic_shape_syllable(HB_Bool openType, HB_ShaperItem *item, bool invalid) +{ + HB_Script script = item->item.script; + assert(script >= HB_Script_Devanagari && script <= HB_Script_Sinhala); + const unsigned short script_base = 0x0900 + 0x80*(script-HB_Script_Devanagari); + const unsigned short ra = script_base + 0x30; + const unsigned short halant = script_base + 0x4d; + const unsigned short nukta = script_base + 0x3c; + bool control = false; + + int len = (int)item->item.length; + IDEBUG(">>>>> indic shape: from=%d, len=%d invalid=%d", item->item.pos, item->item.length, invalid); + + if ((int)item->num_glyphs < len+4) { + item->num_glyphs = len+4; + return false; + } + + HB_STACKARRAY(HB_UChar16, reordered, len + 4); + HB_STACKARRAY(hb_uint8, position, len + 4); + + unsigned char properties = scriptProperties[script-HB_Script_Devanagari]; + + if (invalid) { + *reordered = 0x25cc; + memcpy(reordered+1, item->string + item->item.pos, len*sizeof(HB_UChar16)); + len++; + } else { + memcpy(reordered, item->string + item->item.pos, len*sizeof(HB_UChar16)); + } + if (reordered[len-1] == 0x200c) // zero width non joiner + len--; + + int i; + int base = 0; + int reph = -1; + +#ifdef INDIC_DEBUG + IDEBUG("original:"); + for (i = 0; i < len; i++) { + IDEBUG(" %d: %4x", i, reordered[i]); + } +#endif + + if (len != 1) { + HB_UChar16 *uc = reordered; + bool beginsWithRa = false; + + // Rule 1: find base consonant + // + // The shaping engine finds the base consonant of the + // syllable, using the following algorithm: starting from the + // end of the syllable, move backwards until a consonant is + // found that does not have a below-base or post-base form + // (post-base forms have to follow below-base forms), or + // arrive at the first consonant. The consonant stopped at + // will be the base. + // + // * If the syllable starts with Ra + H (in a script that has + // 'Reph'), Ra is excluded from candidates for base + // consonants. + // + // * In Kannada and Telugu, the base consonant cannot be + // farther than 3 consonants from the end of the syllable. + // #### replace the HasReph property by testing if the feature exists in the font! + if (form(*uc) == Consonant || (script == HB_Script_Bengali && form(*uc) == IndependentVowel)) { + if ((properties & HasReph) && (len > 2) && + (*uc == ra || *uc == 0x9f0) && *(uc+1) == halant) + beginsWithRa = true; + + if (beginsWithRa && form(*(uc+2)) == Control) + beginsWithRa = false; + + base = (beginsWithRa ? 2 : 0); + IDEBUG(" length = %d, beginsWithRa = %d, base=%d", len, beginsWithRa, base); + + int lastConsonant = 0; + int matra = -1; + // we remember: + // * the last consonant since we need it for rule 2 + // * the matras position for rule 3 and 4 + + // figure out possible base glyphs + memset(position, 0, len); + if (script == HB_Script_Devanagari || script == HB_Script_Gujarati) { + bool vattu = false; + for (i = base; i < len; ++i) { + position[i] = form(uc[i]); + if (position[i] == Consonant) { + lastConsonant = i; + vattu = (!vattu && uc[i] == ra); + if (vattu) { + IDEBUG("excluding vattu glyph at %d from base candidates", i); + position[i] = Vattu; + } + } else if (position[i] == Matra) { + matra = i; + } + } + } else { + for (i = base; i < len; ++i) { + position[i] = form(uc[i]); + if (position[i] == Consonant) + lastConsonant = i; + else if (matra < 0 && position[i] == Matra) + matra = i; + } + } + int skipped = 0; + Position pos = Post; + for (i = len-1; i >= base; i--) { + if (position[i] != Consonant && (position[i] != Control || script == HB_Script_Kannada)) + continue; + + if (i < len-1 && position[i] == Control && position[i+1] == Consonant) { + base = i+1; + break; + } + + Position charPosition = indic_position(uc[i]); + if (pos == Post && charPosition == Post) { + pos = Post; + } else if ((pos == Post || pos == Below) && charPosition == Below) { + if (script == HB_Script_Devanagari || script == HB_Script_Gujarati) + base = i; + pos = Below; + } else { + base = i; + break; + } + if (skipped == 2 && (script == HB_Script_Kannada || script == HB_Script_Telugu)) { + base = i; + break; + } + ++skipped; + } + + IDEBUG(" base consonant at %d skipped=%d, lastConsonant=%d", base, skipped, lastConsonant); + + // Rule 2: + // + // If the base consonant is not the last one, Uniscribe + // moves the halant from the base consonant to the last + // one. + if (lastConsonant > base) { + int halantPos = 0; + if (uc[base+1] == halant) + halantPos = base + 1; + else if (uc[base+1] == nukta && uc[base+2] == halant) + halantPos = base + 2; + if (halantPos > 0) { + IDEBUG(" moving halant from %d to %d!", base+1, lastConsonant); + for (i = halantPos; i < lastConsonant; i++) + uc[i] = uc[i+1]; + uc[lastConsonant] = halant; + } + } + + // Rule 3: + // + // If the syllable starts with Ra + H, Uniscribe moves + // this combination so that it follows either: + + // * the post-base 'matra' (if any) or the base consonant + // (in scripts that show similarity to Devanagari, i.e., + // Devanagari, Gujarati, Bengali) + // * the base consonant (other scripts) + // * the end of the syllable (Kannada) + + Position matra_position = None; + if (matra > 0) + matra_position = indic_position(uc[matra]); + IDEBUG(" matra at %d with form %d, base=%d", matra, matra_position, base); + + if (beginsWithRa && base != 0) { + int toPos = base+1; + if (toPos < len && uc[toPos] == nukta) + toPos++; + if (toPos < len && uc[toPos] == halant) + toPos++; + if (toPos < len && uc[toPos] == 0x200d) + toPos++; + if (toPos < len-1 && uc[toPos] == ra && uc[toPos+1] == halant) + toPos += 2; + if (script == HB_Script_Devanagari || script == HB_Script_Gujarati || script == HB_Script_Bengali) { + if (matra_position == Post || matra_position == Split) { + toPos = matra+1; + matra -= 2; + } + } else if (script == HB_Script_Kannada) { + toPos = len; + matra -= 2; + } + + IDEBUG("moving leading ra+halant to position %d", toPos); + for (i = 2; i < toPos; i++) + uc[i-2] = uc[i]; + uc[toPos-2] = ra; + uc[toPos-1] = halant; + base -= 2; + if (properties & HasReph) + reph = toPos-2; + } + + // Rule 4: + + // Uniscribe splits two- or three-part matras into their + // parts. This splitting is a character-to-character + // operation). + // + // Uniscribe describes some moving operations for these + // matras here. For shaping however all pre matras need + // to be at the beginning of the syllable, so we just move + // them there now. + if (matra_position == Split) { + splitMatra(uc, matra, len); + // Handle three-part matras (0xccb in Kannada) + matra_position = indic_position(uc[matra]); + } + + if (matra_position == Pre) { + unsigned short m = uc[matra]; + while (matra--) + uc[matra+1] = uc[matra]; + uc[0] = m; + base++; + } + } + + // Rule 5: + // + // Uniscribe classifies consonants and 'matra' parts as + // pre-base, above-base (Reph), below-base or post-base. This + // classification exists on the character code level and is + // language-dependent, not font-dependent. + for (i = 0; i < base; ++i) + position[i] = Pre; + position[base] = Base; + for (i = base+1; i < len; ++i) { + position[i] = indic_position(uc[i]); + // #### replace by adjusting table + if (uc[i] == nukta || uc[i] == halant) + position[i] = Inherit; + } + if (reph > 0) { + // recalculate reph, it might have changed. + for (i = base+1; i < len; ++i) + if (uc[i] == ra) + reph = i; + position[reph] = Reph; + position[reph+1] = Inherit; + } + + // all reordering happens now to the chars after the base + int fixed = base+1; + if (fixed < len && uc[fixed] == nukta) + fixed++; + if (fixed < len && uc[fixed] == halant) + fixed++; + if (fixed < len && uc[fixed] == 0x200d) + fixed++; + +#ifdef INDIC_DEBUG + for (i = fixed; i < len; ++i) + IDEBUG("position[%d] = %d, form=%d uc=%x", i, position[i], form(uc[i]), uc[i]); +#endif + // we continuosly position the matras and vowel marks and increase the fixed + // until we reached the end. + const IndicOrdering *finalOrder = indic_order[script-HB_Script_Devanagari]; + + IDEBUG(" reordering pass:"); + IDEBUG(" base=%d fixed=%d", base, fixed); + int toMove = 0; + while (finalOrder[toMove].form && fixed < len-1) { + IDEBUG(" fixed = %d, toMove=%d, moving form %d with pos %d", fixed, toMove, finalOrder[toMove].form, finalOrder[toMove].position); + for (i = fixed; i < len; i++) { +// IDEBUG() << " i=" << i << "uc=" << hex << uc[i] << "form=" << form(uc[i]) +// << "position=" << position[i]; + if (form(uc[i]) == finalOrder[toMove].form && + position[i] == finalOrder[toMove].position) { + // need to move this glyph + int to = fixed; + if (i < len-1 && position[i+1] == Inherit) { + IDEBUG(" moving two chars from %d to %d", i, to); + unsigned short ch = uc[i]; + unsigned short ch2 = uc[i+1]; + unsigned char pos = position[i]; + for (int j = i+1; j > to+1; j--) { + uc[j] = uc[j-2]; + position[j] = position[j-2]; + } + uc[to] = ch; + uc[to+1] = ch2; + position[to] = pos; + position[to+1] = pos; + fixed += 2; + } else { + IDEBUG(" moving one char from %d to %d", i, to); + unsigned short ch = uc[i]; + unsigned char pos = position[i]; + for (int j = i; j > to; j--) { + uc[j] = uc[j-1]; + position[j] = position[j-1]; + } + uc[to] = ch; + position[to] = pos; + fixed++; + } + } + } + toMove++; + } + + } + + if (reph > 0) { + // recalculate reph, it might have changed. + for (i = base+1; i < len; ++i) + if (reordered[i] == ra) + reph = i; + } + +#ifndef NO_OPENTYPE + const int availableGlyphs = item->num_glyphs; +#endif + if (!item->font->klass->convertStringToGlyphIndices(item->font, + reordered, len, + item->glyphs, &item->num_glyphs, + item->item.bidiLevel % 2)) + goto error; + + + IDEBUG(" base=%d, reph=%d", base, reph); + IDEBUG("reordered:"); + for (i = 0; i < len; i++) { + item->attributes[i].mark = false; + item->attributes[i].clusterStart = false; + item->attributes[i].justification = 0; + item->attributes[i].zeroWidth = false; + IDEBUG(" %d: %4x", i, reordered[i]); + } + + // now we have the syllable in the right order, and can start running it through open type. + + for (i = 0; i < len; ++i) + control |= (form(reordered[i]) == Control); + +#ifndef NO_OPENTYPE + if (openType) { + + // we need to keep track of where the base glyph is for some + // scripts and use the cluster feature for this. This + // also means we have to correct the logCluster output from + // the open type engine manually afterwards. for indic this + // is rather simple, as all chars just point to the first + // glyph in the syllable. + HB_STACKARRAY(unsigned short, clusters, len); + HB_STACKARRAY(unsigned int, properties, len); + + for (i = 0; i < len; ++i) + clusters[i] = i; + + // features we should always apply + for (i = 0; i < len; ++i) + properties[i] = ~(LocaProperty + | CcmpProperty + | NuktaProperty + | VattuProperty + | ConjunctFormProperty + | PreSubstProperty + | BelowSubstProperty + | AboveSubstProperty + | PostSubstProperty + | HalantProperty + | IndicCaltProperty + | PositioningProperties); + + // Loca always applies + // Ccmp always applies + // Init + if (item->item.pos == 0 + || !(isLetter(item->string[item->item.pos-1]) || isMark(item->string[item->item.pos-1]))) + properties[0] &= ~InitProperty; + + // Nukta always applies + // Akhant + for (i = 0; i <= base; ++i) + properties[i] &= ~AkhantProperty; + // Reph + if (reph >= 0) { + properties[reph] &= ~RephProperty; + properties[reph+1] &= ~RephProperty; + } + // BelowForm + for (i = base+1; i < len; ++i) + properties[i] &= ~BelowFormProperty; + + if (script == HB_Script_Devanagari || script == HB_Script_Gujarati) { + // vattu glyphs need this aswell + bool vattu = false; + for (i = base-2; i > 1; --i) { + if (form(reordered[i]) == Consonant) { + vattu = (!vattu && reordered[i] == ra); + if (vattu) { + IDEBUG("forming vattu ligature at %d", i); + properties[i] &= ~BelowFormProperty; + properties[i+1] &= ~BelowFormProperty; + } + } + } + } + // HalfFormProperty + for (i = 0; i < base; ++i) + properties[i] &= ~HalfFormProperty; + if (control) { + for (i = 2; i < len; ++i) { + if (reordered[i] == 0x200d /* ZWJ */) { + properties[i-1] &= ~HalfFormProperty; + properties[i-2] &= ~HalfFormProperty; + } else if (reordered[i] == 0x200c /* ZWNJ */) { + properties[i-1] &= ~HalfFormProperty; + properties[i-2] &= ~HalfFormProperty; + } + } + } + // PostFormProperty + for (i = base+1; i < len; ++i) + properties[i] &= ~PostFormProperty; + // vattu always applies + // pres always applies + // blws always applies + // abvs always applies + // psts always applies + // halant always applies + // calt always applies + +#ifdef INDIC_DEBUG +// { +// IDEBUG("OT properties:"); +// for (int i = 0; i < len; ++i) +// qDebug(" i: %s", ::propertiesToString(properties[i]).toLatin1().data()); +// } +#endif + + // initialize + item->log_clusters = clusters; + HB_OpenTypeShape(item, properties); + + int newLen = item->face->buffer->in_length; + HB_GlyphItem otl_glyphs = item->face->buffer->in_string; + + // move the left matra back to its correct position in malayalam and tamil + if ((script == HB_Script_Malayalam || script == HB_Script_Tamil) && (form(reordered[0]) == Matra)) { +// qDebug("reordering matra, len=%d", newLen); + // need to find the base in the shaped string and move the matra there + int basePos = 0; + while (basePos < newLen && (int)otl_glyphs[basePos].cluster <= base) + basePos++; + --basePos; + if (basePos < newLen && basePos > 1) { +// qDebug("moving prebase matra to position %d in syllable newlen=%d", basePos, newLen); + HB_GlyphItemRec m = otl_glyphs[0]; + --basePos; + for (i = 0; i < basePos; ++i) + otl_glyphs[i] = otl_glyphs[i+1]; + otl_glyphs[basePos] = m; + } + } + + HB_Bool positioned = HB_OpenTypePosition(item, availableGlyphs, false); + + HB_FREE_STACKARRAY(clusters); + HB_FREE_STACKARRAY(properties); + + if (!positioned) + goto error; + + if (control) { + IDEBUG("found a control char in the syllable"); + hb_uint32 i = 0, j = 0; + while (i < item->num_glyphs) { + if (form(reordered[otl_glyphs[i].cluster]) == Control) { + ++i; + if (i >= item->num_glyphs) + break; + } + item->glyphs[j] = item->glyphs[i]; + item->attributes[j] = item->attributes[i]; + ++i; + ++j; + } + item->num_glyphs = j; + } + + } else { + HB_HeuristicPosition(item); + } +#endif // NO_OPENTYPE + item->attributes[0].clusterStart = true; + + HB_FREE_STACKARRAY(reordered); + HB_FREE_STACKARRAY(position); + + IDEBUG("<<<<<<"); + return true; + +error: + HB_FREE_STACKARRAY(reordered); + HB_FREE_STACKARRAY(position); + return false; +} + +/* syllables are of the form: + + (Consonant Nukta? Halant)* Consonant Matra? VowelMark? StressMark? + (Consonant Nukta? Halant)* Consonant Halant + IndependentVowel VowelMark? StressMark? + + We return syllable boundaries on invalid combinations aswell +*/ +static int indic_nextSyllableBoundary(HB_Script script, const HB_UChar16 *s, int start, int end, bool *invalid) +{ + *invalid = false; + IDEBUG("indic_nextSyllableBoundary: start=%d, end=%d", start, end); + const HB_UChar16 *uc = s+start; + + int pos = 0; + Form state = form(uc[pos]); + IDEBUG("state[%d]=%d (uc=%4x)", pos, state, uc[pos]); + pos++; + + if (state != Consonant && state != IndependentVowel) { + if (state != Other) + *invalid = true; + goto finish; + } + + while (pos < end - start) { + Form newState = form(uc[pos]); + IDEBUG("state[%d]=%d (uc=%4x)", pos, newState, uc[pos]); + switch(newState) { + case Control: + newState = state; + if (state == Halant && uc[pos] == 0x200d /* ZWJ */) + break; + // the control character should be the last char in the item + ++pos; + goto finish; + case Consonant: + if (state == Halant && (script != HB_Script_Sinhala || uc[pos-1] == 0x200d /* ZWJ */)) + break; + goto finish; + case Halant: + if (state == Nukta || state == Consonant) + break; + // Bengali has a special exception allowing the combination Vowel_A/E + Halant + Ya + if (script == HB_Script_Bengali && pos == 1 && + (uc[0] == 0x0985 || uc[0] == 0x098f)) + break; + // Sinhala uses the Halant as a component of certain matras. Allow these, but keep the state on Matra. + if (script == HB_Script_Sinhala && state == Matra) { + ++pos; + continue; + } + if (script == HB_Script_Malayalam && state == Matra && uc[pos-1] == 0x0d41) { + ++pos; + continue; + } + goto finish; + case Nukta: + if (state == Consonant) + break; + goto finish; + case StressMark: + if (state == VowelMark) + break; + // fall through + case VowelMark: + if (state == Matra || state == LengthMark || state == IndependentVowel) + break; + // fall through + case Matra: + if (state == Consonant || state == Nukta) + break; + if (state == Matra) { + // ### needs proper testing for correct two/three part matras + break; + } + // ### not sure if this is correct. If it is, does it apply only to Bengali or should + // it work for all Indic languages? + // the combination Independent_A + Vowel Sign AA is allowed. + if (script == HB_Script_Bengali && uc[pos] == 0x9be && uc[pos-1] == 0x985) + break; + if (script == HB_Script_Tamil && state == Matra) { + if (uc[pos-1] == 0x0bc6 && + (uc[pos] == 0xbbe || uc[pos] == 0xbd7)) + break; + if (uc[pos-1] == 0x0bc7 && uc[pos] == 0xbbe) + break; + } + goto finish; + + case LengthMark: + if (state == Matra) { + // ### needs proper testing for correct two/three part matras + break; + } + case IndependentVowel: + case Invalid: + case Other: + goto finish; + } + state = newState; + pos++; + } + finish: + return pos+start; +} + +HB_Bool HB_IndicShape(HB_ShaperItem *item) +{ + assert(item->item.script >= HB_Script_Devanagari && item->item.script <= HB_Script_Sinhala); + + HB_Bool openType = false; +#ifndef NO_OPENTYPE + openType = HB_SelectScript(item, indic_features); +#endif + unsigned short *logClusters = item->log_clusters; + + HB_ShaperItem syllable = *item; + int first_glyph = 0; + + int sstart = item->item.pos; + int end = sstart + item->item.length; + IDEBUG("indic_shape: from %d length %d", item->item.pos, item->item.length); + while (sstart < end) { + bool invalid; + int send = indic_nextSyllableBoundary(item->item.script, item->string, sstart, end, &invalid); + IDEBUG("syllable from %d, length %d, invalid=%s", sstart, send-sstart, + invalid ? "true" : "false"); + syllable.item.pos = sstart; + syllable.item.length = send-sstart; + syllable.glyphs = item->glyphs + first_glyph; + syllable.attributes = item->attributes + first_glyph; + syllable.offsets = item->offsets + first_glyph; + syllable.advances = item->advances + first_glyph; + syllable.num_glyphs = item->num_glyphs - first_glyph; + if (!indic_shape_syllable(openType, &syllable, invalid)) { + IDEBUG("syllable shaping failed, syllable requests %d glyphs", syllable.num_glyphs); + item->num_glyphs += syllable.num_glyphs; + return false; + } + // fix logcluster array + IDEBUG("syllable:"); + hb_uint32 g; + for (g = first_glyph; g < first_glyph + syllable.num_glyphs; ++g) + IDEBUG(" %d -> glyph %x", g, item->glyphs[g]); + IDEBUG(" logclusters:"); + int i; + for (i = sstart; i < send; ++i) { + IDEBUG(" %d -> glyph %d", i, first_glyph); + logClusters[i-item->item.pos] = first_glyph; + } + sstart = send; + first_glyph += syllable.num_glyphs; + } + item->num_glyphs = first_glyph; + return true; +} + +void HB_IndicAttributes(HB_Script script, const HB_UChar16 *text, hb_uint32 from, hb_uint32 len, HB_CharAttributes *attributes) +{ + int end = from + len; + const HB_UChar16 *uc = text + from; + attributes += from; + hb_uint32 i = 0; + while (i < len) { + bool invalid; + hb_uint32 boundary = indic_nextSyllableBoundary(script, text, from+i, end, &invalid) - from; + attributes[i].charStop = true; + + if (boundary > len-1) boundary = len; + i++; + while (i < boundary) { + attributes[i].charStop = false; + ++uc; + ++i; + } + assert(i == boundary); + } + + +} + + diff --git a/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-khmer.c b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-khmer.c new file mode 100644 index 0000000..958069e --- /dev/null +++ b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-khmer.c @@ -0,0 +1,667 @@ +/* + * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) + * + * This is part of HarfBuzz, an OpenType Layout engine library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#include "harfbuzz-shaper.h" +#include "harfbuzz-shaper-private.h" + +#include +#include + +/* +// Vocabulary +// Base -> A consonant or an independent vowel in its full (not subscript) form. It is the +// center of the syllable, it can be surrounded by coeng (subscript) consonants, vowels, +// split vowels, signs... but there is only one base in a syllable, it has to be coded as +// the first character of the syllable. +// split vowel --> vowel that has two parts placed separately (e.g. Before and after the consonant). +// Khmer language has five of them. Khmer split vowels either have one part before the +// base and one after the base or they have a part before the base and a part above the base. +// The first part of all Khmer split vowels is the same character, identical to +// the glyph of Khmer dependent vowel SRA EI +// coeng --> modifier used in Khmer to construct coeng (subscript) consonants +// Differently than indian languages, the coeng modifies the consonant that follows it, +// not the one preceding it Each consonant has two forms, the base form and the subscript form +// the base form is the normal one (using the consonants code-point), the subscript form is +// displayed when the combination coeng + consonant is encountered. +// Consonant of type 1 -> A consonant which has subscript for that only occupies space under a base consonant +// Consonant of type 2.-> Its subscript form occupies space under and before the base (only one, RO) +// Consonant of Type 3 -> Its subscript form occupies space under and after the base (KHO, CHHO, THHO, BA, YO, SA) +// Consonant shifter -> Khmer has to series of consonants. The same dependent vowel has different sounds +// if it is attached to a consonant of the first series or a consonant of the second series +// Most consonants have an equivalent in the other series, but some of theme exist only in +// one series (for example SA). If we want to use the consonant SA with a vowel sound that +// can only be done with a vowel sound that corresponds to a vowel accompanying a consonant +// of the other series, then we need to use a consonant shifter: TRIISAP or MUSIKATOAN +// x17C9 y x17CA. TRIISAP changes a first series consonant to second series sound and +// MUSIKATOAN a second series consonant to have a first series vowel sound. +// Consonant shifter are both normally supercript marks, but, when they are followed by a +// superscript, they change shape and take the form of subscript dependent vowel SRA U. +// If they are in the same syllable as a coeng consonant, Unicode 3.0 says that they +// should be typed before the coeng. Unicode 4.0 breaks the standard and says that it should +// be placed after the coeng consonant. +// Dependent vowel -> In khmer dependent vowels can be placed above, below, before or after the base +// Each vowel has its own position. Only one vowel per syllable is allowed. +// Signs -> Khmer has above signs and post signs. Only one above sign and/or one post sign are +// Allowed in a syllable. +// +// +// order is important here! This order must be the same that is found in each horizontal +// line in the statetable for Khmer (see khmerStateTable) . +*/ +enum KhmerCharClassValues { + CC_RESERVED = 0, + CC_CONSONANT = 1, /* Consonant of type 1 or independent vowel */ + CC_CONSONANT2 = 2, /* Consonant of type 2 */ + CC_CONSONANT3 = 3, /* Consonant of type 3 */ + CC_ZERO_WIDTH_NJ_MARK = 4, /* Zero Width non joiner character (0x200C) */ + CC_CONSONANT_SHIFTER = 5, + CC_ROBAT = 6, /* Khmer special diacritic accent -treated differently in state table */ + CC_COENG = 7, /* Subscript consonant combining character */ + CC_DEPENDENT_VOWEL = 8, + CC_SIGN_ABOVE = 9, + CC_SIGN_AFTER = 10, + CC_ZERO_WIDTH_J_MARK = 11, /* Zero width joiner character */ + CC_COUNT = 12 /* This is the number of character classes */ +}; + + +enum KhmerCharClassFlags { + CF_CLASS_MASK = 0x0000FFFF, + + CF_CONSONANT = 0x01000000, /* flag to speed up comparing */ + CF_SPLIT_VOWEL = 0x02000000, /* flag for a split vowel -> the first part is added in front of the syllable */ + CF_DOTTED_CIRCLE = 0x04000000, /* add a dotted circle if a character with this flag is the first in a syllable */ + CF_COENG = 0x08000000, /* flag to speed up comparing */ + CF_SHIFTER = 0x10000000, /* flag to speed up comparing */ + CF_ABOVE_VOWEL = 0x20000000, /* flag to speed up comparing */ + + /* position flags */ + CF_POS_BEFORE = 0x00080000, + CF_POS_BELOW = 0x00040000, + CF_POS_ABOVE = 0x00020000, + CF_POS_AFTER = 0x00010000, + CF_POS_MASK = 0x000f0000 +}; + + +/* Characters that get referred to by name */ +enum KhmerChar { + C_SIGN_ZWNJ = 0x200C, + C_SIGN_ZWJ = 0x200D, + C_RO = 0x179A, + C_VOWEL_AA = 0x17B6, + C_SIGN_NIKAHIT = 0x17C6, + C_VOWEL_E = 0x17C1, + C_COENG = 0x17D2 +}; + + +/* +// simple classes, they are used in the statetable (in this file) to control the length of a syllable +// they are also used to know where a character should be placed (location in reference to the base character) +// and also to know if a character, when independently displayed, should be displayed with a dotted-circle to +// indicate error in syllable construction +*/ +enum { + _xx = CC_RESERVED, + _sa = CC_SIGN_ABOVE | CF_DOTTED_CIRCLE | CF_POS_ABOVE, + _sp = CC_SIGN_AFTER | CF_DOTTED_CIRCLE| CF_POS_AFTER, + _c1 = CC_CONSONANT | CF_CONSONANT, + _c2 = CC_CONSONANT2 | CF_CONSONANT, + _c3 = CC_CONSONANT3 | CF_CONSONANT, + _rb = CC_ROBAT | CF_POS_ABOVE | CF_DOTTED_CIRCLE, + _cs = CC_CONSONANT_SHIFTER | CF_DOTTED_CIRCLE | CF_SHIFTER, + _dl = CC_DEPENDENT_VOWEL | CF_POS_BEFORE | CF_DOTTED_CIRCLE, + _db = CC_DEPENDENT_VOWEL | CF_POS_BELOW | CF_DOTTED_CIRCLE, + _da = CC_DEPENDENT_VOWEL | CF_POS_ABOVE | CF_DOTTED_CIRCLE | CF_ABOVE_VOWEL, + _dr = CC_DEPENDENT_VOWEL | CF_POS_AFTER | CF_DOTTED_CIRCLE, + _co = CC_COENG | CF_COENG | CF_DOTTED_CIRCLE, + + /* split vowel */ + _va = _da | CF_SPLIT_VOWEL, + _vr = _dr | CF_SPLIT_VOWEL +}; + + +/* +// Character class: a character class value +// ORed with character class flags. +*/ +typedef unsigned long KhmerCharClass; + + +/* +// Character class tables +// _xx character does not combine into syllable, such as numbers, puntuation marks, non-Khmer signs... +// _sa Sign placed above the base +// _sp Sign placed after the base +// _c1 Consonant of type 1 or independent vowel (independent vowels behave as type 1 consonants) +// _c2 Consonant of type 2 (only RO) +// _c3 Consonant of type 3 +// _rb Khmer sign robat u17CC. combining mark for subscript consonants +// _cd Consonant-shifter +// _dl Dependent vowel placed before the base (left of the base) +// _db Dependent vowel placed below the base +// _da Dependent vowel placed above the base +// _dr Dependent vowel placed behind the base (right of the base) +// _co Khmer combining mark COENG u17D2, combines with the consonant or independent vowel following +// it to create a subscript consonant or independent vowel +// _va Khmer split vowel in which the first part is before the base and the second one above the base +// _vr Khmer split vowel in which the first part is before the base and the second one behind (right of) the base +*/ +static const KhmerCharClass khmerCharClasses[] = { + _c1, _c1, _c1, _c3, _c1, _c1, _c1, _c1, _c3, _c1, _c1, _c1, _c1, _c3, _c1, _c1, /* 1780 - 178F */ + _c1, _c1, _c1, _c1, _c3, _c1, _c1, _c1, _c1, _c3, _c2, _c1, _c1, _c1, _c3, _c3, /* 1790 - 179F */ + _c1, _c3, _c1, _c1, _c1, _c1, _c1, _c1, _c1, _c1, _c1, _c1, _c1, _c1, _c1, _c1, /* 17A0 - 17AF */ + _c1, _c1, _c1, _c1, _dr, _dr, _dr, _da, _da, _da, _da, _db, _db, _db, _va, _vr, /* 17B0 - 17BF */ + _vr, _dl, _dl, _dl, _vr, _vr, _sa, _sp, _sp, _cs, _cs, _sa, _rb, _sa, _sa, _sa, /* 17C0 - 17CF */ + _sa, _sa, _co, _sa, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _sa, _xx, _xx /* 17D0 - 17DF */ +}; + +/* this enum must reflect the range of khmerCharClasses */ +enum KhmerCharClassesRange { + KhmerFirstChar = 0x1780, + KhmerLastChar = 0x17df +}; + +/* +// Below we define how a character in the input string is either in the khmerCharClasses table +// (in which case we get its type back), a ZWJ or ZWNJ (two characters that may appear +// within the syllable, but are not in the table) we also get their type back, or an unknown object +// in which case we get _xx (CC_RESERVED) back +*/ +static KhmerCharClass getKhmerCharClass(HB_UChar16 uc) +{ + if (uc == C_SIGN_ZWJ) { + return CC_ZERO_WIDTH_J_MARK; + } + + if (uc == C_SIGN_ZWNJ) { + return CC_ZERO_WIDTH_NJ_MARK; + } + + if (uc < KhmerFirstChar || uc > KhmerLastChar) { + return CC_RESERVED; + } + + return khmerCharClasses[uc - KhmerFirstChar]; +} + + +/* +// The stateTable is used to calculate the end (the length) of a well +// formed Khmer Syllable. +// +// Each horizontal line is ordered exactly the same way as the values in KhmerClassTable +// CharClassValues. This coincidence of values allows the follow up of the table. +// +// Each line corresponds to a state, which does not necessarily need to be a type +// of component... for example, state 2 is a base, with is always a first character +// in the syllable, but the state could be produced a consonant of any type when +// it is the first character that is analysed (in ground state). +// +// Differentiating 3 types of consonants is necessary in order to +// forbid the use of certain combinations, such as having a second +// coeng after a coeng RO, +// The inexistent possibility of having a type 3 after another type 3 is permitted, +// eliminating it would very much complicate the table, and it does not create typing +// problems, as the case above. +// +// The table is quite complex, in order to limit the number of coeng consonants +// to 2 (by means of the table). +// +// There a peculiarity, as far as Unicode is concerned: +// - The consonant-shifter is considered in two possible different +// locations, the one considered in Unicode 3.0 and the one considered in +// Unicode 4.0. (there is a backwards compatibility problem in this standard). +// +// +// xx independent character, such as a number, punctuation sign or non-khmer char +// +// c1 Khmer consonant of type 1 or an independent vowel +// that is, a letter in which the subscript for is only under the +// base, not taking any space to the right or to the left +// +// c2 Khmer consonant of type 2, the coeng form takes space under +// and to the left of the base (only RO is of this type) +// +// c3 Khmer consonant of type 3. Its subscript form takes space under +// and to the right of the base. +// +// cs Khmer consonant shifter +// +// rb Khmer robat +// +// co coeng character (u17D2) +// +// dv dependent vowel (including split vowels, they are treated in the same way). +// even if dv is not defined above, the component that is really tested for is +// KhmerClassTable::CC_DEPENDENT_VOWEL, which is common to all dependent vowels +// +// zwj Zero Width joiner +// +// zwnj Zero width non joiner +// +// sa above sign +// +// sp post sign +// +// there are lines with equal content but for an easier understanding +// (and maybe change in the future) we did not join them +*/ +static const signed char khmerStateTable[][CC_COUNT] = +{ + /* xx c1 c2 c3 zwnj cs rb co dv sa sp zwj */ + { 1, 2, 2, 2, 1, 1, 1, 6, 1, 1, 1, 2}, /* 0 - ground state */ + {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 1 - exit state (or sign to the right of the syllable) */ + {-1, -1, -1, -1, 3, 4, 5, 6, 16, 17, 1, -1}, /* 2 - Base consonant */ + {-1, -1, -1, -1, -1, 4, -1, -1, 16, -1, -1, -1}, /* 3 - First ZWNJ before a register shifter It can only be followed by a shifter or a vowel */ + {-1, -1, -1, -1, 15, -1, -1, 6, 16, 17, 1, 14}, /* 4 - First register shifter */ + {-1, -1, -1, -1, -1, -1, -1, -1, 20, -1, 1, -1}, /* 5 - Robat */ + {-1, 7, 8, 9, -1, -1, -1, -1, -1, -1, -1, -1}, /* 6 - First Coeng */ + {-1, -1, -1, -1, 12, 13, -1, 10, 16, 17, 1, 14}, /* 7 - First consonant of type 1 after coeng */ + {-1, -1, -1, -1, 12, 13, -1, -1, 16, 17, 1, 14}, /* 8 - First consonant of type 2 after coeng */ + {-1, -1, -1, -1, 12, 13, -1, 10, 16, 17, 1, 14}, /* 9 - First consonant or type 3 after ceong */ + {-1, 11, 11, 11, -1, -1, -1, -1, -1, -1, -1, -1}, /* 10 - Second Coeng (no register shifter before) */ + {-1, -1, -1, -1, 15, -1, -1, -1, 16, 17, 1, 14}, /* 11 - Second coeng consonant (or ind. vowel) no register shifter before */ + {-1, -1, -1, -1, -1, 13, -1, -1, 16, -1, -1, -1}, /* 12 - Second ZWNJ before a register shifter */ + {-1, -1, -1, -1, 15, -1, -1, -1, 16, 17, 1, 14}, /* 13 - Second register shifter */ + {-1, -1, -1, -1, -1, -1, -1, -1, 16, -1, -1, -1}, /* 14 - ZWJ before vowel */ + {-1, -1, -1, -1, -1, -1, -1, -1, 16, -1, -1, -1}, /* 15 - ZWNJ before vowel */ + {-1, -1, -1, -1, -1, -1, -1, -1, -1, 17, 1, 18}, /* 16 - dependent vowel */ + {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 18}, /* 17 - sign above */ + {-1, -1, -1, -1, -1, -1, -1, 19, -1, -1, -1, -1}, /* 18 - ZWJ after vowel */ + {-1, 1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 19 - Third coeng */ + {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1}, /* 20 - dependent vowel after a Robat */ +}; + + +/* #define KHMER_DEBUG */ +#ifdef KHMER_DEBUG +#define KHDEBUG qDebug +#else +#define KHDEBUG if(0) printf +#endif + +/* +// Given an input string of characters and a location in which to start looking +// calculate, using the state table, which one is the last character of the syllable +// that starts in the starting position. +*/ +static int khmer_nextSyllableBoundary(const HB_UChar16 *s, int start, int end, HB_Bool *invalid) +{ + const HB_UChar16 *uc = s + start; + int state = 0; + int pos = start; + *invalid = FALSE; + + while (pos < end) { + KhmerCharClass charClass = getKhmerCharClass(*uc); + if (pos == start) { + *invalid = (charClass > 0) && ! (charClass & CF_CONSONANT); + } + state = khmerStateTable[state][charClass & CF_CLASS_MASK]; + + KHDEBUG("state[%d]=%d class=%8lx (uc=%4x)", pos - start, state, + charClass, *uc ); + + if (state < 0) { + break; + } + ++uc; + ++pos; + } + return pos; +} + +#ifndef NO_OPENTYPE +static const HB_OpenTypeFeature khmer_features[] = { + { HB_MAKE_TAG( 'p', 'r', 'e', 'f' ), PreFormProperty }, + { HB_MAKE_TAG( 'b', 'l', 'w', 'f' ), BelowFormProperty }, + { HB_MAKE_TAG( 'a', 'b', 'v', 'f' ), AboveFormProperty }, + { HB_MAKE_TAG( 'p', 's', 't', 'f' ), PostFormProperty }, + { HB_MAKE_TAG( 'p', 'r', 'e', 's' ), PreSubstProperty }, + { HB_MAKE_TAG( 'b', 'l', 'w', 's' ), BelowSubstProperty }, + { HB_MAKE_TAG( 'a', 'b', 'v', 's' ), AboveSubstProperty }, + { HB_MAKE_TAG( 'p', 's', 't', 's' ), PostSubstProperty }, + { HB_MAKE_TAG( 'c', 'l', 'i', 'g' ), CligProperty }, + { 0, 0 } +}; +#endif + + +static HB_Bool khmer_shape_syllable(HB_Bool openType, HB_ShaperItem *item) +{ +/* KHDEBUG("syllable from %d len %d, str='%s'", item->from, item->length, + item->string->mid(item->from, item->length).toUtf8().data()); */ + + int len = 0; + int syllableEnd = item->item.pos + item->item.length; + unsigned short reordered[16]; + unsigned char properties[16]; + enum { + AboveForm = 0x01, + PreForm = 0x02, + PostForm = 0x04, + BelowForm = 0x08 + }; +#ifndef NO_OPENTYPE + const int availableGlyphs = item->num_glyphs; +#endif + int coengRo; + int i; + + /* according to the specs this is the max length one can get + ### the real value should be smaller */ + assert(item->item.length < 13); + + memset(properties, 0, 16*sizeof(unsigned char)); + +#ifdef KHMER_DEBUG + qDebug("original:"); + for (int i = from; i < syllableEnd; i++) { + qDebug(" %d: %4x", i, string[i]); + } +#endif + + /* + // write a pre vowel or the pre part of a split vowel first + // and look out for coeng + ro. RO is the only vowel of type 2, and + // therefore the only one that requires saving space before the base. + */ + coengRo = -1; /* There is no Coeng Ro, if found this value will change */ + for (i = item->item.pos; i < syllableEnd; i += 1) { + KhmerCharClass charClass = getKhmerCharClass(item->string[i]); + + /* if a split vowel, write the pre part. In Khmer the pre part + is the same for all split vowels, same glyph as pre vowel C_VOWEL_E */ + if (charClass & CF_SPLIT_VOWEL) { + reordered[len] = C_VOWEL_E; + properties[len] = PreForm; + ++len; + break; /* there can be only one vowel */ + } + /* if a vowel with pos before write it out */ + if (charClass & CF_POS_BEFORE) { + reordered[len] = item->string[i]; + properties[len] = PreForm; + ++len; + break; /* there can be only one vowel */ + } + /* look for coeng + ro and remember position + works because coeng + ro is always in front of a vowel (if there is a vowel) + and because CC_CONSONANT2 is enough to identify it, as it is the only consonant + with this flag */ + if ( (charClass & CF_COENG) && (i + 1 < syllableEnd) && + ( (getKhmerCharClass(item->string[i+1]) & CF_CLASS_MASK) == CC_CONSONANT2) ) { + coengRo = i; + } + } + + /* write coeng + ro if found */ + if (coengRo > -1) { + reordered[len] = C_COENG; + properties[len] = PreForm; + ++len; + reordered[len] = C_RO; + properties[len] = PreForm; + ++len; + } + + /* + shall we add a dotted circle? + If in the position in which the base should be (first char in the string) there is + a character that has the Dotted circle flag (a character that cannot be a base) + then write a dotted circle */ + if (getKhmerCharClass(item->string[item->item.pos]) & CF_DOTTED_CIRCLE) { + reordered[len] = C_DOTTED_CIRCLE; + ++len; + } + + /* copy what is left to the output, skipping before vowels and + coeng Ro if they are present */ + for (i = item->item.pos; i < syllableEnd; i += 1) { + HB_UChar16 uc = item->string[i]; + KhmerCharClass charClass = getKhmerCharClass(uc); + + /* skip a before vowel, it was already processed */ + if (charClass & CF_POS_BEFORE) { + continue; + } + + /* skip coeng + ro, it was already processed */ + if (i == coengRo) { + i += 1; + continue; + } + + switch (charClass & CF_POS_MASK) + { + case CF_POS_ABOVE : + reordered[len] = uc; + properties[len] = AboveForm; + ++len; + break; + + case CF_POS_AFTER : + reordered[len] = uc; + properties[len] = PostForm; + ++len; + break; + + case CF_POS_BELOW : + reordered[len] = uc; + properties[len] = BelowForm; + ++len; + break; + + default: + /* assign the correct flags to a coeng consonant + Consonants of type 3 are taged as Post forms and those type 1 as below forms */ + if ( (charClass & CF_COENG) && i + 1 < syllableEnd ) { + unsigned char property = (getKhmerCharClass(item->string[i+1]) & CF_CLASS_MASK) == CC_CONSONANT3 ? + PostForm : BelowForm; + reordered[len] = uc; + properties[len] = property; + ++len; + i += 1; + reordered[len] = item->string[i]; + properties[len] = property; + ++len; + break; + } + + /* if a shifter is followed by an above vowel change the shifter to below form, + an above vowel can have two possible positions i + 1 or i + 3 + (position i+1 corresponds to unicode 3, position i+3 to Unicode 4) + and there is an extra rule for C_VOWEL_AA + C_SIGN_NIKAHIT also for two + different positions, right after the shifter or after a vowel (Unicode 4) */ + if ( (charClass & CF_SHIFTER) && (i + 1 < syllableEnd) ) { + if (getKhmerCharClass(item->string[i+1]) & CF_ABOVE_VOWEL ) { + reordered[len] = uc; + properties[len] = BelowForm; + ++len; + break; + } + if (i + 2 < syllableEnd && + (item->string[i+1] == C_VOWEL_AA) && + (item->string[i+2] == C_SIGN_NIKAHIT) ) + { + reordered[len] = uc; + properties[len] = BelowForm; + ++len; + break; + } + if (i + 3 < syllableEnd && (getKhmerCharClass(item->string[i+3]) & CF_ABOVE_VOWEL) ) { + reordered[len] = uc; + properties[len] = BelowForm; + ++len; + break; + } + if (i + 4 < syllableEnd && + (item->string[i+3] == C_VOWEL_AA) && + (item->string[i+4] == C_SIGN_NIKAHIT) ) + { + reordered[len] = uc; + properties[len] = BelowForm; + ++len; + break; + } + } + + /* default - any other characters */ + reordered[len] = uc; + ++len; + break; + } /* switch */ + } /* for */ + + if (!item->font->klass->convertStringToGlyphIndices(item->font, + reordered, len, + item->glyphs, &item->num_glyphs, + item->item.bidiLevel % 2)) + return FALSE; + + + KHDEBUG("after shaping: len=%d", len); + for (i = 0; i < len; i++) { + item->attributes[i].mark = FALSE; + item->attributes[i].clusterStart = FALSE; + item->attributes[i].justification = 0; + item->attributes[i].zeroWidth = FALSE; + KHDEBUG(" %d: %4x property=%x", i, reordered[i], properties[i]); + } + + /* now we have the syllable in the right order, and can start running it through open type. */ + +#ifndef NO_OPENTYPE + if (openType) { + hb_uint32 where[16]; + for (i = 0; i < len; ++i) { + where[i] = ~(PreSubstProperty + | BelowSubstProperty + | AboveSubstProperty + | PostSubstProperty + | CligProperty + | PositioningProperties); + if (properties[i] == PreForm) + where[i] &= ~PreFormProperty; + else if (properties[i] == BelowForm) + where[i] &= ~BelowFormProperty; + else if (properties[i] == AboveForm) + where[i] &= ~AboveFormProperty; + else if (properties[i] == PostForm) + where[i] &= ~PostFormProperty; + } + + HB_OpenTypeShape(item, where); + if (!HB_OpenTypePosition(item, availableGlyphs, /*doLogClusters*/FALSE)) + return FALSE; + } else +#endif + { + KHDEBUG("Not using openType"); + HB_HeuristicPosition(item); + } + + item->attributes[0].clusterStart = TRUE; + return TRUE; +} + +HB_Bool HB_KhmerShape(HB_ShaperItem *item) +{ + HB_Bool openType = FALSE; + unsigned short *logClusters = item->log_clusters; + int i; + + HB_ShaperItem syllable = *item; + int first_glyph = 0; + + int sstart = item->item.pos; + int end = sstart + item->item.length; + + assert(item->item.script == HB_Script_Khmer); + +#ifndef NO_OPENTYPE + openType = HB_SelectScript(item, khmer_features); +#endif + + KHDEBUG("khmer_shape: from %d length %d", item->item.pos, item->item.length); + while (sstart < end) { + HB_Bool invalid; + int send = khmer_nextSyllableBoundary(item->string, sstart, end, &invalid); + KHDEBUG("syllable from %d, length %d, invalid=%s", sstart, send-sstart, + invalid ? "TRUE" : "FALSE"); + syllable.item.pos = sstart; + syllable.item.length = send-sstart; + syllable.glyphs = item->glyphs + first_glyph; + syllable.attributes = item->attributes + first_glyph; + syllable.offsets = item->offsets + first_glyph; + syllable.advances = item->advances + first_glyph; + syllable.num_glyphs = item->num_glyphs - first_glyph; + if (!khmer_shape_syllable(openType, &syllable)) { + KHDEBUG("syllable shaping failed, syllable requests %d glyphs", syllable.num_glyphs); + item->num_glyphs += syllable.num_glyphs; + return FALSE; + } + /* fix logcluster array */ + KHDEBUG("syllable:"); + for (i = first_glyph; i < first_glyph + (int)syllable.num_glyphs; ++i) + KHDEBUG(" %d -> glyph %x", i, item->glyphs[i]); + KHDEBUG(" logclusters:"); + for (i = sstart; i < send; ++i) { + KHDEBUG(" %d -> glyph %d", i, first_glyph); + logClusters[i-item->item.pos] = first_glyph; + } + sstart = send; + first_glyph += syllable.num_glyphs; + } + item->num_glyphs = first_glyph; + return TRUE; +} + +void HB_KhmerAttributes(HB_Script script, const HB_UChar16 *text, hb_uint32 from, hb_uint32 len, HB_CharAttributes *attributes) +{ + int end = from + len; + const HB_UChar16 *uc = text + from; + hb_uint32 i = 0; + HB_UNUSED(script); + attributes += from; + while ( i < len ) { + HB_Bool invalid; + hb_uint32 boundary = khmer_nextSyllableBoundary( text, from+i, end, &invalid ) - from; + + attributes[i].charStop = TRUE; + + if ( boundary > len-1 ) boundary = len; + i++; + while ( i < boundary ) { + attributes[i].charStop = FALSE; + ++uc; + ++i; + } + assert( i == boundary ); + } +} + diff --git a/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-myanmar.c b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-myanmar.c new file mode 100644 index 0000000..7cd82bb --- /dev/null +++ b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-myanmar.c @@ -0,0 +1,542 @@ +/* + * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) + * + * This is part of HarfBuzz, an OpenType Layout engine library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#include "harfbuzz-shaper.h" +#include "harfbuzz-shaper-private.h" + +#include +#include + +enum MymrCharClassValues +{ + Mymr_CC_RESERVED = 0, + Mymr_CC_CONSONANT = 1, /* Consonant of type 1, that has subscript form */ + Mymr_CC_CONSONANT2 = 2, /* Consonant of type 2, that has no subscript form */ + Mymr_CC_NGA = 3, /* Consonant NGA */ + Mymr_CC_YA = 4, /* Consonant YA */ + Mymr_CC_RA = 5, /* Consonant RA */ + Mymr_CC_WA = 6, /* Consonant WA */ + Mymr_CC_HA = 7, /* Consonant HA */ + Mymr_CC_IND_VOWEL = 8, /* Independent vowel */ + Mymr_CC_ZERO_WIDTH_NJ_MARK = 9, /* Zero Width non joiner character (0x200C) */ + Mymr_CC_VIRAMA = 10, /* Subscript consonant combining character */ + Mymr_CC_PRE_VOWEL = 11, /* Dependent vowel, prebase (Vowel e) */ + Mymr_CC_BELOW_VOWEL = 12, /* Dependent vowel, prebase (Vowel u, uu) */ + Mymr_CC_ABOVE_VOWEL = 13, /* Dependent vowel, prebase (Vowel i, ii, ai) */ + Mymr_CC_POST_VOWEL = 14, /* Dependent vowel, prebase (Vowel aa) */ + Mymr_CC_SIGN_ABOVE = 15, + Mymr_CC_SIGN_BELOW = 16, + Mymr_CC_SIGN_AFTER = 17, + Mymr_CC_ZERO_WIDTH_J_MARK = 18, /* Zero width joiner character */ + Mymr_CC_COUNT = 19 /* This is the number of character classes */ +}; + +enum MymrCharClassFlags +{ + Mymr_CF_CLASS_MASK = 0x0000FFFF, + + Mymr_CF_CONSONANT = 0x01000000, /* flag to speed up comparing */ + Mymr_CF_MEDIAL = 0x02000000, /* flag to speed up comparing */ + Mymr_CF_IND_VOWEL = 0x04000000, /* flag to speed up comparing */ + Mymr_CF_DEP_VOWEL = 0x08000000, /* flag to speed up comparing */ + Mymr_CF_DOTTED_CIRCLE = 0x10000000, /* add a dotted circle if a character with this flag is the first in a syllable */ + Mymr_CF_VIRAMA = 0x20000000, /* flag to speed up comparing */ + + /* position flags */ + Mymr_CF_POS_BEFORE = 0x00080000, + Mymr_CF_POS_BELOW = 0x00040000, + Mymr_CF_POS_ABOVE = 0x00020000, + Mymr_CF_POS_AFTER = 0x00010000, + Mymr_CF_POS_MASK = 0x000f0000, + + Mymr_CF_AFTER_KINZI = 0x00100000 +}; + +/* Characters that get refrered to by name */ +enum MymrChar +{ + Mymr_C_SIGN_ZWNJ = 0x200C, + Mymr_C_SIGN_ZWJ = 0x200D, + Mymr_C_DOTTED_CIRCLE = 0x25CC, + Mymr_C_RA = 0x101B, + Mymr_C_YA = 0x101A, + Mymr_C_NGA = 0x1004, + Mymr_C_VOWEL_E = 0x1031, + Mymr_C_VIRAMA = 0x1039 +}; + +enum +{ + Mymr_xx = Mymr_CC_RESERVED, + Mymr_c1 = Mymr_CC_CONSONANT | Mymr_CF_CONSONANT | Mymr_CF_POS_BELOW, + Mymr_c2 = Mymr_CC_CONSONANT2 | Mymr_CF_CONSONANT, + Mymr_ng = Mymr_CC_NGA | Mymr_CF_CONSONANT | Mymr_CF_POS_ABOVE, + Mymr_ya = Mymr_CC_YA | Mymr_CF_CONSONANT | Mymr_CF_MEDIAL | Mymr_CF_POS_AFTER | Mymr_CF_AFTER_KINZI, + Mymr_ra = Mymr_CC_RA | Mymr_CF_CONSONANT | Mymr_CF_MEDIAL | Mymr_CF_POS_BEFORE, + Mymr_wa = Mymr_CC_WA | Mymr_CF_CONSONANT | Mymr_CF_MEDIAL | Mymr_CF_POS_BELOW, + Mymr_ha = Mymr_CC_HA | Mymr_CF_CONSONANT | Mymr_CF_MEDIAL | Mymr_CF_POS_BELOW, + Mymr_id = Mymr_CC_IND_VOWEL | Mymr_CF_IND_VOWEL, + Mymr_vi = Mymr_CC_VIRAMA | Mymr_CF_VIRAMA | Mymr_CF_POS_ABOVE | Mymr_CF_DOTTED_CIRCLE, + Mymr_dl = Mymr_CC_PRE_VOWEL | Mymr_CF_DEP_VOWEL | Mymr_CF_POS_BEFORE | Mymr_CF_DOTTED_CIRCLE | Mymr_CF_AFTER_KINZI, + Mymr_db = Mymr_CC_BELOW_VOWEL | Mymr_CF_DEP_VOWEL | Mymr_CF_POS_BELOW | Mymr_CF_DOTTED_CIRCLE | Mymr_CF_AFTER_KINZI, + Mymr_da = Mymr_CC_ABOVE_VOWEL | Mymr_CF_DEP_VOWEL | Mymr_CF_POS_ABOVE | Mymr_CF_DOTTED_CIRCLE | Mymr_CF_AFTER_KINZI, + Mymr_dr = Mymr_CC_POST_VOWEL | Mymr_CF_DEP_VOWEL | Mymr_CF_POS_AFTER | Mymr_CF_DOTTED_CIRCLE | Mymr_CF_AFTER_KINZI, + Mymr_sa = Mymr_CC_SIGN_ABOVE | Mymr_CF_DOTTED_CIRCLE | Mymr_CF_POS_ABOVE | Mymr_CF_AFTER_KINZI, + Mymr_sb = Mymr_CC_SIGN_BELOW | Mymr_CF_DOTTED_CIRCLE | Mymr_CF_POS_BELOW | Mymr_CF_AFTER_KINZI, + Mymr_sp = Mymr_CC_SIGN_AFTER | Mymr_CF_DOTTED_CIRCLE | Mymr_CF_AFTER_KINZI +}; + + +typedef int MymrCharClass; + + +static const MymrCharClass mymrCharClasses[] = +{ + Mymr_c1, Mymr_c1, Mymr_c1, Mymr_c1, Mymr_ng, Mymr_c1, Mymr_c1, Mymr_c1, + Mymr_c1, Mymr_c1, Mymr_c2, Mymr_c1, Mymr_c1, Mymr_c1, Mymr_c1, Mymr_c1, /* 1000 - 100F */ + Mymr_c1, Mymr_c1, Mymr_c1, Mymr_c1, Mymr_c1, Mymr_c1, Mymr_c1, Mymr_c1, + Mymr_c1, Mymr_c1, Mymr_ya, Mymr_ra, Mymr_c1, Mymr_wa, Mymr_c1, Mymr_ha, /* 1010 - 101F */ + Mymr_c2, Mymr_c2, Mymr_xx, Mymr_id, Mymr_id, Mymr_id, Mymr_id, Mymr_id, + Mymr_xx, Mymr_id, Mymr_id, Mymr_xx, Mymr_dr, Mymr_da, Mymr_da, Mymr_db, /* 1020 - 102F */ + Mymr_db, Mymr_dl, Mymr_da, Mymr_xx, Mymr_xx, Mymr_xx, Mymr_sa, Mymr_sb, + Mymr_sp, Mymr_vi, Mymr_xx, Mymr_xx, Mymr_xx, Mymr_xx, Mymr_xx, Mymr_xx, /* 1030 - 103F */ + Mymr_xx, Mymr_xx, Mymr_xx, Mymr_xx, Mymr_xx, Mymr_xx, Mymr_xx, Mymr_xx, + Mymr_xx, Mymr_xx, Mymr_xx, Mymr_xx, Mymr_xx, Mymr_xx, Mymr_xx, Mymr_xx, /* 1040 - 104F */ + Mymr_xx, Mymr_xx, Mymr_xx, Mymr_xx, Mymr_xx, Mymr_xx, Mymr_xx, Mymr_xx, + Mymr_xx, Mymr_xx, Mymr_xx, Mymr_xx, Mymr_xx, Mymr_xx, Mymr_xx, Mymr_xx, /* 1050 - 105F */ +}; + +static MymrCharClass +getMyanmarCharClass (HB_UChar16 ch) +{ + if (ch == Mymr_C_SIGN_ZWJ) + return Mymr_CC_ZERO_WIDTH_J_MARK; + + if (ch == Mymr_C_SIGN_ZWNJ) + return Mymr_CC_ZERO_WIDTH_NJ_MARK; + + if (ch < 0x1000 || ch > 0x105f) + return Mymr_CC_RESERVED; + + return mymrCharClasses[ch - 0x1000]; +} + +static const signed char mymrStateTable[][Mymr_CC_COUNT] = +{ +/* xx c1, c2 ng ya ra wa ha id zwnj vi dl db da dr sa sb sp zwj */ + { 1, 4, 4, 2, 4, 4, 4, 4, 24, 1, 27, 17, 18, 19, 20, 21, 1, 1, 4}, /* 0 - ground state */ + {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 1 - exit state (or sp to the right of the syllable) */ + {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, 17, 18, 19, 20, 21, -1, -1, 4}, /* 2 - NGA */ + {-1, 4, 4, 4, 4, 4, 4, 4, -1, 23, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 3 - Virama after NGA */ + {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 5, 17, 18, 19, 20, 21, 1, 1, -1}, /* 4 - Base consonant */ + {-2, 6, -2, -2, 7, 8, 9, 10, -2, 23, -2, -2, -2, -2, -2, -2, -2, -2, -2}, /* 5 - First virama */ + {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 25, 17, 18, 19, 20, 21, -1, -1, -1}, /* 6 - c1 after virama */ + {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 12, 17, 18, 19, 20, 21, -1, -1, -1}, /* 7 - ya after virama */ + {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 12, 17, 18, 19, 20, 21, -1, -1, -1}, /* 8 - ra after virama */ + {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 12, 17, 18, 19, 20, 21, -1, -1, -1}, /* 9 - wa after virama */ + {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 17, 18, 19, 20, 21, -1, -1, -1}, /* 10 - ha after virama */ + {-1, -1, -1, -1, 7, 8, 9, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 11 - Virama after NGA+zwj */ + {-2, -2, -2, -2, -2, -2, 13, 14, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2}, /* 12 - Second virama */ + {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 15, 17, 18, 19, 20, 21, -1, -1, -1}, /* 13 - wa after virama */ + {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 17, 18, 19, 20, 21, -1, -1, -1}, /* 14 - ha after virama */ + {-2, -2, -2, -2, -2, -2, -2, 16, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2}, /* 15 - Third virama */ + {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 17, 18, 19, 20, 21, -1, -1, -1}, /* 16 - ha after virama */ + {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 20, 21, 1, 1, -1}, /* 17 - dl, Dependent vowel e */ + {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 19, -1, 21, 1, 1, -1}, /* 18 - db, Dependent vowel u,uu */ + {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1, -1}, /* 19 - da, Dependent vowel i,ii,ai */ + {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 22, -1, -1, -1, -1, -1, 1, 1, -1}, /* 20 - dr, Dependent vowel aa */ + {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, -1}, /* 21 - sa, Sign anusvara */ + {-1, -1, -1, -1, -1, -1, -1, -1, -1, 23, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 22 - atha */ + {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, -1}, /* 23 - zwnj for atha */ + {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1}, /* 24 - Independent vowel */ + {-2, -2, -2, -2, 26, 26, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2}, /* 25 - Virama after subscript consonant */ + {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 12, 17, 18, 19, 20, 21, -1, 1, -1}, /* 26 - ra/ya after subscript consonant + virama */ + {-1, 6, -1, -1, 7, 8, 9, 10, -1, 23, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 - Virama after ground state */ +/* exit state -2 is for invalid order of medials and combination of invalids + with virama where virama should treat as start of next syllable + */ +}; + + + +/*#define MYANMAR_DEBUG */ +#ifdef MYANMAR_DEBUG +#define MMDEBUG qDebug +#else +#define MMDEBUG if(0) printf +#endif + +/* +// Given an input string of characters and a location in which to start looking +// calculate, using the state table, which one is the last character of the syllable +// that starts in the starting position. +*/ +static int myanmar_nextSyllableBoundary(const HB_UChar16 *s, int start, int end, HB_Bool *invalid) +{ + const HB_UChar16 *uc = s + start; + int state = 0; + int pos = start; + *invalid = FALSE; + + while (pos < end) { + MymrCharClass charClass = getMyanmarCharClass(*uc); + state = mymrStateTable[state][charClass & Mymr_CF_CLASS_MASK]; + if (pos == start) + *invalid = (HB_Bool)(charClass & Mymr_CF_DOTTED_CIRCLE); + + MMDEBUG("state[%d]=%d class=%8x (uc=%4x)", pos - start, state, charClass, *uc); + + if (state < 0) { + if (state < -1) + --pos; + break; + } + ++uc; + ++pos; + } + return pos; +} + +#ifndef NO_OPENTYPE +/* ###### might have to change order of above and below forms and substitutions, + but according to Unicode below comes before above */ +static const HB_OpenTypeFeature myanmar_features[] = { + { HB_MAKE_TAG('p', 'r', 'e', 'f'), PreFormProperty }, + { HB_MAKE_TAG('b', 'l', 'w', 'f'), BelowFormProperty }, + { HB_MAKE_TAG('a', 'b', 'v', 'f'), AboveFormProperty }, + { HB_MAKE_TAG('p', 's', 't', 'f'), PostFormProperty }, + { HB_MAKE_TAG('p', 'r', 'e', 's'), PreSubstProperty }, + { HB_MAKE_TAG('b', 'l', 'w', 's'), BelowSubstProperty }, + { HB_MAKE_TAG('a', 'b', 'v', 's'), AboveSubstProperty }, + { HB_MAKE_TAG('p', 's', 't', 's'), PostSubstProperty }, + { HB_MAKE_TAG('r', 'l', 'i', 'g'), CligProperty }, /* Myanmar1 uses this instead of the other features */ + { 0, 0 } +}; +#endif + + +/* +// Visual order before shaping should be: +// +// [Vowel Mark E] +// [Virama + Medial Ra] +// [Base] +// [Virama + Consonant] +// [Nga + Virama] (Kinzi) ### should probably come before post forms (medial ya) +// [Vowels] +// [Marks] +// +// This means that we can keep the logical order apart from having to +// move the pre vowel, medial ra and kinzi +*/ + +static HB_Bool myanmar_shape_syllable(HB_Bool openType, HB_ShaperItem *item, HB_Bool invalid) +{ + /* +// MMDEBUG("\nsyllable from %d len %d, str='%s'", item->item.pos, item->item.length, +// item->string->mid(item->from, item->length).toUtf8().data()); + */ + +#ifndef NO_OPENTYPE + const int availableGlyphs = item->num_glyphs; +#endif + const HB_UChar16 *uc = item->string + item->item.pos; + int vowel_e = -1; + int kinzi = -1; + int medial_ra = -1; + int base = -1; + int i; + int len = 0; + unsigned short reordered[32]; + unsigned char properties[32]; + enum { + AboveForm = 0x01, + PreForm = 0x02, + PostForm = 0x04, + BelowForm = 0x08 + }; + HB_Bool lastWasVirama = FALSE; + int basePos = -1; + + memset(properties, 0, 32*sizeof(unsigned char)); + + /* according to the table the max length of a syllable should be around 14 chars */ + assert(item->item.length < 32); + +#ifdef MYANMAR_DEBUG + printf("original:"); + for (i = 0; i < (int)item->item.length; i++) { + printf(" %d: %4x", i, uc[i]); + } +#endif + for (i = 0; i < (int)item->item.length; ++i) { + HB_UChar16 chr = uc[i]; + + if (chr == Mymr_C_VOWEL_E) { + vowel_e = i; + continue; + } + if (i == 0 + && chr == Mymr_C_NGA + && i + 2 < (int)item->item.length + && uc[i+1] == Mymr_C_VIRAMA) { + int mc = getMyanmarCharClass(uc[i+2]); + /*MMDEBUG("maybe kinzi: mc=%x", mc);*/ + if ((mc & Mymr_CF_CONSONANT) == Mymr_CF_CONSONANT) { + kinzi = i; + continue; + } + } + if (base >= 0 + && chr == Mymr_C_VIRAMA + && i + 1 < (int)item->item.length + && uc[i+1] == Mymr_C_RA) { + medial_ra = i; + continue; + } + if (base < 0) + base = i; + } + + MMDEBUG("\n base=%d, vowel_e=%d, kinzi=%d, medial_ra=%d", base, vowel_e, kinzi, medial_ra); + /* write vowel_e if found */ + if (vowel_e >= 0) { + reordered[0] = Mymr_C_VOWEL_E; + len = 1; + } + /* write medial_ra */ + if (medial_ra >= 0) { + reordered[len] = Mymr_C_VIRAMA; + reordered[len+1] = Mymr_C_RA; + properties[len] = PreForm; + properties[len+1] = PreForm; + len += 2; + } + + /* shall we add a dotted circle? + If in the position in which the base should be (first char in the string) there is + a character that has the Dotted circle flag (a character that cannot be a base) + then write a dotted circle */ + if (invalid) { + reordered[len] = C_DOTTED_CIRCLE; + ++len; + } + + /* copy the rest of the syllable to the output, inserting the kinzi + at the correct place */ + for (i = 0; i < (int)item->item.length; ++i) { + hb_uint16 chr = uc[i]; + MymrCharClass cc; + if (i == vowel_e) + continue; + if (i == medial_ra || i == kinzi) { + ++i; + continue; + } + + cc = getMyanmarCharClass(uc[i]); + if (kinzi >= 0 && i > base && (cc & Mymr_CF_AFTER_KINZI)) { + reordered[len] = Mymr_C_NGA; + reordered[len+1] = Mymr_C_VIRAMA; + properties[len-1] = AboveForm; + properties[len] = AboveForm; + len += 2; + kinzi = -1; + } + + if (lastWasVirama) { + int prop = 0; + switch(cc & Mymr_CF_POS_MASK) { + case Mymr_CF_POS_BEFORE: + prop = PreForm; + break; + case Mymr_CF_POS_BELOW: + prop = BelowForm; + break; + case Mymr_CF_POS_ABOVE: + prop = AboveForm; + break; + case Mymr_CF_POS_AFTER: + prop = PostForm; + break; + default: + break; + } + properties[len-1] = prop; + properties[len] = prop; + if(basePos >= 0 && basePos == len-2) + properties[len-2] = prop; + } + lastWasVirama = (chr == Mymr_C_VIRAMA); + if(i == base) + basePos = len; + + if ((chr != Mymr_C_SIGN_ZWNJ && chr != Mymr_C_SIGN_ZWJ) || !len) { + reordered[len] = chr; + ++len; + } + } + if (kinzi >= 0) { + reordered[len] = Mymr_C_NGA; + reordered[len+1] = Mymr_C_VIRAMA; + properties[len] = AboveForm; + properties[len+1] = AboveForm; + len += 2; + } + + if (!item->font->klass->convertStringToGlyphIndices(item->font, + reordered, len, + item->glyphs, &item->num_glyphs, + item->item.bidiLevel % 2)) + return FALSE; + + MMDEBUG("after shaping: len=%d", len); + for (i = 0; i < len; i++) { + item->attributes[i].mark = FALSE; + item->attributes[i].clusterStart = FALSE; + item->attributes[i].justification = 0; + item->attributes[i].zeroWidth = FALSE; + MMDEBUG(" %d: %4x property=%x", i, reordered[i], properties[i]); + } + + /* now we have the syllable in the right order, and can start running it through open type. */ + +#ifndef NO_OPENTYPE + if (openType) { + unsigned short logClusters[32]; + hb_uint32 where[32]; + + for (i = 0; i < len; ++i) + logClusters[i] = i; + + for (i = 0; i < len; ++i) { + where[i] = ~(PreSubstProperty + | BelowSubstProperty + | AboveSubstProperty + | PostSubstProperty + | CligProperty + | PositioningProperties); + if (properties[i] & PreForm) + where[i] &= ~PreFormProperty; + if (properties[i] & BelowForm) + where[i] &= ~BelowFormProperty; + if (properties[i] & AboveForm) + where[i] &= ~AboveFormProperty; + if (properties[i] & PostForm) + where[i] &= ~PostFormProperty; + } + + HB_OpenTypeShape(item, where); + if (!HB_OpenTypePosition(item, availableGlyphs, /*doLogClusters*/FALSE)) + return FALSE; + } else +#endif + { + MMDEBUG("Not using openType"); + HB_HeuristicPosition(item); + } + + item->attributes[0].clusterStart = TRUE; + return TRUE; +} + +HB_Bool HB_MyanmarShape(HB_ShaperItem *item) +{ + HB_Bool openType = FALSE; + unsigned short *logClusters = item->log_clusters; + + HB_ShaperItem syllable = *item; + int first_glyph = 0; + + int sstart = item->item.pos; + int end = sstart + item->item.length; + int i = 0; + + assert(item->item.script == HB_Script_Myanmar); +#ifndef NO_OPENTYPE + openType = HB_SelectScript(item, myanmar_features); +#endif + + MMDEBUG("myanmar_shape: from %d length %d", item->item.pos, item->item.length); + while (sstart < end) { + HB_Bool invalid; + int send = myanmar_nextSyllableBoundary(item->string, sstart, end, &invalid); + MMDEBUG("syllable from %d, length %d, invalid=%s", sstart, send-sstart, + invalid ? "TRUE" : "FALSE"); + syllable.item.pos = sstart; + syllable.item.length = send-sstart; + syllable.glyphs = item->glyphs + first_glyph; + syllable.attributes = item->attributes + first_glyph; + syllable.advances = item->advances + first_glyph; + syllable.offsets = item->offsets + first_glyph; + syllable.num_glyphs = item->num_glyphs - first_glyph; + if (!myanmar_shape_syllable(openType, &syllable, invalid)) { + MMDEBUG("syllable shaping failed, syllable requests %d glyphs", syllable.num_glyphs); + item->num_glyphs += syllable.num_glyphs; + return FALSE; + } + + /* fix logcluster array */ + MMDEBUG("syllable:"); + for (i = first_glyph; i < first_glyph + (int)syllable.num_glyphs; ++i) + MMDEBUG(" %d -> glyph %x", i, item->glyphs[i]); + MMDEBUG(" logclusters:"); + for (i = sstart; i < send; ++i) { + MMDEBUG(" %d -> glyph %d", i, first_glyph); + logClusters[i-item->item.pos] = first_glyph; + } + sstart = send; + first_glyph += syllable.num_glyphs; + } + item->num_glyphs = first_glyph; + return TRUE; +} + +void HB_MyanmarAttributes(HB_Script script, const HB_UChar16 *text, hb_uint32 from, hb_uint32 len, HB_CharAttributes *attributes) +{ + int end = from + len; + const HB_UChar16 *uc = text + from; + hb_uint32 i = 0; + HB_UNUSED(script); + attributes += from; + while (i < len) { + HB_Bool invalid; + hb_uint32 boundary = myanmar_nextSyllableBoundary(text, from+i, end, &invalid) - from; + + attributes[i].charStop = TRUE; + if (i) + attributes[i-1].lineBreakType = HB_Break; + + if (boundary > len-1) + boundary = len; + i++; + while (i < boundary) { + attributes[i].charStop = FALSE; + ++uc; + ++i; + } + assert(i == boundary); + } +} + diff --git a/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-open-private.h b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-open-private.h new file mode 100644 index 0000000..f1ca278 --- /dev/null +++ b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-open-private.h @@ -0,0 +1,102 @@ +/* + * Copyright (C) 1998-2004 David Turner and Werner Lemberg + * Copyright (C) 2006 Behdad Esfahbod + * + * This is part of HarfBuzz, an OpenType Layout engine library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#ifndef HARFBUZZ_OPEN_PRIVATE_H +#define HARFBUZZ_OPEN_PRIVATE_H + +#include "harfbuzz-impl.h" +#include "harfbuzz-open.h" +#include "harfbuzz-gsub-private.h" +#include "harfbuzz-gpos-private.h" + +HB_BEGIN_HEADER + + +struct HB_SubTable_ +{ + union + { + HB_GSUB_SubTable gsub; + HB_GPOS_SubTable gpos; + } st; +}; + + +HB_INTERNAL HB_Error +_HB_OPEN_Load_ScriptList( HB_ScriptList* sl, + HB_Stream input ); +HB_INTERNAL HB_Error +_HB_OPEN_Load_FeatureList( HB_FeatureList* fl, + HB_Stream input ); +HB_INTERNAL HB_Error +_HB_OPEN_Load_LookupList( HB_LookupList* ll, + HB_Stream input, + HB_Type type ); + +HB_INTERNAL HB_Error +_HB_OPEN_Load_Coverage( HB_Coverage* c, + HB_Stream input ); +HB_INTERNAL HB_Error +_HB_OPEN_Load_ClassDefinition( HB_ClassDefinition* cd, + HB_UShort limit, + HB_Stream input ); +HB_INTERNAL HB_Error +_HB_OPEN_Load_EmptyOrClassDefinition( HB_ClassDefinition* cd, + HB_UShort limit, + HB_UInt class_offset, + HB_UInt base_offset, + HB_Stream input ); +HB_INTERNAL HB_Error +_HB_OPEN_Load_Device( HB_Device** d, + HB_Stream input ); + +HB_INTERNAL void _HB_OPEN_Free_ScriptList( HB_ScriptList* sl ); +HB_INTERNAL void _HB_OPEN_Free_FeatureList( HB_FeatureList* fl ); +HB_INTERNAL void _HB_OPEN_Free_LookupList( HB_LookupList* ll, + HB_Type type ); + +HB_INTERNAL void _HB_OPEN_Free_Coverage( HB_Coverage* c ); +HB_INTERNAL void _HB_OPEN_Free_ClassDefinition( HB_ClassDefinition* cd ); +HB_INTERNAL void _HB_OPEN_Free_Device( HB_Device* d ); + + + +HB_INTERNAL HB_Error +_HB_OPEN_Coverage_Index( HB_Coverage* c, + HB_UShort glyphID, + HB_UShort* index ); +HB_INTERNAL HB_Error +_HB_OPEN_Get_Class( HB_ClassDefinition* cd, + HB_UShort glyphID, + HB_UShort* klass, + HB_UShort* index ); +HB_INTERNAL HB_Error +_HB_OPEN_Get_Device( HB_Device* d, + HB_UShort size, + HB_Short* value ); + +HB_END_HEADER + +#endif /* HARFBUZZ_OPEN_PRIVATE_H */ diff --git a/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-open.c b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-open.c new file mode 100644 index 0000000..f12f5b7 --- /dev/null +++ b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-open.c @@ -0,0 +1,1433 @@ +/* + * Copyright (C) 1998-2004 David Turner and Werner Lemberg + * Copyright (C) 2006 Behdad Esfahbod + * + * This is part of HarfBuzz, an OpenType Layout engine library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#include "harfbuzz-impl.h" +#include "harfbuzz-open-private.h" + + +/*************************** + * Script related functions + ***************************/ + + +/* LangSys */ + +static HB_Error Load_LangSys( HB_LangSys* ls, + HB_Stream stream ) +{ + HB_Error error; + HB_UShort n, count; + HB_UShort* fi; + + + if ( ACCESS_Frame( 6L ) ) + return error; + + ls->LookupOrderOffset = GET_UShort(); /* should be 0 */ + ls->ReqFeatureIndex = GET_UShort(); + count = ls->FeatureCount = GET_UShort(); + + FORGET_Frame(); + + ls->FeatureIndex = NULL; + + if ( ALLOC_ARRAY( ls->FeatureIndex, count, HB_UShort ) ) + return error; + + if ( ACCESS_Frame( count * 2L ) ) + { + FREE( ls->FeatureIndex ); + return error; + } + + fi = ls->FeatureIndex; + + for ( n = 0; n < count; n++ ) + fi[n] = GET_UShort(); + + FORGET_Frame(); + + return HB_Err_Ok; +} + + +static void Free_LangSys( HB_LangSys* ls ) +{ + FREE( ls->FeatureIndex ); +} + + +/* Script */ + +static HB_Error Load_Script( HB_ScriptTable* s, + HB_Stream stream ) +{ + HB_Error error; + HB_UShort n, m, count; + HB_UInt cur_offset, new_offset, base_offset; + + HB_LangSysRecord* lsr; + + + base_offset = FILE_Pos(); + + if ( ACCESS_Frame( 2L ) ) + return error; + + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + if ( new_offset != base_offset ) /* not a NULL offset */ + { + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = Load_LangSys( &s->DefaultLangSys, + stream ) ) != HB_Err_Ok ) + return error; + (void)FILE_Seek( cur_offset ); + } + else + { + /* we create a DefaultLangSys table with no entries */ + + s->DefaultLangSys.LookupOrderOffset = 0; + s->DefaultLangSys.ReqFeatureIndex = 0xFFFF; + s->DefaultLangSys.FeatureCount = 0; + s->DefaultLangSys.FeatureIndex = NULL; + } + + if ( ACCESS_Frame( 2L ) ) + goto Fail2; + + count = s->LangSysCount = GET_UShort(); + + /* safety check; otherwise the official handling of TrueType Open + fonts won't work */ + + if ( s->LangSysCount == 0 && s->DefaultLangSys.FeatureCount == 0 ) + { + error = HB_Err_Not_Covered; + goto Fail2; + } + + FORGET_Frame(); + + s->LangSysRecord = NULL; + + if ( ALLOC_ARRAY( s->LangSysRecord, count, HB_LangSysRecord ) ) + goto Fail2; + + lsr = s->LangSysRecord; + + for ( n = 0; n < count; n++ ) + { + if ( ACCESS_Frame( 6L ) ) + goto Fail1; + + lsr[n].LangSysTag = GET_ULong(); + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = Load_LangSys( &lsr[n].LangSys, stream ) ) != HB_Err_Ok ) + goto Fail1; + (void)FILE_Seek( cur_offset ); + } + + return HB_Err_Ok; + +Fail1: + for ( m = 0; m < n; m++ ) + Free_LangSys( &lsr[m].LangSys ); + + FREE( s->LangSysRecord ); + +Fail2: + Free_LangSys( &s->DefaultLangSys ); + return error; +} + + +static void Free_Script( HB_ScriptTable* s ) +{ + HB_UShort n, count; + + HB_LangSysRecord* lsr; + + + Free_LangSys( &s->DefaultLangSys ); + + if ( s->LangSysRecord ) + { + count = s->LangSysCount; + lsr = s->LangSysRecord; + + for ( n = 0; n < count; n++ ) + Free_LangSys( &lsr[n].LangSys ); + + FREE( lsr ); + } +} + + +/* ScriptList */ + +HB_INTERNAL HB_Error +_HB_OPEN_Load_ScriptList( HB_ScriptList* sl, + HB_Stream stream ) +{ + HB_Error error; + + HB_UShort n, script_count; + HB_UInt cur_offset, new_offset, base_offset; + + HB_ScriptRecord* sr; + + + base_offset = FILE_Pos(); + + if ( ACCESS_Frame( 2L ) ) + return error; + + script_count = GET_UShort(); + + FORGET_Frame(); + + sl->ScriptRecord = NULL; + + if ( ALLOC_ARRAY( sl->ScriptRecord, script_count, HB_ScriptRecord ) ) + return error; + + sr = sl->ScriptRecord; + + sl->ScriptCount= 0; + for ( n = 0; n < script_count; n++ ) + { + if ( ACCESS_Frame( 6L ) ) + goto Fail; + + sr[sl->ScriptCount].ScriptTag = GET_ULong(); + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + + if ( FILE_Seek( new_offset ) ) + goto Fail; + + error = Load_Script( &sr[sl->ScriptCount].Script, stream ); + if ( error == HB_Err_Ok ) + sl->ScriptCount += 1; + else if ( error != HB_Err_Not_Covered ) + goto Fail; + + (void)FILE_Seek( cur_offset ); + } + + /* Empty tables are harmless and generated by fontforge. + * See http://bugzilla.gnome.org/show_bug.cgi?id=347073 + */ +#if 0 + if ( sl->ScriptCount == 0 ) + { + error = ERR(HB_Err_Invalid_SubTable); + goto Fail; + } +#endif + + return HB_Err_Ok; + +Fail: + for ( n = 0; n < sl->ScriptCount; n++ ) + Free_Script( &sr[n].Script ); + + FREE( sl->ScriptRecord ); + return error; +} + + +HB_INTERNAL void +_HB_OPEN_Free_ScriptList( HB_ScriptList* sl ) +{ + HB_UShort n, count; + + HB_ScriptRecord* sr; + + + if ( sl->ScriptRecord ) + { + count = sl->ScriptCount; + sr = sl->ScriptRecord; + + for ( n = 0; n < count; n++ ) + Free_Script( &sr[n].Script ); + + FREE( sr ); + } +} + + + +/********************************* + * Feature List related functions + *********************************/ + + +/* Feature */ + +static HB_Error Load_Feature( HB_Feature* f, + HB_Stream stream ) +{ + HB_Error error; + + HB_UShort n, count; + + HB_UShort* lli; + + + if ( ACCESS_Frame( 4L ) ) + return error; + + f->FeatureParams = GET_UShort(); /* should be 0 */ + count = f->LookupListCount = GET_UShort(); + + FORGET_Frame(); + + f->LookupListIndex = NULL; + + if ( ALLOC_ARRAY( f->LookupListIndex, count, HB_UShort ) ) + return error; + + lli = f->LookupListIndex; + + if ( ACCESS_Frame( count * 2L ) ) + { + FREE( f->LookupListIndex ); + return error; + } + + for ( n = 0; n < count; n++ ) + lli[n] = GET_UShort(); + + FORGET_Frame(); + + return HB_Err_Ok; +} + + +static void Free_Feature( HB_Feature* f ) +{ + FREE( f->LookupListIndex ); +} + + +/* FeatureList */ + +HB_INTERNAL HB_Error +_HB_OPEN_Load_FeatureList( HB_FeatureList* fl, + HB_Stream stream ) +{ + HB_Error error; + + HB_UShort n, m, count; + HB_UInt cur_offset, new_offset, base_offset; + + HB_FeatureRecord* fr; + + + base_offset = FILE_Pos(); + + if ( ACCESS_Frame( 2L ) ) + return error; + + count = fl->FeatureCount = GET_UShort(); + + FORGET_Frame(); + + fl->FeatureRecord = NULL; + + if ( ALLOC_ARRAY( fl->FeatureRecord, count, HB_FeatureRecord ) ) + return error; + if ( ALLOC_ARRAY( fl->ApplyOrder, count, HB_UShort ) ) + goto Fail2; + + fl->ApplyCount = 0; + + fr = fl->FeatureRecord; + + for ( n = 0; n < count; n++ ) + { + if ( ACCESS_Frame( 6L ) ) + goto Fail1; + + fr[n].FeatureTag = GET_ULong(); + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = Load_Feature( &fr[n].Feature, stream ) ) != HB_Err_Ok ) + goto Fail1; + (void)FILE_Seek( cur_offset ); + } + + return HB_Err_Ok; + +Fail1: + for ( m = 0; m < n; m++ ) + Free_Feature( &fr[m].Feature ); + + FREE( fl->ApplyOrder ); + +Fail2: + FREE( fl->FeatureRecord ); + + return error; +} + + +HB_INTERNAL void +_HB_OPEN_Free_FeatureList( HB_FeatureList* fl ) +{ + HB_UShort n, count; + + HB_FeatureRecord* fr; + + + if ( fl->FeatureRecord ) + { + count = fl->FeatureCount; + fr = fl->FeatureRecord; + + for ( n = 0; n < count; n++ ) + Free_Feature( &fr[n].Feature ); + + FREE( fr ); + } + + FREE( fl->ApplyOrder ); +} + + + +/******************************** + * Lookup List related functions + ********************************/ + +/* the subroutines of the following two functions are defined in + ftxgsub.c and ftxgpos.c respectively */ + + +/* SubTable */ + +static HB_Error Load_SubTable( HB_SubTable* st, + HB_Stream stream, + HB_Type table_type, + HB_UShort lookup_type ) +{ + if ( table_type == HB_Type_GSUB ) + return _HB_GSUB_Load_SubTable ( &st->st.gsub, stream, lookup_type ); + else + return _HB_GPOS_Load_SubTable ( &st->st.gpos, stream, lookup_type ); +} + + +static void Free_SubTable( HB_SubTable* st, + HB_Type table_type, + HB_UShort lookup_type ) +{ + if ( table_type == HB_Type_GSUB ) + _HB_GSUB_Free_SubTable ( &st->st.gsub, lookup_type ); + else + _HB_GPOS_Free_SubTable ( &st->st.gpos, lookup_type ); +} + + +/* Lookup */ + +static HB_Error Load_Lookup( HB_Lookup* l, + HB_Stream stream, + HB_Type type ) +{ + HB_Error error; + + HB_UShort n, m, count; + HB_UInt cur_offset, new_offset, base_offset; + + HB_SubTable* st; + + HB_Bool is_extension = FALSE; + + + base_offset = FILE_Pos(); + + if ( ACCESS_Frame( 6L ) ) + return error; + + l->LookupType = GET_UShort(); + l->LookupFlag = GET_UShort(); + count = l->SubTableCount = GET_UShort(); + + FORGET_Frame(); + + l->SubTable = NULL; + + if ( ALLOC_ARRAY( l->SubTable, count, HB_SubTable ) ) + return error; + + st = l->SubTable; + + if ( ( type == HB_Type_GSUB && l->LookupType == HB_GSUB_LOOKUP_EXTENSION ) || + ( type == HB_Type_GPOS && l->LookupType == HB_GPOS_LOOKUP_EXTENSION ) ) + is_extension = TRUE; + + for ( n = 0; n < count; n++ ) + { + if ( ACCESS_Frame( 2L ) ) + goto Fail; + + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + + if ( is_extension ) + { + if ( FILE_Seek( new_offset ) || ACCESS_Frame( 8L ) ) + goto Fail; + + if (GET_UShort() != 1) /* format should be 1 */ + goto Fail; + + l->LookupType = GET_UShort(); + new_offset += GET_ULong(); + + FORGET_Frame(); + } + + if ( FILE_Seek( new_offset ) || + ( error = Load_SubTable( &st[n], stream, + type, l->LookupType ) ) != HB_Err_Ok ) + goto Fail; + (void)FILE_Seek( cur_offset ); + } + + return HB_Err_Ok; + +Fail: + for ( m = 0; m < n; m++ ) + Free_SubTable( &st[m], type, l->LookupType ); + + FREE( l->SubTable ); + return error; +} + + +static void Free_Lookup( HB_Lookup* l, + HB_Type type) +{ + HB_UShort n, count; + + HB_SubTable* st; + + + if ( l->SubTable ) + { + count = l->SubTableCount; + st = l->SubTable; + + for ( n = 0; n < count; n++ ) + Free_SubTable( &st[n], type, l->LookupType ); + + FREE( st ); + } +} + + +/* LookupList */ + +HB_INTERNAL HB_Error +_HB_OPEN_Load_LookupList( HB_LookupList* ll, + HB_Stream stream, + HB_Type type ) +{ + HB_Error error; + + HB_UShort n, m, count; + HB_UInt cur_offset, new_offset, base_offset; + + HB_Lookup* l; + + + base_offset = FILE_Pos(); + + if ( ACCESS_Frame( 2L ) ) + return error; + + count = ll->LookupCount = GET_UShort(); + + FORGET_Frame(); + + ll->Lookup = NULL; + + if ( ALLOC_ARRAY( ll->Lookup, count, HB_Lookup ) ) + return error; + if ( ALLOC_ARRAY( ll->Properties, count, HB_UInt ) ) + goto Fail2; + + l = ll->Lookup; + + for ( n = 0; n < count; n++ ) + { + if ( ACCESS_Frame( 2L ) ) + goto Fail1; + + new_offset = GET_UShort() + base_offset; + + FORGET_Frame(); + + cur_offset = FILE_Pos(); + if ( FILE_Seek( new_offset ) || + ( error = Load_Lookup( &l[n], stream, type ) ) != HB_Err_Ok ) + goto Fail1; + (void)FILE_Seek( cur_offset ); + } + + return HB_Err_Ok; + +Fail1: + FREE( ll->Properties ); + + for ( m = 0; m < n; m++ ) + Free_Lookup( &l[m], type ); + +Fail2: + FREE( ll->Lookup ); + return error; +} + + +HB_INTERNAL void +_HB_OPEN_Free_LookupList( HB_LookupList* ll, + HB_Type type ) +{ + HB_UShort n, count; + + HB_Lookup* l; + + + FREE( ll->Properties ); + + if ( ll->Lookup ) + { + count = ll->LookupCount; + l = ll->Lookup; + + for ( n = 0; n < count; n++ ) + Free_Lookup( &l[n], type ); + + FREE( l ); + } +} + + + +/***************************** + * Coverage related functions + *****************************/ + + +/* CoverageFormat1 */ + +static HB_Error Load_Coverage1( HB_CoverageFormat1* cf1, + HB_Stream stream ) +{ + HB_Error error; + + HB_UShort n, count; + + HB_UShort* ga; + + + if ( ACCESS_Frame( 2L ) ) + return error; + + count = cf1->GlyphCount = GET_UShort(); + + FORGET_Frame(); + + cf1->GlyphArray = NULL; + + if ( ALLOC_ARRAY( cf1->GlyphArray, count, HB_UShort ) ) + return error; + + ga = cf1->GlyphArray; + + if ( ACCESS_Frame( count * 2L ) ) + { + FREE( cf1->GlyphArray ); + return error; + } + + for ( n = 0; n < count; n++ ) + ga[n] = GET_UShort(); + + FORGET_Frame(); + + return HB_Err_Ok; +} + + +static void Free_Coverage1( HB_CoverageFormat1* cf1) +{ + FREE( cf1->GlyphArray ); +} + + +/* CoverageFormat2 */ + +static HB_Error Load_Coverage2( HB_CoverageFormat2* cf2, + HB_Stream stream ) +{ + HB_Error error; + + HB_UShort n, count; + + HB_RangeRecord* rr; + + + if ( ACCESS_Frame( 2L ) ) + return error; + + count = cf2->RangeCount = GET_UShort(); + + FORGET_Frame(); + + cf2->RangeRecord = NULL; + + if ( ALLOC_ARRAY( cf2->RangeRecord, count, HB_RangeRecord ) ) + return error; + + rr = cf2->RangeRecord; + + if ( ACCESS_Frame( count * 6L ) ) + goto Fail; + + for ( n = 0; n < count; n++ ) + { + rr[n].Start = GET_UShort(); + rr[n].End = GET_UShort(); + rr[n].StartCoverageIndex = GET_UShort(); + + /* sanity check; we are limited to 16bit integers */ + if ( rr[n].Start > rr[n].End || + ( rr[n].End - rr[n].Start + (long)rr[n].StartCoverageIndex ) >= + 0x10000L ) + { + error = ERR(HB_Err_Invalid_SubTable); + goto Fail; + } + } + + FORGET_Frame(); + + return HB_Err_Ok; + +Fail: + FREE( cf2->RangeRecord ); + return error; +} + + +static void Free_Coverage2( HB_CoverageFormat2* cf2 ) +{ + FREE( cf2->RangeRecord ); +} + + +HB_INTERNAL HB_Error +_HB_OPEN_Load_Coverage( HB_Coverage* c, + HB_Stream stream ) +{ + HB_Error error; + + if ( ACCESS_Frame( 2L ) ) + return error; + + c->CoverageFormat = GET_UShort(); + + FORGET_Frame(); + + switch ( c->CoverageFormat ) + { + case 1: return Load_Coverage1( &c->cf.cf1, stream ); + case 2: return Load_Coverage2( &c->cf.cf2, stream ); + default: return ERR(HB_Err_Invalid_SubTable_Format); + } + + return HB_Err_Ok; /* never reached */ +} + + +HB_INTERNAL void +_HB_OPEN_Free_Coverage( HB_Coverage* c ) +{ + switch ( c->CoverageFormat ) + { + case 1: Free_Coverage1( &c->cf.cf1 ); break; + case 2: Free_Coverage2( &c->cf.cf2 ); break; + default: break; + } +} + + +static HB_Error Coverage_Index1( HB_CoverageFormat1* cf1, + HB_UShort glyphID, + HB_UShort* index ) +{ + HB_UShort min, max, new_min, new_max, middle; + + HB_UShort* array = cf1->GlyphArray; + + + /* binary search */ + + if ( cf1->GlyphCount == 0 ) + return HB_Err_Not_Covered; + + new_min = 0; + new_max = cf1->GlyphCount - 1; + + do + { + min = new_min; + max = new_max; + + /* we use (min + max) / 2 = max - (max - min) / 2 to avoid + overflow and rounding errors */ + + middle = max - ( ( max - min ) >> 1 ); + + if ( glyphID == array[middle] ) + { + *index = middle; + return HB_Err_Ok; + } + else if ( glyphID < array[middle] ) + { + if ( middle == min ) + break; + new_max = middle - 1; + } + else + { + if ( middle == max ) + break; + new_min = middle + 1; + } + } while ( min < max ); + + return HB_Err_Not_Covered; +} + + +static HB_Error Coverage_Index2( HB_CoverageFormat2* cf2, + HB_UShort glyphID, + HB_UShort* index ) +{ + HB_UShort min, max, new_min, new_max, middle; + + HB_RangeRecord* rr = cf2->RangeRecord; + + + /* binary search */ + + if ( cf2->RangeCount == 0 ) + return HB_Err_Not_Covered; + + new_min = 0; + new_max = cf2->RangeCount - 1; + + do + { + min = new_min; + max = new_max; + + /* we use (min + max) / 2 = max - (max - min) / 2 to avoid + overflow and rounding errors */ + + middle = max - ( ( max - min ) >> 1 ); + + if ( glyphID >= rr[middle].Start && glyphID <= rr[middle].End ) + { + *index = rr[middle].StartCoverageIndex + glyphID - rr[middle].Start; + return HB_Err_Ok; + } + else if ( glyphID < rr[middle].Start ) + { + if ( middle == min ) + break; + new_max = middle - 1; + } + else + { + if ( middle == max ) + break; + new_min = middle + 1; + } + } while ( min < max ); + + return HB_Err_Not_Covered; +} + + +HB_INTERNAL HB_Error +_HB_OPEN_Coverage_Index( HB_Coverage* c, + HB_UShort glyphID, + HB_UShort* index ) +{ + switch ( c->CoverageFormat ) + { + case 1: return Coverage_Index1( &c->cf.cf1, glyphID, index ); + case 2: return Coverage_Index2( &c->cf.cf2, glyphID, index ); + default: return ERR(HB_Err_Invalid_SubTable_Format); + } + + return HB_Err_Ok; /* never reached */ +} + + + +/************************************* + * Class Definition related functions + *************************************/ + + +/* ClassDefFormat1 */ + +static HB_Error Load_ClassDef1( HB_ClassDefinition* cd, + HB_UShort limit, + HB_Stream stream ) +{ + HB_Error error; + + HB_UShort n, count; + + HB_UShort* cva; + + HB_ClassDefFormat1* cdf1; + + + cdf1 = &cd->cd.cd1; + + if ( ACCESS_Frame( 4L ) ) + return error; + + cdf1->StartGlyph = GET_UShort(); + count = cdf1->GlyphCount = GET_UShort(); + + FORGET_Frame(); + + /* sanity check; we are limited to 16bit integers */ + + if ( cdf1->StartGlyph + (long)count >= 0x10000L ) + return ERR(HB_Err_Invalid_SubTable); + + cdf1->ClassValueArray = NULL; + + if ( ALLOC_ARRAY( cdf1->ClassValueArray, count, HB_UShort ) ) + return error; + + cva = cdf1->ClassValueArray; + + if ( ACCESS_Frame( count * 2L ) ) + goto Fail; + + for ( n = 0; n < count; n++ ) + { + cva[n] = GET_UShort(); + if ( cva[n] >= limit ) + { + error = ERR(HB_Err_Invalid_SubTable); + goto Fail; + } + } + + FORGET_Frame(); + + return HB_Err_Ok; + +Fail: + FREE( cva ); + + return error; +} + + +static void Free_ClassDef1( HB_ClassDefFormat1* cdf1 ) +{ + FREE( cdf1->ClassValueArray ); +} + + +/* ClassDefFormat2 */ + +static HB_Error Load_ClassDef2( HB_ClassDefinition* cd, + HB_UShort limit, + HB_Stream stream ) +{ + HB_Error error; + + HB_UShort n, count; + + HB_ClassRangeRecord* crr; + + HB_ClassDefFormat2* cdf2; + + + cdf2 = &cd->cd.cd2; + + if ( ACCESS_Frame( 2L ) ) + return error; + + count = GET_UShort(); + cdf2->ClassRangeCount = 0; /* zero for now. we fill with the number of good entries later */ + + FORGET_Frame(); + + cdf2->ClassRangeRecord = NULL; + + if ( ALLOC_ARRAY( cdf2->ClassRangeRecord, count, HB_ClassRangeRecord ) ) + return error; + + crr = cdf2->ClassRangeRecord; + + if ( ACCESS_Frame( count * 6L ) ) + goto Fail; + + for ( n = 0; n < count; n++ ) + { + crr[n].Start = GET_UShort(); + crr[n].End = GET_UShort(); + crr[n].Class = GET_UShort(); + + /* sanity check */ + + if ( crr[n].Start > crr[n].End || + crr[n].Class >= limit ) + { + /* XXX + * Corrupt entry. Skip it. + * This is hit by Nafees Nastaliq font for example + */ + n--; + count--; + } + } + + FORGET_Frame(); + + cdf2->ClassRangeCount = count; + + return HB_Err_Ok; + +Fail: + FREE( crr ); + + return error; +} + + +static void Free_ClassDef2( HB_ClassDefFormat2* cdf2 ) +{ + FREE( cdf2->ClassRangeRecord ); +} + + +/* ClassDefinition */ + +HB_INTERNAL HB_Error +_HB_OPEN_Load_ClassDefinition( HB_ClassDefinition* cd, + HB_UShort limit, + HB_Stream stream ) +{ + HB_Error error; + + if ( ACCESS_Frame( 2L ) ) + return error; + + cd->ClassFormat = GET_UShort(); + + FORGET_Frame(); + + switch ( cd->ClassFormat ) + { + case 1: error = Load_ClassDef1( cd, limit, stream ); break; + case 2: error = Load_ClassDef2( cd, limit, stream ); break; + default: error = ERR(HB_Err_Invalid_SubTable_Format); break; + } + + if ( error ) + return error; + + cd->loaded = TRUE; + + return HB_Err_Ok; +} + + +static HB_Error +_HB_OPEN_Load_EmptyClassDefinition( HB_ClassDefinition* cd ) +{ + HB_Error error; + + cd->ClassFormat = 1; /* Meaningless */ + + if ( ALLOC_ARRAY( cd->cd.cd1.ClassValueArray, 1, HB_UShort ) ) + return error; + + cd->loaded = TRUE; + + return HB_Err_Ok; +} + +HB_INTERNAL HB_Error +_HB_OPEN_Load_EmptyOrClassDefinition( HB_ClassDefinition* cd, + HB_UShort limit, + HB_UInt class_offset, + HB_UInt base_offset, + HB_Stream stream ) +{ + HB_Error error; + HB_UInt cur_offset; + + cur_offset = FILE_Pos(); + + if ( class_offset ) + { + if ( !FILE_Seek( class_offset + base_offset ) ) + error = _HB_OPEN_Load_ClassDefinition( cd, limit, stream ); + } + else + error = _HB_OPEN_Load_EmptyClassDefinition ( cd ); + + if (error == HB_Err_Ok) + (void)FILE_Seek( cur_offset ); /* Changes error as a side-effect */ + + return error; +} + +HB_INTERNAL void +_HB_OPEN_Free_ClassDefinition( HB_ClassDefinition* cd ) +{ + if ( !cd->loaded ) + return; + + switch ( cd->ClassFormat ) + { + case 1: Free_ClassDef1( &cd->cd.cd1 ); break; + case 2: Free_ClassDef2( &cd->cd.cd2 ); break; + default: break; + } +} + + +static HB_Error Get_Class1( HB_ClassDefFormat1* cdf1, + HB_UShort glyphID, + HB_UShort* klass, + HB_UShort* index ) +{ + HB_UShort* cva = cdf1->ClassValueArray; + + + if ( index ) + *index = 0; + + if ( glyphID >= cdf1->StartGlyph && + glyphID < cdf1->StartGlyph + cdf1->GlyphCount ) + { + *klass = cva[glyphID - cdf1->StartGlyph]; + return HB_Err_Ok; + } + else + { + *klass = 0; + return HB_Err_Not_Covered; + } +} + + +/* we need the index value of the last searched class range record + in case of failure for constructed GDEF tables */ + +static HB_Error Get_Class2( HB_ClassDefFormat2* cdf2, + HB_UShort glyphID, + HB_UShort* klass, + HB_UShort* index ) +{ + HB_Error error = HB_Err_Ok; + HB_UShort min, max, new_min, new_max, middle; + + HB_ClassRangeRecord* crr = cdf2->ClassRangeRecord; + + + /* binary search */ + + if ( cdf2->ClassRangeCount == 0 ) + { + *klass = 0; + if ( index ) + *index = 0; + + return HB_Err_Not_Covered; + } + + new_min = 0; + new_max = cdf2->ClassRangeCount - 1; + + do + { + min = new_min; + max = new_max; + + /* we use (min + max) / 2 = max - (max - min) / 2 to avoid + overflow and rounding errors */ + + middle = max - ( ( max - min ) >> 1 ); + + if ( glyphID >= crr[middle].Start && glyphID <= crr[middle].End ) + { + *klass = crr[middle].Class; + error = HB_Err_Ok; + break; + } + else if ( glyphID < crr[middle].Start ) + { + if ( middle == min ) + { + *klass = 0; + error = HB_Err_Not_Covered; + break; + } + new_max = middle - 1; + } + else + { + if ( middle == max ) + { + *klass = 0; + error = HB_Err_Not_Covered; + break; + } + new_min = middle + 1; + } + } while ( min < max ); + + if ( index ) + *index = middle; + + return error; +} + + +HB_INTERNAL HB_Error +_HB_OPEN_Get_Class( HB_ClassDefinition* cd, + HB_UShort glyphID, + HB_UShort* klass, + HB_UShort* index ) +{ + switch ( cd->ClassFormat ) + { + case 1: return Get_Class1( &cd->cd.cd1, glyphID, klass, index ); + case 2: return Get_Class2( &cd->cd.cd2, glyphID, klass, index ); + default: return ERR(HB_Err_Invalid_SubTable_Format); + } + + return HB_Err_Ok; /* never reached */ +} + + + +/*************************** + * Device related functions + ***************************/ + + +HB_INTERNAL HB_Error +_HB_OPEN_Load_Device( HB_Device** device, + HB_Stream stream ) +{ + HB_Device* d; + HB_Error error; + + HB_UShort n, count; + + HB_UShort* dv; + + + if ( ACCESS_Frame( 6L ) ) + return error; + + if ( ALLOC( *device, sizeof(HB_Device)) ) + { + *device = 0; + return error; + } + + d = *device; + + d->StartSize = GET_UShort(); + d->EndSize = GET_UShort(); + d->DeltaFormat = GET_UShort(); + + FORGET_Frame(); + + d->DeltaValue = NULL; + + if ( d->StartSize > d->EndSize || + d->DeltaFormat == 0 || d->DeltaFormat > 3 ) + { + /* XXX + * I've seen fontforge generate DeltaFormat == 0. + * Just return Ok and let the NULL DeltaValue disable + * this table. + */ + return HB_Err_Ok; + } + + count = ( ( d->EndSize - d->StartSize + 1 ) >> + ( 4 - d->DeltaFormat ) ) + 1; + + if ( ALLOC_ARRAY( d->DeltaValue, count, HB_UShort ) ) + { + FREE( *device ); + *device = 0; + return error; + } + + if ( ACCESS_Frame( count * 2L ) ) + { + FREE( d->DeltaValue ); + FREE( *device ); + *device = 0; + return error; + } + + dv = d->DeltaValue; + + for ( n = 0; n < count; n++ ) + dv[n] = GET_UShort(); + + FORGET_Frame(); + + return HB_Err_Ok; +} + + +HB_INTERNAL void +_HB_OPEN_Free_Device( HB_Device* d ) +{ + if ( d ) + { + FREE( d->DeltaValue ); + FREE( d ); + } +} + + +/* Since we have the delta values stored in compressed form, we must + uncompress it now. To simplify the interface, the function always + returns a meaningful value in `value'; the error is just for + information. + | | + format = 1: 0011223344556677|8899101112131415|... + | | + byte 1 byte 2 + + 00: (byte >> 14) & mask + 11: (byte >> 12) & mask + ... + + mask = 0x0003 + | | + format = 2: 0000111122223333|4444555566667777|... + | | + byte 1 byte 2 + + 0000: (byte >> 12) & mask + 1111: (byte >> 8) & mask + ... + + mask = 0x000F + | | + format = 3: 0000000011111111|2222222233333333|... + | | + byte 1 byte 2 + + 00000000: (byte >> 8) & mask + 11111111: (byte >> 0) & mask + .... + + mask = 0x00FF */ + +HB_INTERNAL HB_Error +_HB_OPEN_Get_Device( HB_Device* d, + HB_UShort size, + HB_Short* value ) +{ + HB_UShort byte, bits, mask, s; + + if ( d && d->DeltaValue && size >= d->StartSize && size <= d->EndSize ) + { + HB_UShort f = d->DeltaFormat; + s = size - d->StartSize; + byte = d->DeltaValue[s >> ( 4 - f )]; + bits = byte >> ( 16 - ( ( s % ( 1 << ( 4 - f ) ) + 1 ) << f ) ); + mask = 0xFFFF >> ( 16 - ( 1 << f ) ); + + *value = (HB_Short)( bits & mask ); + + /* conversion to a signed value */ + + if ( *value >= ( ( mask + 1 ) >> 1 ) ) + *value -= mask + 1; + + return HB_Err_Ok; + } + else + { + *value = 0; + return HB_Err_Not_Covered; + } +} + + +/* END */ diff --git a/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-open.h b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-open.h new file mode 100644 index 0000000..4ba6cf5 --- /dev/null +++ b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-open.h @@ -0,0 +1,288 @@ +/* + * Copyright (C) 1998-2004 David Turner and Werner Lemberg + * Copyright (C) 2006 Behdad Esfahbod + * + * This is part of HarfBuzz, an OpenType Layout engine library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#ifndef HARFBUZZ_OPEN_H +#define HARFBUZZ_OPEN_H + +#include "harfbuzz-global.h" + +HB_BEGIN_HEADER + +#ifdef HB_USE_PACKED_STRUCTS +#pragma pack(push, 1) +#endif + +/* Use this if a feature applies to all glyphs */ +#define HB_ALL_GLYPHS 0xFFFF + +#define HB_DEFAULT_LANGUAGE 0xFFFF + +#define HB_MAX_NESTING_LEVEL 100 + + +/* Script list related structures */ + +struct HB_LangSys_ +{ + HB_UShort* FeatureIndex; /* array of Feature indices */ + HB_UShort LookupOrderOffset; /* always 0 for TT Open 1.0 */ + HB_UShort ReqFeatureIndex; /* required FeatureIndex */ + HB_UShort FeatureCount; /* number of Feature indices */ +}; + +typedef struct HB_LangSys_ HB_LangSys; + + +struct HB_LangSysRecord_ +{ + HB_LangSys LangSys; /* LangSys table */ + HB_UInt LangSysTag; /* LangSysTag identifier */ +}; + +typedef struct HB_LangSysRecord_ HB_LangSysRecord; + + +struct HB_ScriptTable_ +{ + HB_LangSysRecord* LangSysRecord; /* array of LangSysRecords */ + HB_LangSys DefaultLangSys; /* DefaultLangSys table */ + HB_UShort LangSysCount; /* number of LangSysRecords */ +}; + +typedef struct HB_ScriptTable_ HB_ScriptTable; + + +struct HB_ScriptRecord_ +{ + HB_UInt ScriptTag; /* ScriptTag identifier */ + HB_ScriptTable Script; /* Script table */ +}; + +typedef struct HB_ScriptRecord_ HB_ScriptRecord; + + +struct HB_ScriptList_ +{ + HB_ScriptRecord* ScriptRecord; /* array of ScriptRecords */ + HB_UShort ScriptCount; /* number of ScriptRecords */ +}; + +typedef struct HB_ScriptList_ HB_ScriptList; + + +/* Feature list related structures */ + +struct HB_Feature_ +{ + HB_UShort* LookupListIndex; /* array of LookupList indices */ + HB_UShort FeatureParams; /* always 0 for TT Open 1.0 */ + HB_UShort LookupListCount; /* number of LookupList indices */ +}; + +typedef struct HB_Feature_ HB_Feature; + + +struct HB_FeatureRecord_ +{ + HB_UInt FeatureTag; /* FeatureTag identifier */ + HB_Feature Feature; /* Feature table */ +}; + +typedef struct HB_FeatureRecord_ HB_FeatureRecord; + + +struct HB_FeatureList_ +{ + HB_UShort* ApplyOrder; /* order to apply features */ + HB_FeatureRecord* FeatureRecord; /* array of FeatureRecords */ + HB_UShort FeatureCount; /* number of FeatureRecords */ + HB_UShort ApplyCount; /* number of elements in ApplyOrder */ +}; + +typedef struct HB_FeatureList_ HB_FeatureList; + + +/* Lookup list related structures */ + +typedef struct HB_SubTable_ HB_SubTable; + + +struct HB_Lookup_ +{ + HB_SubTable* SubTable; /* array of SubTables */ + HB_UShort LookupType; /* Lookup type */ + HB_UShort LookupFlag; /* Lookup qualifiers */ + HB_UShort SubTableCount; /* number of SubTables */ +}; + +typedef struct HB_Lookup_ HB_Lookup; + + +/* The `Properties' field is not defined in the OpenType specification but + is needed for processing lookups. If properties[n] is > 0, the + functions HB_GSUB_Apply_String() resp. HB_GPOS_Apply_String() will + process Lookup[n] for glyphs which have the specific bit not set in + the `properties' field of the input string object. */ + +struct HB_LookupList_ +{ + HB_Lookup* Lookup; /* array of Lookup records */ + HB_UInt* Properties; /* array of flags */ + HB_UShort LookupCount; /* number of Lookups */ +}; + +typedef struct HB_LookupList_ HB_LookupList; + + +/* Possible LookupFlag bit masks. `HB_LOOKUP_FLAG_IGNORE_SPECIAL_MARKS' comes from the + OpenType 1.2 specification; HB_LOOKUP_FLAG_RIGHT_TO_LEFT has been (re)introduced in + OpenType 1.3 -- if set, the last glyph in a cursive attachment + sequence has to be positioned on the baseline -- regardless of the + writing direction. */ + +#define HB_LOOKUP_FLAG_RIGHT_TO_LEFT 0x0001 +#define HB_LOOKUP_FLAG_IGNORE_BASE_GLYPHS 0x0002 +#define HB_LOOKUP_FLAG_IGNORE_LIGATURES 0x0004 +#define HB_LOOKUP_FLAG_IGNORE_MARKS 0x0008 +#define HB_LOOKUP_FLAG_IGNORE_SPECIAL_MARKS 0xFF00 + + +struct HB_CoverageFormat1_ +{ + HB_UShort* GlyphArray; /* array of glyph IDs */ + HB_UShort GlyphCount; /* number of glyphs in GlyphArray */ +}; + +typedef struct HB_CoverageFormat1_ HB_CoverageFormat1; + + +struct HB_RangeRecord_ +{ + HB_UShort Start; /* first glyph ID in the range */ + HB_UShort End; /* last glyph ID in the range */ + HB_UShort StartCoverageIndex; /* coverage index of first + glyph ID in the range */ +}; + +typedef struct HB_RangeRecord_ HB_RangeRecord; + + +struct HB_CoverageFormat2_ +{ + HB_RangeRecord* RangeRecord; /* array of RangeRecords */ + HB_UShort RangeCount; /* number of RangeRecords */ +}; + +typedef struct HB_CoverageFormat2_ HB_CoverageFormat2; + + +struct HB_Coverage_ +{ + HB_Byte CoverageFormat; /* 1 or 2 */ + + union + { + HB_CoverageFormat1 cf1; + HB_CoverageFormat2 cf2; + } cf; +}; + +typedef struct HB_Coverage_ HB_Coverage; + + +struct HB_ClassDefFormat1_ +{ + HB_UShort* ClassValueArray; /* array of class values */ + HB_UShort StartGlyph; /* first glyph ID of the + ClassValueArray */ + HB_UShort GlyphCount; /* size of the ClassValueArray */ +}; + +typedef struct HB_ClassDefFormat1_ HB_ClassDefFormat1; + + +struct HB_ClassRangeRecord_ +{ + HB_UShort Start; /* first glyph ID in the range */ + HB_UShort End; /* last glyph ID in the range */ + HB_UShort Class; /* applied to all glyphs in range */ +}; + +typedef struct HB_ClassRangeRecord_ HB_ClassRangeRecord; + + +struct HB_ClassDefFormat2_ +{ + HB_ClassRangeRecord* ClassRangeRecord; + /* array of ClassRangeRecords */ + HB_UShort ClassRangeCount; + /* number of ClassRangeRecords */ +}; + +typedef struct HB_ClassDefFormat2_ HB_ClassDefFormat2; + + +struct HB_ClassDefinition_ +{ + union + { + HB_ClassDefFormat1 cd1; + HB_ClassDefFormat2 cd2; + } cd; + + HB_Byte ClassFormat; /* 1 or 2 */ + HB_Bool loaded; +}; + +typedef struct HB_ClassDefinition_ HB_ClassDefinition; + + +struct HB_Device_ +{ + HB_UShort* DeltaValue; /* array of compressed data */ + HB_UShort StartSize; /* smallest size to correct */ + HB_UShort EndSize; /* largest size to correct */ + HB_Byte DeltaFormat; /* DeltaValue array data format: + 1, 2, or 3 */ +}; + +typedef struct HB_Device_ HB_Device; + + +enum HB_Type_ +{ + HB_Type_GSUB, + HB_Type_GPOS +}; + +typedef enum HB_Type_ HB_Type; + +#ifdef HB_USE_PACKED_STRUCTS +#pragma pack(pop) +#endif + +HB_END_HEADER + +#endif /* HARFBUZZ_OPEN_H */ diff --git a/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-shape.h b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-shape.h new file mode 100644 index 0000000..e4b5f9a --- /dev/null +++ b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-shape.h @@ -0,0 +1,199 @@ +/* + * Copyright (C) 2006 Red Hat, Inc. + * + * This is part of HarfBuzz, an OpenType Layout engine library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + * + * Red Hat Author(s): Owen Taylor + */ + +#include + +/* Base Types */ + +typedef hb_uint16 HB_CodePoint; /* UTF-16 codepoint (not character ) */ +typedef char HB_Boolean; +typedef hb_uint32 HB_Fixed; /* 26.6 */ +typedef hb_uint32 HB_Glyph; +typedef hb_uint32 HB_Unichar; + +/* Metrics reported by the font backend for use of the shaper */ +typedef struct _HB_GlyphMetrics HB_GlyphMetrics; +struct _HB_GlyphMetrics +{ + HB_Fixed advance; + + /* Do we need ink/logical extents for the glyph here? */ +}; + +/* + * HB_Font: Abstract font interface. + * First pass of this might just have FT_Face *getFace(); + */ +typedef struct _HB_Font HB_Font; +typedef struct _HB_FontClass HB_FontClass; + +struct HB_FontClass { + HB_Glyph (*charToGlyph)(HB_Font *font, HB_Unichar chr); + void (*getMetrics)(HB_Font *font, HB_Glyph glyph, HB_GlyphMetrics *metrics); + HB_Boolean (*getSFontTable)(HB_Font *font, void **cookie, char **start, int *len); + HB_Boolean (*freeSFontTable)(void **cookie); +}; + +struct _HB_Font { + HB_FontClass *clazz; +}; + +/* + * Language tags, of the form en-us; represented as interned, canonicalized + * strings. hb_language_from_string("en_US"), hb_language_from_string("en-us") + * both return the same (pointer-comparable) HB_Language). + */ +typedef struct HB_Language_ *HB_Language; + +HB_Language hb_language_from_string(const char *str); +const char *hb_language_to_string(HB_Language language); + +/* Special treatment for the edges of runs. + */ +typedef enum { + HB_RUN_EDGE_LINE_VISUAL_EDGE = 1 << 0, + HB_RUN_EDGE_LINE_LOGICAL_EDGE = 1 << 1, + HB_RUN_EDGE_LINE_ADD_HYPHEN = 1 << 2 /* ???? */ +} HB_RunEdge; + +/* Defines optional informaiton in HB_ShapeInput; this allows extension + * of HB_ShapeInput while keeping binary compatibility + */ +typedef enum { + HB_SHAPE_START_TYPE = 1 << 0, + HB_SHAPE_END_TYPE = 1 << 1 +} HB_ShapeFlags; + +/* Attributes types are described by "interned strings"; this is a little + * annoying if you want to write a switch statement, but keeps things + * simple. + */ +typedef struct _HB_AttributeType *HB_AttributeType; + +HB_AttributeType hb_attribute_type_from_string(const char *str); +const char *hb_attribute_type_to_string(HB_AttributeType attribute_type); + +struct HB_Attribute { + HB_AttributeType type; + int start; + int end; +}; + + +/** + * You could handle this like HB_Language, but an enum seems a little nicer; + * another approach would be to use OpenType script tags. + */ +typedef enum { + HB_SCRIPT_LATIN + /* ... */ +} HB_ShapeScript; + +/* This is just the subset of direction information needed by the shaper */ +typedef enum { + HB_DIRECTION_LTR, + HB_DIRECTION_RTL, + HB_DIRECTION_TTB +} HB_Direction; + +typedef struct _HB_ShapeInput HB_ShapeInput; +struct _HB_ShapeInput { + /* Defines what fields the caller has initialized - fields not in + * the enum are mandatory. + */ + HB_ShapeFlags flags; + + HB_CodePoint *text; + int length; /* total length of text to shape */ + int shape_offset; /* start of section to shape */ + int shape_length; /* number of code points to shape */ + + HB_Direction direction; + HB_ShapeScript script; + HB_Language language; + + HB_AttributeType *attributes; + int n_attributes; + + HB_RunEdge start_type; + HB_RunEdge end_type; +}; + +struct HB_GlyphItem { + HB_Glyph glyph; + + HB_Fixed x_offset; + HB_Fixed y_offset; + HB_Fixed advance; + + /* Add kashida information, etc, here */ +}; + +typedef enum { + HB_RESULT_SUCCESS, + HB_RESULT_NO_MEMORY, + HB_SHAPE_RESULT_FAILED +} HB_Result; + +/* + * Buffer for output + */ +typedef struct _HB_GlyphBuffer HB_GlyphBuffer; +struct _HB_GlyphBuffer { + int glyph_item_size; + int total_glyphs; + + int *log_clusters; /* Uniscribe style */ + int cluster_space; + + int glyph_space; + void *glyph_buffer; +}; + +/* Making this self-allocating simplifies writing shapers and + * also keeps things easier for caller. item_size passed in + * must be at least sizeof(HB_GlyphItem) but can be bigger, + * to accomodate application structures that extend HB_GlyphItem. + * The allocated items will be zero-initialized. + * + * (Hack: Harfbuzz could choose to use even a *bigger* item size + * and stick internal information before the public item structure. + * This hack could possibly be used to unify this with HB_Buffer) + */ +HB_GlyphBuffer *hb_glyph_buffer_new (size_t item_size); +void hb_glyph_buffer_clear (HB_GlyphBuffer *buf); +HB_Result hb_glyph_buffer_extend_glyphs (HB_GlyphBuffer *buf, int n_items); +HB_Result hb_glyph_buffer_extend_clusters (HB_GlyphBuffer *buf, int n_clusters); +void hb_glyph_buffer_free (HB_GlyphBuffer *buf); + + +/* Accessor for a particular glyph */ +#define HB_GLYPH_BUFFER_ITEM(buffer, index) + +/* + * Main shaping function + */ +HB_Result hb_shape(HB_ShapeInput *input, HB_GlyphBuffer *output); diff --git a/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-shaper-all.cpp b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-shaper-all.cpp new file mode 100644 index 0000000..2dae501 --- /dev/null +++ b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-shaper-all.cpp @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) + * + * This is part of HarfBuzz, an OpenType Layout engine library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#include "harfbuzz-shaper.cpp" +#include "harfbuzz-indic.cpp" +extern "C" { +#include "harfbuzz-greek.c" +#include "harfbuzz-tibetan.c" +#include "harfbuzz-khmer.c" +#include "harfbuzz-hebrew.c" +#include "harfbuzz-arabic.c" +#include "harfbuzz-hangul.c" +#include "harfbuzz-myanmar.c" +#include "harfbuzz-thai.c" +} + diff --git a/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-shaper-private.h b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-shaper-private.h new file mode 100644 index 0000000..e1360c7 --- /dev/null +++ b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-shaper-private.h @@ -0,0 +1,171 @@ +/* + * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) + * + * This is part of HarfBuzz, an OpenType Layout engine library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#ifndef HARFBUZZ_SHAPER_PRIVATE_H +#define HARFBUZZ_SHAPER_PRIVATE_H + +HB_BEGIN_HEADER + +enum { + C_DOTTED_CIRCLE = 0x25CC +}; + +typedef enum +{ + HB_Combining_BelowLeftAttached = 200, + HB_Combining_BelowAttached = 202, + HB_Combining_BelowRightAttached = 204, + HB_Combining_LeftAttached = 208, + HB_Combining_RightAttached = 210, + HB_Combining_AboveLeftAttached = 212, + HB_Combining_AboveAttached = 214, + HB_Combining_AboveRightAttached = 216, + + HB_Combining_BelowLeft = 218, + HB_Combining_Below = 220, + HB_Combining_BelowRight = 222, + HB_Combining_Left = 224, + HB_Combining_Right = 226, + HB_Combining_AboveLeft = 228, + HB_Combining_Above = 230, + HB_Combining_AboveRight = 232, + + HB_Combining_DoubleBelow = 233, + HB_Combining_DoubleAbove = 234, + HB_Combining_IotaSubscript = 240 +} HB_CombiningClass; + +typedef enum { + LocaProperty = 0x1, + CcmpProperty = 0x2, + InitProperty = 0x4, + IsolProperty = 0x8, + FinaProperty = 0x10, + MediProperty = 0x20, + RligProperty = 0x40, + CaltProperty = 0x80, + LigaProperty = 0x100, + DligProperty = 0x200, + CswhProperty = 0x400, + MsetProperty = 0x800, + + /* used by indic and myanmar shaper */ + NuktaProperty = 0x8, + AkhantProperty = 0x10, + RephProperty = 0x20, + PreFormProperty = 0x40, + BelowFormProperty = 0x80, + AboveFormProperty = 0x100, + HalfFormProperty = 0x200, + PostFormProperty = 0x400, + ConjunctFormProperty = 0x800, + VattuProperty = 0x1000, + PreSubstProperty = 0x2000, + BelowSubstProperty = 0x4000, + AboveSubstProperty = 0x8000, + PostSubstProperty = 0x10000, + HalantProperty = 0x20000, + CligProperty = 0x40000, + IndicCaltProperty = 0x80000 + +} HB_OpenTypeProperty; + +/* return true if ok. */ +typedef HB_Bool (*HB_ShapeFunction)(HB_ShaperItem *shaper_item); +typedef void (*HB_AttributeFunction)(HB_Script script, const HB_UChar16 *string, hb_uint32 from, hb_uint32 len, HB_CharAttributes *attributes); + +typedef struct { + HB_ShapeFunction shape; + HB_AttributeFunction charAttributes; +} HB_ScriptEngine; + +extern const HB_ScriptEngine hb_scriptEngines[]; + +extern HB_Bool HB_BasicShape(HB_ShaperItem *shaper_item); +extern HB_Bool HB_GreekShape(HB_ShaperItem *shaper_item); +extern HB_Bool HB_TibetanShape(HB_ShaperItem *shaper_item); +extern HB_Bool HB_HebrewShape(HB_ShaperItem *shaper_item); +extern HB_Bool HB_ArabicShape(HB_ShaperItem *shaper_item); +extern HB_Bool HB_HangulShape(HB_ShaperItem *shaper_item); +extern HB_Bool HB_MyanmarShape(HB_ShaperItem *shaper_item); +extern HB_Bool HB_KhmerShape(HB_ShaperItem *shaper_item); +extern HB_Bool HB_IndicShape(HB_ShaperItem *shaper_item); + +extern void HB_TibetanAttributes(HB_Script script, const HB_UChar16 *string, hb_uint32 from, hb_uint32 len, HB_CharAttributes *attributes); + +extern void HB_MyanmarAttributes(HB_Script script, const HB_UChar16 *string, hb_uint32 from, hb_uint32 len, HB_CharAttributes *attributes); + +extern void HB_KhmerAttributes(HB_Script script, const HB_UChar16 *string, hb_uint32 from, hb_uint32 len, HB_CharAttributes *attributes); + +extern void HB_IndicAttributes(HB_Script script, const HB_UChar16 *string, hb_uint32 from, hb_uint32 len, HB_CharAttributes *attributes); + +extern void HB_ThaiAttributes(HB_Script script, const HB_UChar16 *string, hb_uint32 from, hb_uint32 len, HB_CharAttributes *attributes); + +typedef struct { + hb_uint32 tag; + hb_uint32 property; +} HB_OpenTypeFeature; + +#define PositioningProperties 0x80000000 + +HB_Bool HB_SelectScript(HB_ShaperItem *item, const HB_OpenTypeFeature *features); + +HB_Bool HB_OpenTypeShape(HB_ShaperItem *item, const hb_uint32 *properties); +HB_Bool HB_OpenTypePosition(HB_ShaperItem *item, int availableGlyphs, HB_Bool doLogClusters); + +void HB_HeuristicPosition(HB_ShaperItem *item); +void HB_HeuristicSetGlyphAttributes(HB_ShaperItem *item); + +#define HB_IsControlChar(uc) \ + ((uc >= 0x200b && uc <= 0x200f /* ZW Space, ZWNJ, ZWJ, LRM and RLM */) \ + || (uc >= 0x2028 && uc <= 0x202f /* LS, PS, LRE, RLE, PDF, LRO, RLO, NNBSP */) \ + || (uc >= 0x206a && uc <= 0x206f /* ISS, ASS, IAFS, AFS, NADS, NODS */)) + +HB_Bool HB_ConvertStringToGlyphIndices(HB_ShaperItem *shaper_item); + +#define HB_GetGlyphAdvances(shaper_item) \ + shaper_item->font->klass->getGlyphAdvances(shaper_item->font, \ + shaper_item->glyphs, shaper_item->num_glyphs, \ + shaper_item->advances, \ + shaper_item->face->current_flags); + +#define HB_DECLARE_STACKARRAY(Type, Name) \ + Type stack##Name[512]; \ + Type *Name = stack##Name; + +#define HB_INIT_STACKARRAY(Type, Name, Length) \ + if ((Length) >= 512) \ + Name = (Type *)malloc((Length) * sizeof(Type)); + +#define HB_STACKARRAY(Type, Name, Length) \ + HB_DECLARE_STACKARRAY(Type, Name) \ + HB_INIT_STACKARRAY(Type, Name, Length) + +#define HB_FREE_STACKARRAY(Name) \ + if (stack##Name != Name) \ + free(Name); + +HB_END_HEADER + +#endif diff --git a/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-shaper.cpp b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-shaper.cpp new file mode 100644 index 0000000..ce4d4ac --- /dev/null +++ b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-shaper.cpp @@ -0,0 +1,1338 @@ +/* + * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) + * + * This is part of HarfBuzz, an OpenType Layout engine library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#include "harfbuzz-shaper.h" +#include "harfbuzz-shaper-private.h" + +#include "harfbuzz-stream-private.h" +#include +#include + +#define HB_MIN(a, b) ((a) < (b) ? (a) : (b)) +#define HB_MAX(a, b) ((a) > (b) ? (a) : (b)) + +// ----------------------------------------------------------------------------------------------------- +// +// The line break algorithm. See http://www.unicode.org/reports/tr14/tr14-13.html +// +// ----------------------------------------------------------------------------------------------------- + +/* The Unicode algorithm does in our opinion allow line breaks at some + places they shouldn't be allowed. The following changes were thus + made in comparison to the Unicode reference: + + EX->AL from DB to IB + SY->AL from DB to IB + SY->PO from DB to IB + SY->PR from DB to IB + SY->OP from DB to IB + AL->PR from DB to IB + AL->PO from DB to IB + PR->PR from DB to IB + PO->PO from DB to IB + PR->PO from DB to IB + PO->PR from DB to IB + HY->PO from DB to IB + HY->PR from DB to IB + HY->OP from DB to IB + NU->EX from PB to IB + EX->PO from DB to IB +*/ + +// The following line break classes are not treated by the table: +// AI, BK, CB, CR, LF, NL, SA, SG, SP, XX + +enum break_class { + // the first 4 values have to agree with the enum in QCharAttributes + ProhibitedBreak, // PB in table + DirectBreak, // DB in table + IndirectBreak, // IB in table + CombiningIndirectBreak, // CI in table + CombiningProhibitedBreak // CP in table +}; +#define DB DirectBreak +#define IB IndirectBreak +#define CI CombiningIndirectBreak +#define CP CombiningProhibitedBreak +#define PB ProhibitedBreak + +static const hb_uint8 breakTable[HB_LineBreak_JT+1][HB_LineBreak_JT+1] = +{ +/* OP CL QU GL NS EX SY IS PR PO NU AL ID IN HY BA BB B2 ZW CM WJ H2 H3 JL JV JT */ +/* OP */ { PB, PB, PB, PB, PB, PB, PB, PB, PB, PB, PB, PB, PB, PB, PB, PB, PB, PB, PB, CP, PB, PB, PB, PB, PB, PB }, +/* CL */ { DB, PB, IB, IB, PB, PB, PB, PB, IB, IB, IB, IB, DB, DB, IB, IB, DB, DB, PB, CI, PB, DB, DB, DB, DB, DB }, +/* QU */ { PB, PB, IB, IB, IB, PB, PB, PB, IB, IB, IB, IB, IB, IB, IB, IB, IB, IB, PB, CI, PB, IB, IB, IB, IB, IB }, +/* GL */ { IB, PB, IB, IB, IB, PB, PB, PB, IB, IB, IB, IB, IB, IB, IB, IB, IB, IB, PB, CI, PB, IB, IB, IB, IB, IB }, +/* NS */ { DB, PB, IB, IB, IB, PB, PB, PB, DB, DB, DB, DB, DB, DB, IB, IB, DB, DB, PB, CI, PB, DB, DB, DB, DB, DB }, +/* EX */ { DB, PB, IB, IB, IB, PB, PB, PB, DB, IB, DB, IB, DB, DB, IB, IB, DB, DB, PB, CI, PB, DB, DB, DB, DB, DB }, +/* SY */ { IB, PB, IB, IB, IB, PB, PB, PB, IB, IB, IB, IB, DB, DB, IB, IB, DB, DB, PB, CI, PB, DB, DB, DB, DB, DB }, +/* IS */ { DB, PB, IB, IB, IB, PB, PB, PB, DB, DB, IB, IB, DB, DB, IB, IB, DB, DB, PB, CI, PB, DB, DB, DB, DB, DB }, +/* PR */ { IB, PB, IB, IB, IB, PB, PB, PB, IB, IB, IB, IB, IB, DB, IB, IB, DB, DB, PB, CI, PB, IB, IB, IB, IB, IB }, +/* PO */ { IB, PB, IB, IB, IB, PB, PB, PB, IB, IB, IB, IB, DB, DB, IB, IB, DB, DB, PB, CI, PB, DB, DB, DB, DB, DB }, +/* NU */ { IB, PB, IB, IB, IB, IB, PB, PB, IB, IB, IB, IB, DB, IB, IB, IB, DB, DB, PB, CI, PB, DB, DB, DB, DB, DB }, +/* AL */ { IB, PB, IB, IB, IB, PB, PB, PB, IB, IB, IB, IB, DB, IB, IB, IB, DB, DB, PB, CI, PB, DB, DB, DB, DB, DB }, +/* ID */ { DB, PB, IB, IB, IB, PB, PB, PB, DB, IB, DB, DB, DB, IB, IB, IB, DB, DB, PB, CI, PB, DB, DB, DB, DB, DB }, +/* IN */ { DB, PB, IB, IB, IB, PB, PB, PB, DB, DB, DB, DB, DB, IB, IB, IB, DB, DB, PB, CI, PB, DB, DB, DB, DB, DB }, +/* HY */ { IB, PB, IB, IB, IB, PB, PB, PB, IB, IB, IB, DB, DB, DB, IB, IB, DB, DB, PB, CI, PB, DB, DB, DB, DB, DB }, +/* BA */ { DB, PB, IB, IB, IB, PB, PB, PB, DB, DB, DB, DB, DB, DB, IB, IB, DB, DB, PB, CI, PB, DB, DB, DB, DB, DB }, +/* BB */ { IB, PB, IB, IB, IB, PB, PB, PB, IB, IB, IB, IB, IB, IB, IB, IB, IB, IB, PB, CI, PB, IB, IB, IB, IB, IB }, +/* B2 */ { DB, PB, IB, IB, IB, PB, PB, PB, DB, DB, DB, DB, DB, DB, IB, IB, DB, PB, PB, CI, PB, DB, DB, DB, DB, DB }, +/* ZW */ { DB, DB, DB, DB, DB, DB, DB, DB, DB, DB, DB, DB, DB, DB, DB, DB, DB, DB, PB, DB, DB, DB, DB, DB, DB, DB }, +/* CM */ { DB, PB, IB, IB, IB, PB, PB, PB, DB, DB, IB, IB, DB, IB, IB, IB, DB, DB, PB, CI, PB, DB, DB, DB, DB, DB }, +/* WJ */ { IB, PB, IB, IB, IB, PB, PB, PB, IB, IB, IB, IB, IB, IB, IB, IB, IB, IB, PB, CI, PB, IB, IB, IB, IB, IB }, +/* H2 */ { DB, PB, IB, IB, IB, PB, PB, PB, DB, IB, DB, DB, DB, IB, IB, IB, DB, DB, PB, CI, PB, DB, DB, DB, IB, IB }, +/* H3 */ { DB, PB, IB, IB, IB, PB, PB, PB, DB, IB, DB, DB, DB, IB, IB, IB, DB, DB, PB, CI, PB, DB, DB, DB, DB, IB }, +/* JL */ { DB, PB, IB, IB, IB, PB, PB, PB, DB, IB, DB, DB, DB, IB, IB, IB, DB, DB, PB, CI, PB, IB, IB, IB, IB, DB }, +/* JV */ { DB, PB, IB, IB, IB, PB, PB, PB, DB, IB, DB, DB, DB, IB, IB, IB, DB, DB, PB, CI, PB, DB, DB, DB, IB, IB }, +/* JT */ { DB, PB, IB, IB, IB, PB, PB, PB, DB, IB, DB, DB, DB, IB, IB, IB, DB, DB, PB, CI, PB, DB, DB, DB, DB, IB } +}; +#undef DB +#undef IB +#undef CI +#undef CP +#undef PB + +static const hb_uint8 graphemeTable[HB_Grapheme_LVT + 1][HB_Grapheme_LVT + 1] = +{ +// Other, CR, LF, Control,Extend,L, V, T, LV, LVT + { true , true , true , true , true , true , true , true , true , true }, // Other, + { true , true , true , true , true , true , true , true , true , true }, // CR, + { true , false, true , true , true , true , true , true , true , true }, // LF, + { true , true , true , true , true , true , true , true , true , true }, // Control, + { false, true , true , true , false, false, false, false, false, false }, // Extend, + { true , true , true , true , true , false, true , true , true , true }, // L, + { true , true , true , true , true , false, false, true , false, true }, // V, + { true , true , true , true , true , true , false, false, false, false }, // T, + { true , true , true , true , true , false, true , true , true , true }, // LV, + { true , true , true , true , true , false, true , true , true , true }, // LVT +}; + +static void calcLineBreaks(const HB_UChar16 *uc, hb_uint32 len, HB_CharAttributes *charAttributes) +{ + if (!len) + return; + + // ##### can this fail if the first char is a surrogate? + HB_LineBreakClass cls; + HB_GraphemeClass grapheme; + HB_GetGraphemeAndLineBreakClass(*uc, &grapheme, &cls); + // handle case where input starts with an LF + if (cls == HB_LineBreak_LF) + cls = HB_LineBreak_BK; + + charAttributes[0].whiteSpace = (cls == HB_LineBreak_SP || cls == HB_LineBreak_BK); + charAttributes[0].charStop = true; + + int lcls = cls; + for (hb_uint32 i = 1; i < len; ++i) { + charAttributes[i].whiteSpace = false; + charAttributes[i].charStop = true; + + HB_UChar32 code = uc[i]; + HB_GraphemeClass ngrapheme; + HB_LineBreakClass ncls; + HB_GetGraphemeAndLineBreakClass(code, &ngrapheme, &ncls); + charAttributes[i].charStop = graphemeTable[ngrapheme][grapheme]; + // handle surrogates + if (ncls == HB_LineBreak_SG) { + if (HB_IsHighSurrogate(uc[i]) && i < len - 1 && HB_IsLowSurrogate(uc[i+1])) { + continue; + } else if (HB_IsLowSurrogate(uc[i]) && HB_IsHighSurrogate(uc[i-1])) { + code = HB_SurrogateToUcs4(uc[i-1], uc[i]); + HB_GetGraphemeAndLineBreakClass(code, &ngrapheme, &ncls); + charAttributes[i].charStop = false; + } else { + ncls = HB_LineBreak_AL; + } + } + + // set white space and char stop flag + if (ncls >= HB_LineBreak_SP) + charAttributes[i].whiteSpace = true; + + HB_LineBreakType lineBreakType = HB_NoBreak; + if (cls >= HB_LineBreak_LF) { + lineBreakType = HB_ForcedBreak; + } else if(cls == HB_LineBreak_CR) { + lineBreakType = (ncls == HB_LineBreak_LF) ? HB_NoBreak : HB_ForcedBreak; + } + + if (ncls == HB_LineBreak_SP) + goto next_no_cls_update; + if (ncls >= HB_LineBreak_CR) + goto next; + + { + int tcls = ncls; + // for south east asian chars that require a complex (dictionary analysis), the unicode + // standard recommends to treat them as AL. thai_attributes and other attribute methods that + // do dictionary analysis can override + if (tcls >= HB_LineBreak_SA) + tcls = HB_LineBreak_AL; + if (cls >= HB_LineBreak_SA) + cls = HB_LineBreak_AL; + + int brk = breakTable[cls][tcls]; + switch (brk) { + case DirectBreak: + lineBreakType = HB_Break; + if (uc[i-1] == 0xad) // soft hyphen + lineBreakType = HB_SoftHyphen; + break; + case IndirectBreak: + lineBreakType = (lcls == HB_LineBreak_SP) ? HB_Break : HB_NoBreak; + break; + case CombiningIndirectBreak: + lineBreakType = HB_NoBreak; + if (lcls == HB_LineBreak_SP){ + if (i > 1) + charAttributes[i-2].lineBreakType = HB_Break; + } else { + goto next_no_cls_update; + } + break; + case CombiningProhibitedBreak: + lineBreakType = HB_NoBreak; + if (lcls != HB_LineBreak_SP) + goto next_no_cls_update; + case ProhibitedBreak: + default: + break; + } + } + next: + cls = ncls; + next_no_cls_update: + lcls = ncls; + grapheme = ngrapheme; + charAttributes[i-1].lineBreakType = lineBreakType; + } + charAttributes[len-1].lineBreakType = HB_ForcedBreak; +} + +// -------------------------------------------------------------------------------------------------------------------------------------------- +// +// Basic processing +// +// -------------------------------------------------------------------------------------------------------------------------------------------- + +static inline void positionCluster(HB_ShaperItem *item, int gfrom, int glast) +{ + int nmarks = glast - gfrom; + assert(nmarks > 0); + + HB_Glyph *glyphs = item->glyphs; + HB_GlyphAttributes *attributes = item->attributes; + + HB_GlyphMetrics baseMetrics; + item->font->klass->getGlyphMetrics(item->font, glyphs[gfrom], &baseMetrics); + + if (item->item.script == HB_Script_Hebrew + && (-baseMetrics.y) > baseMetrics.height) + // we need to attach below the baseline, because of the hebrew iud. + baseMetrics.height = -baseMetrics.y; + +// qDebug("---> positionCluster: cluster from %d to %d", gfrom, glast); +// qDebug("baseInfo: %f/%f (%f/%f) off=%f/%f", baseInfo.x, baseInfo.y, baseInfo.width, baseInfo.height, baseInfo.xoff, baseInfo.yoff); + + HB_Fixed size = item->font->klass->getFontMetric(item->font, HB_FontAscent) / 10; + HB_Fixed offsetBase = HB_FIXED_CONSTANT(1) + (size - HB_FIXED_CONSTANT(4)) / 4; + if (size > HB_FIXED_CONSTANT(4)) + offsetBase += HB_FIXED_CONSTANT(4); + else + offsetBase += size; + //qreal offsetBase = (size - 4) / 4 + qMin(size, 4) + 1; +// qDebug("offset = %f", offsetBase); + + bool rightToLeft = item->item.bidiLevel % 2; + + int i; + unsigned char lastCmb = 0; + HB_GlyphMetrics attachmentRect; + memset(&attachmentRect, 0, sizeof(attachmentRect)); + + for(i = 1; i <= nmarks; i++) { + HB_Glyph mark = glyphs[gfrom+i]; + HB_GlyphMetrics markMetrics; + item->font->klass->getGlyphMetrics(item->font, mark, &markMetrics); + HB_FixedPoint p; + p.x = p.y = 0; +// qDebug("markInfo: %f/%f (%f/%f) off=%f/%f", markInfo.x, markInfo.y, markInfo.width, markInfo.height, markInfo.xoff, markInfo.yoff); + + HB_Fixed offset = offsetBase; + unsigned char cmb = attributes[gfrom+i].combiningClass; + + // ### maybe the whole position determination should move down to heuristicSetGlyphAttributes. Would save some + // bits in the glyphAttributes structure. + if (cmb < 200) { + // fixed position classes. We approximate by mapping to one of the others. + // currently I added only the ones for arabic, hebrew, lao and thai. + + // for Lao and Thai marks with class 0, see below (heuristicSetGlyphAttributes) + + // add a bit more offset to arabic, a bit hacky + if (cmb >= 27 && cmb <= 36 && offset < 3) + offset +=1; + // below + if ((cmb >= 10 && cmb <= 18) || + cmb == 20 || cmb == 22 || + cmb == 29 || cmb == 32) + cmb = HB_Combining_Below; + // above + else if (cmb == 23 || cmb == 27 || cmb == 28 || + cmb == 30 || cmb == 31 || (cmb >= 33 && cmb <= 36)) + cmb = HB_Combining_Above; + //below-right + else if (cmb == 9 || cmb == 103 || cmb == 118) + cmb = HB_Combining_BelowRight; + // above-right + else if (cmb == 24 || cmb == 107 || cmb == 122) + cmb = HB_Combining_AboveRight; + else if (cmb == 25) + cmb = HB_Combining_AboveLeft; + // fixed: + // 19 21 + + } + + // combining marks of different class don't interact. Reset the rectangle. + if (cmb != lastCmb) { + //qDebug("resetting rect"); + attachmentRect = baseMetrics; + } + + switch(cmb) { + case HB_Combining_DoubleBelow: + // ### wrong in rtl context! + case HB_Combining_BelowLeft: + p.y += offset; + case HB_Combining_BelowLeftAttached: + p.x += attachmentRect.x - markMetrics.x; + p.y += (attachmentRect.y + attachmentRect.height) - markMetrics.y; + break; + case HB_Combining_Below: + p.y += offset; + case HB_Combining_BelowAttached: + p.x += attachmentRect.x - markMetrics.x; + p.y += (attachmentRect.y + attachmentRect.height) - markMetrics.y; + + p.x += (attachmentRect.width - markMetrics.width) / 2; + break; + case HB_Combining_BelowRight: + p.y += offset; + case HB_Combining_BelowRightAttached: + p.x += attachmentRect.x + attachmentRect.width - markMetrics.width - markMetrics.x; + p.y += attachmentRect.y + attachmentRect.height - markMetrics.y; + break; + case HB_Combining_Left: + p.x -= offset; + case HB_Combining_LeftAttached: + break; + case HB_Combining_Right: + p.x += offset; + case HB_Combining_RightAttached: + break; + case HB_Combining_DoubleAbove: + // ### wrong in RTL context! + case HB_Combining_AboveLeft: + p.y -= offset; + case HB_Combining_AboveLeftAttached: + p.x += attachmentRect.x - markMetrics.x; + p.y += attachmentRect.y - markMetrics.y - markMetrics.height; + break; + case HB_Combining_Above: + p.y -= offset; + case HB_Combining_AboveAttached: + p.x += attachmentRect.x - markMetrics.x; + p.y += attachmentRect.y - markMetrics.y - markMetrics.height; + + p.x += (attachmentRect.width - markMetrics.width) / 2; + break; + case HB_Combining_AboveRight: + p.y -= offset; + case HB_Combining_AboveRightAttached: + p.x += attachmentRect.x + attachmentRect.width - markMetrics.x - markMetrics.width; + p.y += attachmentRect.y - markMetrics.y - markMetrics.height; + break; + + case HB_Combining_IotaSubscript: + default: + break; + } +// qDebug("char=%x combiningClass = %d offset=%f/%f", mark, cmb, p.x(), p.y()); + markMetrics.x += p.x; + markMetrics.y += p.y; + + HB_GlyphMetrics unitedAttachmentRect = attachmentRect; + unitedAttachmentRect.x = HB_MIN(attachmentRect.x, markMetrics.x); + unitedAttachmentRect.y = HB_MIN(attachmentRect.y, markMetrics.y); + unitedAttachmentRect.width = HB_MAX(attachmentRect.x + attachmentRect.width, markMetrics.x + markMetrics.width) - unitedAttachmentRect.x; + unitedAttachmentRect.height = HB_MAX(attachmentRect.y + attachmentRect.height, markMetrics.y + markMetrics.height) - unitedAttachmentRect.y; + attachmentRect = unitedAttachmentRect; + + lastCmb = cmb; + if (rightToLeft) { + item->offsets[gfrom+i].x = p.x; + item->offsets[gfrom+i].y = p.y; + } else { + item->offsets[gfrom+i].x = p.x - baseMetrics.xOffset; + item->offsets[gfrom+i].y = p.y - baseMetrics.yOffset; + } + item->advances[gfrom+i] = 0; + } +} + +void HB_HeuristicPosition(HB_ShaperItem *item) +{ + HB_GetGlyphAdvances(item); + HB_GlyphAttributes *attributes = item->attributes; + + int cEnd = -1; + int i = item->num_glyphs; + while (i--) { + if (cEnd == -1 && attributes[i].mark) { + cEnd = i; + } else if (cEnd != -1 && !attributes[i].mark) { + positionCluster(item, i, cEnd); + cEnd = -1; + } + } +} + +// set the glyph attributes heuristically. Assumes a 1 to 1 relationship between chars and glyphs +// and no reordering. +// also computes logClusters heuristically +void HB_HeuristicSetGlyphAttributes(HB_ShaperItem *item) +{ + const HB_UChar16 *uc = item->string + item->item.pos; + hb_uint32 length = item->item.length; + + // ### zeroWidth and justification are missing here!!!!! + + assert(item->num_glyphs <= length); + +// qDebug("QScriptEngine::heuristicSetGlyphAttributes, num_glyphs=%d", item->num_glyphs); + HB_GlyphAttributes *attributes = item->attributes; + unsigned short *logClusters = item->log_clusters; + + hb_uint32 glyph_pos = 0; + hb_uint32 i; + for (i = 0; i < length; i++) { + if (HB_IsHighSurrogate(uc[i]) && i < length - 1 + && HB_IsLowSurrogate(uc[i + 1])) { + logClusters[i] = glyph_pos; + logClusters[++i] = glyph_pos; + } else { + logClusters[i] = glyph_pos; + } + ++glyph_pos; + } + assert(glyph_pos == item->num_glyphs); + + // first char in a run is never (treated as) a mark + int cStart = 0; + const bool symbolFont = item->face->isSymbolFont; + attributes[0].mark = false; + attributes[0].clusterStart = true; + attributes[0].dontPrint = (!symbolFont && uc[0] == 0x00ad) || HB_IsControlChar(uc[0]); + + int pos = 0; + HB_CharCategory lastCat; + int dummy; + HB_GetUnicodeCharProperties(uc[0], &lastCat, &dummy); + for (i = 1; i < length; ++i) { + if (logClusters[i] == pos) + // same glyph + continue; + ++pos; + while (pos < logClusters[i]) { + attributes[pos] = attributes[pos-1]; + ++pos; + } + // hide soft-hyphens by default + if ((!symbolFont && uc[i] == 0x00ad) || HB_IsControlChar(uc[i])) + attributes[pos].dontPrint = true; + HB_CharCategory cat; + int cmb; + HB_GetUnicodeCharProperties(uc[i], &cat, &cmb); + if (cat != HB_Mark_NonSpacing) { + attributes[pos].mark = false; + attributes[pos].clusterStart = true; + attributes[pos].combiningClass = 0; + cStart = logClusters[i]; + } else { + if (cmb == 0) { + // Fix 0 combining classes + if ((uc[pos] & 0xff00) == 0x0e00) { + // thai or lao + if (uc[pos] == 0xe31 || + uc[pos] == 0xe34 || + uc[pos] == 0xe35 || + uc[pos] == 0xe36 || + uc[pos] == 0xe37 || + uc[pos] == 0xe47 || + uc[pos] == 0xe4c || + uc[pos] == 0xe4d || + uc[pos] == 0xe4e) { + cmb = HB_Combining_AboveRight; + } else if (uc[pos] == 0xeb1 || + uc[pos] == 0xeb4 || + uc[pos] == 0xeb5 || + uc[pos] == 0xeb6 || + uc[pos] == 0xeb7 || + uc[pos] == 0xebb || + uc[pos] == 0xecc || + uc[pos] == 0xecd) { + cmb = HB_Combining_Above; + } else if (uc[pos] == 0xebc) { + cmb = HB_Combining_Below; + } + } + } + + attributes[pos].mark = true; + attributes[pos].clusterStart = false; + attributes[pos].combiningClass = cmb; + logClusters[i] = cStart; + } + // one gets an inter character justification point if the current char is not a non spacing mark. + // as then the current char belongs to the last one and one gets a space justification point + // after the space char. + if (lastCat == HB_Separator_Space) + attributes[pos-1].justification = HB_Space; + else if (cat != HB_Mark_NonSpacing) + attributes[pos-1].justification = HB_Character; + else + attributes[pos-1].justification = HB_NoJustification; + + lastCat = cat; + } + pos = logClusters[length-1]; + if (lastCat == HB_Separator_Space) + attributes[pos].justification = HB_Space; + else + attributes[pos].justification = HB_Character; +} + +#ifndef NO_OPENTYPE +static const HB_OpenTypeFeature basic_features[] = { + { HB_MAKE_TAG('c', 'c', 'm', 'p'), CcmpProperty }, + { HB_MAKE_TAG('l', 'i', 'g', 'a'), CcmpProperty }, + { HB_MAKE_TAG('c', 'l', 'i', 'g'), CcmpProperty }, + {0, 0} +}; +#endif + +HB_Bool HB_ConvertStringToGlyphIndices(HB_ShaperItem *shaper_item) +{ + if (shaper_item->glyphIndicesPresent) { + shaper_item->num_glyphs = shaper_item->initialGlyphCount; + shaper_item->glyphIndicesPresent = false; + return true; + } + return shaper_item->font->klass + ->convertStringToGlyphIndices(shaper_item->font, + shaper_item->string + shaper_item->item.pos, shaper_item->item.length, + shaper_item->glyphs, &shaper_item->num_glyphs, + shaper_item->item.bidiLevel % 2); +} + +HB_Bool HB_BasicShape(HB_ShaperItem *shaper_item) +{ +#ifndef NO_OPENTYPE + const int availableGlyphs = shaper_item->num_glyphs; +#endif + + if (!HB_ConvertStringToGlyphIndices(shaper_item)) + return false; + + HB_HeuristicSetGlyphAttributes(shaper_item); + +#ifndef NO_OPENTYPE + if (HB_SelectScript(shaper_item, basic_features)) { + HB_OpenTypeShape(shaper_item, /*properties*/0); + return HB_OpenTypePosition(shaper_item, availableGlyphs, /*doLogClusters*/true); + } +#endif + + HB_HeuristicPosition(shaper_item); + return true; +} + +const HB_ScriptEngine HB_ScriptEngines[] = { + // Common + { HB_BasicShape, 0}, + // Greek + { HB_GreekShape, 0}, + // Cyrillic + { HB_BasicShape, 0}, + // Armenian + { HB_BasicShape, 0}, + // Hebrew + { HB_HebrewShape, 0 }, + // Arabic + { HB_ArabicShape, 0}, + // Syriac + { HB_ArabicShape, 0}, + // Thaana + { HB_BasicShape, 0 }, + // Devanagari + { HB_IndicShape, HB_IndicAttributes }, + // Bengali + { HB_IndicShape, HB_IndicAttributes }, + // Gurmukhi + { HB_IndicShape, HB_IndicAttributes }, + // Gujarati + { HB_IndicShape, HB_IndicAttributes }, + // Oriya + { HB_IndicShape, HB_IndicAttributes }, + // Tamil + { HB_IndicShape, HB_IndicAttributes }, + // Telugu + { HB_IndicShape, HB_IndicAttributes }, + // Kannada + { HB_IndicShape, HB_IndicAttributes }, + // Malayalam + { HB_IndicShape, HB_IndicAttributes }, + // Sinhala + { HB_IndicShape, HB_IndicAttributes }, + // Thai + { HB_BasicShape, HB_ThaiAttributes }, + // Lao + { HB_BasicShape, 0 }, + // Tibetan + { HB_TibetanShape, HB_TibetanAttributes }, + // Myanmar + { HB_MyanmarShape, HB_MyanmarAttributes }, + // Georgian + { HB_BasicShape, 0 }, + // Hangul + { HB_HangulShape, 0 }, + // Ogham + { HB_BasicShape, 0 }, + // Runic + { HB_BasicShape, 0 }, + // Khmer + { HB_KhmerShape, HB_KhmerAttributes }, + // N'Ko + { HB_ArabicShape, 0} +}; + +void HB_GetCharAttributes(const HB_UChar16 *string, hb_uint32 stringLength, + const HB_ScriptItem *items, hb_uint32 numItems, + HB_CharAttributes *attributes) +{ + calcLineBreaks(string, stringLength, attributes); + + for (hb_uint32 i = 0; i < numItems; ++i) { + HB_Script script = items[i].script; + if (script == HB_Script_Inherited) + script = HB_Script_Common; + HB_AttributeFunction attributeFunction = HB_ScriptEngines[script].charAttributes; + if (!attributeFunction) + continue; + attributeFunction(script, string, items[i].pos, items[i].length, attributes); + } +} + + +enum BreakRule { NoBreak = 0, Break = 1, Middle = 2 }; + +static const hb_uint8 wordbreakTable[HB_Word_ExtendNumLet + 1][HB_Word_ExtendNumLet + 1] = { +// Other Format Katakana ALetter MidLetter MidNum Numeric ExtendNumLet + { Break, Break, Break, Break, Break, Break, Break, Break }, // Other + { Break, Break, Break, Break, Break, Break, Break, Break }, // Format + { Break, Break, NoBreak, Break, Break, Break, Break, NoBreak }, // Katakana + { Break, Break, Break, NoBreak, Middle, Break, NoBreak, NoBreak }, // ALetter + { Break, Break, Break, Break, Break, Break, Break, Break }, // MidLetter + { Break, Break, Break, Break, Break, Break, Break, Break }, // MidNum + { Break, Break, Break, NoBreak, Break, Middle, NoBreak, NoBreak }, // Numeric + { Break, Break, NoBreak, NoBreak, Break, Break, NoBreak, NoBreak }, // ExtendNumLet +}; + +void HB_GetWordBoundaries(const HB_UChar16 *string, hb_uint32 stringLength, + const HB_ScriptItem * /*items*/, hb_uint32 /*numItems*/, + HB_CharAttributes *attributes) +{ + if (stringLength == 0) + return; + unsigned int brk = HB_GetWordClass(string[0]); + attributes[0].wordBoundary = true; + for (hb_uint32 i = 1; i < stringLength; ++i) { + if (!attributes[i].charStop) { + attributes[i].wordBoundary = false; + continue; + } + hb_uint32 nbrk = HB_GetWordClass(string[i]); + if (nbrk == HB_Word_Format) { + attributes[i].wordBoundary = (HB_GetSentenceClass(string[i-1]) == HB_Sentence_Sep); + continue; + } + BreakRule rule = (BreakRule)wordbreakTable[brk][nbrk]; + if (rule == Middle) { + rule = Break; + hb_uint32 lookahead = i + 1; + while (lookahead < stringLength) { + hb_uint32 testbrk = HB_GetWordClass(string[lookahead]); + if (testbrk == HB_Word_Format && HB_GetSentenceClass(string[lookahead]) != HB_Sentence_Sep) { + ++lookahead; + continue; + } + if (testbrk == brk) { + rule = NoBreak; + while (i < lookahead) + attributes[i++].wordBoundary = false; + nbrk = testbrk; + } + break; + } + } + attributes[i].wordBoundary = (rule == Break); + brk = nbrk; + } +} + + +enum SentenceBreakStates { + SB_Initial, + SB_Upper, + SB_UpATerm, + SB_ATerm, + SB_ATermC, + SB_ACS, + SB_STerm, + SB_STermC, + SB_SCS, + SB_BAfter, + SB_Break, + SB_Look +}; + +static const hb_uint8 sentenceBreakTable[HB_Sentence_Close + 1][HB_Sentence_Close + 1] = { +// Other Sep Format Sp Lower Upper OLetter Numeric ATerm STerm Close + { SB_Initial, SB_BAfter , SB_Initial, SB_Initial, SB_Initial, SB_Upper , SB_Initial, SB_Initial, SB_ATerm , SB_STerm , SB_Initial }, // SB_Initial, + { SB_Initial, SB_BAfter , SB_Upper , SB_Initial, SB_Initial, SB_Upper , SB_Initial, SB_Initial, SB_UpATerm, SB_STerm , SB_Initial }, // SB_Upper + + { SB_Look , SB_BAfter , SB_UpATerm, SB_ACS , SB_Initial, SB_Upper , SB_Break , SB_Initial, SB_ATerm , SB_STerm , SB_ATermC }, // SB_UpATerm + { SB_Look , SB_BAfter , SB_ATerm , SB_ACS , SB_Initial, SB_Break , SB_Break , SB_Initial, SB_ATerm , SB_STerm , SB_ATermC }, // SB_ATerm + { SB_Look , SB_BAfter , SB_ATermC , SB_ACS , SB_Initial, SB_Break , SB_Break , SB_Look , SB_ATerm , SB_STerm , SB_ATermC }, // SB_ATermC, + { SB_Look , SB_BAfter , SB_ACS , SB_ACS , SB_Initial, SB_Break , SB_Break , SB_Look , SB_ATerm , SB_STerm , SB_Look }, // SB_ACS, + + { SB_Break , SB_BAfter , SB_STerm , SB_SCS , SB_Break , SB_Break , SB_Break , SB_Break , SB_ATerm , SB_STerm , SB_STermC }, // SB_STerm, + { SB_Break , SB_BAfter , SB_STermC , SB_SCS , SB_Break , SB_Break , SB_Break , SB_Break , SB_ATerm , SB_STerm , SB_STermC }, // SB_STermC, + { SB_Break , SB_BAfter , SB_SCS , SB_SCS , SB_Break , SB_Break , SB_Break , SB_Break , SB_ATerm , SB_STerm , SB_Break }, // SB_SCS, + { SB_Break , SB_Break , SB_Break , SB_Break , SB_Break , SB_Break , SB_Break , SB_Break , SB_Break , SB_Break , SB_Break }, // SB_BAfter, +}; + +void HB_GetSentenceBoundaries(const HB_UChar16 *string, hb_uint32 stringLength, + const HB_ScriptItem * /*items*/, hb_uint32 /*numItems*/, + HB_CharAttributes *attributes) +{ + if (stringLength == 0) + return; + hb_uint32 brk = sentenceBreakTable[SB_Initial][HB_GetSentenceClass(string[0])]; + attributes[0].sentenceBoundary = true; + for (hb_uint32 i = 1; i < stringLength; ++i) { + if (!attributes[i].charStop) { + attributes[i].sentenceBoundary = false; + continue; + } + brk = sentenceBreakTable[brk][HB_GetSentenceClass(string[i])]; + if (brk == SB_Look) { + brk = SB_Break; + hb_uint32 lookahead = i + 1; + while (lookahead < stringLength) { + hb_uint32 sbrk = HB_GetSentenceClass(string[lookahead]); + if (sbrk != HB_Sentence_Other && sbrk != HB_Sentence_Numeric && sbrk != HB_Sentence_Close) { + break; + } else if (sbrk == HB_Sentence_Lower) { + brk = SB_Initial; + break; + } + ++lookahead; + } + if (brk == SB_Initial) { + while (i < lookahead) + attributes[i++].sentenceBoundary = false; + } + } + if (brk == SB_Break) { + attributes[i].sentenceBoundary = true; + brk = sentenceBreakTable[SB_Initial][HB_GetSentenceClass(string[i])]; + } else { + attributes[i].sentenceBoundary = false; + } + } +} + + +static inline char *tag_to_string(HB_UInt tag) +{ + static char string[5]; + string[0] = (tag >> 24)&0xff; + string[1] = (tag >> 16)&0xff; + string[2] = (tag >> 8)&0xff; + string[3] = tag&0xff; + string[4] = 0; + return string; +} + +#ifdef OT_DEBUG +static void dump_string(HB_Buffer buffer) +{ + for (uint i = 0; i < buffer->in_length; ++i) { + qDebug(" %x: cluster=%d", buffer->in_string[i].gindex, buffer->in_string[i].cluster); + } +} +#define DEBUG printf +#else +#define DEBUG if (1) ; else printf +#endif + +#define DefaultLangSys 0xffff +#define DefaultScript HB_MAKE_TAG('D', 'F', 'L', 'T') + +enum { + RequiresGsub = 1, + RequiresGpos = 2 +}; + +struct OTScripts { + unsigned int tag; + int flags; +}; +static const OTScripts ot_scripts [] = { + // Common + { HB_MAKE_TAG('l', 'a', 't', 'n'), 0 }, + // Greek + { HB_MAKE_TAG('g', 'r', 'e', 'k'), 0 }, + // Cyrillic + { HB_MAKE_TAG('c', 'y', 'r', 'l'), 0 }, + // Armenian + { HB_MAKE_TAG('a', 'r', 'm', 'n'), 0 }, + // Hebrew + { HB_MAKE_TAG('h', 'e', 'b', 'r'), 1 }, + // Arabic + { HB_MAKE_TAG('a', 'r', 'a', 'b'), 1 }, + // Syriac + { HB_MAKE_TAG('s', 'y', 'r', 'c'), 1 }, + // Thaana + { HB_MAKE_TAG('t', 'h', 'a', 'a'), 1 }, + // Devanagari + { HB_MAKE_TAG('d', 'e', 'v', 'a'), 1 }, + // Bengali + { HB_MAKE_TAG('b', 'e', 'n', 'g'), 1 }, + // Gurmukhi + { HB_MAKE_TAG('g', 'u', 'r', 'u'), 1 }, + // Gujarati + { HB_MAKE_TAG('g', 'u', 'j', 'r'), 1 }, + // Oriya + { HB_MAKE_TAG('o', 'r', 'y', 'a'), 1 }, + // Tamil + { HB_MAKE_TAG('t', 'a', 'm', 'l'), 1 }, + // Telugu + { HB_MAKE_TAG('t', 'e', 'l', 'u'), 1 }, + // Kannada + { HB_MAKE_TAG('k', 'n', 'd', 'a'), 1 }, + // Malayalam + { HB_MAKE_TAG('m', 'l', 'y', 'm'), 1 }, + // Sinhala + { HB_MAKE_TAG('s', 'i', 'n', 'h'), 1 }, + // Thai + { HB_MAKE_TAG('t', 'h', 'a', 'i'), 1 }, + // Lao + { HB_MAKE_TAG('l', 'a', 'o', ' '), 1 }, + // Tibetan + { HB_MAKE_TAG('t', 'i', 'b', 't'), 1 }, + // Myanmar + { HB_MAKE_TAG('m', 'y', 'm', 'r'), 1 }, + // Georgian + { HB_MAKE_TAG('g', 'e', 'o', 'r'), 0 }, + // Hangul + { HB_MAKE_TAG('h', 'a', 'n', 'g'), 1 }, + // Ogham + { HB_MAKE_TAG('o', 'g', 'a', 'm'), 0 }, + // Runic + { HB_MAKE_TAG('r', 'u', 'n', 'r'), 0 }, + // Khmer + { HB_MAKE_TAG('k', 'h', 'm', 'r'), 1 }, + // N'Ko + { HB_MAKE_TAG('n', 'k', 'o', ' '), 1 } +}; +enum { NumOTScripts = sizeof(ot_scripts)/sizeof(OTScripts) }; + +static HB_Bool checkScript(HB_Face face, int script) +{ + assert(script < HB_ScriptCount); + + if (!face->gsub && !face->gpos) + return false; + + unsigned int tag = ot_scripts[script].tag; + int requirements = ot_scripts[script].flags; + + if (requirements & RequiresGsub) { + if (!face->gsub) + return false; + + HB_UShort script_index; + HB_Error error = HB_GSUB_Select_Script(face->gsub, tag, &script_index); + if (error) { + DEBUG("could not select script %d in GSub table: %d", (int)script, error); + error = HB_GSUB_Select_Script(face->gsub, HB_MAKE_TAG('D', 'F', 'L', 'T'), &script_index); + if (error) + return false; + } + } + + if (requirements & RequiresGpos) { + if (!face->gpos) + return false; + + HB_UShort script_index; + HB_Error error = HB_GPOS_Select_Script(face->gpos, script, &script_index); + if (error) { + DEBUG("could not select script in gpos table: %d", error); + error = HB_GPOS_Select_Script(face->gpos, HB_MAKE_TAG('D', 'F', 'L', 'T'), &script_index); + if (error) + return false; + } + + } + return true; +} + +static HB_Stream getTableStream(void *font, HB_GetFontTableFunc tableFunc, HB_Tag tag) +{ + HB_Error error; + HB_UInt length = 0; + HB_Stream stream = 0; + + if (!font) + return 0; + + error = tableFunc(font, tag, 0, &length); + if (error) + return 0; + stream = (HB_Stream)malloc(sizeof(HB_StreamRec)); + if (!stream) + return 0; + stream->base = (HB_Byte*)malloc(length); + if (!stream->base) { + free(stream); + return 0; + } + error = tableFunc(font, tag, stream->base, &length); + if (error) { + _hb_close_stream(stream); + return 0; + } + stream->size = length; + stream->pos = 0; + stream->cursor = NULL; + return stream; +} + +HB_Face HB_NewFace(void *font, HB_GetFontTableFunc tableFunc) +{ + HB_Face face = (HB_Face )malloc(sizeof(HB_FaceRec)); + if (!face) + return 0; + + face->isSymbolFont = false; + face->gdef = 0; + face->gpos = 0; + face->gsub = 0; + face->current_script = HB_ScriptCount; + face->current_flags = HB_ShaperFlag_Default; + face->has_opentype_kerning = false; + face->tmpAttributes = 0; + face->tmpLogClusters = 0; + face->glyphs_substituted = false; + face->buffer = 0; + + HB_Error error = HB_Err_Ok; + HB_Stream stream; + HB_Stream gdefStream; + + gdefStream = getTableStream(font, tableFunc, TTAG_GDEF); + error = HB_Err_Not_Covered; + if (!gdefStream || (error = HB_Load_GDEF_Table(gdefStream, &face->gdef))) { + //DEBUG("error loading gdef table: %d", error); + face->gdef = 0; + } + + //DEBUG() << "trying to load gsub table"; + stream = getTableStream(font, tableFunc, TTAG_GSUB); + error = HB_Err_Not_Covered; + if (!stream || (error = HB_Load_GSUB_Table(stream, &face->gsub, face->gdef, gdefStream))) { + face->gsub = 0; + if (error != HB_Err_Not_Covered) { + //DEBUG("error loading gsub table: %d", error); + } else { + //DEBUG("face doesn't have a gsub table"); + } + } + _hb_close_stream(stream); + + stream = getTableStream(font, tableFunc, TTAG_GPOS); + error = HB_Err_Not_Covered; + if (!stream || (error = HB_Load_GPOS_Table(stream, &face->gpos, face->gdef, gdefStream))) { + face->gpos = 0; + DEBUG("error loading gpos table: %d", error); + } + _hb_close_stream(stream); + + _hb_close_stream(gdefStream); + + for (unsigned int i = 0; i < HB_ScriptCount; ++i) + face->supported_scripts[i] = checkScript(face, i); + + if (hb_buffer_new(&face->buffer) != HB_Err_Ok) { + HB_FreeFace(face); + return 0; + } + + return face; +} + +void HB_FreeFace(HB_Face face) +{ + if (!face) + return; + if (face->gpos) + HB_Done_GPOS_Table(face->gpos); + if (face->gsub) + HB_Done_GSUB_Table(face->gsub); + if (face->gdef) + HB_Done_GDEF_Table(face->gdef); + if (face->buffer) + hb_buffer_free(face->buffer); + if (face->tmpAttributes) + free(face->tmpAttributes); + if (face->tmpLogClusters) + free(face->tmpLogClusters); + free(face); +} + +HB_Bool HB_SelectScript(HB_ShaperItem *shaper_item, const HB_OpenTypeFeature *features) +{ + HB_Script script = shaper_item->item.script; + + if (!shaper_item->face->supported_scripts[script]) + return false; + + HB_Face face = shaper_item->face; + if (face->current_script == script && face->current_flags == shaper_item->shaperFlags) + return true; + + face->current_script = script; + face->current_flags = shaper_item->shaperFlags; + + assert(script < HB_ScriptCount); + // find script in our list of supported scripts. + unsigned int tag = ot_scripts[script].tag; + + if (face->gsub && features) { +#ifdef OT_DEBUG + { + HB_FeatureList featurelist = face->gsub->FeatureList; + int numfeatures = featurelist.FeatureCount; + DEBUG("gsub table has %d features", numfeatures); + for (int i = 0; i < numfeatures; i++) { + HB_FeatureRecord *r = featurelist.FeatureRecord + i; + DEBUG(" feature '%s'", tag_to_string(r->FeatureTag)); + } + } +#endif + HB_GSUB_Clear_Features(face->gsub); + HB_UShort script_index; + HB_Error error = HB_GSUB_Select_Script(face->gsub, tag, &script_index); + if (!error) { + DEBUG("script %s has script index %d", tag_to_string(script), script_index); + while (features->tag) { + HB_UShort feature_index; + error = HB_GSUB_Select_Feature(face->gsub, features->tag, script_index, 0xffff, &feature_index); + if (!error) { + DEBUG(" adding feature %s", tag_to_string(features->tag)); + HB_GSUB_Add_Feature(face->gsub, feature_index, features->property); + } + ++features; + } + } + } + + // reset + face->has_opentype_kerning = false; + + if (face->gpos) { + HB_GPOS_Clear_Features(face->gpos); + HB_UShort script_index; + HB_Error error = HB_GPOS_Select_Script(face->gpos, tag, &script_index); + if (!error) { +#ifdef OT_DEBUG + { + HB_FeatureList featurelist = face->gpos->FeatureList; + int numfeatures = featurelist.FeatureCount; + DEBUG("gpos table has %d features", numfeatures); + for(int i = 0; i < numfeatures; i++) { + HB_FeatureRecord *r = featurelist.FeatureRecord + i; + HB_UShort feature_index; + HB_GPOS_Select_Feature(face->gpos, r->FeatureTag, script_index, 0xffff, &feature_index); + DEBUG(" feature '%s'", tag_to_string(r->FeatureTag)); + } + } +#endif + HB_UInt *feature_tag_list_buffer; + error = HB_GPOS_Query_Features(face->gpos, script_index, 0xffff, &feature_tag_list_buffer); + if (!error) { + HB_UInt *feature_tag_list = feature_tag_list_buffer; + while (*feature_tag_list) { + HB_UShort feature_index; + if (*feature_tag_list == HB_MAKE_TAG('k', 'e', 'r', 'n')) { + if (face->current_flags & HB_ShaperFlag_NoKerning) { + ++feature_tag_list; + continue; + } + face->has_opentype_kerning = true; + } + error = HB_GPOS_Select_Feature(face->gpos, *feature_tag_list, script_index, 0xffff, &feature_index); + if (!error) + HB_GPOS_Add_Feature(face->gpos, feature_index, PositioningProperties); + ++feature_tag_list; + } + FREE(feature_tag_list_buffer); + } + } + } + + return true; +} + +HB_Bool HB_OpenTypeShape(HB_ShaperItem *item, const hb_uint32 *properties) +{ + HB_GlyphAttributes *tmpAttributes; + unsigned int *tmpLogClusters; + + HB_Face face = item->face; + + face->length = item->num_glyphs; + + hb_buffer_clear(face->buffer); + + tmpAttributes = (HB_GlyphAttributes *) realloc(face->tmpAttributes, face->length*sizeof(HB_GlyphAttributes)); + if (!tmpAttributes) + return false; + face->tmpAttributes = tmpAttributes; + + tmpLogClusters = (unsigned int *) realloc(face->tmpLogClusters, face->length*sizeof(unsigned int)); + if (!tmpLogClusters) + return false; + face->tmpLogClusters = tmpLogClusters; + + for (int i = 0; i < face->length; ++i) { + hb_buffer_add_glyph(face->buffer, item->glyphs[i], properties ? properties[i] : 0, i); + face->tmpAttributes[i] = item->attributes[i]; + face->tmpLogClusters[i] = item->log_clusters[i]; + } + +#ifdef OT_DEBUG + DEBUG("-----------------------------------------"); +// DEBUG("log clusters before shaping:"); +// for (int j = 0; j < length; j++) +// DEBUG(" log[%d] = %d", j, item->log_clusters[j]); + DEBUG("original glyphs: %p", item->glyphs); + for (int i = 0; i < length; ++i) + DEBUG(" glyph=%4x", hb_buffer->in_string[i].gindex); +// dump_string(hb_buffer); +#endif + + face->glyphs_substituted = false; + if (face->gsub) { + unsigned int error = HB_GSUB_Apply_String(face->gsub, face->buffer); + if (error && error != HB_Err_Not_Covered) + return false; + face->glyphs_substituted = (error != HB_Err_Not_Covered); + } + +#ifdef OT_DEBUG +// DEBUG("log clusters before shaping:"); +// for (int j = 0; j < length; j++) +// DEBUG(" log[%d] = %d", j, item->log_clusters[j]); + DEBUG("shaped glyphs:"); + for (int i = 0; i < length; ++i) + DEBUG(" glyph=%4x", hb_buffer->in_string[i].gindex); + DEBUG("-----------------------------------------"); +// dump_string(hb_buffer); +#endif + + return true; +} + +HB_Bool HB_OpenTypePosition(HB_ShaperItem *item, int availableGlyphs, HB_Bool doLogClusters) +{ + HB_Face face = item->face; + + bool glyphs_positioned = false; + if (face->gpos) { + if (face->buffer->positions) + memset(face->buffer->positions, 0, face->buffer->in_length*sizeof(HB_PositionRec)); + // #### check that passing "false,false" is correct + glyphs_positioned = HB_GPOS_Apply_String(item->font, face->gpos, face->current_flags, face->buffer, false, false) != HB_Err_Not_Covered; + } + + if (!face->glyphs_substituted && !glyphs_positioned) { + HB_GetGlyphAdvances(item); + return true; // nothing to do for us + } + + // make sure we have enough space to write everything back + if (availableGlyphs < (int)face->buffer->in_length) { + item->num_glyphs = face->buffer->in_length; + return false; + } + + HB_Glyph *glyphs = item->glyphs; + HB_GlyphAttributes *attributes = item->attributes; + + for (unsigned int i = 0; i < face->buffer->in_length; ++i) { + glyphs[i] = face->buffer->in_string[i].gindex; + attributes[i] = face->tmpAttributes[face->buffer->in_string[i].cluster]; + if (i && face->buffer->in_string[i].cluster == face->buffer->in_string[i-1].cluster) + attributes[i].clusterStart = false; + } + item->num_glyphs = face->buffer->in_length; + + if (doLogClusters && face->glyphs_substituted) { + // we can't do this for indic, as we pass the stuf in syllables and it's easier to do it in the shaper. + unsigned short *logClusters = item->log_clusters; + int clusterStart = 0; + int oldCi = 0; + // #### the reconstruction of the logclusters currently does not work if the original string + // contains surrogate pairs + for (unsigned int i = 0; i < face->buffer->in_length; ++i) { + int ci = face->buffer->in_string[i].cluster; + // DEBUG(" ci[%d] = %d mark=%d, cmb=%d, cs=%d", + // i, ci, glyphAttributes[i].mark, glyphAttributes[i].combiningClass, glyphAttributes[i].clusterStart); + if (!attributes[i].mark && attributes[i].clusterStart && ci != oldCi) { + for (int j = oldCi; j < ci; j++) + logClusters[j] = clusterStart; + clusterStart = i; + oldCi = ci; + } + } + for (int j = oldCi; j < face->length; j++) + logClusters[j] = clusterStart; + } + + // calulate the advances for the shaped glyphs +// DEBUG("unpositioned: "); + + // positioning code: + if (glyphs_positioned) { + HB_GetGlyphAdvances(item); + HB_Position positions = face->buffer->positions; + HB_Fixed *advances = item->advances; + +// DEBUG("positioned glyphs:"); + for (unsigned int i = 0; i < face->buffer->in_length; i++) { +// DEBUG(" %d:\t orig advance: (%d/%d)\tadv=(%d/%d)\tpos=(%d/%d)\tback=%d\tnew_advance=%d", i, +// glyphs[i].advance.x.toInt(), glyphs[i].advance.y.toInt(), +// (int)(positions[i].x_advance >> 6), (int)(positions[i].y_advance >> 6), +// (int)(positions[i].x_pos >> 6), (int)(positions[i].y_pos >> 6), +// positions[i].back, positions[i].new_advance); + + HB_Fixed adjustment = (item->item.bidiLevel % 2) ? -positions[i].x_advance : positions[i].x_advance; + + if (!(face->current_flags & HB_ShaperFlag_UseDesignMetrics)) + adjustment = HB_FIXED_ROUND(adjustment); + + if (positions[i].new_advance) { + advances[i] = adjustment; + } else { + advances[i] += adjustment; + } + + int back = 0; + HB_FixedPoint *offsets = item->offsets; + offsets[i].x = positions[i].x_pos; + offsets[i].y = positions[i].y_pos; + while (positions[i - back].back) { + back += positions[i - back].back; + offsets[i].x += positions[i - back].x_pos; + offsets[i].y += positions[i - back].y_pos; + } + offsets[i].y = -offsets[i].y; + + if (item->item.bidiLevel % 2) { + // ### may need to go back multiple glyphs like in ltr + back = positions[i].back; + while (back--) + offsets[i].x -= advances[i-back]; + } else { + back = 0; + while (positions[i - back].back) { + back += positions[i - back].back; + offsets[i].x -= advances[i-back]; + } + } +// DEBUG(" ->\tadv=%d\tpos=(%d/%d)", +// glyphs[i].advance.x.toInt(), glyphs[i].offset.x.toInt(), glyphs[i].offset.y.toInt()); + } + item->kerning_applied = face->has_opentype_kerning; + } else { + HB_HeuristicPosition(item); + } + +#ifdef OT_DEBUG + if (doLogClusters) { + DEBUG("log clusters after shaping:"); + for (int j = 0; j < length; j++) + DEBUG(" log[%d] = %d", j, item->log_clusters[j]); + } + DEBUG("final glyphs:"); + for (int i = 0; i < (int)hb_buffer->in_length; ++i) + DEBUG(" glyph=%4x char_index=%d mark: %d cmp: %d, clusterStart: %d advance=%d/%d offset=%d/%d", + glyphs[i].glyph, hb_buffer->in_string[i].cluster, glyphs[i].attributes.mark, + glyphs[i].attributes.combiningClass, glyphs[i].attributes.clusterStart, + glyphs[i].advance.x.toInt(), glyphs[i].advance.y.toInt(), + glyphs[i].offset.x.toInt(), glyphs[i].offset.y.toInt()); + DEBUG("-----------------------------------------"); +#endif + return true; +} + +HB_Bool HB_ShapeItem(HB_ShaperItem *shaper_item) +{ + HB_Bool result = false; + if (shaper_item->num_glyphs < shaper_item->item.length) { + shaper_item->num_glyphs = shaper_item->item.length; + return false; + } + assert(shaper_item->item.script < HB_ScriptCount); + result = HB_ScriptEngines[shaper_item->item.script].shape(shaper_item); + shaper_item->glyphIndicesPresent = false; + return result; +} + diff --git a/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-shaper.h b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-shaper.h new file mode 100644 index 0000000..ab5c07a --- /dev/null +++ b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-shaper.h @@ -0,0 +1,294 @@ +/* + * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) + * + * This is part of HarfBuzz, an OpenType Layout engine library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#ifndef HARFBUZZ_SHAPER_H +#define HARFBUZZ_SHAPER_H + +#include "harfbuzz-global.h" +#include "harfbuzz-gdef.h" +#include "harfbuzz-gpos.h" +#include "harfbuzz-gsub.h" +#include "harfbuzz-external.h" +#include "harfbuzz-stream-private.h" + +HB_BEGIN_HEADER + +#ifdef HB_USE_PACKED_STRUCTS +#pragma pack(push, 1) +#endif + +/* + using anything else than signed or unsigned for bitfields in C is non standard, + but accepted by almost all compilers. And it gives a significant reduction in + memory consumption as HB_CharAttributes and HB_GlyphAttributes will not have + a 4 byte alignment +*/ +#ifdef __xlC__ +typedef unsigned hb_bitfield; +#else +typedef hb_uint8 hb_bitfield; +#endif + +typedef enum { + HB_Script_Common, + HB_Script_Greek, + HB_Script_Cyrillic, + HB_Script_Armenian, + HB_Script_Hebrew, + HB_Script_Arabic, + HB_Script_Syriac, + HB_Script_Thaana, + HB_Script_Devanagari, + HB_Script_Bengali, + HB_Script_Gurmukhi, + HB_Script_Gujarati, + HB_Script_Oriya, + HB_Script_Tamil, + HB_Script_Telugu, + HB_Script_Kannada, + HB_Script_Malayalam, + HB_Script_Sinhala, + HB_Script_Thai, + HB_Script_Lao, + HB_Script_Tibetan, + HB_Script_Myanmar, + HB_Script_Georgian, + HB_Script_Hangul, + HB_Script_Ogham, + HB_Script_Runic, + HB_Script_Khmer, + HB_Script_Nko, + HB_Script_Inherited, + HB_ScriptCount = HB_Script_Inherited + /* + HB_Script_Latin = Common, + HB_Script_Ethiopic = Common, + HB_Script_Cherokee = Common, + HB_Script_CanadianAboriginal = Common, + HB_Script_Mongolian = Common, + HB_Script_Hiragana = Common, + HB_Script_Katakana = Common, + HB_Script_Bopomofo = Common, + HB_Script_Han = Common, + HB_Script_Yi = Common, + HB_Script_OldItalic = Common, + HB_Script_Gothic = Common, + HB_Script_Deseret = Common, + HB_Script_Tagalog = Common, + HB_Script_Hanunoo = Common, + HB_Script_Buhid = Common, + HB_Script_Tagbanwa = Common, + HB_Script_Limbu = Common, + HB_Script_TaiLe = Common, + HB_Script_LinearB = Common, + HB_Script_Ugaritic = Common, + HB_Script_Shavian = Common, + HB_Script_Osmanya = Common, + HB_Script_Cypriot = Common, + HB_Script_Braille = Common, + HB_Script_Buginese = Common, + HB_Script_Coptic = Common, + HB_Script_NewTaiLue = Common, + HB_Script_Glagolitic = Common, + HB_Script_Tifinagh = Common, + HB_Script_SylotiNagri = Common, + HB_Script_OldPersian = Common, + HB_Script_Kharoshthi = Common, + HB_Script_Balinese = Common, + HB_Script_Cuneiform = Common, + HB_Script_Phoenician = Common, + HB_Script_PhagsPa = Common, + */ +} HB_Script; + +typedef struct +{ + hb_uint32 pos; + hb_uint32 length; + HB_Script script; + hb_uint8 bidiLevel; +} HB_ScriptItem; + +typedef enum { + HB_NoBreak, + HB_SoftHyphen, + HB_Break, + HB_ForcedBreak +} HB_LineBreakType; + + +typedef struct { + /*HB_LineBreakType*/ hb_bitfield lineBreakType :2; + /*HB_Bool*/ hb_bitfield whiteSpace :1; /* A unicode whitespace character, except NBSP, ZWNBSP */ + /*HB_Bool*/ hb_bitfield charStop :1; /* Valid cursor position (for left/right arrow) */ + /*HB_Bool*/ hb_bitfield wordBoundary :1; + /*HB_Bool*/ hb_bitfield sentenceBoundary :1; + hb_bitfield unused :2; +} HB_CharAttributes; + +void HB_GetCharAttributes(const HB_UChar16 *string, hb_uint32 stringLength, + const HB_ScriptItem *items, hb_uint32 numItems, + HB_CharAttributes *attributes); + +/* requires HB_GetCharAttributes to be called before */ +void HB_GetWordBoundaries(const HB_UChar16 *string, hb_uint32 stringLength, + const HB_ScriptItem *items, hb_uint32 numItems, + HB_CharAttributes *attributes); + +/* requires HB_GetCharAttributes to be called before */ +void HB_GetSentenceBoundaries(const HB_UChar16 *string, hb_uint32 stringLength, + const HB_ScriptItem *items, hb_uint32 numItems, + HB_CharAttributes *attributes); + + +typedef enum { + HB_LeftToRight = 0, + HB_RightToLeft = 1 +} HB_StringToGlyphsFlags; + +typedef enum { + HB_ShaperFlag_Default = 0, + HB_ShaperFlag_NoKerning = 1, + HB_ShaperFlag_UseDesignMetrics = 2 +} HB_ShaperFlag; + +/* + highest value means highest priority for justification. Justification is done by first inserting kashidas + starting with the highest priority positions, then stretching spaces, afterwards extending inter char + spacing, and last spacing between arabic words. + NoJustification is for example set for arabic where no Kashida can be inserted or for diacritics. +*/ +typedef enum { + HB_NoJustification= 0, /* Justification can't be applied after this glyph */ + HB_Arabic_Space = 1, /* This glyph represents a space inside arabic text */ + HB_Character = 2, /* Inter-character justification point follows this glyph */ + HB_Space = 4, /* This glyph represents a blank outside an Arabic run */ + HB_Arabic_Normal = 7, /* Normal Middle-Of-Word glyph that connects to the right (begin) */ + HB_Arabic_Waw = 8, /* Next character is final form of Waw/Ain/Qaf/Fa */ + HB_Arabic_BaRa = 9, /* Next two chars are Ba + Ra/Ya/AlefMaksura */ + HB_Arabic_Alef = 10, /* Next character is final form of Alef/Tah/Lam/Kaf/Gaf */ + HB_Arabic_HaaDal = 11, /* Next character is final form of Haa/Dal/Taa Marbutah */ + HB_Arabic_Seen = 12, /* Initial or Medial form Of Seen/Sad */ + HB_Arabic_Kashida = 13 /* Kashida(U+640) in middle of word */ +} HB_JustificationClass; + +/* This structure is binary compatible with Uniscribe's SCRIPT_VISATTR. Would be nice to keep + * it like that. If this is a problem please tell Trolltech :) + */ +typedef struct { + hb_bitfield justification :4; /* Justification class */ + hb_bitfield clusterStart :1; /* First glyph of representation of cluster */ + hb_bitfield mark :1; /* needs to be positioned around base char */ + hb_bitfield zeroWidth :1; /* ZWJ, ZWNJ etc, with no width */ + hb_bitfield dontPrint :1; + hb_bitfield combiningClass :8; +} HB_GlyphAttributes; + +typedef struct HB_FaceRec_ { + HB_Bool isSymbolFont; + + HB_GDEF gdef; + HB_GSUB gsub; + HB_GPOS gpos; + HB_Bool supported_scripts[HB_ScriptCount]; + HB_Buffer buffer; + HB_Script current_script; + int current_flags; /* HB_ShaperFlags */ + HB_Bool has_opentype_kerning; + HB_Bool glyphs_substituted; + HB_GlyphAttributes *tmpAttributes; + unsigned int *tmpLogClusters; + int length; + int orig_nglyphs; +} HB_FaceRec; + +typedef HB_Error (*HB_GetFontTableFunc)(void *font, HB_Tag tag, HB_Byte *buffer, HB_UInt *length); + +HB_Face HB_NewFace(void *font, HB_GetFontTableFunc tableFunc); +void HB_FreeFace(HB_Face face); + +typedef struct { + HB_Fixed x, y; + HB_Fixed width, height; + HB_Fixed xOffset, yOffset; +} HB_GlyphMetrics; + +typedef enum { + HB_FontAscent +} HB_FontMetric; + +typedef struct { + HB_Bool (*convertStringToGlyphIndices)(HB_Font font, const HB_UChar16 *string, hb_uint32 length, HB_Glyph *glyphs, hb_uint32 *numGlyphs, HB_Bool rightToLeft); + void (*getGlyphAdvances)(HB_Font font, const HB_Glyph *glyphs, hb_uint32 numGlyphs, HB_Fixed *advances, int flags /*HB_ShaperFlag*/); + HB_Bool (*canRender)(HB_Font font, const HB_UChar16 *string, hb_uint32 length); + /* implementation needs to make sure to load a scaled glyph, so /no/ FT_LOAD_NO_SCALE */ + HB_Error (*getPointInOutline)(HB_Font font, HB_Glyph glyph, int flags /*HB_ShaperFlag*/, hb_uint32 point, HB_Fixed *xpos, HB_Fixed *ypos, hb_uint32 *nPoints); + void (*getGlyphMetrics)(HB_Font font, HB_Glyph glyph, HB_GlyphMetrics *metrics); + HB_Fixed (*getFontMetric)(HB_Font font, HB_FontMetric metric); +} HB_FontClass; + +typedef struct HB_Font_ { + const HB_FontClass *klass; + + /* Metrics */ + HB_UShort x_ppem, y_ppem; + HB_16Dot16 x_scale, y_scale; + + void *userData; +} HB_FontRec; + +#ifdef HB_USE_PACKED_STRUCTS +#pragma pack(pop) +#endif + +typedef struct HB_ShaperItem_ HB_ShaperItem; + +struct HB_ShaperItem_ { + const HB_UChar16 *string; /* input: the Unicode UTF16 text to be shaped */ + hb_uint32 stringLength; /* input: the length of the input in 16-bit words */ + HB_ScriptItem item; /* input: the current run to be shaped: a run of text all in the same script that is a substring of */ + HB_Font font; /* input: the font: scale, units and function pointers supplying glyph indices and metrics */ + HB_Face face; /* input: the shaper state; current script, access to the OpenType tables , etc. */ + int shaperFlags; /* input (unused) should be set to 0; intended to support flags defined in HB_ShaperFlag */ + HB_Bool glyphIndicesPresent; /* input: true if the array contains glyph indices ready to be shaped */ + hb_uint32 initialGlyphCount; /* input: if glyphIndicesPresent is true, the number of glyph indices in the array */ + + hb_uint32 num_glyphs; /* input: capacity of output arrays , , , , and ; */ + /* output: required capacity (may be larger than actual capacity) */ + + HB_Glyph *glyphs; /* output: indices of shaped glyphs */ + HB_GlyphAttributes *attributes; /* output: glyph attributes */ + HB_Fixed *advances; /* output: advances */ + HB_FixedPoint *offsets; /* output: offsets */ + unsigned short *log_clusters; /* output: for each output glyph, the index in the input of the start of its logical cluster */ + + /* internal */ + HB_Bool kerning_applied; /* output: true if kerning was applied by the shaper */ +}; + +HB_Bool HB_ShapeItem(HB_ShaperItem *item); + +HB_END_HEADER + +#endif diff --git a/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-stream-private.h b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-stream-private.h new file mode 100644 index 0000000..fbd9f81 --- /dev/null +++ b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-stream-private.h @@ -0,0 +1,81 @@ +/* + * Copyright (C) 1998-2004 David Turner and Werner Lemberg + * Copyright (C) 2006 Behdad Esfahbod + * + * This is part of HarfBuzz, an OpenType Layout engine library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#ifndef HARFBUZZ_STREAM_PRIVATE_H +#define HARFBUZZ_STREAM_PRIVATE_H + +#include "harfbuzz-impl.h" +#include "harfbuzz-stream.h" + +HB_BEGIN_HEADER + +HB_INTERNAL void +_hb_close_stream( HB_Stream stream ); + +HB_INTERNAL HB_Int +_hb_stream_pos( HB_Stream stream ); + +HB_INTERNAL HB_Error +_hb_stream_seek( HB_Stream stream, + HB_UInt pos ); + +HB_INTERNAL HB_Error +_hb_stream_frame_enter( HB_Stream stream, + HB_UInt size ); + +HB_INTERNAL void +_hb_stream_frame_exit( HB_Stream stream ); + +/* convenience macros */ + +#define SET_ERR(c) ( (error = (c)) != 0 ) + +#define GOTO_Table(tag) (0) +#define FILE_Pos() _hb_stream_pos( stream ) +#define FILE_Seek(pos) SET_ERR( _hb_stream_seek( stream, pos ) ) +#define ACCESS_Frame(size) SET_ERR( _hb_stream_frame_enter( stream, size ) ) +#define FORGET_Frame() _hb_stream_frame_exit( stream ) + +#define GET_Byte() (*stream->cursor++) +#define GET_Short() (stream->cursor += 2, (HB_Short)( \ + (*(((HB_Byte*)stream->cursor)-2) << 8) | \ + *(((HB_Byte*)stream->cursor)-1) \ + )) +#define GET_Long() (stream->cursor += 4, (HB_Int)( \ + (*(((HB_Byte*)stream->cursor)-4) << 24) | \ + (*(((HB_Byte*)stream->cursor)-3) << 16) | \ + (*(((HB_Byte*)stream->cursor)-2) << 8) | \ + *(((HB_Byte*)stream->cursor)-1) \ + )) + + +#define GET_Char() ((HB_Char)GET_Byte()) +#define GET_UShort() ((HB_UShort)GET_Short()) +#define GET_ULong() ((HB_UInt)GET_Long()) +#define GET_Tag4() GET_ULong() + +HB_END_HEADER + +#endif /* HARFBUZZ_STREAM_PRIVATE_H */ diff --git a/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-stream.c b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-stream.c new file mode 100644 index 0000000..2d9638f --- /dev/null +++ b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-stream.c @@ -0,0 +1,114 @@ +/* + * Copyright (C) 2005 David Turner + * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) + * Copyright (C) 2007 Red Hat, Inc. + * + * This is part of HarfBuzz, an OpenType Layout engine library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + * + * Red Hat Author(s): Behdad Esfahbod + */ + +#include "harfbuzz-impl.h" +#include "harfbuzz-stream-private.h" +#include + +#if 0 +#include +#define LOG(x) _hb_log x + +static void +_hb_log( const char* format, ... ) +{ + va_list ap; + + va_start( ap, format ); + vfprintf( stderr, format, ap ); + va_end( ap ); +} + +#else +#define LOG(x) do {} while (0) +#endif + +HB_INTERNAL void +_hb_close_stream( HB_Stream stream ) +{ + if (!stream) + return; + free(stream->base); + free(stream); +} + + +HB_INTERNAL HB_Int +_hb_stream_pos( HB_Stream stream ) +{ + LOG(( "_hb_stream_pos() -> %ld\n", stream->pos )); + return stream->pos; +} + + +HB_INTERNAL HB_Error +_hb_stream_seek( HB_Stream stream, + HB_UInt pos ) +{ + HB_Error error = (HB_Error)0; + + stream->pos = pos; + if (pos > stream->size) + error = ERR(HB_Err_Read_Error); + + LOG(( "_hb_stream_seek(%ld) -> 0x%04X\n", pos, error )); + return error; +} + + +HB_INTERNAL HB_Error +_hb_stream_frame_enter( HB_Stream stream, + HB_UInt count ) +{ + HB_Error error = HB_Err_Ok; + + /* check new position, watch for overflow */ + if (HB_UNLIKELY (stream->pos + count > stream->size || + stream->pos + count < stream->pos)) + { + error = ERR(HB_Err_Read_Error); + goto Exit; + } + + /* set cursor */ + stream->cursor = stream->base + stream->pos; + stream->pos += count; + +Exit: + LOG(( "_hb_stream_frame_enter(%ld) -> 0x%04X\n", count, error )); + return error; +} + + +HB_INTERNAL void +_hb_stream_frame_exit( HB_Stream stream ) +{ + stream->cursor = NULL; + + LOG(( "_hb_stream_frame_exit()\n" )); +} diff --git a/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-stream.h b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-stream.h new file mode 100644 index 0000000..a155cc2 --- /dev/null +++ b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-stream.h @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2005 David Turner + * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) + * + * This is part of HarfBuzz, an OpenType Layout engine library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#ifndef HARFBUZZ_STREAM_H +#define HARFBUZZ_STREAM_H + +#include "harfbuzz-global.h" + +HB_BEGIN_HEADER + +#ifdef HB_USE_PACKED_STRUCTS +#pragma pack(push, 1) +#endif + +typedef struct HB_StreamRec_ +{ + HB_Byte* base; + HB_Byte* cursor; + HB_UInt size; + HB_UInt pos; +} HB_StreamRec; + +#ifdef HB_USE_PACKED_STRUCTS +#pragma pack(pop) +#endif + +HB_END_HEADER + +#endif diff --git a/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-thai.c b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-thai.c new file mode 100644 index 0000000..e153ba9 --- /dev/null +++ b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-thai.c @@ -0,0 +1,111 @@ +/* + * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) + * + * This is part of HarfBuzz, an OpenType Layout engine library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#include "harfbuzz-shaper.h" +#include "harfbuzz-shaper-private.h" +#include "harfbuzz-external.h" + +#include +#include + +typedef int (*th_brk_def)(const char*, int[], int); +static th_brk_def th_brk = 0; +static int libthai_resolved = 0; + +static void resolve_libthai() +{ + if (!th_brk) + th_brk = (th_brk_def)HB_Library_Resolve("thai", 0, "th_brk"); + libthai_resolved = 1; +} + +static void to_tis620(const HB_UChar16 *string, hb_uint32 len, const char *cstr) +{ + hb_uint32 i; + unsigned char *result = (unsigned char *)cstr; + + for (i = 0; i < len; ++i) { + if (string[i] <= 0xa0) + result[i] = (unsigned char)string[i]; + if (string[i] >= 0xe01 && string[i] <= 0xe5b) + result[i] = (unsigned char)(string[i] - 0xe00 + 0xa0); + else + result[i] = '?'; + } + + result[len] = 0; +} + +static void thaiWordBreaks(const HB_UChar16 *string, hb_uint32 len, HB_CharAttributes *attributes) +{ + char s[128]; + char *cstr = s; + int brp[128]; + int *break_positions = brp; + hb_uint32 numbreaks; + hb_uint32 i; + + if (!libthai_resolved) + resolve_libthai(); + + if (!th_brk) + return; + + if (len >= 128) + cstr = (char *)malloc(len*sizeof(char) + 1); + + to_tis620(string, len, cstr); + + numbreaks = th_brk(cstr, break_positions, 128); + if (numbreaks > 128) { + break_positions = (int *)malloc(numbreaks * sizeof(int)); + numbreaks = th_brk(cstr, break_positions, numbreaks); + } + + for (i = 0; i < len; ++i) { + attributes[i].lineBreakType = HB_NoBreak; + attributes[i].wordBoundary = FALSE; + } + + for (i = 0; i < numbreaks; ++i) { + if (break_positions[i] > 0) { + attributes[break_positions[i]-1].lineBreakType = HB_Break; + attributes[i].wordBoundary = TRUE; + } + } + + if (break_positions != brp) + free(break_positions); + + if (len >= 128) + free(cstr); +} + +void HB_ThaiAttributes(HB_Script script, const HB_UChar16 *text, hb_uint32 from, hb_uint32 len, HB_CharAttributes *attributes) +{ + assert(script == HB_Script_Thai); + attributes += from; + thaiWordBreaks(text + from, len, attributes); +} + diff --git a/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-tibetan.c b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-tibetan.c new file mode 100644 index 0000000..bfa31b1 --- /dev/null +++ b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz-tibetan.c @@ -0,0 +1,274 @@ +/* + * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) + * + * This is part of HarfBuzz, an OpenType Layout engine library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#include "harfbuzz-shaper.h" +#include "harfbuzz-shaper-private.h" + +#include + +/* + tibetan syllables are of the form: + head position consonant + first sub-joined consonant + ....intermediate sub-joined consonants (if any) + last sub-joined consonant + sub-joined vowel (a-chung U+0F71) + standard or compound vowel sign (or 'virama' for devanagari transliteration) +*/ + +typedef enum { + TibetanOther, + TibetanHeadConsonant, + TibetanSubjoinedConsonant, + TibetanSubjoinedVowel, + TibetanVowel +} TibetanForm; + +/* this table starts at U+0f40 */ +static const unsigned char tibetanForm[0x80] = { + TibetanHeadConsonant, TibetanHeadConsonant, TibetanHeadConsonant, TibetanHeadConsonant, + TibetanHeadConsonant, TibetanHeadConsonant, TibetanHeadConsonant, TibetanHeadConsonant, + TibetanHeadConsonant, TibetanHeadConsonant, TibetanHeadConsonant, TibetanHeadConsonant, + TibetanHeadConsonant, TibetanHeadConsonant, TibetanHeadConsonant, TibetanHeadConsonant, + + TibetanHeadConsonant, TibetanHeadConsonant, TibetanHeadConsonant, TibetanHeadConsonant, + TibetanHeadConsonant, TibetanHeadConsonant, TibetanHeadConsonant, TibetanHeadConsonant, + TibetanHeadConsonant, TibetanHeadConsonant, TibetanHeadConsonant, TibetanHeadConsonant, + TibetanHeadConsonant, TibetanHeadConsonant, TibetanHeadConsonant, TibetanHeadConsonant, + + TibetanHeadConsonant, TibetanHeadConsonant, TibetanHeadConsonant, TibetanHeadConsonant, + TibetanHeadConsonant, TibetanHeadConsonant, TibetanHeadConsonant, TibetanHeadConsonant, + TibetanHeadConsonant, TibetanHeadConsonant, TibetanHeadConsonant, TibetanHeadConsonant, + TibetanOther, TibetanOther, TibetanOther, TibetanOther, + + TibetanOther, TibetanVowel, TibetanVowel, TibetanVowel, + TibetanVowel, TibetanVowel, TibetanVowel, TibetanVowel, + TibetanVowel, TibetanVowel, TibetanVowel, TibetanVowel, + TibetanVowel, TibetanVowel, TibetanVowel, TibetanVowel, + + TibetanVowel, TibetanVowel, TibetanVowel, TibetanVowel, + TibetanVowel, TibetanVowel, TibetanVowel, TibetanVowel, + TibetanOther, TibetanOther, TibetanOther, TibetanOther, + TibetanOther, TibetanOther, TibetanOther, TibetanOther, + + TibetanSubjoinedConsonant, TibetanSubjoinedConsonant, TibetanSubjoinedConsonant, TibetanSubjoinedConsonant, + TibetanSubjoinedConsonant, TibetanSubjoinedConsonant, TibetanSubjoinedConsonant, TibetanSubjoinedConsonant, + TibetanSubjoinedConsonant, TibetanSubjoinedConsonant, TibetanSubjoinedConsonant, TibetanSubjoinedConsonant, + TibetanSubjoinedConsonant, TibetanSubjoinedConsonant, TibetanSubjoinedConsonant, TibetanSubjoinedConsonant, + + TibetanSubjoinedConsonant, TibetanSubjoinedConsonant, TibetanSubjoinedConsonant, TibetanSubjoinedConsonant, + TibetanSubjoinedConsonant, TibetanSubjoinedConsonant, TibetanSubjoinedConsonant, TibetanSubjoinedConsonant, + TibetanSubjoinedConsonant, TibetanSubjoinedConsonant, TibetanSubjoinedConsonant, TibetanSubjoinedConsonant, + TibetanSubjoinedConsonant, TibetanSubjoinedConsonant, TibetanSubjoinedConsonant, TibetanSubjoinedConsonant, + + TibetanSubjoinedConsonant, TibetanSubjoinedConsonant, TibetanSubjoinedConsonant, TibetanSubjoinedConsonant, + TibetanSubjoinedConsonant, TibetanSubjoinedConsonant, TibetanSubjoinedConsonant, TibetanSubjoinedConsonant, + TibetanSubjoinedConsonant, TibetanSubjoinedConsonant, TibetanSubjoinedConsonant, TibetanSubjoinedConsonant, + TibetanSubjoinedConsonant, TibetanOther, TibetanOther, TibetanOther +}; + + +#define tibetan_form(c) \ + (TibetanForm)tibetanForm[c - 0x0f40] + +static const HB_OpenTypeFeature tibetan_features[] = { + { HB_MAKE_TAG('c', 'c', 'm', 'p'), CcmpProperty }, + { HB_MAKE_TAG('a', 'b', 'v', 's'), AboveSubstProperty }, + { HB_MAKE_TAG('b', 'l', 'w', 's'), BelowSubstProperty }, + { HB_MAKE_TAG('c', 'a', 'l', 't'), CaltProperty }, + {0, 0} +}; + +static HB_Bool tibetan_shape_syllable(HB_Bool openType, HB_ShaperItem *item, HB_Bool invalid) +{ + hb_uint32 i; + const HB_UChar16 *str = item->string + item->item.pos; + int len = item->item.length; +#ifndef NO_OPENTYPE + const int availableGlyphs = item->num_glyphs; +#endif + HB_Bool haveGlyphs; + HB_STACKARRAY(HB_UChar16, reordered, len + 4); + + if (item->num_glyphs < item->item.length + 4) { + item->num_glyphs = item->item.length + 4; + return FALSE; + } + + if (invalid) { + *reordered = 0x25cc; + memcpy(reordered+1, str, len*sizeof(HB_UChar16)); + len++; + str = reordered; + } + + haveGlyphs = item->font->klass->convertStringToGlyphIndices(item->font, + str, len, + item->glyphs, &item->num_glyphs, + item->item.bidiLevel % 2); + + HB_FREE_STACKARRAY(reordered); + + if (!haveGlyphs) + return FALSE; + + for (i = 0; i < item->item.length; i++) { + item->attributes[i].mark = FALSE; + item->attributes[i].clusterStart = FALSE; + item->attributes[i].justification = 0; + item->attributes[i].zeroWidth = FALSE; +/* IDEBUG(" %d: %4x", i, str[i]); */ + } + + /* now we have the syllable in the right order, and can start running it through open type. */ + +#ifndef NO_OPENTYPE + if (openType) { + HB_OpenTypeShape(item, /*properties*/0); + if (!HB_OpenTypePosition(item, availableGlyphs, /*doLogClusters*/FALSE)) + return FALSE; + } else { + HB_HeuristicPosition(item); + } +#endif + + item->attributes[0].clusterStart = TRUE; + return TRUE; +} + + +static int tibetan_nextSyllableBoundary(const HB_UChar16 *s, int start, int end, HB_Bool *invalid) +{ + const HB_UChar16 *uc = s + start; + + int pos = 0; + TibetanForm state = tibetan_form(*uc); + +/* qDebug("state[%d]=%d (uc=%4x)", pos, state, uc[pos]);*/ + pos++; + + if (state != TibetanHeadConsonant) { + if (state != TibetanOther) + *invalid = TRUE; + goto finish; + } + + while (pos < end - start) { + TibetanForm newState = tibetan_form(uc[pos]); + switch(newState) { + case TibetanSubjoinedConsonant: + case TibetanSubjoinedVowel: + if (state != TibetanHeadConsonant && + state != TibetanSubjoinedConsonant) + goto finish; + state = newState; + break; + case TibetanVowel: + if (state != TibetanHeadConsonant && + state != TibetanSubjoinedConsonant && + state != TibetanSubjoinedVowel) + goto finish; + break; + case TibetanOther: + case TibetanHeadConsonant: + goto finish; + } + pos++; + } + +finish: + *invalid = FALSE; + return start+pos; +} + +HB_Bool HB_TibetanShape(HB_ShaperItem *item) +{ + + HB_Bool openType = FALSE; + unsigned short *logClusters = item->log_clusters; + + HB_ShaperItem syllable = *item; + int first_glyph = 0; + + int sstart = item->item.pos; + int end = sstart + item->item.length; + + assert(item->item.script == HB_Script_Tibetan); + +#ifndef QT_NO_OPENTYPE + openType = HB_SelectScript(item, tibetan_features); +#endif + + while (sstart < end) { + HB_Bool invalid; + int i; + int send = tibetan_nextSyllableBoundary(item->string, sstart, end, &invalid); +/* IDEBUG("syllable from %d, length %d, invalid=%s", sstart, send-sstart, + invalid ? "TRUE" : "FALSE"); */ + syllable.item.pos = sstart; + syllable.item.length = send-sstart; + syllable.glyphs = item->glyphs + first_glyph; + syllable.attributes = item->attributes + first_glyph; + syllable.offsets = item->offsets + first_glyph; + syllable.advances = item->advances + first_glyph; + syllable.num_glyphs = item->num_glyphs - first_glyph; + if (!tibetan_shape_syllable(openType, &syllable, invalid)) { + item->num_glyphs += syllable.num_glyphs; + return FALSE; + } + /* fix logcluster array */ + for (i = sstart; i < send; ++i) + logClusters[i-item->item.pos] = first_glyph; + sstart = send; + first_glyph += syllable.num_glyphs; + } + item->num_glyphs = first_glyph; + return TRUE; +} + +void HB_TibetanAttributes(HB_Script script, const HB_UChar16 *text, hb_uint32 from, hb_uint32 len, HB_CharAttributes *attributes) +{ + int end = from + len; + const HB_UChar16 *uc = text + from; + hb_uint32 i = 0; + HB_UNUSED(script); + attributes += from; + while (i < len) { + HB_Bool invalid; + hb_uint32 boundary = tibetan_nextSyllableBoundary(text, from+i, end, &invalid) - from; + + attributes[i].charStop = TRUE; + + if (boundary > len-1) boundary = len; + i++; + while (i < boundary) { + attributes[i].charStop = FALSE; + ++uc; + ++i; + } + assert(i == boundary); + } +} + + diff --git a/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz.c b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz.c new file mode 100644 index 0000000..3e4a30a --- /dev/null +++ b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz.c @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2006 Behdad Esfahbod + * + * This is part of HarfBuzz, an OpenType Layout engine library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#define HB_INTERNAL static +#include "harfbuzz-buffer.c" +#include "harfbuzz-gdef.c" +#include "harfbuzz-gsub.c" +#include "harfbuzz-gpos.c" +#include "harfbuzz-impl.c" +#include "harfbuzz-open.c" +#include "harfbuzz-stream.c" diff --git a/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz.h b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz.h new file mode 100644 index 0000000..e91a33e --- /dev/null +++ b/tqtinterface/qt4/include/private/qt4_harfbuzz/src/harfbuzz.h @@ -0,0 +1,38 @@ +/* + * Copyright (C) 1998-2004 David Turner and Werner Lemberg + * Copyright (C) 2006 Behdad Esfahbod + * + * This is part of HarfBuzz, an OpenType Layout engine library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#ifndef HARFBUZZ_H +#define HARFBUZZ_H + +#include "harfbuzz-external.h" +#include "harfbuzz-global.h" +#include "harfbuzz-buffer.h" +#include "harfbuzz-gdef.h" +#include "harfbuzz-gsub.h" +#include "harfbuzz-gpos.h" +#include "harfbuzz-open.h" +#include "harfbuzz-shaper.h" + +#endif /* HARFBUZZ_OPEN_H */ diff --git a/tqtinterface/qt4/include/private/qt4_harfbuzz/tests/Makefile.am b/tqtinterface/qt4/include/private/qt4_harfbuzz/tests/Makefile.am new file mode 100644 index 0000000..febf890 --- /dev/null +++ b/tqtinterface/qt4/include/private/qt4_harfbuzz/tests/Makefile.am @@ -0,0 +1,7 @@ + +SUBDIRS = + +if QT +SUBDIRS += linebreaking shaping +endif + diff --git a/tqtinterface/qt4/include/private/qt4_harfbuzz/tests/fuzzing/fuzz.cc b/tqtinterface/qt4/include/private/qt4_harfbuzz/tests/fuzzing/fuzz.cc new file mode 100644 index 0000000..133577a --- /dev/null +++ b/tqtinterface/qt4/include/private/qt4_harfbuzz/tests/fuzzing/fuzz.cc @@ -0,0 +1,124 @@ +// This is a fuzzing harness for Harfbuzz. Since Harfbuzz's input is generally +// expected to be controlled by a remote party it's a possible vector for +// security issues. +// +// Fuzzing is a black-box testing scheme where the black-box (Harfbuzz's shaping +// engine in this case) is fed random input to see if it will misbehave. +// Misbehaviours can often be turned into security or crash issues. +// +// It's expected that one will generally run this under valgrind in order to get +// better detection of problems. + +#include +#include + +#include +#include FT_FREETYPE_H + +#include "../../src/harfbuzz-shaper.h" +#include "../../src/harfbuzz-global.h" +#include "../../src/harfbuzz-gpos.h" + +extern "C" { +#include "../../contrib/harfbuzz-unicode.h" +#include "../../contrib/harfbuzz-freetype.h" +} + +static FT_Library freetype; + +static FT_Face loadFace(const char *path) +{ + FT_Face face; + + if (FT_New_Face(freetype, path, /* index */ 0, &face)) + return 0; + return face; +} + +static const int kWidth = 100; +static const int kHeight = 100; + +static int +usage(const char *argv0) { + fprintf(stderr, "Usage: %s \n", argv0); + return 1; +} + +int +main(int argc, char **argv) { + FT_Init_FreeType(&freetype); + + if (argc != 2) + return usage(argv[0]); + + FT_Face face; + if (FT_New_Face(freetype, argv[1], 0 /* face index */, &face)) { + fprintf(stderr, "Failed to load font file\n"); + return 1; + } + + HB_Face hbFace = HB_NewFace(face, hb_freetype_table_sfnt_get); + + HB_FontRec hbFont; + hbFont.klass = &hb_freetype_class; + hbFont.userData = face; + hbFont.x_ppem = face->size->metrics.x_ppem; + hbFont.y_ppem = face->size->metrics.y_ppem; + hbFont.x_scale = face->size->metrics.x_scale; + hbFont.y_scale = face->size->metrics.y_scale; + + // This is the maximum number of bytes of input which we'll feed to Harfbuzz + // in one shot. We also overload it and make it the size of the output arrays + // as well. (Must be a power of two.) + static const unsigned kMaxInputBytes = 1024; + uint8_t str[kMaxInputBytes]; + + HB_ShaperItem shaper_item; + shaper_item.kerning_applied = false; + shaper_item.string = (HB_UChar16 *) str; + shaper_item.stringLength = 0; + shaper_item.item.bidiLevel = 0; + shaper_item.shaperFlags = 0; + shaper_item.font = &hbFont; + shaper_item.face = hbFace; + shaper_item.glyphIndicesPresent = false; + shaper_item.initialGlyphCount = 0; + + HB_Glyph out_glyphs[kMaxInputBytes]; + HB_GlyphAttributes out_attrs[kMaxInputBytes]; + HB_Fixed out_advs[kMaxInputBytes]; + HB_FixedPoint out_offsets[kMaxInputBytes]; + unsigned short out_logClusters[kMaxInputBytes]; + + shaper_item.glyphs = out_glyphs; + shaper_item.attributes = out_attrs; + shaper_item.advances = out_advs; + shaper_item.offsets = out_offsets; + shaper_item.log_clusters = out_logClusters; + shaper_item.num_glyphs = kMaxInputBytes; + + FILE *urandom = fopen("/dev/urandom", "rb"); + if (!urandom) { + fprintf(stderr, "Cannot open /dev/urandom\n"); + return 1; + } + + for (;;) { + uint16_t len; + fread(&len, sizeof(len), 1, urandom); + len &= (kMaxInputBytes - 1); + len &= ~1; + fread(str, len, 1, urandom); + + ssize_t iterator = 0; + + for (;;) { + if (!hb_utf16_script_run_next(NULL, &shaper_item.item, (uint16_t *) str, len >> 1, &iterator)) + break; + + HB_ShapeItem(&shaper_item); + } + } + + HB_FreeFace(hbFace); +} diff --git a/tqtinterface/qt4/include/private/qt4_harfbuzz/tests/linebreaking/Makefile.am b/tqtinterface/qt4/include/private/qt4_harfbuzz/tests/linebreaking/Makefile.am new file mode 100644 index 0000000..b710896 --- /dev/null +++ b/tqtinterface/qt4/include/private/qt4_harfbuzz/tests/linebreaking/Makefile.am @@ -0,0 +1,12 @@ + +check_PROGRAMS = linebreaking + +linebreaking_SOURCES = main.cpp harfbuzz-qt.cpp +linebreaking_LDADD = $(QT_GUI_LIBS) $(QT_QTEST_LIBS) ../../src/libharfbuzz-1.la + +main.o: main.moc + +main.moc: $(srcdir)/main.cpp + $(QT_MOC) -o main.moc $(srcdir)/main.cpp + +INCLUDES = -I$(top_srcdir)/src $(FREETYPE_CFLAGS) $(QT_GUI_CFLAGS) $(QT_QTEST_CFLAGS) diff --git a/tqtinterface/qt4/include/private/qt4_harfbuzz/tests/linebreaking/harfbuzz-qt.cpp b/tqtinterface/qt4/include/private/qt4_harfbuzz/tests/linebreaking/harfbuzz-qt.cpp new file mode 100644 index 0000000..f0048b7 --- /dev/null +++ b/tqtinterface/qt4/include/private/qt4_harfbuzz/tests/linebreaking/harfbuzz-qt.cpp @@ -0,0 +1,87 @@ +/* + * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) + * + * This is part of HarfBuzz, an OpenType Layout engine library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#include +#include +#include +#include + +extern "C" { + +HB_LineBreakClass HB_GetLineBreakClass(HB_UChar32 ch) +{ +#if QT_VERSION >= 0x040300 + return (HB_LineBreakClass)QUnicodeTables::lineBreakClass(ch); +#else +#error "This test currently requires Qt >= 4.3" +#endif +} + +void HB_GetUnicodeCharProperties(HB_UChar32 ch, HB_CharCategory *category, int *combiningClass) +{ + *category = (HB_CharCategory)QChar::category(ch); + *combiningClass = QChar::combiningClass(ch); +} + +HB_CharCategory HB_GetUnicodeCharCategory(HB_UChar32 ch) +{ + return (HB_CharCategory)QChar::category(ch); +} + +int HB_GetUnicodeCharCombiningClass(HB_UChar32 ch) +{ + return QChar::combiningClass(ch); +} + +HB_UChar16 HB_GetMirroredChar(HB_UChar16 ch) +{ + return QChar::mirroredChar(ch); +} + +HB_WordClass HB_GetWordClass(HB_UChar32 ch) +{ + const QUnicodeTables::Properties *prop = QUnicodeTables::properties(ch); + return (HB_WordClass) prop->wordBreak; +} + + +HB_SentenceClass HB_GetSentenceClass(HB_UChar32 ch) +{ + const QUnicodeTables::Properties *prop = QUnicodeTables::properties(ch); + return (HB_SentenceClass) prop->sentenceBreak; +} + +void HB_GetGraphemeAndLineBreakClass(HB_UChar32 ch, HB_GraphemeClass *grapheme, HB_LineBreakClass *lineBreak) +{ + const QUnicodeTables::Properties *prop = QUnicodeTables::properties(ch); + *grapheme = (HB_GraphemeClass) prop->graphemeBreak; + *lineBreak = (HB_LineBreakClass) prop->line_break_class; +} + +void *HB_Library_Resolve(const char *library, int version, const char *symbol) +{ + return QLibrary::resolve(library, version, symbol); +} + +} diff --git a/tqtinterface/qt4/include/private/qt4_harfbuzz/tests/linebreaking/main.cpp b/tqtinterface/qt4/include/private/qt4_harfbuzz/tests/linebreaking/main.cpp new file mode 100644 index 0000000..41333c9 --- /dev/null +++ b/tqtinterface/qt4/include/private/qt4_harfbuzz/tests/linebreaking/main.cpp @@ -0,0 +1,230 @@ +/* + * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) + * + * This is part of HarfBuzz, an OpenType Layout engine library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +/* + !!!!!! Warning !!!!! + Please don't save this file in emacs. It contains utf8 text sequences emacs will + silently convert to a series of question marks. + */ +#include +#include + +#include + +static QVector getCharAttributes(const QString &str, HB_Script script = HB_Script_Common) +{ + QVector attrs(str.length()); + HB_ScriptItem item; + item.pos = 0; + item.length = str.length(); + item.script = script; + HB_GetCharAttributes(str.utf16(), str.length(), + &item, 1, + attrs.data()); + return attrs; +} + +class tst_CharAttributes : public TQT_BASE_OBJECT_NAME +{ + Q_OBJECT + +public: + tst_CharAttributes(); + virtual ~tst_CharAttributes(); + +public slots: + void init(); + void cleanup(); +private slots: + void lineBreaking(); + void charWordStopOnLineSeparator(); + void charStopForSurrogatePairs(); + void thaiWordBreak(); +}; + + +tst_CharAttributes::tst_CharAttributes() +{ +} + +tst_CharAttributes::~tst_CharAttributes() +{ +} + +void tst_CharAttributes::init() +{ +} + +void tst_CharAttributes::cleanup() +{ +} + + +void tst_CharAttributes::lineBreaking() +{ + struct Breaks { + const char *utf8; + uchar breaks[32]; + }; + Breaks brks[] = { + { "11", { false, 0xff } }, + { "aa", { false, 0xff } }, + { "++", { false, 0xff } }, + { "--", { false, 0xff } }, + { "((", { false, 0xff } }, + { "))", { false, 0xff } }, + { "..", { false, 0xff } }, + { "\"\"", { false, 0xff } }, + { "$$", { false, 0xff } }, + { "!!", { false, 0xff } }, + { "??", { false, 0xff } }, + { ",,", { false, 0xff } }, + + { ")()", { true, false, 0xff } }, + { "?!?", { false, false, 0xff } }, + { ".,.", { false, false, 0xff } }, + { "+-+", { false, false, 0xff } }, + { "+=+", { false, false, 0xff } }, + { "+(+", { false, false, 0xff } }, + { "+)+", { false, false, 0xff } }, + + { "a b", { false, true, 0xff } }, + { "a(b", { false, false, 0xff } }, + { "a)b", { false, false, 0xff } }, + { "a-b", { false, true, 0xff } }, + { "a.b", { false, false, 0xff } }, + { "a+b", { false, false, 0xff } }, + { "a?b", { false, false, 0xff } }, + { "a!b", { false, false, 0xff } }, + { "a$b", { false, false, 0xff } }, + { "a,b", { false, false, 0xff } }, + { "a/b", { false, false, 0xff } }, + { "1/2", { false, false, 0xff } }, + { "./.", { false, false, 0xff } }, + { ",/,", { false, false, 0xff } }, + { "!/!", { false, false, 0xff } }, + { "\\/\\", { false, false, 0xff } }, + { "1 2", { false, true, 0xff } }, + { "1(2", { false, false, 0xff } }, + { "1)2", { false, false, 0xff } }, + { "1-2", { false, false, 0xff } }, + { "1.2", { false, false, 0xff } }, + { "1+2", { false, false, 0xff } }, + { "1?2", { false, true, 0xff } }, + { "1!2", { false, true, 0xff } }, + { "1$2", { false, false, 0xff } }, + { "1,2", { false, false, 0xff } }, + { "1/2", { false, false, 0xff } }, + { "\330\260\331\216\331\204\331\220\331\203\331\216", { false, false, false, false, false, 0xff } }, + { "\330\247\331\204\331\205 \330\247\331\204\331\205", { false, false, false, true, false, false, 0xff } }, + { "1#2", { false, false, 0xff } }, + { "!#!", { false, false, 0xff } }, + { 0, {} } + }; + Breaks *b = brks; + while (b->utf8) { + QString str = QString::fromUtf8(b->utf8); + + QVector attrs = getCharAttributes(str); + + int i; + for (i = 0; i < (int)str.length() - 1; ++i) { + QVERIFY(b->breaks[i] != 0xff); + if ( (attrs[i].lineBreakType != HB_NoBreak) != (bool)b->breaks[i] ) { + qDebug("test case \"%s\" failed at char %d; break type: %d", b->utf8, i, attrs[i].lineBreakType); + QCOMPARE( (attrs[i].lineBreakType != HB_NoBreak), (bool)b->breaks[i] ); + } + } + QVERIFY(attrs[i].lineBreakType == HB_ForcedBreak); + QCOMPARE(b->breaks[i], (uchar)0xff); + ++b; + } +} + +void tst_CharAttributes::charWordStopOnLineSeparator() +{ + const QChar lineSeparator(QChar::LineSeparator); + QString txt; + txt.append(lineSeparator); + txt.append(lineSeparator); + QVector attrs = getCharAttributes(txt); + QVERIFY(attrs[1].charStop); +} + +void tst_CharAttributes::charStopForSurrogatePairs() +{ + QString txt; + txt.append("a"); + txt.append(0xd87e); + txt.append(0xdc25); + txt.append("b"); + QVector attrs = getCharAttributes(txt); + QVERIFY(attrs[0].charStop); + QVERIFY(attrs[1].charStop); + QVERIFY(!attrs[2].charStop); + QVERIFY(attrs[3].charStop); +} + +void tst_CharAttributes::thaiWordBreak() +{ + // สวัสดีครับ นี่เป็นการงทดสอบตัวเอ + QTextCodec *codec = QTextCodec::codecForMib(2259); + QString txt = codec->toUnicode(QByteArray("\xca\xc7\xd1\xca\xb4\xd5\xa4\xc3\xd1\xba\x20\xb9\xd5\xe8\xe0\xbb\xe7\xb9\xa1\xd2\xc3\xb7\xb4\xca\xcd\xba\xb5\xd1\xc7\xe0\xcd\xa7")); + + + QCOMPARE(txt.length(), 32); + QVector attrs = getCharAttributes(txt, HB_Script_Thai); + QVERIFY(attrs[0].lineBreakType == HB_NoBreak); + QVERIFY(attrs[1].lineBreakType == HB_NoBreak); + QVERIFY(attrs[2].lineBreakType == HB_NoBreak); + QVERIFY(attrs[3].lineBreakType == HB_NoBreak); + QVERIFY(attrs[4].lineBreakType == HB_NoBreak); + QVERIFY(attrs[5].lineBreakType == HB_Break); + QVERIFY(attrs[6].lineBreakType == HB_NoBreak); + QVERIFY(attrs[7].lineBreakType == HB_NoBreak); + QVERIFY(attrs[8].lineBreakType == HB_NoBreak); + QVERIFY(attrs[9].lineBreakType == HB_NoBreak); + QVERIFY(attrs[10].lineBreakType == HB_Break); + QVERIFY(attrs[11].lineBreakType == HB_NoBreak); + QVERIFY(attrs[12].lineBreakType == HB_NoBreak); + QVERIFY(attrs[13].lineBreakType == HB_Break); + QVERIFY(attrs[14].lineBreakType == HB_NoBreak); + QVERIFY(attrs[15].lineBreakType == HB_NoBreak); + QVERIFY(attrs[16].lineBreakType == HB_NoBreak); + QVERIFY(attrs[17].lineBreakType == HB_Break); + QVERIFY(attrs[18].lineBreakType == HB_NoBreak); + QVERIFY(attrs[19].lineBreakType == HB_NoBreak); + QVERIFY(attrs[20].lineBreakType == HB_Break); + QVERIFY(attrs[21].lineBreakType == HB_NoBreak); + QVERIFY(attrs[22].lineBreakType == HB_NoBreak); + QVERIFY(attrs[23].lineBreakType == HB_NoBreak); + QVERIFY(attrs[24].lineBreakType == HB_NoBreak); + QVERIFY(attrs[25].lineBreakType == HB_Break); + QVERIFY(attrs[26].lineBreakType == HB_NoBreak); + for (int i = 27; i < 32; ++i) + QVERIFY(attrs[i].lineBreakType == HB_NoBreak); +} + +QTEST_MAIN(tst_CharAttributes) +#include "main.moc" diff --git a/tqtinterface/qt4/include/private/qt4_harfbuzz/tests/shaping/Makefile.am b/tqtinterface/qt4/include/private/qt4_harfbuzz/tests/shaping/Makefile.am new file mode 100644 index 0000000..31c6db7 --- /dev/null +++ b/tqtinterface/qt4/include/private/qt4_harfbuzz/tests/shaping/Makefile.am @@ -0,0 +1,14 @@ + +check_PROGRAMS = shaping + +shaping_SOURCES = main.cpp ../linebreaking/harfbuzz-qt.cpp +shaping_LDADD = $(QT_GUI_LIBS) $(QT_QTEST_LIBS) ../../src/libharfbuzz-1.la + +main.o: main.moc + +main.moc: $(srcdir)/main.cpp + $(QT_MOC) -o main.moc $(srcdir)/main.cpp + +INCLUDES = -I$(top_srcdir)/src $(FREETYPE_CFLAGS) $(QT_GUI_CFLAGS) $(QT_QTEST_CFLAGS) +AM_CPPFLAGS = -DQT_GUI_LIB -DSRCDIR=\"$(srcdir)\" + diff --git a/tqtinterface/qt4/include/private/qt4_harfbuzz/tests/shaping/README b/tqtinterface/qt4/include/private/qt4_harfbuzz/tests/shaping/README new file mode 100644 index 0000000..1db1c5a --- /dev/null +++ b/tqtinterface/qt4/include/private/qt4_harfbuzz/tests/shaping/README @@ -0,0 +1,9 @@ +These shaper tests need some specific TrueType fonts. You can get a package of +them from + + http://people.freedesktop.org/~hausmann/harfbuzz-test-fonts-0.1.tar.bz2 + +In addition you may need two fonts (Mangal and Tunga) from Microsoft Windows +for some of the test cases. These fonts are not freely redistributable. + +The test program looks for them in a fonts/ subdirectory. diff --git a/tqtinterface/qt4/include/private/qt4_harfbuzz/tests/shaping/main.cpp b/tqtinterface/qt4/include/private/qt4_harfbuzz/tests/shaping/main.cpp new file mode 100644 index 0000000..d30b1a0 --- /dev/null +++ b/tqtinterface/qt4/include/private/qt4_harfbuzz/tests/shaping/main.cpp @@ -0,0 +1,1291 @@ +/* + * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) + * + * This is part of HarfBuzz, an OpenType Layout engine library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#include + +#include +#include FT_FREETYPE_H +#include FT_TRUETYPE_TABLES_H + +#include +#include +#include + +static FT_Library freetype; + +static FT_Face loadFace(const char *name) +{ + FT_Face face; + char path[256]; + + strcpy(path, SRCDIR); + strcat(path, "/fonts/"); + strcat(path, name); + + if (FT_New_Face(freetype, path, /*index*/0, &face)) + return 0; + return face; +} + +static HB_UChar32 getChar(const HB_UChar16 *string, hb_uint32 length, hb_uint32 &i) +{ + HB_UChar32 ch; + if (HB_IsHighSurrogate(string[i]) + && i < length - 1 + && HB_IsLowSurrogate(string[i + 1])) { + ch = HB_SurrogateToUcs4(string[i], string[i + 1]); + ++i; + } else { + ch = string[i]; + } + return ch; +} + +static HB_Bool hb_stringToGlyphs(HB_Font font, const HB_UChar16 *string, hb_uint32 length, HB_Glyph *glyphs, hb_uint32 *numGlyphs, HB_Bool /*rightToLeft*/) +{ + FT_Face face = (FT_Face)font->userData; + if (length > *numGlyphs) + return false; + + int glyph_pos = 0; + for (hb_uint32 i = 0; i < length; ++i) { + glyphs[glyph_pos] = FT_Get_Char_Index(face, getChar(string, length, i)); + ++glyph_pos; + } + + *numGlyphs = glyph_pos; + + return true; +} + +static void hb_getAdvances(HB_Font /*font*/, const HB_Glyph * /*glyphs*/, hb_uint32 numGlyphs, HB_Fixed *advances, int /*flags*/) +{ + for (hb_uint32 i = 0; i < numGlyphs; ++i) + advances[i] = 0; // ### not tested right now +} + +static HB_Bool hb_canRender(HB_Font font, const HB_UChar16 *string, hb_uint32 length) +{ + FT_Face face = (FT_Face)font->userData; + + for (hb_uint32 i = 0; i < length; ++i) + if (!FT_Get_Char_Index(face, getChar(string, length, i))) + return false; + + return true; +} + +static HB_Error hb_getSFntTable(void *font, HB_Tag tableTag, HB_Byte *buffer, HB_UInt *length) +{ + FT_Face face = (FT_Face)font; + FT_ULong ftlen = *length; + FT_Error error = 0; + + if (!FT_IS_SFNT(face)) + return HB_Err_Invalid_Argument; + + error = FT_Load_Sfnt_Table(face, tableTag, 0, buffer, &ftlen); + *length = ftlen; + return (HB_Error)error; +} + +HB_Error hb_getPointInOutline(HB_Font font, HB_Glyph glyph, int flags, hb_uint32 point, HB_Fixed *xpos, HB_Fixed *ypos, hb_uint32 *nPoints) +{ + HB_Error error = HB_Err_Ok; + FT_Face face = (FT_Face)font->userData; + + int load_flags = (flags & HB_ShaperFlag_UseDesignMetrics) ? FT_LOAD_NO_HINTING : FT_LOAD_DEFAULT; + + if ((error = (HB_Error)FT_Load_Glyph(face, glyph, load_flags))) + return error; + + if (face->glyph->format != ft_glyph_format_outline) + return (HB_Error)HB_Err_Invalid_SubTable; + + *nPoints = face->glyph->outline.n_points; + if (!(*nPoints)) + return HB_Err_Ok; + + if (point > *nPoints) + return (HB_Error)HB_Err_Invalid_SubTable; + + *xpos = face->glyph->outline.points[point].x; + *ypos = face->glyph->outline.points[point].y; + + return HB_Err_Ok; +} + +void hb_getGlyphMetrics(HB_Font, HB_Glyph, HB_GlyphMetrics *metrics) +{ + // ### + metrics->x = metrics->y = metrics->width = metrics->height = metrics->xOffset = metrics->yOffset = 0; +} + +HB_Fixed hb_getFontMetric(HB_Font, HB_FontMetric ) +{ + return 0; // #### +} + +const HB_FontClass hb_fontClass = { + hb_stringToGlyphs, hb_getAdvances, hb_canRender, + hb_getPointInOutline, hb_getGlyphMetrics, hb_getFontMetric +}; + + +//TESTED_CLASS= +//TESTED_FILES= gui/text/qscriptengine.cpp + +class tst_QScriptEngine : public TQT_BASE_OBJECT_NAME +{ +Q_OBJECT + +public: + tst_QScriptEngine(); + virtual ~tst_QScriptEngine(); + + +public slots: + void initTestCase(); + void cleanupTestCase(); +private slots: + void greek(); + + void devanagari(); + void bengali(); + void gurmukhi(); + // gujarati missing + void oriya(); + void tamil(); + void telugu(); + void kannada(); + void malayalam(); + void sinhala(); + + void khmer(); + void nko(); + void linearB(); +}; + +tst_QScriptEngine::tst_QScriptEngine() +{ +} + +tst_QScriptEngine::~tst_QScriptEngine() +{ +} + +void tst_QScriptEngine::initTestCase() +{ + FT_Init_FreeType(&freetype); +} + +void tst_QScriptEngine::cleanupTestCase() +{ + FT_Done_FreeType(freetype); +} + +class Shaper +{ +public: + Shaper(FT_Face face, HB_Script script, const QString &str); + + HB_FontRec hbFont; + HB_ShaperItem shaper_item; + QVarLengthArray hb_glyphs; + QVarLengthArray hb_attributes; + QVarLengthArray hb_advances; + QVarLengthArray hb_offsets; + QVarLengthArray hb_logClusters; + +}; + +Shaper::Shaper(FT_Face face, HB_Script script, const QString &str) +{ + HB_Face hbFace = HB_NewFace(face, hb_getSFntTable); + + hbFont.klass = &hb_fontClass; + hbFont.userData = face; + hbFont.x_ppem = face->size->metrics.x_ppem; + hbFont.y_ppem = face->size->metrics.y_ppem; + hbFont.x_scale = face->size->metrics.x_scale; + hbFont.y_scale = face->size->metrics.y_scale; + + shaper_item.kerning_applied = false; + shaper_item.string = reinterpret_cast(str.constData()); + shaper_item.stringLength = str.length(); + shaper_item.item.script = script; + shaper_item.item.pos = 0; + shaper_item.item.length = shaper_item.stringLength; + shaper_item.item.bidiLevel = 0; // ### + shaper_item.shaperFlags = 0; + shaper_item.font = &hbFont; + shaper_item.face = hbFace; + shaper_item.num_glyphs = shaper_item.item.length; + shaper_item.glyphIndicesPresent = false; + shaper_item.initialGlyphCount = 0; + + + while (1) { + hb_glyphs.resize(shaper_item.num_glyphs); + hb_attributes.resize(shaper_item.num_glyphs); + hb_advances.resize(shaper_item.num_glyphs); + hb_offsets.resize(shaper_item.num_glyphs); + hb_logClusters.resize(shaper_item.num_glyphs); + + memset(hb_glyphs.data(), 0, hb_glyphs.size() * sizeof(HB_Glyph)); + memset(hb_attributes.data(), 0, hb_attributes.size() * sizeof(HB_GlyphAttributes)); + memset(hb_advances.data(), 0, hb_advances.size() * sizeof(HB_Fixed)); + memset(hb_offsets.data(), 0, hb_offsets.size() * sizeof(HB_FixedPoint)); + + shaper_item.glyphs = hb_glyphs.data(); + shaper_item.attributes = hb_attributes.data(); + shaper_item.advances = hb_advances.data(); + shaper_item.offsets = hb_offsets.data(); + shaper_item.log_clusters = hb_logClusters.data(); + + if (HB_ShapeItem(&shaper_item)) + break; + } + + HB_FreeFace(hbFace); +} + + +static bool decomposedShaping(FT_Face face, HB_Script script, const QChar &ch) +{ + QString uc = QString().append(ch); + Shaper shaper(face, script, uc); + + uc = uc.normalized(QString::NormalizationForm_D); + Shaper decomposed(face, script, uc); + + if( shaper.shaper_item.num_glyphs != decomposed.shaper_item.num_glyphs ) + goto error; + + for (unsigned int i = 0; i < shaper.shaper_item.num_glyphs; ++i) { + if ((shaper.shaper_item.glyphs[i]&0xffffff) != (decomposed.shaper_item.glyphs[i]&0xffffff)) + goto error; + } + return true; + error: + QString str = ""; + int i = 0; + while (i < uc.length()) { + str += QString("%1 ").arg(uc[i].unicode(), 4, 16); + ++i; + } + qDebug("%s: decomposedShaping of char %4x failed\n decomposedString: %s\n nglyphs=%d, decomposed nglyphs %d", + face->family_name, + ch.unicode(), str.toLatin1().data(), + shaper.shaper_item.num_glyphs, + decomposed.shaper_item.num_glyphs); + + str = ""; + i = 0; + while (i < shaper.shaper_item.num_glyphs) { + str += QString("%1 ").arg(shaper.shaper_item.glyphs[i], 4, 16); + ++i; + } + qDebug(" composed glyph result = %s", str.toLatin1().constData()); + str = ""; + i = 0; + while (i < decomposed.shaper_item.num_glyphs) { + str += QString("%1 ").arg(decomposed.shaper_item.glyphs[i], 4, 16); + ++i; + } + qDebug(" decomposed glyph result = %s", str.toLatin1().constData()); + return false; +} + +struct ShapeTable { + unsigned short unicode[16]; + unsigned short glyphs[16]; +}; + +static bool shaping(FT_Face face, const ShapeTable *s, HB_Script script) +{ + Shaper shaper(face, script, QString::fromUtf16( s->unicode )); + + hb_uint32 nglyphs = 0; + const unsigned short *g = s->glyphs; + while ( *g ) { + nglyphs++; + g++; + } + + if( nglyphs != shaper.shaper_item.num_glyphs ) + goto error; + + for (hb_uint32 i = 0; i < nglyphs; ++i) { + if ((shaper.shaper_item.glyphs[i]&0xffffff) != s->glyphs[i]) + goto error; + } + return true; + error: + QString str = ""; + const unsigned short *uc = s->unicode; + while (*uc) { + str += QString("%1 ").arg(*uc, 4, 16); + ++uc; + } + qDebug("%s: shaping of string %s failed, nglyphs=%d, expected %d", + face->family_name, + str.toLatin1().constData(), + shaper.shaper_item.num_glyphs, nglyphs); + + str = ""; + hb_uint32 i = 0; + while (i < shaper.shaper_item.num_glyphs) { + str += QString("%1 ").arg(shaper.shaper_item.glyphs[i], 4, 16); + ++i; + } + qDebug(" glyph result = %s", str.toLatin1().constData()); + return false; +} + + +void tst_QScriptEngine::greek() +{ + FT_Face face = loadFace("DejaVuSans.ttf"); + if (face) { + for (int uc = 0x1f00; uc <= 0x1fff; ++uc) { + QString str; + str.append(uc); + if (str.normalized(QString::NormalizationForm_D).normalized(QString::NormalizationForm_C) != str) { + //qDebug() << "skipping" << hex << uc; + continue; + } + if (uc == 0x1fc1 || uc == 0x1fed) + continue; + QVERIFY( decomposedShaping(face, HB_Script_Greek, QChar(uc)) ); + } + FT_Done_Face(face); + } else { + QSKIP("couln't find DejaVu Sans", SkipAll); + } + + + face = loadFace("SBL_grk.ttf"); + if (face) { + for (int uc = 0x1f00; uc <= 0x1fff; ++uc) { + QString str; + str.append(uc); + if (str.normalized(QString::NormalizationForm_D).normalized(QString::NormalizationForm_C) != str) { + //qDebug() << "skipping" << hex << uc; + continue; + } + if (uc == 0x1fc1 || uc == 0x1fed) + continue; + QVERIFY( decomposedShaping(face, HB_Script_Greek, QChar(uc)) ); + + } + + const ShapeTable shape_table [] = { + { { 0x3b1, 0x300, 0x313, 0x0 }, + { 0xb8, 0x3d3, 0x3c7, 0x0 } }, + { { 0x3b1, 0x313, 0x300, 0x0 }, + { 0xd4, 0x0 } }, + + { {0}, {0} } + }; + + + const ShapeTable *s = shape_table; + while (s->unicode[0]) { + QVERIFY( shaping(face, s, HB_Script_Greek) ); + ++s; + } + + FT_Done_Face(face); + } else { + QSKIP("couln't find DejaVu Sans", SkipAll); + } +} + + +void tst_QScriptEngine::devanagari() +{ + { + FT_Face face = loadFace("raghu.ttf"); + if (face) { + const ShapeTable shape_table [] = { + // Ka + { { 0x0915, 0x0 }, + { 0x0080, 0x0 } }, + // Ka Halant + { { 0x0915, 0x094d, 0x0 }, + { 0x0080, 0x0051, 0x0 } }, + // Ka Halant Ka + { { 0x0915, 0x094d, 0x0915, 0x0 }, + { 0x00c8, 0x0080, 0x0 } }, + // Ka MatraI + { { 0x0915, 0x093f, 0x0 }, + { 0x01d1, 0x0080, 0x0 } }, + // Ra Halant Ka + { { 0x0930, 0x094d, 0x0915, 0x0 }, + { 0x0080, 0x005b, 0x0 } }, + // Ra Halant Ka MatraI + { { 0x0930, 0x094d, 0x0915, 0x093f, 0x0 }, + { 0x01d1, 0x0080, 0x005b, 0x0 } }, + // MatraI + { { 0x093f, 0x0 }, + { 0x01d4, 0x029c, 0x0 } }, + // Ka Nukta + { { 0x0915, 0x093c, 0x0 }, + { 0x00a4, 0x0 } }, + // Ka Halant Ra + { { 0x0915, 0x094d, 0x0930, 0x0 }, + { 0x0110, 0x0 } }, + // Ka Halant Ra Halant Ka + { { 0x0915, 0x094d, 0x0930, 0x094d, 0x0915, 0x0 }, + { 0x0158, 0x0080, 0x0 } }, + { { 0x0930, 0x094d, 0x200d, 0x0 }, + { 0x00e2, 0x0 } }, + { { 0x0915, 0x094d, 0x0930, 0x094d, 0x200d, 0x0 }, + { 0x0158, 0x0 } }, + + { {0}, {0} } + }; + + + const ShapeTable *s = shape_table; + while (s->unicode[0]) { + QVERIFY( shaping(face, s, HB_Script_Devanagari) ); + ++s; + } + + FT_Done_Face(face); + } else { + QSKIP("couln't find raghu.ttf", SkipAll); + } + } + + { + FT_Face face = loadFace("mangal.ttf"); + if (face) { + const ShapeTable shape_table [] = { + // Ka + { { 0x0915, 0x0 }, + { 0x0080, 0x0 } }, + // Ka Halant + { { 0x0915, 0x094d, 0x0 }, + { 0x0080, 0x0051, 0x0 } }, + // Ka Halant Ka + { { 0x0915, 0x094d, 0x0915, 0x0 }, + { 0x00c8, 0x0080, 0x0 } }, + // Ka MatraI + { { 0x0915, 0x093f, 0x0 }, + { 0x01d1, 0x0080, 0x0 } }, + // Ra Halant Ka + { { 0x0930, 0x094d, 0x0915, 0x0 }, + { 0x0080, 0x005b, 0x0 } }, + // Ra Halant Ka MatraI + { { 0x0930, 0x094d, 0x0915, 0x093f, 0x0 }, + { 0x01d1, 0x0080, 0x005b, 0x0 } }, + // MatraI + { { 0x093f, 0x0 }, + { 0x01d4, 0x029c, 0x0 } }, + // Ka Nukta + { { 0x0915, 0x093c, 0x0 }, + { 0x00a4, 0x0 } }, + // Ka Halant Ra + { { 0x0915, 0x094d, 0x0930, 0x0 }, + { 0x0110, 0x0 } }, + // Ka Halant Ra Halant Ka + { { 0x0915, 0x094d, 0x0930, 0x094d, 0x0915, 0x0 }, + { 0x0158, 0x0080, 0x0 } }, + + { { 0x92b, 0x94d, 0x930, 0x0 }, + { 0x125, 0x0 } }, + { { 0x92b, 0x93c, 0x94d, 0x930, 0x0 }, + { 0x149, 0x0 } }, + { {0}, {0} } + }; + + const ShapeTable *s = shape_table; + while (s->unicode[0]) { + QVERIFY( shaping(face, s, HB_Script_Devanagari) ); + ++s; + } + + FT_Done_Face(face); + } else { + QSKIP("couldn't find mangal.ttf", SkipAll); + } + } +} + +void tst_QScriptEngine::bengali() +{ + { + FT_Face face = loadFace("AkaashNormal.ttf"); + if (face) { + const ShapeTable shape_table [] = { + // Ka + { { 0x0995, 0x0 }, + { 0x0151, 0x0 } }, + // Ka Halant + { { 0x0995, 0x09cd, 0x0 }, + { 0x0151, 0x017d, 0x0 } }, + // Ka Halant Ka + { { 0x0995, 0x09cd, 0x0995, 0x0 }, + { 0x019b, 0x0 } }, + // Ka MatraI + { { 0x0995, 0x09bf, 0x0 }, + { 0x0173, 0x0151, 0x0 } }, + // Ra Halant Ka + { { 0x09b0, 0x09cd, 0x0995, 0x0 }, + { 0x0151, 0x0276, 0x0 } }, + // Ra Halant Ka MatraI + { { 0x09b0, 0x09cd, 0x0995, 0x09bf, 0x0 }, + { 0x0173, 0x0151, 0x0276, 0x0 } }, + // Ka Nukta + { { 0x0995, 0x09bc, 0x0 }, + { 0x0151, 0x0171, 0x0 } }, + // Ka Halant Ra + { { 0x0995, 0x09cd, 0x09b0, 0x0 }, + { 0x01f4, 0x0 } }, + // Ka Halant Ra Halant Ka + { { 0x0995, 0x09cd, 0x09b0, 0x09cd, 0x0995, 0x0 }, + { 0x025c, 0x0276, 0x0151, 0x0 } }, + // Ya + Halant + { { 0x09af, 0x09cd, 0x0 }, + { 0x016a, 0x017d, 0x0 } }, + // Da Halant Ya -> Da Ya-Phala + { { 0x09a6, 0x09cd, 0x09af, 0x0 }, + { 0x01e5, 0x0 } }, + // A Halant Ya -> A Ya-phala + { { 0x0985, 0x09cd, 0x09af, 0x0 }, + { 0x0145, 0x01cf, 0x0 } }, + // Na Halant Ka + { { 0x09a8, 0x09cd, 0x0995, 0x0 }, + { 0x026f, 0x0151, 0x0 } }, + // Na Halant ZWNJ Ka + { { 0x09a8, 0x09cd, 0x200c, 0x0995, 0x0 }, + { 0x0164, 0x017d, 0x0151, 0x0 } }, + // Na Halant ZWJ Ka + { { 0x09a8, 0x09cd, 0x200d, 0x0995, 0x0 }, + { 0x026f, 0x0151, 0x0 } }, + // Ka Halant ZWNJ Ka + { { 0x0995, 0x09cd, 0x200c, 0x0995, 0x0 }, + { 0x0151, 0x017d, 0x0151, 0x0 } }, + // Ka Halant ZWJ Ka + { { 0x0995, 0x09cd, 0x200d, 0x0995, 0x0 }, + { 0x025c, 0x0151, 0x0 } }, + // Na Halant Ra + { { 0x09a8, 0x09cd, 0x09b0, 0x0 }, + { 0x0207, 0x0 } }, + // Na Halant ZWNJ Ra + { { 0x09a8, 0x09cd, 0x200c, 0x09b0, 0x0 }, + { 0x0164, 0x017d, 0x016b, 0x0 } }, + // Na Halant ZWJ Ra + { { 0x09a8, 0x09cd, 0x200d, 0x09b0, 0x0 }, + { 0x026f, 0x016b, 0x0 } }, + // Na Halant Ba + { { 0x09a8, 0x09cd, 0x09ac, 0x0 }, + { 0x022f, 0x0 } }, + // Na Halant ZWNJ Ba + { { 0x09a8, 0x09cd, 0x200c, 0x09ac, 0x0 }, + { 0x0164, 0x017d, 0x0167, 0x0 } }, + // Na Halant ZWJ Ba + { { 0x09a8, 0x09cd, 0x200d, 0x09ac, 0x0 }, + { 0x026f, 0x0167, 0x0 } }, + // Na Halant Dha + { { 0x09a8, 0x09cd, 0x09a7, 0x0 }, + { 0x01d3, 0x0 } }, + // Na Halant ZWNJ Dha + { { 0x09a8, 0x09cd, 0x200c, 0x09a7, 0x0 }, + { 0x0164, 0x017d, 0x0163, 0x0 } }, + // Na Halant ZWJ Dha + { { 0x09a8, 0x09cd, 0x200d, 0x09a7, 0x0 }, + { 0x026f, 0x0163, 0x0 } }, + // Ra Halant Ka MatraAU + { { 0x09b0, 0x09cd, 0x0995, 0x09cc, 0x0 }, + { 0x0179, 0x0151, 0x0276, 0x017e, 0x0 } }, + // Ra Halant Ba Halant Ba + { { 0x09b0, 0x09cd, 0x09ac, 0x09cd, 0x09ac, 0x0 }, + { 0x0232, 0x0276, 0x0 } }, + { { 0x9b0, 0x9cd, 0x995, 0x9be, 0x982, 0x0 }, + { 0x151, 0x276, 0x172, 0x143, 0x0 } }, + { { 0x9b0, 0x9cd, 0x995, 0x9be, 0x983, 0x0 }, + { 0x151, 0x276, 0x172, 0x144, 0x0 } }, + // test decomposed two parts matras + { { 0x995, 0x9c7, 0x9be, 0x0 }, + { 0x179, 0x151, 0x172, 0x0 } }, + { { 0x995, 0x9c7, 0x9d7, 0x0 }, + { 0x179, 0x151, 0x17e, 0x0 } }, + { { 0x9b0, 0x9cd, 0x9ad, 0x0 }, + { 0x168, 0x276, 0x0 } }, + { { 0x9f0, 0x9cd, 0x9ad, 0x0 }, + { 0x168, 0x276, 0x0 } }, + { { 0x9f1, 0x9cd, 0x9ad, 0x0 }, + { 0x191, 0x17d, 0x168, 0x0 } }, + + { {0}, {0} } + }; + + + const ShapeTable *s = shape_table; + while (s->unicode[0]) { + QVERIFY( shaping(face, s, HB_Script_Bengali) ); + ++s; + } + + FT_Done_Face(face); + } else { + QSKIP("couln't find AkaashNormal.ttf", SkipAll); + } + } + { + FT_Face face = loadFace("MuktiNarrow.ttf"); + if (face) { + const ShapeTable shape_table [] = { + // Ka + { { 0x0995, 0x0 }, + { 0x0073, 0x0 } }, + // Ka Halant + { { 0x0995, 0x09cd, 0x0 }, + { 0x00b9, 0x0 } }, + // Ka Halant Ka + { { 0x0995, 0x09cd, 0x0995, 0x0 }, + { 0x0109, 0x0 } }, + // Ka MatraI + { { 0x0995, 0x09bf, 0x0 }, + { 0x0095, 0x0073, 0x0 } }, + // Ra Halant Ka + { { 0x09b0, 0x09cd, 0x0995, 0x0 }, + { 0x0073, 0x00e1, 0x0 } }, + // Ra Halant Ka MatraI + { { 0x09b0, 0x09cd, 0x0995, 0x09bf, 0x0 }, + { 0x0095, 0x0073, 0x00e1, 0x0 } }, + // MatraI + { { 0x09bf, 0x0 }, + { 0x0095, 0x01c8, 0x0 } }, + // Ka Nukta + { { 0x0995, 0x09bc, 0x0 }, + { 0x0073, 0x0093, 0x0 } }, + // Ka Halant Ra + { { 0x0995, 0x09cd, 0x09b0, 0x0 }, + { 0x00e5, 0x0 } }, + // Ka Halant Ra Halant Ka + { { 0x995, 0x9cd, 0x9b0, 0x9cd, 0x995, 0x0 }, + { 0x234, 0x24e, 0x73, 0x0 } }, + // Ya + Halant + { { 0x09af, 0x09cd, 0x0 }, + { 0x00d2, 0x0 } }, + // Da Halant Ya -> Da Ya-Phala + { { 0x09a6, 0x09cd, 0x09af, 0x0 }, + { 0x0084, 0x00e2, 0x0 } }, + // A Halant Ya -> A Ya-phala + { { 0x0985, 0x09cd, 0x09af, 0x0 }, + { 0x0067, 0x00e2, 0x0 } }, + // Na Halant Ka + { { 0x09a8, 0x09cd, 0x0995, 0x0 }, + { 0x0188, 0x0 } }, + // Na Halant ZWNJ Ka + { { 0x9a8, 0x9cd, 0x200c, 0x995, 0x0 }, + { 0xcc, 0x73, 0x0 } }, + // Na Halant ZWJ Ka + { { 0x9a8, 0x9cd, 0x200d, 0x995, 0x0 }, + { 0x247, 0x73, 0x0 } }, + // Ka Halant ZWNJ Ka + { { 0x9a8, 0x9cd, 0x200d, 0x995, 0x0 }, + { 0x247, 0x73, 0x0 } }, + // Ka Halant ZWJ Ka + { { 0x9a8, 0x9cd, 0x200d, 0x995, 0x0 }, + { 0x247, 0x73, 0x0 } }, + // Na Halant Ra + { { 0x09a8, 0x09cd, 0x09b0, 0x0 }, + { 0x00f8, 0x0 } }, + // Na Halant ZWNJ Ra + { { 0x09a8, 0x09cd, 0x200c, 0x09b0, 0x0 }, + { 0xcc, 0x8d, 0x0 } }, + // Na Halant ZWJ Ra + { { 0x9a8, 0x9cd, 0x200d, 0x9b0, 0x0 }, + { 0x247, 0x8d, 0x0 } }, + // Na Halant Ba + { { 0x09a8, 0x09cd, 0x09ac, 0x0 }, + { 0x0139, 0x0 } }, + // Na Halant ZWNJ Ba + { { 0x9a8, 0x9cd, 0x200c, 0x9ac, 0x0 }, + { 0xcc, 0x89, 0x0 } }, + // Na Halant ZWJ Ba + { { 0x9a8, 0x9cd, 0x200d, 0x9ac, 0x0 }, + { 0x247, 0x89, 0x0 } }, + // Na Halant Dha + { { 0x09a8, 0x09cd, 0x09a7, 0x0 }, + { 0x0145, 0x0 } }, + // Na Halant ZWNJ Dha + { { 0x09a8, 0x09cd, 0x200c, 0x09a7, 0x0 }, + { 0xcc, 0x85, 0x0 } }, + // Na Halant ZWJ Dha + { { 0x09a8, 0x09cd, 0x200d, 0x09a7, 0x0 }, + { 0x247, 0x85, 0x0 } }, + // Ra Halant Ka MatraAU + { { 0x9b0, 0x9cd, 0x995, 0x9cc, 0x0 }, + { 0x232, 0x73, 0xe1, 0xa0, 0x0 } }, + // Ra Halant Ba Halant Ba + { { 0x09b0, 0x09cd, 0x09ac, 0x09cd, 0x09ac, 0x0 }, + { 0x013b, 0x00e1, 0x0 } }, + + { {0}, {0} } + }; + + + const ShapeTable *s = shape_table; + while (s->unicode[0]) { + QVERIFY( shaping(face, s, HB_Script_Bengali) ); + ++s; + } + + FT_Done_Face(face); + } else { + QSKIP("couln't find MuktiNarrow.ttf", SkipAll); + } + } + { + FT_Face face = loadFace("LikhanNormal.ttf"); + if (face) { + const ShapeTable shape_table [] = { + { { 0x09a8, 0x09cd, 0x09af, 0x0 }, + { 0x01ca, 0x0 } }, + { { 0x09b8, 0x09cd, 0x09af, 0x0 }, + { 0x020e, 0x0 } }, + { { 0x09b6, 0x09cd, 0x09af, 0x0 }, + { 0x01f4, 0x0 } }, + { { 0x09b7, 0x09cd, 0x09af, 0x0 }, + { 0x01fe, 0x0 } }, + { { 0x09b0, 0x09cd, 0x09a8, 0x09cd, 0x200d, 0x0 }, + { 0x10b, 0x167, 0x0 } }, + { { 0x9b0, 0x9cd, 0x9ad, 0x0 }, + { 0xa1, 0x167, 0x0 } }, + { { 0x9f0, 0x9cd, 0x9ad, 0x0 }, + { 0xa1, 0x167, 0x0 } }, + { { 0x9f1, 0x9cd, 0x9ad, 0x0 }, + { 0x11c, 0xa1, 0x0 } }, + + { {0}, {0} } + }; + + + const ShapeTable *s = shape_table; + while (s->unicode[0]) { + QVERIFY( shaping(face, s, HB_Script_Bengali) ); + ++s; + } + + FT_Done_Face(face); + } else { + QSKIP("couln't find LikhanNormal.ttf", SkipAll); + } + } +} + +void tst_QScriptEngine::gurmukhi() +{ + { + FT_Face face = loadFace("lohit_pa.ttf"); + if (face) { + const ShapeTable shape_table [] = { + { { 0xA15, 0xA4D, 0xa39, 0x0 }, + { 0x3b, 0x8b, 0x0 } }, + { {0}, {0} } + }; + + + const ShapeTable *s = shape_table; + while (s->unicode[0]) { + QVERIFY( shaping(face, s, HB_Script_Gurmukhi) ); + ++s; + } + + FT_Done_Face(face); + } else { + QSKIP("couln't find lohit.punjabi.1.1.ttf", SkipAll); + } + } +} + +void tst_QScriptEngine::oriya() +{ + { + FT_Face face = loadFace("utkalm.ttf"); + if (face) { + const ShapeTable shape_table [] = { + { { 0xb15, 0xb4d, 0xb24, 0xb4d, 0xb30, 0x0 }, + { 0x150, 0x125, 0x0 } }, + { { 0xb24, 0xb4d, 0xb24, 0xb4d, 0xb2c, 0x0 }, + { 0x151, 0x120, 0x0 } }, + { { 0xb28, 0xb4d, 0xb24, 0xb4d, 0xb2c, 0x0 }, + { 0x152, 0x120, 0x0 } }, + { { 0xb28, 0xb4d, 0xb24, 0xb4d, 0xb2c, 0x0 }, + { 0x152, 0x120, 0x0 } }, + { { 0xb28, 0xb4d, 0xb24, 0xb4d, 0xb30, 0x0 }, + { 0x176, 0x0 } }, + { { 0xb38, 0xb4d, 0xb24, 0xb4d, 0xb30, 0x0 }, + { 0x177, 0x0 } }, + { { 0xb28, 0xb4d, 0xb24, 0xb4d, 0xb30, 0xb4d, 0xb2f, 0x0 }, + { 0x176, 0x124, 0x0 } }, + { {0}, {0} } + + }; + + const ShapeTable *s = shape_table; + while (s->unicode[0]) { + QVERIFY( shaping(face, s, HB_Script_Oriya) ); + ++s; + } + + FT_Done_Face(face); + } else { + QSKIP("couln't find utkalm.ttf", SkipAll); + } + } +} + + +void tst_QScriptEngine::tamil() +{ + { + FT_Face face = loadFace("akruti1.ttf"); + if (face) { + const ShapeTable shape_table [] = { + { { 0x0b95, 0x0bc2, 0x0 }, + { 0x004e, 0x0 } }, + { { 0x0bae, 0x0bc2, 0x0 }, + { 0x009e, 0x0 } }, + { { 0x0b9a, 0x0bc2, 0x0 }, + { 0x0058, 0x0 } }, + { { 0x0b99, 0x0bc2, 0x0 }, + { 0x0053, 0x0 } }, + { { 0x0bb0, 0x0bc2, 0x0 }, + { 0x00a8, 0x0 } }, + { { 0x0ba4, 0x0bc2, 0x0 }, + { 0x008e, 0x0 } }, + { { 0x0b9f, 0x0bc2, 0x0 }, + { 0x0062, 0x0 } }, + { { 0x0b95, 0x0bc6, 0x0 }, + { 0x000a, 0x0031, 0x0 } }, + { { 0x0b95, 0x0bca, 0x0 }, + { 0x000a, 0x0031, 0x0007, 0x0 } }, + { { 0x0b95, 0x0bc6, 0x0bbe, 0x0 }, + { 0x000a, 0x0031, 0x007, 0x0 } }, + { { 0x0b95, 0x0bcd, 0x0bb7, 0x0 }, + { 0x0049, 0x0 } }, + { { 0x0b95, 0x0bcd, 0x0bb7, 0x0bca, 0x0 }, + { 0x000a, 0x0049, 0x007, 0x0 } }, + { { 0x0b95, 0x0bcd, 0x0bb7, 0x0bc6, 0x0bbe, 0x0 }, + { 0x000a, 0x0049, 0x007, 0x0 } }, + { { 0x0b9f, 0x0bbf, 0x0 }, + { 0x005f, 0x0 } }, + { { 0x0b9f, 0x0bc0, 0x0 }, + { 0x0060, 0x0 } }, + { { 0x0bb2, 0x0bc0, 0x0 }, + { 0x00ab, 0x0 } }, + { { 0x0bb2, 0x0bbf, 0x0 }, + { 0x00aa, 0x0 } }, + { { 0x0bb0, 0x0bcd, 0x0 }, + { 0x00a4, 0x0 } }, + { { 0x0bb0, 0x0bbf, 0x0 }, + { 0x00a5, 0x0 } }, + { { 0x0bb0, 0x0bc0, 0x0 }, + { 0x00a6, 0x0 } }, + { { 0x0b83, 0x0 }, + { 0x0025, 0x0 } }, + { { 0x0b83, 0x0b95, 0x0 }, + { 0x0025, 0x0031, 0x0 } }, + + { {0}, {0} } + }; + + + const ShapeTable *s = shape_table; + while (s->unicode[0]) { + QVERIFY( shaping(face, s, HB_Script_Tamil) ); + ++s; + } + + FT_Done_Face(face); + } else { + QSKIP("couln't find akruti1.ttf", SkipAll); + } + } +} + + +void tst_QScriptEngine::telugu() +{ + { + FT_Face face = loadFace("Pothana2000.ttf"); + if (face) { + const ShapeTable shape_table [] = { + { { 0xc15, 0xc4d, 0x0 }, + { 0xbb, 0x0 } }, + { { 0xc15, 0xc4d, 0xc37, 0x0 }, + { 0x4b, 0x0 } }, + { { 0xc15, 0xc4d, 0xc37, 0xc4d, 0x0 }, + { 0xe0, 0x0 } }, + { { 0xc15, 0xc4d, 0xc37, 0xc4d, 0xc23, 0x0 }, + { 0x4b, 0x91, 0x0 } }, + { { 0xc15, 0xc4d, 0xc30, 0x0 }, + { 0x5a, 0xb2, 0x0 } }, + { { 0xc15, 0xc4d, 0xc30, 0xc4d, 0x0 }, + { 0xbb, 0xb2, 0x0 } }, + { { 0xc15, 0xc4d, 0xc30, 0xc4d, 0xc15, 0x0 }, + { 0x5a, 0xb2, 0x83, 0x0 } }, + { { 0xc15, 0xc4d, 0xc30, 0xc3f, 0x0 }, + { 0xe2, 0xb2, 0x0 } }, + { { 0xc15, 0xc4d, 0xc15, 0xc48, 0x0 }, + { 0xe6, 0xb3, 0x83, 0x0 } }, + { { 0xc15, 0xc4d, 0xc30, 0xc48, 0x0 }, + { 0xe6, 0xb3, 0x9f, 0x0 } }, + { { 0xc15, 0xc46, 0xc56, 0x0 }, + { 0xe6, 0xb3, 0x0 } }, + { {0}, {0} } + }; + + const ShapeTable *s = shape_table; + while (s->unicode[0]) { + QVERIFY( shaping(face, s, HB_Script_Telugu) ); + ++s; + } + + FT_Done_Face(face); + } else { + QSKIP("couln't find Pothana2000.ttf", SkipAll); + } + } +} + + +void tst_QScriptEngine::kannada() +{ + { + FT_Face face = loadFace("Sampige.ttf"); + if (face) { + const ShapeTable shape_table [] = { + { { 0x0ca8, 0x0ccd, 0x0ca8, 0x0 }, + { 0x0049, 0x00ba, 0x0 } }, + { { 0x0ca8, 0x0ccd, 0x0ca1, 0x0 }, + { 0x0049, 0x00b3, 0x0 } }, + { { 0x0caf, 0x0cc2, 0x0 }, + { 0x004f, 0x005d, 0x0 } }, + { { 0x0ce0, 0x0 }, + { 0x006a, 0x0 } }, + { { 0x0ce6, 0x0ce7, 0x0ce8, 0x0 }, + { 0x006b, 0x006c, 0x006d, 0x0 } }, + { { 0x0cb5, 0x0ccb, 0x0 }, + { 0x015f, 0x0067, 0x0 } }, + { { 0x0cb0, 0x0ccd, 0x0cae, 0x0 }, + { 0x004e, 0x0082, 0x0 } }, + { { 0x0cb0, 0x0ccd, 0x0c95, 0x0 }, + { 0x0036, 0x0082, 0x0 } }, + { { 0x0c95, 0x0ccd, 0x0cb0, 0x0 }, + { 0x0036, 0x00c1, 0x0 } }, + { { 0x0cb0, 0x0ccd, 0x200d, 0x0c95, 0x0 }, + { 0x0050, 0x00a7, 0x0 } }, + { {0}, {0} } + }; + + + const ShapeTable *s = shape_table; + while (s->unicode[0]) { + QVERIFY( shaping(face, s, HB_Script_Kannada) ); + ++s; + } + + FT_Done_Face(face); + } else { + QSKIP("couln't find Sampige.ttf", SkipAll); + } + } + { + FT_Face face = loadFace("tunga.ttf"); + if (face) { + const ShapeTable shape_table [] = { + { { 0x0cb7, 0x0cc6, 0x0 }, + { 0x00b0, 0x006c, 0x0 } }, + { { 0x0cb7, 0x0ccd, 0x0 }, + { 0x0163, 0x0 } }, + { { 0xc95, 0xcbf, 0xcd5, 0x0 }, + { 0x114, 0x73, 0x0 } }, + { { 0xc95, 0xcc6, 0xcd5, 0x0 }, + { 0x90, 0x6c, 0x73, 0x0 } }, + { { 0xc95, 0xcc6, 0xcd6, 0x0 }, + { 0x90, 0x6c, 0x74, 0x0 } }, + { { 0xc95, 0xcc6, 0xcc2, 0x0 }, + { 0x90, 0x6c, 0x69, 0x0 } }, + { { 0xc95, 0xcca, 0xcd5, 0x0 }, + { 0x90, 0x6c, 0x69, 0x73, 0x0 } }, + + + { {0}, {0} } + }; + + + const ShapeTable *s = shape_table; + while (s->unicode[0]) { + QVERIFY( shaping(face, s, HB_Script_Kannada) ); + ++s; + } + + FT_Done_Face(face); + } else { + QSKIP("couln't find tunga.ttf", SkipAll); + } + } +} + + + +void tst_QScriptEngine::malayalam() +{ + { + FT_Face face = loadFace("AkrutiMal2Normal.ttf"); + if (face) { + const ShapeTable shape_table [] = { + { { 0x0d15, 0x0d46, 0x0 }, + { 0x005e, 0x0034, 0x0 } }, + { { 0x0d15, 0x0d47, 0x0 }, + { 0x005f, 0x0034, 0x0 } }, + { { 0x0d15, 0x0d4b, 0x0 }, + { 0x005f, 0x0034, 0x0058, 0x0 } }, + { { 0x0d15, 0x0d48, 0x0 }, + { 0x0060, 0x0034, 0x0 } }, + { { 0x0d15, 0x0d4a, 0x0 }, + { 0x005e, 0x0034, 0x0058, 0x0 } }, + { { 0x0d30, 0x0d4d, 0x0d15, 0x0 }, + { 0x009e, 0x0034, 0x0 } }, + { { 0x0d15, 0x0d4d, 0x0d35, 0x0 }, + { 0x0034, 0x007a, 0x0 } }, + { { 0x0d15, 0x0d4d, 0x0d2f, 0x0 }, + { 0x0034, 0x00a2, 0x0 } }, + { { 0x0d1f, 0x0d4d, 0x0d1f, 0x0 }, + { 0x0069, 0x0 } }, + { { 0x0d26, 0x0d4d, 0x0d26, 0x0 }, + { 0x0074, 0x0 } }, + { { 0x0d30, 0x0d4d, 0x0 }, + { 0x009e, 0x0 } }, + { { 0x0d30, 0x0d4d, 0x200c, 0x0 }, + { 0x009e, 0x0 } }, + { { 0x0d30, 0x0d4d, 0x200d, 0x0 }, + { 0x009e, 0x0 } }, + { { 0xd15, 0xd46, 0xd3e, 0x0 }, + { 0x5e, 0x34, 0x58, 0x0 } }, + { { 0xd15, 0xd47, 0xd3e, 0x0 }, + { 0x5f, 0x34, 0x58, 0x0 } }, + { { 0xd15, 0xd46, 0xd57, 0x0 }, + { 0x5e, 0x34, 0x65, 0x0 } }, + { { 0xd15, 0xd57, 0x0 }, + { 0x34, 0x65, 0x0 } }, + { { 0xd1f, 0xd4d, 0xd1f, 0xd41, 0xd4d, 0x0 }, + { 0x69, 0x5b, 0x64, 0x0 } }, + + { {0}, {0} } + }; + + + const ShapeTable *s = shape_table; + while (s->unicode[0]) { + QVERIFY( shaping(face, s, HB_Script_Malayalam) ); + ++s; + } + + FT_Done_Face(face); + } else { + QSKIP("couln't find AkrutiMal2Normal.ttf", SkipAll); + } + } + + { + FT_Face face = loadFace("Rachana.ttf"); + if (face) { + const ShapeTable shape_table [] = { + { { 0xd37, 0xd4d, 0xd1f, 0xd4d, 0xd30, 0xd40, 0x0 }, + { 0x385, 0xa3, 0x0 } }, + { { 0xd2f, 0xd4d, 0xd15, 0xd4d, 0xd15, 0xd41, 0x0 }, + { 0x2ff, 0x0 } }, + { { 0xd33, 0xd4d, 0xd33, 0x0 }, + { 0x3f8, 0x0 } }, + { { 0xd2f, 0xd4d, 0xd15, 0xd4d, 0xd15, 0xd41, 0x0 }, + { 0x2ff, 0x0 } }, + { { 0xd30, 0xd4d, 0x200d, 0xd35, 0xd4d, 0xd35, 0x0 }, + { 0xf3, 0x350, 0x0 } }, + + { {0}, {0} } + }; + + + const ShapeTable *s = shape_table; + while (s->unicode[0]) { + QVERIFY( shaping(face, s, HB_Script_Malayalam) ); + ++s; + } + + FT_Done_Face(face); + } else { + QSKIP("couln't find Rachana.ttf", SkipAll); + } + } + +} + +void tst_QScriptEngine::sinhala() +{ + { + FT_Face face = loadFace("FM-MalithiUW46.ttf"); + if (face) { + const ShapeTable shape_table [] = { + { { 0xd9a, 0xdd9, 0xdcf, 0x0 }, + { 0x4a, 0x61, 0x42, 0x0 } }, + { { 0xd9a, 0xdd9, 0xddf, 0x0 }, + { 0x4a, 0x61, 0x50, 0x0 } }, + { { 0xd9a, 0xdd9, 0xdca, 0x0 }, + { 0x4a, 0x62, 0x0 } }, + { { 0xd9a, 0xddc, 0xdca, 0x0 }, + { 0x4a, 0x61, 0x42, 0x41, 0x0 } }, + { { 0xd9a, 0xdda, 0x0 }, + { 0x4a, 0x62, 0x0 } }, + { { 0xd9a, 0xddd, 0x0 }, + { 0x4a, 0x61, 0x42, 0x41, 0x0 } }, + { {0}, {0} } + }; + + const ShapeTable *s = shape_table; + while (s->unicode[0]) { + QVERIFY( shaping(face, s, HB_Script_Sinhala) ); + ++s; + } + + FT_Done_Face(face); + } else { + QSKIP("couln't find FM-MalithiUW46.ttf", SkipAll); + } + } +} + + +void tst_QScriptEngine::khmer() +{ + { + FT_Face face = loadFace("KhmerOS.ttf"); + if (face) { + const ShapeTable shape_table [] = { + { { 0x179a, 0x17cd, 0x0 }, + { 0x24c, 0x27f, 0x0 } }, + { { 0x179f, 0x17c5, 0x0 }, + { 0x273, 0x203, 0x0 } }, + { { 0x1790, 0x17d2, 0x1784, 0x17c3, 0x0 }, + { 0x275, 0x242, 0x182, 0x0 } }, + { { 0x179a, 0x0 }, + { 0x24c, 0x0 } }, + { { 0x1781, 0x17d2, 0x1798, 0x17c2, 0x0 }, + { 0x274, 0x233, 0x197, 0x0 } }, + { { 0x1798, 0x17b6, 0x0 }, + { 0x1cb, 0x0 } }, + { { 0x179a, 0x17b8, 0x0 }, + { 0x24c, 0x26a, 0x0 } }, + { { 0x1787, 0x17b6, 0x0 }, + { 0x1ba, 0x0 } }, + { { 0x1798, 0x17d2, 0x1796, 0x17bb, 0x0 }, + { 0x24a, 0x195, 0x26d, 0x0 } }, + { {0}, {0} } + }; + + + const ShapeTable *s = shape_table; + while (s->unicode[0]) { + QVERIFY( shaping(face, s, HB_Script_Khmer) ); + ++s; + } + + FT_Done_Face(face); + } else { + QSKIP("couln't find KhmerOS.ttf", SkipAll); + } + } +} + +void tst_QScriptEngine::nko() +{ + { + FT_Face face = loadFace("DejaVuSans.ttf"); + if (face) { + const ShapeTable shape_table [] = { + { { 0x7ca, 0x0 }, + { 0x5c1, 0x0 } }, + { { 0x7ca, 0x7ca, 0x0 }, + { 0x14db, 0x14d9, 0x0 } }, + { { 0x7ca, 0x7fa, 0x7ca, 0x0 }, + { 0x14db, 0x5ec, 0x14d9, 0x0 } }, + { { 0x7ca, 0x7f3, 0x7ca, 0x0 }, + { 0x14db, 0x5e7, 0x14d9, 0x0 } }, + { { 0x7ca, 0x7f3, 0x7fa, 0x7ca, 0x0 }, + { 0x14db, 0x5e7, 0x5ec, 0x14d9, 0x0 } }, + { {0}, {0} } + }; + + + const ShapeTable *s = shape_table; + while (s->unicode[0]) { + QVERIFY( shaping(face, s, HB_Script_Nko) ); + ++s; + } + + FT_Done_Face(face); + } else { + QSKIP("couln't find DejaVuSans.ttf", SkipAll); + } + } +} + + +void tst_QScriptEngine::linearB() +{ + { + FT_Face face = loadFace("penuture.ttf"); + if (face) { + const ShapeTable shape_table [] = { + { { 0xd800, 0xdc01, 0xd800, 0xdc02, 0xd800, 0xdc03, 0 }, + { 0x5, 0x6, 0x7, 0 } }, + { {0}, {0} } + }; + + + const ShapeTable *s = shape_table; + while (s->unicode[0]) { + QVERIFY( shaping(face, s, HB_Script_Common) ); + ++s; + } + + FT_Done_Face(face); + } else { + QSKIP("couln't find PENUTURE.TTF", SkipAll); + } + } +} + + +QTEST_MAIN(tst_QScriptEngine) +#include "main.moc" diff --git a/tqtinterface/qt4/include/private/qt4_qapplication_p.h b/tqtinterface/qt4/include/private/qt4_qapplication_p.h new file mode 100644 index 0000000..c5bab8e --- /dev/null +++ b/tqtinterface/qt4/include/private/qt4_qapplication_p.h @@ -0,0 +1,8 @@ +// ----------------------------------------------------------------------------------- +// Large chunks of this file are taken straight from the qapplication_p.h file in Qt4 +// +// Specifically, these structures and classes must be kept in sync with Qt4: +// +// Enjoy! +// ----------------------------------------------------------------------------------- + diff --git a/tqtinterface/qt4/include/private/qt4_qbezier_p.h b/tqtinterface/qt4/include/private/qt4_qbezier_p.h new file mode 100644 index 0000000..a76d94b --- /dev/null +++ b/tqtinterface/qt4/include/private/qt4_qbezier_p.h @@ -0,0 +1,274 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QBEZIER_P_H +#define QBEZIER_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of other Qt classes. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "QtCore/qpoint.h" +#include "QtCore/qline.h" +#include "QtCore/qrect.h" +#include "QtCore/qvector.h" +#include "QtCore/qlist.h" +#include "QtCore/qpair.h" +#include "QtGui/qtransform.h" + +QT_BEGIN_NAMESPACE + +class QPolygonF; + +class Q_GUI_EXPORT QBezier +{ +public: + static QBezier fromPoints(const QPointF &p1, const QPointF &p2, + const QPointF &p3, const QPointF &p4); + + static void coefficients(qreal t, qreal &a, qreal &b, qreal &c, qreal &d); + + inline QPointF pointAt(qreal t) const; + inline QPointF normalVector(qreal t) const; + + inline QPointF derivedAt(qreal t) const; + inline QPointF secondDerivedAt(qreal t) const; + + QPolygonF toPolygon(qreal bezier_flattening_threshold = 0.5) const; + void addToPolygon(QPolygonF *p, qreal bezier_flattening_threshold = 0.5) const; + + QRectF bounds() const; + qreal length(qreal error = 0.01) const; + void addIfClose(qreal *length, qreal error) const; + + qreal tAtLength(qreal len) const; + + int stationaryYPoints(qreal &t0, qreal &t1) const; + qreal tForY(qreal t0, qreal t1, qreal y) const; + + QPointF pt1() const { return QPointF(x1, y1); } + QPointF pt2() const { return QPointF(x2, y2); } + QPointF pt3() const { return QPointF(x3, y3); } + QPointF pt4() const { return QPointF(x4, y4); } + + QBezier mapBy(const QTransform &transform) const; + + inline QPointF midPoint() const; + inline QLineF midTangent() const; + + inline QLineF startTangent() const; + inline QLineF endTangent() const; + + inline void parameterSplitLeft(qreal t, QBezier *left); + inline void split(QBezier *firstHalf, QBezier *secondHalf) const; + + int shifted(QBezier *curveSegments, int maxSegmets, + qreal offset, float threshold) const; + + QBezier bezierOnInterval(qreal t0, qreal t1) const; + QBezier getSubRange(qreal t0, qreal t1) const; + + qreal x1, y1, x2, y2, x3, y3, x4, y4; +}; + +inline QPointF QBezier::midPoint() const +{ + return QPointF((x1 + x4 + 3*(x2 + x3))/8., (y1 + y4 + 3*(y2 + y3))/8.); +} + +inline QLineF QBezier::midTangent() const +{ + QPointF mid = midPoint(); + QLineF dir(QLineF(x1, y1, x2, y2).pointAt(0.5), QLineF(x3, y3, x4, y4).pointAt(0.5)); + return QLineF(mid.x() - dir.dx(), mid.y() - dir.dy(), + mid.x() + dir.dx(), mid.y() + dir.dy()); +} + +inline QLineF QBezier::startTangent() const +{ + QLineF tangent(pt1(), pt2()); + if (tangent.isNull()) + tangent = QLineF(pt1(), pt3()); + if (tangent.isNull()) + tangent = QLineF(pt1(), pt4()); + return tangent; +} + +inline QLineF QBezier::endTangent() const +{ + QLineF tangent(pt4(), pt3()); + if (tangent.isNull()) + tangent = QLineF(pt4(), pt2()); + if (tangent.isNull()) + tangent = QLineF(pt4(), pt1()); + return tangent; +} + +inline void QBezier::coefficients(qreal t, qreal &a, qreal &b, qreal &c, qreal &d) +{ + qreal m_t = 1. - t; + b = m_t * m_t; + c = t * t; + d = c * t; + a = b * m_t; + b *= 3. * t; + c *= 3. * m_t; +} + +inline QPointF QBezier::pointAt(qreal t) const +{ +#if 1 + qreal a, b, c, d; + coefficients(t, a, b, c, d); + return QPointF(a*x1 + b*x2 + c*x3 + d*x4, a*y1 + b*y2 + c*y3 + d*y4); +#else + // numerically more stable: + qreal m_t = 1. - t; + qreal a = x1*m_t + x2*t; + qreal b = x2*m_t + x3*t; + qreal c = x3*m_t + x4*t; + a = a*m_t + b*t; + b = b*m_t + c*t; + qreal x = a*m_t + b*t; + qreal a = y1*m_t + y2*t; + qreal b = y2*m_t + y3*t; + qreal c = y3*m_t + y4*t; + a = a*m_t + b*t; + b = b*m_t + c*t; + qreal y = a*m_t + b*t; + return QPointF(x, y); +#endif +} + +inline QPointF QBezier::normalVector(qreal t) const +{ + qreal m_t = 1. - t; + qreal a = m_t * m_t; + qreal b = t * m_t; + qreal c = t * t; + + return QPointF((y2-y1) * a + (y3-y2) * b + (y4-y3) * c, -(x2-x1) * a - (x3-x2) * b - (x4-x3) * c); +} + +inline QPointF QBezier::derivedAt(qreal t) const +{ + // p'(t) = 3 * (-(1-2t+t^2) * p0 + (1 - 4 * t + 3 * t^2) * p1 + (2 * t - 3 * t^2) * p2 + t^2 * p3) + + qreal m_t = 1. - t; + + qreal d = t * t; + qreal a = -m_t * m_t; + qreal b = 1 - 4 * t + 3 * d; + qreal c = 2 * t - 3 * d; + + return 3 * QPointF(a * x1 + b * x2 + c * x3 + d * x4, + a * y1 + b * y2 + c * y3 + d * y4); +} + +inline QPointF QBezier::secondDerivedAt(qreal t) const +{ + qreal a = 2. - 2. * t; + qreal b = -4 + 6 * t; + qreal c = 2 - 6 * t; + qreal d = 2 * t; + + return 3 * QPointF(a * x1 + b * x2 + c * x3 + d * x4, + a * y1 + b * y2 + c * y3 + d * y4); +} + +inline void QBezier::split(QBezier *firstHalf, QBezier *secondHalf) const +{ + Q_ASSERT(firstHalf); + Q_ASSERT(secondHalf); + + qreal c = (x2 + x3)*.5; + firstHalf->x2 = (x1 + x2)*.5; + secondHalf->x3 = (x3 + x4)*.5; + firstHalf->x1 = x1; + secondHalf->x4 = x4; + firstHalf->x3 = (firstHalf->x2 + c)*.5; + secondHalf->x2 = (secondHalf->x3 + c)*.5; + firstHalf->x4 = secondHalf->x1 = (firstHalf->x3 + secondHalf->x2)*.5; + + c = (y2 + y3)/2; + firstHalf->y2 = (y1 + y2)*.5; + secondHalf->y3 = (y3 + y4)*.5; + firstHalf->y1 = y1; + secondHalf->y4 = y4; + firstHalf->y3 = (firstHalf->y2 + c)*.5; + secondHalf->y2 = (secondHalf->y3 + c)*.5; + firstHalf->y4 = secondHalf->y1 = (firstHalf->y3 + secondHalf->y2)*.5; +} + +inline void QBezier::parameterSplitLeft(qreal t, QBezier *left) +{ + left->x1 = x1; + left->y1 = y1; + + left->x2 = x1 + t * ( x2 - x1 ); + left->y2 = y1 + t * ( y2 - y1 ); + + left->x3 = x2 + t * ( x3 - x2 ); // temporary holding spot + left->y3 = y2 + t * ( y3 - y2 ); // temporary holding spot + + x3 = x3 + t * ( x4 - x3 ); + y3 = y3 + t * ( y4 - y3 ); + + x2 = left->x3 + t * ( x3 - left->x3); + y2 = left->y3 + t * ( y3 - left->y3); + + left->x3 = left->x2 + t * ( left->x3 - left->x2 ); + left->y3 = left->y2 + t * ( left->y3 - left->y2 ); + + left->x4 = x1 = left->x3 + t * (x2 - left->x3); + left->y4 = y1 = left->y3 + t * (y2 - left->y3); +} + +QT_END_NAMESPACE + +#endif // QBEZIER_P_H diff --git a/tqtinterface/qt4/include/private/qt4_qfixed_p.h b/tqtinterface/qt4/include/private/qt4_qfixed_p.h new file mode 100644 index 0000000..aa912be --- /dev/null +++ b/tqtinterface/qt4/include/private/qt4_qfixed_p.h @@ -0,0 +1,221 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QFIXED_P_H +#define QFIXED_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of other Qt classes. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "QtCore/qdebug.h" +#include "QtCore/qpoint.h" +#include "QtCore/qsize.h" + +QT_BEGIN_NAMESPACE + +struct QFixed { +public: + QFixed() : val(0) {} + QFixed(int i) : val(i<<6) {} + QFixed(long i) : val(i<<6) {} + QFixed &operator=(int i) { val = (i<<6); return *this; } + QFixed &operator=(long i) { val = (i<<6); return *this; } + + static QFixed fromReal(qreal r) { QFixed f; f.val = (int)(r*qreal(64)); return f; } + static QFixed fromFixed(int fixed) { QFixed f; f.val = fixed; return f; } + + inline int value() const { return val; } + inline void setValue(int value) { val = value; } + + inline int toInt() const { return (((val)+32) & -64)>>6; } + inline qreal toReal() const { return ((qreal)val)/(qreal)64; } + + inline int truncate() const { return val>>6; } + inline QFixed round() const { QFixed f; f.val = ((val)+32) & -64; return f; } + inline QFixed floor() const { QFixed f; f.val = (val) & -64; return f; } + inline QFixed ceil() const { QFixed f; f.val = (val+63) & -64; return f; } + + inline QFixed operator+(int i) const { QFixed f; f.val = (val + (i<<6)); return f; } + inline QFixed operator+(uint i) const { QFixed f; f.val = (val + (i<<6)); return f; } + inline QFixed operator+(const QFixed &other) const { QFixed f; f.val = (val + other.val); return f; } + inline QFixed &operator+=(int i) { val += (i<<6); return *this; } + inline QFixed &operator+=(uint i) { val += (i<<6); return *this; } + inline QFixed &operator+=(const QFixed &other) { val += other.val; return *this; } + inline QFixed operator-(int i) const { QFixed f; f.val = (val - (i<<6)); return f; } + inline QFixed operator-(uint i) const { QFixed f; f.val = (val - (i<<6)); return f; } + inline QFixed operator-(const QFixed &other) const { QFixed f; f.val = (val - other.val); return f; } + inline QFixed &operator-=(int i) { val -= (i<<6); return *this; } + inline QFixed &operator-=(uint i) { val -= (i<<6); return *this; } + inline QFixed &operator-=(const QFixed &other) { val -= other.val; return *this; } + inline QFixed operator-() const { QFixed f; f.val = -val; return f; } + + inline bool operator==(const QFixed &other) const { return val == other.val; } + inline bool operator!=(const QFixed &other) const { return val != other.val; } + inline bool operator<(const QFixed &other) const { return val < other.val; } + inline bool operator>(const QFixed &other) const { return val > other.val; } + inline bool operator<=(const QFixed &other) const { return val <= other.val; } + inline bool operator>=(const QFixed &other) const { return val >= other.val; } + inline bool operator!() const { return !val; } + + inline QFixed &operator/=(int x) { val /= x; return *this; } + inline QFixed &operator/=(const QFixed &o) { + if (o.val == 0) { + val = 0x7FFFFFFFL; + } else { + bool neg = false; + qint64 a = val; + qint64 b = o.val; + if (a < 0) { a = -a; neg = true; } + if (b < 0) { b = -b; neg = !neg; } + + int res = (int)(((a << 6) + (b >> 1)) / b); + + val = (neg ? -res : res); + } + return *this; + } + inline QFixed operator/(int d) const { QFixed f; f.val = val/d; return f; } + inline QFixed operator/(QFixed b) const { QFixed f = *this; return (f /= b); } + inline QFixed operator>>(int d) const { QFixed f = *this; f.val >>= d; return f; } + inline QFixed &operator*=(int i) { val *= i; return *this; } + inline QFixed &operator*=(uint i) { val *= i; return *this; } + inline QFixed &operator*=(const QFixed &o) { + bool neg = false; + qint64 a = val; + qint64 b = o.val; + if (a < 0) { a = -a; neg = true; } + if (b < 0) { b = -b; neg = !neg; } + + int res = (int)((a * b + 0x20L) >> 6); + val = neg ? -res : res; + return *this; + } + inline QFixed operator*(int i) const { QFixed f = *this; return (f *= i); } + inline QFixed operator*(uint i) const { QFixed f = *this; return (f *= i); } + inline QFixed operator*(const QFixed &o) const { QFixed f = *this; return (f *= o); } + +private: + QFixed(qreal i) : val((int)(i*qreal(64))) {} + QFixed &operator=(qreal i) { val = (int)(i*qreal(64)); return *this; } + inline QFixed operator+(qreal i) const { QFixed f; f.val = (val + (int)(i*qreal(64))); return f; } + inline QFixed &operator+=(qreal i) { val += (int)(i*64); return *this; } + inline QFixed operator-(qreal i) const { QFixed f; f.val = (val - (int)(i*qreal(64))); return f; } + inline QFixed &operator-=(qreal i) { val -= (int)(i*64); return *this; } + inline QFixed &operator/=(qreal r) { val = (int)(val/r); return *this; } + inline QFixed operator/(qreal d) const { QFixed f; f.val = (int)(val/d); return f; } + inline QFixed &operator*=(qreal d) { val = (int) (val*d); return *this; } + inline QFixed operator*(qreal d) const { QFixed f = *this; return (f *= d); } + int val; +}; +Q_DECLARE_TYPEINFO(QFixed, Q_PRIMITIVE_TYPE); + +#define QFIXED_MAX (INT_MAX/256) + +inline int qRound(const QFixed &f) { return f.toInt(); } +inline int qFloor(const QFixed &f) { return f.floor().truncate(); } + +inline QFixed operator*(int i, const QFixed &d) { return d*i; } +inline QFixed operator+(int i, const QFixed &d) { return d+i; } +inline QFixed operator-(int i, const QFixed &d) { return -(d-i); } +inline QFixed operator*(uint i, const QFixed &d) { return d*i; } +inline QFixed operator+(uint i, const QFixed &d) { return d+i; } +inline QFixed operator-(uint i, const QFixed &d) { return -(d-i); } +// inline QFixed operator*(qreal d, const QFixed &d2) { return d2*d; } + +inline bool operator==(const QFixed &f, int i) { return f.value() == (i<<6); } +inline bool operator==(int i, const QFixed &f) { return f.value() == (i<<6); } +inline bool operator!=(const QFixed &f, int i) { return f.value() != (i<<6); } +inline bool operator!=(int i, const QFixed &f) { return f.value() != (i<<6); } +inline bool operator<=(const QFixed &f, int i) { return f.value() <= (i<<6); } +inline bool operator<=(int i, const QFixed &f) { return (i<<6) <= f.value(); } +inline bool operator>=(const QFixed &f, int i) { return f.value() >= (i<<6); } +inline bool operator>=(int i, const QFixed &f) { return (i<<6) >= f.value(); } +inline bool operator<(const QFixed &f, int i) { return f.value() < (i<<6); } +inline bool operator<(int i, const QFixed &f) { return (i<<6) < f.value(); } +inline bool operator>(const QFixed &f, int i) { return f.value() > (i<<6); } +inline bool operator>(int i, const QFixed &f) { return (i<<6) > f.value(); } + +#ifndef QT_NO_DEBUG_STREAM +inline QDebug &operator<<(QDebug &dbg, const QFixed &f) +{ return dbg << f.toReal(); } +#endif + +struct QFixedPoint { + QFixed x; + QFixed y; + inline QFixedPoint() {} + inline QFixedPoint(const QFixed &_x, const QFixed &_y) : x(_x), y(_y) {} + QPointF toPointF() const { return QPointF(x.toReal(), y.toReal()); } + static QFixedPoint fromPointF(const QPointF &p) { + return QFixedPoint(QFixed::fromReal(p.x()), QFixed::fromReal(p.y())); + } +}; +Q_DECLARE_TYPEINFO(QFixedPoint, Q_PRIMITIVE_TYPE); + +inline QFixedPoint operator-(const QFixedPoint &p1, const QFixedPoint &p2) +{ return QFixedPoint(p1.x - p2.x, p1.y - p2.y); } +inline QFixedPoint operator+(const QFixedPoint &p1, const QFixedPoint &p2) +{ return QFixedPoint(p1.x + p2.x, p1.y + p2.y); } + +struct QFixedSize { + QFixed width; + QFixed height; + QSizeF toSizeF() const { return QSizeF(width.toReal(), height.toReal()); } + static QFixedSize fromSizeF(const QSizeF &s) { + QFixedSize size; + size.width = QFixed::fromReal(s.width()); + size.height = QFixed::fromReal(s.height()); + return size; + } +}; +Q_DECLARE_TYPEINFO(QFixedSize, Q_PRIMITIVE_TYPE); + +QT_END_NAMESPACE + +#endif // QTEXTENGINE_P_H diff --git a/tqtinterface/qt4/include/private/qt4_qfont_p.h b/tqtinterface/qt4/include/private/qt4_qfont_p.h new file mode 100644 index 0000000..987ff1e --- /dev/null +++ b/tqtinterface/qt4/include/private/qt4_qfont_p.h @@ -0,0 +1,278 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QFONT_P_H +#define QFONT_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of internal files. This header file may change from version to version +// without notice, or even be removed. +// +// We mean it. +// + +#include "QtGui/qfont.h" +#include "QtCore/qmap.h" +#include "QtCore/qobject.h" +#include +#include +#include "private/qt4_qfixed_p.h" + +QT_BEGIN_NAMESPACE + +// forwards +class QFontCache; +class QFontEngine; + +struct QFontDef +{ + inline QFontDef() + : pointSize(-1.0), pixelSize(-1), + styleStrategy(QFont::PreferDefault), tqstyleHint(QFont::AnyStyle), + weight(50), fixedPitch(false), style(QFont::StyleNormal), stretch(100), + ignorePitch(true) +#ifdef Q_WS_MAC + ,fixedPitchComputed(false) +#endif + { + } + + QString family; + +#ifdef Q_WS_X11 + QString addStyle; +#endif // Q_WS_X11 + + qreal pointSize; + qreal pixelSize; + + uint styleStrategy : 16; + uint tqstyleHint : 8; + + uint weight : 7; // 0-99 + uint fixedPitch : 1; + uint style : 2; + uint stretch : 12; // 0-400 + + uint ignorePitch : 1; + uint fixedPitchComputed : 1; // for Mac OS X only + int reserved : 16; // for future extensions + + bool exactMatch(const QFontDef &other) const; + bool operator==(const QFontDef &other) const + { + return pixelSize == other.pixelSize + && weight == other.weight + && style == other.style + && stretch == other.stretch + && tqstyleHint == other.tqstyleHint + && styleStrategy == other.styleStrategy + && ignorePitch == other.ignorePitch && fixedPitch == other.fixedPitch + && family == other.family +#ifdef Q_WS_X11 + && addStyle == other.addStyle +#endif + ; + } + inline bool operator<(const QFontDef &other) const + { + if (pixelSize != other.pixelSize) return pixelSize < other.pixelSize; + if (weight != other.weight) return weight < other.weight; + if (style != other.style) return style < other.style; + if (stretch != other.stretch) return stretch < other.stretch; + if (tqstyleHint != other.tqstyleHint) return tqstyleHint < other.tqstyleHint; + if (styleStrategy != other.styleStrategy) return styleStrategy < other.styleStrategy; + if (family != other.family) return family < other.family; + +#ifdef Q_WS_X11 + if (addStyle != other.addStyle) return addStyle < other.addStyle; +#endif // Q_WS_X11 + + if (ignorePitch != other.ignorePitch) return ignorePitch < other.ignorePitch; + if (fixedPitch != other.fixedPitch) return fixedPitch < other.fixedPitch; + return false; + } +}; + +class QFontEngineData +{ +public: + QFontEngineData(); + ~QFontEngineData(); + + QAtomicInt ref; + QFontCache *fontCache; + +#if !defined(Q_WS_MAC) + QFontEngine *engines[QUnicodeTables::ScriptCount]; +#else + QFontEngine *engine; +#endif +}; + + +class Q_GUI_EXPORT QFontPrivate +{ +public: +#ifdef Q_WS_X11 + static int defaultEncodingID; +#endif // Q_WS_X11 + + QFontPrivate(); + QFontPrivate(const QFontPrivate &other); + ~QFontPrivate(); + + QFontEngine *engineForScript(int script) const; + void alterCharForCapitalization(QChar &c) const; + + QAtomicInt ref; + QFontDef request; + mutable QFontEngineData *engineData; + int dpi; + int screen; + +#ifdef Q_WS_WIN + HDC hdc; +#endif + + uint rawMode : 1; + uint underline : 1; + uint overline : 1; + uint strikeOut : 1; + uint kerning : 1; + uint capital : 3; + bool letterSpacingIsAbsolute : 1; + + QFixed letterSpacing; + QFixed wordSpacing; + + mutable QFontPrivate *scFont; + QFont smallCapsFont() const { return QFont(smallCapsFontPrivate()); } + QFontPrivate *smallCapsFontPrivate() const; + + void resolve(uint mask, const QFontPrivate *other); +private: + QFontPrivate &operator=(const QFontPrivate &) { return *this; } +}; + + +class QFontCache : public TQT_BASE_OBJECT_NAME +{ + Q_OBJECT +public: + // note: these static functions work on a per-thread basis + static QFontCache *instance(); + static void cleanup(); + + QFontCache(); + ~QFontCache(); + + void clear(); +#if defined(Q_WS_QWS) && !defined(QT_NO_QWS_QPF2) + void removeEngineForFont(const QByteArray &fontName); +#endif + // universal key structure. QFontEngineDatas and QFontEngines are cached using + // the same keys + struct Key { + Key() : script(0), screen(0) { } + Key(const QFontDef &d, int c, int s = 0) + : def(d), script(c), screen(s) { } + + QFontDef def; + int script; + int screen; + + inline bool operator<(const Key &other) const + { + if (script != other.script) return script < other.script; + if (screen != other.screen) return screen < other.screen; + return def < other.def; + } + inline bool operator==(const Key &other) const + { return def == other.def && script == other.script && screen == other.screen; } + }; + + // QFontEngineData cache + typedef QMap EngineDataCache; + EngineDataCache engineDataCache; + + QFontEngineData *findEngineData(const Key &key) const; + void insertEngineData(const Key &key, QFontEngineData *engineData); + + // QFontEngine cache + struct Engine { + Engine() : data(0), timestamp(0), hits(0) { } + Engine(QFontEngine *d) : data(d), timestamp(0), hits(0) { } + + QFontEngine *data; + uint timestamp; + uint hits; + }; + + typedef QMap EngineCache; + EngineCache engineCache; + + QFontEngine *findEngine(const Key &key); + void insertEngine(const Key &key, QFontEngine *engine); + +#if defined(Q_WS_WIN) || defined(Q_WS_QWS) + void cleanupPrinterFonts(); +#endif + + private: + void increaseCost(uint cost); + void decreaseCost(uint cost); + void timerEvent(QTimerEvent *event); + + static const uint min_cost; + uint total_cost, max_cost; + uint current_timestamp; + bool fast; + int timer_id; +}; + +QT_END_NAMESPACE + +#endif // QFONT_P_H diff --git a/tqtinterface/qt4/include/private/qt4_qharfbuzz_p.h b/tqtinterface/qt4/include/private/qt4_qharfbuzz_p.h new file mode 100644 index 0000000..1c2ff69 --- /dev/null +++ b/tqtinterface/qt4/include/private/qt4_qharfbuzz_p.h @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#ifndef QHARFBUZZ_P_H +#define QHARFBUZZ_P_H + +#include +#include "private/qt4_harfbuzz/src/harfbuzz-shaper.h" + +QT_BEGIN_NAMESPACE + +// temporary forward until all the textengine code has been moved to QtCore +Q_CORE_EXPORT void qGetCharAttributes(const HB_UChar16 *string, hb_uint32 stringLength, + const HB_ScriptItem *items, hb_uint32 numItems, + HB_CharAttributes *attributes); + +Q_CORE_EXPORT HB_Bool qShapeItem(HB_ShaperItem *item); + +// ### temporary +Q_CORE_EXPORT HB_Face qHBNewFace(void *font, HB_GetFontTableFunc tableFunc); +Q_CORE_EXPORT void qHBFreeFace(HB_Face); + +Q_DECLARE_TYPEINFO(HB_GlyphAttributes, Q_PRIMITIVE_TYPE); +Q_DECLARE_TYPEINFO(HB_FixedPoint, Q_PRIMITIVE_TYPE); + +QT_END_NAMESPACE + +#endif diff --git a/tqtinterface/qt4/include/private/qt4_qimage_p.h b/tqtinterface/qt4/include/private/qt4_qimage_p.h new file mode 100644 index 0000000..77aeccb --- /dev/null +++ b/tqtinterface/qt4/include/private/qt4_qimage_p.h @@ -0,0 +1,114 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QIMAGE_P_H +#define QIMAGE_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include + +#include + +#ifndef QT_NO_IMAGE_TEXT +#include +#endif + +QT_BEGIN_NAMESPACE + +struct Q_GUI_EXPORT QImageData { // internal image data + QImageData(); + ~QImageData(); + static QImageData *create(const QSize &size, QImage::Format format, int numColors = 0); + static QImageData *create(uchar *data, int w, int h, int bpl, QImage::Format format, bool readOnly); + + QAtomicInt ref; + + int width; + int height; + int depth; + int nbytes; // number of bytes data + QVector colortable; + uchar *data; +#ifdef QT3_SUPPORT + uchar **jumptable; +#endif + QImage::Format format; + int bytes_per_line; + int ser_no; // serial number + int detach_no; + + qreal dpmx; // dots per meter X (or 0) + qreal dpmy; // dots per meter Y (or 0) + QPoint offset; // offset in pixels + + uint own_data : 1; + uint ro_data : 1; + uint has_alpha_clut : 1; + uint is_cached : 1; + + bool checkForAlphaPixels() const; + + // Convert the image in-place, minimizing memory reallocation + // Return false if the conversion cannot be done in-place. + bool convertInPlace(QImage::Format newFormat, Qt::ImageConversionFlags); + +#ifndef QT_NO_IMAGE_TEXT + QMap text; +#endif + bool doImageIO(const QImage *image, QImageWriter* io, int quality) const; + + QPaintEngine *paintEngine; +}; + +QT_END_NAMESPACE + +#endif + diff --git a/tqtinterface/qt4/include/private/qt4_qmetaobject_p.h b/tqtinterface/qt4/include/private/qt4_qmetaobject_p.h new file mode 100644 index 0000000..9ee8eb0 --- /dev/null +++ b/tqtinterface/qt4/include/private/qt4_qmetaobject_p.h @@ -0,0 +1,320 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMETAOBJECT_P_H +#define QMETAOBJECT_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of moc. This header file may change from version to version without notice, +// or even be removed. +// +// We mean it. +// + +#include +#include + +QT_BEGIN_NAMESPACE + +enum PropertyFlags { + Invalid = 0x00000000, + Readable = 0x00000001, + Writable = 0x00000002, + Resettable = 0x00000004, + EnumOrFlag = 0x00000008, + StdCppSet = 0x00000100, +// Override = 0x00000200, + Constant = 0x00000400, + Final = 0x00000800, + Designable = 0x00001000, + ResolveDesignable = 0x00002000, + Scriptable = 0x00004000, + ResolveScriptable = 0x00008000, + Stored = 0x00010000, + ResolveStored = 0x00020000, + Editable = 0x00040000, + ResolveEditable = 0x00080000, + User = 0x00100000, + ResolveUser = 0x00200000, + Notify = 0x00400000 +}; + +enum MethodFlags { + AccessPrivate = 0x00, + AccessProtected = 0x01, + AccessPublic = 0x02, + AccessMask = 0x03, //mask + + MethodMethod = 0x00, + MethodSignal = 0x04, + MethodSlot = 0x08, + MethodConstructor = 0x0c, + MethodTypeMask = 0x0c, + + MethodCompatibility = 0x10, + MethodCloned = 0x20, + MethodScriptable = 0x40 +}; + +enum MetaObjectFlags { + DynamicMetaObject = 0x01 +}; + +class QMutex; + +struct QMetaObjectPrivate +{ + int revision; + int className; + int classInfoCount, classInfoData; + int methodCount, methodData; + int propertyCount, propertyData; + int enumeratorCount, enumeratorData; + int constructorCount, constructorData; //since revision 2 + int flags; //since revision 3 + int signalCount; //since revision 4 + // revision 5 introduces changes in normalized signatures, no new members + + static inline const QMetaObjectPrivate *get(const QMetaObject *metaobject) + { return reinterpret_cast(metaobject->d.data); } + + static int indexOfSignalRelative(const QMetaObject **baseObject, + const char* name, + bool normalizeStringData); + static int indexOfSlot(const QMetaObject *m, + const char *slot, + bool normalizeStringData); + static int originalClone(const QMetaObject *obj, int local_method_index); + +#ifndef QT_NO_QOBJECT + //defined in qobject.cpp + enum DisconnectType { DisconnectAll, DisconnectOne }; + static bool connect(const QObject *sender, int signal_index, + const QObject *receiver, int method_index, + int type = 0, int *types = 0); + static bool disconnect(const QObject *sender, int signal_index, + const QObject *receiver, int method_index, + DisconnectType = DisconnectAll); + static inline bool disconnectHelper(QObjectPrivate::Connection *c, + const QObject *receiver, int method_index, + QMutex *senderMutex, DisconnectType); +#endif +}; + +#ifndef UTILS_H +// mirrored in moc's utils.h +static inline bool is_ident_char(char s) +{ + return ((s >= 'a' && s <= 'z') + || (s >= 'A' && s <= 'Z') + || (s >= '0' && s <= '9') + || s == '_' + ); +} + +static inline bool is_space(char s) +{ + return (s == ' ' || s == '\t'); +} +#endif + +// This code is shared with moc.cpp +static QByteArray normalizeTypeInternal(const char *t, const char *e, bool fixScope = false, bool adjustConst = true) +{ + int len = e - t; + /* + Convert 'char const *' into 'const char *'. Start at index 1, + not 0, because 'const char *' is already OK. + */ + QByteArray constbuf; + for (int i = 1; i < len; i++) { + if ( t[i] == 'c' + && strncmp(t + i + 1, "onst", 4) == 0 + && (i + 5 >= len || !is_ident_char(t[i + 5])) + && !is_ident_char(t[i-1]) + ) { + constbuf = QByteArray(t, len); + if (is_space(t[i-1])) + constbuf.remove(i-1, 6); + else + constbuf.remove(i, 5); + constbuf.prepend("const "); + t = constbuf.data(); + e = constbuf.data() + constbuf.length(); + break; + } + /* + We musn't convert 'char * const *' into 'const char **' + and we must beware of 'Bar'. + */ + if (t[i] == '&' || t[i] == '*' ||t[i] == '<') + break; + } + if (adjustConst && e > t + 6 && strncmp("const ", t, 6) == 0) { + if (*(e-1) == '&') { // treat const reference as value + t += 6; + --e; + } else if (is_ident_char(*(e-1)) || *(e-1) == '>') { // treat const value as value + t += 6; + } + } + QByteArray result; + result.reserve(len); + +#if 1 + // consume initial 'const ' + if (strncmp("const ", t, 6) == 0) { + t+= 6; + result += "const "; + } +#endif + + // some type substitutions for 'unsigned x' + if (strncmp("unsigned", t, 8) == 0) { + // make sure "unsigned" is an isolated word before making substitutions + if (!t[8] || !is_ident_char(t[8])) { + if (strncmp(" int", t+8, 4) == 0) { + t += 8+4; + result += "uint"; + } else if (strncmp(" long", t+8, 5) == 0) { + if ((strlen(t + 8 + 5) < 4 || strncmp(t + 8 + 5, " int", 4) != 0) // preserve '[unsigned] long int' + && (strlen(t + 8 + 5) < 5 || strncmp(t + 8 + 5, " long", 5) != 0) // preserve '[unsigned] long long' + ) { + t += 8+5; + result += "ulong"; + } + } else if (strncmp(" short", t+8, 6) != 0 // preserve unsigned short + && strncmp(" char", t+8, 5) != 0) { // preserve unsigned char + // treat rest (unsigned) as uint + t += 8; + result += "uint"; + } + } + } else { + // discard 'struct', 'class', and 'enum'; they are optional + // and we don't want them in the normalized signature + struct { + const char *keyword; + int len; + } optional[] = { + { "struct ", 7 }, + { "class ", 6 }, + { "enum ", 5 }, + { 0, 0 } + }; + int i = 0; + do { + if (strncmp(optional[i].keyword, t, optional[i].len) == 0) { + t += optional[i].len; + break; + } + } while (optional[++i].keyword != 0); + } + + bool star = false; + while (t != e) { + char c = *t++; + if (fixScope && c == ':' && *t == ':' ) { + ++t; + c = *t++; + int i = result.size() - 1; + while (i >= 0 && is_ident_char(result.at(i))) + --i; + result.resize(i + 1); + } + star = star || c == '*'; + result += c; + if (c == '<') { + //template recursion + const char* tt = t; + int templdepth = 1; + while (t != e) { + c = *t++; + if (c == '<') + ++templdepth; + if (c == '>') + --templdepth; + if (templdepth == 0 || (templdepth == 1 && c == ',')) { + result += normalizeTypeInternal(tt, t-1, fixScope, false); + result += c; + if (templdepth == 0) { + if (*t == '>') + result += ' '; // avoid >> + break; + } + tt = t; + } + } + } + + // cv qualifers can appear after the type as well + if (!is_ident_char(c) && t != e && (e - t >= 5 && strncmp("const", t, 5) == 0) + && (e - t == 5 || !is_ident_char(t[5]))) { + t += 5; + while (t != e && is_space(*t)) + ++t; + if (adjustConst && t != e && *t == '&') { + // treat const ref as value + ++t; + } else if (adjustConst && !star) { + // treat const as value + } else if (!star) { + // move const to the front (but not if const comes after a *) + result.prepend("const "); + } else { + // keep const after a * + result += "const"; + } + } + } + + return result; +} + + +QT_END_NAMESPACE + +#endif + diff --git a/tqtinterface/qt4/include/private/qt4_qprinter_p.h b/tqtinterface/qt4/include/private/qt4_qprinter_p.h new file mode 100644 index 0000000..a0253fc --- /dev/null +++ b/tqtinterface/qt4/include/private/qt4_qprinter_p.h @@ -0,0 +1,141 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPRINTER_P_H +#define QPRINTER_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + + +#include "QtCore/qglobal.h" + +#ifndef QT_NO_PRINTER + +#include "QtGui/qprinter.h" +#include "QtGui/qprintengine.h" +#include "QtGui/qprintdialog.h" +#include "QtCore/qpointer.h" + +#include + +QT_BEGIN_NAMESPACE + +class QPrintEngine; +class QPreviewPaintEngine; +class QPicture; + +class QPrinterPrivate +{ + Q_DECLARE_PUBLIC(QPrinter) +public: + QPrinterPrivate(QPrinter *printer) + : printEngine(0) + , paintEngine(0) + , q_ptr(printer) + , options(QAbstractPrintDialog::PrintToFile | QAbstractPrintDialog::PrintPageRange | + QAbstractPrintDialog::PrintCollateCopies | QAbstractPrintDialog::PrintShowPageSize) + , printRange(QAbstractPrintDialog::AllPages) + , minPage(1) + , maxPage(INT_MAX) + , fromPage(0) + , toPage(0) + , use_default_engine(true) + , validPrinter(false) + , hasCustomPageMargins(false) + , hasUserSetPageSize(false) + { + } + + ~QPrinterPrivate() { + + } + + void createDefaultEngines(); +#ifndef QT_NO_PRINTPREVIEWWIDGET + QList previewPages() const; + void setPreviewMode(bool); +#endif + + void addToManualSetList(QPrintEngine::PrintEnginePropertyKey key); + + QPrinter::PrinterMode printerMode; + QPrinter::OutputFormat outputFormat; + QPrintEngine *printEngine; + QPaintEngine *paintEngine; + + QPrintEngine *realPrintEngine; + QPaintEngine *realPaintEngine; +#ifndef QT_NO_PRINTPREVIEWWIDGET + QPreviewPaintEngine *previewEngine; +#endif + + QPrinter *q_ptr; + + QAbstractPrintDialog::PrintDialogOptions options; + QAbstractPrintDialog::PrintRange printRange; + int minPage, maxPage, fromPage, toPage; + + uint use_default_engine : 1; + uint had_default_engines : 1; + + uint validPrinter : 1; + uint hasCustomPageMargins : 1; + uint hasUserSetPageSize : 1; + + // Used to remember which properties have been manually set by the user. + QList manualSetList; +}; + +QT_END_NAMESPACE + +#endif // QT_NO_PRINTER + +#endif // QPRINTER_P_H + diff --git a/tqtinterface/qt4/include/private/qt4_qtextengine_p.h b/tqtinterface/qt4/include/private/qt4_qtextengine_p.h new file mode 100644 index 0000000..2651c12 --- /dev/null +++ b/tqtinterface/qt4/include/private/qt4_qtextengine_p.h @@ -0,0 +1,613 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTEXTENGINE_P_H +#define QTEXTENGINE_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of other Qt classes. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "QtCore/qglobal.h" +#include "QtCore/qstring.h" +#include "QtCore/qvarlengtharray.h" +#include "QtCore/qnamespace.h" +#include "QtGui/qtextlayout.h" +// #include "private/qtextformat_p.h" +#include "private/qt4_qfont_p.h" +#include "QtCore/qvector.h" +#include "QtGui/qpaintengine.h" +#include "QtGui/qtextobject.h" +#include "QtGui/qtextoption.h" +#include "QtCore/qset.h" +#include "QtCore/qdebug.h" +#ifndef QT_BUILD_COMPAT_LIB +// #include "private/qt4_qtextdocument_p.h" +#endif +#include "private/qt4_qharfbuzz_p.h" +#include "private/qt4_qfixed_p.h" + +#include + +QT_BEGIN_NAMESPACE + +class QFontPrivate; +class QFontEngine; + +class QString; +class QPainter; + +class QAbstractTextDocumentLayout; + + +// this uses the same coordinate system as Qt, but a different one to freetype. +// * y is usually negative, and is equal to the ascent. +// * negative yoff means the following stuff is drawn higher up. +// the characters bounding rect is given by QRect(x,y,width,height), its advance by +// xoo and yoff +struct glyph_metrics_t +{ + inline glyph_metrics_t() + : x(100000), y(100000) {} + inline glyph_metrics_t(QFixed _x, QFixed _y, QFixed _width, QFixed _height, QFixed _xoff, QFixed _yoff) + : x(_x), + y(_y), + width(_width), + height(_height), + xoff(_xoff), + yoff(_yoff) + {} + QFixed x; + QFixed y; + QFixed width; + QFixed height; + QFixed xoff; + QFixed yoff; + + glyph_metrics_t transformed(const QTransform &xform) const; + inline bool isValid() const {return x != 100000 && y != 100000;} +}; +Q_DECLARE_TYPEINFO(glyph_metrics_t, Q_PRIMITIVE_TYPE); + +struct Q_AUTOTEST_EXPORT QScriptAnalysis +{ + enum Flags { + None = 0, + Lowercase = 1, + Uppercase = 2, + SmallCaps = 3, + LineOrParagraphSeparator = 4, + Space = 5, + SpaceTabOrObject = Space, + Tab = 6, + TabOrObject = Tab, + Object = 7 + }; + unsigned short script : 8; + unsigned short bidiLevel : 6; // Unicode Bidi algorithm embedding level (0-61) + unsigned short flags : 3; + inline bool operator == (const QScriptAnalysis &other) const { + return script == other.script && bidiLevel == other.bidiLevel && flags == other.flags; + } +}; +Q_DECLARE_TYPEINFO(QScriptAnalysis, Q_PRIMITIVE_TYPE); + +struct QGlyphJustification +{ + inline QGlyphJustification() + : type(0), nKashidas(0), space_18d6(0) + {} + + enum JustificationType { + JustifyNone, + JustifySpace, + JustifyKashida + }; + + uint type :2; + uint nKashidas : 6; // more do not make sense... + uint space_18d6 : 24; +}; +Q_DECLARE_TYPEINFO(QGlyphJustification, Q_PRIMITIVE_TYPE); + +struct QGlyphLayoutInstance +{ + QFixedPoint offset; + QFixedPoint advance; + HB_Glyph glyph; + QGlyphJustification justification; + HB_GlyphAttributes attributes; +}; + +struct QGlyphLayout +{ + // init to 0 not needed, done when shaping + QFixedPoint *offsets; // 8 bytes per element + HB_Glyph *glyphs; // 4 bytes per element + QFixed *advances_x; // 4 bytes per element + QFixed *advances_y; // 4 bytes per element + QGlyphJustification *justifications; // 4 bytes per element + HB_GlyphAttributes *attributes; // 2 bytes per element + + int numGlyphs; + + inline QGlyphLayout() : numGlyphs(0) {} + + inline explicit QGlyphLayout(char *address, int totalGlyphs) + { + offsets = reinterpret_cast(address); + int offset = totalGlyphs * sizeof(HB_FixedPoint); + glyphs = reinterpret_cast(address + offset); + offset += totalGlyphs * sizeof(HB_Glyph); + advances_x = reinterpret_cast(address + offset); + offset += totalGlyphs * sizeof(QFixed); + advances_y = reinterpret_cast(address + offset); + offset += totalGlyphs * sizeof(QFixed); + justifications = reinterpret_cast(address + offset); + offset += totalGlyphs * sizeof(QGlyphJustification); + attributes = reinterpret_cast(address + offset); + numGlyphs = totalGlyphs; + } + + inline QGlyphLayout mid(int position, int n = -1) const { + QGlyphLayout copy = *this; + copy.glyphs += position; + copy.advances_x += position; + copy.advances_y += position; + copy.offsets += position; + copy.justifications += position; + copy.attributes += position; + if (n == -1) + copy.numGlyphs -= position; + else + copy.numGlyphs = n; + return copy; + } + + static inline int spaceNeededForGlyphLayout(int totalGlyphs) { + return totalGlyphs * (sizeof(HB_Glyph) + sizeof(HB_GlyphAttributes) + + sizeof(QFixed) + sizeof(QFixed) + sizeof(QFixedPoint) + + sizeof(QGlyphJustification)); + } + + inline QFixed effectiveAdvance(int item) const + { return (advances_x[item] + QFixed::fromFixed(justifications[item].space_18d6)) * !attributes[item].dontPrint; } + + inline QGlyphLayoutInstance instance(int position) const { + QGlyphLayoutInstance g; + g.offset.x = offsets[position].x; + g.offset.y = offsets[position].y; + g.glyph = glyphs[position]; + g.advance.x = advances_x[position]; + g.advance.y = advances_y[position]; + g.justification = justifications[position]; + g.attributes = attributes[position]; + return g; + } + + inline void setInstance(int position, const QGlyphLayoutInstance &g) { + offsets[position].x = g.offset.x; + offsets[position].y = g.offset.y; + glyphs[position] = g.glyph; + advances_x[position] = g.advance.x; + advances_y[position] = g.advance.y; + justifications[position] = g.justification; + attributes[position] = g.attributes; + } + + inline void clear(int first = 0, int last = -1) { + if (last == -1) + last = numGlyphs; + if (first == 0 && last == numGlyphs + && reinterpret_cast(offsets + numGlyphs) == reinterpret_cast(glyphs)) { + memset(offsets, 0, spaceNeededForGlyphLayout(numGlyphs)); + } else { + const int num = last - first; + memset(offsets + first, 0, num * sizeof(QFixedPoint)); + memset(glyphs + first, 0, num * sizeof(HB_Glyph)); + memset(advances_x + first, 0, num * sizeof(QFixed)); + memset(advances_y + first, 0, num * sizeof(QFixed)); + memset(justifications + first, 0, num * sizeof(QGlyphJustification)); + memset(attributes + first, 0, num * sizeof(HB_GlyphAttributes)); + } + } + + inline char *data() { + return reinterpret_cast(offsets); + } + + void grow(char *address, int totalGlyphs); +}; + +class QVarLengthGlyphLayoutArray : private QVarLengthArray, public QGlyphLayout +{ +private: + typedef QVarLengthArray Array; +public: + QVarLengthGlyphLayoutArray(int totalGlyphs) + : Array(spaceNeededForGlyphLayout(totalGlyphs) / sizeof(void *) + 1) + , QGlyphLayout(reinterpret_cast(Array::data()), totalGlyphs) + { + memset(Array::data(), 0, Array::size() * sizeof(void *)); + } + + void resize(int totalGlyphs) + { + Array::resize(spaceNeededForGlyphLayout(totalGlyphs) / sizeof(void *) + 1); + + *((QGlyphLayout *)this) = QGlyphLayout(reinterpret_cast(Array::data()), totalGlyphs); + memset(Array::data(), 0, Array::size() * sizeof(void *)); + } +}; + +template struct QGlyphLayoutArray : public QGlyphLayout +{ +public: + QGlyphLayoutArray() + : QGlyphLayout(reinterpret_cast(buffer), N) + { + memset(buffer, 0, sizeof(buffer)); + } + +private: + void *buffer[(N * (sizeof(HB_Glyph) + sizeof(HB_GlyphAttributes) + + sizeof(QFixed) + sizeof(QFixed) + sizeof(QFixedPoint) + + sizeof(QGlyphJustification))) + / sizeof(void *) + 1]; +}; + +struct QScriptItem; +/// Internal QTextItem +class QTextItemInt : public QTextItem +{ +public: + inline QTextItemInt() + : justified(false), underlineStyle(QTextCharFormat::NoUnderline), num_chars(0), chars(0), + logClusters(0), f(0), fontEngine(0) + {} + QTextItemInt(const QScriptItem &si, QFont *font, const QTextCharFormat &format = QTextCharFormat()); + QTextItemInt(const QGlyphLayout &g, QFont *font, const QChar *chars, int numChars, QFontEngine *fe); + + /// copy the structure items, adjusting the glyphs arrays to the right subarrays. + /// the width of the returned QTextItemInt is not adjusted, for speed reasons + QTextItemInt midItem(QFontEngine *fontEngine, int firstGlyphIndex, int numGlyphs) const; + + QFixed descent; + QFixed ascent; + QFixed width; + + RenderFlags flags; + bool justified; + QTextCharFormat::UnderlineStyle underlineStyle; + const QTextCharFormat charFormat; + int num_chars; + const QChar *chars; + const unsigned short *logClusters; + const QFont *f; + + QGlyphLayout glyphs; + QFontEngine *fontEngine; +}; + +inline bool qIsControlChar(ushort uc) +{ + return uc >= 0x200b && uc <= 0x206f + && (uc <= 0x200f /* ZW Space, ZWNJ, ZWJ, LRM and RLM */ + || (uc >= 0x2028 && uc <= 0x202f /* LS, PS, LRE, RLE, PDF, LRO, RLO, NNBSP */) + || uc >= 0x206a /* ISS, ASS, IAFS, AFS, NADS, NODS */); +} + +struct Q_AUTOTEST_EXPORT QScriptItem +{ + inline QScriptItem() + : position(0), + num_glyphs(0), descent(-1), ascent(-1), leading(-1), width(-1), + glyph_data_offset(0) {} + inline QScriptItem(int p, const QScriptAnalysis &a) + : position(p), analysis(a), + num_glyphs(0), descent(-1), ascent(-1), leading(-1), width(-1), + glyph_data_offset(0) {} + + int position; + QScriptAnalysis analysis; + unsigned short num_glyphs; + QFixed descent; + QFixed ascent; + QFixed leading; + QFixed width; + int glyph_data_offset; + QFixed height() const { return ascent + descent + 1; } +}; + + +Q_DECLARE_TYPEINFO(QScriptItem, Q_MOVABLE_TYPE); + +typedef QVector QScriptItemArray; + +struct Q_AUTOTEST_EXPORT QScriptLine +{ + // created and filled in QTextLine::layout_helper + QScriptLine() + : from(0), length(0), + justified(0), gridfitted(0), + hasTrailingSpaces(0), leadingIncluded(0) {} + QFixed descent; + QFixed ascent; + QFixed leading; + QFixed x; + QFixed y; + QFixed width; + QFixed textWidth; + QFixed textAdvance; + int from; + signed int length : 29; + mutable uint justified : 1; + mutable uint gridfitted : 1; + uint hasTrailingSpaces : 1; + uint leadingIncluded : 1; + QFixed height() const { return (ascent + descent).ceil() + 1 + + (leadingIncluded? qMax(QFixed(),leading) : QFixed()); } + QFixed base() const { return ascent + + (leadingIncluded ? qMax(QFixed(),leading) : QFixed()); } + void setDefaultHeight(QTextEngine *eng); + void operator+=(const QScriptLine &other); +}; +Q_DECLARE_TYPEINFO(QScriptLine, Q_PRIMITIVE_TYPE); + + +inline void QScriptLine::operator+=(const QScriptLine &other) +{ + leading= qMax(leading + ascent, other.leading + other.ascent) - qMax(ascent, other.ascent); + descent = qMax(descent, other.descent); + ascent = qMax(ascent, other.ascent); + textWidth += other.textWidth; + length += other.length; +} + +typedef QVector QScriptLineArray; + +class QFontPrivate; +class QTextFormatCollection; + +class Q_GUI_EXPORT QTextEngine { +public: + enum LayoutState { + LayoutEmpty, + InLayout, + LayoutFailed, + }; + struct LayoutData { + LayoutData(const QString &str, void **stack_memory, int mem_size); + LayoutData(); + ~LayoutData(); + mutable QScriptItemArray items; + int allocated; + int available_glyphs; + void **memory; + unsigned short *logClustersPtr; + QGlyphLayout glyphLayout; + mutable int used; + uint hasBidi : 1; + uint layoutState : 2; + uint memory_on_stack : 1; + bool haveCharAttributes; + QString string; + bool reallocate(int totalGlyphs); + }; + + QTextEngine(LayoutData *data); + QTextEngine(); + QTextEngine(const QString &str, const QFont &f); + ~QTextEngine(); + + enum Mode { + WidthOnly = 0x07 + }; + + // keep in sync with QAbstractFontEngine::TextShapingFlag!! + enum ShaperFlag { + RightToLeft = 0x0001, + DesignMetrics = 0x0002, + GlyphIndicesOnly = 0x0004 + }; + Q_DECLARE_FLAGS(ShaperFlags, ShaperFlag) + + void invalidate(); + void clearLineData(); + + void validate() const; + void itemize() const; + + bool isRightToLeft() const; + static void bidiReorder(int numRuns, const quint8 *levels, int *visualOrder); + + const HB_CharAttributes *attributes() const; + + void shape(int item) const; + + void justify(const QScriptLine &si); + + QFixed width(int charFrom, int numChars) const; + glyph_metrics_t boundingBox(int from, int len) const; + glyph_metrics_t tightBoundingBox(int from, int len) const; + + int length(int item) const { + const QScriptItem &si = layoutData->items[item]; + int from = si.position; + item++; + return (item < layoutData->items.size() ? layoutData->items[item].position : layoutData->string.length()) - from; + } + int length(const QScriptItem *si) const { + int end; + if (si + 1 < layoutData->items.constData()+ layoutData->items.size()) + end = (si+1)->position; + else + end = layoutData->string.length(); + return end - si->position; + } + + QFontEngine *fontEngine(const QScriptItem &si, QFixed *ascent = 0, QFixed *descent = 0, QFixed *leading = 0) const; + QFont font(const QScriptItem &si) const; + inline QFont font() const { return fnt; } + + /** + * Returns a pointer to an array of log clusters, offset at the script item. + * Each item in the array is a unsigned short. For each character in the original string there is an entry in the table + * so there is a one to one correlation in indexes between the original text and the index in the logcluster. + * The value of each item is the position in the glyphs array. Multiple similar pointers in the logclusters array imply + * that one glyph is used for more than one character. + * \sa glyphs() + */ + inline unsigned short *logClusters(const QScriptItem *si) const + { return layoutData->logClustersPtr+si->position; } + /** + * Returns an array of QGlyphLayout items, offset at the script item. + * Each item in the array matches one glyph in the text, storing the advance, position etc. + * The returned item's length equals to the number of available glyphs. This may be more + * than what was actually shaped. + * \sa logClusters() + */ + inline QGlyphLayout availableGlyphs(const QScriptItem *si) const { + return layoutData->glyphLayout.mid(si->glyph_data_offset); + } + /** + * Returns an array of QGlyphLayout items, offset at the script item. + * Each item in the array matches one glyph in the text, storing the advance, position etc. + * The returned item's length equals to the number of shaped glyphs. + * \sa logClusters() + */ + inline QGlyphLayout shapedGlyphs(const QScriptItem *si) const { + return layoutData->glyphLayout.mid(si->glyph_data_offset, si->num_glyphs); + } + + inline bool ensureSpace(int nGlyphs) const { + if (layoutData->glyphLayout.numGlyphs - layoutData->used < nGlyphs) + return layoutData->reallocate((((layoutData->used + nGlyphs)*3/2 + 15) >> 4) << 4); + return true; + } + + void freeMemory(); + + int findItem(int strPos) const; + QTextFormatCollection *formats() const; + QTextCharFormat format(const QScriptItem *si) const; + QAbstractTextDocumentLayout *docLayout() const; + int formatIndex(const QScriptItem *si) const; + + /// returns the width of tab at index (in the tabs array) with the tab-start at position x + QFixed calculateTabWidth(int index, QFixed x) const; + + mutable QScriptLineArray lines; + + QString text; + QFont fnt; + QTextBlock block; + + QTextOption option; + + QFixed minWidth; + QFixed maxWidth; + QPointF position; + uint ignoreBidi : 1; + uint cacheGlyphs : 1; + uint stackEngine : 1; + uint forceJustification : 1; + + int *underlinePositions; + + mutable LayoutData *layoutData; + + inline bool hasFormats() const { return (block.docHandle() || specialData); } + + struct SpecialData { + int preeditPosition; + QString preeditText; + QList addFormats; + QVector addFormatIndices; + QVector resolvedFormatIndices; + }; + SpecialData *specialData; + + bool atWordSeparator(int position) const; + bool atSpace(int position) const; + void indexAdditionalFormats(); + + QString elidedText(Qt::TextElideMode mode, const QFixed &width, int flags = 0) const; + + void shapeLine(const QScriptLine &line); + +private: + void setBoundary(int strPos) const; + void addRequiredBoundaries() const; + void shapeText(int item) const; + void shapeTextWithHarfbuzz(int item) const; +#if defined(Q_WS_WINCE) + void shapeTextWithCE(int item) const; +#endif +#if defined(Q_WS_MAC) + void shapeTextMac(int item) const; +#endif + void splitItem(int item, int pos) const; + + void resolveAdditionalFormats() const; +}; + +class QStackTextEngine : public QTextEngine { +public: + enum { MemSize = 256*40/sizeof(void *) }; + QStackTextEngine(const QString &string, const QFont &f); + LayoutData _layoutData; + void *_memory[MemSize]; +}; + + +Q_DECLARE_OPERATORS_FOR_FLAGS(QTextEngine::ShaperFlags) + +QT_END_NAMESPACE + +#endif // QTEXTENGINE_P_H diff --git a/tqtinterface/qt4/include/private/qt4_qtextimagehandler_p.h b/tqtinterface/qt4/include/private/qt4_qtextimagehandler_p.h new file mode 100644 index 0000000..65ed7fa --- /dev/null +++ b/tqtinterface/qt4/include/private/qt4_qtextimagehandler_p.h @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTEXTIMAGEHANDLER_P_H +#define QTEXTIMAGEHANDLER_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "QtCore/qobject.h" +#include "QtGui/qabstracttextdocumentlayout.h" + +QT_BEGIN_NAMESPACE + +class QTextImageFormat; + +class QTextImageHandler : public TQT_BASE_OBJECT_NAME, + public QTextObjectInterface +{ + Q_OBJECT + Q_INTERFACES(QTextObjectInterface) +public: + explicit QTextImageHandler(TQT_BASE_OBJECT_NAME *parent = 0); + + virtual QSizeF intrinsicSize(QTextDocument *doc, int posInDocument, const QTextFormat &format); + virtual void drawObject(QPainter *p, const QRectF &rect, QTextDocument *doc, int posInDocument, const QTextFormat &format); + + typedef QImage (*ExternalImageLoaderFunction)(const QString &name, const QString &context); + static Q_GUI_EXPORT ExternalImageLoaderFunction externalLoader; //this is needed by Qt3Support +}; + +QT_END_NAMESPACE + +#endif // QTEXTIMAGEHANDLER_P_H diff --git a/tqtinterface/qt4/include/private/qt4_qunicodetables_p.h b/tqtinterface/qt4/include/private/qt4_qunicodetables_p.h new file mode 100644 index 0000000..9a4c2e0 --- /dev/null +++ b/tqtinterface/qt4/include/private/qt4_qunicodetables_p.h @@ -0,0 +1,232 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/* This file is autogenerated from the Unicode 5.0 database. Do not edit */ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of internal files. This header file may change from version to version +// without notice, or even be removed. +// +// We mean it. +// + +#ifndef QUNICODETABLES_P_H +#define QUNICODETABLES_P_H + +#include + +QT_BEGIN_NAMESPACE + +#define UNICODE_DATA_VERSION QChar::Unicode_5_0 + +#define UNICODE_LAST_CODEPOINT 0x10ffff + +namespace QUnicodeTables { + + struct Properties { + ushort category : 8; /* 5 needed */ + ushort line_break_class : 8; /* 6 needed */ + ushort direction : 8; /* 5 needed */ + ushort combiningClass : 8; + ushort joining : 2; + signed short digitValue : 6; /* 5 needed */ + ushort unicodeVersion : 4; + ushort lowerCaseSpecial : 1; + ushort upperCaseSpecial : 1; + ushort titleCaseSpecial : 1; + ushort caseFoldSpecial : 1; /* currently unused */ + signed short mirrorDiff : 16; + signed short lowerCaseDiff : 16; + signed short upperCaseDiff : 16; + signed short titleCaseDiff : 16; + signed short caseFoldDiff : 16; + ushort graphemeBreak : 8; /* 4 needed */ + ushort wordBreak : 8; /* 4 needed */ + ushort sentenceBreak : 8; /* 4 needed */ + }; + Q_CORE_EXPORT const Properties * QT_FASTCALL properties(uint ucs4); + Q_CORE_EXPORT const Properties * QT_FASTCALL properties(ushort ucs2); + + // See http://www.unicode.org/reports/tr24/tr24-5.html + enum Script { + Common, + Greek, + Cyrillic, + Armenian, + Hebrew, + Arabic, + Syriac, + Thaana, + Devanagari, + Bengali, + Gurmukhi, + Gujarati, + Oriya, + Tamil, + Telugu, + Kannada, + Malayalam, + Sinhala, + Thai, + Lao, + Tibetan, + Myanmar, + Georgian, + Hangul, + Ogham, + Runic, + Khmer, + Nko, + Inherited, + ScriptCount = Inherited, + Latin = Common, + Ethiopic = Common, + Cherokee = Common, + CanadianAboriginal = Common, + Mongolian = Common, + Hiragana = Common, + Katakana = Common, + Bopomofo = Common, + Han = Common, + Yi = Common, + OldItalic = Common, + Gothic = Common, + Deseret = Common, + Tagalog = Common, + Hanunoo = Common, + Buhid = Common, + Tagbanwa = Common, + Limbu = Common, + TaiLe = Common, + LinearB = Common, + Ugaritic = Common, + Shavian = Common, + Osmanya = Common, + Cypriot = Common, + Braille = Common, + Buginese = Common, + Coptic = Common, + NewTaiLue = Common, + Glagolitic = Common, + Tifinagh = Common, + SylotiNagri = Common, + OldPersian = Common, + Kharoshthi = Common, + Balinese = Common, + Cuneiform = Common, + Phoenician = Common, + PhagsPa = Common + }; + enum { ScriptSentinel = 32 }; + + + // see http://www.unicode.org/reports/tr14/tr14-19.html + // we don't use the XX, AI and CB properties and map them to AL instead. + // as we don't support any EBDIC based OS'es, NL is ignored and mapped to AL as well. + enum LineBreakClass { + LineBreak_OP, LineBreak_CL, LineBreak_QU, LineBreak_GL, LineBreak_NS, + LineBreak_EX, LineBreak_SY, LineBreak_IS, LineBreak_PR, LineBreak_PO, + LineBreak_NU, LineBreak_AL, LineBreak_ID, LineBreak_IN, LineBreak_HY, + LineBreak_BA, LineBreak_BB, LineBreak_B2, LineBreak_ZW, LineBreak_CM, + LineBreak_WJ, LineBreak_H2, LineBreak_H3, LineBreak_JL, LineBreak_JV, + LineBreak_JT, LineBreak_SA, LineBreak_SG, + LineBreak_SP, LineBreak_CR, LineBreak_LF, LineBreak_BK + }; + + + enum GraphemeBreak { + GraphemeBreakOther, + GraphemeBreakCR, + GraphemeBreakLF, + GraphemeBreakControl, + GraphemeBreakExtend, + GraphemeBreakL, + GraphemeBreakV, + GraphemeBreakT, + GraphemeBreakLV, + GraphemeBreakLVT + }; + + + enum WordBreak { + WordBreakOther, + WordBreakFormat, + WordBreakKatakana, + WordBreakALetter, + WordBreakMidLetter, + WordBreakMidNum, + WordBreakNumeric, + WordBreakExtendNumLet + }; + + + enum SentenceBreak { + SentenceBreakOther, + SentenceBreakSep, + SentenceBreakFormat, + SentenceBreakSp, + SentenceBreakLower, + SentenceBreakUpper, + SentenceBreakOLetter, + SentenceBreakNumeric, + SentenceBreakATerm, + SentenceBreakSTerm, + SentenceBreakClose + }; + + + Q_CORE_EXPORT QUnicodeTables::LineBreakClass QT_FASTCALL lineBreakClass(uint ucs4); + inline int lineBreakClass(const QChar &ch) + { return lineBreakClass(ch.unicode()); } + + Q_CORE_EXPORT int QT_FASTCALL script(uint ucs4); + inline int script(const QChar &ch) + { return script(ch.unicode()); } + +} // namespace QUnicodeTables + +QT_END_NAMESPACE + +#endif // QUNICODETABLES_P_H diff --git a/tqtinterface/qt4/include/private/qt4_qwidget_p.h b/tqtinterface/qt4/include/private/qt4_qwidget_p.h new file mode 100644 index 0000000..c0f6ec7 --- /dev/null +++ b/tqtinterface/qt4/include/private/qt4_qwidget_p.h @@ -0,0 +1,334 @@ +// ----------------------------------------------------------------------------------- +// Large chunks of this file are taken straight from the qwidget_p.h file in Qt4 +// +// Specifically, these structures and classes must be kept in sync with Qt4: +// QWidgetBackingStoreTracker +// QTLWExtra +// QWExtra +// The same applies to the implementations defined in tqwidget.cpp +// +// Enjoy! +// ----------------------------------------------------------------------------------- + +#ifndef QWIDGET_P_H +#define QWIDGET_P_H + +#include +#include + +// Extra QWidget data +// - to minimize memory usage for members that are seldom used. +// - top-level widgets have extra extra data to reduce cost further +#if defined(Q_WS_QWS) +class QWSManager; +#endif +#if defined(Q_WS_MAC) +class QCoreGraphicsPaintEnginePrivate; +#endif +class QPaintEngine; +class QPixmap; +class QWidgetBackingStore; +class QGraphicsProxyWidget; +class QWidgetItemV2; + +class Q_AUTOTEST_EXPORT QWidgetBackingStoreTracker +{ + +public: + QWidgetBackingStoreTracker(); + ~QWidgetBackingStoreTracker(); + + void create(QWidget *tlw); + void destroy(); + + void registerWidget(QWidget *w); + void unregisterWidget(QWidget *w); + + inline QWidgetBackingStore* data() + { + return m_ptr; + } + + inline QWidgetBackingStore* operator->() + { + return m_ptr; + } + + inline QWidgetBackingStore& operator*() + { + return *m_ptr; + } + + inline operator bool() const + { + return (0 != m_ptr); + } + +private: + Q_DISABLE_COPY(QWidgetBackingStoreTracker) + +private: + QWidgetBackingStore* m_ptr; + QSet m_widgets; +}; + +struct QTLWExtra { + // *************************** Cross-platform variables ***************************** + + // Regular pointers (keep them together to avoid gaps on 64 bits architectures). + QIcon *icon; // widget icon + QPixmap *iconPixmap; + QWidgetBackingStoreTracker backingStore; + QWindowSurface *windowSurface; + QPainter *sharedPainter; + + // Implicit pointers (shared_null). + QString caption; // widget caption + QString iconText; // widget icon text + QString role; // widget role + QString filePath; // widget file path + + // Other variables. + short incw, inch; // size increments + short basew, baseh; // base sizes + // frame strut, don't use these directly, use QWidgetPrivate::frameStrut() instead. + QRect frameStrut; + QRect normalGeometry; // used by showMin/maximized/FullScreen + Qt::WindowFlags savedFlags; // Save widget flags while showing fullscreen + + // *************************** Cross-platform bit fields **************************** + uint opacity : 8; + uint posFromMove : 1; + uint sizeAdjusted : 1; + uint inTopLevelResize : 1; + uint inRepaint : 1; + uint embedded : 1; + + // *************************** Platform specific values (bit fields first) ********** +#if defined(Q_WS_X11) // <----------------------------------------------------------- X11 + uint spont_unmapped: 1; // window was spontaneously unmapped + uint dnd : 1; // DND properties installed + uint validWMState : 1; // is WM_STATE valid? + uint waitingForMapNotify : 1; // show() has been called, haven't got the MapNotify yet + WId parentWinId; // tqparent window Id (valid after reparenting) + WId userTimeWindow; // window id that tqcontains user-time timestamp when WM supports a _NET_WM_USER_TIME_WINDOW atom + QPoint fullScreenOffset; +#ifndef QT_NO_XSYNC + WId syncUpdateCounter; + ulong syncRequestTimestamp; + qint32 newCounterValueHi; + quint32 newCounterValueLo; +#endif +#elif defined(Q_WS_WIN) // <--------------------------------------------------------- WIN + uint hotkeyRegistered: 1; // Hot key from the STARTUPINFO has been registered. + HICON winIconBig; // internal big Windows icon + HICON winIconSmall; // internal small Windows icon +#elif defined(Q_WS_MAC) // <--------------------------------------------------------- MAC + uint resizer : 4; + uint isSetGeometry : 1; + uint isMove : 1; + quint32 wattr; + quint32 wclass; + WindowGroupRef group; + IconRef windowIcon; // the current window icon, if set with setWindowIcon_sys. + quint32 savedWindowAttributesFromMaximized; // Saved attributes from when the calling updateMaximizeButton_sys() +#ifdef QT_MAC_USE_COCOA + // This value is just to make sure we maximize and restore to the right location, yet we allow apps to be maximized and + // manually resized. + // The name is misleading, since this is set when maximizing the window. It is a hint to saveGeometry(..) to record the + // starting position as 0,0 instead of the normal starting position. + bool wasMaximized; +#endif // QT_MAC_USE_COCOA + +#elif defined(Q_WS_QWS) // <--------------------------------------------------------- QWS +#ifndef QT_NO_QWS_MANAGER + QWSManager *qwsManager; +#endif +#elif defined(Q_OS_SYMBIAN) + uint inExpose : 1; // Prevents drawing recursion +#endif +}; + +struct QWExtra { + // *************************** Cross-platform variables ***************************** + + // Regular pointers (keep them together to avoid gaps on 64 bits architectures). + void *glContext; // if the widget is hijacked by QGLWindowSurface + QTLWExtra *topextra; // only useful for TLWs +#ifndef QT_NO_GRAPHICSVIEW + QGraphicsProxyWidget *proxyWidget; // if the widget is embedded +#endif +#ifndef QT_NO_CURSOR + QCursor *curs; +#endif + QPointer style; + QPointer focus_proxy; + + // Implicit pointers (shared_empty/shared_null). + QRegion tqmask; // widget tqmask + QString styleSheet; + + // Other variables. + qint32 minw; + qint32 minh; // minimum size + qint32 maxw; + qint32 maxh; // maximum size + quint16 customDpiX; + quint16 customDpiY; + QSize staticContentsSize; + + // *************************** Cross-platform bit fields **************************** + uint explicitMinSize : 2; + uint explicitMaxSize : 2; + uint autoFillBackground : 1; + uint nativeChildrenForced : 1; + uint inRenderWithPainter : 1; + uint hasMask : 1; + + // *************************** Platform specific values (bit fields first) ********** +#if defined(Q_WS_WIN) // <----------------------------------------------------------- WIN +#ifndef QT_NO_DRAGANDDROP + QOleDropTarget *dropTarget; // drop target + QList > oleDropWidgets; +#endif +#elif defined(Q_WS_X11) // <--------------------------------------------------------- X11 + uint compress_events : 1; + WId xDndProxy; // XDND forwarding to embedded windows +#elif defined(Q_WS_MAC) // <------------------------------------------------------ MAC +#ifdef QT_MAC_USE_COCOA + // Cocoa Mask stuff + QImage maskBits; + CGImageRef imageMask; +#endif +#elif defined(Q_OS_SYMBIAN) // <----------------------------------------------------- Symbian + uint activated : 1; // RWindowBase::Activated has been called + + /** + * If this bit is set, each native widget receives the Q_SIGNALS from the + * Symbian control immediately before and immediately after draw ops are + * sent to the window server for this control: + * void beginNativePaintEvent(const QRect &paintRect); + * void endNativePaintEvent(const QRect &paintRect); + */ + uint receiveNativePaintEvents : 1; + + /** + * Defines the behaviour of QSymbianControl::Draw. + */ + enum NativePaintMode { + /** + * Normal drawing mode: blits the required region of the backing store + * via WSERV. + */ + Blit, + + /** + * Disable drawing for this widget. + */ + Disable, + + /** + * Paint zeros into the WSERV framebuffer, using BitGDI APIs. For windows + * with an EColor16MU display mode, zero is written only into the R, G and B + * channels of the pixel. + */ + ZeroFill, + + Default = Blit + }; + + NativePaintMode nativePaintMode; + +#endif +}; + +class Q_GUI_EXPORT QWidgetPrivate +{ +// Q_DECLARE_PUBLIC(QWidget) + +public: + // *************************** Cross-platform *************************************** + enum DrawWidgetFlags { + DrawAsRoot = 0x01, + DrawPaintOnScreen = 0x02, + DrawRecursive = 0x04, + DrawInvisible = 0x08, + DontSubtractOpaqueChildren = 0x10, + DontSetCompositionMode = 0x20, + DontDrawOpaqueChildren = 0x40 + }; + + enum CloseMode { + CloseNoEvent, + CloseWithEvent, + CloseWithSpontaneousEvent + }; + + enum Direction { + DirectionNorth = 0x01, + DirectionEast = 0x10, + DirectionSouth = 0x02, + DirectionWest = 0x20 + }; + + // Functions. + explicit QWidgetPrivate(int version); + ~QWidgetPrivate(); + + QWExtra *extraData() const; + QTLWExtra *topData() const; + QTLWExtra *maybeTopData() const; + QPainter *sharedPainter() const; + void setSharedPainter(QPainter *painter); + QWidgetBackingStore *maybeBackingStore() const; + void init(QWidget *desktopWidget, Qt::WindowFlags f); + void create_sys(WId window, bool initializeWindow, bool destroyOldWindow); + void createRecursively(); + void createWinId(WId id = 0); + + void createTLExtra(); + void createExtra(); + void deleteExtra(); + void createSysExtra(); + void deleteSysExtra(); + void createTLSysExtra(); + void deleteTLSysExtra(); + void updateSystemBackground(); + void propagatePaletteChange(); + + // Variables. + // Regular pointers (keep them together to avoid gaps on 64 bit architectures). + QWExtra *extra; + QWidget *focus_next; + QWidget *focus_prev; + QWidget *focus_child; + QLayout *layout; + QRegion *needsFlush; + QPaintDevice *redirectDev; + QWidgetItemV2 *widgetItem; + QPaintEngine *extraPaintEngine; + mutable const QMetaObject *polished; + QGraphicsEffect *graphicsEffect; + // All widgets are added into the allWidgets set. Once + // they receive a window id they are also added to the mapper. + // This should just ensure that all widgets are deleted by QApplication + static QWidgetMapper *mapper; +}; + +inline QWExtra *QWidgetPrivate::extraData() const +{ + return extra; +} + +inline QTLWExtra *QWidgetPrivate::topData() const +{ + const_cast(this)->createTLExtra(); + return extra->topextra; +} + +inline QTLWExtra *QWidgetPrivate::maybeTopData() const +{ + return extra ? extra->topextra : 0; +} + +#endif // QWIDGET_P_H \ No newline at end of file diff --git a/tqtinterface/qt4/include/private/tqapplication_p.h b/tqtinterface/qt4/include/private/tqapplication_p.h new file mode 120000 index 0000000..b4f919e --- /dev/null +++ b/tqtinterface/qt4/include/private/tqapplication_p.h @@ -0,0 +1 @@ +../../src/kernel/tqapplication_p.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/private/tqcolor_p.h b/tqtinterface/qt4/include/private/tqcolor_p.h new file mode 120000 index 0000000..b3b245a --- /dev/null +++ b/tqtinterface/qt4/include/private/tqcolor_p.h @@ -0,0 +1 @@ +../../src/kernel/tqcolor_p.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/private/tqcom_p.h b/tqtinterface/qt4/include/private/tqcom_p.h new file mode 120000 index 0000000..7df32df --- /dev/null +++ b/tqtinterface/qt4/include/private/tqcom_p.h @@ -0,0 +1 @@ +../../src/tools/tqcom_p.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/private/tqcomlibrary_p.h b/tqtinterface/qt4/include/private/tqcomlibrary_p.h new file mode 120000 index 0000000..621dc9f --- /dev/null +++ b/tqtinterface/qt4/include/private/tqcomlibrary_p.h @@ -0,0 +1 @@ +../../src/tools/tqcomlibrary_p.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/private/tqcomponentfactory_p.h b/tqtinterface/qt4/include/private/tqcomponentfactory_p.h new file mode 120000 index 0000000..80efb5b --- /dev/null +++ b/tqtinterface/qt4/include/private/tqcomponentfactory_p.h @@ -0,0 +1 @@ +../../src/tools/tqcomponentfactory_p.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/private/tqcriticalsection_p.h b/tqtinterface/qt4/include/private/tqcriticalsection_p.h new file mode 120000 index 0000000..6c11336 --- /dev/null +++ b/tqtinterface/qt4/include/private/tqcriticalsection_p.h @@ -0,0 +1 @@ +../../src/tools/tqcriticalsection_p.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/private/tqdialogbuttons_p.h b/tqtinterface/qt4/include/private/tqdialogbuttons_p.h new file mode 120000 index 0000000..4f270cf --- /dev/null +++ b/tqtinterface/qt4/include/private/tqdialogbuttons_p.h @@ -0,0 +1 @@ +../../src/widgets/tqdialogbuttons_p.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/private/tqdir_p.h b/tqtinterface/qt4/include/private/tqdir_p.h new file mode 120000 index 0000000..723ac40 --- /dev/null +++ b/tqtinterface/qt4/include/private/tqdir_p.h @@ -0,0 +1 @@ +../../src/tools/tqdir_p.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/private/tqeffects_p.h b/tqtinterface/qt4/include/private/tqeffects_p.h new file mode 120000 index 0000000..d375803 --- /dev/null +++ b/tqtinterface/qt4/include/private/tqeffects_p.h @@ -0,0 +1 @@ +../../src/widgets/tqeffects_p.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/private/tqeventloop_p.h b/tqtinterface/qt4/include/private/tqeventloop_p.h new file mode 120000 index 0000000..69230d9 --- /dev/null +++ b/tqtinterface/qt4/include/private/tqeventloop_p.h @@ -0,0 +1 @@ +../../src/kernel/tqeventloop_p.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/private/tqfiledefs_p.h b/tqtinterface/qt4/include/private/tqfiledefs_p.h new file mode 120000 index 0000000..44b89f6 --- /dev/null +++ b/tqtinterface/qt4/include/private/tqfiledefs_p.h @@ -0,0 +1 @@ +../../src/tools/tqfiledefs_p.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/private/tqfontcodecs_p.h b/tqtinterface/qt4/include/private/tqfontcodecs_p.h new file mode 120000 index 0000000..3da61cc --- /dev/null +++ b/tqtinterface/qt4/include/private/tqfontcodecs_p.h @@ -0,0 +1 @@ +../../src/codecs/tqfontcodecs_p.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/private/tqfontdata_p.h b/tqtinterface/qt4/include/private/tqfontdata_p.h new file mode 120000 index 0000000..83d5e6a --- /dev/null +++ b/tqtinterface/qt4/include/private/tqfontdata_p.h @@ -0,0 +1 @@ +../../src/kernel/tqfontdata_p.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/private/tqfontengine_p.h b/tqtinterface/qt4/include/private/tqfontengine_p.h new file mode 120000 index 0000000..e08e927 --- /dev/null +++ b/tqtinterface/qt4/include/private/tqfontengine_p.h @@ -0,0 +1 @@ +../../src/kernel/tqfontengine_p.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/private/tqgfxdriverinterface_p.h b/tqtinterface/qt4/include/private/tqgfxdriverinterface_p.h new file mode 120000 index 0000000..26e5ab2 --- /dev/null +++ b/tqtinterface/qt4/include/private/tqgfxdriverinterface_p.h @@ -0,0 +1 @@ +../../src/embedded/tqgfxdriverinterface_p.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/private/tqgl_x11_p.h b/tqtinterface/qt4/include/private/tqgl_x11_p.h new file mode 120000 index 0000000..3f5af2a --- /dev/null +++ b/tqtinterface/qt4/include/private/tqgl_x11_p.h @@ -0,0 +1 @@ +../../src/opengl/tqgl_x11_p.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/private/tqgpluginmanager_p.h b/tqtinterface/qt4/include/private/tqgpluginmanager_p.h new file mode 120000 index 0000000..e3ba037 --- /dev/null +++ b/tqtinterface/qt4/include/private/tqgpluginmanager_p.h @@ -0,0 +1 @@ +../../src/tools/tqgpluginmanager_p.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/private/tqimageformatinterface_p.h b/tqtinterface/qt4/include/private/tqimageformatinterface_p.h new file mode 120000 index 0000000..88cd30d --- /dev/null +++ b/tqtinterface/qt4/include/private/tqimageformatinterface_p.h @@ -0,0 +1 @@ +../../src/kernel/tqimageformatinterface_p.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/private/tqinputcontext_p.h b/tqtinterface/qt4/include/private/tqinputcontext_p.h new file mode 120000 index 0000000..14f83dd --- /dev/null +++ b/tqtinterface/qt4/include/private/tqinputcontext_p.h @@ -0,0 +1 @@ +../../src/kernel/tqinputcontext_p.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/private/tqinternal_p.h b/tqtinterface/qt4/include/private/tqinternal_p.h new file mode 120000 index 0000000..bdd99f0 --- /dev/null +++ b/tqtinterface/qt4/include/private/tqinternal_p.h @@ -0,0 +1 @@ +../../src/kernel/tqinternal_p.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/private/tqisciicodec_p.h b/tqtinterface/qt4/include/private/tqisciicodec_p.h new file mode 120000 index 0000000..9b8cc6b --- /dev/null +++ b/tqtinterface/qt4/include/private/tqisciicodec_p.h @@ -0,0 +1 @@ +../../src/codecs/tqisciicodec_p.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/private/tqkbddriverinterface_p.h b/tqtinterface/qt4/include/private/tqkbddriverinterface_p.h new file mode 120000 index 0000000..5658e80 --- /dev/null +++ b/tqtinterface/qt4/include/private/tqkbddriverinterface_p.h @@ -0,0 +1 @@ +../../src/embedded/tqkbddriverinterface_p.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/private/tqlayoutengine_p.h b/tqtinterface/qt4/include/private/tqlayoutengine_p.h new file mode 120000 index 0000000..34ddbd7 --- /dev/null +++ b/tqtinterface/qt4/include/private/tqlayoutengine_p.h @@ -0,0 +1 @@ +../../src/kernel/tqlayoutengine_p.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/private/tqlibrary_p.h b/tqtinterface/qt4/include/private/tqlibrary_p.h new file mode 120000 index 0000000..2d6d44d --- /dev/null +++ b/tqtinterface/qt4/include/private/tqlibrary_p.h @@ -0,0 +1 @@ +../../src/tools/tqlibrary_p.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/private/tqlocale_p.h b/tqtinterface/qt4/include/private/tqlocale_p.h new file mode 120000 index 0000000..903f5d7 --- /dev/null +++ b/tqtinterface/qt4/include/private/tqlocale_p.h @@ -0,0 +1 @@ +../../src/tools/tqlocale_p.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/private/tqlock_p.h b/tqtinterface/qt4/include/private/tqlock_p.h new file mode 120000 index 0000000..062cc3d --- /dev/null +++ b/tqtinterface/qt4/include/private/tqlock_p.h @@ -0,0 +1 @@ +../../src/kernel/tqlock_p.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/private/tqmousedriverinterface_p.h b/tqtinterface/qt4/include/private/tqmousedriverinterface_p.h new file mode 120000 index 0000000..2b5b7e7 --- /dev/null +++ b/tqtinterface/qt4/include/private/tqmousedriverinterface_p.h @@ -0,0 +1 @@ +../../src/embedded/tqmousedriverinterface_p.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/private/tqmutex_p.h b/tqtinterface/qt4/include/private/tqmutex_p.h new file mode 120000 index 0000000..af12dcd --- /dev/null +++ b/tqtinterface/qt4/include/private/tqmutex_p.h @@ -0,0 +1 @@ +../../src/tools/tqmutex_p.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/private/tqmutexpool_p.h b/tqtinterface/qt4/include/private/tqmutexpool_p.h new file mode 120000 index 0000000..dcd445d --- /dev/null +++ b/tqtinterface/qt4/include/private/tqmutexpool_p.h @@ -0,0 +1 @@ +../../src/tools/tqmutexpool_p.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/private/tqpainter_p.h b/tqtinterface/qt4/include/private/tqpainter_p.h new file mode 120000 index 0000000..3e4dd4b --- /dev/null +++ b/tqtinterface/qt4/include/private/tqpainter_p.h @@ -0,0 +1 @@ +../../src/kernel/tqpainter_p.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/private/tqpluginmanager_p.h b/tqtinterface/qt4/include/private/tqpluginmanager_p.h new file mode 120000 index 0000000..b661d03 --- /dev/null +++ b/tqtinterface/qt4/include/private/tqpluginmanager_p.h @@ -0,0 +1 @@ +../../src/tools/tqpluginmanager_p.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/private/tqprinter_p.h b/tqtinterface/qt4/include/private/tqprinter_p.h new file mode 120000 index 0000000..8d60d1d --- /dev/null +++ b/tqtinterface/qt4/include/private/tqprinter_p.h @@ -0,0 +1 @@ +../../src/kernel/tqprinter_p.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/private/tqpsprinter_p.h b/tqtinterface/qt4/include/private/tqpsprinter_p.h new file mode 120000 index 0000000..9c1c61f --- /dev/null +++ b/tqtinterface/qt4/include/private/tqpsprinter_p.h @@ -0,0 +1 @@ +../../src/kernel/tqpsprinter_p.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/private/tqrichtext_p.h b/tqtinterface/qt4/include/private/tqrichtext_p.h new file mode 120000 index 0000000..72b48fc --- /dev/null +++ b/tqtinterface/qt4/include/private/tqrichtext_p.h @@ -0,0 +1 @@ +../../src/kernel/tqrichtext_p.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/private/tqscriptengine_p.h b/tqtinterface/qt4/include/private/tqscriptengine_p.h new file mode 120000 index 0000000..f4a4687 --- /dev/null +++ b/tqtinterface/qt4/include/private/tqscriptengine_p.h @@ -0,0 +1 @@ +../../src/kernel/tqscriptengine_p.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/private/tqsettings_p.h b/tqtinterface/qt4/include/private/tqsettings_p.h new file mode 120000 index 0000000..ea34ba9 --- /dev/null +++ b/tqtinterface/qt4/include/private/tqsettings_p.h @@ -0,0 +1 @@ +../../src/tools/tqsettings_p.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/private/tqsharedmemory_p.h b/tqtinterface/qt4/include/private/tqsharedmemory_p.h new file mode 120000 index 0000000..2cb7d1f --- /dev/null +++ b/tqtinterface/qt4/include/private/tqsharedmemory_p.h @@ -0,0 +1 @@ +../../src/kernel/tqsharedmemory_p.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/private/tqsqldriverinterface_p.h b/tqtinterface/qt4/include/private/tqsqldriverinterface_p.h new file mode 120000 index 0000000..fa323dd --- /dev/null +++ b/tqtinterface/qt4/include/private/tqsqldriverinterface_p.h @@ -0,0 +1 @@ +../../src/sql/tqsqldriverinterface_p.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/private/tqsqlextension_p.h b/tqtinterface/qt4/include/private/tqsqlextension_p.h new file mode 120000 index 0000000..42e1649 --- /dev/null +++ b/tqtinterface/qt4/include/private/tqsqlextension_p.h @@ -0,0 +1 @@ +../../src/sql/tqsqlextension_p.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/private/tqsqlmanager_p.h b/tqtinterface/qt4/include/private/tqsqlmanager_p.h new file mode 120000 index 0000000..a74c0b8 --- /dev/null +++ b/tqtinterface/qt4/include/private/tqsqlmanager_p.h @@ -0,0 +1 @@ +../../src/sql/tqsqlmanager_p.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/private/tqstyleinterface_p.h b/tqtinterface/qt4/include/private/tqstyleinterface_p.h new file mode 120000 index 0000000..631c37f --- /dev/null +++ b/tqtinterface/qt4/include/private/tqstyleinterface_p.h @@ -0,0 +1 @@ +../../src/styles/tqstyleinterface_p.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/private/tqsvgdevice_p.h b/tqtinterface/qt4/include/private/tqsvgdevice_p.h new file mode 120000 index 0000000..a659160 --- /dev/null +++ b/tqtinterface/qt4/include/private/tqsvgdevice_p.h @@ -0,0 +1 @@ +../../src/xml/tqsvgdevice_p.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/private/tqsyntaxhighlighter_p.h b/tqtinterface/qt4/include/private/tqsyntaxhighlighter_p.h new file mode 120000 index 0000000..dae21c2 --- /dev/null +++ b/tqtinterface/qt4/include/private/tqsyntaxhighlighter_p.h @@ -0,0 +1 @@ +../../src/widgets/tqsyntaxhighlighter_p.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/private/tqt_x11_p.h b/tqtinterface/qt4/include/private/tqt_x11_p.h new file mode 120000 index 0000000..8c6e4c1 --- /dev/null +++ b/tqtinterface/qt4/include/private/tqt_x11_p.h @@ -0,0 +1 @@ +../../src/kernel/tqt_x11_p.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/private/tqtextcodecinterface_p.h b/tqtinterface/qt4/include/private/tqtextcodecinterface_p.h new file mode 120000 index 0000000..75a7a51 --- /dev/null +++ b/tqtinterface/qt4/include/private/tqtextcodecinterface_p.h @@ -0,0 +1 @@ +../../src/codecs/tqtextcodecinterface_p.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/private/tqtextengine_p.h b/tqtinterface/qt4/include/private/tqtextengine_p.h new file mode 120000 index 0000000..357fe97 --- /dev/null +++ b/tqtinterface/qt4/include/private/tqtextengine_p.h @@ -0,0 +1 @@ +../../src/kernel/tqtextengine_p.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/private/tqtextlayout_p.h b/tqtinterface/qt4/include/private/tqtextlayout_p.h new file mode 120000 index 0000000..bf9dc49 --- /dev/null +++ b/tqtinterface/qt4/include/private/tqtextlayout_p.h @@ -0,0 +1 @@ +../../src/kernel/tqtextlayout_p.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/private/tqthreadinstance_p.h b/tqtinterface/qt4/include/private/tqthreadinstance_p.h new file mode 120000 index 0000000..c6380e3 --- /dev/null +++ b/tqtinterface/qt4/include/private/tqthreadinstance_p.h @@ -0,0 +1 @@ +../../src/tools/tqthreadinstance_p.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/private/tqtitlebar_p.h b/tqtinterface/qt4/include/private/tqtitlebar_p.h new file mode 120000 index 0000000..6fedbb5 --- /dev/null +++ b/tqtinterface/qt4/include/private/tqtitlebar_p.h @@ -0,0 +1 @@ +../../src/widgets/tqtitlebar_p.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/private/tqucom_p.h b/tqtinterface/qt4/include/private/tqucom_p.h new file mode 120000 index 0000000..bd307b7 --- /dev/null +++ b/tqtinterface/qt4/include/private/tqucom_p.h @@ -0,0 +1 @@ +../../src/tools/tqucom_p.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/private/tqucomextra_p.h b/tqtinterface/qt4/include/private/tqucomextra_p.h new file mode 120000 index 0000000..ba9b4aa --- /dev/null +++ b/tqtinterface/qt4/include/private/tqucomextra_p.h @@ -0,0 +1 @@ +../../src/kernel/tqucomextra_p.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/private/tqunicodetables_p.h b/tqtinterface/qt4/include/private/tqunicodetables_p.h new file mode 120000 index 0000000..3ad77b7 --- /dev/null +++ b/tqtinterface/qt4/include/private/tqunicodetables_p.h @@ -0,0 +1 @@ +../../src/tools/tqunicodetables_p.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/private/tqwidget_p.h b/tqtinterface/qt4/include/private/tqwidget_p.h new file mode 120000 index 0000000..433940b --- /dev/null +++ b/tqtinterface/qt4/include/private/tqwidget_p.h @@ -0,0 +1 @@ +../../src/kernel/tqwidget_p.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/private/tqwidgetinterface_p.h b/tqtinterface/qt4/include/private/tqwidgetinterface_p.h new file mode 120000 index 0000000..652ddfc --- /dev/null +++ b/tqtinterface/qt4/include/private/tqwidgetinterface_p.h @@ -0,0 +1 @@ +../../src/widgets/tqwidgetinterface_p.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/private/tqwidgetresizehandler_p.h b/tqtinterface/qt4/include/private/tqwidgetresizehandler_p.h new file mode 120000 index 0000000..a413f64 --- /dev/null +++ b/tqtinterface/qt4/include/private/tqwidgetresizehandler_p.h @@ -0,0 +1 @@ +../../src/widgets/tqwidgetresizehandler_p.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tq1xcompatibility.h b/tqtinterface/qt4/include/tq1xcompatibility.h new file mode 120000 index 0000000..22a5caf --- /dev/null +++ b/tqtinterface/qt4/include/tq1xcompatibility.h @@ -0,0 +1 @@ +../src/kernel/tq1xcompatibility.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqabstractlayout.h b/tqtinterface/qt4/include/tqabstractlayout.h new file mode 120000 index 0000000..2b64bd7 --- /dev/null +++ b/tqtinterface/qt4/include/tqabstractlayout.h @@ -0,0 +1 @@ +../src/kernel/tqabstractlayout.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqaccel.h b/tqtinterface/qt4/include/tqaccel.h new file mode 120000 index 0000000..7d3b626 --- /dev/null +++ b/tqtinterface/qt4/include/tqaccel.h @@ -0,0 +1 @@ +../src/kernel/tqaccel.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqaccessible.h b/tqtinterface/qt4/include/tqaccessible.h new file mode 120000 index 0000000..678178e --- /dev/null +++ b/tqtinterface/qt4/include/tqaccessible.h @@ -0,0 +1 @@ +../src/kernel/tqaccessible.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqaction.h b/tqtinterface/qt4/include/tqaction.h new file mode 120000 index 0000000..f016eda --- /dev/null +++ b/tqtinterface/qt4/include/tqaction.h @@ -0,0 +1 @@ +../src/widgets/tqaction.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqapp.h b/tqtinterface/qt4/include/tqapp.h new file mode 120000 index 0000000..9da9b7c --- /dev/null +++ b/tqtinterface/qt4/include/tqapp.h @@ -0,0 +1 @@ +../src/compat/tqapp.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqapplication.h b/tqtinterface/qt4/include/tqapplication.h new file mode 120000 index 0000000..cc0178e --- /dev/null +++ b/tqtinterface/qt4/include/tqapplication.h @@ -0,0 +1 @@ +../src/kernel/tqapplication.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqarray.h b/tqtinterface/qt4/include/tqarray.h new file mode 120000 index 0000000..c24a2de --- /dev/null +++ b/tqtinterface/qt4/include/tqarray.h @@ -0,0 +1 @@ +../src/compat/tqarray.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqasciicache.h b/tqtinterface/qt4/include/tqasciicache.h new file mode 120000 index 0000000..b6862fe --- /dev/null +++ b/tqtinterface/qt4/include/tqasciicache.h @@ -0,0 +1 @@ +../src/tools/tqasciicache.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqasciidict.h b/tqtinterface/qt4/include/tqasciidict.h new file mode 120000 index 0000000..a0150ad --- /dev/null +++ b/tqtinterface/qt4/include/tqasciidict.h @@ -0,0 +1 @@ +../src/tools/tqasciidict.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqassistantclient.h b/tqtinterface/qt4/include/tqassistantclient.h new file mode 120000 index 0000000..a94a625 --- /dev/null +++ b/tqtinterface/qt4/include/tqassistantclient.h @@ -0,0 +1 @@ +../tools/assistant/lib/tqassistantclient.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqasyncimageio.h b/tqtinterface/qt4/include/tqasyncimageio.h new file mode 120000 index 0000000..b4d8027 --- /dev/null +++ b/tqtinterface/qt4/include/tqasyncimageio.h @@ -0,0 +1 @@ +../src/kernel/tqasyncimageio.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqasyncio.h b/tqtinterface/qt4/include/tqasyncio.h new file mode 120000 index 0000000..fa744b8 --- /dev/null +++ b/tqtinterface/qt4/include/tqasyncio.h @@ -0,0 +1 @@ +../src/kernel/tqasyncio.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqbig5codec.h b/tqtinterface/qt4/include/tqbig5codec.h new file mode 120000 index 0000000..44c0b85 --- /dev/null +++ b/tqtinterface/qt4/include/tqbig5codec.h @@ -0,0 +1 @@ +../src/codecs/tqbig5codec.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqbitarray.h b/tqtinterface/qt4/include/tqbitarray.h new file mode 120000 index 0000000..fa3fcdf --- /dev/null +++ b/tqtinterface/qt4/include/tqbitarray.h @@ -0,0 +1 @@ +../src/tools/tqbitarray.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqbitarry.h b/tqtinterface/qt4/include/tqbitarry.h new file mode 120000 index 0000000..a0451ce --- /dev/null +++ b/tqtinterface/qt4/include/tqbitarry.h @@ -0,0 +1 @@ +../src/compat/tqbitarry.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqbitmap.h b/tqtinterface/qt4/include/tqbitmap.h new file mode 120000 index 0000000..2d6a6e2 --- /dev/null +++ b/tqtinterface/qt4/include/tqbitmap.h @@ -0,0 +1 @@ +../src/kernel/tqbitmap.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqbrush.h b/tqtinterface/qt4/include/tqbrush.h new file mode 120000 index 0000000..d741892 --- /dev/null +++ b/tqtinterface/qt4/include/tqbrush.h @@ -0,0 +1 @@ +../src/kernel/tqbrush.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqbttngrp.h b/tqtinterface/qt4/include/tqbttngrp.h new file mode 120000 index 0000000..e806fcf --- /dev/null +++ b/tqtinterface/qt4/include/tqbttngrp.h @@ -0,0 +1 @@ +../src/compat/tqbttngrp.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqbuffer.h b/tqtinterface/qt4/include/tqbuffer.h new file mode 120000 index 0000000..8fc2634 --- /dev/null +++ b/tqtinterface/qt4/include/tqbuffer.h @@ -0,0 +1 @@ +../src/tools/tqbuffer.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqbutton.h b/tqtinterface/qt4/include/tqbutton.h new file mode 120000 index 0000000..134a702 --- /dev/null +++ b/tqtinterface/qt4/include/tqbutton.h @@ -0,0 +1 @@ +../src/widgets/tqbutton.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqbuttongroup.h b/tqtinterface/qt4/include/tqbuttongroup.h new file mode 120000 index 0000000..652a774 --- /dev/null +++ b/tqtinterface/qt4/include/tqbuttongroup.h @@ -0,0 +1 @@ +../src/widgets/tqbuttongroup.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqcache.h b/tqtinterface/qt4/include/tqcache.h new file mode 120000 index 0000000..bd22e00 --- /dev/null +++ b/tqtinterface/qt4/include/tqcache.h @@ -0,0 +1 @@ +../src/tools/tqcache.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqcanvas.h b/tqtinterface/qt4/include/tqcanvas.h new file mode 120000 index 0000000..35e71a5 --- /dev/null +++ b/tqtinterface/qt4/include/tqcanvas.h @@ -0,0 +1 @@ +../src/canvas/tqcanvas.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqcdestyle.h b/tqtinterface/qt4/include/tqcdestyle.h new file mode 120000 index 0000000..c28eadf --- /dev/null +++ b/tqtinterface/qt4/include/tqcdestyle.h @@ -0,0 +1 @@ +../src/styles/tqcdestyle.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqcheckbox.h b/tqtinterface/qt4/include/tqcheckbox.h new file mode 120000 index 0000000..9e52b4d --- /dev/null +++ b/tqtinterface/qt4/include/tqcheckbox.h @@ -0,0 +1 @@ +../src/widgets/tqcheckbox.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqchkbox.h b/tqtinterface/qt4/include/tqchkbox.h new file mode 120000 index 0000000..d193e65 --- /dev/null +++ b/tqtinterface/qt4/include/tqchkbox.h @@ -0,0 +1 @@ +../src/compat/tqchkbox.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqcleanuphandler.h b/tqtinterface/qt4/include/tqcleanuphandler.h new file mode 120000 index 0000000..31b5c7d --- /dev/null +++ b/tqtinterface/qt4/include/tqcleanuphandler.h @@ -0,0 +1 @@ +../src/tools/tqcleanuphandler.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqclipboard.h b/tqtinterface/qt4/include/tqclipboard.h new file mode 120000 index 0000000..24a4b6c --- /dev/null +++ b/tqtinterface/qt4/include/tqclipboard.h @@ -0,0 +1 @@ +../src/kernel/tqclipboard.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqclipbrd.h b/tqtinterface/qt4/include/tqclipbrd.h new file mode 120000 index 0000000..6bfa08a --- /dev/null +++ b/tqtinterface/qt4/include/tqclipbrd.h @@ -0,0 +1 @@ +../src/compat/tqclipbrd.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqcollect.h b/tqtinterface/qt4/include/tqcollect.h new file mode 120000 index 0000000..3574835 --- /dev/null +++ b/tqtinterface/qt4/include/tqcollect.h @@ -0,0 +1 @@ +../src/compat/tqcollect.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqcollection.h b/tqtinterface/qt4/include/tqcollection.h new file mode 120000 index 0000000..fcd252e --- /dev/null +++ b/tqtinterface/qt4/include/tqcollection.h @@ -0,0 +1 @@ +../src/compat/tqcollection.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqcolor.h b/tqtinterface/qt4/include/tqcolor.h new file mode 120000 index 0000000..6094e76 --- /dev/null +++ b/tqtinterface/qt4/include/tqcolor.h @@ -0,0 +1 @@ +../src/kernel/tqcolor.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqcolordialog.h b/tqtinterface/qt4/include/tqcolordialog.h new file mode 120000 index 0000000..8920166 --- /dev/null +++ b/tqtinterface/qt4/include/tqcolordialog.h @@ -0,0 +1 @@ +../src/dialogs/tqcolordialog.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqcombo.h b/tqtinterface/qt4/include/tqcombo.h new file mode 120000 index 0000000..1285690 --- /dev/null +++ b/tqtinterface/qt4/include/tqcombo.h @@ -0,0 +1 @@ +../src/compat/tqcombo.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqcombobox.h b/tqtinterface/qt4/include/tqcombobox.h new file mode 120000 index 0000000..22a722c --- /dev/null +++ b/tqtinterface/qt4/include/tqcombobox.h @@ -0,0 +1 @@ +../src/widgets/tqcombobox.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqcommonstyle.h b/tqtinterface/qt4/include/tqcommonstyle.h new file mode 120000 index 0000000..7fc4ed2 --- /dev/null +++ b/tqtinterface/qt4/include/tqcommonstyle.h @@ -0,0 +1 @@ +../src/styles/tqcommonstyle.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqcompactstyle.h b/tqtinterface/qt4/include/tqcompactstyle.h new file mode 120000 index 0000000..a6426a9 --- /dev/null +++ b/tqtinterface/qt4/include/tqcompactstyle.h @@ -0,0 +1 @@ +../src/styles/tqcompactstyle.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqconfig-dist.h b/tqtinterface/qt4/include/tqconfig-dist.h new file mode 120000 index 0000000..1fef170 --- /dev/null +++ b/tqtinterface/qt4/include/tqconfig-dist.h @@ -0,0 +1 @@ +../src/tools/tqconfig-dist.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqconfig-large.h b/tqtinterface/qt4/include/tqconfig-large.h new file mode 120000 index 0000000..cc46c60 --- /dev/null +++ b/tqtinterface/qt4/include/tqconfig-large.h @@ -0,0 +1 @@ +../src/tools/tqconfig-large.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqconfig-medium.h b/tqtinterface/qt4/include/tqconfig-medium.h new file mode 120000 index 0000000..c4e2e52 --- /dev/null +++ b/tqtinterface/qt4/include/tqconfig-medium.h @@ -0,0 +1 @@ +../src/tools/tqconfig-medium.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqconfig-minimal.h b/tqtinterface/qt4/include/tqconfig-minimal.h new file mode 120000 index 0000000..4d494b3 --- /dev/null +++ b/tqtinterface/qt4/include/tqconfig-minimal.h @@ -0,0 +1 @@ +../src/tools/tqconfig-minimal.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqconfig-small.h b/tqtinterface/qt4/include/tqconfig-small.h new file mode 120000 index 0000000..80bdbdc --- /dev/null +++ b/tqtinterface/qt4/include/tqconfig-small.h @@ -0,0 +1 @@ +../src/tools/tqconfig-small.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqconnect.h b/tqtinterface/qt4/include/tqconnect.h new file mode 120000 index 0000000..ccdb246 --- /dev/null +++ b/tqtinterface/qt4/include/tqconnect.h @@ -0,0 +1 @@ +../src/compat/tqconnect.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqconnection.h b/tqtinterface/qt4/include/tqconnection.h new file mode 120000 index 0000000..49e97db --- /dev/null +++ b/tqtinterface/qt4/include/tqconnection.h @@ -0,0 +1 @@ +../src/kernel/tqconnection.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqcstring.h b/tqtinterface/qt4/include/tqcstring.h new file mode 120000 index 0000000..cfa9197 --- /dev/null +++ b/tqtinterface/qt4/include/tqcstring.h @@ -0,0 +1 @@ +../src/tools/tqcstring.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqcursor.h b/tqtinterface/qt4/include/tqcursor.h new file mode 120000 index 0000000..025854b --- /dev/null +++ b/tqtinterface/qt4/include/tqcursor.h @@ -0,0 +1 @@ +../src/kernel/tqcursor.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqdatabrowser.h b/tqtinterface/qt4/include/tqdatabrowser.h new file mode 120000 index 0000000..c3d0d77 --- /dev/null +++ b/tqtinterface/qt4/include/tqdatabrowser.h @@ -0,0 +1 @@ +../src/sql/tqdatabrowser.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqdatastream.h b/tqtinterface/qt4/include/tqdatastream.h new file mode 120000 index 0000000..7f6cc84 --- /dev/null +++ b/tqtinterface/qt4/include/tqdatastream.h @@ -0,0 +1 @@ +../src/tools/tqdatastream.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqdatatable.h b/tqtinterface/qt4/include/tqdatatable.h new file mode 120000 index 0000000..92c985c --- /dev/null +++ b/tqtinterface/qt4/include/tqdatatable.h @@ -0,0 +1 @@ +../src/sql/tqdatatable.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqdataview.h b/tqtinterface/qt4/include/tqdataview.h new file mode 120000 index 0000000..0456120 --- /dev/null +++ b/tqtinterface/qt4/include/tqdataview.h @@ -0,0 +1 @@ +../src/sql/tqdataview.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqdatetime.h b/tqtinterface/qt4/include/tqdatetime.h new file mode 120000 index 0000000..464fbfa --- /dev/null +++ b/tqtinterface/qt4/include/tqdatetime.h @@ -0,0 +1 @@ +../src/tools/tqdatetime.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqdatetimeedit.h b/tqtinterface/qt4/include/tqdatetimeedit.h new file mode 120000 index 0000000..f0fc2ff --- /dev/null +++ b/tqtinterface/qt4/include/tqdatetimeedit.h @@ -0,0 +1 @@ +../src/widgets/tqdatetimeedit.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqdatetm.h b/tqtinterface/qt4/include/tqdatetm.h new file mode 120000 index 0000000..82a7abd --- /dev/null +++ b/tqtinterface/qt4/include/tqdatetm.h @@ -0,0 +1 @@ +../src/compat/tqdatetm.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqdeepcopy.h b/tqtinterface/qt4/include/tqdeepcopy.h new file mode 120000 index 0000000..e91b4e1 --- /dev/null +++ b/tqtinterface/qt4/include/tqdeepcopy.h @@ -0,0 +1 @@ +../src/tools/tqdeepcopy.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqdesktopwidget.h b/tqtinterface/qt4/include/tqdesktopwidget.h new file mode 120000 index 0000000..76f67e8 --- /dev/null +++ b/tqtinterface/qt4/include/tqdesktopwidget.h @@ -0,0 +1 @@ +../src/kernel/tqdesktopwidget.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqdial.h b/tqtinterface/qt4/include/tqdial.h new file mode 120000 index 0000000..9f6ce84 --- /dev/null +++ b/tqtinterface/qt4/include/tqdial.h @@ -0,0 +1 @@ +../src/widgets/tqdial.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqdialog.h b/tqtinterface/qt4/include/tqdialog.h new file mode 120000 index 0000000..9e5fa53 --- /dev/null +++ b/tqtinterface/qt4/include/tqdialog.h @@ -0,0 +1 @@ +../src/dialogs/tqdialog.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqdict.h b/tqtinterface/qt4/include/tqdict.h new file mode 120000 index 0000000..77ddbbf --- /dev/null +++ b/tqtinterface/qt4/include/tqdict.h @@ -0,0 +1 @@ +../src/tools/tqdict.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqdir.h b/tqtinterface/qt4/include/tqdir.h new file mode 120000 index 0000000..e0bdafc --- /dev/null +++ b/tqtinterface/qt4/include/tqdir.h @@ -0,0 +1 @@ +../src/tools/tqdir.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqdns.h b/tqtinterface/qt4/include/tqdns.h new file mode 120000 index 0000000..c758c3d --- /dev/null +++ b/tqtinterface/qt4/include/tqdns.h @@ -0,0 +1 @@ +../src/network/tqdns.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqdockarea.h b/tqtinterface/qt4/include/tqdockarea.h new file mode 120000 index 0000000..3e54a8a --- /dev/null +++ b/tqtinterface/qt4/include/tqdockarea.h @@ -0,0 +1 @@ +../src/widgets/tqdockarea.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqdockwindow.h b/tqtinterface/qt4/include/tqdockwindow.h new file mode 120000 index 0000000..8a2a625 --- /dev/null +++ b/tqtinterface/qt4/include/tqdockwindow.h @@ -0,0 +1 @@ +../src/widgets/tqdockwindow.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqdom.h b/tqtinterface/qt4/include/tqdom.h new file mode 120000 index 0000000..85891d6 --- /dev/null +++ b/tqtinterface/qt4/include/tqdom.h @@ -0,0 +1 @@ +../src/xml/tqdom.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqdragobject.h b/tqtinterface/qt4/include/tqdragobject.h new file mode 120000 index 0000000..20126f6 --- /dev/null +++ b/tqtinterface/qt4/include/tqdragobject.h @@ -0,0 +1 @@ +../src/kernel/tqdragobject.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqdrawutil.h b/tqtinterface/qt4/include/tqdrawutil.h new file mode 120000 index 0000000..ff5eca7 --- /dev/null +++ b/tqtinterface/qt4/include/tqdrawutil.h @@ -0,0 +1 @@ +../src/kernel/tqdrawutil.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqdrawutl.h b/tqtinterface/qt4/include/tqdrawutl.h new file mode 120000 index 0000000..d8aa949 --- /dev/null +++ b/tqtinterface/qt4/include/tqdrawutl.h @@ -0,0 +1 @@ +../src/compat/tqdrawutl.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqdropsite.h b/tqtinterface/qt4/include/tqdropsite.h new file mode 120000 index 0000000..b5d9413 --- /dev/null +++ b/tqtinterface/qt4/include/tqdropsite.h @@ -0,0 +1 @@ +../src/kernel/tqdropsite.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqdstream.h b/tqtinterface/qt4/include/tqdstream.h new file mode 120000 index 0000000..6ecc8ce --- /dev/null +++ b/tqtinterface/qt4/include/tqdstream.h @@ -0,0 +1 @@ +../src/compat/tqdstream.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqeditorfactory.h b/tqtinterface/qt4/include/tqeditorfactory.h new file mode 120000 index 0000000..1bf6f5e --- /dev/null +++ b/tqtinterface/qt4/include/tqeditorfactory.h @@ -0,0 +1 @@ +../src/sql/tqeditorfactory.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqerrormessage.h b/tqtinterface/qt4/include/tqerrormessage.h new file mode 120000 index 0000000..962af12 --- /dev/null +++ b/tqtinterface/qt4/include/tqerrormessage.h @@ -0,0 +1 @@ +../src/dialogs/tqerrormessage.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqeucjpcodec.h b/tqtinterface/qt4/include/tqeucjpcodec.h new file mode 120000 index 0000000..744b5f0 --- /dev/null +++ b/tqtinterface/qt4/include/tqeucjpcodec.h @@ -0,0 +1 @@ +../src/codecs/tqeucjpcodec.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqeuckrcodec.h b/tqtinterface/qt4/include/tqeuckrcodec.h new file mode 120000 index 0000000..404e90a --- /dev/null +++ b/tqtinterface/qt4/include/tqeuckrcodec.h @@ -0,0 +1 @@ +../src/codecs/tqeuckrcodec.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqevent.h b/tqtinterface/qt4/include/tqevent.h new file mode 120000 index 0000000..9193954 --- /dev/null +++ b/tqtinterface/qt4/include/tqevent.h @@ -0,0 +1 @@ +../src/kernel/tqevent.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqeventloop.h b/tqtinterface/qt4/include/tqeventloop.h new file mode 120000 index 0000000..8696ed1 --- /dev/null +++ b/tqtinterface/qt4/include/tqeventloop.h @@ -0,0 +1 @@ +../src/kernel/tqeventloop.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqfeatures.h b/tqtinterface/qt4/include/tqfeatures.h new file mode 120000 index 0000000..2f85924 --- /dev/null +++ b/tqtinterface/qt4/include/tqfeatures.h @@ -0,0 +1 @@ +../src/tools/tqfeatures.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqfile.h b/tqtinterface/qt4/include/tqfile.h new file mode 120000 index 0000000..c729205 --- /dev/null +++ b/tqtinterface/qt4/include/tqfile.h @@ -0,0 +1 @@ +../src/tools/tqfile.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqfiledef.h b/tqtinterface/qt4/include/tqfiledef.h new file mode 120000 index 0000000..914f612 --- /dev/null +++ b/tqtinterface/qt4/include/tqfiledef.h @@ -0,0 +1 @@ +../src/compat/tqfiledef.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqfiledialog.h b/tqtinterface/qt4/include/tqfiledialog.h new file mode 120000 index 0000000..e40095b --- /dev/null +++ b/tqtinterface/qt4/include/tqfiledialog.h @@ -0,0 +1 @@ +../src/dialogs/tqfiledialog.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqfiledlg.h b/tqtinterface/qt4/include/tqfiledlg.h new file mode 120000 index 0000000..11e140c --- /dev/null +++ b/tqtinterface/qt4/include/tqfiledlg.h @@ -0,0 +1 @@ +../src/compat/tqfiledlg.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqfileinf.h b/tqtinterface/qt4/include/tqfileinf.h new file mode 120000 index 0000000..1856a13 --- /dev/null +++ b/tqtinterface/qt4/include/tqfileinf.h @@ -0,0 +1 @@ +../src/compat/tqfileinf.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqfileinfo.h b/tqtinterface/qt4/include/tqfileinfo.h new file mode 120000 index 0000000..17aaf9f --- /dev/null +++ b/tqtinterface/qt4/include/tqfileinfo.h @@ -0,0 +1 @@ +../src/tools/tqfileinfo.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqfocusdata.h b/tqtinterface/qt4/include/tqfocusdata.h new file mode 120000 index 0000000..50da1d9 --- /dev/null +++ b/tqtinterface/qt4/include/tqfocusdata.h @@ -0,0 +1 @@ +../src/kernel/tqfocusdata.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqfont.h b/tqtinterface/qt4/include/tqfont.h new file mode 120000 index 0000000..05a58eb --- /dev/null +++ b/tqtinterface/qt4/include/tqfont.h @@ -0,0 +1 @@ +../src/kernel/tqfont.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqfontdatabase.h b/tqtinterface/qt4/include/tqfontdatabase.h new file mode 120000 index 0000000..b4635d1 --- /dev/null +++ b/tqtinterface/qt4/include/tqfontdatabase.h @@ -0,0 +1 @@ +../src/kernel/tqfontdatabase.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqfontdialog.h b/tqtinterface/qt4/include/tqfontdialog.h new file mode 120000 index 0000000..2c65cdf --- /dev/null +++ b/tqtinterface/qt4/include/tqfontdialog.h @@ -0,0 +1 @@ +../src/dialogs/tqfontdialog.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqfontinf.h b/tqtinterface/qt4/include/tqfontinf.h new file mode 120000 index 0000000..9fe9332 --- /dev/null +++ b/tqtinterface/qt4/include/tqfontinf.h @@ -0,0 +1 @@ +../src/compat/tqfontinf.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqfontinfo.h b/tqtinterface/qt4/include/tqfontinfo.h new file mode 120000 index 0000000..9286866 --- /dev/null +++ b/tqtinterface/qt4/include/tqfontinfo.h @@ -0,0 +1 @@ +../src/kernel/tqfontinfo.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqfontmet.h b/tqtinterface/qt4/include/tqfontmet.h new file mode 120000 index 0000000..da41385 --- /dev/null +++ b/tqtinterface/qt4/include/tqfontmet.h @@ -0,0 +1 @@ +../src/compat/tqfontmet.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqfontmetrics.h b/tqtinterface/qt4/include/tqfontmetrics.h new file mode 120000 index 0000000..9809ac7 --- /dev/null +++ b/tqtinterface/qt4/include/tqfontmetrics.h @@ -0,0 +1 @@ +../src/kernel/tqfontmetrics.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqframe.h b/tqtinterface/qt4/include/tqframe.h new file mode 120000 index 0000000..777cb0d --- /dev/null +++ b/tqtinterface/qt4/include/tqframe.h @@ -0,0 +1 @@ +../src/widgets/tqframe.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqftp.h b/tqtinterface/qt4/include/tqftp.h new file mode 120000 index 0000000..6274e3b --- /dev/null +++ b/tqtinterface/qt4/include/tqftp.h @@ -0,0 +1 @@ +../src/network/tqftp.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqgarray.h b/tqtinterface/qt4/include/tqgarray.h new file mode 120000 index 0000000..afc6cf9 --- /dev/null +++ b/tqtinterface/qt4/include/tqgarray.h @@ -0,0 +1 @@ +../src/tools/tqgarray.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqgb18030codec.h b/tqtinterface/qt4/include/tqgb18030codec.h new file mode 120000 index 0000000..cb07bd4 --- /dev/null +++ b/tqtinterface/qt4/include/tqgb18030codec.h @@ -0,0 +1 @@ +../src/codecs/tqgb18030codec.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqgbkcodec.h b/tqtinterface/qt4/include/tqgbkcodec.h new file mode 120000 index 0000000..c958e48 --- /dev/null +++ b/tqtinterface/qt4/include/tqgbkcodec.h @@ -0,0 +1 @@ +../src/codecs/tqgbkcodec.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqgcache.h b/tqtinterface/qt4/include/tqgcache.h new file mode 120000 index 0000000..81a7560 --- /dev/null +++ b/tqtinterface/qt4/include/tqgcache.h @@ -0,0 +1 @@ +../src/tools/tqgcache.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqgdict.h b/tqtinterface/qt4/include/tqgdict.h new file mode 120000 index 0000000..082d3c8 --- /dev/null +++ b/tqtinterface/qt4/include/tqgdict.h @@ -0,0 +1 @@ +../src/tools/tqgdict.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqgeneric.h b/tqtinterface/qt4/include/tqgeneric.h new file mode 120000 index 0000000..db223b1 --- /dev/null +++ b/tqtinterface/qt4/include/tqgeneric.h @@ -0,0 +1 @@ +../src/tools/tqgeneric.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqgif.h b/tqtinterface/qt4/include/tqgif.h new file mode 120000 index 0000000..d7ce036 --- /dev/null +++ b/tqtinterface/qt4/include/tqgif.h @@ -0,0 +1 @@ +../src/kernel/tqgif.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqgl.h b/tqtinterface/qt4/include/tqgl.h new file mode 120000 index 0000000..4194a77 --- /dev/null +++ b/tqtinterface/qt4/include/tqgl.h @@ -0,0 +1 @@ +../src/opengl/tqgl.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqglcolormap.h b/tqtinterface/qt4/include/tqglcolormap.h new file mode 120000 index 0000000..c32d565 --- /dev/null +++ b/tqtinterface/qt4/include/tqglcolormap.h @@ -0,0 +1 @@ +../src/opengl/tqglcolormap.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqglist.h b/tqtinterface/qt4/include/tqglist.h new file mode 120000 index 0000000..cbc1f41 --- /dev/null +++ b/tqtinterface/qt4/include/tqglist.h @@ -0,0 +1 @@ +../src/tools/tqglist.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqglobal.h b/tqtinterface/qt4/include/tqglobal.h new file mode 120000 index 0000000..ef6895d --- /dev/null +++ b/tqtinterface/qt4/include/tqglobal.h @@ -0,0 +1 @@ +../src/tools/tqglobal.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqgplugin.h b/tqtinterface/qt4/include/tqgplugin.h new file mode 120000 index 0000000..cf689bb --- /dev/null +++ b/tqtinterface/qt4/include/tqgplugin.h @@ -0,0 +1 @@ +../src/kernel/tqgplugin.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqgrid.h b/tqtinterface/qt4/include/tqgrid.h new file mode 120000 index 0000000..ece82d6 --- /dev/null +++ b/tqtinterface/qt4/include/tqgrid.h @@ -0,0 +1 @@ +../src/widgets/tqgrid.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqgridview.h b/tqtinterface/qt4/include/tqgridview.h new file mode 120000 index 0000000..7e13f53 --- /dev/null +++ b/tqtinterface/qt4/include/tqgridview.h @@ -0,0 +1 @@ +../src/widgets/tqgridview.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqgroupbox.h b/tqtinterface/qt4/include/tqgroupbox.h new file mode 120000 index 0000000..419214c --- /dev/null +++ b/tqtinterface/qt4/include/tqgroupbox.h @@ -0,0 +1 @@ +../src/widgets/tqgroupbox.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqgrpbox.h b/tqtinterface/qt4/include/tqgrpbox.h new file mode 120000 index 0000000..4e5040c --- /dev/null +++ b/tqtinterface/qt4/include/tqgrpbox.h @@ -0,0 +1 @@ +../src/compat/tqgrpbox.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqguardedptr.h b/tqtinterface/qt4/include/tqguardedptr.h new file mode 120000 index 0000000..e7e8b6b --- /dev/null +++ b/tqtinterface/qt4/include/tqguardedptr.h @@ -0,0 +1 @@ +../src/kernel/tqguardedptr.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqgvector.h b/tqtinterface/qt4/include/tqgvector.h new file mode 120000 index 0000000..0193e2f --- /dev/null +++ b/tqtinterface/qt4/include/tqgvector.h @@ -0,0 +1 @@ +../src/tools/tqgvector.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqhbox.h b/tqtinterface/qt4/include/tqhbox.h new file mode 120000 index 0000000..b4167f8 --- /dev/null +++ b/tqtinterface/qt4/include/tqhbox.h @@ -0,0 +1 @@ +../src/widgets/tqhbox.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqhbuttongroup.h b/tqtinterface/qt4/include/tqhbuttongroup.h new file mode 120000 index 0000000..5d16161 --- /dev/null +++ b/tqtinterface/qt4/include/tqhbuttongroup.h @@ -0,0 +1 @@ +../src/widgets/tqhbuttongroup.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqheader.h b/tqtinterface/qt4/include/tqheader.h new file mode 120000 index 0000000..4fb138f --- /dev/null +++ b/tqtinterface/qt4/include/tqheader.h @@ -0,0 +1 @@ +../src/widgets/tqheader.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqhgroupbox.h b/tqtinterface/qt4/include/tqhgroupbox.h new file mode 120000 index 0000000..b63e4e8 --- /dev/null +++ b/tqtinterface/qt4/include/tqhgroupbox.h @@ -0,0 +1 @@ +../src/widgets/tqhgroupbox.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqhostaddress.h b/tqtinterface/qt4/include/tqhostaddress.h new file mode 120000 index 0000000..763e2ec --- /dev/null +++ b/tqtinterface/qt4/include/tqhostaddress.h @@ -0,0 +1 @@ +../src/network/tqhostaddress.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqhttp.h b/tqtinterface/qt4/include/tqhttp.h new file mode 120000 index 0000000..021f706 --- /dev/null +++ b/tqtinterface/qt4/include/tqhttp.h @@ -0,0 +1 @@ +../src/network/tqhttp.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqiconset.h b/tqtinterface/qt4/include/tqiconset.h new file mode 120000 index 0000000..e3034e0 --- /dev/null +++ b/tqtinterface/qt4/include/tqiconset.h @@ -0,0 +1 @@ +../src/kernel/tqiconset.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqiconview.h b/tqtinterface/qt4/include/tqiconview.h new file mode 120000 index 0000000..8be0cea --- /dev/null +++ b/tqtinterface/qt4/include/tqiconview.h @@ -0,0 +1 @@ +../src/iconview/tqiconview.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqimage.h b/tqtinterface/qt4/include/tqimage.h new file mode 120000 index 0000000..d1c5680 --- /dev/null +++ b/tqtinterface/qt4/include/tqimage.h @@ -0,0 +1 @@ +../src/kernel/tqimage.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqimageformatplugin.h b/tqtinterface/qt4/include/tqimageformatplugin.h new file mode 120000 index 0000000..be8007f --- /dev/null +++ b/tqtinterface/qt4/include/tqimageformatplugin.h @@ -0,0 +1 @@ +../src/kernel/tqimageformatplugin.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqinputdialog.h b/tqtinterface/qt4/include/tqinputdialog.h new file mode 120000 index 0000000..d9d508e --- /dev/null +++ b/tqtinterface/qt4/include/tqinputdialog.h @@ -0,0 +1 @@ +../src/dialogs/tqinputdialog.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqintcach.h b/tqtinterface/qt4/include/tqintcach.h new file mode 120000 index 0000000..8e23f24 --- /dev/null +++ b/tqtinterface/qt4/include/tqintcach.h @@ -0,0 +1 @@ +../src/compat/tqintcach.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqintcache.h b/tqtinterface/qt4/include/tqintcache.h new file mode 120000 index 0000000..0e22fec --- /dev/null +++ b/tqtinterface/qt4/include/tqintcache.h @@ -0,0 +1 @@ +../src/tools/tqintcache.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqintdict.h b/tqtinterface/qt4/include/tqintdict.h new file mode 120000 index 0000000..8024315 --- /dev/null +++ b/tqtinterface/qt4/include/tqintdict.h @@ -0,0 +1 @@ +../src/tools/tqintdict.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqinterlacestyle.h b/tqtinterface/qt4/include/tqinterlacestyle.h new file mode 120000 index 0000000..e954cd8 --- /dev/null +++ b/tqtinterface/qt4/include/tqinterlacestyle.h @@ -0,0 +1 @@ +../src/styles/tqinterlacestyle.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqiodev.h b/tqtinterface/qt4/include/tqiodev.h new file mode 120000 index 0000000..037b570 --- /dev/null +++ b/tqtinterface/qt4/include/tqiodev.h @@ -0,0 +1 @@ +../src/compat/tqiodev.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqiodevice.h b/tqtinterface/qt4/include/tqiodevice.h new file mode 120000 index 0000000..95018d2 --- /dev/null +++ b/tqtinterface/qt4/include/tqiodevice.h @@ -0,0 +1 @@ +../src/tools/tqiodevice.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqjiscodec.h b/tqtinterface/qt4/include/tqjiscodec.h new file mode 120000 index 0000000..5b5b0bb --- /dev/null +++ b/tqtinterface/qt4/include/tqjiscodec.h @@ -0,0 +1 @@ +../src/codecs/tqjiscodec.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqjpegio.h b/tqtinterface/qt4/include/tqjpegio.h new file mode 120000 index 0000000..e7f65a2 --- /dev/null +++ b/tqtinterface/qt4/include/tqjpegio.h @@ -0,0 +1 @@ +../src/kernel/tqjpegio.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqjpunicode.h b/tqtinterface/qt4/include/tqjpunicode.h new file mode 120000 index 0000000..5a0b262 --- /dev/null +++ b/tqtinterface/qt4/include/tqjpunicode.h @@ -0,0 +1 @@ +../src/codecs/tqjpunicode.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqkeycode.h b/tqtinterface/qt4/include/tqkeycode.h new file mode 120000 index 0000000..6edf203 --- /dev/null +++ b/tqtinterface/qt4/include/tqkeycode.h @@ -0,0 +1 @@ +../src/kernel/tqkeycode.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqkeysequence.h b/tqtinterface/qt4/include/tqkeysequence.h new file mode 120000 index 0000000..4d07f18 --- /dev/null +++ b/tqtinterface/qt4/include/tqkeysequence.h @@ -0,0 +1 @@ +../src/kernel/tqkeysequence.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqlabel.h b/tqtinterface/qt4/include/tqlabel.h new file mode 120000 index 0000000..cb18976 --- /dev/null +++ b/tqtinterface/qt4/include/tqlabel.h @@ -0,0 +1 @@ +../src/widgets/tqlabel.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqlayout.h b/tqtinterface/qt4/include/tqlayout.h new file mode 120000 index 0000000..f409586 --- /dev/null +++ b/tqtinterface/qt4/include/tqlayout.h @@ -0,0 +1 @@ +../src/kernel/tqlayout.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqlcdnum.h b/tqtinterface/qt4/include/tqlcdnum.h new file mode 120000 index 0000000..f236076 --- /dev/null +++ b/tqtinterface/qt4/include/tqlcdnum.h @@ -0,0 +1 @@ +../src/compat/tqlcdnum.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqlcdnumber.h b/tqtinterface/qt4/include/tqlcdnumber.h new file mode 120000 index 0000000..6fde907 --- /dev/null +++ b/tqtinterface/qt4/include/tqlcdnumber.h @@ -0,0 +1 @@ +../src/widgets/tqlcdnumber.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqlibrary.h b/tqtinterface/qt4/include/tqlibrary.h new file mode 120000 index 0000000..af31284 --- /dev/null +++ b/tqtinterface/qt4/include/tqlibrary.h @@ -0,0 +1 @@ +../src/tools/tqlibrary.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqlined.h b/tqtinterface/qt4/include/tqlined.h new file mode 120000 index 0000000..0d7bf7e --- /dev/null +++ b/tqtinterface/qt4/include/tqlined.h @@ -0,0 +1 @@ +../src/compat/tqlined.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqlineedit.h b/tqtinterface/qt4/include/tqlineedit.h new file mode 120000 index 0000000..54694e2 --- /dev/null +++ b/tqtinterface/qt4/include/tqlineedit.h @@ -0,0 +1 @@ +../src/widgets/tqlineedit.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqlist.h b/tqtinterface/qt4/include/tqlist.h new file mode 120000 index 0000000..b3ba230 --- /dev/null +++ b/tqtinterface/qt4/include/tqlist.h @@ -0,0 +1 @@ +../src/compat/tqlist.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqlistbox.h b/tqtinterface/qt4/include/tqlistbox.h new file mode 120000 index 0000000..615fcfb --- /dev/null +++ b/tqtinterface/qt4/include/tqlistbox.h @@ -0,0 +1 @@ +../src/widgets/tqlistbox.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqlistview.h b/tqtinterface/qt4/include/tqlistview.h new file mode 120000 index 0000000..2f61716 --- /dev/null +++ b/tqtinterface/qt4/include/tqlistview.h @@ -0,0 +1 @@ +../src/widgets/tqlistview.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqlocale.h b/tqtinterface/qt4/include/tqlocale.h new file mode 120000 index 0000000..47a05b6 --- /dev/null +++ b/tqtinterface/qt4/include/tqlocale.h @@ -0,0 +1 @@ +../src/tools/tqlocale.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqlocalfs.h b/tqtinterface/qt4/include/tqlocalfs.h new file mode 120000 index 0000000..5f0ec03 --- /dev/null +++ b/tqtinterface/qt4/include/tqlocalfs.h @@ -0,0 +1 @@ +../src/kernel/tqlocalfs.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqmainwindow.h b/tqtinterface/qt4/include/tqmainwindow.h new file mode 120000 index 0000000..44bfd87 --- /dev/null +++ b/tqtinterface/qt4/include/tqmainwindow.h @@ -0,0 +1 @@ +../src/widgets/tqmainwindow.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqmap.h b/tqtinterface/qt4/include/tqmap.h new file mode 120000 index 0000000..6669fbf --- /dev/null +++ b/tqtinterface/qt4/include/tqmap.h @@ -0,0 +1 @@ +../src/tools/tqmap.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqmemarray.h b/tqtinterface/qt4/include/tqmemarray.h new file mode 120000 index 0000000..ba84ae2 --- /dev/null +++ b/tqtinterface/qt4/include/tqmemarray.h @@ -0,0 +1 @@ +../src/tools/tqmemarray.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqmenubar.h b/tqtinterface/qt4/include/tqmenubar.h new file mode 120000 index 0000000..80545c7 --- /dev/null +++ b/tqtinterface/qt4/include/tqmenubar.h @@ -0,0 +1 @@ +../src/widgets/tqmenubar.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqmenudata.h b/tqtinterface/qt4/include/tqmenudata.h new file mode 120000 index 0000000..92db1c0 --- /dev/null +++ b/tqtinterface/qt4/include/tqmenudata.h @@ -0,0 +1 @@ +../src/widgets/tqmenudata.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqmenudta.h b/tqtinterface/qt4/include/tqmenudta.h new file mode 120000 index 0000000..d6c18ea --- /dev/null +++ b/tqtinterface/qt4/include/tqmenudta.h @@ -0,0 +1 @@ +../src/compat/tqmenudta.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqmessagebox.h b/tqtinterface/qt4/include/tqmessagebox.h new file mode 120000 index 0000000..40f8a38 --- /dev/null +++ b/tqtinterface/qt4/include/tqmessagebox.h @@ -0,0 +1 @@ +../src/dialogs/tqmessagebox.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqmetaobj.h b/tqtinterface/qt4/include/tqmetaobj.h new file mode 120000 index 0000000..3fbe15f --- /dev/null +++ b/tqtinterface/qt4/include/tqmetaobj.h @@ -0,0 +1 @@ +../src/compat/tqmetaobj.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqmetaobject.h b/tqtinterface/qt4/include/tqmetaobject.h new file mode 120000 index 0000000..4fc5b0c --- /dev/null +++ b/tqtinterface/qt4/include/tqmetaobject.h @@ -0,0 +1 @@ +../src/kernel/tqmetaobject.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqmime.h b/tqtinterface/qt4/include/tqmime.h new file mode 120000 index 0000000..1b0ad1c --- /dev/null +++ b/tqtinterface/qt4/include/tqmime.h @@ -0,0 +1 @@ +../src/kernel/tqmime.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqmlined.h b/tqtinterface/qt4/include/tqmlined.h new file mode 120000 index 0000000..a574c0d --- /dev/null +++ b/tqtinterface/qt4/include/tqmlined.h @@ -0,0 +1 @@ +../src/compat/tqmlined.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqmngio.h b/tqtinterface/qt4/include/tqmngio.h new file mode 120000 index 0000000..0820dba --- /dev/null +++ b/tqtinterface/qt4/include/tqmngio.h @@ -0,0 +1 @@ +../src/kernel/tqmngio.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqmotifplusstyle.h b/tqtinterface/qt4/include/tqmotifplusstyle.h new file mode 120000 index 0000000..6209223 --- /dev/null +++ b/tqtinterface/qt4/include/tqmotifplusstyle.h @@ -0,0 +1 @@ +../src/styles/tqmotifplusstyle.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqmotifstyle.h b/tqtinterface/qt4/include/tqmotifstyle.h new file mode 120000 index 0000000..65784c4 --- /dev/null +++ b/tqtinterface/qt4/include/tqmotifstyle.h @@ -0,0 +1 @@ +../src/styles/tqmotifstyle.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqmovie.h b/tqtinterface/qt4/include/tqmovie.h new file mode 120000 index 0000000..d8a962e --- /dev/null +++ b/tqtinterface/qt4/include/tqmovie.h @@ -0,0 +1 @@ +../src/kernel/tqmovie.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqmsgbox.h b/tqtinterface/qt4/include/tqmsgbox.h new file mode 120000 index 0000000..4458cdc --- /dev/null +++ b/tqtinterface/qt4/include/tqmsgbox.h @@ -0,0 +1 @@ +../src/compat/tqmsgbox.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqmultilinedit.h b/tqtinterface/qt4/include/tqmultilinedit.h new file mode 120000 index 0000000..b7b91a0 --- /dev/null +++ b/tqtinterface/qt4/include/tqmultilinedit.h @@ -0,0 +1 @@ +../src/compat/tqmultilinedit.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqmultilineedit.h b/tqtinterface/qt4/include/tqmultilineedit.h new file mode 120000 index 0000000..121e33a --- /dev/null +++ b/tqtinterface/qt4/include/tqmultilineedit.h @@ -0,0 +1 @@ +../src/widgets/tqmultilineedit.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqmutex.h b/tqtinterface/qt4/include/tqmutex.h new file mode 120000 index 0000000..c550c01 --- /dev/null +++ b/tqtinterface/qt4/include/tqmutex.h @@ -0,0 +1 @@ +../src/tools/tqmutex.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqnamespace.h b/tqtinterface/qt4/include/tqnamespace.h new file mode 120000 index 0000000..447cfed --- /dev/null +++ b/tqtinterface/qt4/include/tqnamespace.h @@ -0,0 +1 @@ +../src/kernel/tqnamespace.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqnetwork.h b/tqtinterface/qt4/include/tqnetwork.h new file mode 120000 index 0000000..0b98392 --- /dev/null +++ b/tqtinterface/qt4/include/tqnetwork.h @@ -0,0 +1 @@ +../src/network/tqnetwork.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqnetworkprotocol.h b/tqtinterface/qt4/include/tqnetworkprotocol.h new file mode 120000 index 0000000..d757f9f --- /dev/null +++ b/tqtinterface/qt4/include/tqnetworkprotocol.h @@ -0,0 +1 @@ +../src/kernel/tqnetworkprotocol.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqnp.h b/tqtinterface/qt4/include/tqnp.h new file mode 120000 index 0000000..bf3f2dc --- /dev/null +++ b/tqtinterface/qt4/include/tqnp.h @@ -0,0 +1 @@ +../extensions/nsplugin/src/tqnp.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqobjcoll.h b/tqtinterface/qt4/include/tqobjcoll.h new file mode 120000 index 0000000..8eda254 --- /dev/null +++ b/tqtinterface/qt4/include/tqobjcoll.h @@ -0,0 +1 @@ +../src/compat/tqobjcoll.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqobjdefs.h b/tqtinterface/qt4/include/tqobjdefs.h new file mode 120000 index 0000000..5248a33 --- /dev/null +++ b/tqtinterface/qt4/include/tqobjdefs.h @@ -0,0 +1 @@ +../src/compat/tqobjdefs.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqobject.h b/tqtinterface/qt4/include/tqobject.h new file mode 120000 index 0000000..a056d81 --- /dev/null +++ b/tqtinterface/qt4/include/tqobject.h @@ -0,0 +1 @@ +../src/kernel/tqobject.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqobjectcleanuphandler.h b/tqtinterface/qt4/include/tqobjectcleanuphandler.h new file mode 120000 index 0000000..4d11d97 --- /dev/null +++ b/tqtinterface/qt4/include/tqobjectcleanuphandler.h @@ -0,0 +1 @@ +../src/kernel/tqobjectcleanuphandler.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqobjectdefs.h b/tqtinterface/qt4/include/tqobjectdefs.h new file mode 120000 index 0000000..dffbccf --- /dev/null +++ b/tqtinterface/qt4/include/tqobjectdefs.h @@ -0,0 +1 @@ +../src/kernel/tqobjectdefs.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqobjectdict.h b/tqtinterface/qt4/include/tqobjectdict.h new file mode 120000 index 0000000..6a5b911 --- /dev/null +++ b/tqtinterface/qt4/include/tqobjectdict.h @@ -0,0 +1 @@ +../src/kernel/tqobjectdict.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqobjectlist.h b/tqtinterface/qt4/include/tqobjectlist.h new file mode 120000 index 0000000..60b88d5 --- /dev/null +++ b/tqtinterface/qt4/include/tqobjectlist.h @@ -0,0 +1 @@ +../src/kernel/tqobjectlist.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqpaintd.h b/tqtinterface/qt4/include/tqpaintd.h new file mode 120000 index 0000000..323cc89 --- /dev/null +++ b/tqtinterface/qt4/include/tqpaintd.h @@ -0,0 +1 @@ +../src/compat/tqpaintd.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqpaintdc.h b/tqtinterface/qt4/include/tqpaintdc.h new file mode 120000 index 0000000..059d18a --- /dev/null +++ b/tqtinterface/qt4/include/tqpaintdc.h @@ -0,0 +1 @@ +../src/compat/tqpaintdc.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqpaintdevice.h b/tqtinterface/qt4/include/tqpaintdevice.h new file mode 120000 index 0000000..2621919 --- /dev/null +++ b/tqtinterface/qt4/include/tqpaintdevice.h @@ -0,0 +1 @@ +../src/kernel/tqpaintdevice.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqpaintdevicedefs.h b/tqtinterface/qt4/include/tqpaintdevicedefs.h new file mode 120000 index 0000000..13b2ccb --- /dev/null +++ b/tqtinterface/qt4/include/tqpaintdevicedefs.h @@ -0,0 +1 @@ +../src/kernel/tqpaintdevicedefs.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqpaintdevicemetrics.h b/tqtinterface/qt4/include/tqpaintdevicemetrics.h new file mode 120000 index 0000000..8b7377c --- /dev/null +++ b/tqtinterface/qt4/include/tqpaintdevicemetrics.h @@ -0,0 +1 @@ +../src/kernel/tqpaintdevicemetrics.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqpainter.h b/tqtinterface/qt4/include/tqpainter.h new file mode 120000 index 0000000..a430e16 --- /dev/null +++ b/tqtinterface/qt4/include/tqpainter.h @@ -0,0 +1 @@ +../src/kernel/tqpainter.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqpair.h b/tqtinterface/qt4/include/tqpair.h new file mode 120000 index 0000000..9fb13e8 --- /dev/null +++ b/tqtinterface/qt4/include/tqpair.h @@ -0,0 +1 @@ +../src/tools/tqpair.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqpalette.h b/tqtinterface/qt4/include/tqpalette.h new file mode 120000 index 0000000..e8f06d5 --- /dev/null +++ b/tqtinterface/qt4/include/tqpalette.h @@ -0,0 +1 @@ +../src/kernel/tqpalette.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqpdevmet.h b/tqtinterface/qt4/include/tqpdevmet.h new file mode 120000 index 0000000..46cae9e --- /dev/null +++ b/tqtinterface/qt4/include/tqpdevmet.h @@ -0,0 +1 @@ +../src/compat/tqpdevmet.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqpen.h b/tqtinterface/qt4/include/tqpen.h new file mode 120000 index 0000000..a7cef56 --- /dev/null +++ b/tqtinterface/qt4/include/tqpen.h @@ -0,0 +1 @@ +../src/kernel/tqpen.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqpicture.h b/tqtinterface/qt4/include/tqpicture.h new file mode 120000 index 0000000..f2dda1e --- /dev/null +++ b/tqtinterface/qt4/include/tqpicture.h @@ -0,0 +1 @@ +../src/kernel/tqpicture.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqpixmap.h b/tqtinterface/qt4/include/tqpixmap.h new file mode 120000 index 0000000..6e29fb4 --- /dev/null +++ b/tqtinterface/qt4/include/tqpixmap.h @@ -0,0 +1 @@ +../src/kernel/tqpixmap.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqpixmapcache.h b/tqtinterface/qt4/include/tqpixmapcache.h new file mode 120000 index 0000000..1cb97a7 --- /dev/null +++ b/tqtinterface/qt4/include/tqpixmapcache.h @@ -0,0 +1 @@ +../src/kernel/tqpixmapcache.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqplatinumstyle.h b/tqtinterface/qt4/include/tqplatinumstyle.h new file mode 120000 index 0000000..60b7a99 --- /dev/null +++ b/tqtinterface/qt4/include/tqplatinumstyle.h @@ -0,0 +1 @@ +../src/styles/tqplatinumstyle.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqpmcache.h b/tqtinterface/qt4/include/tqpmcache.h new file mode 120000 index 0000000..487a80e --- /dev/null +++ b/tqtinterface/qt4/include/tqpmcache.h @@ -0,0 +1 @@ +../src/compat/tqpmcache.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqpngio.h b/tqtinterface/qt4/include/tqpngio.h new file mode 120000 index 0000000..0d44108 --- /dev/null +++ b/tqtinterface/qt4/include/tqpngio.h @@ -0,0 +1 @@ +../src/kernel/tqpngio.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqpntarry.h b/tqtinterface/qt4/include/tqpntarry.h new file mode 120000 index 0000000..a5c57c4 --- /dev/null +++ b/tqtinterface/qt4/include/tqpntarry.h @@ -0,0 +1 @@ +../src/compat/tqpntarry.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqpoint.h b/tqtinterface/qt4/include/tqpoint.h new file mode 120000 index 0000000..630842a --- /dev/null +++ b/tqtinterface/qt4/include/tqpoint.h @@ -0,0 +1 @@ +../src/kernel/tqpoint.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqpointarray.h b/tqtinterface/qt4/include/tqpointarray.h new file mode 120000 index 0000000..b1fad72 --- /dev/null +++ b/tqtinterface/qt4/include/tqpointarray.h @@ -0,0 +1 @@ +../src/kernel/tqpointarray.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqpolygonscanner.h b/tqtinterface/qt4/include/tqpolygonscanner.h new file mode 120000 index 0000000..1db8061 --- /dev/null +++ b/tqtinterface/qt4/include/tqpolygonscanner.h @@ -0,0 +1 @@ +../src/kernel/tqpolygonscanner.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqpopmenu.h b/tqtinterface/qt4/include/tqpopmenu.h new file mode 120000 index 0000000..25ed5d3 --- /dev/null +++ b/tqtinterface/qt4/include/tqpopmenu.h @@ -0,0 +1 @@ +../src/compat/tqpopmenu.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqpopupmenu.h b/tqtinterface/qt4/include/tqpopupmenu.h new file mode 120000 index 0000000..16d481f --- /dev/null +++ b/tqtinterface/qt4/include/tqpopupmenu.h @@ -0,0 +1 @@ +../src/widgets/tqpopupmenu.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqprintdialog.h b/tqtinterface/qt4/include/tqprintdialog.h new file mode 120000 index 0000000..f808b73 --- /dev/null +++ b/tqtinterface/qt4/include/tqprintdialog.h @@ -0,0 +1 @@ +../src/dialogs/tqprintdialog.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqprinter.h b/tqtinterface/qt4/include/tqprinter.h new file mode 120000 index 0000000..d09521d --- /dev/null +++ b/tqtinterface/qt4/include/tqprinter.h @@ -0,0 +1 @@ +../src/kernel/tqprinter.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqprndlg.h b/tqtinterface/qt4/include/tqprndlg.h new file mode 120000 index 0000000..0460115 --- /dev/null +++ b/tqtinterface/qt4/include/tqprndlg.h @@ -0,0 +1 @@ +../src/compat/tqprndlg.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqprocess.h b/tqtinterface/qt4/include/tqprocess.h new file mode 120000 index 0000000..47a6990 --- /dev/null +++ b/tqtinterface/qt4/include/tqprocess.h @@ -0,0 +1 @@ +../src/kernel/tqprocess.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqprogbar.h b/tqtinterface/qt4/include/tqprogbar.h new file mode 120000 index 0000000..9568445 --- /dev/null +++ b/tqtinterface/qt4/include/tqprogbar.h @@ -0,0 +1 @@ +../src/compat/tqprogbar.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqprogdlg.h b/tqtinterface/qt4/include/tqprogdlg.h new file mode 120000 index 0000000..aa52ffe --- /dev/null +++ b/tqtinterface/qt4/include/tqprogdlg.h @@ -0,0 +1 @@ +../src/compat/tqprogdlg.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqprogressbar.h b/tqtinterface/qt4/include/tqprogressbar.h new file mode 120000 index 0000000..1735303 --- /dev/null +++ b/tqtinterface/qt4/include/tqprogressbar.h @@ -0,0 +1 @@ +../src/widgets/tqprogressbar.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqprogressdialog.h b/tqtinterface/qt4/include/tqprogressdialog.h new file mode 120000 index 0000000..5307e0f --- /dev/null +++ b/tqtinterface/qt4/include/tqprogressdialog.h @@ -0,0 +1 @@ +../src/dialogs/tqprogressdialog.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqpsprn.h b/tqtinterface/qt4/include/tqpsprn.h new file mode 120000 index 0000000..0bead6b --- /dev/null +++ b/tqtinterface/qt4/include/tqpsprn.h @@ -0,0 +1 @@ +../src/compat/tqpsprn.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqptrcollection.h b/tqtinterface/qt4/include/tqptrcollection.h new file mode 120000 index 0000000..5d7529f --- /dev/null +++ b/tqtinterface/qt4/include/tqptrcollection.h @@ -0,0 +1 @@ +../src/tools/tqptrcollection.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqptrdict.h b/tqtinterface/qt4/include/tqptrdict.h new file mode 120000 index 0000000..eed77ac --- /dev/null +++ b/tqtinterface/qt4/include/tqptrdict.h @@ -0,0 +1 @@ +../src/tools/tqptrdict.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqptrlist.h b/tqtinterface/qt4/include/tqptrlist.h new file mode 120000 index 0000000..46f5f76 --- /dev/null +++ b/tqtinterface/qt4/include/tqptrlist.h @@ -0,0 +1 @@ +../src/tools/tqptrlist.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqptrqueue.h b/tqtinterface/qt4/include/tqptrqueue.h new file mode 120000 index 0000000..2f589c5 --- /dev/null +++ b/tqtinterface/qt4/include/tqptrqueue.h @@ -0,0 +1 @@ +../src/tools/tqptrqueue.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqptrstack.h b/tqtinterface/qt4/include/tqptrstack.h new file mode 120000 index 0000000..74d599b --- /dev/null +++ b/tqtinterface/qt4/include/tqptrstack.h @@ -0,0 +1 @@ +../src/tools/tqptrstack.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqptrvector.h b/tqtinterface/qt4/include/tqptrvector.h new file mode 120000 index 0000000..062547f --- /dev/null +++ b/tqtinterface/qt4/include/tqptrvector.h @@ -0,0 +1 @@ +../src/tools/tqptrvector.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqpushbt.h b/tqtinterface/qt4/include/tqpushbt.h new file mode 120000 index 0000000..a6216e8 --- /dev/null +++ b/tqtinterface/qt4/include/tqpushbt.h @@ -0,0 +1 @@ +../src/compat/tqpushbt.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqpushbutton.h b/tqtinterface/qt4/include/tqpushbutton.h new file mode 120000 index 0000000..f6c6c20 --- /dev/null +++ b/tqtinterface/qt4/include/tqpushbutton.h @@ -0,0 +1 @@ +../src/widgets/tqpushbutton.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqqueue.h b/tqtinterface/qt4/include/tqqueue.h new file mode 120000 index 0000000..8c94a61 --- /dev/null +++ b/tqtinterface/qt4/include/tqqueue.h @@ -0,0 +1 @@ +../src/compat/tqqueue.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqradiobt.h b/tqtinterface/qt4/include/tqradiobt.h new file mode 120000 index 0000000..297bb26 --- /dev/null +++ b/tqtinterface/qt4/include/tqradiobt.h @@ -0,0 +1 @@ +../src/compat/tqradiobt.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqradiobutton.h b/tqtinterface/qt4/include/tqradiobutton.h new file mode 120000 index 0000000..405b53f --- /dev/null +++ b/tqtinterface/qt4/include/tqradiobutton.h @@ -0,0 +1 @@ +../src/widgets/tqradiobutton.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqrangecontrol.h b/tqtinterface/qt4/include/tqrangecontrol.h new file mode 120000 index 0000000..fb334df --- /dev/null +++ b/tqtinterface/qt4/include/tqrangecontrol.h @@ -0,0 +1 @@ +../src/widgets/tqrangecontrol.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqrangect.h b/tqtinterface/qt4/include/tqrangect.h new file mode 120000 index 0000000..14572e0 --- /dev/null +++ b/tqtinterface/qt4/include/tqrangect.h @@ -0,0 +1 @@ +../src/compat/tqrangect.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqrect.h b/tqtinterface/qt4/include/tqrect.h new file mode 120000 index 0000000..2e79aa0 --- /dev/null +++ b/tqtinterface/qt4/include/tqrect.h @@ -0,0 +1 @@ +../src/kernel/tqrect.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqregexp.h b/tqtinterface/qt4/include/tqregexp.h new file mode 120000 index 0000000..a2714e8 --- /dev/null +++ b/tqtinterface/qt4/include/tqregexp.h @@ -0,0 +1 @@ +../src/tools/tqregexp.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqregion.h b/tqtinterface/qt4/include/tqregion.h new file mode 120000 index 0000000..57c639b --- /dev/null +++ b/tqtinterface/qt4/include/tqregion.h @@ -0,0 +1 @@ +../src/kernel/tqregion.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqrtlcodec.h b/tqtinterface/qt4/include/tqrtlcodec.h new file mode 120000 index 0000000..0f12eb6 --- /dev/null +++ b/tqtinterface/qt4/include/tqrtlcodec.h @@ -0,0 +1 @@ +../src/codecs/tqrtlcodec.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqscrbar.h b/tqtinterface/qt4/include/tqscrbar.h new file mode 120000 index 0000000..b33358b --- /dev/null +++ b/tqtinterface/qt4/include/tqscrbar.h @@ -0,0 +1 @@ +../src/compat/tqscrbar.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqscrollbar.h b/tqtinterface/qt4/include/tqscrollbar.h new file mode 120000 index 0000000..e076471 --- /dev/null +++ b/tqtinterface/qt4/include/tqscrollbar.h @@ -0,0 +1 @@ +../src/widgets/tqscrollbar.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqscrollview.h b/tqtinterface/qt4/include/tqscrollview.h new file mode 120000 index 0000000..1807b4c --- /dev/null +++ b/tqtinterface/qt4/include/tqscrollview.h @@ -0,0 +1 @@ +../src/widgets/tqscrollview.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqsemaphore.h b/tqtinterface/qt4/include/tqsemaphore.h new file mode 120000 index 0000000..f8c3957 --- /dev/null +++ b/tqtinterface/qt4/include/tqsemaphore.h @@ -0,0 +1 @@ +../src/tools/tqsemaphore.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqsemimodal.h b/tqtinterface/qt4/include/tqsemimodal.h new file mode 120000 index 0000000..3a1ffb2 --- /dev/null +++ b/tqtinterface/qt4/include/tqsemimodal.h @@ -0,0 +1 @@ +../src/dialogs/tqsemimodal.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqserversocket.h b/tqtinterface/qt4/include/tqserversocket.h new file mode 120000 index 0000000..939a86e --- /dev/null +++ b/tqtinterface/qt4/include/tqserversocket.h @@ -0,0 +1 @@ +../src/network/tqserversocket.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqsession.h b/tqtinterface/qt4/include/tqsession.h new file mode 120000 index 0000000..6735340 --- /dev/null +++ b/tqtinterface/qt4/include/tqsession.h @@ -0,0 +1 @@ +../src/kernel/tqsession.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqsessionmanager.h b/tqtinterface/qt4/include/tqsessionmanager.h new file mode 120000 index 0000000..048f86d --- /dev/null +++ b/tqtinterface/qt4/include/tqsessionmanager.h @@ -0,0 +1 @@ +../src/kernel/tqsessionmanager.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqsettings.h b/tqtinterface/qt4/include/tqsettings.h new file mode 120000 index 0000000..7699677 --- /dev/null +++ b/tqtinterface/qt4/include/tqsettings.h @@ -0,0 +1 @@ +../src/tools/tqsettings.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqsgistyle.h b/tqtinterface/qt4/include/tqsgistyle.h new file mode 120000 index 0000000..769d10e --- /dev/null +++ b/tqtinterface/qt4/include/tqsgistyle.h @@ -0,0 +1 @@ +../src/styles/tqsgistyle.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqshared.h b/tqtinterface/qt4/include/tqshared.h new file mode 120000 index 0000000..dc6623d --- /dev/null +++ b/tqtinterface/qt4/include/tqshared.h @@ -0,0 +1 @@ +../src/tools/tqshared.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqsignal.h b/tqtinterface/qt4/include/tqsignal.h new file mode 120000 index 0000000..63bf982 --- /dev/null +++ b/tqtinterface/qt4/include/tqsignal.h @@ -0,0 +1 @@ +../src/kernel/tqsignal.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqsignalmapper.h b/tqtinterface/qt4/include/tqsignalmapper.h new file mode 120000 index 0000000..f230660 --- /dev/null +++ b/tqtinterface/qt4/include/tqsignalmapper.h @@ -0,0 +1 @@ +../src/kernel/tqsignalmapper.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqsignalslotimp.h b/tqtinterface/qt4/include/tqsignalslotimp.h new file mode 120000 index 0000000..5d59674 --- /dev/null +++ b/tqtinterface/qt4/include/tqsignalslotimp.h @@ -0,0 +1 @@ +../src/kernel/tqsignalslotimp.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqsimplerichtext.h b/tqtinterface/qt4/include/tqsimplerichtext.h new file mode 120000 index 0000000..759d75e --- /dev/null +++ b/tqtinterface/qt4/include/tqsimplerichtext.h @@ -0,0 +1 @@ +../src/kernel/tqsimplerichtext.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqsize.h b/tqtinterface/qt4/include/tqsize.h new file mode 120000 index 0000000..84507ca --- /dev/null +++ b/tqtinterface/qt4/include/tqsize.h @@ -0,0 +1 @@ +../src/kernel/tqsize.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqsizegrip.h b/tqtinterface/qt4/include/tqsizegrip.h new file mode 120000 index 0000000..43a93b8 --- /dev/null +++ b/tqtinterface/qt4/include/tqsizegrip.h @@ -0,0 +1 @@ +../src/kernel/tqsizegrip.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqsizepolicy.h b/tqtinterface/qt4/include/tqsizepolicy.h new file mode 120000 index 0000000..f73ea1f --- /dev/null +++ b/tqtinterface/qt4/include/tqsizepolicy.h @@ -0,0 +1 @@ +../src/kernel/tqsizepolicy.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqsjiscodec.h b/tqtinterface/qt4/include/tqsjiscodec.h new file mode 120000 index 0000000..1fdb188 --- /dev/null +++ b/tqtinterface/qt4/include/tqsjiscodec.h @@ -0,0 +1 @@ +../src/codecs/tqsjiscodec.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqslider.h b/tqtinterface/qt4/include/tqslider.h new file mode 120000 index 0000000..b9ca51d --- /dev/null +++ b/tqtinterface/qt4/include/tqslider.h @@ -0,0 +1 @@ +../src/widgets/tqslider.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqsocket.h b/tqtinterface/qt4/include/tqsocket.h new file mode 120000 index 0000000..361c6c5 --- /dev/null +++ b/tqtinterface/qt4/include/tqsocket.h @@ -0,0 +1 @@ +../src/network/tqsocket.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqsocketdevice.h b/tqtinterface/qt4/include/tqsocketdevice.h new file mode 120000 index 0000000..c280bd2 --- /dev/null +++ b/tqtinterface/qt4/include/tqsocketdevice.h @@ -0,0 +1 @@ +../src/network/tqsocketdevice.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqsocketnotifier.h b/tqtinterface/qt4/include/tqsocketnotifier.h new file mode 120000 index 0000000..478719a --- /dev/null +++ b/tqtinterface/qt4/include/tqsocketnotifier.h @@ -0,0 +1 @@ +../src/kernel/tqsocketnotifier.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqsocknot.h b/tqtinterface/qt4/include/tqsocknot.h new file mode 120000 index 0000000..988aafd --- /dev/null +++ b/tqtinterface/qt4/include/tqsocknot.h @@ -0,0 +1 @@ +../src/compat/tqsocknot.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqsortedlist.h b/tqtinterface/qt4/include/tqsortedlist.h new file mode 120000 index 0000000..4459a9d --- /dev/null +++ b/tqtinterface/qt4/include/tqsortedlist.h @@ -0,0 +1 @@ +../src/tools/tqsortedlist.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqsound.h b/tqtinterface/qt4/include/tqsound.h new file mode 120000 index 0000000..5000a8d --- /dev/null +++ b/tqtinterface/qt4/include/tqsound.h @@ -0,0 +1 @@ +../src/kernel/tqsound.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqspinbox.h b/tqtinterface/qt4/include/tqspinbox.h new file mode 120000 index 0000000..97dd515 --- /dev/null +++ b/tqtinterface/qt4/include/tqspinbox.h @@ -0,0 +1 @@ +../src/widgets/tqspinbox.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqsplashscreen.h b/tqtinterface/qt4/include/tqsplashscreen.h new file mode 120000 index 0000000..db7b4f6 --- /dev/null +++ b/tqtinterface/qt4/include/tqsplashscreen.h @@ -0,0 +1 @@ +../src/widgets/tqsplashscreen.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqsplitter.h b/tqtinterface/qt4/include/tqsplitter.h new file mode 120000 index 0000000..4b9b276 --- /dev/null +++ b/tqtinterface/qt4/include/tqsplitter.h @@ -0,0 +1 @@ +../src/widgets/tqsplitter.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqsql.h b/tqtinterface/qt4/include/tqsql.h new file mode 120000 index 0000000..aad06ef --- /dev/null +++ b/tqtinterface/qt4/include/tqsql.h @@ -0,0 +1 @@ +../src/sql/tqsql.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqsqlcursor.h b/tqtinterface/qt4/include/tqsqlcursor.h new file mode 120000 index 0000000..8144d48 --- /dev/null +++ b/tqtinterface/qt4/include/tqsqlcursor.h @@ -0,0 +1 @@ +../src/sql/tqsqlcursor.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqsqldatabase.h b/tqtinterface/qt4/include/tqsqldatabase.h new file mode 120000 index 0000000..4abff10 --- /dev/null +++ b/tqtinterface/qt4/include/tqsqldatabase.h @@ -0,0 +1 @@ +../src/sql/tqsqldatabase.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqsqldriver.h b/tqtinterface/qt4/include/tqsqldriver.h new file mode 120000 index 0000000..8c3f2c2 --- /dev/null +++ b/tqtinterface/qt4/include/tqsqldriver.h @@ -0,0 +1 @@ +../src/sql/tqsqldriver.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqsqldriverplugin.h b/tqtinterface/qt4/include/tqsqldriverplugin.h new file mode 120000 index 0000000..a5ff574 --- /dev/null +++ b/tqtinterface/qt4/include/tqsqldriverplugin.h @@ -0,0 +1 @@ +../src/sql/tqsqldriverplugin.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqsqleditorfactory.h b/tqtinterface/qt4/include/tqsqleditorfactory.h new file mode 120000 index 0000000..04b48c5 --- /dev/null +++ b/tqtinterface/qt4/include/tqsqleditorfactory.h @@ -0,0 +1 @@ +../src/sql/tqsqleditorfactory.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqsqlerror.h b/tqtinterface/qt4/include/tqsqlerror.h new file mode 120000 index 0000000..1c94963 --- /dev/null +++ b/tqtinterface/qt4/include/tqsqlerror.h @@ -0,0 +1 @@ +../src/sql/tqsqlerror.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqsqlfield.h b/tqtinterface/qt4/include/tqsqlfield.h new file mode 120000 index 0000000..bc66716 --- /dev/null +++ b/tqtinterface/qt4/include/tqsqlfield.h @@ -0,0 +1 @@ +../src/sql/tqsqlfield.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqsqlform.h b/tqtinterface/qt4/include/tqsqlform.h new file mode 120000 index 0000000..0c79230 --- /dev/null +++ b/tqtinterface/qt4/include/tqsqlform.h @@ -0,0 +1 @@ +../src/sql/tqsqlform.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqsqlindex.h b/tqtinterface/qt4/include/tqsqlindex.h new file mode 120000 index 0000000..bc7d5f6 --- /dev/null +++ b/tqtinterface/qt4/include/tqsqlindex.h @@ -0,0 +1 @@ +../src/sql/tqsqlindex.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqsqlpropertymap.h b/tqtinterface/qt4/include/tqsqlpropertymap.h new file mode 120000 index 0000000..c7c1b46 --- /dev/null +++ b/tqtinterface/qt4/include/tqsqlpropertymap.h @@ -0,0 +1 @@ +../src/sql/tqsqlpropertymap.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqsqlquery.h b/tqtinterface/qt4/include/tqsqlquery.h new file mode 120000 index 0000000..45e24e4 --- /dev/null +++ b/tqtinterface/qt4/include/tqsqlquery.h @@ -0,0 +1 @@ +../src/sql/tqsqlquery.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqsqlrecord.h b/tqtinterface/qt4/include/tqsqlrecord.h new file mode 120000 index 0000000..924265d --- /dev/null +++ b/tqtinterface/qt4/include/tqsqlrecord.h @@ -0,0 +1 @@ +../src/sql/tqsqlrecord.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqsqlresult.h b/tqtinterface/qt4/include/tqsqlresult.h new file mode 120000 index 0000000..5955504 --- /dev/null +++ b/tqtinterface/qt4/include/tqsqlresult.h @@ -0,0 +1 @@ +../src/sql/tqsqlresult.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqsqlselectcursor.h b/tqtinterface/qt4/include/tqsqlselectcursor.h new file mode 120000 index 0000000..bed0c95 --- /dev/null +++ b/tqtinterface/qt4/include/tqsqlselectcursor.h @@ -0,0 +1 @@ +../src/sql/tqsqlselectcursor.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqstack.h b/tqtinterface/qt4/include/tqstack.h new file mode 120000 index 0000000..28350ff --- /dev/null +++ b/tqtinterface/qt4/include/tqstack.h @@ -0,0 +1 @@ +../src/compat/tqstack.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqstatusbar.h b/tqtinterface/qt4/include/tqstatusbar.h new file mode 120000 index 0000000..45975c2 --- /dev/null +++ b/tqtinterface/qt4/include/tqstatusbar.h @@ -0,0 +1 @@ +../src/widgets/tqstatusbar.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqstring.h b/tqtinterface/qt4/include/tqstring.h new file mode 120000 index 0000000..7733544 --- /dev/null +++ b/tqtinterface/qt4/include/tqstring.h @@ -0,0 +1 @@ +../src/tools/tqstring.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqstringlist.h b/tqtinterface/qt4/include/tqstringlist.h new file mode 120000 index 0000000..1023411 --- /dev/null +++ b/tqtinterface/qt4/include/tqstringlist.h @@ -0,0 +1 @@ +../src/tools/tqstringlist.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqstrlist.h b/tqtinterface/qt4/include/tqstrlist.h new file mode 120000 index 0000000..fdefc58 --- /dev/null +++ b/tqtinterface/qt4/include/tqstrlist.h @@ -0,0 +1 @@ +../src/tools/tqstrlist.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqstrvec.h b/tqtinterface/qt4/include/tqstrvec.h new file mode 120000 index 0000000..8a350e6 --- /dev/null +++ b/tqtinterface/qt4/include/tqstrvec.h @@ -0,0 +1 @@ +../src/tools/tqstrvec.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqstyle.h b/tqtinterface/qt4/include/tqstyle.h new file mode 120000 index 0000000..8960a09 --- /dev/null +++ b/tqtinterface/qt4/include/tqstyle.h @@ -0,0 +1 @@ +../src/kernel/tqstyle.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqstylefactory.h b/tqtinterface/qt4/include/tqstylefactory.h new file mode 120000 index 0000000..377d4a6 --- /dev/null +++ b/tqtinterface/qt4/include/tqstylefactory.h @@ -0,0 +1 @@ +../src/styles/tqstylefactory.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqstyleplugin.h b/tqtinterface/qt4/include/tqstyleplugin.h new file mode 120000 index 0000000..c9d4f31 --- /dev/null +++ b/tqtinterface/qt4/include/tqstyleplugin.h @@ -0,0 +1 @@ +../src/styles/tqstyleplugin.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqstylesheet.h b/tqtinterface/qt4/include/tqstylesheet.h new file mode 120000 index 0000000..86470bb --- /dev/null +++ b/tqtinterface/qt4/include/tqstylesheet.h @@ -0,0 +1 @@ +../src/kernel/tqstylesheet.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqsyntaxhighlighter.h b/tqtinterface/qt4/include/tqsyntaxhighlighter.h new file mode 120000 index 0000000..6a36cf5 --- /dev/null +++ b/tqtinterface/qt4/include/tqsyntaxhighlighter.h @@ -0,0 +1 @@ +../src/widgets/tqsyntaxhighlighter.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqt.h b/tqtinterface/qt4/include/tqt.h new file mode 120000 index 0000000..7009f74 --- /dev/null +++ b/tqtinterface/qt4/include/tqt.h @@ -0,0 +1 @@ +../src/kernel/tqt.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqtabbar.h b/tqtinterface/qt4/include/tqtabbar.h new file mode 120000 index 0000000..8266329 --- /dev/null +++ b/tqtinterface/qt4/include/tqtabbar.h @@ -0,0 +1 @@ +../src/widgets/tqtabbar.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqtabdialog.h b/tqtinterface/qt4/include/tqtabdialog.h new file mode 120000 index 0000000..fc47638 --- /dev/null +++ b/tqtinterface/qt4/include/tqtabdialog.h @@ -0,0 +1 @@ +../src/dialogs/tqtabdialog.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqtabdlg.h b/tqtinterface/qt4/include/tqtabdlg.h new file mode 120000 index 0000000..598d4a2 --- /dev/null +++ b/tqtinterface/qt4/include/tqtabdlg.h @@ -0,0 +1 @@ +../src/compat/tqtabdlg.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqtable.h b/tqtinterface/qt4/include/tqtable.h new file mode 120000 index 0000000..8364f90 --- /dev/null +++ b/tqtinterface/qt4/include/tqtable.h @@ -0,0 +1 @@ +../src/table/tqtable.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqtabwidget.h b/tqtinterface/qt4/include/tqtabwidget.h new file mode 120000 index 0000000..1d09cd9 --- /dev/null +++ b/tqtinterface/qt4/include/tqtabwidget.h @@ -0,0 +1 @@ +../src/widgets/tqtabwidget.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqtenuminheritance.h b/tqtinterface/qt4/include/tqtenuminheritance.h new file mode 100644 index 0000000..ea69016 --- /dev/null +++ b/tqtinterface/qt4/include/tqtenuminheritance.h @@ -0,0 +1,36 @@ +#ifndef TQT_ENUM_INHERITANCE_H +#define TQT_ENUM_INHERITANCE_H + +template +class TQTInheritEnum +{ +public: + TQTInheritEnum() {} + TQTInheritEnum(EnumT e) + : enum_(e) + {} + + TQTInheritEnum(BaseEnumT e) + : baseEnum_(e) + {} + + explicit TQTInheritEnum( int val ) + : enum_(static_cast(val)) + {} + + operator EnumT() const { return enum_; } +private: + // Note - the value is declared as a union mainly for as a debugging aid. If + + // the union is undesired and you have other methods of debugging, change it + + // to either of EnumT and do a cast for the constructor that accepts BaseEnumT. + + union + { + EnumT enum_; + BaseEnumT baseEnum_; + }; +}; + +#endif // TQT_ENUM_INHERITANCE_H \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqtextbrowser.h b/tqtinterface/qt4/include/tqtextbrowser.h new file mode 120000 index 0000000..1703397 --- /dev/null +++ b/tqtinterface/qt4/include/tqtextbrowser.h @@ -0,0 +1 @@ +../src/widgets/tqtextbrowser.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqtextcodec.h b/tqtinterface/qt4/include/tqtextcodec.h new file mode 120000 index 0000000..e0da5c1 --- /dev/null +++ b/tqtinterface/qt4/include/tqtextcodec.h @@ -0,0 +1 @@ +../src/codecs/tqtextcodec.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqtextcodecfactory.h b/tqtinterface/qt4/include/tqtextcodecfactory.h new file mode 120000 index 0000000..5537fd0 --- /dev/null +++ b/tqtinterface/qt4/include/tqtextcodecfactory.h @@ -0,0 +1 @@ +../src/codecs/tqtextcodecfactory.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqtextcodecplugin.h b/tqtinterface/qt4/include/tqtextcodecplugin.h new file mode 120000 index 0000000..59d41cb --- /dev/null +++ b/tqtinterface/qt4/include/tqtextcodecplugin.h @@ -0,0 +1 @@ +../src/codecs/tqtextcodecplugin.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqtextedit.h b/tqtinterface/qt4/include/tqtextedit.h new file mode 120000 index 0000000..cc25259 --- /dev/null +++ b/tqtinterface/qt4/include/tqtextedit.h @@ -0,0 +1 @@ +../src/widgets/tqtextedit.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqtextstream.h b/tqtinterface/qt4/include/tqtextstream.h new file mode 120000 index 0000000..403f8a5 --- /dev/null +++ b/tqtinterface/qt4/include/tqtextstream.h @@ -0,0 +1 @@ +../src/tools/tqtextstream.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqtextview.h b/tqtinterface/qt4/include/tqtextview.h new file mode 120000 index 0000000..f2f0d5b --- /dev/null +++ b/tqtinterface/qt4/include/tqtextview.h @@ -0,0 +1 @@ +../src/widgets/tqtextview.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqtglobaldefines.h b/tqtinterface/qt4/include/tqtglobaldefines.h new file mode 120000 index 0000000..39a758a --- /dev/null +++ b/tqtinterface/qt4/include/tqtglobaldefines.h @@ -0,0 +1 @@ +../src/kernel/tqtglobaldefines.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqtglobaldefines.h~ b/tqtinterface/qt4/include/tqtglobaldefines.h~ new file mode 100644 index 0000000..6c023a8 --- /dev/null +++ b/tqtinterface/qt4/include/tqtglobaldefines.h~ @@ -0,0 +1,492 @@ +#ifndef TQTGLOBALDEFINES_H +#define TQTGLOBALDEFINES_H + +#include "tqtglobalsettings.h" + +// #ifdef USE_QT4 +// #define QT3_SUPPORT +// #endif +// +#ifdef USE_QT4 + +#include +#include +#include + +#ifdef QT_NO_TRANSLATION +#define TQT_NO_TRANSLATION +#endif // QT_NO_TRANSLATION + +#ifdef QT_THREAD_SUPPORT +#define TQT_THREAD_SUPPORT +#endif // QT_THREAD_SUPPORT + +// #define tqqt_cast qobject_cast + +// Mark certain Qt3 static variables squarely OFF LIMITS +#define qt_x_time "Usage of the qt_x_time static variable is strongly deprecated in TQt, and is unavailable in TQt for Qt4. Use GET_QT_X_TIME/SET_QT_X_TIME instead" +#define qt_x_user_time "Usage of the qt_x_time static variable is strongly deprecated in TQt, and is unavailable in TQt for Qt4. Use GET_QT_X_USER_TIME/SET_QT_X_USER_TIME instead" + +// #define TQT_TQOBJECT(x) (static_cast(static_cast(x))) +#define TQT_TQOBJECT(x) (convertFromTQT_BASE_OBJECT_NAMEPointer(x)) +#define TQT_TQWIDGET(x) TQWidget::tqt_ensure_valid_widget_painting(static_cast(static_cast(static_cast(x)))) +#define TQT_TQSIZEPOLICY(x) (static_cast(static_cast(x))) +#define TQT_TQLAYOUT(x) (static_cast(static_cast(x))) +#define TQT_TQGRIDLAYOUT(x) (static_cast(static_cast(x))) +#define TQT_TQPAINTER(x) (static_cast(static_cast(x))) +#define TQT_TQPAINTDEVICE(x) (static_cast(static_cast(x))) +#define TQT_TQLAYOUTITEM(x) (static_cast(static_cast(x))) +#define TQT_TQIODEVICE(x) (static_cast(static_cast(x))) +#define TQT_TQCOLOR(x) (static_cast(static_cast(x))) +#define TQT_TQCHAR(x) TQChar(x) +#define TQT_TQSTRING(x) TQString(x) +#define TQT_TQPOINT(x) (static_cast(static_cast(x))) +#define TQT_TQBUFFER(x) (static_cast(static_cast(x))) +#define TQT_TQWMATRIX(x) (static_cast(static_cast(x))) +#define TQT_TQFILE(x) (static_cast(static_cast(x))) +#define TQT_TQBYTEARRAY(x) (static_cast(static_cast(x))) +#define TQT_TQMIMESOURCE(x) (static_cast(static_cast(x))) +#define TQT_TQWEXTRA(x) (static_cast(static_cast(x))) +#define TQT_TQPIXMAP(x) (static_cast(static_cast(x))) +#define TQT_TQCLIPBOARD(x) (static_cast(static_cast(x))) +#define TQT_TQPRINTER(x) (static_cast(static_cast(x))) +#define TQT_TQVARIANT(x) (static_cast(static_cast(x))) +#define TQT_TQMETAOBJECT(x) (static_cast(static_cast(x))) +#define TQT_TQSTYLEOPTION(x) (static_cast(static_cast(x))) +#define TQT_TQEVENT(x) (static_cast(static_cast(x))) +#define TQT_TQKEYEVENT(x) (static_cast(static_cast(static_cast(x)))) +#define TQT_TQSHOWEVENT(x) (static_cast(static_cast(static_cast(x)))) +#define TQT_TQMOUSEEVENT(x) (static_cast(static_cast(static_cast(x)))) +#define TQT_TQWHEELEVENT(x) (static_cast(static_cast(static_cast(x)))) +#define TQT_TQFOCUSEVENT(x) (static_cast(static_cast(static_cast(x)))) +#define TQT_TQPAINTEVENT(x) (static_cast(static_cast(static_cast(x)))) +#define TQT_TQCHILDEVENT(x) (static_cast(static_cast(static_cast(x)))) +#define TQT_TQCLOSEEVENT(x) (static_cast(static_cast(static_cast(x)))) +#define TQT_TQTIMEREVENT(x) (static_cast(static_cast(static_cast(x)))) +#define TQT_TQRESIZEEVENT(x) (static_cast(static_cast(static_cast(x)))) +#define TQT_TQCONTEXTMENUEVENT(x) (static_cast(static_cast(static_cast(x)))) + +#define TQT_TQOBJECT_OBJECT(x) (convertFromTQT_BASE_OBJECT_NAME(x)) +#define TQT_TQSIZEPOLICY_OBJECT(x) (convertFromQSizePolicy(x)) +#define TQT_TQLAYOUT_OBJECT(x) (convertFromQLayout(x)) +#define TQT_TQCOLOR_OBJECT(x) (convertFromQColor(x)) +#define TQT_TQSTRING_OBJECT(x) (convertFromQString(x)) +#define TQT_TQSTRLIST_OBJECT(x) (convertFromQStrList(x)) +#define TQT_TQSTRINGLIST_OBJECT(x) (TQStringList::convertFromQStringList(x)) +#define TQT_TQWMATRIX_OBJECT(x) (convertFromQMatrix(x)) +#define TQT_TQRECT_OBJECT(x) TQRect(x) +#define TQT_TQBYTEARRAY_OBJECT(x) (convertFromQByteArray(x)) +#define TQT_TQPIXMAP_OBJECT(x) (convertFromQPixmap(x)) +#define TQT_TQTIME_OBJECT(x) (TQTime::convertFromQTime(x)) +#define TQT_TQDATE_OBJECT(x) (TQDate::convertFromQDate(x)) +#define TQT_TQDATETIME_OBJECT(x) (TQDateTime::convertFromQDateTime(x)) +#define TQT_TQBRUSH_OBJECT(x) (convertFromQBrush(x)) +#define TQT_TQPALETTE_OBJECT(x) (convertFromQPalette(x)) +#define TQT_TQPOINT_OBJECT(x) (convertFromQPoint(x)) +#define TQT_TQREGION_OBJECT(x) (convertFromQRegion(x)) +#define TQT_TQIMAGE_OBJECT(x) (convertFromQImage(x)) +#define TQT_TQPAINTDEVICE_OBJECT(x) (convertFromQPaintDevice(x)) +#define TQT_TQVARIANT_OBJECT(x) (convertFromQVariant(x)) +#define TQT_TQIODEVICE_OBJECT(x) (convertFromQIODevice(x)) +#define TQT_TQSESSIONMANAGER_OBJECT(x) (convertFromQSessionManager(x)) +#define TQT_TQSTYLEOPTION_OBJECT(x) (TQStyleOption(x)) + +// #define TQT_TQOBJECT_CONST(x) (static_cast(static_cast(x))) +#define TQT_TQOBJECT_CONST(x) (convertFromTQT_BASE_OBJECT_NAMEPointerConst(x)) +#define TQT_TQWIDGET_CONST(x) (static_cast(static_cast(static_cast(x)))) +#define TQT_TQMIMESOURCE_CONST(x) (static_cast(static_cast(x))) +#define TQT_TQPOINT_CONST(x) (static_cast(static_cast(x))) +#define TQT_TQBRUSH_CONST(x) (static_cast(static_cast(x))) +#define TQT_TQPIXMAP_CONST(x) (static_cast(static_cast(x))) +#define TQT_TQPAINTDEVICE_CONST(x) (static_cast(static_cast(x))) +#define TQT_TQCOLOR_CONST(x) (static_cast(static_cast(x))) +#define TQT_TQPRINTER_CONST(x) (static_cast(static_cast(x))) +#define TQT_TQIODEVICE_CONST(x) (static_cast(static_cast(x))) +#define TQT_TQVARIANT_CONST(x) (static_cast(static_cast(x))) +#define TQT_TQMETAOBJECT_CONST(x) (static_cast(static_cast(x))) +#define TQT_TQSTYLEOPTION_CONST(x) (static_cast(static_cast(x))) + +#define TQPOINT_OBJECT_NAME_STRING "TQPoint" +#define TQBYTEARRAY_OBJECT_NAME_STRING "TQByteArray" +#define TQPIXMAP_OBJECT_NAME_STRING "TQPixmap" +#define TQSTRING_OBJECT_NAME_STRING "TQString" +#define TQSTRINGLIST_OBJECT_NAME_STRING "TQStringList" +#define TQLAYOUT_OBJECT_NAME_STRING "TQLayout" +#define TQBOXLAYOUT_OBJECT_NAME_STRING "TQBoxLayout" +#define TQHBOXLAYOUT_OBJECT_NAME_STRING "TQHBoxLayout" +#define TQVBOXLAYOUT_OBJECT_NAME_STRING "TQVBoxLayout" +#define TQGRIDLAYOUT_OBJECT_NAME_STRING "TQGridLayout" +#define TQHBOX_OBJECT_NAME_STRING "TQHBox" +#define TQVBOX_OBJECT_NAME_STRING "TQVBox" +#define TQGRID_OBJECT_NAME_STRING "TQGrid" +#define TQTABWIDGET_OBJECT_NAME_STRING "TQTabWidget" +#define TQCHECKBOX_OBJECT_NAME_STRING "TQCheckBox" +#define TQLINEEDIT_OBJECT_NAME_STRING "TQLineEdit" +#define TQTEXTEDIT_OBJECT_NAME_STRING "TQTextEdit" +#define TQOBJECT_OBJECT_NAME_STRING "TQObject" +#define TQWIDGET_OBJECT_NAME_STRING "TQWidget" +#define TQGLWIDGET_OBJECT_NAME_STRING "TQGLWidget" +#define TQLABEL_OBJECT_NAME_STRING "TQLabel" +#define TQTIMER_OBJECT_NAME_STRING "TQTimer" +#define TQFRAME_OBJECT_NAME_STRING "TQFrame" +#define TQACCEL_OBJECT_NAME_STRING "TQAccel" +#define TQDIALOG_OBJECT_NAME_STRING "TQDialog" +#define TQDIAL_OBJECT_NAME_STRING "TQDial" +#define TQACTION_OBJECT_NAME_STRING "TQAction" +#define TQACTIONGROUP_OBJECT_NAME_STRING "TQActionGroup" +#define TQLCDNUMBER_OBJECT_NAME_STRING "TQLCDNumber" +#define TQPROGRESSBAR_OBJECT_NAME_STRING "TQProgressBar" +#define TQTABDIALOG_OBJECT_NAME_STRING "TQTabDialog" +#define TQTABWIDGET_OBJECT_NAME_STRING "TQTabWidget" +#define TQDOCKWINDOW_OBJECT_NAME_STRING "TQDockWindow" +#define TQGROUPBOX_OBJECT_NAME_STRING "TQGroupBox" +#define TQCOMBOBOX_OBJECT_NAME_STRING "TQComboBox" +#define TQSPINBOX_OBJECT_NAME_STRING "TQSpinBox" +#define TQSPINWIDGET_OBJECT_NAME_STRING "TQSpinWidget" +#define TQLISTBOX_OBJECT_NAME_STRING "TQListBox" +#define TQTOOLBOX_OBJECT_NAME_STRING "TQToolBox" +#define TQTOOLBOXBUTTON_OBJECT_NAME_STRING "TQToolBoxButton" +#define TQVGROUPBOX_OBJECT_NAME_STRING "TQVGroupBox" +#define TQSPLITTER_OBJECT_NAME_STRING "TQSplitter" +#define TQSPLITTERHANDLE_OBJECT_NAME_STRING "TQSplitterHandle" +#define TQBUTTON_OBJECT_NAME_STRING "TQButton" +#define TQGRIDVIEW_OBJECT_NAME_STRING "TQGridView" +#define TQSLIDER_OBJECT_NAME_STRING "TQSlider" +#define TQPUSHBUTTON_OBJECT_NAME_STRING "TQPushButton" +#define TQTOOLBUTTON_OBJECT_NAME_STRING "TQToolButton" +#define TQRADIOBUTTON_OBJECT_NAME_STRING "TQRadioButton" +#define TQPOPUPMENU_OBJECT_NAME_STRING "TQPopupMenu" +#define TQTOOLBAR_OBJECT_NAME_STRING "TQToolBar" +#define TQMENUBAR_OBJECT_NAME_STRING "TQMenuBar" +#define TQTABBAR_OBJECT_NAME_STRING "TQTabBar" +#define TQLISTVIEW_OBJECT_NAME_STRING "TQListView" +#define TQSCROLLBAR_OBJECT_NAME_STRING "TQScrollBar" +#define TQSCROLLVIEW_OBJECT_NAME_STRING "TQScrollView" +#define TQRANGECONTROL_OBJECT_NAME_STRING "TQRangeControl" +#define TQCANVASITEM_OBJECT_NAME_STRING "TQCanvasItem" +#define TQICONVIEW_OBJECT_NAME_STRING "TQIconView" +#define TQMULTILINEEDIT_OBJECT_NAME_STRING "TQMultiLineEdit" +#define TQINTVALIDATOR_OBJECT_NAME_STRING "TQIntValidator" +#define TQDATEEDIT_OBJECT_NAME_STRING "TQDateEdit" +#define TQTIMEEDIT_OBJECT_NAME_STRING "TQTimeEdit" +#define TQDATETIMEEDIT_OBJECT_NAME_STRING "TQDateTimeEdit" +#define TQHEADER_OBJECT_NAME_STRING "TQHeader" +#define TQSIZEGRIP_OBJECT_NAME_STRING "TQSizeGrip" +#define TQDOCKWINDOWHANDLE_OBJECT_NAME_STRING "TQDockWindowHandle" +#define TQHIDEDOCK_OBJECT_NAME_STRING "TQHideDock" +#define TQTABLE_OBJECT_NAME_STRING "TQTable" +#define TQWIZARD_OBJECT_NAME_STRING "TQWizard" +#define TQDATATABLE_OBJECT_NAME_STRING "TQDataTable" +#define TQDATABROWSER_OBJECT_NAME_STRING "TQDataBrowser" +#define TQDATAVIEW_OBJECT_NAME_STRING "TQDataView" +#define TQMAINWINDOW_OBJECT_NAME_STRING "TQMainWindow" +#define TQWIDGETSTACK_OBJECT_NAME_STRING "TQWidgetStack" +#define TQBUTTONGROUP_OBJECT_NAME_STRING "TQButtonGroup" +#define TQTEXTVIEW_OBJECT_NAME_STRING "TQTextView" +#define TQTEXTBROWSER_OBJECT_NAME_STRING "TQTextBrowser" +#define TQLAYOUTWIDGET_OBJECT_NAME_STRING "TQLayoutWidget" + +#define TQMOTIFPLUSSTYLE_OBJECT_NAME_STRING "TQMotifPlusStyle" + +// #define tqarrowCursor Qt::ArrowCursor +// #define tqupArrowCursor Qt::UpArrowCursor +// #define tqcrossCursor Qt::CrossCursor +// #define tqwaitCursor Qt::WaitCursor +// #define tqibeamCursor Qt::IBeamCursor +// #define tqsizeVerCursor Qt::SizeVerCursor +// #define tqsizeHorCursor Qt::SizeHorCursor +// #define tqsizeBDiagCursor Qt::SizeBDiagCursor +// #define tqsizeFDiagCursor Qt::SizeFDiagCursor +// #define tqsizeAllCursor Qt::SizeAllCursor +// #define tqblankCursor Qt::BlankCursor +// #define tqsplitVCursor Qt::SplitVCursor +// #define tqsplitHCursor Qt::SplitHCursor +// #define tqpointingHandCursor Qt::PointingHandCursor +// #define tqforbiddenCursor Qt::ForbiddenCursor +// #define tqwhatsThisCursor Qt::WhatsThisCursor +// #define tqbusyCursor Qt::BusyCursor + +#define tqarrowCursor TQt::arrowCursor +#define tqupArrowCursor TQt::upArrowCursor +#define tqcrossCursor TQt::crossCursor +#define tqwaitCursor TQt::waitCursor +#define tqibeamCursor TQt::ibeamCursor +#define tqsizeVerCursor TQt::sizeVerCursor +#define tqsizeHorCursor TQt::sizeHorCursor +#define tqsizeBDiagCursor TQt::sizeBDiagCursor +#define tqsizeFDiagCursor TQt::sizeFDiagCursor +#define tqsizeAllCursor TQt::sizeAllCursor +#define tqblankCursor TQt::blankCursor +#define tqsplitVCursor TQt::splitVCursor +#define tqsplitHCursor TQt::splitHCursor +#define tqpointingHandCursor TQt::pointingHandCursor +#define tqforbiddenCursor TQt::forbiddenCursor +#define tqwhatsThisCursor TQt::whatsThisCursor +#define tqbusyCursor TQt::busyCursor + +#define tqreadBlock readData +#define tqwriteBlock writeData +#define TQT_TQIO_LONG qint64 +#define TQT_TQIO_ULONG qint64 +#define TQ_WFlags WFlags + +#define SET_QT_X_TIME(x) QX11Info::setAppTime(x) +#define GET_QT_X_TIME(x) QX11Info::appTime() +#define SET_QT_X_USER_TIME(x) QX11Info::setAppUserTime(x) +#define GET_QT_X_USER_TIME(x) QX11Info::appUserTime() + +// // [FIXME] +// // This should try a dynamic cast first before resorting to conversion (which entails a create/copy/delete operation) +// // Also, is simply overwriting the origin pointer enough to make this work in all cases??? +// template +// U* tqt_convert_object(T* orig) +// { +// T* orig_ptr = orig; +// U* temp = new U(); +// *temp = *orig; +// orig_ptr = temp; +// delete orig; +// return temp; +// } +// +// #define TQT_TQPIXMAP(x) (tqt_convert_object(x)) +// #define TQT_TQPIXMAP_CONST(x) (tqt_convert_object(x)) + +// [NOTE] +// It is IMPOSSIBLE to downcast an abstract base class [ABC] to a derived type. Period. End of story. +// Think of it this way...is it ever possible to instantiate an ABC on its own (e.g. with new)? No! +// Therefore, it is also impossible to copy an ABC. +// static_cast won't work because an ABC has a completely different structure than a non abstract class. +// Specifically, you will get segmentation faults in typeinfo for the ABC at runtime. +// This is probably due to the complete absence of the abstract method implementations in the static_casted object. +// The only exception that I can think of MIGHT be if NO CHANGES are made to the abstracted methods, +// including addition, modification, or removal of said methods. Don't bet the farm on this however! + +// #define TQT_TQLAYOUTITEM_CONST(x) (static_cast(static_cast(x))) + +// // [FIXME] +// // This should try a dynamic cast first before resorting to conversion (which entails a create/copy/delete operation) +// // There is half a chance that this sort of nasty hackery is only required for abstract base classes, such as QStyle and QLayoutItem +// // For other class types a simple static_cast *might* suffice. [???] +// template +// U* tqt_convert_object(T* orig) +// { +// T* orig_ptr = orig; +// U* temp = new U(); +// *temp = *orig; +// orig_ptr = temp; +// delete orig; +// return temp; +// } +// +// #define TQT_TQLAYOUTITEM_CONST(x) (tqt_convert_object(x)) + +// TQT_BASE_OBJECT is here for equality operators, as pointers will only be considered equal if the top (base) classes are compared +// This is because all widget/extension/etc. classes will have one and only one TQT_BASE_OBJECT class instance in memory +// Thus casting both pointers to TQT_BASE_OBJECT and comparing will reveal if the objects being compared are truly the same +// For TQT 3 TQObject is the real base class, while in TQt 4 QObject is the real base class +#define TQT_BASE_OBJECT_NAME QObject +#define TQT_BASE_OBJECT(x) (static_cast(x)) +#define TQT_BASE_OBJECT_CONST(x) (static_cast(x)) + +// This can be used to change any object name within TQt +// x is a QString or TQString +#define TQT_OBJECT_NAME_HANDLER(x) TQString(x) + +// Safe casts +template +T tqt_dynamic_cast(TQT_BASE_OBJECT_NAME* a) { return dynamic_cast(a); } + +template +T tqt_dynamic_cast(const TQT_BASE_OBJECT_NAME* a) { return dynamic_cast(a); } + +// Interface defines +#define QABS(n) qAbs(n) +#define QMIN(x, y) qMin(x, y) +#define QMAX(x, y) qMax(x, y) + +#define tqt_mo_access access() + +// [FIXME] The underlying problem in uic creating the need for these defines should probably be fixed sometime in the future... +// See object.cpp e.g. line 571 +#define setTqmaximumSize setMaximumSize +#define setTqminimumSize setMinimumSize +#define setTqalignment tqsetAlignment +#define setTqgeometry setGeometry + +#define Q_UINT16 quint16 + +#define ttqqt_cast( x ) tqqt_cast(TQT_TQOBJECT(x)) + +// TQT for Qt3 compatibility defines +#define tqred red +#define tqgreen green +#define tqblue blue +#define tqcyan cyan +#define tqmagenta magenta +#define tqyellow yellow +#define tqdarkRed darkRed +#define tqdarkGreen darkGreen +#define tqdarkBlue darkBlue +#define tqdarkCyan darkCyan +#define tqdarkMagenta darkMagenta +#define tqdarkYellow darkYellow +#define tqwhite white +#define tqwhiteptr &TQt::white +#define tqlightGray lightGray +#define tqgray gray +#define tqdarkGray darkGray +#define tqblack black +#define tqblackptr &TQt::black +#define tqcolor0 color0 +#define tqcolor1 color1 + +// #define tqaccess access +// #define tqcolorTable colorTable +#define TQSO_Default Default +// #define tqqt_cast ::qt_cast +#define TQ_Alignment Qt::Alignment +#define TQ_Horizontal Horizontal +#define TQ_Vertical Vertical +#define TQImage_ScaleFree ScaleFree +#define TQ_Key_Shift Key_Shift +#define TQ_Key_Control Key_Control +#define TQ_Key_Alt Key_Alt +#define TQ_Key_Meta Key_Meta +#define TQ_Key_Super_L Key_Super_L +#define TQ_Key_Super_R Key_Super_R +#define TQ_Key_Hyper_L Key_Hyper_L +#define TQ_Key_Hyper_R Key_Hyper_R +#define TQ_ButtonState TQt::ButtonState +#define TQ_LeftButton Qt::LeftButton +#define TQ_MidButton Qt::MidButton +#define TQ_RightButton Qt::RightButton +#define TQ_ShiftButton ShiftButton +#define TQ_ControlButton ControlButton +#define TQ_AltButton AltButton +#define TQ_MetaButton MetaButton +#define TQ_ScaleFree ScaleFree +#define TQ_ScaleMin ScaleMin +#define TQ_ScaleMax ScaleMax +#define TQ_ScaleMode ScaleMode +#define TQ_StrongFocus Qt::StrongFocus +#define TQ_NoFocus Qt::NoFocus +#define TQ_WheelFocus Qt::WheelFocus +#define TQ_ClickFocus Qt::ClickFocus +#define TQ_TabFocus Qt::TabFocus +#define TQ_FocusPolicy Qt::FocusPolicy +#define TQ_SPExpandData Qt::Orientations +#define TQIODevice_OpenModeFlag QIODevice::OpenModeFlag +#define TQ_OpenMode OpenMode + +// #define Orientation Qt::Orientation + +// #define SubRect SubElement +// #define SR_PushButtonContents SE_PushButtonContents +// #define SR_PushButtonFocusRect SE_PushButtonFocusRect +// #define SR_CheckBoxIndicator SE_CheckBoxIndicator +// #define SR_CheckBoxContents SE_CheckBoxContents +// #define SR_CheckBoxFocusRect SE_CheckBoxFocusRect +// #define SR_RadioButtonIndicator SE_RadioButtonIndicator +// #define SR_RadioButtonContents SE_RadioButtonContents +// #define SR_RadioButtonFocusRect SE_RadioButtonFocusRect +// #define SR_ComboBoxFocusRect SE_ComboBoxFocusRect +// #define SR_SliderFocusRect SE_SliderFocusRect +// #define SR_DockWindowHandleRect SE_DockWindowHandleRect +// #define SR_ProgressBarGroove SE_ProgressBarGroove +// #define SR_ProgressBarContents SE_ProgressBarContents +// #define SR_ProgressBarLabel SE_ProgressBarLabel +// #define SR_ToolButtonContents SE_ToolButtonContents +// #define SR_DialogButtonAccept SE_DialogButtonAccept +// #define SR_DialogButtonReject SE_DialogButtonReject +// #define SR_DialogButtonApply SE_DialogButtonApply +// #define SR_DialogButtonHelp SE_DialogButtonHelp +// #define SR_DialogButtonAll SE_DialogButtonAll +// #define SR_DialogButtonAbort SE_DialogButtonAbort +// #define SR_DialogButtonIgnore SE_DialogButtonIgnore +// #define SR_DialogButtonRetry SE_DialogButtonRetry +// #define SR_DialogButtonCustom SE_DialogButtonCustom +// #define SR_ToolBoxTabContents SE_ToolBoxTabContents +// #define SR_CustomBase SE_CustomBase +// +// #define StylePixmap StandardPixmap +// // #define SP_TitleBarMinButton SC_TitleBarMinButton +// // #define SP_TitleBarMaxButton SC_TitleBarMaxButton +// // #define SP_TitleBarCloseButton SC_TitleBarCloseButton +// // #define SP_TitleBarNormalButton SC_TitleBarNormalButton +// // #define SP_TitleBarShadeButton SC_TitleBarShadeButton +// // #define SP_TitleBarUnshadeButton SC_TitleBarUnshadeButton +// #define SP_DockWindowCloseButton SP_DockWidgetCloseButton +// // #define SP_MessageBoxInformation SC_MessageBoxInformation +// // #define SP_MessageBoxWarning SC_MessageBoxWarning +// // #define SP_MessageBoxCritical SC_MessageBoxCritical +// // #define SP_MessageBoxQuestion SC_MessageBoxQuestion +// // #define SP_CustomBase SC_CustomBase +// +// #define StyleFlags StateFlags +// #define Style_Default QStyle::State_Default +// #define Style_Enabled QStyle::State_Enabled +// #define Style_Raised QStyle::State_Raised +// #define Style_Sunken QStyle::State_Sunken +// #define Style_Off QStyle::State_Off +// #define Style_NoChange QStyle::State_NoChange +// #define Style_On QStyle::State_On +// #define Style_Down QStyle::State_DownArrow +// #define Style_Horizontal QStyle::State_Horizontal +// #define Style_HasFocus QStyle::State_HasFocus +// #define Style_To QStyle::State_To +// #define Style_Bottom QStyle::State_Bottom +// #define Style_FocusAtBorder QStyle::State_FocusAtBorder +// #define Style_AutoRaise QStyle::State_AutoRaise +// #define Style_MouseOver QStyle::State_MouseOver +// #define Style_Up QStyle::State_UpArrow +// #define Style_Selected QStyle::State_Selected +// #define Style_Active QStyle::State_Active +// #define Style_ButtonDefault QStyle::State_ButtonDefault +// +// #define PE_ArrowDown PE_IndicatorArrowDown +// #define PE_ArrowUp PE_IndicatorArrowUp +// #define PE_ButtonTool PE_PanelButtonTool +// #define PE_DockWindowHandle PE_IndicatorToolBarHandle +// #define PE_DockWindowSeparator PE_Q3DockWindowSeparator +// // Verify this one -------------v +// #define PE_FocusRect PE_FrameFocusRect +// #define PE_Panel PE_Frame +// #define PE_RubberBand CE_RubberBand +// #define PE_ScrollBarAddLine CE_ScrollBarAddLine +// #define PE_ScrollBarAddPage CE_ScrollBarAddPage +// #define PE_ScrollBarFirst CE_ScrollBarFirst +// #define PE_ScrollBarLast CE_ScrollBarLast +// #define PE_ScrollBarSlider CE_ScrollBarSlider +// #define PE_ScrollBarSubLine CE_ScrollBarSubLine +// #define PE_ScrollBarSubPage CE_ScrollBarSubPage +// +// #define SC_ListView SC_Q3ListView +// #define SC_ListViewBranch SC_Q3ListViewBranch +// #define SC_ListViewExpand SC_Q3ListViewExpand +// +// #define CC_ListView CC_Q3ListView +// +// #define WState Qt::WidgetAttribute +// #define WState_Polished Qt::WA_WState_Polished +// //#define WState_ForceHide Qt::WA_WState_ForceHide +// #define WState_ForceHide Qt::WA_WState_Hidden +// +// #define SH_PopupMenu_Scrollable SH_Menu_Scrollable +// #define SH_PopupMenu_SloppySubMenus SH_Menu_SloppySubMenus +// #define SH_PopupMenu_SubMenuPopupDelay SH_Menu_SubMenuPopupDelay +// #define SH_PopupMenu_AllowActiveAndDisabled SH_Menu_AllowActiveAndDisabled +// #define SH_PopupMenu_MouseTracking SH_Menu_MouseTracking +// +// #define CE_PopupMenuScroller CE_MenuScroller +// +// #define PM_DockWindowHandleExtent PM_DockWidgetHandleExtent +// #define PM_MenuBarFrameWidth PM_ToolBarFrameWidth +// #define PM_DockWindowFrameWidth PM_DockWidgetFrameWidth +// #define PM_PopupMenuScrollerHeight PM_MenuScrollerHeight +// +// // #define WFlags Qt::WindowFlags + +#endif // USE_QT4 + +#endif // TQTGLOBALDEFINES_H diff --git a/tqtinterface/qt4/include/tqtglobalsettings.h b/tqtinterface/qt4/include/tqtglobalsettings.h new file mode 120000 index 0000000..af0b167 --- /dev/null +++ b/tqtinterface/qt4/include/tqtglobalsettings.h @@ -0,0 +1 @@ +../src/kernel/tqtglobalsettings.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqthread.h b/tqtinterface/qt4/include/tqthread.h new file mode 120000 index 0000000..fb906f1 --- /dev/null +++ b/tqtinterface/qt4/include/tqthread.h @@ -0,0 +1 @@ +../src/kernel/tqthread.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqthreadstorage.h b/tqtinterface/qt4/include/tqthreadstorage.h new file mode 120000 index 0000000..d3804ee --- /dev/null +++ b/tqtinterface/qt4/include/tqthreadstorage.h @@ -0,0 +1 @@ +../src/tools/tqthreadstorage.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqtimer.h b/tqtinterface/qt4/include/tqtimer.h new file mode 120000 index 0000000..75c9b24 --- /dev/null +++ b/tqtinterface/qt4/include/tqtimer.h @@ -0,0 +1 @@ +../src/kernel/tqtimer.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqtl.h b/tqtinterface/qt4/include/tqtl.h new file mode 120000 index 0000000..86a033d --- /dev/null +++ b/tqtinterface/qt4/include/tqtl.h @@ -0,0 +1 @@ +../src/tools/tqtl.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqtoolbar.h b/tqtinterface/qt4/include/tqtoolbar.h new file mode 120000 index 0000000..f890f2a --- /dev/null +++ b/tqtinterface/qt4/include/tqtoolbar.h @@ -0,0 +1 @@ +../src/widgets/tqtoolbar.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqtoolbox.h b/tqtinterface/qt4/include/tqtoolbox.h new file mode 120000 index 0000000..848366e --- /dev/null +++ b/tqtinterface/qt4/include/tqtoolbox.h @@ -0,0 +1 @@ +../src/widgets/tqtoolbox.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqtoolbutton.h b/tqtinterface/qt4/include/tqtoolbutton.h new file mode 120000 index 0000000..9101004 --- /dev/null +++ b/tqtinterface/qt4/include/tqtoolbutton.h @@ -0,0 +1 @@ +../src/widgets/tqtoolbutton.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqtooltip.h b/tqtinterface/qt4/include/tqtooltip.h new file mode 120000 index 0000000..9f6503f --- /dev/null +++ b/tqtinterface/qt4/include/tqtooltip.h @@ -0,0 +1 @@ +../src/widgets/tqtooltip.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqtranslator.h b/tqtinterface/qt4/include/tqtranslator.h new file mode 120000 index 0000000..724e8f1 --- /dev/null +++ b/tqtinterface/qt4/include/tqtranslator.h @@ -0,0 +1 @@ +../src/kernel/tqtranslator.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqtsciicodec.h b/tqtinterface/qt4/include/tqtsciicodec.h new file mode 120000 index 0000000..1f30779 --- /dev/null +++ b/tqtinterface/qt4/include/tqtsciicodec.h @@ -0,0 +1 @@ +../src/codecs/tqtsciicodec.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqtstream.h b/tqtinterface/qt4/include/tqtstream.h new file mode 120000 index 0000000..23b7031 --- /dev/null +++ b/tqtinterface/qt4/include/tqtstream.h @@ -0,0 +1 @@ +../src/compat/tqtstream.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqurl.h b/tqtinterface/qt4/include/tqurl.h new file mode 120000 index 0000000..fc69182 --- /dev/null +++ b/tqtinterface/qt4/include/tqurl.h @@ -0,0 +1 @@ +../src/kernel/tqurl.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqurlinfo.h b/tqtinterface/qt4/include/tqurlinfo.h new file mode 120000 index 0000000..bea8f16 --- /dev/null +++ b/tqtinterface/qt4/include/tqurlinfo.h @@ -0,0 +1 @@ +../src/kernel/tqurlinfo.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqurloperator.h b/tqtinterface/qt4/include/tqurloperator.h new file mode 120000 index 0000000..eec0bf7 --- /dev/null +++ b/tqtinterface/qt4/include/tqurloperator.h @@ -0,0 +1 @@ +../src/kernel/tqurloperator.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqutfcodec.h b/tqtinterface/qt4/include/tqutfcodec.h new file mode 120000 index 0000000..4e0a756 --- /dev/null +++ b/tqtinterface/qt4/include/tqutfcodec.h @@ -0,0 +1 @@ +../src/codecs/tqutfcodec.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tquuid.h b/tqtinterface/qt4/include/tquuid.h new file mode 120000 index 0000000..cb75bc3 --- /dev/null +++ b/tqtinterface/qt4/include/tquuid.h @@ -0,0 +1 @@ +../src/tools/tquuid.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqvalidator.h b/tqtinterface/qt4/include/tqvalidator.h new file mode 120000 index 0000000..3fed4ab --- /dev/null +++ b/tqtinterface/qt4/include/tqvalidator.h @@ -0,0 +1 @@ +../src/widgets/tqvalidator.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqvaluelist.h b/tqtinterface/qt4/include/tqvaluelist.h new file mode 120000 index 0000000..863a982 --- /dev/null +++ b/tqtinterface/qt4/include/tqvaluelist.h @@ -0,0 +1 @@ +../src/tools/tqvaluelist.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqvaluestack.h b/tqtinterface/qt4/include/tqvaluestack.h new file mode 120000 index 0000000..392473e --- /dev/null +++ b/tqtinterface/qt4/include/tqvaluestack.h @@ -0,0 +1 @@ +../src/tools/tqvaluestack.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqvaluevector.h b/tqtinterface/qt4/include/tqvaluevector.h new file mode 120000 index 0000000..3cd96d3 --- /dev/null +++ b/tqtinterface/qt4/include/tqvaluevector.h @@ -0,0 +1 @@ +../src/tools/tqvaluevector.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqvariant.h b/tqtinterface/qt4/include/tqvariant.h new file mode 120000 index 0000000..5ec61c9 --- /dev/null +++ b/tqtinterface/qt4/include/tqvariant.h @@ -0,0 +1 @@ +../src/kernel/tqvariant.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqvbox.h b/tqtinterface/qt4/include/tqvbox.h new file mode 120000 index 0000000..a4d448d --- /dev/null +++ b/tqtinterface/qt4/include/tqvbox.h @@ -0,0 +1 @@ +../src/widgets/tqvbox.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqvbuttongroup.h b/tqtinterface/qt4/include/tqvbuttongroup.h new file mode 120000 index 0000000..4d83d16 --- /dev/null +++ b/tqtinterface/qt4/include/tqvbuttongroup.h @@ -0,0 +1 @@ +../src/widgets/tqvbuttongroup.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqvector.h b/tqtinterface/qt4/include/tqvector.h new file mode 120000 index 0000000..cd1a7a8 --- /dev/null +++ b/tqtinterface/qt4/include/tqvector.h @@ -0,0 +1 @@ +../src/compat/tqvector.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqvfbhdr.h b/tqtinterface/qt4/include/tqvfbhdr.h new file mode 120000 index 0000000..572435b --- /dev/null +++ b/tqtinterface/qt4/include/tqvfbhdr.h @@ -0,0 +1 @@ +../src/kernel/tqvfbhdr.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqvgroupbox.h b/tqtinterface/qt4/include/tqvgroupbox.h new file mode 120000 index 0000000..9db6009 --- /dev/null +++ b/tqtinterface/qt4/include/tqvgroupbox.h @@ -0,0 +1 @@ +../src/widgets/tqvgroupbox.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqwaitcondition.h b/tqtinterface/qt4/include/tqwaitcondition.h new file mode 120000 index 0000000..3734541 --- /dev/null +++ b/tqtinterface/qt4/include/tqwaitcondition.h @@ -0,0 +1 @@ +../src/tools/tqwaitcondition.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqwhatsthis.h b/tqtinterface/qt4/include/tqwhatsthis.h new file mode 120000 index 0000000..80c9d08 --- /dev/null +++ b/tqtinterface/qt4/include/tqwhatsthis.h @@ -0,0 +1 @@ +../src/widgets/tqwhatsthis.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqwidcoll.h b/tqtinterface/qt4/include/tqwidcoll.h new file mode 120000 index 0000000..934f577 --- /dev/null +++ b/tqtinterface/qt4/include/tqwidcoll.h @@ -0,0 +1 @@ +../src/compat/tqwidcoll.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqwidget.h b/tqtinterface/qt4/include/tqwidget.h new file mode 120000 index 0000000..b63873f --- /dev/null +++ b/tqtinterface/qt4/include/tqwidget.h @@ -0,0 +1 @@ +../src/kernel/tqwidget.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqwidgetfactory.h b/tqtinterface/qt4/include/tqwidgetfactory.h new file mode 120000 index 0000000..6f48808 --- /dev/null +++ b/tqtinterface/qt4/include/tqwidgetfactory.h @@ -0,0 +1 @@ +../tools/designer/uilib/tqwidgetfactory.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqwidgetintdict.h b/tqtinterface/qt4/include/tqwidgetintdict.h new file mode 120000 index 0000000..f3c80fb --- /dev/null +++ b/tqtinterface/qt4/include/tqwidgetintdict.h @@ -0,0 +1 @@ +../src/kernel/tqwidgetintdict.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqwidgetlist.h b/tqtinterface/qt4/include/tqwidgetlist.h new file mode 120000 index 0000000..7a02e5f --- /dev/null +++ b/tqtinterface/qt4/include/tqwidgetlist.h @@ -0,0 +1 @@ +../src/kernel/tqwidgetlist.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqwidgetplugin.h b/tqtinterface/qt4/include/tqwidgetplugin.h new file mode 120000 index 0000000..6f58aa9 --- /dev/null +++ b/tqtinterface/qt4/include/tqwidgetplugin.h @@ -0,0 +1 @@ +../src/widgets/tqwidgetplugin.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqwidgetstack.h b/tqtinterface/qt4/include/tqwidgetstack.h new file mode 120000 index 0000000..63f636c --- /dev/null +++ b/tqtinterface/qt4/include/tqwidgetstack.h @@ -0,0 +1 @@ +../src/widgets/tqwidgetstack.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqwindefs.h b/tqtinterface/qt4/include/tqwindefs.h new file mode 120000 index 0000000..0dedc3f --- /dev/null +++ b/tqtinterface/qt4/include/tqwindefs.h @@ -0,0 +1 @@ +../src/compat/tqwindefs.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqwindow.h b/tqtinterface/qt4/include/tqwindow.h new file mode 120000 index 0000000..bea1f79 --- /dev/null +++ b/tqtinterface/qt4/include/tqwindow.h @@ -0,0 +1 @@ +../src/kernel/tqwindow.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqwindowdefs.h b/tqtinterface/qt4/include/tqwindowdefs.h new file mode 120000 index 0000000..88e7308 --- /dev/null +++ b/tqtinterface/qt4/include/tqwindowdefs.h @@ -0,0 +1 @@ +../src/kernel/tqwindowdefs.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqwindowsstyle.h b/tqtinterface/qt4/include/tqwindowsstyle.h new file mode 120000 index 0000000..0738267 --- /dev/null +++ b/tqtinterface/qt4/include/tqwindowsstyle.h @@ -0,0 +1 @@ +../src/styles/tqwindowsstyle.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqwinexport.h b/tqtinterface/qt4/include/tqwinexport.h new file mode 120000 index 0000000..ff82771 --- /dev/null +++ b/tqtinterface/qt4/include/tqwinexport.h @@ -0,0 +1 @@ +../src/tools/tqwinexport.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqwizard.h b/tqtinterface/qt4/include/tqwizard.h new file mode 120000 index 0000000..ae786d1 --- /dev/null +++ b/tqtinterface/qt4/include/tqwizard.h @@ -0,0 +1 @@ +../src/dialogs/tqwizard.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqwmatrix.h b/tqtinterface/qt4/include/tqwmatrix.h new file mode 120000 index 0000000..234bbdb --- /dev/null +++ b/tqtinterface/qt4/include/tqwmatrix.h @@ -0,0 +1 @@ +../src/kernel/tqwmatrix.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqworkspace.h b/tqtinterface/qt4/include/tqworkspace.h new file mode 120000 index 0000000..731d49f --- /dev/null +++ b/tqtinterface/qt4/include/tqworkspace.h @@ -0,0 +1 @@ +../src/workspace/tqworkspace.h \ No newline at end of file diff --git a/tqtinterface/qt4/include/tqxml.h b/tqtinterface/qt4/include/tqxml.h new file mode 120000 index 0000000..a65c100 --- /dev/null +++ b/tqtinterface/qt4/include/tqxml.h @@ -0,0 +1 @@ +../src/xml/tqxml.h \ No newline at end of file -- cgit v1.2.1