From b85e85862ea9263c2a0ed994368016498e31d3eb Mon Sep 17 00:00:00 2001 From: Peter Breitenlohner Date: Sat, 17 Mar 2012 10:36:08 +0000 Subject: graphite 2.4 (svn r1250 2012-03-1419:45:41 UTC) git-svn-id: svn://tug.org/texlive/trunk@25676 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/libs/README | 7 +- Build/source/libs/graphite/ChangeLog | 8 + Build/source/libs/graphite/Makefile.am | 2 - Build/source/libs/graphite/Makefile.in | 37 +- Build/source/libs/graphite/configure | 24 +- Build/source/libs/graphite/configure.ac | 7 +- .../libs/graphite/engine-2.3.1-PATCHES/ChangeLog | 38 - .../libs/graphite/engine-2.3.1-PATCHES/TL-Changes | 19 - .../engine-2.3.1-PATCHES/patch-01-warnings | 282 - .../graphite/engine-2.3.1-PATCHES/patch-02-virtual | 21 - .../engine-2.3.1-PATCHES/patch-03-SIZEOF_WCHAR_T | 18 - .../engine-2.3.1-PATCHES/patch-04-math_h-WIN32 | 13 - .../engine-2.3.1-PATCHES/patch-05-copy-constr | 29 - .../patch-06-static-const-members | 25 - .../patch-07-stdlib-workaround | 35 - Build/source/libs/graphite/engine-2.3.1/COPYING | 1 - Build/source/libs/graphite/engine-2.3.1/INSTALL | 236 - .../source/libs/graphite/engine-2.3.1/Makefile.am | 62 - .../source/libs/graphite/engine-2.3.1/Makefile.in | 720 - Build/source/libs/graphite/engine-2.3.1/README | 32 - Build/source/libs/graphite/engine-2.3.1/TODO | 4 - Build/source/libs/graphite/engine-2.3.1/aclocal.m4 | 8811 --------- Build/source/libs/graphite/engine-2.3.1/build.bat | 1 - .../source/libs/graphite/engine-2.3.1/build_d.bat | 1 - Build/source/libs/graphite/engine-2.3.1/configure | 19424 ------------------- .../source/libs/graphite/engine-2.3.1/configure.ac | 140 - .../libs/graphite/engine-2.3.1/doc/GTF_3_0.odt | Bin 32225 -> 0 bytes .../engine-2.3.1/doc/V2_Engine_Interface.odt | Bin 35760 -> 0 bytes .../engine-2.3.1/doc/V2_Segment_Interface.odt | Bin 29879 -> 0 bytes .../engine-2.3.1/doc/V2_TextSource_Interface.odt | Bin 29230 -> 0 bytes .../libs/graphite/engine-2.3.1/doc/hungarian.txt | 126 - .../libs/graphite/engine-2.3.1/doc/policy.txt | 19 - .../libs/graphite/engine-2.3.1/include/Makefile.am | 29 - .../engine-2.3.1/include/graphite/BinTree.h | 71 - .../engine-2.3.1/include/graphite/FileFont.h | 260 - .../graphite/engine-2.3.1/include/graphite/Font.h | 416 - .../include/graphite/GenericResource.h | 86 - .../engine-2.3.1/include/graphite/GrAppData.h | 39 - .../engine-2.3.1/include/graphite/GrClient.h | 39 - .../engine-2.3.1/include/graphite/GrCommon.h | 145 - .../engine-2.3.1/include/graphite/GrConstants.h | 268 - .../engine-2.3.1/include/graphite/GrData.h | 227 - .../engine-2.3.1/include/graphite/GrDebug.h | 200 - .../graphite/engine-2.3.1/include/graphite/GrExt.h | 13 - .../engine-2.3.1/include/graphite/GrFeature.h | 203 - .../engine-2.3.1/include/graphite/GrMstypes.h | 40 - .../engine-2.3.1/include/graphite/GrPlatform.h | 189 - .../engine-2.3.1/include/graphite/GrResult.h | 171 - .../engine-2.3.1/include/graphite/GrStructs.h | 97 - .../engine-2.3.1/include/graphite/GrWrappers.h | 13 - .../include/graphite/GraphiteProcess.h | 45 - .../engine-2.3.1/include/graphite/HashMap.h | 328 - .../engine-2.3.1/include/graphite/IGrEngine.h | 36 - .../engine-2.3.1/include/graphite/IGrJustifier.h | 58 - .../include/graphite/IGraphiteProcess.h | 44 - .../engine-2.3.1/include/graphite/ITextSource.h | 69 - .../engine-2.3.1/include/graphite/MemoryUsage.h | 156 - .../engine-2.3.1/include/graphite/Segment.h | 623 - .../engine-2.3.1/include/graphite/SegmentAux.h | 392 - .../engine-2.3.1/include/graphite/SegmentPainter.h | 234 - .../libs/graphite/engine-2.3.1/installed-top.pc.in | 5 - .../graphite/engine-2.3.1/license/LICENSING.txt | 43 - .../engine-2.3.1/license/License_CPLv05.txt | 86 - .../engine-2.3.1/license/License_GPLv2.txt | 342 - .../engine-2.3.1/license/License_LGPLv21.txt | 506 - .../source/libs/graphite/engine-2.3.1/makefile.vc7 | 814 - .../source/libs/graphite/engine-2.3.1/makefile.vc8 | 814 - .../libs/graphite/engine-2.3.1/silgraphite.pc.in | 7 - .../libs/graphite/engine-2.3.1/src/Makefile.am | 22 - .../libs/graphite/engine-2.3.1/src/Makefile.in | 781 - .../graphite/engine-2.3.1/src/font/FileFont.cpp | 429 - .../libs/graphite/engine-2.3.1/src/font/Font.cpp | 949 - .../engine-2.3.1/src/font/FontTableCache.h | 52 - .../graphite/engine-2.3.1/src/font/Makefile.am | 7 - .../libs/graphite/engine-2.3.1/src/font/TtfTypes.h | 388 - .../graphite/engine-2.3.1/src/font/TtfUtil.cpp | 1937 -- .../libs/graphite/engine-2.3.1/src/font/TtfUtil.h | 147 - .../graphite/engine-2.3.1/src/generic/BinTree.h | 71 - .../engine-2.3.1/src/generic/BinTree_i.cpp | 225 - .../graphite/engine-2.3.1/src/generic/Debug.cpp | 83 - .../engine-2.3.1/src/generic/GenericResource.h | 86 - .../graphite/engine-2.3.1/src/generic/HashMap.h | 328 - .../engine-2.3.1/src/generic/HashMap_i.cpp | 561 - .../graphite/engine-2.3.1/src/generic/Makefile.am | 8 - .../graphite/engine-2.3.1/src/generic/Util.cpp | 261 - .../graphite/engine-2.3.1/src/painter/Makefile.am | 5 - .../engine-2.3.1/src/painter/SegmentPainter.cpp | 3004 --- .../engine-2.3.1/src/segment/FileInput.cpp | 266 - .../graphite/engine-2.3.1/src/segment/FileInput.h | 104 - .../engine-2.3.1/src/segment/FontCache.cpp | 308 - .../graphite/engine-2.3.1/src/segment/FontCache.h | 105 - .../graphite/engine-2.3.1/src/segment/FontFace.cpp | 598 - .../graphite/engine-2.3.1/src/segment/FontFace.h | 246 - .../engine-2.3.1/src/segment/GrCharStream.cpp | 652 - .../engine-2.3.1/src/segment/GrCharStream.h | 183 - .../engine-2.3.1/src/segment/GrClassTable.cpp | 382 - .../engine-2.3.1/src/segment/GrClassTable.h | 188 - .../graphite/engine-2.3.1/src/segment/GrEngine.cpp | 2031 -- .../graphite/engine-2.3.1/src/segment/GrEngine.h | 622 - .../graphite/engine-2.3.1/src/segment/GrFSM.cpp | 526 - .../libs/graphite/engine-2.3.1/src/segment/GrFSM.h | 245 - .../engine-2.3.1/src/segment/GrFeature.cpp | 321 - .../engine-2.3.1/src/segment/GrFeatureValues.h | 66 - .../engine-2.3.1/src/segment/GrGlyphTable.cpp | 650 - .../engine-2.3.1/src/segment/GrGlyphTable.h | 429 - .../graphite/engine-2.3.1/src/segment/GrPass.cpp | 2030 -- .../graphite/engine-2.3.1/src/segment/GrPass.h | 747 - .../engine-2.3.1/src/segment/GrPassActionCode.cpp | 1490 -- .../engine-2.3.1/src/segment/GrPseudoMap.h | 48 - .../engine-2.3.1/src/segment/GrSlotState.cpp | 1540 -- .../engine-2.3.1/src/segment/GrSlotState.h | 1315 -- .../engine-2.3.1/src/segment/GrSlotStream.cpp | 2381 --- .../engine-2.3.1/src/segment/GrSlotStream.h | 577 - .../engine-2.3.1/src/segment/GrTableManager.cpp | 2694 --- .../engine-2.3.1/src/segment/GrTableManager.h | 557 - .../libs/graphite/engine-2.3.1/src/segment/Main.h | 182 - .../graphite/engine-2.3.1/src/segment/Makefile.am | 26 - .../engine-2.3.1/src/segment/MemoryUsage.cpp | 781 - .../graphite/engine-2.3.1/src/segment/Platform.cpp | 113 - .../graphite/engine-2.3.1/src/segment/Segment.cpp | 3558 ---- .../engine-2.3.1/src/segment/SegmentAux.cpp | 256 - .../graphite/engine-2.3.1/src/segment/TestFSM.cpp | 3416 ---- .../engine-2.3.1/src/segment/TestPasses.cpp | 1005 - .../engine-2.3.1/src/segment/TransductionLog.cpp | 2129 -- .../graphite/engine-2.3.1/src/segment/resource.h | 15 - .../libs/graphite/engine-2.3.1/test/Makefile.am | 2 - .../libs/graphite/engine-2.3.1/test/Makefile.in | 490 - .../test/ProfileHarness/GrUtfTextSrc.cpp | 310 - .../test/ProfileHarness/GrUtfTextSrc.h | 146 - .../engine-2.3.1/test/ProfileHarness/Makefile.am | 14 - .../engine-2.3.1/test/ProfileHarness/Makefile.in | 462 - .../test/ProfileHarness/ProfileHarness.cpp | 476 - .../test/RegressionTest/GrJustifier.cpp | 566 - .../engine-2.3.1/test/RegressionTest/GrJustifier.h | 82 - .../engine-2.3.1/test/RegressionTest/Makefile.am | 38 - .../engine-2.3.1/test/RegressionTest/Makefile.in | 495 - .../engine-2.3.1/test/RegressionTest/Makefile.vc | 121 - .../test/RegressionTest/RegressionTest.cpp | 749 - .../engine-2.3.1/test/RegressionTest/RtTextSrc.h | 74 - .../test/RegressionTest/SimpleTextSrc.cpp | 93 - .../test/RegressionTest/SimpleTextSrc.h | 113 - .../engine-2.3.1/test/RegressionTest/TestCase.cpp | 1985 -- .../engine-2.3.1/test/RegressionTest/TestCase.h | 245 - .../test/RegressionTest/burmeseText.wpx | 138 - .../test/RegressionTest/grtest_arabic.ttf | Bin 304748 -> 0 bytes .../test/RegressionTest/grtest_badCmap.ttf | Bin 1013012 -> 0 bytes .../test/RegressionTest/grtest_badVersion.ttf | Bin 58160 -> 0 bytes .../test/RegressionTest/grtest_burmese.ttf | Bin 176660 -> 0 bytes .../test/RegressionTest/grtest_roman.ttf | Bin 1069592 -> 0 bytes .../test/RegressionTest/grtest_taiviet.ttf | Bin 115564 -> 0 bytes .../test/RegressionTest/grtest_xline.ttf | Bin 61132 -> 0 bytes .../engine-2.3.1/test/RegressionTest/main.h | 90 - .../engine-2.3.1/test/RegressionTest/makedebug.bat | 2 - .../engine-2.3.1/test/RegressionTest/readme.txt | 19 - .../engine-2.3.1/test/RegressionTest/romanText.wpx | 206 - .../engine-2.3.1/test/RegressionTest/stdafx.cpp | 8 - .../engine-2.3.1/test/RegressionTest/stdafx.h | 12 - .../engine-2.3.1/test/RegressionTest/xline.gdl | 146 - .../engine-2.3.1/test/RegressionTest/xlineText.wpx | 132 - .../engine-2.3.1/test/fonterrors/errBadGloc.ttf | Bin 57988 -> 0 bytes .../engine-2.3.1/test/fonterrors/errBadGloc2.ttf | Bin 57996 -> 0 bytes .../engine-2.3.1/test/fonterrors/errBadPass.ttf | Bin 58132 -> 0 bytes .../test/fonterrors/errBadStackMachine.ttf | Bin 58216 -> 0 bytes .../engine-2.3.1/test/fonterrors/errBadSubs.ttf | Bin 58132 -> 0 bytes .../engine-2.3.1/test/fonterrors/errBadVersion.ttf | Bin 58160 -> 0 bytes .../engine-2.3.1/test/fonterrors/errGarbageFsm.ttf | Bin 58160 -> 0 bytes .../test/fonterrors/errGarbageGlat.ttf | Bin 58144 -> 0 bytes .../test/fonterrors/errGarbageSilf.ttf | Bin 58144 -> 0 bytes .../test/fonterrors/errSilfVerMismatch.ttf | Bin 58252 -> 0 bytes .../test/fonterrors/errSubsUnderflow.ttf | Bin 58196 -> 0 bytes .../test/fonterrors/errTooManyClasses.ttf | Bin 58200 -> 0 bytes .../engine-2.3.1/test/fonterrors/fonterrors.gdl | 43 - .../engine-2.3.1/test/fonterrors/readme.txt | 43 - .../graphite/engine-2.3.1/uninstalled-top.pc.in | 6 - .../libs/graphite/engine-2.4-PATCHES/ChangeLog | 55 + .../libs/graphite/engine-2.4-PATCHES/TL-Changes | 24 + .../graphite/engine-2.4-PATCHES/patch-01-warnings | 255 + .../engine-2.4-PATCHES/patch-05-copy-constr | 29 + .../patch-06-static-const-members | 25 + .../engine-2.4-PATCHES/patch-07-stdlib-workaround | 23 + .../engine-2.4-PATCHES/patch-08-case-sensitive | 12 + .../source/libs/graphite/engine-2.4/CMakeLists.txt | 26 + Build/source/libs/graphite/engine-2.4/COPYING | 1 + Build/source/libs/graphite/engine-2.4/INSTALL | 236 + Build/source/libs/graphite/engine-2.4/Makefile.am | 62 + Build/source/libs/graphite/engine-2.4/README | 32 + Build/source/libs/graphite/engine-2.4/TODO | 4 + Build/source/libs/graphite/engine-2.4/build.bat | 2 + Build/source/libs/graphite/engine-2.4/build_d.bat | 2 + .../libs/graphite/engine-2.4/build_d_vc8.bat | 2 + .../source/libs/graphite/engine-2.4/build_vc8.bat | 2 + Build/source/libs/graphite/engine-2.4/configure.ac | 140 + .../libs/graphite/engine-2.4/debian/changelog | 186 + .../source/libs/graphite/engine-2.4/debian/compat | 1 + .../source/libs/graphite/engine-2.4/debian/control | 83 + .../libs/graphite/engine-2.4/debian/copyright | 259 + .../engine-2.4/debian/libgraphite-dev.dirs | 4 + .../engine-2.4/debian/libgraphite-dev.docs | 5 + .../engine-2.4/debian/libgraphite-dev.install | 4 + Build/source/libs/graphite/engine-2.4/debian/rules | 12 + Build/source/libs/graphite/engine-2.4/doc/GTF.odt | Bin 0 -> 40855 bytes .../libs/graphite/engine-2.4/doc/GTF_1_0.pdf | Bin 0 -> 34561 bytes .../libs/graphite/engine-2.4/doc/GTF_2_0.pdf | Bin 0 -> 39553 bytes .../libs/graphite/engine-2.4/doc/GTF_3_0.pdf | Bin 0 -> 49403 bytes .../libs/graphite/engine-2.4/doc/GTF_4.0.pdf | Bin 0 -> 49056 bytes .../engine-2.4/doc/Stack Machine Commands_3_0.pdf | Bin 0 -> 19832 bytes .../engine-2.4/doc/V2_Engine_Interface.odt | Bin 0 -> 34025 bytes .../engine-2.4/doc/V2_Segment_Interface.odt | Bin 0 -> 38136 bytes .../engine-2.4/doc/V2_TextSource_Interface.odt | Bin 0 -> 29230 bytes .../libs/graphite/engine-2.4/doc/hungarian.txt | 126 + .../source/libs/graphite/engine-2.4/doc/policy.txt | 19 + .../libs/graphite/engine-2.4/include/Makefile.am | 29 + .../graphite/engine-2.4/include/graphite/BinTree.h | 71 + .../engine-2.4/include/graphite/FileFont.h | 260 + .../graphite/engine-2.4/include/graphite/Font.h | 417 + .../engine-2.4/include/graphite/GenericResource.h | 86 + .../engine-2.4/include/graphite/GrAppData.h | 39 + .../engine-2.4/include/graphite/GrClient.h | 39 + .../engine-2.4/include/graphite/GrCommon.h | 101 + .../engine-2.4/include/graphite/GrConstants.h | 279 + .../graphite/engine-2.4/include/graphite/GrData.h | 197 + .../graphite/engine-2.4/include/graphite/GrDebug.h | 200 + .../graphite/engine-2.4/include/graphite/GrExt.h | 13 + .../engine-2.4/include/graphite/GrFeature.h | 203 + .../engine-2.4/include/graphite/GrMstypes.h | 40 + .../engine-2.4/include/graphite/GrPlatform.h | 192 + .../engine-2.4/include/graphite/GrResult.h | 171 + .../engine-2.4/include/graphite/GrStructs.h | 97 + .../engine-2.4/include/graphite/GrWrappers.h | 13 + .../engine-2.4/include/graphite/GraphiteProcess.h | 45 + .../graphite/engine-2.4/include/graphite/HashMap.h | 328 + .../engine-2.4/include/graphite/IGrEngine.h | 36 + .../engine-2.4/include/graphite/IGrJustifier.h | 58 + .../engine-2.4/include/graphite/IGraphiteProcess.h | 44 + .../engine-2.4/include/graphite/ITextSource.h | 70 + .../engine-2.4/include/graphite/MemoryUsage.h | 156 + .../graphite/engine-2.4/include/graphite/Segment.h | 623 + .../engine-2.4/include/graphite/SegmentAux.h | 419 + .../engine-2.4/include/graphite/SegmentPainter.h | 234 + .../libs/graphite/engine-2.4/installed-top.pc.in | 5 + .../libs/graphite/engine-2.4/license/LICENSING.txt | 43 + .../graphite/engine-2.4/license/License_CPLv05.txt | 86 + .../graphite/engine-2.4/license/License_GPLv2.txt | 342 + .../engine-2.4/license/License_LGPLv21.txt | 506 + Build/source/libs/graphite/engine-2.4/makefile.vc7 | 814 + Build/source/libs/graphite/engine-2.4/makefile.vc8 | 814 + .../libs/graphite/engine-2.4/silgraphite.pc.in | 7 + .../libs/graphite/engine-2.4/src/CMakeLists.txt | 94 + .../libs/graphite/engine-2.4/src/Makefile.am | 22 + .../libs/graphite/engine-2.4/src/font/FileFont.cpp | 429 + .../libs/graphite/engine-2.4/src/font/Font.cpp | 942 + .../graphite/engine-2.4/src/font/FontTableCache.h | 52 + .../libs/graphite/engine-2.4/src/font/Makefile.am | 7 + .../libs/graphite/engine-2.4/src/font/TtfTypes.h | 388 + .../libs/graphite/engine-2.4/src/font/TtfUtil.cpp | 1964 ++ .../libs/graphite/engine-2.4/src/font/TtfUtil.h | 153 + .../libs/graphite/engine-2.4/src/generic/BinTree.h | 71 + .../graphite/engine-2.4/src/generic/BinTree_i.cpp | 225 + .../libs/graphite/engine-2.4/src/generic/Debug.cpp | 81 + .../engine-2.4/src/generic/GenericResource.h | 86 + .../libs/graphite/engine-2.4/src/generic/HashMap.h | 328 + .../graphite/engine-2.4/src/generic/HashMap_i.cpp | 561 + .../graphite/engine-2.4/src/generic/Makefile.am | 8 + .../libs/graphite/engine-2.4/src/generic/Util.cpp | 261 + .../graphite/engine-2.4/src/painter/Makefile.am | 5 + .../engine-2.4/src/painter/SegmentPainter.cpp | 3011 +++ .../graphite/engine-2.4/src/segment/FileInput.cpp | 269 + .../graphite/engine-2.4/src/segment/FileInput.h | 104 + .../graphite/engine-2.4/src/segment/FontCache.cpp | 305 + .../graphite/engine-2.4/src/segment/FontCache.h | 105 + .../graphite/engine-2.4/src/segment/FontFace.cpp | 596 + .../graphite/engine-2.4/src/segment/FontFace.h | 246 + .../engine-2.4/src/segment/GrCharStream.cpp | 653 + .../graphite/engine-2.4/src/segment/GrCharStream.h | 183 + .../engine-2.4/src/segment/GrClassTable.cpp | 269 + .../graphite/engine-2.4/src/segment/GrClassTable.h | 179 + .../graphite/engine-2.4/src/segment/GrEngine.cpp | 1984 ++ .../graphite/engine-2.4/src/segment/GrEngine.h | 605 + .../libs/graphite/engine-2.4/src/segment/GrFSM.cpp | 545 + .../libs/graphite/engine-2.4/src/segment/GrFSM.h | 229 + .../graphite/engine-2.4/src/segment/GrFeature.cpp | 328 + .../engine-2.4/src/segment/GrFeatureValues.h | 66 + .../engine-2.4/src/segment/GrGlyphTable.cpp | 509 + .../graphite/engine-2.4/src/segment/GrGlyphTable.h | 421 + .../graphite/engine-2.4/src/segment/GrPass.cpp | 2113 ++ .../libs/graphite/engine-2.4/src/segment/GrPass.h | 666 + .../engine-2.4/src/segment/GrPassActionCode.cpp | 1511 ++ .../graphite/engine-2.4/src/segment/GrPseudoMap.h | 48 + .../engine-2.4/src/segment/GrSlotState.cpp | 1563 ++ .../graphite/engine-2.4/src/segment/GrSlotState.h | 1331 ++ .../engine-2.4/src/segment/GrSlotStream.cpp | 2461 +++ .../graphite/engine-2.4/src/segment/GrSlotStream.h | 586 + .../engine-2.4/src/segment/GrTableManager.cpp | 2712 +++ .../engine-2.4/src/segment/GrTableManager.h | 568 + .../libs/graphite/engine-2.4/src/segment/Main.h | 189 + .../graphite/engine-2.4/src/segment/Makefile.am | 24 + .../engine-2.4/src/segment/MemoryUsage.cpp | 779 + .../graphite/engine-2.4/src/segment/Platform.cpp | 113 + .../graphite/engine-2.4/src/segment/Segment.cpp | 3577 ++++ .../graphite/engine-2.4/src/segment/SegmentAux.cpp | 252 + .../engine-2.4/src/segment/TransductionLog.cpp | 2187 +++ .../graphite/engine-2.4/src/segment/resource.h | 15 + .../libs/graphite/engine-2.4/test/Makefile.am | 2 + .../engine-2.4/test/ProfileHarness/CMakeLists.txt | 8 + .../test/ProfileHarness/GrUtfTextSrc.cpp | 310 + .../engine-2.4/test/ProfileHarness/GrUtfTextSrc.h | 147 + .../engine-2.4/test/ProfileHarness/Makefile.am | 14 + .../test/ProfileHarness/ProfileHarness.cpp | 476 + .../engine-2.4/test/ProfileHarness/makefile.vc | 111 + .../engine-2.4/test/RegressionTest/CMakeLists.txt | 14 + .../engine-2.4/test/RegressionTest/GrJustifier.cpp | 563 + .../engine-2.4/test/RegressionTest/GrJustifier.h | 82 + .../engine-2.4/test/RegressionTest/Makefile.am | 41 + .../engine-2.4/test/RegressionTest/Makefile.vc | 121 + .../engine-2.4/test/RegressionTest/Makefile.vc8 | 120 + .../test/RegressionTest/RegressionTest.cpp | 755 + .../engine-2.4/test/RegressionTest/RtTextSrc.h | 74 + .../test/RegressionTest/SimpleTextSrc.cpp | 90 + .../engine-2.4/test/RegressionTest/SimpleTextSrc.h | 119 + .../engine-2.4/test/RegressionTest/TestCase.cpp | 2650 +++ .../engine-2.4/test/RegressionTest/TestCase.h | 256 + .../engine-2.4/test/RegressionTest/arabicText.wpx | 137 + .../test/RegressionTest/bridgingStackingText.wpx | 158 + .../test/RegressionTest/burmese2Position.wpx | 167 + .../test/RegressionTest/burmeseFeature.wpx | 185 + .../engine-2.4/test/RegressionTest/burmeseText.wpx | 138 + .../test/RegressionTest/devanagariText.wpx | 144 + .../test/RegressionTest/grtest_arabic.ttf | Bin 0 -> 304748 bytes .../test/RegressionTest/grtest_badCmap.ttf | Bin 0 -> 1013012 bytes .../test/RegressionTest/grtest_badVersion.ttf | Bin 0 -> 58160 bytes .../test/RegressionTest/grtest_burmese.ttf | Bin 0 -> 176660 bytes .../test/RegressionTest/grtest_burmese2.ttf | Bin 0 -> 418312 bytes .../test/RegressionTest/grtest_burmese3.ttf | Bin 0 -> 419228 bytes .../test/RegressionTest/grtest_devanagari.ttf | Bin 0 -> 471952 bytes .../test/RegressionTest/grtest_kernglat2.ttf | Bin 0 -> 1469552 bytes .../test/RegressionTest/grtest_pconstraints.ttf | Bin 0 -> 1360576 bytes .../test/RegressionTest/grtest_roman.ttf | Bin 0 -> 1069592 bytes .../test/RegressionTest/grtest_taiviet.ttf | Bin 0 -> 115564 bytes .../test/RegressionTest/grtest_xline.ttf | Bin 0 -> 61132 bytes .../graphite/engine-2.4/test/RegressionTest/main.h | 102 + .../engine-2.4/test/RegressionTest/makedebug.bat | 2 + .../engine-2.4/test/RegressionTest/readme.txt | 19 + .../engine-2.4/test/RegressionTest/romanText.wpx | 206 + .../engine-2.4/test/RegressionTest/stdafx.cpp | 8 + .../engine-2.4/test/RegressionTest/stdafx.h | 12 + .../engine-2.4/test/RegressionTest/taivietText.wpx | 162 + .../engine-2.4/test/RegressionTest/xline.gdl | 146 + .../engine-2.4/test/RegressionTest/xlineText.wpx | 132 + .../engine-2.4/test/examples/burmese/Padauk.ttf | Bin 0 -> 232884 bytes .../engine-2.4/test/examples/burmese/bh1.utx | 4 + .../engine-2.4/test/examples/khmer/cloudsku2.txt | 29 + .../engine-2.4/test/examples/khmer/mond40gr6.ttf | Bin 0 -> 906948 bytes .../engine-2.4/test/fonterrors/errBadGloc.ttf | Bin 0 -> 57988 bytes .../engine-2.4/test/fonterrors/errBadGloc2.ttf | Bin 0 -> 57996 bytes .../engine-2.4/test/fonterrors/errBadPass.ttf | Bin 0 -> 58132 bytes .../test/fonterrors/errBadStackMachine.ttf | Bin 0 -> 58216 bytes .../engine-2.4/test/fonterrors/errBadSubs.ttf | Bin 0 -> 58132 bytes .../engine-2.4/test/fonterrors/errBadVersion.ttf | Bin 0 -> 58160 bytes .../engine-2.4/test/fonterrors/errGarbageFsm.ttf | Bin 0 -> 58160 bytes .../engine-2.4/test/fonterrors/errGarbageGlat.ttf | Bin 0 -> 58144 bytes .../engine-2.4/test/fonterrors/errGarbageSilf.ttf | Bin 0 -> 58144 bytes .../test/fonterrors/errSilfVerMismatch.ttf | Bin 0 -> 58252 bytes .../test/fonterrors/errSubsUnderflow.ttf | Bin 0 -> 58196 bytes .../test/fonterrors/errTooManyClasses.ttf | Bin 0 -> 58200 bytes .../engine-2.4/test/fonterrors/fonterrors.gdl | 43 + .../graphite/engine-2.4/test/fonterrors/readme.txt | 43 + .../libs/graphite/engine-2.4/uninstalled-top.pc.in | 6 + .../libs/graphite/include/graphite/Makefile.in | 2 +- Build/source/libs/graphite/version.ac | 11 + 369 files changed, 53524 insertions(+), 86654 deletions(-) delete mode 100644 Build/source/libs/graphite/engine-2.3.1-PATCHES/ChangeLog delete mode 100644 Build/source/libs/graphite/engine-2.3.1-PATCHES/TL-Changes delete mode 100644 Build/source/libs/graphite/engine-2.3.1-PATCHES/patch-01-warnings delete mode 100644 Build/source/libs/graphite/engine-2.3.1-PATCHES/patch-02-virtual delete mode 100644 Build/source/libs/graphite/engine-2.3.1-PATCHES/patch-03-SIZEOF_WCHAR_T delete mode 100644 Build/source/libs/graphite/engine-2.3.1-PATCHES/patch-04-math_h-WIN32 delete mode 100644 Build/source/libs/graphite/engine-2.3.1-PATCHES/patch-05-copy-constr delete mode 100644 Build/source/libs/graphite/engine-2.3.1-PATCHES/patch-06-static-const-members delete mode 100644 Build/source/libs/graphite/engine-2.3.1-PATCHES/patch-07-stdlib-workaround delete mode 100644 Build/source/libs/graphite/engine-2.3.1/COPYING delete mode 100644 Build/source/libs/graphite/engine-2.3.1/INSTALL delete mode 100644 Build/source/libs/graphite/engine-2.3.1/Makefile.am delete mode 100644 Build/source/libs/graphite/engine-2.3.1/Makefile.in delete mode 100644 Build/source/libs/graphite/engine-2.3.1/README delete mode 100644 Build/source/libs/graphite/engine-2.3.1/TODO delete mode 100644 Build/source/libs/graphite/engine-2.3.1/aclocal.m4 delete mode 100644 Build/source/libs/graphite/engine-2.3.1/build.bat delete mode 100644 Build/source/libs/graphite/engine-2.3.1/build_d.bat delete mode 100755 Build/source/libs/graphite/engine-2.3.1/configure delete mode 100644 Build/source/libs/graphite/engine-2.3.1/configure.ac delete mode 100644 Build/source/libs/graphite/engine-2.3.1/doc/GTF_3_0.odt delete mode 100644 Build/source/libs/graphite/engine-2.3.1/doc/V2_Engine_Interface.odt delete mode 100644 Build/source/libs/graphite/engine-2.3.1/doc/V2_Segment_Interface.odt delete mode 100644 Build/source/libs/graphite/engine-2.3.1/doc/V2_TextSource_Interface.odt delete mode 100644 Build/source/libs/graphite/engine-2.3.1/doc/hungarian.txt delete mode 100644 Build/source/libs/graphite/engine-2.3.1/doc/policy.txt delete mode 100644 Build/source/libs/graphite/engine-2.3.1/include/Makefile.am delete mode 100644 Build/source/libs/graphite/engine-2.3.1/include/graphite/BinTree.h delete mode 100644 Build/source/libs/graphite/engine-2.3.1/include/graphite/FileFont.h delete mode 100644 Build/source/libs/graphite/engine-2.3.1/include/graphite/Font.h delete mode 100644 Build/source/libs/graphite/engine-2.3.1/include/graphite/GenericResource.h delete mode 100644 Build/source/libs/graphite/engine-2.3.1/include/graphite/GrAppData.h delete mode 100644 Build/source/libs/graphite/engine-2.3.1/include/graphite/GrClient.h delete mode 100644 Build/source/libs/graphite/engine-2.3.1/include/graphite/GrCommon.h delete mode 100644 Build/source/libs/graphite/engine-2.3.1/include/graphite/GrConstants.h delete mode 100644 Build/source/libs/graphite/engine-2.3.1/include/graphite/GrData.h delete mode 100644 Build/source/libs/graphite/engine-2.3.1/include/graphite/GrDebug.h delete mode 100644 Build/source/libs/graphite/engine-2.3.1/include/graphite/GrExt.h delete mode 100644 Build/source/libs/graphite/engine-2.3.1/include/graphite/GrFeature.h delete mode 100644 Build/source/libs/graphite/engine-2.3.1/include/graphite/GrMstypes.h delete mode 100644 Build/source/libs/graphite/engine-2.3.1/include/graphite/GrPlatform.h delete mode 100644 Build/source/libs/graphite/engine-2.3.1/include/graphite/GrResult.h delete mode 100644 Build/source/libs/graphite/engine-2.3.1/include/graphite/GrStructs.h delete mode 100644 Build/source/libs/graphite/engine-2.3.1/include/graphite/GrWrappers.h delete mode 100644 Build/source/libs/graphite/engine-2.3.1/include/graphite/GraphiteProcess.h delete mode 100644 Build/source/libs/graphite/engine-2.3.1/include/graphite/HashMap.h delete mode 100644 Build/source/libs/graphite/engine-2.3.1/include/graphite/IGrEngine.h delete mode 100644 Build/source/libs/graphite/engine-2.3.1/include/graphite/IGrJustifier.h delete mode 100644 Build/source/libs/graphite/engine-2.3.1/include/graphite/IGraphiteProcess.h delete mode 100644 Build/source/libs/graphite/engine-2.3.1/include/graphite/ITextSource.h delete mode 100644 Build/source/libs/graphite/engine-2.3.1/include/graphite/MemoryUsage.h delete mode 100644 Build/source/libs/graphite/engine-2.3.1/include/graphite/Segment.h delete mode 100644 Build/source/libs/graphite/engine-2.3.1/include/graphite/SegmentAux.h delete mode 100644 Build/source/libs/graphite/engine-2.3.1/include/graphite/SegmentPainter.h delete mode 100644 Build/source/libs/graphite/engine-2.3.1/installed-top.pc.in delete mode 100644 Build/source/libs/graphite/engine-2.3.1/license/LICENSING.txt delete mode 100644 Build/source/libs/graphite/engine-2.3.1/license/License_CPLv05.txt delete mode 100644 Build/source/libs/graphite/engine-2.3.1/license/License_GPLv2.txt delete mode 100644 Build/source/libs/graphite/engine-2.3.1/license/License_LGPLv21.txt delete mode 100644 Build/source/libs/graphite/engine-2.3.1/makefile.vc7 delete mode 100644 Build/source/libs/graphite/engine-2.3.1/makefile.vc8 delete mode 100644 Build/source/libs/graphite/engine-2.3.1/silgraphite.pc.in delete mode 100644 Build/source/libs/graphite/engine-2.3.1/src/Makefile.am delete mode 100644 Build/source/libs/graphite/engine-2.3.1/src/Makefile.in delete mode 100644 Build/source/libs/graphite/engine-2.3.1/src/font/FileFont.cpp delete mode 100644 Build/source/libs/graphite/engine-2.3.1/src/font/Font.cpp delete mode 100644 Build/source/libs/graphite/engine-2.3.1/src/font/FontTableCache.h delete mode 100644 Build/source/libs/graphite/engine-2.3.1/src/font/Makefile.am delete mode 100644 Build/source/libs/graphite/engine-2.3.1/src/font/TtfTypes.h delete mode 100644 Build/source/libs/graphite/engine-2.3.1/src/font/TtfUtil.cpp delete mode 100644 Build/source/libs/graphite/engine-2.3.1/src/font/TtfUtil.h delete mode 100644 Build/source/libs/graphite/engine-2.3.1/src/generic/BinTree.h delete mode 100644 Build/source/libs/graphite/engine-2.3.1/src/generic/BinTree_i.cpp delete mode 100644 Build/source/libs/graphite/engine-2.3.1/src/generic/Debug.cpp delete mode 100644 Build/source/libs/graphite/engine-2.3.1/src/generic/GenericResource.h delete mode 100644 Build/source/libs/graphite/engine-2.3.1/src/generic/HashMap.h delete mode 100644 Build/source/libs/graphite/engine-2.3.1/src/generic/HashMap_i.cpp delete mode 100644 Build/source/libs/graphite/engine-2.3.1/src/generic/Makefile.am delete mode 100644 Build/source/libs/graphite/engine-2.3.1/src/generic/Util.cpp delete mode 100644 Build/source/libs/graphite/engine-2.3.1/src/painter/Makefile.am delete mode 100644 Build/source/libs/graphite/engine-2.3.1/src/painter/SegmentPainter.cpp delete mode 100644 Build/source/libs/graphite/engine-2.3.1/src/segment/FileInput.cpp delete mode 100644 Build/source/libs/graphite/engine-2.3.1/src/segment/FileInput.h delete mode 100644 Build/source/libs/graphite/engine-2.3.1/src/segment/FontCache.cpp delete mode 100644 Build/source/libs/graphite/engine-2.3.1/src/segment/FontCache.h delete mode 100644 Build/source/libs/graphite/engine-2.3.1/src/segment/FontFace.cpp delete mode 100644 Build/source/libs/graphite/engine-2.3.1/src/segment/FontFace.h delete mode 100644 Build/source/libs/graphite/engine-2.3.1/src/segment/GrCharStream.cpp delete mode 100644 Build/source/libs/graphite/engine-2.3.1/src/segment/GrCharStream.h delete mode 100644 Build/source/libs/graphite/engine-2.3.1/src/segment/GrClassTable.cpp delete mode 100644 Build/source/libs/graphite/engine-2.3.1/src/segment/GrClassTable.h delete mode 100644 Build/source/libs/graphite/engine-2.3.1/src/segment/GrEngine.cpp delete mode 100644 Build/source/libs/graphite/engine-2.3.1/src/segment/GrEngine.h delete mode 100644 Build/source/libs/graphite/engine-2.3.1/src/segment/GrFSM.cpp delete mode 100644 Build/source/libs/graphite/engine-2.3.1/src/segment/GrFSM.h delete mode 100644 Build/source/libs/graphite/engine-2.3.1/src/segment/GrFeature.cpp delete mode 100644 Build/source/libs/graphite/engine-2.3.1/src/segment/GrFeatureValues.h delete mode 100644 Build/source/libs/graphite/engine-2.3.1/src/segment/GrGlyphTable.cpp delete mode 100644 Build/source/libs/graphite/engine-2.3.1/src/segment/GrGlyphTable.h delete mode 100644 Build/source/libs/graphite/engine-2.3.1/src/segment/GrPass.cpp delete mode 100644 Build/source/libs/graphite/engine-2.3.1/src/segment/GrPass.h delete mode 100644 Build/source/libs/graphite/engine-2.3.1/src/segment/GrPassActionCode.cpp delete mode 100644 Build/source/libs/graphite/engine-2.3.1/src/segment/GrPseudoMap.h delete mode 100644 Build/source/libs/graphite/engine-2.3.1/src/segment/GrSlotState.cpp delete mode 100644 Build/source/libs/graphite/engine-2.3.1/src/segment/GrSlotState.h delete mode 100644 Build/source/libs/graphite/engine-2.3.1/src/segment/GrSlotStream.cpp delete mode 100644 Build/source/libs/graphite/engine-2.3.1/src/segment/GrSlotStream.h delete mode 100644 Build/source/libs/graphite/engine-2.3.1/src/segment/GrTableManager.cpp delete mode 100644 Build/source/libs/graphite/engine-2.3.1/src/segment/GrTableManager.h delete mode 100644 Build/source/libs/graphite/engine-2.3.1/src/segment/Main.h delete mode 100644 Build/source/libs/graphite/engine-2.3.1/src/segment/Makefile.am delete mode 100644 Build/source/libs/graphite/engine-2.3.1/src/segment/MemoryUsage.cpp delete mode 100644 Build/source/libs/graphite/engine-2.3.1/src/segment/Platform.cpp delete mode 100644 Build/source/libs/graphite/engine-2.3.1/src/segment/Segment.cpp delete mode 100644 Build/source/libs/graphite/engine-2.3.1/src/segment/SegmentAux.cpp delete mode 100644 Build/source/libs/graphite/engine-2.3.1/src/segment/TestFSM.cpp delete mode 100644 Build/source/libs/graphite/engine-2.3.1/src/segment/TestPasses.cpp delete mode 100644 Build/source/libs/graphite/engine-2.3.1/src/segment/TransductionLog.cpp delete mode 100644 Build/source/libs/graphite/engine-2.3.1/src/segment/resource.h delete mode 100644 Build/source/libs/graphite/engine-2.3.1/test/Makefile.am delete mode 100644 Build/source/libs/graphite/engine-2.3.1/test/Makefile.in delete mode 100644 Build/source/libs/graphite/engine-2.3.1/test/ProfileHarness/GrUtfTextSrc.cpp delete mode 100644 Build/source/libs/graphite/engine-2.3.1/test/ProfileHarness/GrUtfTextSrc.h delete mode 100644 Build/source/libs/graphite/engine-2.3.1/test/ProfileHarness/Makefile.am delete mode 100644 Build/source/libs/graphite/engine-2.3.1/test/ProfileHarness/Makefile.in delete mode 100644 Build/source/libs/graphite/engine-2.3.1/test/ProfileHarness/ProfileHarness.cpp delete mode 100644 Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/GrJustifier.cpp delete mode 100644 Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/GrJustifier.h delete mode 100644 Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/Makefile.am delete mode 100644 Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/Makefile.in delete mode 100644 Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/Makefile.vc delete mode 100644 Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/RegressionTest.cpp delete mode 100644 Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/RtTextSrc.h delete mode 100644 Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/SimpleTextSrc.cpp delete mode 100644 Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/SimpleTextSrc.h delete mode 100644 Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/TestCase.cpp delete mode 100644 Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/TestCase.h delete mode 100644 Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/burmeseText.wpx delete mode 100644 Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/grtest_arabic.ttf delete mode 100644 Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/grtest_badCmap.ttf delete mode 100644 Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/grtest_badVersion.ttf delete mode 100644 Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/grtest_burmese.ttf delete mode 100644 Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/grtest_roman.ttf delete mode 100644 Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/grtest_taiviet.ttf delete mode 100644 Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/grtest_xline.ttf delete mode 100644 Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/main.h delete mode 100644 Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/makedebug.bat delete mode 100644 Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/readme.txt delete mode 100644 Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/romanText.wpx delete mode 100644 Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/stdafx.cpp delete mode 100644 Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/stdafx.h delete mode 100644 Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/xline.gdl delete mode 100644 Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/xlineText.wpx delete mode 100644 Build/source/libs/graphite/engine-2.3.1/test/fonterrors/errBadGloc.ttf delete mode 100644 Build/source/libs/graphite/engine-2.3.1/test/fonterrors/errBadGloc2.ttf delete mode 100644 Build/source/libs/graphite/engine-2.3.1/test/fonterrors/errBadPass.ttf delete mode 100644 Build/source/libs/graphite/engine-2.3.1/test/fonterrors/errBadStackMachine.ttf delete mode 100644 Build/source/libs/graphite/engine-2.3.1/test/fonterrors/errBadSubs.ttf delete mode 100644 Build/source/libs/graphite/engine-2.3.1/test/fonterrors/errBadVersion.ttf delete mode 100644 Build/source/libs/graphite/engine-2.3.1/test/fonterrors/errGarbageFsm.ttf delete mode 100644 Build/source/libs/graphite/engine-2.3.1/test/fonterrors/errGarbageGlat.ttf delete mode 100644 Build/source/libs/graphite/engine-2.3.1/test/fonterrors/errGarbageSilf.ttf delete mode 100644 Build/source/libs/graphite/engine-2.3.1/test/fonterrors/errSilfVerMismatch.ttf delete mode 100644 Build/source/libs/graphite/engine-2.3.1/test/fonterrors/errSubsUnderflow.ttf delete mode 100644 Build/source/libs/graphite/engine-2.3.1/test/fonterrors/errTooManyClasses.ttf delete mode 100644 Build/source/libs/graphite/engine-2.3.1/test/fonterrors/fonterrors.gdl delete mode 100644 Build/source/libs/graphite/engine-2.3.1/test/fonterrors/readme.txt delete mode 100644 Build/source/libs/graphite/engine-2.3.1/uninstalled-top.pc.in create mode 100644 Build/source/libs/graphite/engine-2.4-PATCHES/ChangeLog create mode 100644 Build/source/libs/graphite/engine-2.4-PATCHES/TL-Changes create mode 100644 Build/source/libs/graphite/engine-2.4-PATCHES/patch-01-warnings create mode 100644 Build/source/libs/graphite/engine-2.4-PATCHES/patch-05-copy-constr create mode 100644 Build/source/libs/graphite/engine-2.4-PATCHES/patch-06-static-const-members create mode 100644 Build/source/libs/graphite/engine-2.4-PATCHES/patch-07-stdlib-workaround create mode 100644 Build/source/libs/graphite/engine-2.4-PATCHES/patch-08-case-sensitive create mode 100644 Build/source/libs/graphite/engine-2.4/CMakeLists.txt create mode 100644 Build/source/libs/graphite/engine-2.4/COPYING create mode 100644 Build/source/libs/graphite/engine-2.4/INSTALL create mode 100644 Build/source/libs/graphite/engine-2.4/Makefile.am create mode 100644 Build/source/libs/graphite/engine-2.4/README create mode 100644 Build/source/libs/graphite/engine-2.4/TODO create mode 100644 Build/source/libs/graphite/engine-2.4/build.bat create mode 100644 Build/source/libs/graphite/engine-2.4/build_d.bat create mode 100755 Build/source/libs/graphite/engine-2.4/build_d_vc8.bat create mode 100755 Build/source/libs/graphite/engine-2.4/build_vc8.bat create mode 100644 Build/source/libs/graphite/engine-2.4/configure.ac create mode 100644 Build/source/libs/graphite/engine-2.4/debian/changelog create mode 100644 Build/source/libs/graphite/engine-2.4/debian/compat create mode 100644 Build/source/libs/graphite/engine-2.4/debian/control create mode 100644 Build/source/libs/graphite/engine-2.4/debian/copyright create mode 100644 Build/source/libs/graphite/engine-2.4/debian/libgraphite-dev.dirs create mode 100644 Build/source/libs/graphite/engine-2.4/debian/libgraphite-dev.docs create mode 100644 Build/source/libs/graphite/engine-2.4/debian/libgraphite-dev.install create mode 100644 Build/source/libs/graphite/engine-2.4/debian/rules create mode 100644 Build/source/libs/graphite/engine-2.4/doc/GTF.odt create mode 100644 Build/source/libs/graphite/engine-2.4/doc/GTF_1_0.pdf create mode 100644 Build/source/libs/graphite/engine-2.4/doc/GTF_2_0.pdf create mode 100644 Build/source/libs/graphite/engine-2.4/doc/GTF_3_0.pdf create mode 100644 Build/source/libs/graphite/engine-2.4/doc/GTF_4.0.pdf create mode 100644 Build/source/libs/graphite/engine-2.4/doc/Stack Machine Commands_3_0.pdf create mode 100644 Build/source/libs/graphite/engine-2.4/doc/V2_Engine_Interface.odt create mode 100644 Build/source/libs/graphite/engine-2.4/doc/V2_Segment_Interface.odt create mode 100644 Build/source/libs/graphite/engine-2.4/doc/V2_TextSource_Interface.odt create mode 100644 Build/source/libs/graphite/engine-2.4/doc/hungarian.txt create mode 100644 Build/source/libs/graphite/engine-2.4/doc/policy.txt create mode 100644 Build/source/libs/graphite/engine-2.4/include/Makefile.am create mode 100644 Build/source/libs/graphite/engine-2.4/include/graphite/BinTree.h create mode 100644 Build/source/libs/graphite/engine-2.4/include/graphite/FileFont.h create mode 100644 Build/source/libs/graphite/engine-2.4/include/graphite/Font.h create mode 100644 Build/source/libs/graphite/engine-2.4/include/graphite/GenericResource.h create mode 100644 Build/source/libs/graphite/engine-2.4/include/graphite/GrAppData.h create mode 100644 Build/source/libs/graphite/engine-2.4/include/graphite/GrClient.h create mode 100644 Build/source/libs/graphite/engine-2.4/include/graphite/GrCommon.h create mode 100644 Build/source/libs/graphite/engine-2.4/include/graphite/GrConstants.h create mode 100644 Build/source/libs/graphite/engine-2.4/include/graphite/GrData.h create mode 100644 Build/source/libs/graphite/engine-2.4/include/graphite/GrDebug.h create mode 100644 Build/source/libs/graphite/engine-2.4/include/graphite/GrExt.h create mode 100644 Build/source/libs/graphite/engine-2.4/include/graphite/GrFeature.h create mode 100644 Build/source/libs/graphite/engine-2.4/include/graphite/GrMstypes.h create mode 100644 Build/source/libs/graphite/engine-2.4/include/graphite/GrPlatform.h create mode 100644 Build/source/libs/graphite/engine-2.4/include/graphite/GrResult.h create mode 100644 Build/source/libs/graphite/engine-2.4/include/graphite/GrStructs.h create mode 100644 Build/source/libs/graphite/engine-2.4/include/graphite/GrWrappers.h create mode 100644 Build/source/libs/graphite/engine-2.4/include/graphite/GraphiteProcess.h create mode 100644 Build/source/libs/graphite/engine-2.4/include/graphite/HashMap.h create mode 100644 Build/source/libs/graphite/engine-2.4/include/graphite/IGrEngine.h create mode 100644 Build/source/libs/graphite/engine-2.4/include/graphite/IGrJustifier.h create mode 100644 Build/source/libs/graphite/engine-2.4/include/graphite/IGraphiteProcess.h create mode 100644 Build/source/libs/graphite/engine-2.4/include/graphite/ITextSource.h create mode 100644 Build/source/libs/graphite/engine-2.4/include/graphite/MemoryUsage.h create mode 100644 Build/source/libs/graphite/engine-2.4/include/graphite/Segment.h create mode 100644 Build/source/libs/graphite/engine-2.4/include/graphite/SegmentAux.h create mode 100644 Build/source/libs/graphite/engine-2.4/include/graphite/SegmentPainter.h create mode 100644 Build/source/libs/graphite/engine-2.4/installed-top.pc.in create mode 100644 Build/source/libs/graphite/engine-2.4/license/LICENSING.txt create mode 100644 Build/source/libs/graphite/engine-2.4/license/License_CPLv05.txt create mode 100644 Build/source/libs/graphite/engine-2.4/license/License_GPLv2.txt create mode 100644 Build/source/libs/graphite/engine-2.4/license/License_LGPLv21.txt create mode 100644 Build/source/libs/graphite/engine-2.4/makefile.vc7 create mode 100644 Build/source/libs/graphite/engine-2.4/makefile.vc8 create mode 100644 Build/source/libs/graphite/engine-2.4/silgraphite.pc.in create mode 100644 Build/source/libs/graphite/engine-2.4/src/CMakeLists.txt create mode 100644 Build/source/libs/graphite/engine-2.4/src/Makefile.am create mode 100644 Build/source/libs/graphite/engine-2.4/src/font/FileFont.cpp create mode 100644 Build/source/libs/graphite/engine-2.4/src/font/Font.cpp create mode 100644 Build/source/libs/graphite/engine-2.4/src/font/FontTableCache.h create mode 100644 Build/source/libs/graphite/engine-2.4/src/font/Makefile.am create mode 100644 Build/source/libs/graphite/engine-2.4/src/font/TtfTypes.h create mode 100644 Build/source/libs/graphite/engine-2.4/src/font/TtfUtil.cpp create mode 100644 Build/source/libs/graphite/engine-2.4/src/font/TtfUtil.h create mode 100644 Build/source/libs/graphite/engine-2.4/src/generic/BinTree.h create mode 100644 Build/source/libs/graphite/engine-2.4/src/generic/BinTree_i.cpp create mode 100644 Build/source/libs/graphite/engine-2.4/src/generic/Debug.cpp create mode 100644 Build/source/libs/graphite/engine-2.4/src/generic/GenericResource.h create mode 100644 Build/source/libs/graphite/engine-2.4/src/generic/HashMap.h create mode 100644 Build/source/libs/graphite/engine-2.4/src/generic/HashMap_i.cpp create mode 100644 Build/source/libs/graphite/engine-2.4/src/generic/Makefile.am create mode 100644 Build/source/libs/graphite/engine-2.4/src/generic/Util.cpp create mode 100644 Build/source/libs/graphite/engine-2.4/src/painter/Makefile.am create mode 100644 Build/source/libs/graphite/engine-2.4/src/painter/SegmentPainter.cpp create mode 100644 Build/source/libs/graphite/engine-2.4/src/segment/FileInput.cpp create mode 100644 Build/source/libs/graphite/engine-2.4/src/segment/FileInput.h create mode 100644 Build/source/libs/graphite/engine-2.4/src/segment/FontCache.cpp create mode 100644 Build/source/libs/graphite/engine-2.4/src/segment/FontCache.h create mode 100644 Build/source/libs/graphite/engine-2.4/src/segment/FontFace.cpp create mode 100644 Build/source/libs/graphite/engine-2.4/src/segment/FontFace.h create mode 100644 Build/source/libs/graphite/engine-2.4/src/segment/GrCharStream.cpp create mode 100644 Build/source/libs/graphite/engine-2.4/src/segment/GrCharStream.h create mode 100644 Build/source/libs/graphite/engine-2.4/src/segment/GrClassTable.cpp create mode 100644 Build/source/libs/graphite/engine-2.4/src/segment/GrClassTable.h create mode 100644 Build/source/libs/graphite/engine-2.4/src/segment/GrEngine.cpp create mode 100644 Build/source/libs/graphite/engine-2.4/src/segment/GrEngine.h create mode 100644 Build/source/libs/graphite/engine-2.4/src/segment/GrFSM.cpp create mode 100644 Build/source/libs/graphite/engine-2.4/src/segment/GrFSM.h create mode 100644 Build/source/libs/graphite/engine-2.4/src/segment/GrFeature.cpp create mode 100644 Build/source/libs/graphite/engine-2.4/src/segment/GrFeatureValues.h create mode 100644 Build/source/libs/graphite/engine-2.4/src/segment/GrGlyphTable.cpp create mode 100644 Build/source/libs/graphite/engine-2.4/src/segment/GrGlyphTable.h create mode 100644 Build/source/libs/graphite/engine-2.4/src/segment/GrPass.cpp create mode 100644 Build/source/libs/graphite/engine-2.4/src/segment/GrPass.h create mode 100644 Build/source/libs/graphite/engine-2.4/src/segment/GrPassActionCode.cpp create mode 100644 Build/source/libs/graphite/engine-2.4/src/segment/GrPseudoMap.h create mode 100644 Build/source/libs/graphite/engine-2.4/src/segment/GrSlotState.cpp create mode 100644 Build/source/libs/graphite/engine-2.4/src/segment/GrSlotState.h create mode 100644 Build/source/libs/graphite/engine-2.4/src/segment/GrSlotStream.cpp create mode 100644 Build/source/libs/graphite/engine-2.4/src/segment/GrSlotStream.h create mode 100644 Build/source/libs/graphite/engine-2.4/src/segment/GrTableManager.cpp create mode 100644 Build/source/libs/graphite/engine-2.4/src/segment/GrTableManager.h create mode 100644 Build/source/libs/graphite/engine-2.4/src/segment/Main.h create mode 100644 Build/source/libs/graphite/engine-2.4/src/segment/Makefile.am create mode 100644 Build/source/libs/graphite/engine-2.4/src/segment/MemoryUsage.cpp create mode 100644 Build/source/libs/graphite/engine-2.4/src/segment/Platform.cpp create mode 100644 Build/source/libs/graphite/engine-2.4/src/segment/Segment.cpp create mode 100644 Build/source/libs/graphite/engine-2.4/src/segment/SegmentAux.cpp create mode 100644 Build/source/libs/graphite/engine-2.4/src/segment/TransductionLog.cpp create mode 100644 Build/source/libs/graphite/engine-2.4/src/segment/resource.h create mode 100644 Build/source/libs/graphite/engine-2.4/test/Makefile.am create mode 100644 Build/source/libs/graphite/engine-2.4/test/ProfileHarness/CMakeLists.txt create mode 100644 Build/source/libs/graphite/engine-2.4/test/ProfileHarness/GrUtfTextSrc.cpp create mode 100644 Build/source/libs/graphite/engine-2.4/test/ProfileHarness/GrUtfTextSrc.h create mode 100644 Build/source/libs/graphite/engine-2.4/test/ProfileHarness/Makefile.am create mode 100644 Build/source/libs/graphite/engine-2.4/test/ProfileHarness/ProfileHarness.cpp create mode 100644 Build/source/libs/graphite/engine-2.4/test/ProfileHarness/makefile.vc create mode 100644 Build/source/libs/graphite/engine-2.4/test/RegressionTest/CMakeLists.txt create mode 100644 Build/source/libs/graphite/engine-2.4/test/RegressionTest/GrJustifier.cpp create mode 100644 Build/source/libs/graphite/engine-2.4/test/RegressionTest/GrJustifier.h create mode 100644 Build/source/libs/graphite/engine-2.4/test/RegressionTest/Makefile.am create mode 100644 Build/source/libs/graphite/engine-2.4/test/RegressionTest/Makefile.vc create mode 100644 Build/source/libs/graphite/engine-2.4/test/RegressionTest/Makefile.vc8 create mode 100644 Build/source/libs/graphite/engine-2.4/test/RegressionTest/RegressionTest.cpp create mode 100644 Build/source/libs/graphite/engine-2.4/test/RegressionTest/RtTextSrc.h create mode 100644 Build/source/libs/graphite/engine-2.4/test/RegressionTest/SimpleTextSrc.cpp create mode 100644 Build/source/libs/graphite/engine-2.4/test/RegressionTest/SimpleTextSrc.h create mode 100644 Build/source/libs/graphite/engine-2.4/test/RegressionTest/TestCase.cpp create mode 100644 Build/source/libs/graphite/engine-2.4/test/RegressionTest/TestCase.h create mode 100644 Build/source/libs/graphite/engine-2.4/test/RegressionTest/arabicText.wpx create mode 100644 Build/source/libs/graphite/engine-2.4/test/RegressionTest/bridgingStackingText.wpx create mode 100644 Build/source/libs/graphite/engine-2.4/test/RegressionTest/burmese2Position.wpx create mode 100644 Build/source/libs/graphite/engine-2.4/test/RegressionTest/burmeseFeature.wpx create mode 100644 Build/source/libs/graphite/engine-2.4/test/RegressionTest/burmeseText.wpx create mode 100644 Build/source/libs/graphite/engine-2.4/test/RegressionTest/devanagariText.wpx create mode 100644 Build/source/libs/graphite/engine-2.4/test/RegressionTest/grtest_arabic.ttf create mode 100644 Build/source/libs/graphite/engine-2.4/test/RegressionTest/grtest_badCmap.ttf create mode 100644 Build/source/libs/graphite/engine-2.4/test/RegressionTest/grtest_badVersion.ttf create mode 100644 Build/source/libs/graphite/engine-2.4/test/RegressionTest/grtest_burmese.ttf create mode 100644 Build/source/libs/graphite/engine-2.4/test/RegressionTest/grtest_burmese2.ttf create mode 100644 Build/source/libs/graphite/engine-2.4/test/RegressionTest/grtest_burmese3.ttf create mode 100644 Build/source/libs/graphite/engine-2.4/test/RegressionTest/grtest_devanagari.ttf create mode 100644 Build/source/libs/graphite/engine-2.4/test/RegressionTest/grtest_kernglat2.ttf create mode 100644 Build/source/libs/graphite/engine-2.4/test/RegressionTest/grtest_pconstraints.ttf create mode 100644 Build/source/libs/graphite/engine-2.4/test/RegressionTest/grtest_roman.ttf create mode 100644 Build/source/libs/graphite/engine-2.4/test/RegressionTest/grtest_taiviet.ttf create mode 100644 Build/source/libs/graphite/engine-2.4/test/RegressionTest/grtest_xline.ttf create mode 100644 Build/source/libs/graphite/engine-2.4/test/RegressionTest/main.h create mode 100644 Build/source/libs/graphite/engine-2.4/test/RegressionTest/makedebug.bat create mode 100644 Build/source/libs/graphite/engine-2.4/test/RegressionTest/readme.txt create mode 100644 Build/source/libs/graphite/engine-2.4/test/RegressionTest/romanText.wpx create mode 100644 Build/source/libs/graphite/engine-2.4/test/RegressionTest/stdafx.cpp create mode 100644 Build/source/libs/graphite/engine-2.4/test/RegressionTest/stdafx.h create mode 100644 Build/source/libs/graphite/engine-2.4/test/RegressionTest/taivietText.wpx create mode 100644 Build/source/libs/graphite/engine-2.4/test/RegressionTest/xline.gdl create mode 100644 Build/source/libs/graphite/engine-2.4/test/RegressionTest/xlineText.wpx create mode 100644 Build/source/libs/graphite/engine-2.4/test/examples/burmese/Padauk.ttf create mode 100644 Build/source/libs/graphite/engine-2.4/test/examples/burmese/bh1.utx create mode 100644 Build/source/libs/graphite/engine-2.4/test/examples/khmer/cloudsku2.txt create mode 100644 Build/source/libs/graphite/engine-2.4/test/examples/khmer/mond40gr6.ttf create mode 100644 Build/source/libs/graphite/engine-2.4/test/fonterrors/errBadGloc.ttf create mode 100644 Build/source/libs/graphite/engine-2.4/test/fonterrors/errBadGloc2.ttf create mode 100644 Build/source/libs/graphite/engine-2.4/test/fonterrors/errBadPass.ttf create mode 100644 Build/source/libs/graphite/engine-2.4/test/fonterrors/errBadStackMachine.ttf create mode 100644 Build/source/libs/graphite/engine-2.4/test/fonterrors/errBadSubs.ttf create mode 100644 Build/source/libs/graphite/engine-2.4/test/fonterrors/errBadVersion.ttf create mode 100644 Build/source/libs/graphite/engine-2.4/test/fonterrors/errGarbageFsm.ttf create mode 100644 Build/source/libs/graphite/engine-2.4/test/fonterrors/errGarbageGlat.ttf create mode 100644 Build/source/libs/graphite/engine-2.4/test/fonterrors/errGarbageSilf.ttf create mode 100644 Build/source/libs/graphite/engine-2.4/test/fonterrors/errSilfVerMismatch.ttf create mode 100644 Build/source/libs/graphite/engine-2.4/test/fonterrors/errSubsUnderflow.ttf create mode 100644 Build/source/libs/graphite/engine-2.4/test/fonterrors/errTooManyClasses.ttf create mode 100644 Build/source/libs/graphite/engine-2.4/test/fonterrors/fonterrors.gdl create mode 100644 Build/source/libs/graphite/engine-2.4/test/fonterrors/readme.txt create mode 100644 Build/source/libs/graphite/engine-2.4/uninstalled-top.pc.in create mode 100644 Build/source/libs/graphite/version.ac diff --git a/Build/source/libs/README b/Build/source/libs/README index f6aa9c5cb5c..cbbeb44e1ee 100644 --- a/Build/source/libs/README +++ b/Build/source/libs/README @@ -19,9 +19,10 @@ gd 2.0.35 - unchecked 25apr11, site down http://www.boutell.com/gd/ https://bitbucket.org/pierrejoye/gd-libgd/overview -graphite 2.3.1 - checked 25apr11 - the directory silgraphite-2.3.1/engine/ from - http://sourceforge.net/projects/silgraphite/files/silgraphite/ +graphite 2.4 - checked 16mar12 + the directory silgraphite/engine/ from + http://scripts.sil.org/svn-public/graphite/graphite/trunk + (svn r1250 2012-03-1419:45:41 UTC). icu 49.1 (49_rc) - http://download.icu-project.org/files/icu4c/ with modifications required for xetex, also used by bibtexu diff --git a/Build/source/libs/graphite/ChangeLog b/Build/source/libs/graphite/ChangeLog index aeb9a0156a5..90110e4fc71 100644 --- a/Build/source/libs/graphite/ChangeLog +++ b/Build/source/libs/graphite/ChangeLog @@ -1,3 +1,11 @@ +2012-03-12 Peter Breitenlohner + + Import engine-2.4 + (silgraphite/engine svn r1250 2012-03-1419:45:41 UTC) from + http://scripts.sil.org/svn-public/graphite/graphite/trunk. + * version.ac: New file defining the silgraphite version. + * Makefile.am, configure.ac: Adapt. + 2012-02-24 Peter Breitenlohner * include/graphite/Makefile.am: Use ../am/hdr_links.am. diff --git a/Build/source/libs/graphite/Makefile.am b/Build/source/libs/graphite/Makefile.am index b9b38980292..385c1c0d0bd 100644 --- a/Build/source/libs/graphite/Makefile.am +++ b/Build/source/libs/graphite/Makefile.am @@ -59,7 +59,5 @@ nodist_libgraphite_a_SOURCES = \ $(GRAPHITE_TREE)/src/segment/Platform.cpp \ $(GRAPHITE_TREE)/src/segment/Segment.cpp \ $(GRAPHITE_TREE)/src/segment/SegmentAux.cpp \ - $(GRAPHITE_TREE)/src/segment/TestFSM.cpp \ - $(GRAPHITE_TREE)/src/segment/TestPasses.cpp \ $(GRAPHITE_TREE)/src/segment/TransductionLog.cpp diff --git a/Build/source/libs/graphite/Makefile.in b/Build/source/libs/graphite/Makefile.in index 15de7b86d99..47a6ee7306c 100644 --- a/Build/source/libs/graphite/Makefile.in +++ b/Build/source/libs/graphite/Makefile.in @@ -48,7 +48,7 @@ DIST_COMMON = $(am__configure_deps) \ ../../build-aux/texinfo.tex ../../build-aux/ylwrap ChangeLog ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/../../m4/kpse-warnings.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/version.ac $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ @@ -70,8 +70,7 @@ nodist_libgraphite_a_OBJECTS = FileFont.$(OBJEXT) Font.$(OBJEXT) \ GrPassActionCode.$(OBJEXT) GrSlotState.$(OBJEXT) \ GrSlotStream.$(OBJEXT) GrTableManager.$(OBJEXT) \ MemoryUsage.$(OBJEXT) Platform.$(OBJEXT) Segment.$(OBJEXT) \ - SegmentAux.$(OBJEXT) TestFSM.$(OBJEXT) TestPasses.$(OBJEXT) \ - TransductionLog.$(OBJEXT) + SegmentAux.$(OBJEXT) TransductionLog.$(OBJEXT) libgraphite_a_OBJECTS = $(nodist_libgraphite_a_OBJECTS) DEFAULT_INCLUDES = -I.@am__isrc@ depcomp = $(SHELL) $(top_srcdir)/../../build-aux/depcomp @@ -280,8 +279,6 @@ nodist_libgraphite_a_SOURCES = \ $(GRAPHITE_TREE)/src/segment/Platform.cpp \ $(GRAPHITE_TREE)/src/segment/Segment.cpp \ $(GRAPHITE_TREE)/src/segment/SegmentAux.cpp \ - $(GRAPHITE_TREE)/src/segment/TestFSM.cpp \ - $(GRAPHITE_TREE)/src/segment/TestPasses.cpp \ $(GRAPHITE_TREE)/src/segment/TransductionLog.cpp all: all-recursive @@ -358,8 +355,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Segment.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SegmentAux.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SegmentPainter.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TestFSM.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TestPasses.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TransductionLog.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TtfUtil.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Util.Po@am__quote@ @@ -714,34 +709,6 @@ SegmentAux.obj: $(GRAPHITE_TREE)/src/segment/SegmentAux.cpp @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o SegmentAux.obj `if test -f '$(GRAPHITE_TREE)/src/segment/SegmentAux.cpp'; then $(CYGPATH_W) '$(GRAPHITE_TREE)/src/segment/SegmentAux.cpp'; else $(CYGPATH_W) '$(srcdir)/$(GRAPHITE_TREE)/src/segment/SegmentAux.cpp'; fi` -TestFSM.o: $(GRAPHITE_TREE)/src/segment/TestFSM.cpp -@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT TestFSM.o -MD -MP -MF $(DEPDIR)/TestFSM.Tpo -c -o TestFSM.o `test -f '$(GRAPHITE_TREE)/src/segment/TestFSM.cpp' || echo '$(srcdir)/'`$(GRAPHITE_TREE)/src/segment/TestFSM.cpp -@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/TestFSM.Tpo $(DEPDIR)/TestFSM.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(GRAPHITE_TREE)/src/segment/TestFSM.cpp' object='TestFSM.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o TestFSM.o `test -f '$(GRAPHITE_TREE)/src/segment/TestFSM.cpp' || echo '$(srcdir)/'`$(GRAPHITE_TREE)/src/segment/TestFSM.cpp - -TestFSM.obj: $(GRAPHITE_TREE)/src/segment/TestFSM.cpp -@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT TestFSM.obj -MD -MP -MF $(DEPDIR)/TestFSM.Tpo -c -o TestFSM.obj `if test -f '$(GRAPHITE_TREE)/src/segment/TestFSM.cpp'; then $(CYGPATH_W) '$(GRAPHITE_TREE)/src/segment/TestFSM.cpp'; else $(CYGPATH_W) '$(srcdir)/$(GRAPHITE_TREE)/src/segment/TestFSM.cpp'; fi` -@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/TestFSM.Tpo $(DEPDIR)/TestFSM.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(GRAPHITE_TREE)/src/segment/TestFSM.cpp' object='TestFSM.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o TestFSM.obj `if test -f '$(GRAPHITE_TREE)/src/segment/TestFSM.cpp'; then $(CYGPATH_W) '$(GRAPHITE_TREE)/src/segment/TestFSM.cpp'; else $(CYGPATH_W) '$(srcdir)/$(GRAPHITE_TREE)/src/segment/TestFSM.cpp'; fi` - -TestPasses.o: $(GRAPHITE_TREE)/src/segment/TestPasses.cpp -@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT TestPasses.o -MD -MP -MF $(DEPDIR)/TestPasses.Tpo -c -o TestPasses.o `test -f '$(GRAPHITE_TREE)/src/segment/TestPasses.cpp' || echo '$(srcdir)/'`$(GRAPHITE_TREE)/src/segment/TestPasses.cpp -@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/TestPasses.Tpo $(DEPDIR)/TestPasses.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(GRAPHITE_TREE)/src/segment/TestPasses.cpp' object='TestPasses.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o TestPasses.o `test -f '$(GRAPHITE_TREE)/src/segment/TestPasses.cpp' || echo '$(srcdir)/'`$(GRAPHITE_TREE)/src/segment/TestPasses.cpp - -TestPasses.obj: $(GRAPHITE_TREE)/src/segment/TestPasses.cpp -@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT TestPasses.obj -MD -MP -MF $(DEPDIR)/TestPasses.Tpo -c -o TestPasses.obj `if test -f '$(GRAPHITE_TREE)/src/segment/TestPasses.cpp'; then $(CYGPATH_W) '$(GRAPHITE_TREE)/src/segment/TestPasses.cpp'; else $(CYGPATH_W) '$(srcdir)/$(GRAPHITE_TREE)/src/segment/TestPasses.cpp'; fi` -@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/TestPasses.Tpo $(DEPDIR)/TestPasses.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(GRAPHITE_TREE)/src/segment/TestPasses.cpp' object='TestPasses.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o TestPasses.obj `if test -f '$(GRAPHITE_TREE)/src/segment/TestPasses.cpp'; then $(CYGPATH_W) '$(GRAPHITE_TREE)/src/segment/TestPasses.cpp'; else $(CYGPATH_W) '$(srcdir)/$(GRAPHITE_TREE)/src/segment/TestPasses.cpp'; fi` - TransductionLog.o: $(GRAPHITE_TREE)/src/segment/TransductionLog.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT TransductionLog.o -MD -MP -MF $(DEPDIR)/TransductionLog.Tpo -c -o TransductionLog.o `test -f '$(GRAPHITE_TREE)/src/segment/TransductionLog.cpp' || echo '$(srcdir)/'`$(GRAPHITE_TREE)/src/segment/TransductionLog.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/TransductionLog.Tpo $(DEPDIR)/TransductionLog.Po diff --git a/Build/source/libs/graphite/configure b/Build/source/libs/graphite/configure index 5201c608c5b..0b7cf56d702 100755 --- a/Build/source/libs/graphite/configure +++ b/Build/source/libs/graphite/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for silgraphite for TeX Live 2.3.1. +# Generated by GNU Autoconf 2.68 for silgraphite for TeX Live 2.4. # # Report bugs to . # @@ -560,12 +560,12 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='silgraphite for TeX Live' PACKAGE_TARNAME='silgraphite-for-tex-live' -PACKAGE_VERSION='2.3.1' -PACKAGE_STRING='silgraphite for TeX Live 2.3.1' +PACKAGE_VERSION='2.4' +PACKAGE_STRING='silgraphite for TeX Live 2.4' PACKAGE_BUGREPORT='tex-k@tug.org' PACKAGE_URL='' -ac_unique_file="engine-2.3.1/src/segment/GrEngine.cpp" +ac_unique_file="engine-2.4/src/segment/GrEngine.cpp" # Factoring default headers for most tests. ac_includes_default="\ #include @@ -1273,7 +1273,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures silgraphite for TeX Live 2.3.1 to adapt to many kinds of systems. +\`configure' configures silgraphite for TeX Live 2.4 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1344,7 +1344,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of silgraphite for TeX Live 2.3.1:";; + short | recursive ) echo "Configuration of silgraphite for TeX Live 2.4:";; esac cat <<\_ACEOF @@ -1438,7 +1438,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -silgraphite for TeX Live configure 2.3.1 +silgraphite for TeX Live configure 2.4 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1986,7 +1986,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by silgraphite for TeX Live $as_me 2.3.1, which was +It was created by silgraphite for TeX Live $as_me 2.4, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2805,7 +2805,7 @@ fi # Define the identity of the package. PACKAGE='silgraphite-for-tex-live' - VERSION='2.3.1' + VERSION='2.4' # Some tools Automake needs. @@ -5267,7 +5267,7 @@ else fi -GRAPHITE_TREE=engine-2.3.1 +GRAPHITE_TREE=engine-2.4 ac_config_files="$ac_config_files Makefile include/graphite/Makefile" @@ -5856,7 +5856,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by silgraphite for TeX Live $as_me 2.3.1, which was +This file was extended by silgraphite for TeX Live $as_me 2.4, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -5913,7 +5913,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -silgraphite for TeX Live config.status 2.3.1 +silgraphite for TeX Live config.status 2.4 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/Build/source/libs/graphite/configure.ac b/Build/source/libs/graphite/configure.ac index 687b40b2794..743faf8b1ad 100644 --- a/Build/source/libs/graphite/configure.ac +++ b/Build/source/libs/graphite/configure.ac @@ -1,12 +1,12 @@ dnl Process this file with autoconf to produce a configure script. dnl -dnl Copyright (C) 2009 Peter Breitenlohner +dnl Copyright (C) 2009-2012 Peter Breitenlohner dnl dnl This file is free software; the copyright holder dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl -m4_define([silgraphite_version], [2.3.1])[]dnl using unmodified silgraphite/engine source tree +m4_include([version.ac])[] dnl define silgraphite_version AC_INIT([silgraphite for TeX Live], silgraphite_version, [tex-k@tug.org]) AC_PREREQ([2.65]) AC_CONFIG_SRCDIR([engine-]silgraphite_version[/src/segment/GrEngine.cpp]) @@ -41,8 +41,7 @@ AC_CHECK_FUNCS([fabsf]) AM_CONDITIONAL([build], [test "x$enable_build" != xno]) -GRAPHITE_TREE=[engine-]silgraphite_version -AC_SUBST([GRAPHITE_TREE]) +AC_SUBST([GRAPHITE_TREE], [engine-]silgraphite_version) AC_CONFIG_FILES([Makefile include/graphite/Makefile]) diff --git a/Build/source/libs/graphite/engine-2.3.1-PATCHES/ChangeLog b/Build/source/libs/graphite/engine-2.3.1-PATCHES/ChangeLog deleted file mode 100644 index dbe5842a1ad..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1-PATCHES/ChangeLog +++ /dev/null @@ -1,38 +0,0 @@ -2010-07-05 Peter Breitenlohner - - * patch-06-static-const-members (new): Add a definition for - initialized static const class members, required for AIX. - From Vladimir Volovich, Fri, 04 Jun 2010 19:46:38. - - * patch-07-stdlib-workaround (new): Work around stdlib problems, - requires -DUSE_STDLIB_WORKAROUNDS for AIX (and MinGW32?). - From Vladimir Volovich, Mon, 05 Jul 2010 14:05:18. - -2010-03-29 Peter Breitenlohner - - * patch-05-copy-constr (new): Declare copy constructor's source - as const. Required by g++-4.3.2 for OpenSolaris x86_64. - Reported by Apostolos Syropoulos . - Patch proposed by Jonathan Kew . - -2010-02-21 Peter Breitenlohner - - * patch-03-SIZEOF_WCHAR_T (new): MinGW32 fix. - * patch-04-math_h-WIN32 (new): #include also for WIN32. - -2009-10-20 Peter Breitenlohner - - * patch-02-virtual (new): Declare destructors as virtual to - avoid compiler warnings. - -2009-10-19 Peter Breitenlohner - - * TL-changes (new): Modifications applied to the distribution. - * patch-[0-9][0-9]-*: Patches applied to the distribution. - -2009-10-01 Peter Breitenlohner - - * patch-01-warnings (new): Avoid maximal compiler warnings. - * src/segment/GrEngine.{cpp,h}, src/segment/FileInput.{cpp,h}, - src/segment/FontFace.cpp, src/font/TtfUtil.cpp: Constify. - diff --git a/Build/source/libs/graphite/engine-2.3.1-PATCHES/TL-Changes b/Build/source/libs/graphite/engine-2.3.1-PATCHES/TL-Changes deleted file mode 100644 index c257ea84d64..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1-PATCHES/TL-Changes +++ /dev/null @@ -1,19 +0,0 @@ -Changes applied to the silgraphite-2.3.1/engine/ tree obtained from: - http://sourceforge.net/projects/silgraphite/files/silgraphite/ - 2.3.1/silgraphite-2.3.1.tar.gz/download - -Removed: - config/ - -Executed the command: - find -type f -perm /111 ! -name configure -exec chmod -c a-x {} \; -i.e., removed execute permissions from all files except configure. - -Converted Dos/Win line ends to native: - makefile.vc8 - test/RegressionTest/RtTextSrc.h - -Added newline at end of file: - build.bat - build_d.bat - diff --git a/Build/source/libs/graphite/engine-2.3.1-PATCHES/patch-01-warnings b/Build/source/libs/graphite/engine-2.3.1-PATCHES/patch-01-warnings deleted file mode 100644 index 79eb38fcdda..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1-PATCHES/patch-01-warnings +++ /dev/null @@ -1,282 +0,0 @@ -diff -ur -N engine-2.3.1.orig/src/font/TtfUtil.cpp engine-2.3.1/src/font/TtfUtil.cpp ---- engine-2.3.1.orig/src/font/TtfUtil.cpp 2009-01-29 09:33:19.000000000 +0100 -+++ engine-2.3.1/src/font/TtfUtil.cpp 2009-10-01 22:48:21.000000000 +0200 -@@ -1223,7 +1223,7 @@ - (&pGlyph->end_pts_of_contours[cContours]); - - // skip over hints & point to first flag -- int cbHints = read(*(uint16 *)pbGlyph); -+ int cbHints = read(*(const uint16 *)pbGlyph); - pbGlyph += sizeof(uint16); - pbGlyph += cbHints; - -@@ -1277,7 +1277,7 @@ - } - else - { -- prgnX[iFlag] = read(*(int16 *)pbGlyph); -+ prgnX[iFlag] = read(*(const int16 *)pbGlyph); - pbGlyph += sizeof(int16); - } - } -@@ -1306,7 +1306,7 @@ - } - else - { -- prgnY[iFlag] = read(*(int16 *)pbGlyph); -+ prgnY[iFlag] = read(*(const int16 *)pbGlyph); - pbGlyph += sizeof(int16); - } - } -@@ -1342,9 +1342,9 @@ - size_t iCurrentComp = 0; - do - { -- GlyphFlags = read(*((uint16 *)pbGlyph)); -+ GlyphFlags = read(*((const uint16 *)pbGlyph)); - pbGlyph += sizeof(uint16); -- prgnCompId[iCurrentComp++] = read(*((uint16 *)pbGlyph)); -+ prgnCompId[iCurrentComp++] = read(*((const uint16 *)pbGlyph)); - pbGlyph += sizeof(uint16); - if (iCurrentComp >= cnCompIdTotal) - return false; -@@ -1386,18 +1386,18 @@ - uint16 GlyphFlags; - do - { -- GlyphFlags = read(*((uint16 *)pbGlyph)); -+ GlyphFlags = read(*((const uint16 *)pbGlyph)); - pbGlyph += sizeof(uint16); -- if (read(*((uint16 *)pbGlyph)) == nCompId) -+ if (read(*((const uint16 *)pbGlyph)) == nCompId) - { - pbGlyph += sizeof(uint16); // skip over glyph id of component - fOffset = (GlyphFlags & CompoundGlyph::ArgsAreXYValues) == CompoundGlyph::ArgsAreXYValues; - - if (GlyphFlags & CompoundGlyph::Arg1Arg2Words ) - { -- a = read(*(int16 *)pbGlyph); -+ a = read(*(const int16 *)pbGlyph); - pbGlyph += sizeof(int16); -- b = read(*(int16 *)pbGlyph); -+ b = read(*(const int16 *)pbGlyph); - pbGlyph += sizeof(int16); - } - else -@@ -1451,9 +1451,9 @@ - uint16 GlyphFlags; - do - { -- GlyphFlags = read(*((uint16 *)pbGlyph)); -+ GlyphFlags = read(*((const uint16 *)pbGlyph)); - pbGlyph += sizeof(uint16); -- if (read(*((uint16 *)pbGlyph)) == nCompId) -+ if (read(*((const uint16 *)pbGlyph)) == nCompId) - { - pbGlyph += sizeof(uint16); // skip over glyph id of component - pbGlyph += GlyphFlags & CompoundGlyph::Arg1Arg2Words ? 4 : 2; // skip over placement data -@@ -1465,7 +1465,7 @@ - - if (GlyphFlags & CompoundGlyph::HaveScale) - { -- flt11 = fixed_to_float<14>(read(*(uint16 *)pbGlyph)); -+ flt11 = fixed_to_float<14>(read(*(const uint16 *)pbGlyph)); - pbGlyph += sizeof(uint16); - flt12 = 0; - flt21 = 0; -@@ -1473,22 +1473,22 @@ - } - else if (GlyphFlags & CompoundGlyph::HaveXAndYScale) - { -- flt11 = fixed_to_float<14>(read(*(uint16 *)pbGlyph)); -+ flt11 = fixed_to_float<14>(read(*(const uint16 *)pbGlyph)); - pbGlyph += sizeof(uint16); - flt12 = 0; - flt21 = 0; -- flt22 = fixed_to_float<14>(read(*(uint16 *)pbGlyph)); -+ flt22 = fixed_to_float<14>(read(*(const uint16 *)pbGlyph)); - pbGlyph += sizeof(uint16); - } - else if (GlyphFlags & CompoundGlyph::HaveTwoByTwo) - { -- flt11 = fixed_to_float<14>(read(*(uint16 *)pbGlyph)); -+ flt11 = fixed_to_float<14>(read(*(const uint16 *)pbGlyph)); - pbGlyph += sizeof(uint16); -- flt12 = fixed_to_float<14>(read(*(uint16 *)pbGlyph)); -+ flt12 = fixed_to_float<14>(read(*(const uint16 *)pbGlyph)); - pbGlyph += sizeof(uint16); -- flt21 = fixed_to_float<14>(read(*(uint16 *)pbGlyph)); -+ flt21 = fixed_to_float<14>(read(*(const uint16 *)pbGlyph)); - pbGlyph += sizeof(uint16); -- flt22 = fixed_to_float<14>(read(*(uint16 *)pbGlyph)); -+ flt22 = fixed_to_float<14>(read(*(const uint16 *)pbGlyph)); - pbGlyph += sizeof(uint16); - } - else -diff -ur -N engine-2.3.1.orig/src/segment/FileInput.cpp engine-2.3.1/src/segment/FileInput.cpp ---- engine-2.3.1.orig/src/segment/FileInput.cpp 2009-01-21 23:36:42.000000000 +0100 -+++ engine-2.3.1/src/segment/FileInput.cpp 2009-10-01 23:08:51.000000000 +0200 -@@ -90,7 +90,7 @@ - /*---------------------------------------------------------------------------------------------- - Initialize the stream to a buffer. - ----------------------------------------------------------------------------------------------*/ --bool GrBufferIStream::OpenBuffer(byte * pbBuffer, int cb) -+bool GrBufferIStream::OpenBuffer(const byte * pbBuffer, int cb) - { - Assert(m_pbStart == NULL); - Assert(m_pbNext == NULL); -@@ -133,7 +133,7 @@ - ----------------------------------------------------------------------------------------------*/ - short GrBufferIStream::ReadShortFromFont() - { -- short snInput = *(short *)m_pbNext; -+ short snInput = *(const short *)m_pbNext; - m_pbNext += isizeof(short); - if (m_pbLim && m_pbNext > m_pbLim) - THROW(kresReadFault); -@@ -147,7 +147,7 @@ - ----------------------------------------------------------------------------------------------*/ - utf16 GrBufferIStream::ReadUShortFromFont() - { -- utf16 chwInput = *(utf16 *)m_pbNext; -+ utf16 chwInput = *(const utf16 *)m_pbNext; - m_pbNext += isizeof(utf16); - if (m_pbLim && m_pbNext > m_pbLim) - THROW(kresReadFault); -@@ -161,7 +161,7 @@ - ----------------------------------------------------------------------------------------------*/ - int GrBufferIStream::ReadIntFromFont() - { -- int nInput = *(int *)m_pbNext; -+ int nInput = *(const int *)m_pbNext; - m_pbNext += isizeof(int); - if (m_pbLim && m_pbNext > m_pbLim) - THROW(kresReadFault); -diff -ur -N engine-2.3.1.orig/src/segment/FileInput.h engine-2.3.1/src/segment/FileInput.h ---- engine-2.3.1.orig/src/segment/FileInput.h 2009-01-21 23:36:42.000000000 +0100 -+++ engine-2.3.1/src/segment/FileInput.h 2009-10-01 23:02:12.000000000 +0200 -@@ -54,7 +54,7 @@ - virtual void GetPositionInFont(long * plPos) = 0; - virtual void SetPositionInFont(long lPos) = 0; - -- virtual bool OpenBuffer(byte * pbBuffer, int cb) = 0; -+ virtual bool OpenBuffer(const byte * pbBuffer, int cb) = 0; - virtual void CloseBuffer() = 0; - - protected: -@@ -87,16 +87,16 @@ - virtual void GetPositionInFont(long * plPos); - virtual void SetPositionInFont(long lPos); - -- virtual bool OpenBuffer(byte * pbBuffer, int cb); -+ virtual bool OpenBuffer(const byte * pbBuffer, int cb); - virtual void CloseBuffer() - { - Close(); - } - - protected: -- byte * m_pbStart; -- byte * m_pbNext; -- byte * m_pbLim; -+ const byte * m_pbStart; -+ const byte * m_pbNext; -+ const byte * m_pbLim; - }; - - } // namespace gr -diff -ur -N engine-2.3.1.orig/src/segment/FontFace.cpp engine-2.3.1/src/segment/FontFace.cpp ---- engine-2.3.1.orig/src/segment/FontFace.cpp 2009-01-21 23:36:42.000000000 +0100 -+++ engine-2.3.1/src/segment/FontFace.cpp 2009-10-01 23:05:26.000000000 +0200 -@@ -340,9 +340,9 @@ - - // ibGlocStart = cbGlatTbl; - fOk = CheckTableVersions(&grstrm, -- (byte *)pSilfTbl, 0, -- (byte *)pGlocTbl, 0, -- (byte *)pFeatTbl, 0, -+ (const byte *)pSilfTbl, 0, -+ (const byte *)pGlocTbl, 0, -+ (const byte *)pFeatTbl, 0, - &m_fxdBadVersion); - if (!fOk) - { -@@ -376,7 +376,7 @@ - try - { - // Parse the "Silf" table. -- grstrm.OpenBuffer((byte*)pSilfTbl, cbSilfSz); -+ grstrm.OpenBuffer((const byte*)pSilfTbl, cbSilfSz); - int chwGlyphIDMax, fxdVersion; - bool f = ReadSilfTable(grstrm, 0, 0, &chwGlyphIDMax, &fxdVersion); - grstrm.Close(); -@@ -391,8 +391,8 @@ - { - GrBufferIStream grstrmGlat; - -- grstrm.OpenBuffer((byte *)pGlocTbl, cbGlocSz); -- grstrmGlat.OpenBuffer((byte *)pGlatTbl, cbGlatSz); -+ grstrm.OpenBuffer((const byte *)pGlocTbl, cbGlocSz); -+ grstrmGlat.OpenBuffer((const byte *)pGlatTbl, cbGlatSz); - f = ReadGlocAndGlatTables(grstrm, 0, grstrmGlat, 0, chwGlyphIDMax, fxdVersion); - grstrm.Close(); - grstrmGlat.Close(); -@@ -405,7 +405,7 @@ - } - - // Parse the "Feat" table. -- grstrm.OpenBuffer((byte *)pFeatTbl, cbFeatSz); -+ grstrm.OpenBuffer((const byte *)pFeatTbl, cbFeatSz); - f = ReadFeatTable(grstrm, 0); - grstrm.Close(); - if (!f) -@@ -418,7 +418,7 @@ - // Parse the "Sill" table. - if (pSillTbl) - { -- grstrm.OpenBuffer((byte *)pSillTbl, cbFeatSz); -+ grstrm.OpenBuffer((const byte *)pSillTbl, cbFeatSz); - f = ReadSillTable(grstrm, 0); - grstrm.Close(); - if (!f) -@@ -551,7 +551,7 @@ - - if (!m_fNameTblCopy) - { -- res = (pNameTbl = (byte *)pfont->getTable(TtfUtil::TableIdTag(ktiName), &cbNameSz)) ? kresOk : kresFail; -+ res = (pNameTbl = (const byte *)pfont->getTable(TtfUtil::TableIdTag(ktiName), &cbNameSz)) ? kresOk : kresFail; - fOk = pNameTbl && (cbNameSz == 0 || TtfUtil::CheckTable(ktiName, pNameTbl, cbNameSz)); - if (!fOk) - { -diff -ur -N engine-2.3.1.orig/src/segment/GrEngine.cpp engine-2.3.1/src/segment/GrEngine.cpp ---- engine-2.3.1.orig/src/segment/GrEngine.cpp 2009-01-28 03:01:29.000000000 +0100 -+++ engine-2.3.1/src/segment/GrEngine.cpp 2009-10-01 23:05:27.000000000 +0200 -@@ -891,9 +891,9 @@ - implementation of the engine can't handle. - ----------------------------------------------------------------------------------------------*/ - bool GrEngine::CheckTableVersions(GrIStream * pgrstrm, -- byte *pSilfTbl, int lSilfStart, -- byte *pGlobTbl, int lGlocStart, -- byte *pFeatTbl, int lFeatStart, -+ const byte *pSilfTbl, int lSilfStart, -+ const byte *pGlobTbl, int lGlocStart, -+ const byte *pFeatTbl, int lFeatStart, - int * pfxdBadVersion) - { - pgrstrm->OpenBuffer(pSilfTbl, isizeof(int)); -diff -ur -N engine-2.3.1.orig/src/segment/GrEngine.h engine-2.3.1/src/segment/GrEngine.h ---- engine-2.3.1.orig/src/segment/GrEngine.h 2009-01-21 23:36:42.000000000 +0100 -+++ engine-2.3.1/src/segment/GrEngine.h 2009-10-01 23:05:29.000000000 +0200 -@@ -541,9 +541,9 @@ - void DestroyEverything(); - - bool CheckTableVersions(GrIStream * pgrstrm, -- byte *silf_tbl, int lSilfStart, -- byte *gloc_tbl, int lGlocStart, -- byte *feat_tbl, int lFeatStart, -+ const byte *silf_tbl, int lSilfStart, -+ const byte *gloc_tbl, int lGlocStart, -+ const byte *feat_tbl, int lFeatStart, - int * pfxdBadVersion); - //bool ReadSileTable(GrIStream & grstrm, long lTableSTart, - // int * pmFontEmUnits, bool * pfMismatchedBase); diff --git a/Build/source/libs/graphite/engine-2.3.1-PATCHES/patch-02-virtual b/Build/source/libs/graphite/engine-2.3.1-PATCHES/patch-02-virtual deleted file mode 100644 index 9be87c6697c..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1-PATCHES/patch-02-virtual +++ /dev/null @@ -1,21 +0,0 @@ -diff -ur engine-2.3.1.orig/src/segment/GrSlotState.h engine-2.3.1/src/segment/GrSlotState.h ---- engine-2.3.1.orig/src/segment/GrSlotState.h 2009-01-28 03:01:29.000000000 +0100 -+++ engine-2.3.1/src/segment/GrSlotState.h 2009-10-20 01:11:50.000000000 +0200 -@@ -48,7 +48,7 @@ - { - } - -- ~GrSlotAbstract() -+ virtual ~GrSlotAbstract() - { - // the table manager is responsible for destroying the contents of m_prgnVarLenBuf - } -@@ -231,7 +231,7 @@ - ZapCompositeMetrics(); - } - -- ~GrSlotState() -+ virtual ~GrSlotState() - { - } - diff --git a/Build/source/libs/graphite/engine-2.3.1-PATCHES/patch-03-SIZEOF_WCHAR_T b/Build/source/libs/graphite/engine-2.3.1-PATCHES/patch-03-SIZEOF_WCHAR_T deleted file mode 100644 index baf160081fb..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1-PATCHES/patch-03-SIZEOF_WCHAR_T +++ /dev/null @@ -1,18 +0,0 @@ -diff -ur engine-2.3.1.orig/src/font/FileFont.cpp engine-2.3.1/src/font/FileFont.cpp ---- engine-2.3.1.orig/src/font/FileFont.cpp 2009-01-21 23:36:42.000000000 +0100 -+++ engine-2.3.1/src/font/FileFont.cpp 2010-02-19 23:30:05.299876675 +0100 -@@ -208,10 +208,10 @@ - } - // } - #else -- m_stuFaceName.assign(rgchwFace); -- // VS 2005 needs this: -- //for (int cch16 = 0; cch16 < cchw; cch16++) -- // m_stuFaceName.push_back(rgchwFace[cch16]); -+ // m_stuFaceName.assign(rgchwFace); -+ // VS 2005 and MinGW32 need this: -+ for (int cch16 = 0; cch16 < cchw; cch16++) -+ m_stuFaceName.push_back(rgchwFace[cch16]); - #endif - pTable = readTable(ktiHead, lSize); - if (!m_fIsValid || !pTable) diff --git a/Build/source/libs/graphite/engine-2.3.1-PATCHES/patch-04-math_h-WIN32 b/Build/source/libs/graphite/engine-2.3.1-PATCHES/patch-04-math_h-WIN32 deleted file mode 100644 index 3f84de21aa7..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1-PATCHES/patch-04-math_h-WIN32 +++ /dev/null @@ -1,13 +0,0 @@ -diff -ur engine-2.3.1.orig/src/segment/GrTableManager.cpp engine-2.3.1/src/segment/GrTableManager.cpp ---- engine-2.3.1.orig/src/segment/GrTableManager.cpp 2009-01-28 03:01:29.000000000 +0100 -+++ engine-2.3.1/src/segment/GrTableManager.cpp 2010-02-21 17:51:33.772814394 +0100 -@@ -25,8 +25,8 @@ - DEFINE_THIS_FILE - #ifndef _WIN32 - #include --#include - #endif -+#include - - //:>******************************************************************************************** - //:> Forward declarations diff --git a/Build/source/libs/graphite/engine-2.3.1-PATCHES/patch-05-copy-constr b/Build/source/libs/graphite/engine-2.3.1-PATCHES/patch-05-copy-constr deleted file mode 100644 index 0ecba6a43d4..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1-PATCHES/patch-05-copy-constr +++ /dev/null @@ -1,29 +0,0 @@ - Declare copy constructor's source as const. - Required by g++-4.3.2 for OpenSolaris x86_64. - Reported by Apostolos Syropoulos . - Patch proposed by Jonathan Kew . - -diff -ur engine-2.3.1.orig/include/graphite/Segment.h engine-2.3.1/include/graphite/Segment.h ---- engine-2.3.1.orig/include/graphite/Segment.h 2009-01-29 09:33:19.000000000 +0100 -+++ engine-2.3.1/include/graphite/Segment.h 2010-03-29 12:24:52.380352551 +0200 -@@ -64,7 +64,7 @@ - virtual ~Segment(); - - // Basic copy constructor: -- Segment(Segment & seg); -+ Segment(const Segment & seg); - - // For making modified copies of segments: - static Segment * LineContextSegment(Segment & seg, bool fStartLine, bool fEndLine); -diff -ur engine-2.3.1.orig/src/segment/Segment.cpp engine-2.3.1/src/segment/Segment.cpp ---- engine-2.3.1.orig/src/segment/Segment.cpp 2008-08-21 16:24:32.000000000 +0200 -+++ engine-2.3.1/src/segment/Segment.cpp 2010-03-29 12:24:50.067202026 +0200 -@@ -433,7 +433,7 @@ - /*---------------------------------------------------------------------------------------------- - Basic copy method. - ----------------------------------------------------------------------------------------------*/ --Segment::Segment(Segment & seg) -+Segment::Segment(const Segment & seg) - { - int islout; - diff --git a/Build/source/libs/graphite/engine-2.3.1-PATCHES/patch-06-static-const-members b/Build/source/libs/graphite/engine-2.3.1-PATCHES/patch-06-static-const-members deleted file mode 100644 index 9a181666379..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1-PATCHES/patch-06-static-const-members +++ /dev/null @@ -1,25 +0,0 @@ - Initialized static const class members may need to be defined - in the enclosing scope. - -diff -ur engine-2.3.1.orig/test/RegressionTest/RegressionTest.cpp engine-2.3.1/test/RegressionTest/RegressionTest.cpp ---- engine-2.3.1.orig/test/RegressionTest/RegressionTest.cpp 2009-01-21 23:36:42.000000000 +0100 -+++ engine-2.3.1/test/RegressionTest/RegressionTest.cpp 2010-07-05 15:28:32.820883982 +0200 -@@ -34,6 +34,7 @@ - - SegmentMemoryUsage g_smu; - FontMemoryUsage g_fmu; -+const int TestCase::kAbsent; - - std::string g_fontPath = "."; - #ifdef _WIN32 -diff -ur engine-2.3.1.orig/test/RegressionTest/TestCase.cpp engine-2.3.1/test/RegressionTest/TestCase.cpp ---- engine-2.3.1.orig/test/RegressionTest/TestCase.cpp 2009-01-21 23:36:42.000000000 +0100 -+++ engine-2.3.1/test/RegressionTest/TestCase.cpp 2010-07-05 15:27:40.045646923 +0200 -@@ -1875,6 +1875,7 @@ - m_attGlyphs[i] = stuff[i]; - } - -+const int ClickTest::fieldCnt; - void TestCase::SetClickTests(int clickTestCount, int * clickStuff) - { - const int fc = ClickTest::fieldCnt; diff --git a/Build/source/libs/graphite/engine-2.3.1-PATCHES/patch-07-stdlib-workaround b/Build/source/libs/graphite/engine-2.3.1-PATCHES/patch-07-stdlib-workaround deleted file mode 100644 index c0e0ae20cde..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1-PATCHES/patch-07-stdlib-workaround +++ /dev/null @@ -1,35 +0,0 @@ -diff -ur engine-2.3.1.orig/src/font/FileFont.cpp engine-2.3.1/src/font/FileFont.cpp ---- engine-2.3.1.orig/src/font/FileFont.cpp 2010-02-19 23:30:05.000000000 +0100 -+++ engine-2.3.1/src/font/FileFont.cpp 2010-07-05 17:33:59.065493280 +0200 -@@ -209,7 +209,7 @@ - // } - #else - // m_stuFaceName.assign(rgchwFace); -- // VS 2005 and MinGW32 need this: -+ // VS 2005, MinGW32, and AIX need this: - for (int cch16 = 0; cch16 < cchw; cch16++) - m_stuFaceName.push_back(rgchwFace[cch16]); - #endif -diff -ur engine-2.3.1.orig/src/font/TtfUtil.cpp engine-2.3.1/src/font/TtfUtil.cpp ---- engine-2.3.1.orig/src/font/TtfUtil.cpp 2009-10-01 22:48:21.000000000 +0200 -+++ engine-2.3.1/src/font/TtfUtil.cpp 2010-07-05 17:37:51.200867045 +0200 -@@ -784,12 +784,14 @@ - uint16 * pStr = reinterpret_cast(pWStr); - uint16 * const pStrEnd = pStr + (nSize == 0 ? gr::utf16len(pStr) : nSize); - -+#ifndef USE_STDLIB_WORKAROUNDS - std::transform(pStr, pStrEnd, pStr, read); -- --// for (int i = 0; i < nSize; i++) --// { // swap the wide characters in the string --// pStr[i] = gr::utf16(read(uint16(pStr[i]))); --// } -+#else -+ for (int i = 0; i < nSize; i++) -+ { // swap the wide characters in the string -+ pStr[i] = gr::utf16(read(uint16(pStr[i]))); -+ } -+#endif - } - - /*---------------------------------------------------------------------------------------------- diff --git a/Build/source/libs/graphite/engine-2.3.1/COPYING b/Build/source/libs/graphite/engine-2.3.1/COPYING deleted file mode 100644 index 2e009b10e5a..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/COPYING +++ /dev/null @@ -1 +0,0 @@ -see license/LICENSING.txt diff --git a/Build/source/libs/graphite/engine-2.3.1/INSTALL b/Build/source/libs/graphite/engine-2.3.1/INSTALL deleted file mode 100644 index 23e5f25d0e5..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/INSTALL +++ /dev/null @@ -1,236 +0,0 @@ -Installation Instructions -************************* - -Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free -Software Foundation, Inc. - -This file is free documentation; the Free Software Foundation gives -unlimited permission to copy, distribute and modify it. - -Basic Installation -================== - -These are generic installation instructions. - - The `configure' shell script attempts to guess correct values for -various system-dependent variables used during compilation. It uses -those values to create a `Makefile' in each directory of the package. -It may also create one or more `.h' files containing system-dependent -definitions. Finally, it creates a shell script `config.status' that -you can run in the future to recreate the current configuration, and a -file `config.log' containing compiler output (useful mainly for -debugging `configure'). - - It can also use an optional file (typically called `config.cache' -and enabled with `--cache-file=config.cache' or simply `-C') that saves -the results of its tests to speed up reconfiguring. (Caching is -disabled by default to prevent problems with accidental use of stale -cache files.) - - If you need to do unusual things to compile the package, please try -to figure out how `configure' could check whether to do them, and mail -diffs or instructions to the address given in the `README' so they can -be considered for the next release. If you are using the cache, and at -some point `config.cache' contains results you don't want to keep, you -may remove or edit it. - - The file `configure.ac' (or `configure.in') is used to create -`configure' by a program called `autoconf'. You only need -`configure.ac' if you want to change it or regenerate `configure' using -a newer version of `autoconf'. - -The simplest way to compile this package is: - - 1. `cd' to the directory containing the package's source code and type - `./configure' to configure the package for your system. If you're - using `csh' on an old version of System V, you might need to type - `sh ./configure' instead to prevent `csh' from trying to execute - `configure' itself. - - Running `configure' takes awhile. While running, it prints some - messages telling which features it is checking for. - - 2. Type `make' to compile the package. - - 3. Optionally, type `make check' to run any self-tests that come with - the package. - - 4. Type `make install' to install the programs and any data files and - documentation. - - 5. You can remove the program binaries and object files from the - source code directory by typing `make clean'. To also remove the - files that `configure' created (so you can compile the package for - a different kind of computer), type `make distclean'. There is - also a `make maintainer-clean' target, but that is intended mainly - for the package's developers. If you use it, you may have to get - all sorts of other programs in order to regenerate files that came - with the distribution. - -Compilers and Options -===================== - -Some systems require unusual options for compilation or linking that the -`configure' script does not know about. Run `./configure --help' for -details on some of the pertinent environment variables. - - You can give `configure' initial values for configuration parameters -by setting variables in the command line or in the environment. Here -is an example: - - ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix - - *Note Defining Variables::, for more details. - -Compiling For Multiple Architectures -==================================== - -You can compile the package for more than one kind of computer at the -same time, by placing the object files for each architecture in their -own directory. To do this, you must use a version of `make' that -supports the `VPATH' variable, such as GNU `make'. `cd' to the -directory where you want the object files and executables to go and run -the `configure' script. `configure' automatically checks for the -source code in the directory that `configure' is in and in `..'. - - If you have to use a `make' that does not support the `VPATH' -variable, you have to compile the package for one architecture at a -time in the source code directory. After you have installed the -package for one architecture, use `make distclean' before reconfiguring -for another architecture. - -Installation Names -================== - -By default, `make install' installs the package's commands under -`/usr/local/bin', include files under `/usr/local/include', etc. You -can specify an installation prefix other than `/usr/local' by giving -`configure' the option `--prefix=PREFIX'. - - You can specify separate installation prefixes for -architecture-specific files and architecture-independent files. If you -pass the option `--exec-prefix=PREFIX' to `configure', the package uses -PREFIX as the prefix for installing programs and libraries. -Documentation and other data files still use the regular prefix. - - In addition, if you use an unusual directory layout you can give -options like `--bindir=DIR' to specify different values for particular -kinds of files. Run `configure --help' for a list of the directories -you can set and what kinds of files go in them. - - If the package supports it, you can cause programs to be installed -with an extra prefix or suffix on their names by giving `configure' the -option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. - -Optional Features -================= - -Some packages pay attention to `--enable-FEATURE' options to -`configure', where FEATURE indicates an optional part of the package. -They may also pay attention to `--with-PACKAGE' options, where PACKAGE -is something like `gnu-as' or `x' (for the X Window System). The -`README' should mention any `--enable-' and `--with-' options that the -package recognizes. - - For packages that use the X Window System, `configure' can usually -find the X include and library files automatically, but if it doesn't, -you can use the `configure' options `--x-includes=DIR' and -`--x-libraries=DIR' to specify their locations. - -Specifying the System Type -========================== - -There may be some features `configure' cannot figure out automatically, -but needs to determine by the type of machine the package will run on. -Usually, assuming the package is built to be run on the _same_ -architectures, `configure' can figure that out, but if it prints a -message saying it cannot guess the machine type, give it the -`--build=TYPE' option. TYPE can either be a short name for the system -type, such as `sun4', or a canonical name which has the form: - - CPU-COMPANY-SYSTEM - -where SYSTEM can have one of these forms: - - OS KERNEL-OS - - See the file `config.sub' for the possible values of each field. If -`config.sub' isn't included in this package, then this package doesn't -need to know the machine type. - - If you are _building_ compiler tools for cross-compiling, you should -use the option `--target=TYPE' to select the type of system they will -produce code for. - - If you want to _use_ a cross compiler, that generates code for a -platform different from the build platform, you should specify the -"host" platform (i.e., that on which the generated programs will -eventually be run) with `--host=TYPE'. - -Sharing Defaults -================ - -If you want to set default values for `configure' scripts to share, you -can create a site shell script called `config.site' that gives default -values for variables like `CC', `cache_file', and `prefix'. -`configure' looks for `PREFIX/share/config.site' if it exists, then -`PREFIX/etc/config.site' if it exists. Or, you can set the -`CONFIG_SITE' environment variable to the location of the site script. -A warning: not all `configure' scripts look for a site script. - -Defining Variables -================== - -Variables not defined in a site shell script can be set in the -environment passed to `configure'. However, some packages may run -configure again during the build, and the customized values of these -variables may be lost. In order to avoid this problem, you should set -them in the `configure' command line, using `VAR=value'. For example: - - ./configure CC=/usr/local2/bin/gcc - -causes the specified `gcc' to be used as the C compiler (unless it is -overridden in the site shell script). Here is a another example: - - /bin/bash ./configure CONFIG_SHELL=/bin/bash - -Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent -configuration-related scripts to be executed by `/bin/bash'. - -`configure' Invocation -====================== - -`configure' recognizes the following options to control how it operates. - -`--help' -`-h' - Print a summary of the options to `configure', and exit. - -`--version' -`-V' - Print the version of Autoconf used to generate the `configure' - script, and exit. - -`--cache-file=FILE' - Enable the cache: use and save the results of the tests in FILE, - traditionally `config.cache'. FILE defaults to `/dev/null' to - disable caching. - -`--config-cache' -`-C' - Alias for `--cache-file=config.cache'. - -`--quiet' -`--silent' -`-q' - Do not print messages saying which checks are being made. To - suppress all normal output, redirect it to `/dev/null' (any error - messages will still be shown). - -`--srcdir=DIR' - Look for the package's source code in directory DIR. Usually - `configure' can determine that directory automatically. - -`configure' also accepts some other, not widely useful, options. Run -`configure --help' for more details. - diff --git a/Build/source/libs/graphite/engine-2.3.1/Makefile.am b/Build/source/libs/graphite/engine-2.3.1/Makefile.am deleted file mode 100644 index f9265cdb0c7..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/Makefile.am +++ /dev/null @@ -1,62 +0,0 @@ -AUTOMAKE_OPTIONS = 1.6 - -SUBDIRS = src test - -EXTRA_DIST = doc license \ - build.bat build_d.bat makefile.vc7 makefile.vc8 \ - README - -pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = silgraphite.pc - -$(pkgconfig_DATA): config.status - -dist-hook: - find $(distdir) -name .svn | xargs rm -rf - -# VC_VERSION is the last released version of the software -VC_VERSION = 2.3.1 -# D_VERSION gets the number of the current svn revision -D_VERSION = `svnversion ${top_srcdir}|sed -e "s/[0-9]*\://g"` -SVNDEB_VERSION = $(VC_VERSION)+0$(D_VERSION)svn -SVNDEBPACKAGE = silgraphite2.0-$(SVNDEB_VERSION) -SVNORIGTAR = silgraphite2.0_$(SVNDEB_VERSION).orig.tar.gz -SVNWITH_EPOCH = 1:$(SVNDEB_VERSION)-1 - -DEB_VERSION = $(VC_VERSION) -DEBPACKAGE = silgraphite2.0-$(DEB_VERSION) -ORIGTAR = silgraphite2.0_$(DEB_VERSION).orig.tar.gz -WITH_EPOCH = 1:$(DEB_VERSION)-1 - -DISTRIB_CODENAME ?= ${REL_CODENAME} - -showcodename: - echo "Codename: ${DISTRIB_CODENAME}" - -deb-base: dist - rm -rf silgraphite2.0* - mkdir -p ${SVNDEBPACKAGE} - cp ${PACKAGE}-${VERSION}.tar.gz $(SVNDEBPACKAGE) - tar cfz $(SVNORIGTAR) $(SVNDEBPACKAGE) - cp -a ${top_srcdir}/debian $(SVNDEBPACKAGE) - cd ${SVNDEBPACKAGE} && find . -name .svn | xargs rm -rf - -# make deb builds an interim deb from svn source for release -deb: deb-base - dch -D ${DISTRIB_CODENAME} -v ${SVNWITH_EPOCH} -m -c${SVNDEBPACKAGE}/debian/changelog - cd ${SVNDEBPACKAGE} && pdebuild - -# make deb-binary-only builds a binary only deb from svn source -deb-binary-only: deb-base - dch -D ${DISTRIB_CODENAME} -v ${SVNWITH_EPOCH} -m -c${SVNDEBPACKAGE}/debian/changelog "This is build direct from svn" - cd ${SVNDEBPACKAGE} && pdebuild --debbuildopts -i --debbuildopts -b - -# make deb-release builds a deb for a released version number -deb-release: deb-base - dch -D ${DISTRIB_CODENAME} -v ${WITH_EPOCH} -c${DEBPACKAGE}/debian/changelog - cd ${DEBPACKAGE} && pdebuild - -# make deb-local uses debuild to build a deb for local use only -deb-local: deb-base - dch -D ${DISTRIB_CODENAME} -v ${SVNWITH_EPOCH} -m -c${SVNDEBPACKAGE}/debian/changelog "This is a debuild direct from svn" - cd ${SVNDEBPACKAGE} && debuild -us -uc diff --git a/Build/source/libs/graphite/engine-2.3.1/Makefile.in b/Build/source/libs/graphite/engine-2.3.1/Makefile.in deleted file mode 100644 index 6bedb8b16fd..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/Makefile.in +++ /dev/null @@ -1,720 +0,0 @@ -# Makefile.in generated by automake 1.10.1 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -subdir = . -DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ - $(srcdir)/Makefile.in $(srcdir)/installed-top.pc.in \ - $(srcdir)/silgraphite.pc.in $(srcdir)/uninstalled-top.pc.in \ - $(top_srcdir)/configure COPYING INSTALL TODO \ - config/config.guess config/config.sub config/depcomp \ - config/install-sh config/ltmain.sh config/missing -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ - configure.lineno config.status.lineno -mkinstalldirs = $(install_sh) -d -CONFIG_CLEAN_FILES = silgraphite.pc silgraphite-uninstalled.pc -SOURCES = -DIST_SOURCES = -RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ - html-recursive info-recursive install-data-recursive \ - install-dvi-recursive install-exec-recursive \ - install-html-recursive install-info-recursive \ - install-pdf-recursive install-ps-recursive install-recursive \ - installcheck-recursive installdirs-recursive pdf-recursive \ - ps-recursive uninstall-recursive -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(pkgconfigdir)" -pkgconfigDATA_INSTALL = $(INSTALL_DATA) -DATA = $(pkgconfig_DATA) -RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ - distclean-recursive maintainer-clean-recursive -ETAGS = etags -CTAGS = ctags -DIST_SUBDIRS = $(SUBDIRS) -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -distdir = $(PACKAGE)-$(VERSION) -top_distdir = $(distdir) -am__remove_distdir = \ - { test ! -d $(distdir) \ - || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ - && rm -fr $(distdir); }; } -DIST_ARCHIVES = $(distdir).tar.gz -GZIP_ENV = --best -distuninstallcheck_listfiles = find . -type f -print -distcleancheck_listfiles = find . -type f -print -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -GREP = @GREP@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LSB_RELEASE = @LSB_RELEASE@ -LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ -MAKEINFO = @MAKEINFO@ -MKDIR_P = @MKDIR_P@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -RANLIB = @RANLIB@ -REL_CODENAME = @REL_CODENAME@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SIZEOF_WCHAR_T = @SIZEOF_WCHAR_T@ -STRIP = @STRIP@ -VERSION = @VERSION@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -AUTOMAKE_OPTIONS = 1.6 -SUBDIRS = src test -EXTRA_DIST = doc license \ - build.bat build_d.bat makefile.vc7 makefile.vc8 \ - README - -pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = silgraphite.pc - -# VC_VERSION is the last released version of the software -VC_VERSION = 2.3.1 -# D_VERSION gets the number of the current svn revision -D_VERSION = `svnversion ${top_srcdir}|sed -e "s/[0-9]*\://g"` -SVNDEB_VERSION = $(VC_VERSION)+0$(D_VERSION)svn -SVNDEBPACKAGE = silgraphite2.0-$(SVNDEB_VERSION) -SVNORIGTAR = silgraphite2.0_$(SVNDEB_VERSION).orig.tar.gz -SVNWITH_EPOCH = 1:$(SVNDEB_VERSION)-1 -DEB_VERSION = $(VC_VERSION) -DEBPACKAGE = silgraphite2.0-$(DEB_VERSION) -ORIGTAR = silgraphite2.0_$(DEB_VERSION).orig.tar.gz -WITH_EPOCH = 1:$(DEB_VERSION)-1 -all: all-recursive - -.SUFFIXES: -am--refresh: - @: -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - echo ' cd $(srcdir) && $(AUTOMAKE) --foreign '; \ - cd $(srcdir) && $(AUTOMAKE) --foreign \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --foreign Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - echo ' $(SHELL) ./config.status'; \ - $(SHELL) ./config.status;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - $(SHELL) ./config.status --recheck - -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(srcdir) && $(AUTOCONF) -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) - cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) -silgraphite.pc: $(top_builddir)/config.status $(srcdir)/installed-top.pc.in $(srcdir)/silgraphite.pc.in - cd $(top_builddir) && $(SHELL) ./config.status $@ -silgraphite-uninstalled.pc: $(top_builddir)/config.status $(srcdir)/uninstalled-top.pc.in $(srcdir)/silgraphite.pc.in - cd $(top_builddir) && $(SHELL) ./config.status $@ - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -install-pkgconfigDATA: $(pkgconfig_DATA) - @$(NORMAL_INSTALL) - test -z "$(pkgconfigdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" - @list='$(pkgconfig_DATA)'; for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - f=$(am__strip_dir) \ - echo " $(pkgconfigDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgconfigdir)/$$f'"; \ - $(pkgconfigDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgconfigdir)/$$f"; \ - done - -uninstall-pkgconfigDATA: - @$(NORMAL_UNINSTALL) - @list='$(pkgconfig_DATA)'; for p in $$list; do \ - f=$(am__strip_dir) \ - echo " rm -f '$(DESTDIR)$(pkgconfigdir)/$$f'"; \ - rm -f "$(DESTDIR)$(pkgconfigdir)/$$f"; \ - done - -# This directory's subdirectories are mostly independent; you can cd -# into them and run `make' without going through this Makefile. -# To change the values of `make' variables: instead of editing Makefiles, -# (1) if the variable is set in `config.status', edit `config.status' -# (which will cause the Makefiles to be regenerated when you run `make'); -# (2) otherwise, pass the desired values on the `make' command line. -$(RECURSIVE_TARGETS): - @failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - target=`echo $@ | sed s/-recursive//`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - dot_seen=yes; \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done; \ - if test "$$dot_seen" = "no"; then \ - $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ - fi; test -z "$$fail" - -$(RECURSIVE_CLEAN_TARGETS): - @failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - rev=''; for subdir in $$list; do \ - if test "$$subdir" = "."; then :; else \ - rev="$$subdir $$rev"; \ - fi; \ - done; \ - rev="$$rev ."; \ - target=`echo $@ | sed s/-recursive//`; \ - for subdir in $$rev; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done && test -z "$$fail" -tags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ - done -ctags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ - done - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ - include_option=--etags-include; \ - empty_fix=.; \ - else \ - include_option=--include; \ - empty_fix=; \ - fi; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test ! -f $$subdir/TAGS || \ - tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ - fi; \ - done; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - $(am__remove_distdir) - test -d $(distdir) || mkdir $(distdir) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done - list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test -d "$(distdir)/$$subdir" \ - || $(MKDIR_P) "$(distdir)/$$subdir" \ - || exit 1; \ - distdir=`$(am__cd) $(distdir) && pwd`; \ - top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ - (cd $$subdir && \ - $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$$top_distdir" \ - distdir="$$distdir/$$subdir" \ - am__remove_distdir=: \ - am__skip_length_check=: \ - distdir) \ - || exit 1; \ - fi; \ - done - $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$(top_distdir)" distdir="$(distdir)" \ - dist-hook - -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ - ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ - ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ - ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ - || chmod -R a+r $(distdir) -dist-gzip: distdir - tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz - $(am__remove_distdir) - -dist-bzip2: distdir - tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 - $(am__remove_distdir) - -dist-lzma: distdir - tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma - $(am__remove_distdir) - -dist-tarZ: distdir - tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z - $(am__remove_distdir) - -dist-shar: distdir - shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz - $(am__remove_distdir) - -dist-zip: distdir - -rm -f $(distdir).zip - zip -rq $(distdir).zip $(distdir) - $(am__remove_distdir) - -dist dist-all: distdir - tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz - $(am__remove_distdir) - -# This target untars the dist file and tries a VPATH configuration. Then -# it guarantees that the distribution is self-contained by making another -# tarfile. -distcheck: dist - case '$(DIST_ARCHIVES)' in \ - *.tar.gz*) \ - GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ - *.tar.bz2*) \ - bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ - *.tar.lzma*) \ - unlzma -c $(distdir).tar.lzma | $(am__untar) ;;\ - *.tar.Z*) \ - uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ - *.shar.gz*) \ - GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ - *.zip*) \ - unzip $(distdir).zip ;;\ - esac - chmod -R a-w $(distdir); chmod a+w $(distdir) - mkdir $(distdir)/_build - mkdir $(distdir)/_inst - chmod a-w $(distdir) - dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ - && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ - && cd $(distdir)/_build \ - && ../configure --srcdir=.. --prefix="$$dc_install_base" \ - $(DISTCHECK_CONFIGURE_FLAGS) \ - && $(MAKE) $(AM_MAKEFLAGS) \ - && $(MAKE) $(AM_MAKEFLAGS) dvi \ - && $(MAKE) $(AM_MAKEFLAGS) check \ - && $(MAKE) $(AM_MAKEFLAGS) install \ - && $(MAKE) $(AM_MAKEFLAGS) installcheck \ - && $(MAKE) $(AM_MAKEFLAGS) uninstall \ - && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ - distuninstallcheck \ - && chmod -R a-w "$$dc_install_base" \ - && ({ \ - (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ - distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ - } || { rm -rf "$$dc_destdir"; exit 1; }) \ - && rm -rf "$$dc_destdir" \ - && $(MAKE) $(AM_MAKEFLAGS) dist \ - && rm -rf $(DIST_ARCHIVES) \ - && $(MAKE) $(AM_MAKEFLAGS) distcleancheck - $(am__remove_distdir) - @(echo "$(distdir) archives ready for distribution: "; \ - list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ - sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' -distuninstallcheck: - @cd $(distuninstallcheck_dir) \ - && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ - || { echo "ERROR: files left after uninstall:" ; \ - if test -n "$(DESTDIR)"; then \ - echo " (check DESTDIR support)"; \ - fi ; \ - $(distuninstallcheck_listfiles) ; \ - exit 1; } >&2 -distcleancheck: distclean - @if test '$(srcdir)' = . ; then \ - echo "ERROR: distcleancheck can only run from a VPATH build" ; \ - exit 1 ; \ - fi - @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ - || { echo "ERROR: files left in build directory after distclean:" ; \ - $(distcleancheck_listfiles) ; \ - exit 1; } >&2 -check-am: all-am -check: check-recursive -all-am: Makefile $(DATA) -installdirs: installdirs-recursive -installdirs-am: - for dir in "$(DESTDIR)$(pkgconfigdir)"; do \ - test -z "$$dir" || $(MKDIR_P) "$$dir"; \ - done -install: install-recursive -install-exec: install-exec-recursive -install-data: install-data-recursive -uninstall: uninstall-recursive - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-recursive -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-recursive - -clean-am: clean-generic clean-libtool mostlyclean-am - -distclean: distclean-recursive - -rm -f $(am__CONFIG_DISTCLEAN_FILES) - -rm -f Makefile -distclean-am: clean-am distclean-generic distclean-libtool \ - distclean-tags - -dvi: dvi-recursive - -dvi-am: - -html: html-recursive - -info: info-recursive - -info-am: - -install-data-am: install-pkgconfigDATA - -install-dvi: install-dvi-recursive - -install-exec-am: - -install-html: install-html-recursive - -install-info: install-info-recursive - -install-man: - -install-pdf: install-pdf-recursive - -install-ps: install-ps-recursive - -installcheck-am: - -maintainer-clean: maintainer-clean-recursive - -rm -f $(am__CONFIG_DISTCLEAN_FILES) - -rm -rf $(top_srcdir)/autom4te.cache - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-recursive - -mostlyclean-am: mostlyclean-generic mostlyclean-libtool - -pdf: pdf-recursive - -pdf-am: - -ps: ps-recursive - -ps-am: - -uninstall-am: uninstall-pkgconfigDATA - -.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \ - install-strip - -.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ - all all-am am--refresh check check-am clean clean-generic \ - clean-libtool ctags ctags-recursive dist dist-all dist-bzip2 \ - dist-gzip dist-hook dist-lzma dist-shar dist-tarZ dist-zip \ - distcheck distclean distclean-generic distclean-libtool \ - distclean-tags distcleancheck distdir distuninstallcheck dvi \ - dvi-am html html-am info info-am install install-am \ - install-data install-data-am install-dvi install-dvi-am \ - install-exec install-exec-am install-html install-html-am \ - install-info install-info-am install-man install-pdf \ - install-pdf-am install-pkgconfigDATA install-ps install-ps-am \ - install-strip installcheck installcheck-am installdirs \ - installdirs-am maintainer-clean maintainer-clean-generic \ - mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ - ps ps-am tags tags-recursive uninstall uninstall-am \ - uninstall-pkgconfigDATA - - -$(pkgconfig_DATA): config.status - -dist-hook: - find $(distdir) -name .svn | xargs rm -rf - -DISTRIB_CODENAME ?= ${REL_CODENAME} - -showcodename: - echo "Codename: ${DISTRIB_CODENAME}" - -deb-base: dist - rm -rf silgraphite2.0* - mkdir -p ${SVNDEBPACKAGE} - cp ${PACKAGE}-${VERSION}.tar.gz $(SVNDEBPACKAGE) - tar cfz $(SVNORIGTAR) $(SVNDEBPACKAGE) - cp -a ${top_srcdir}/debian $(SVNDEBPACKAGE) - cd ${SVNDEBPACKAGE} && find . -name .svn | xargs rm -rf - -# make deb builds an interim deb from svn source for release -deb: deb-base - dch -D ${DISTRIB_CODENAME} -v ${SVNWITH_EPOCH} -m -c${SVNDEBPACKAGE}/debian/changelog - cd ${SVNDEBPACKAGE} && pdebuild - -# make deb-binary-only builds a binary only deb from svn source -deb-binary-only: deb-base - dch -D ${DISTRIB_CODENAME} -v ${SVNWITH_EPOCH} -m -c${SVNDEBPACKAGE}/debian/changelog "This is build direct from svn" - cd ${SVNDEBPACKAGE} && pdebuild --debbuildopts -i --debbuildopts -b - -# make deb-release builds a deb for a released version number -deb-release: deb-base - dch -D ${DISTRIB_CODENAME} -v ${WITH_EPOCH} -c${DEBPACKAGE}/debian/changelog - cd ${DEBPACKAGE} && pdebuild - -# make deb-local uses debuild to build a deb for local use only -deb-local: deb-base - dch -D ${DISTRIB_CODENAME} -v ${SVNWITH_EPOCH} -m -c${SVNDEBPACKAGE}/debian/changelog "This is a debuild direct from svn" - cd ${SVNDEBPACKAGE} && debuild -us -uc -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/Build/source/libs/graphite/engine-2.3.1/README b/Build/source/libs/graphite/engine-2.3.1/README deleted file mode 100644 index 41c9cc02b5e..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/README +++ /dev/null @@ -1,32 +0,0 @@ - GRAPHITE ENGINE - -The Graphite smart-font engine is the bit that takes a Unicode string, font -formatting information (features, size, etc.) and a font and returns a set -of positioned glyphs. Graphite also does more than this, in that it can -handle cursor tracking and interaction with the application for string -selection, etc. - -In order to interact with the application or system, Graphite is embedded in -an application. You may want to write a custom font and render backend or use one -of the provided backends in the wrappers project. - -The *nix build system uses autoconf and automake including all the -conventions of those tools. This includes extended support for debug, -maintenance mode, etc. See the GNU autotools info pages for the appropriate -tools for help. - -If you have checked this source out of the Graphite Subversion repository or -a similar version control system you will need to generate the autotools -scripts and files (configure, Makefile.in etc) to do this run: - - autoreconf --install - -Please see INSTALL for information on building - -NOTE: -If you modify any configure.in or Makefile.am file you will need rerun -autoreconf like so: - - autoreconf - -For those changes to affect the configure script and makefiles. diff --git a/Build/source/libs/graphite/engine-2.3.1/TODO b/Build/source/libs/graphite/engine-2.3.1/TODO deleted file mode 100644 index 146eff85d26..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/TODO +++ /dev/null @@ -1,4 +0,0 @@ - -Unprioritised - - * NFD/NFC Pre-processing diff --git a/Build/source/libs/graphite/engine-2.3.1/aclocal.m4 b/Build/source/libs/graphite/engine-2.3.1/aclocal.m4 deleted file mode 100644 index 2ec15d55f85..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/aclocal.m4 +++ /dev/null @@ -1,8811 +0,0 @@ -# generated automatically by aclocal 1.10.1 -*- Autoconf -*- - -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -# 2005, 2006, 2007, 2008 Free Software Foundation, Inc. -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -m4_ifndef([AC_AUTOCONF_VERSION], - [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl -m4_if(AC_AUTOCONF_VERSION, [2.61],, -[m4_warning([this file was generated for autoconf 2.61. -You have another version of autoconf. It may work, but is not guaranteed to. -If you have problems, you may need to regenerate the build system entirely. -To do so, use the procedure documented by the package, typically `autoreconf'.])]) - -# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- -# -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, -# 2006, 2007, 2008 Free Software Foundation, Inc. -# Written by Gordon Matzigkeit, 1996 -# -# This file is free software; the Free Software Foundation gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. - -m4_define([_LT_COPYING], [dnl -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, -# 2006, 2007, 2008 Free Software Foundation, Inc. -# Written by Gordon Matzigkeit, 1996 -# -# This file is part of GNU Libtool. -# -# GNU Libtool is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or (at your option) any later version. -# -# As a special exception to the GNU General Public License, -# if you distribute this file as part of a program or library that -# is built using GNU Libtool, you may include this file under the -# same distribution terms that you use for the rest of that program. -# -# GNU Libtool is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Libtool; see the file COPYING. If not, a copy -# can be downloaded from http://www.gnu.org/licenses/gpl.html, or -# obtained by writing to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -]) - -# serial 56 LT_INIT - - -# LT_PREREQ(VERSION) -# ------------------ -# Complain and exit if this libtool version is less that VERSION. -m4_defun([LT_PREREQ], -[m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1, - [m4_default([$3], - [m4_fatal([Libtool version $1 or higher is required], - 63)])], - [$2])]) - - -# _LT_CHECK_BUILDDIR -# ------------------ -# Complain if the absolute build directory name contains unusual characters -m4_defun([_LT_CHECK_BUILDDIR], -[case `pwd` in - *\ * | *\ *) - AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;; -esac -]) - - -# LT_INIT([OPTIONS]) -# ------------------ -AC_DEFUN([LT_INIT], -[AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT -AC_BEFORE([$0], [LT_LANG])dnl -AC_BEFORE([$0], [LT_OUTPUT])dnl -AC_BEFORE([$0], [LTDL_INIT])dnl -m4_require([_LT_CHECK_BUILDDIR])dnl - -dnl Autoconf doesn't catch unexpanded LT_ macros by default: -m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl -m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl -dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4 -dnl unless we require an AC_DEFUNed macro: -AC_REQUIRE([LTOPTIONS_VERSION])dnl -AC_REQUIRE([LTSUGAR_VERSION])dnl -AC_REQUIRE([LTVERSION_VERSION])dnl -AC_REQUIRE([LTOBSOLETE_VERSION])dnl -m4_require([_LT_PROG_LTMAIN])dnl - -dnl Parse OPTIONS -_LT_SET_OPTIONS([$0], [$1]) - -# This can be used to rebuild libtool when needed -LIBTOOL_DEPS="$ltmain" - -# Always use our own libtool. -LIBTOOL='$(SHELL) $(top_builddir)/libtool' -AC_SUBST(LIBTOOL)dnl - -_LT_SETUP - -# Only expand once: -m4_define([LT_INIT]) -])# LT_INIT - -# Old names: -AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT]) -AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_PROG_LIBTOOL], []) -dnl AC_DEFUN([AM_PROG_LIBTOOL], []) - - -# _LT_CC_BASENAME(CC) -# ------------------- -# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. -m4_defun([_LT_CC_BASENAME], -[for cc_temp in $1""; do - case $cc_temp in - compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; - distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` -]) - - -# _LT_FILEUTILS_DEFAULTS -# ---------------------- -# It is okay to use these file commands and assume they have been set -# sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'. -m4_defun([_LT_FILEUTILS_DEFAULTS], -[: ${CP="cp -f"} -: ${MV="mv -f"} -: ${RM="rm -f"} -])# _LT_FILEUTILS_DEFAULTS - - -# _LT_SETUP -# --------- -m4_defun([_LT_SETUP], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_CANONICAL_BUILD])dnl -_LT_DECL([], [host_alias], [0], [The host system])dnl -_LT_DECL([], [host], [0])dnl -_LT_DECL([], [host_os], [0])dnl -dnl -_LT_DECL([], [build_alias], [0], [The build system])dnl -_LT_DECL([], [build], [0])dnl -_LT_DECL([], [build_os], [0])dnl -dnl -AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([LT_PATH_LD])dnl -AC_REQUIRE([LT_PATH_NM])dnl -dnl -AC_REQUIRE([AC_PROG_LN_S])dnl -test -z "$LN_S" && LN_S="ln -s" -_LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl -dnl -AC_REQUIRE([LT_CMD_MAX_LEN])dnl -_LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl -_LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl -dnl -m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_CHECK_SHELL_FEATURES])dnl -m4_require([_LT_CMD_RELOAD])dnl -m4_require([_LT_CHECK_MAGIC_METHOD])dnl -m4_require([_LT_CMD_OLD_ARCHIVE])dnl -m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl - -_LT_CONFIG_LIBTOOL_INIT([ -# See if we are running on zsh, and set the options which allow our -# commands through without removal of \ escapes INIT. -if test -n "\${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST -fi -]) -if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST -fi - -_LT_CHECK_OBJDIR - -m4_require([_LT_TAG_COMPILER])dnl -_LT_PROG_ECHO_BACKSLASH - -case $host_os in -aix3*) - # AIX sometimes has problems with the GCC collect2 program. For some - # reason, if we set the COLLECT_NAMES environment variable, the problems - # vanish in a puff of smoke. - if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES - fi - ;; -esac - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -sed_quote_subst='s/\([["`$\\]]\)/\\\1/g' - -# Same as above, but do not quote variable references. -double_quote_subst='s/\([["`\\]]\)/\\\1/g' - -# Sed substitution to delay expansion of an escaped shell variable in a -# double_quote_subst'ed string. -delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' - -# Sed substitution to delay expansion of an escaped single quote. -delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' - -# Sed substitution to avoid accidental globbing in evaled expressions -no_glob_subst='s/\*/\\\*/g' - -# Global variables: -ofile=libtool -can_build_shared=yes - -# All known linkers require a `.a' archive for static linking (except MSVC, -# which needs '.lib'). -libext=a - -with_gnu_ld="$lt_cv_prog_gnu_ld" - -old_CC="$CC" -old_CFLAGS="$CFLAGS" - -# Set sane defaults for various variables -test -z "$CC" && CC=cc -test -z "$LTCC" && LTCC=$CC -test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS -test -z "$LD" && LD=ld -test -z "$ac_objext" && ac_objext=o - -_LT_CC_BASENAME([$compiler]) - -# Only perform the check for file, if the check method requires it -test -z "$MAGIC_CMD" && MAGIC_CMD=file -case $deplibs_check_method in -file_magic*) - if test "$file_magic_cmd" = '$MAGIC_CMD'; then - _LT_PATH_MAGIC - fi - ;; -esac - -# Use C for the default configuration in the libtool script -LT_SUPPORTED_TAG([CC]) -_LT_LANG_C_CONFIG -_LT_LANG_DEFAULT_CONFIG -_LT_CONFIG_COMMANDS -])# _LT_SETUP - - -# _LT_PROG_LTMAIN -# --------------- -# Note that this code is called both from `configure', and `config.status' -# now that we use AC_CONFIG_COMMANDS to generate libtool. Notably, -# `config.status' has no value for ac_aux_dir unless we are using Automake, -# so we pass a copy along to make sure it has a sensible value anyway. -m4_defun([_LT_PROG_LTMAIN], -[m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl -_LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir']) -ltmain="$ac_aux_dir/ltmain.sh" -])# _LT_PROG_LTMAIN - - - -# So that we can recreate a full libtool script including additional -# tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS -# in macros and then make a single call at the end using the `libtool' -# label. - - -# _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS]) -# ---------------------------------------- -# Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later. -m4_define([_LT_CONFIG_LIBTOOL_INIT], -[m4_ifval([$1], - [m4_append([_LT_OUTPUT_LIBTOOL_INIT], - [$1 -])])]) - -# Initialize. -m4_define([_LT_OUTPUT_LIBTOOL_INIT]) - - -# _LT_CONFIG_LIBTOOL([COMMANDS]) -# ------------------------------ -# Register COMMANDS to be passed to AC_CONFIG_COMMANDS later. -m4_define([_LT_CONFIG_LIBTOOL], -[m4_ifval([$1], - [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS], - [$1 -])])]) - -# Initialize. -m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS]) - - -# _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS]) -# ----------------------------------------------------- -m4_defun([_LT_CONFIG_SAVE_COMMANDS], -[_LT_CONFIG_LIBTOOL([$1]) -_LT_CONFIG_LIBTOOL_INIT([$2]) -]) - - -# _LT_FORMAT_COMMENT([COMMENT]) -# ----------------------------- -# Add leading comment marks to the start of each line, and a trailing -# full-stop to the whole comment if one is not present already. -m4_define([_LT_FORMAT_COMMENT], -[m4_ifval([$1], [ -m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])], - [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.]) -)]) - - - - - -# _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?]) -# ------------------------------------------------------------------- -# CONFIGNAME is the name given to the value in the libtool script. -# VARNAME is the (base) name used in the configure script. -# VALUE may be 0, 1 or 2 for a computed quote escaped value based on -# VARNAME. Any other value will be used directly. -m4_define([_LT_DECL], -[lt_if_append_uniq([lt_decl_varnames], [$2], [, ], - [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name], - [m4_ifval([$1], [$1], [$2])]) - lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3]) - m4_ifval([$4], - [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])]) - lt_dict_add_subkey([lt_decl_dict], [$2], - [tagged?], [m4_ifval([$5], [yes], [no])])]) -]) - - -# _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION]) -# -------------------------------------------------------- -m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])]) - - -# lt_decl_tag_varnames([SEPARATOR], [VARNAME1...]) -# ------------------------------------------------ -m4_define([lt_decl_tag_varnames], -[_lt_decl_filter([tagged?], [yes], $@)]) - - -# _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..]) -# --------------------------------------------------------- -m4_define([_lt_decl_filter], -[m4_case([$#], - [0], [m4_fatal([$0: too few arguments: $#])], - [1], [m4_fatal([$0: too few arguments: $#: $1])], - [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)], - [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)], - [lt_dict_filter([lt_decl_dict], $@)])[]dnl -]) - - -# lt_decl_quote_varnames([SEPARATOR], [VARNAME1...]) -# -------------------------------------------------- -m4_define([lt_decl_quote_varnames], -[_lt_decl_filter([value], [1], $@)]) - - -# lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...]) -# --------------------------------------------------- -m4_define([lt_decl_dquote_varnames], -[_lt_decl_filter([value], [2], $@)]) - - -# lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...]) -# --------------------------------------------------- -m4_define([lt_decl_varnames_tagged], -[_$0(m4_quote(m4_default([$1], [[, ]])), - m4_quote(m4_if([$2], [], - m4_quote(lt_decl_tag_varnames), - m4_quote(m4_shift($@)))), - m4_split(m4_normalize(m4_quote(_LT_TAGS))))]) -m4_define([_lt_decl_varnames_tagged], [lt_combine([$1], [$2], [_], $3)]) - - -# lt_decl_all_varnames([SEPARATOR], [VARNAME1...]) -# ------------------------------------------------ -m4_define([lt_decl_all_varnames], -[_$0(m4_quote(m4_default([$1], [[, ]])), - m4_if([$2], [], - m4_quote(lt_decl_varnames), - m4_quote(m4_shift($@))))[]dnl -]) -m4_define([_lt_decl_all_varnames], -[lt_join($@, lt_decl_varnames_tagged([$1], - lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl -]) - - -# _LT_CONFIG_STATUS_DECLARE([VARNAME]) -# ------------------------------------ -# Quote a variable value, and forward it to `config.status' so that its -# declaration there will have the same value as in `configure'. VARNAME -# must have a single quote delimited value for this to work. -m4_define([_LT_CONFIG_STATUS_DECLARE], -[$1='`$ECHO "X$][$1" | $Xsed -e "$delay_single_quote_subst"`']) - - -# _LT_CONFIG_STATUS_DECLARATIONS -# ------------------------------ -# We delimit libtool config variables with single quotes, so when -# we write them to config.status, we have to be sure to quote all -# embedded single quotes properly. In configure, this macro expands -# each variable declared with _LT_DECL (and _LT_TAGDECL) into: -# -# ='`$ECHO "X$" | $Xsed -e "$delay_single_quote_subst"`' -m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], -[m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), - [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])]) - - -# _LT_LIBTOOL_TAGS -# ---------------- -# Output comment and list of tags supported by the script -m4_defun([_LT_LIBTOOL_TAGS], -[_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl -available_tags="_LT_TAGS"dnl -]) - - -# _LT_LIBTOOL_DECLARE(VARNAME, [TAG]) -# ----------------------------------- -# Extract the dictionary values for VARNAME (optionally with TAG) and -# expand to a commented shell variable setting: -# -# # Some comment about what VAR is for. -# visible_name=$lt_internal_name -m4_define([_LT_LIBTOOL_DECLARE], -[_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], - [description])))[]dnl -m4_pushdef([_libtool_name], - m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl -m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])), - [0], [_libtool_name=[$]$1], - [1], [_libtool_name=$lt_[]$1], - [2], [_libtool_name=$lt_[]$1], - [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl -m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl -]) - - -# _LT_LIBTOOL_CONFIG_VARS -# ----------------------- -# Produce commented declarations of non-tagged libtool config variables -# suitable for insertion in the LIBTOOL CONFIG section of the `libtool' -# script. Tagged libtool config variables (even for the LIBTOOL CONFIG -# section) are produced by _LT_LIBTOOL_TAG_VARS. -m4_defun([_LT_LIBTOOL_CONFIG_VARS], -[m4_foreach([_lt_var], - m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)), - [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])]) - - -# _LT_LIBTOOL_TAG_VARS(TAG) -# ------------------------- -m4_define([_LT_LIBTOOL_TAG_VARS], -[m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames), - [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])]) - - -# _LT_TAGVAR(VARNAME, [TAGNAME]) -# ------------------------------ -m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])]) - - -# _LT_CONFIG_COMMANDS -# ------------------- -# Send accumulated output to $CONFIG_STATUS. Thanks to the lists of -# variables for single and double quote escaping we saved from calls -# to _LT_DECL, we can put quote escaped variables declarations -# into `config.status', and then the shell code to quote escape them in -# for loops in `config.status'. Finally, any additional code accumulated -# from calls to _LT_CONFIG_LIBTOOL_INIT is expanded. -m4_defun([_LT_CONFIG_COMMANDS], -[AC_PROVIDE_IFELSE([LT_OUTPUT], - dnl If the libtool generation code has been placed in $CONFIG_LT, - dnl instead of duplicating it all over again into config.status, - dnl then we will have config.status run $CONFIG_LT later, so it - dnl needs to know what name is stored there: - [AC_CONFIG_COMMANDS([libtool], - [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])], - dnl If the libtool generation code is destined for config.status, - dnl expand the accumulated commands and init code now: - [AC_CONFIG_COMMANDS([libtool], - [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])]) -])#_LT_CONFIG_COMMANDS - - -# Initialize. -m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT], -[ - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -sed_quote_subst='$sed_quote_subst' -double_quote_subst='$double_quote_subst' -delay_variable_subst='$delay_variable_subst' -_LT_CONFIG_STATUS_DECLARATIONS -LTCC='$LTCC' -LTCFLAGS='$LTCFLAGS' -compiler='$compiler_DEFAULT' - -# Quote evaled strings. -for var in lt_decl_all_varnames([[ \ -]], lt_decl_quote_varnames); do - case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in - *[[\\\\\\\`\\"\\\$]]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" - ;; - *) - eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" - ;; - esac -done - -# Double-quote double-evaled strings. -for var in lt_decl_all_varnames([[ \ -]], lt_decl_dquote_varnames); do - case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in - *[[\\\\\\\`\\"\\\$]]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" - ;; - *) - eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" - ;; - esac -done - -# Fix-up fallback echo if it was mangled by the above quoting rules. -case \$lt_ECHO in -*'\\\[$]0 --fallback-echo"')dnl " - lt_ECHO=\`\$ECHO "X\$lt_ECHO" | \$Xsed -e 's/\\\\\\\\\\\\\\\[$]0 --fallback-echo"\[$]/\[$]0 --fallback-echo"/'\` - ;; -esac - -_LT_OUTPUT_LIBTOOL_INIT -]) - - -# LT_OUTPUT -# --------- -# This macro allows early generation of the libtool script (before -# AC_OUTPUT is called), incase it is used in configure for compilation -# tests. -AC_DEFUN([LT_OUTPUT], -[: ${CONFIG_LT=./config.lt} -AC_MSG_NOTICE([creating $CONFIG_LT]) -cat >"$CONFIG_LT" <<_LTEOF -#! $SHELL -# Generated by $as_me. -# Run this file to recreate a libtool stub with the current configuration. - -lt_cl_silent=false -SHELL=\${CONFIG_SHELL-$SHELL} -_LTEOF - -cat >>"$CONFIG_LT" <<\_LTEOF -AS_SHELL_SANITIZE -_AS_PREPARE - -exec AS_MESSAGE_FD>&1 -exec AS_MESSAGE_LOG_FD>>config.log -{ - echo - AS_BOX([Running $as_me.]) -} >&AS_MESSAGE_LOG_FD - -lt_cl_help="\ -\`$as_me' creates a local libtool stub from the current configuration, -for use in further configure time tests before the real libtool is -generated. - -Usage: $[0] [[OPTIONS]] - - -h, --help print this help, then exit - -V, --version print version number, then exit - -q, --quiet do not print progress messages - -d, --debug don't remove temporary files - -Report bugs to ." - -lt_cl_version="\ -m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl -m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) -configured by $[0], generated by m4_PACKAGE_STRING. - -Copyright (C) 2008 Free Software Foundation, Inc. -This config.lt script is free software; the Free Software Foundation -gives unlimited permision to copy, distribute and modify it." - -while test $[#] != 0 -do - case $[1] in - --version | --v* | -V ) - echo "$lt_cl_version"; exit 0 ;; - --help | --h* | -h ) - echo "$lt_cl_help"; exit 0 ;; - --debug | --d* | -d ) - debug=: ;; - --quiet | --q* | --silent | --s* | -q ) - lt_cl_silent=: ;; - - -*) AC_MSG_ERROR([unrecognized option: $[1] -Try \`$[0] --help' for more information.]) ;; - - *) AC_MSG_ERROR([unrecognized argument: $[1] -Try \`$[0] --help' for more information.]) ;; - esac - shift -done - -if $lt_cl_silent; then - exec AS_MESSAGE_FD>/dev/null -fi -_LTEOF - -cat >>"$CONFIG_LT" <<_LTEOF -_LT_OUTPUT_LIBTOOL_COMMANDS_INIT -_LTEOF - -cat >>"$CONFIG_LT" <<\_LTEOF -AC_MSG_NOTICE([creating $ofile]) -_LT_OUTPUT_LIBTOOL_COMMANDS -AS_EXIT(0) -_LTEOF -chmod +x "$CONFIG_LT" - -# configure is writing to config.log, but config.lt does its own redirection, -# appending to config.log, which fails on DOS, as config.log is still kept -# open by configure. Here we exec the FD to /dev/null, effectively closing -# config.log, so it can be properly (re)opened and appended to by config.lt. -if test "$no_create" != yes; then - lt_cl_success=: - test "$silent" = yes && - lt_config_lt_args="$lt_config_lt_args --quiet" - exec AS_MESSAGE_LOG_FD>/dev/null - $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false - exec AS_MESSAGE_LOG_FD>>config.log - $lt_cl_success || AS_EXIT(1) -fi -])# LT_OUTPUT - - -# _LT_CONFIG(TAG) -# --------------- -# If TAG is the built-in tag, create an initial libtool script with a -# default configuration from the untagged config vars. Otherwise add code -# to config.status for appending the configuration named by TAG from the -# matching tagged config vars. -m4_defun([_LT_CONFIG], -[m4_require([_LT_FILEUTILS_DEFAULTS])dnl -_LT_CONFIG_SAVE_COMMANDS([ - m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl - m4_if(_LT_TAG, [C], [ - # See if we are running on zsh, and set the options which allow our - # commands through without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST - fi - - cfgfile="${ofile}T" - trap "$RM \"$cfgfile\"; exit 1" 1 2 15 - $RM "$cfgfile" - - cat <<_LT_EOF >> "$cfgfile" -#! $SHELL - -# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. -# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: -# NOTE: Changes made to this file will be lost: look at ltmain.sh. -# -_LT_COPYING -_LT_LIBTOOL_TAGS - -# ### BEGIN LIBTOOL CONFIG -_LT_LIBTOOL_CONFIG_VARS -_LT_LIBTOOL_TAG_VARS -# ### END LIBTOOL CONFIG - -_LT_EOF - - case $host_os in - aix3*) - cat <<\_LT_EOF >> "$cfgfile" -# AIX sometimes has problems with the GCC collect2 program. For some -# reason, if we set the COLLECT_NAMES environment variable, the problems -# vanish in a puff of smoke. -if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES -fi -_LT_EOF - ;; - esac - - _LT_PROG_LTMAIN - - # We use sed instead of cat because bash on DJGPP gets confused if - # if finds mixed CR/LF and LF-only lines. Since sed operates in - # text mode, it properly converts lines to CR/LF. This bash problem - # is reportedly fixed, but why not run on old versions too? - sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \ - || (rm -f "$cfgfile"; exit 1) - - _LT_PROG_XSI_SHELLFNS - - sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \ - || (rm -f "$cfgfile"; exit 1) - - mv -f "$cfgfile" "$ofile" || - (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") - chmod +x "$ofile" -], -[cat <<_LT_EOF >> "$ofile" - -dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded -dnl in a comment (ie after a #). -# ### BEGIN LIBTOOL TAG CONFIG: $1 -_LT_LIBTOOL_TAG_VARS(_LT_TAG) -# ### END LIBTOOL TAG CONFIG: $1 -_LT_EOF -])dnl /m4_if -], -[m4_if([$1], [], [ - PACKAGE='$PACKAGE' - VERSION='$VERSION' - TIMESTAMP='$TIMESTAMP' - RM='$RM' - ofile='$ofile'], []) -])dnl /_LT_CONFIG_SAVE_COMMANDS -])# _LT_CONFIG - - -# LT_SUPPORTED_TAG(TAG) -# --------------------- -# Trace this macro to discover what tags are supported by the libtool -# --tag option, using: -# autoconf --trace 'LT_SUPPORTED_TAG:$1' -AC_DEFUN([LT_SUPPORTED_TAG], []) - - -# C support is built-in for now -m4_define([_LT_LANG_C_enabled], []) -m4_define([_LT_TAGS], []) - - -# LT_LANG(LANG) -# ------------- -# Enable libtool support for the given language if not already enabled. -AC_DEFUN([LT_LANG], -[AC_BEFORE([$0], [LT_OUTPUT])dnl -m4_case([$1], - [C], [_LT_LANG(C)], - [C++], [_LT_LANG(CXX)], - [Java], [_LT_LANG(GCJ)], - [Fortran 77], [_LT_LANG(F77)], - [Fortran], [_LT_LANG(FC)], - [Windows Resource], [_LT_LANG(RC)], - [m4_ifdef([_LT_LANG_]$1[_CONFIG], - [_LT_LANG($1)], - [m4_fatal([$0: unsupported language: "$1"])])])dnl -])# LT_LANG - - -# _LT_LANG(LANGNAME) -# ------------------ -m4_defun([_LT_LANG], -[m4_ifdef([_LT_LANG_]$1[_enabled], [], - [LT_SUPPORTED_TAG([$1])dnl - m4_append([_LT_TAGS], [$1 ])dnl - m4_define([_LT_LANG_]$1[_enabled], [])dnl - _LT_LANG_$1_CONFIG($1)])dnl -])# _LT_LANG - - -# _LT_LANG_DEFAULT_CONFIG -# ----------------------- -m4_defun([_LT_LANG_DEFAULT_CONFIG], -[AC_PROVIDE_IFELSE([AC_PROG_CXX], - [LT_LANG(CXX)], - [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])]) - -AC_PROVIDE_IFELSE([AC_PROG_F77], - [LT_LANG(F77)], - [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])]) - -AC_PROVIDE_IFELSE([AC_PROG_FC], - [LT_LANG(FC)], - [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])]) - -dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal -dnl pulling things in needlessly. -AC_PROVIDE_IFELSE([AC_PROG_GCJ], - [LT_LANG(GCJ)], - [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], - [LT_LANG(GCJ)], - [AC_PROVIDE_IFELSE([LT_PROG_GCJ], - [LT_LANG(GCJ)], - [m4_ifdef([AC_PROG_GCJ], - [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])]) - m4_ifdef([A][M_PROG_GCJ], - [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])]) - m4_ifdef([LT_PROG_GCJ], - [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])]) - -AC_PROVIDE_IFELSE([LT_PROG_RC], - [LT_LANG(RC)], - [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])]) -])# _LT_LANG_DEFAULT_CONFIG - -# Obsolete macros: -AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)]) -AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) -AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) -AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_CXX], []) -dnl AC_DEFUN([AC_LIBTOOL_F77], []) -dnl AC_DEFUN([AC_LIBTOOL_FC], []) -dnl AC_DEFUN([AC_LIBTOOL_GCJ], []) - - -# _LT_TAG_COMPILER -# ---------------- -m4_defun([_LT_TAG_COMPILER], -[AC_REQUIRE([AC_PROG_CC])dnl - -_LT_DECL([LTCC], [CC], [1], [A C compiler])dnl -_LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl -_LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl -_LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# If no C compiler flags were specified, use CFLAGS. -LTCFLAGS=${LTCFLAGS-"$CFLAGS"} - -# Allow CC to be a program name with arguments. -compiler=$CC -])# _LT_TAG_COMPILER - - -# _LT_COMPILER_BOILERPLATE -# ------------------------ -# Check for compiler boilerplate output or warnings with -# the simple compiler test code. -m4_defun([_LT_COMPILER_BOILERPLATE], -[m4_require([_LT_DECL_SED])dnl -ac_outfile=conftest.$ac_objext -echo "$lt_simple_compile_test_code" >conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$RM conftest* -])# _LT_COMPILER_BOILERPLATE - - -# _LT_LINKER_BOILERPLATE -# ---------------------- -# Check for linker boilerplate output or warnings with -# the simple link test code. -m4_defun([_LT_LINKER_BOILERPLATE], -[m4_require([_LT_DECL_SED])dnl -ac_outfile=conftest.$ac_objext -echo "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$RM -r conftest* -])# _LT_LINKER_BOILERPLATE - -# _LT_REQUIRED_DARWIN_CHECKS -# ------------------------- -m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ - case $host_os in - rhapsody* | darwin*) - AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) - AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) - AC_CHECK_TOOL([LIPO], [lipo], [:]) - AC_CHECK_TOOL([OTOOL], [otool], [:]) - AC_CHECK_TOOL([OTOOL64], [otool64], [:]) - _LT_DECL([], [DSYMUTIL], [1], - [Tool to manipulate archived DWARF debug symbol files on Mac OS X]) - _LT_DECL([], [NMEDIT], [1], - [Tool to change global to local symbols on Mac OS X]) - _LT_DECL([], [LIPO], [1], - [Tool to manipulate fat objects and archives on Mac OS X]) - _LT_DECL([], [OTOOL], [1], - [ldd/readelf like tool for Mach-O binaries on Mac OS X]) - _LT_DECL([], [OTOOL64], [1], - [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4]) - - AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], - [lt_cv_apple_cc_single_mod=no - if test -z "${LT_MULTI_MODULE}"; then - # By default we will add the -single_module flag. You can override - # by either setting the environment variable LT_MULTI_MODULE - # non-empty at configure time, or by adding -multi_module to the - # link flags. - rm -rf libconftest.dylib* - echo "int foo(void){return 1;}" > conftest.c - echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ --dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD - $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ - -dynamiclib -Wl,-single_module conftest.c 2>conftest.err - _lt_result=$? - if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then - lt_cv_apple_cc_single_mod=yes - else - cat conftest.err >&AS_MESSAGE_LOG_FD - fi - rm -rf libconftest.dylib* - rm -f conftest.* - fi]) - AC_CACHE_CHECK([for -exported_symbols_list linker flag], - [lt_cv_ld_exported_symbols_list], - [lt_cv_ld_exported_symbols_list=no - save_LDFLAGS=$LDFLAGS - echo "_main" > conftest.sym - LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" - AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], - [lt_cv_ld_exported_symbols_list=yes], - [lt_cv_ld_exported_symbols_list=no]) - LDFLAGS="$save_LDFLAGS" - ]) - case $host_os in - rhapsody* | darwin1.[[012]]) - _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; - darwin1.*) - _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; - darwin*) # darwin 5.x on - # if running on 10.5 or later, the deployment target defaults - # to the OS version, if on x86, and 10.4, the deployment - # target defaults to 10.4. Don't you love it? - case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in - 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) - _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; - 10.[[012]]*) - _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; - 10.*) - _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; - esac - ;; - esac - if test "$lt_cv_apple_cc_single_mod" = "yes"; then - _lt_dar_single_mod='$single_module' - fi - if test "$lt_cv_ld_exported_symbols_list" = "yes"; then - _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' - else - _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - if test "$DSYMUTIL" != ":"; then - _lt_dsymutil='~$DSYMUTIL $lib || :' - else - _lt_dsymutil= - fi - ;; - esac -]) - - -# _LT_DARWIN_LINKER_FEATURES -# -------------------------- -# Checks for linker and compiler features on darwin -m4_defun([_LT_DARWIN_LINKER_FEATURES], -[ - m4_require([_LT_REQUIRED_DARWIN_CHECKS]) - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_automatic, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_TAGVAR(whole_archive_flag_spec, $1)='' - _LT_TAGVAR(link_all_deplibs, $1)=yes - _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined" - if test "$GCC" = "yes"; then - output_verbose_link_cmd=echo - _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" - _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" - _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" - _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" - m4_if([$1], [CXX], -[ if test "$lt_cv_apple_cc_single_mod" != "yes"; then - _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" - _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" - fi -],[]) - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi -]) - -# _LT_SYS_MODULE_PATH_AIX -# ----------------------- -# Links a minimal program and checks the executable -# for the system default hardcoded library path. In most cases, -# this is /usr/lib:/lib, but when the MPI compilers are used -# the location of the communication and MPI libs are included too. -# If we don't find anything, use the default library path according -# to the aix ld manual. -m4_defun([_LT_SYS_MODULE_PATH_AIX], -[m4_require([_LT_DECL_SED])dnl -AC_LINK_IFELSE(AC_LANG_PROGRAM,[ -lt_aix_libpath_sed=' - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\(.*\)$/\1/ - p - } - }' -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then - aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -fi],[]) -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi -])# _LT_SYS_MODULE_PATH_AIX - - -# _LT_SHELL_INIT(ARG) -# ------------------- -m4_define([_LT_SHELL_INIT], -[ifdef([AC_DIVERSION_NOTICE], - [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], - [AC_DIVERT_PUSH(NOTICE)]) -$1 -AC_DIVERT_POP -])# _LT_SHELL_INIT - - -# _LT_PROG_ECHO_BACKSLASH -# ----------------------- -# Add some code to the start of the generated configure script which -# will find an echo command which doesn't interpret backslashes. -m4_defun([_LT_PROG_ECHO_BACKSLASH], -[_LT_SHELL_INIT([ -# Check that we are running under the correct shell. -SHELL=${CONFIG_SHELL-/bin/sh} - -case X$lt_ECHO in -X*--fallback-echo) - # Remove one level of quotation (which was required for Make). - ECHO=`echo "$lt_ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','` - ;; -esac - -ECHO=${lt_ECHO-echo} -if test "X[$]1" = X--no-reexec; then - # Discard the --no-reexec flag, and continue. - shift -elif test "X[$]1" = X--fallback-echo; then - # Avoid inline document here, it may be left over - : -elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' ; then - # Yippee, $ECHO works! - : -else - # Restart under the correct shell. - exec $SHELL "[$]0" --no-reexec ${1+"[$]@"} -fi - -if test "X[$]1" = X--fallback-echo; then - # used as fallback echo - shift - cat <<_LT_EOF -[$]* -_LT_EOF - exit 0 -fi - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -if test -z "$lt_ECHO"; then - if test "X${echo_test_string+set}" != Xset; then - # find a string as large as possible, as long as the shell can cope with it - for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do - # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... - if { echo_test_string=`eval $cmd`; } 2>/dev/null && - { test "X$echo_test_string" = "X$echo_test_string"; } 2>/dev/null - then - break - fi - done - fi - - if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' && - echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - : - else - # The Solaris, AIX, and Digital Unix default echo programs unquote - # backslashes. This makes it impossible to quote backslashes using - # echo "$something" | sed 's/\\/\\\\/g' - # - # So, first we look for a working echo in the user's PATH. - - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for dir in $PATH /usr/ucb; do - IFS="$lt_save_ifs" - if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && - test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - ECHO="$dir/echo" - break - fi - done - IFS="$lt_save_ifs" - - if test "X$ECHO" = Xecho; then - # We didn't find a better echo, so look for alternatives. - if test "X`{ print -r '\t'; } 2>/dev/null`" = 'X\t' && - echo_testing_string=`{ print -r "$echo_test_string"; } 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - # This shell has a builtin print -r that does the trick. - ECHO='print -r' - elif { test -f /bin/ksh || test -f /bin/ksh$ac_exeext; } && - test "X$CONFIG_SHELL" != X/bin/ksh; then - # If we have ksh, try running configure again with it. - ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} - export ORIGINAL_CONFIG_SHELL - CONFIG_SHELL=/bin/ksh - export CONFIG_SHELL - exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"} - else - # Try using printf. - ECHO='printf %s\n' - if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' && - echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - # Cool, printf works - : - elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && - test "X$echo_testing_string" = 'X\t' && - echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL - export CONFIG_SHELL - SHELL="$CONFIG_SHELL" - export SHELL - ECHO="$CONFIG_SHELL [$]0 --fallback-echo" - elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && - test "X$echo_testing_string" = 'X\t' && - echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - ECHO="$CONFIG_SHELL [$]0 --fallback-echo" - else - # maybe with a smaller string... - prev=: - - for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do - if { test "X$echo_test_string" = "X`eval $cmd`"; } 2>/dev/null - then - break - fi - prev="$cmd" - done - - if test "$prev" != 'sed 50q "[$]0"'; then - echo_test_string=`eval $prev` - export echo_test_string - exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"} - else - # Oops. We lost completely, so just stick with echo. - ECHO=echo - fi - fi - fi - fi - fi -fi - -# Copy echo and quote the copy suitably for passing to libtool from -# the Makefile, instead of quoting the original, which is used later. -lt_ECHO=$ECHO -if test "X$lt_ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then - lt_ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo" -fi - -AC_SUBST(lt_ECHO) -]) -_LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) -_LT_DECL([], [ECHO], [1], - [An echo program that does not interpret backslashes]) -])# _LT_PROG_ECHO_BACKSLASH - - -# _LT_ENABLE_LOCK -# --------------- -m4_defun([_LT_ENABLE_LOCK], -[AC_ARG_ENABLE([libtool-lock], - [AS_HELP_STRING([--disable-libtool-lock], - [avoid locking (might break parallel builds)])]) -test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes - -# Some flags need to be propagated to the compiler or linker for good -# libtool support. -case $host in -ia64-*-hpux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case `/usr/bin/file conftest.$ac_objext` in - *ELF-32*) - HPUX_IA64_MODE="32" - ;; - *ELF-64*) - HPUX_IA64_MODE="64" - ;; - esac - fi - rm -rf conftest* - ;; -*-*-irix6*) - # Find out which ABI we are using. - echo '[#]line __oline__ "configure"' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - if test "$lt_cv_prog_gnu_ld" = yes; then - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -melf32bsmip" - ;; - *N32*) - LD="${LD-ld} -melf32bmipn32" - ;; - *64-bit*) - LD="${LD-ld} -melf64bmip" - ;; - esac - else - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -32" - ;; - *N32*) - LD="${LD-ld} -n32" - ;; - *64-bit*) - LD="${LD-ld} -64" - ;; - esac - fi - fi - rm -rf conftest* - ;; - -x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ -s390*-*linux*|s390*-*tpf*|sparc*-*linux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case `/usr/bin/file conftest.o` in - *32-bit*) - case $host in - x86_64-*kfreebsd*-gnu) - LD="${LD-ld} -m elf_i386_fbsd" - ;; - x86_64-*linux*) - LD="${LD-ld} -m elf_i386" - ;; - ppc64-*linux*|powerpc64-*linux*) - LD="${LD-ld} -m elf32ppclinux" - ;; - s390x-*linux*) - LD="${LD-ld} -m elf_s390" - ;; - sparc64-*linux*) - LD="${LD-ld} -m elf32_sparc" - ;; - esac - ;; - *64-bit*) - case $host in - x86_64-*kfreebsd*-gnu) - LD="${LD-ld} -m elf_x86_64_fbsd" - ;; - x86_64-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; - ppc*-*linux*|powerpc*-*linux*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*|s390*-*tpf*) - LD="${LD-ld} -m elf64_s390" - ;; - sparc*-*linux*) - LD="${LD-ld} -m elf64_sparc" - ;; - esac - ;; - esac - fi - rm -rf conftest* - ;; - -*-*-sco3.2v5*) - # On SCO OpenServer 5, we need -belf to get full-featured binaries. - SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -belf" - AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, - [AC_LANG_PUSH(C) - AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) - AC_LANG_POP]) - if test x"$lt_cv_cc_needs_belf" != x"yes"; then - # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf - CFLAGS="$SAVE_CFLAGS" - fi - ;; -sparc*-*solaris*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case `/usr/bin/file conftest.o` in - *64-bit*) - case $lt_cv_prog_gnu_ld in - yes*) LD="${LD-ld} -m elf64_sparc" ;; - *) - if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then - LD="${LD-ld} -64" - fi - ;; - esac - ;; - esac - fi - rm -rf conftest* - ;; -esac - -need_locks="$enable_libtool_lock" -])# _LT_ENABLE_LOCK - - -# _LT_CMD_OLD_ARCHIVE -# ------------------- -m4_defun([_LT_CMD_OLD_ARCHIVE], -[AC_CHECK_TOOL(AR, ar, false) -test -z "$AR" && AR=ar -test -z "$AR_FLAGS" && AR_FLAGS=cru -_LT_DECL([], [AR], [1], [The archiver]) -_LT_DECL([], [AR_FLAGS], [1]) - -AC_CHECK_TOOL(STRIP, strip, :) -test -z "$STRIP" && STRIP=: -_LT_DECL([], [STRIP], [1], [A symbol stripping program]) - -AC_CHECK_TOOL(RANLIB, ranlib, :) -test -z "$RANLIB" && RANLIB=: -_LT_DECL([], [RANLIB], [1], - [Commands used to install an old-style archive]) - -# Determine commands to create old-style static archives. -old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' -old_postinstall_cmds='chmod 644 $oldlib' -old_postuninstall_cmds= - -if test -n "$RANLIB"; then - case $host_os in - openbsd*) - old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" - ;; - *) - old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" - ;; - esac - old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" -fi -_LT_DECL([], [old_postinstall_cmds], [2]) -_LT_DECL([], [old_postuninstall_cmds], [2]) -_LT_TAGDECL([], [old_archive_cmds], [2], - [Commands used to build an old-style archive]) -])# _LT_CMD_OLD_ARCHIVE - - -# _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, -# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) -# ---------------------------------------------------------------- -# Check whether the given compiler option works -AC_DEFUN([_LT_COMPILER_OPTION], -[m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_DECL_SED])dnl -AC_CACHE_CHECK([$1], [$2], - [$2=no - m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$3" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&AS_MESSAGE_LOG_FD - echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then - $2=yes - fi - fi - $RM conftest* -]) - -if test x"[$]$2" = xyes; then - m4_if([$5], , :, [$5]) -else - m4_if([$6], , :, [$6]) -fi -])# _LT_COMPILER_OPTION - -# Old name: -AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], []) - - -# _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, -# [ACTION-SUCCESS], [ACTION-FAILURE]) -# ---------------------------------------------------- -# Check whether the given linker option works -AC_DEFUN([_LT_LINKER_OPTION], -[m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_DECL_SED])dnl -AC_CACHE_CHECK([$1], [$2], - [$2=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $3" - echo "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The linker can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - # Append any errors to the config.log. - cat conftest.err 1>&AS_MESSAGE_LOG_FD - $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if diff conftest.exp conftest.er2 >/dev/null; then - $2=yes - fi - else - $2=yes - fi - fi - $RM -r conftest* - LDFLAGS="$save_LDFLAGS" -]) - -if test x"[$]$2" = xyes; then - m4_if([$4], , :, [$4]) -else - m4_if([$5], , :, [$5]) -fi -])# _LT_LINKER_OPTION - -# Old name: -AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], []) - - -# LT_CMD_MAX_LEN -#--------------- -AC_DEFUN([LT_CMD_MAX_LEN], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -# find the maximum length of command line arguments -AC_MSG_CHECKING([the maximum length of command line arguments]) -AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl - i=0 - teststring="ABCD" - - case $build_os in - msdosdjgpp*) - # On DJGPP, this test can blow up pretty badly due to problems in libc - # (any single argument exceeding 2000 bytes causes a buffer overrun - # during glob expansion). Even if it were fixed, the result of this - # check would be larger than it should be. - lt_cv_sys_max_cmd_len=12288; # 12K is about right - ;; - - gnu*) - # Under GNU Hurd, this test is not required because there is - # no limit to the length of command line arguments. - # Libtool will interpret -1 as no limit whatsoever - lt_cv_sys_max_cmd_len=-1; - ;; - - cygwin* | mingw*) - # On Win9x/ME, this test blows up -- it succeeds, but takes - # about 5 minutes as the teststring grows exponentially. - # Worse, since 9x/ME are not pre-emptively multitasking, - # you end up with a "frozen" computer, even though with patience - # the test eventually succeeds (with a max line length of 256k). - # Instead, let's just punt: use the minimum linelength reported by - # all of the supported platforms: 8192 (on NT/2K/XP). - lt_cv_sys_max_cmd_len=8192; - ;; - - amigaos*) - # On AmigaOS with pdksh, this test takes hours, literally. - # So we just punt and use a minimum line length of 8192. - lt_cv_sys_max_cmd_len=8192; - ;; - - netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) - # This has been around since 386BSD, at least. Likely further. - if test -x /sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` - elif test -x /usr/sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` - else - lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs - fi - # And add a safety zone - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` - ;; - - interix*) - # We know the value 262144 and hardcode it with a safety zone (like BSD) - lt_cv_sys_max_cmd_len=196608 - ;; - - osf*) - # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure - # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not - # nice to cause kernel panics so lets avoid the loop below. - # First set a reasonable default. - lt_cv_sys_max_cmd_len=16384 - # - if test -x /sbin/sysconfig; then - case `/sbin/sysconfig -q proc exec_disable_arg_limit` in - *1*) lt_cv_sys_max_cmd_len=-1 ;; - esac - fi - ;; - sco3.2v5*) - lt_cv_sys_max_cmd_len=102400 - ;; - sysv5* | sco5v6* | sysv4.2uw2*) - kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` - if test -n "$kargmax"; then - lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` - else - lt_cv_sys_max_cmd_len=32768 - fi - ;; - *) - lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` - if test -n "$lt_cv_sys_max_cmd_len"; then - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` - else - # Make teststring a little bigger before we do anything with it. - # a 1K string should be a reasonable start. - for i in 1 2 3 4 5 6 7 8 ; do - teststring=$teststring$teststring - done - SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} - # If test is not a shell built-in, we'll probably end up computing a - # maximum length that is only half of the actual maximum length, but - # we can't tell. - while { test "X"`$SHELL [$]0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \ - = "XX$teststring$teststring"; } >/dev/null 2>&1 && - test $i != 17 # 1/2 MB should be enough - do - i=`expr $i + 1` - teststring=$teststring$teststring - done - # Only check the string length outside the loop. - lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` - teststring= - # Add a significant safety factor because C++ compilers can tack on - # massive amounts of additional arguments before passing them to the - # linker. It appears as though 1/2 is a usable value. - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` - fi - ;; - esac -]) -if test -n $lt_cv_sys_max_cmd_len ; then - AC_MSG_RESULT($lt_cv_sys_max_cmd_len) -else - AC_MSG_RESULT(none) -fi -max_cmd_len=$lt_cv_sys_max_cmd_len -_LT_DECL([], [max_cmd_len], [0], - [What is the maximum length of a command?]) -])# LT_CMD_MAX_LEN - -# Old name: -AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], []) - - -# _LT_HEADER_DLFCN -# ---------------- -m4_defun([_LT_HEADER_DLFCN], -[AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl -])# _LT_HEADER_DLFCN - - -# _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, -# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) -# ---------------------------------------------------------------- -m4_defun([_LT_TRY_DLOPEN_SELF], -[m4_require([_LT_HEADER_DLFCN])dnl -if test "$cross_compiling" = yes; then : - [$4] -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF -[#line __oline__ "configure" -#include "confdefs.h" - -#if HAVE_DLFCN_H -#include -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -#ifdef __cplusplus -extern "C" void exit (int); -#endif - -void fnord() { int i=42;} -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - /* dlclose (self); */ - } - else - puts (dlerror ()); - - exit (status); -}] -_LT_EOF - if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) $1 ;; - x$lt_dlneed_uscore) $2 ;; - x$lt_dlunknown|x*) $3 ;; - esac - else : - # compilation failed - $3 - fi -fi -rm -fr conftest* -])# _LT_TRY_DLOPEN_SELF - - -# LT_SYS_DLOPEN_SELF -# ------------------ -AC_DEFUN([LT_SYS_DLOPEN_SELF], -[m4_require([_LT_HEADER_DLFCN])dnl -if test "x$enable_dlopen" != xyes; then - enable_dlopen=unknown - enable_dlopen_self=unknown - enable_dlopen_self_static=unknown -else - lt_cv_dlopen=no - lt_cv_dlopen_libs= - - case $host_os in - beos*) - lt_cv_dlopen="load_add_on" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ;; - - mingw* | pw32*) - lt_cv_dlopen="LoadLibrary" - lt_cv_dlopen_libs= - ;; - - cygwin*) - lt_cv_dlopen="dlopen" - lt_cv_dlopen_libs= - ;; - - darwin*) - # if libdl is installed we need to link against it - AC_CHECK_LIB([dl], [dlopen], - [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ - lt_cv_dlopen="dyld" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ]) - ;; - - *) - AC_CHECK_FUNC([shl_load], - [lt_cv_dlopen="shl_load"], - [AC_CHECK_LIB([dld], [shl_load], - [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"], - [AC_CHECK_FUNC([dlopen], - [lt_cv_dlopen="dlopen"], - [AC_CHECK_LIB([dl], [dlopen], - [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], - [AC_CHECK_LIB([svld], [dlopen], - [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], - [AC_CHECK_LIB([dld], [dld_link], - [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"]) - ]) - ]) - ]) - ]) - ]) - ;; - esac - - if test "x$lt_cv_dlopen" != xno; then - enable_dlopen=yes - else - enable_dlopen=no - fi - - case $lt_cv_dlopen in - dlopen) - save_CPPFLAGS="$CPPFLAGS" - test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" - - save_LDFLAGS="$LDFLAGS" - wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" - - save_LIBS="$LIBS" - LIBS="$lt_cv_dlopen_libs $LIBS" - - AC_CACHE_CHECK([whether a program can dlopen itself], - lt_cv_dlopen_self, [dnl - _LT_TRY_DLOPEN_SELF( - lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, - lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) - ]) - - if test "x$lt_cv_dlopen_self" = xyes; then - wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" - AC_CACHE_CHECK([whether a statically linked program can dlopen itself], - lt_cv_dlopen_self_static, [dnl - _LT_TRY_DLOPEN_SELF( - lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, - lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) - ]) - fi - - CPPFLAGS="$save_CPPFLAGS" - LDFLAGS="$save_LDFLAGS" - LIBS="$save_LIBS" - ;; - esac - - case $lt_cv_dlopen_self in - yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; - *) enable_dlopen_self=unknown ;; - esac - - case $lt_cv_dlopen_self_static in - yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; - *) enable_dlopen_self_static=unknown ;; - esac -fi -_LT_DECL([dlopen_support], [enable_dlopen], [0], - [Whether dlopen is supported]) -_LT_DECL([dlopen_self], [enable_dlopen_self], [0], - [Whether dlopen of programs is supported]) -_LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0], - [Whether dlopen of statically linked programs is supported]) -])# LT_SYS_DLOPEN_SELF - -# Old name: -AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], []) - - -# _LT_COMPILER_C_O([TAGNAME]) -# --------------------------- -# Check to see if options -c and -o are simultaneously supported by compiler. -# This macro does not hard code the compiler like AC_PROG_CC_C_O. -m4_defun([_LT_COMPILER_C_O], -[m4_require([_LT_DECL_SED])dnl -m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_TAG_COMPILER])dnl -AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], - [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)], - [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no - $RM -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&AS_MESSAGE_LOG_FD - echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp - $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then - _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes - fi - fi - chmod u+w . 2>&AS_MESSAGE_LOG_FD - $RM conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files - $RM out/* && rmdir out - cd .. - $RM -r conftest - $RM conftest* -]) -_LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1], - [Does compiler simultaneously support -c and -o options?]) -])# _LT_COMPILER_C_O - - -# _LT_COMPILER_FILE_LOCKS([TAGNAME]) -# ---------------------------------- -# Check to see if we can do hard links to lock some files if needed -m4_defun([_LT_COMPILER_FILE_LOCKS], -[m4_require([_LT_ENABLE_LOCK])dnl -m4_require([_LT_FILEUTILS_DEFAULTS])dnl -_LT_COMPILER_C_O([$1]) - -hard_links="nottested" -if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then - # do not overwrite the value of need_locks provided by the user - AC_MSG_CHECKING([if we can lock with hard links]) - hard_links=yes - $RM conftest* - ln conftest.a conftest.b 2>/dev/null && hard_links=no - touch conftest.a - ln conftest.a conftest.b 2>&5 || hard_links=no - ln conftest.a conftest.b 2>/dev/null && hard_links=no - AC_MSG_RESULT([$hard_links]) - if test "$hard_links" = no; then - AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) - need_locks=warn - fi -else - need_locks=no -fi -_LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?]) -])# _LT_COMPILER_FILE_LOCKS - - -# _LT_CHECK_OBJDIR -# ---------------- -m4_defun([_LT_CHECK_OBJDIR], -[AC_CACHE_CHECK([for objdir], [lt_cv_objdir], -[rm -f .libs 2>/dev/null -mkdir .libs 2>/dev/null -if test -d .libs; then - lt_cv_objdir=.libs -else - # MS-DOS does not allow filenames that begin with a dot. - lt_cv_objdir=_libs -fi -rmdir .libs 2>/dev/null]) -objdir=$lt_cv_objdir -_LT_DECL([], [objdir], [0], - [The name of the directory that contains temporary libtool files])dnl -m4_pattern_allow([LT_OBJDIR])dnl -AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/", - [Define to the sub-directory in which libtool stores uninstalled libraries.]) -])# _LT_CHECK_OBJDIR - - -# _LT_LINKER_HARDCODE_LIBPATH([TAGNAME]) -# -------------------------------------- -# Check hardcoding attributes. -m4_defun([_LT_LINKER_HARDCODE_LIBPATH], -[AC_MSG_CHECKING([how to hardcode library paths into programs]) -_LT_TAGVAR(hardcode_action, $1)= -if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" || - test -n "$_LT_TAGVAR(runpath_var, $1)" || - test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then - - # We can hardcode non-existent directories. - if test "$_LT_TAGVAR(hardcode_direct, $1)" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no && - test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then - # Linking always hardcodes the temporary library directory. - _LT_TAGVAR(hardcode_action, $1)=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - _LT_TAGVAR(hardcode_action, $1)=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - _LT_TAGVAR(hardcode_action, $1)=unsupported -fi -AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)]) - -if test "$_LT_TAGVAR(hardcode_action, $1)" = relink || - test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi -_LT_TAGDECL([], [hardcode_action], [0], - [How to hardcode a shared library path into an executable]) -])# _LT_LINKER_HARDCODE_LIBPATH - - -# _LT_CMD_STRIPLIB -# ---------------- -m4_defun([_LT_CMD_STRIPLIB], -[m4_require([_LT_DECL_EGREP]) -striplib= -old_striplib= -AC_MSG_CHECKING([whether stripping libraries is possible]) -if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - AC_MSG_RESULT([yes]) -else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP" ; then - striplib="$STRIP -x" - old_striplib="$STRIP -S" - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - fi - ;; - *) - AC_MSG_RESULT([no]) - ;; - esac -fi -_LT_DECL([], [old_striplib], [1], [Commands to strip libraries]) -_LT_DECL([], [striplib], [1]) -])# _LT_CMD_STRIPLIB - - -# _LT_SYS_DYNAMIC_LINKER([TAG]) -# ----------------------------- -# PORTME Fill in your ld.so characteristics -m4_defun([_LT_SYS_DYNAMIC_LINKER], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -m4_require([_LT_DECL_EGREP])dnl -m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_DECL_SED])dnl -AC_MSG_CHECKING([dynamic linker characteristics]) -m4_if([$1], - [], [ -if test "$GCC" = yes; then - case $host_os in - darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; - *) lt_awk_arg="/^libraries:/" ;; - esac - lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if $ECHO "$lt_search_path_spec" | $GREP ';' >/dev/null ; then - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e 's/;/ /g'` - else - lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - # Ok, now we have the path, separated by spaces, we can step through it - # and add multilib dir if necessary. - lt_tmp_lt_search_path_spec= - lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` - for lt_sys_path in $lt_search_path_spec; do - if test -d "$lt_sys_path/$lt_multi_os_dir"; then - lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" - else - test -d "$lt_sys_path" && \ - lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" - fi - done - lt_search_path_spec=`$ECHO $lt_tmp_lt_search_path_spec | awk ' -BEGIN {RS=" "; FS="/|\n";} { - lt_foo=""; - lt_count=0; - for (lt_i = NF; lt_i > 0; lt_i--) { - if ($lt_i != "" && $lt_i != ".") { - if ($lt_i == "..") { - lt_count++; - } else { - if (lt_count == 0) { - lt_foo="/" $lt_i lt_foo; - } else { - lt_count--; - } - } - } - } - if (lt_foo != "") { lt_freq[[lt_foo]]++; } - if (lt_freq[[lt_foo]] == 1) { print lt_foo; } -}'` - sys_lib_search_path_spec=`$ECHO $lt_search_path_spec` -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi]) -library_names_spec= -libname_spec='lib$name' -soname_spec= -shrext_cmds=".so" -postinstall_cmds= -postuninstall_cmds= -finish_cmds= -finish_eval= -shlibpath_var= -shlibpath_overrides_runpath=unknown -version_type=none -dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown - -case $host_os in -aix3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' - shlibpath_var=LIBPATH - - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' - ;; - -aix[[4-9]]*) - version_type=linux - need_lib_prefix=no - need_version=no - hardcode_into_libs=yes - if test "$host_cpu" = ia64; then - # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - else - # With GCC up to 2.95.x, collect2 would create an import file - # for dependence libraries. The import file would start with - # the line `#! .'. This would cause the generated library to - # depend on `.', always an invalid library. This was fixed in - # development snapshots of GCC prior to 3.0. - case $host_os in - aix4 | aix4.[[01]] | aix4.[[01]].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; - esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. - if test "$aix_use_runtimelinking" = yes; then - # If using run time linking (on AIX 4.2 or later) use lib.so - # instead of lib.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - else - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' - fi - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - case $host_cpu in - powerpc) - # Since July 2007 AmigaOS4 officially supports .so libraries. - # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - ;; - m68k) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' - ;; - esac - ;; - -beos*) - library_names_spec='${libname}${shared_ext}' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - ;; - -bsdi[[45]]*) - version_type=linux - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" - sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - # the default ld.so.conf also contains /usr/contrib/lib and - # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow - # libtool to hard-code these into programs - ;; - -cygwin* | mingw* | pw32*) - version_type=windows - shrext_cmds=".dll" - need_version=no - need_lib_prefix=no - - case $GCC,$host_os in - yes,cygwin* | yes,mingw* | yes,pw32*) - library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname~ - chmod a+x \$dldir/$dlname~ - if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then - eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; - fi' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $RM \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" - ;; - mingw*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then - # It is most probably a Windows format PATH printed by - # mingw gcc, but we are running on Cygwin. Gcc prints its search - # path with ; separators, and with drive letters. We can handle the - # drive letters (cygwin fileutils understands them), so leave them, - # especially as we might pass files found there to a mingw objdump, - # which wouldn't understand a cygwinified path. Ahh. - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' - ;; - esac - ;; - - *) - library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' - ;; - esac - dynamic_linker='Win32 ld.exe' - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - ;; - -darwin* | rhapsody*) - dynamic_linker="$host_os dyld" - version_type=darwin - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' - shlibpath_overrides_runpath=yes - shlibpath_var=DYLD_LIBRARY_PATH - shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' -m4_if([$1], [],[ - sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -freebsd1*) - dynamic_linker=no - ;; - -freebsd* | dragonfly*) - # DragonFly does not have aout. When/if they implement a new - # versioning mechanism, adjust this. - if test -x /usr/bin/objformat; then - objformat=`/usr/bin/objformat` - else - case $host_os in - freebsd[[123]]*) objformat=aout ;; - *) objformat=elf ;; - esac - fi - version_type=freebsd-$objformat - case $version_type in - freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case $host_os in - freebsd2*) - shlibpath_overrides_runpath=yes - ;; - freebsd3.[[01]]* | freebsdelf3.[[01]]*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ - freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - *) # from 4.6 on, and DragonFly - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - esac - ;; - -gnu*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - hardcode_into_libs=yes - ;; - -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - version_type=sunos - need_lib_prefix=no - need_version=no - case $host_cpu in - ia64*) - shrext_cmds='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - if test "X$HPUX_IA64_MODE" = X32; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - hppa*64*) - shrext_cmds='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext_cmds='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - ;; - esac - # HP-UX runs *really* slowly unless shared libraries are mode 555. - postinstall_cmds='chmod 555 $lib' - ;; - -interix[[3-9]]*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -irix5* | irix6* | nonstopux*) - case $host_os in - nonstopux*) version_type=nonstopux ;; - *) - if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux - else - version_type=irix - fi ;; - esac - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' - case $host_os in - irix5* | nonstopux*) - libsuff= shlibsuff= - ;; - *) - case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; - esac - ;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" - sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - hardcode_into_libs=yes - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) - dynamic_linker=no - ;; - -# This must be Linux ELF. -linux* | k*bsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - # Some binutils ld are patched to set DT_RUNPATH - save_LDFLAGS=$LDFLAGS - save_libdir=$libdir - eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ - LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" - AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], - [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], - [shlibpath_overrides_runpath=yes])]) - LDFLAGS=$save_LDFLAGS - libdir=$save_libdir - - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - # Append ld.so.conf contents to the search path - if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" - fi - - # We used to test for /lib/ld.so.1 and disable shared libraries on - # powerpc, because MkLinux only supported shared libraries with the - # GNU dynamic linker. Since this was broken with cross compilers, - # most powerpc-linux boxes support dynamic linking these days and - # people can always --disable-shared, the test was removed, and we - # assume the GNU/Linux dynamic linker is in use. - dynamic_linker='GNU/Linux ld.so' - ;; - -netbsdelf*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='NetBSD ld.elf_so' - ;; - -netbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='NetBSD ld.elf_so' - fi - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - -newsos6) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -*nto* | *qnx*) - version_type=qnx - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='ldqnx.so' - ;; - -openbsd*) - version_type=sunos - sys_lib_dlsearch_path_spec="/usr/lib" - need_lib_prefix=no - # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. - case $host_os in - openbsd3.3 | openbsd3.3.*) need_version=yes ;; - *) need_version=no ;; - esac - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case $host_os in - openbsd2.[[89]] | openbsd2.[[89]].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac - else - shlibpath_overrides_runpath=yes - fi - ;; - -os2*) - libname_spec='$name' - shrext_cmds=".dll" - need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=LIBPATH - ;; - -osf3* | osf4* | osf5*) - version_type=osf - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - ;; - -rdos*) - dynamic_linker=no - ;; - -solaris*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - ;; - -sunos4*) - version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - if test "$with_gnu_ld" = yes; then - need_lib_prefix=no - fi - need_version=yes - ;; - -sysv4 | sysv4.3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - case $host_vendor in - sni) - shlibpath_overrides_runpath=no - need_lib_prefix=no - runpath_var=LD_RUN_PATH - ;; - siemens) - need_lib_prefix=no - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - ;; - esac - ;; - -sysv4*MP*) - if test -d /usr/nec ;then - version_type=linux - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; - -sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - version_type=freebsd-elf - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - if test "$with_gnu_ld" = yes; then - sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' - else - sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' - case $host_os in - sco3.2v5*) - sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" - ;; - esac - fi - sys_lib_dlsearch_path_spec='/usr/lib' - ;; - -tpf*) - # TPF is a cross-target only. Preferred cross-host = GNU/Linux. - version_type=linux - need_lib_prefix=no - need_version=no - library_name_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -uts4*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -*) - dynamic_linker=no - ;; -esac -AC_MSG_RESULT([$dynamic_linker]) -test "$dynamic_linker" = no && can_build_shared=no - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - -if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then - sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" -fi -if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then - sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" -fi - -_LT_DECL([], [variables_saved_for_relink], [1], - [Variables whose values should be saved in libtool wrapper scripts and - restored at link time]) -_LT_DECL([], [need_lib_prefix], [0], - [Do we need the "lib" prefix for modules?]) -_LT_DECL([], [need_version], [0], [Do we need a version for libraries?]) -_LT_DECL([], [version_type], [0], [Library versioning type]) -_LT_DECL([], [runpath_var], [0], [Shared library runtime path variable]) -_LT_DECL([], [shlibpath_var], [0],[Shared library path variable]) -_LT_DECL([], [shlibpath_overrides_runpath], [0], - [Is shlibpath searched before the hard-coded library search path?]) -_LT_DECL([], [libname_spec], [1], [Format of library name prefix]) -_LT_DECL([], [library_names_spec], [1], - [[List of archive names. First name is the real one, the rest are links. - The last name is the one that the linker finds with -lNAME]]) -_LT_DECL([], [soname_spec], [1], - [[The coded name of the library, if different from the real name]]) -_LT_DECL([], [postinstall_cmds], [2], - [Command to use after installation of a shared archive]) -_LT_DECL([], [postuninstall_cmds], [2], - [Command to use after uninstallation of a shared archive]) -_LT_DECL([], [finish_cmds], [2], - [Commands used to finish a libtool library installation in a directory]) -_LT_DECL([], [finish_eval], [1], - [[As "finish_cmds", except a single script fragment to be evaled but - not shown]]) -_LT_DECL([], [hardcode_into_libs], [0], - [Whether we should hardcode library paths into libraries]) -_LT_DECL([], [sys_lib_search_path_spec], [2], - [Compile-time system search path for libraries]) -_LT_DECL([], [sys_lib_dlsearch_path_spec], [2], - [Run-time system search path for libraries]) -])# _LT_SYS_DYNAMIC_LINKER - - -# _LT_PATH_TOOL_PREFIX(TOOL) -# -------------------------- -# find a file program which can recognize shared library -AC_DEFUN([_LT_PATH_TOOL_PREFIX], -[m4_require([_LT_DECL_EGREP])dnl -AC_MSG_CHECKING([for $1]) -AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, -[case $MAGIC_CMD in -[[\\/*] | ?:[\\/]*]) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. - ;; -*) - lt_save_MAGIC_CMD="$MAGIC_CMD" - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR -dnl $ac_dummy forces splitting on constant user-supplied paths. -dnl POSIX.2 word splitting is done only on the output of word expansions, -dnl not every word. This closes a longstanding sh security hole. - ac_dummy="m4_if([$2], , $PATH, [$2])" - for ac_dir in $ac_dummy; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$1; then - lt_cv_path_MAGIC_CMD="$ac_dir/$1" - if test -n "$file_magic_test_file"; then - case $deplibs_check_method in - "file_magic "*) - file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` - MAGIC_CMD="$lt_cv_path_MAGIC_CMD" - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - $EGREP "$file_magic_regex" > /dev/null; then - : - else - cat <<_LT_EOF 1>&2 - -*** Warning: the command libtool uses to detect shared libraries, -*** $file_magic_cmd, produces output that libtool cannot recognize. -*** The result is that libtool may fail to recognize shared libraries -*** as such. This will affect the creation of libtool libraries that -*** depend on shared libraries, but programs linked with such libtool -*** libraries will work regardless of this problem. Nevertheless, you -*** may want to report the problem to your system manager and/or to -*** bug-libtool@gnu.org - -_LT_EOF - fi ;; - esac - fi - break - fi - done - IFS="$lt_save_ifs" - MAGIC_CMD="$lt_save_MAGIC_CMD" - ;; -esac]) -MAGIC_CMD="$lt_cv_path_MAGIC_CMD" -if test -n "$MAGIC_CMD"; then - AC_MSG_RESULT($MAGIC_CMD) -else - AC_MSG_RESULT(no) -fi -_LT_DECL([], [MAGIC_CMD], [0], - [Used to examine libraries when file_magic_cmd begins with "file"])dnl -])# _LT_PATH_TOOL_PREFIX - -# Old name: -AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], []) - - -# _LT_PATH_MAGIC -# -------------- -# find a file program which can recognize a shared library -m4_defun([_LT_PATH_MAGIC], -[_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) -if test -z "$lt_cv_path_MAGIC_CMD"; then - if test -n "$ac_tool_prefix"; then - _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) - else - MAGIC_CMD=: - fi -fi -])# _LT_PATH_MAGIC - - -# LT_PATH_LD -# ---------- -# find the pathname to the GNU or non-GNU linker -AC_DEFUN([LT_PATH_LD], -[AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_CANONICAL_BUILD])dnl -m4_require([_LT_DECL_SED])dnl -m4_require([_LT_DECL_EGREP])dnl - -AC_ARG_WITH([gnu-ld], - [AS_HELP_STRING([--with-gnu-ld], - [assume the C compiler uses GNU ld @<:@default=no@:>@])], - [test "$withval" = no || with_gnu_ld=yes], - [with_gnu_ld=no])dnl - -ac_prog=ld -if test "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - AC_MSG_CHECKING([for ld used by $CC]) - case $host in - *-*-mingw*) - # gcc leaves a trailing carriage return which upsets mingw - ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; - *) - ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; - esac - case $ac_prog in - # Accept absolute paths. - [[\\/]]* | ?:[[\\/]]*) - re_direlt='/[[^/]][[^/]]*/\.\./' - # Canonicalize the pathname of ld - ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` - while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do - ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` - done - test -z "$LD" && LD="$ac_prog" - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac -elif test "$with_gnu_ld" = yes; then - AC_MSG_CHECKING([for GNU ld]) -else - AC_MSG_CHECKING([for non-GNU ld]) -fi -AC_CACHE_VAL(lt_cv_path_LD, -[if test -z "$LD"; then - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - lt_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some variants of GNU ld only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - case `"$lt_cv_path_LD" -v 2>&1 &1 /dev/null 2>&1; then - lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' - lt_cv_file_magic_cmd='func_win32_libid' - else - lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' - lt_cv_file_magic_cmd='$OBJDUMP -f' - fi - ;; - -darwin* | rhapsody*) - lt_cv_deplibs_check_method=pass_all - ;; - -freebsd* | dragonfly*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then - case $host_cpu in - i*86 ) - # Not sure whether the presence of OpenBSD here was a mistake. - # Let's accept both of them until this is cleared up. - lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` - ;; - esac - else - lt_cv_deplibs_check_method=pass_all - fi - ;; - -gnu*) - lt_cv_deplibs_check_method=pass_all - ;; - -hpux10.20* | hpux11*) - lt_cv_file_magic_cmd=/usr/bin/file - case $host_cpu in - ia64*) - lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' - lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so - ;; - hppa*64*) - [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'] - lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl - ;; - *) - lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library' - lt_cv_file_magic_test_file=/usr/lib/libc.sl - ;; - esac - ;; - -interix[[3-9]]*) - # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' - ;; - -irix5* | irix6* | nonstopux*) - case $LD in - *-32|*"-32 ") libmagic=32-bit;; - *-n32|*"-n32 ") libmagic=N32;; - *-64|*"-64 ") libmagic=64-bit;; - *) libmagic=never-match;; - esac - lt_cv_deplibs_check_method=pass_all - ;; - -# This must be Linux ELF. -linux* | k*bsd*-gnu) - lt_cv_deplibs_check_method=pass_all - ;; - -netbsd* | netbsdelf*-gnu) - if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' - fi - ;; - -newos6*) - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=/usr/lib/libnls.so - ;; - -*nto* | *qnx*) - lt_cv_deplibs_check_method=pass_all - ;; - -openbsd*) - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' - fi - ;; - -osf3* | osf4* | osf5*) - lt_cv_deplibs_check_method=pass_all - ;; - -rdos*) - lt_cv_deplibs_check_method=pass_all - ;; - -solaris*) - lt_cv_deplibs_check_method=pass_all - ;; - -sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - lt_cv_deplibs_check_method=pass_all - ;; - -sysv4 | sysv4.3*) - case $host_vendor in - motorola) - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` - ;; - ncr) - lt_cv_deplibs_check_method=pass_all - ;; - sequent) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' - ;; - sni) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" - lt_cv_file_magic_test_file=/lib/libc.so - ;; - siemens) - lt_cv_deplibs_check_method=pass_all - ;; - pc) - lt_cv_deplibs_check_method=pass_all - ;; - esac - ;; - -tpf*) - lt_cv_deplibs_check_method=pass_all - ;; -esac -]) -file_magic_cmd=$lt_cv_file_magic_cmd -deplibs_check_method=$lt_cv_deplibs_check_method -test -z "$deplibs_check_method" && deplibs_check_method=unknown - -_LT_DECL([], [deplibs_check_method], [1], - [Method to check whether dependent libraries are shared objects]) -_LT_DECL([], [file_magic_cmd], [1], - [Command to use when deplibs_check_method == "file_magic"]) -])# _LT_CHECK_MAGIC_METHOD - - -# LT_PATH_NM -# ---------- -# find the pathname to a BSD- or MS-compatible name lister -AC_DEFUN([LT_PATH_NM], -[AC_REQUIRE([AC_PROG_CC])dnl -AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM, -[if test -n "$NM"; then - # Let the user override the test. - lt_cv_path_NM="$NM" -else - lt_nm_to_check="${ac_tool_prefix}nm" - if test -n "$ac_tool_prefix" && test "$build" = "$host"; then - lt_nm_to_check="$lt_nm_to_check nm" - fi - for lt_tmp_nm in $lt_nm_to_check; do - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - tmp_nm="$ac_dir/$lt_tmp_nm" - if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then - # Check to see if the nm accepts a BSD-compat flag. - # Adding the `sed 1q' prevents false positives on HP-UX, which says: - # nm: unknown option "B" ignored - # Tru64's nm complains that /dev/null is an invalid object file - case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in - */dev/null* | *'Invalid file or object type'*) - lt_cv_path_NM="$tmp_nm -B" - break - ;; - *) - case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in - */dev/null*) - lt_cv_path_NM="$tmp_nm -p" - break - ;; - *) - lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but - continue # so that we can try to find one that supports BSD flags - ;; - esac - ;; - esac - fi - done - IFS="$lt_save_ifs" - done - : ${lt_cv_path_NM=no} -fi]) -if test "$lt_cv_path_NM" != "no"; then - NM="$lt_cv_path_NM" -else - # Didn't find any BSD compatible name lister, look for dumpbin. - AC_CHECK_TOOLS(DUMPBIN, ["dumpbin -symbols" "link -dump -symbols"], :) - AC_SUBST([DUMPBIN]) - if test "$DUMPBIN" != ":"; then - NM="$DUMPBIN" - fi -fi -test -z "$NM" && NM=nm -AC_SUBST([NM]) -_LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl - -AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], - [lt_cv_nm_interface="BSD nm" - echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:__oline__: $ac_compile\"" >&AS_MESSAGE_LOG_FD) - (eval "$ac_compile" 2>conftest.err) - cat conftest.err >&AS_MESSAGE_LOG_FD - (eval echo "\"\$as_me:__oline__: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) - (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) - cat conftest.err >&AS_MESSAGE_LOG_FD - (eval echo "\"\$as_me:__oline__: output\"" >&AS_MESSAGE_LOG_FD) - cat conftest.out >&AS_MESSAGE_LOG_FD - if $GREP 'External.*some_variable' conftest.out > /dev/null; then - lt_cv_nm_interface="MS dumpbin" - fi - rm -f conftest*]) -])# LT_PATH_NM - -# Old names: -AU_ALIAS([AM_PROG_NM], [LT_PATH_NM]) -AU_ALIAS([AC_PROG_NM], [LT_PATH_NM]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AM_PROG_NM], []) -dnl AC_DEFUN([AC_PROG_NM], []) - - -# LT_LIB_M -# -------- -# check for math library -AC_DEFUN([LT_LIB_M], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -LIBM= -case $host in -*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*) - # These system don't have libm, or don't need it - ;; -*-ncr-sysv4.3*) - AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") - AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") - ;; -*) - AC_CHECK_LIB(m, cos, LIBM="-lm") - ;; -esac -AC_SUBST([LIBM]) -])# LT_LIB_M - -# Old name: -AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_CHECK_LIBM], []) - - -# _LT_COMPILER_NO_RTTI([TAGNAME]) -# ------------------------------- -m4_defun([_LT_COMPILER_NO_RTTI], -[m4_require([_LT_TAG_COMPILER])dnl - -_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= - -if test "$GCC" = yes; then - _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' - - _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], - lt_cv_prog_compiler_rtti_exceptions, - [-fno-rtti -fno-exceptions], [], - [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) -fi -_LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1], - [Compiler flag to turn off builtin functions]) -])# _LT_COMPILER_NO_RTTI - - -# _LT_CMD_GLOBAL_SYMBOLS -# ---------------------- -m4_defun([_LT_CMD_GLOBAL_SYMBOLS], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([LT_PATH_NM])dnl -AC_REQUIRE([LT_PATH_LD])dnl -m4_require([_LT_DECL_SED])dnl -m4_require([_LT_DECL_EGREP])dnl -m4_require([_LT_TAG_COMPILER])dnl - -# Check for command to grab the raw symbol name followed by C symbol from nm. -AC_MSG_CHECKING([command to parse $NM output from $compiler object]) -AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], -[ -# These are sane defaults that work on at least a few old systems. -# [They come from Ultrix. What could be older than Ultrix?!! ;)] - -# Character class describing NM global symbol codes. -symcode='[[BCDEGRST]]' - -# Regexp to match symbols that can be accessed directly from C. -sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' - -# Define system-specific variables. -case $host_os in -aix*) - symcode='[[BCDT]]' - ;; -cygwin* | mingw* | pw32*) - symcode='[[ABCDGISTW]]' - ;; -hpux*) - if test "$host_cpu" = ia64; then - symcode='[[ABCDEGRST]]' - fi - ;; -irix* | nonstopux*) - symcode='[[BCDEGRST]]' - ;; -osf*) - symcode='[[BCDEGQRST]]' - ;; -solaris*) - symcode='[[BDRT]]' - ;; -sco3.2v5*) - symcode='[[DT]]' - ;; -sysv4.2uw2*) - symcode='[[DT]]' - ;; -sysv5* | sco5v6* | unixware* | OpenUNIX*) - symcode='[[ABDT]]' - ;; -sysv4) - symcode='[[DFNSTU]]' - ;; -esac - -# If we're using GNU nm, then use its standard symbol codes. -case `$NM -V 2>&1` in -*GNU* | *'with BFD'*) - symcode='[[ABCDGIRSTW]]' ;; -esac - -# Transform an extracted symbol line into a proper C declaration. -# Some systems (esp. on ia64) link data and code symbols differently, -# so use this general approach. -lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" - -# Transform an extracted symbol line into symbol name and symbol address -lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'" -lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'" - -# Handle CRLF in mingw tool chain -opt_cr= -case $build_os in -mingw*) - opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp - ;; -esac - -# Try without a prefix underscore, then with it. -for ac_symprfx in "" "_"; do - - # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. - symxfrm="\\1 $ac_symprfx\\2 \\2" - - # Write the raw and C identifiers. - if test "$lt_cv_nm_interface" = "MS dumpbin"; then - # Fake it for dumpbin and say T for any non-static function - # and D for any global variable. - # Also find C++ and __fastcall symbols from MSVC++, - # which start with @ or ?. - lt_cv_sys_global_symbol_pipe="$AWK ['"\ -" {last_section=section; section=\$ 3};"\ -" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ -" \$ 0!~/External *\|/{next};"\ -" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ -" {if(hide[section]) next};"\ -" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ -" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ -" s[1]~/^[@?]/{print s[1], s[1]; next};"\ -" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ -" ' prfx=^$ac_symprfx]" - else - lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" - fi - - # Check to see that the pipe works correctly. - pipe_works=no - - rm -f conftest* - cat > conftest.$ac_ext <<_LT_EOF -#ifdef __cplusplus -extern "C" { -#endif -char nm_test_var; -void nm_test_func(void); -void nm_test_func(void){} -#ifdef __cplusplus -} -#endif -int main(){nm_test_var='a';nm_test_func();return(0);} -_LT_EOF - - if AC_TRY_EVAL(ac_compile); then - # Now try to grab the symbols. - nlist=conftest.nm - if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) && test -s "$nlist"; then - # Try sorting and uniquifying the output. - if sort "$nlist" | uniq > "$nlist"T; then - mv -f "$nlist"T "$nlist" - else - rm -f "$nlist"T - fi - - # Make sure that we snagged all the symbols we need. - if $GREP ' nm_test_var$' "$nlist" >/dev/null; then - if $GREP ' nm_test_func$' "$nlist" >/dev/null; then - cat <<_LT_EOF > conftest.$ac_ext -#ifdef __cplusplus -extern "C" { -#endif - -_LT_EOF - # Now generate the symbol file. - eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' - - cat <<_LT_EOF >> conftest.$ac_ext - -/* The mapping between symbol names and symbols. */ -const struct { - const char *name; - void *address; -} -lt__PROGRAM__LTX_preloaded_symbols[[]] = -{ - { "@PROGRAM@", (void *) 0 }, -_LT_EOF - $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext - cat <<\_LT_EOF >> conftest.$ac_ext - {0, (void *) 0} -}; - -/* This works around a problem in FreeBSD linker */ -#ifdef FREEBSD_WORKAROUND -static const void *lt_preloaded_setup() { - return lt__PROGRAM__LTX_preloaded_symbols; -} -#endif - -#ifdef __cplusplus -} -#endif -_LT_EOF - # Now try linking the two files. - mv conftest.$ac_objext conftstm.$ac_objext - lt_save_LIBS="$LIBS" - lt_save_CFLAGS="$CFLAGS" - LIBS="conftstm.$ac_objext" - CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" - if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then - pipe_works=yes - fi - LIBS="$lt_save_LIBS" - CFLAGS="$lt_save_CFLAGS" - else - echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD - fi - else - echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD - fi - else - echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD - fi - else - echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD - cat conftest.$ac_ext >&5 - fi - rm -rf conftest* conftst* - - # Do not use the global_symbol_pipe unless it works. - if test "$pipe_works" = yes; then - break - else - lt_cv_sys_global_symbol_pipe= - fi -done -]) -if test -z "$lt_cv_sys_global_symbol_pipe"; then - lt_cv_sys_global_symbol_to_cdecl= -fi -if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then - AC_MSG_RESULT(failed) -else - AC_MSG_RESULT(ok) -fi - -_LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], - [Take the output of nm and produce a listing of raw symbols and C names]) -_LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], - [Transform the output of nm in a proper C declaration]) -_LT_DECL([global_symbol_to_c_name_address], - [lt_cv_sys_global_symbol_to_c_name_address], [1], - [Transform the output of nm in a C name address pair]) -_LT_DECL([global_symbol_to_c_name_address_lib_prefix], - [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], - [Transform the output of nm in a C name address pair when lib prefix is needed]) -]) # _LT_CMD_GLOBAL_SYMBOLS - - -# _LT_COMPILER_PIC([TAGNAME]) -# --------------------------- -m4_defun([_LT_COMPILER_PIC], -[m4_require([_LT_TAG_COMPILER])dnl -_LT_TAGVAR(lt_prog_compiler_wl, $1)= -_LT_TAGVAR(lt_prog_compiler_pic, $1)= -_LT_TAGVAR(lt_prog_compiler_static, $1)= - -AC_MSG_CHECKING([for $compiler option to produce PIC]) -m4_if([$1], [CXX], [ - # C++ specific cases for pic, static, wl, etc. - if test "$GXX" = yes; then - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - m68k) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' - ;; - esac - ;; - - beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - mingw* | cygwin* | os2* | pw32*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - # Although the cygwin gcc ignores -fPIC, still need this for old-style - # (--disable-auto-import) libraries - m4_if([$1], [GCJ], [], - [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) - ;; - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' - ;; - *djgpp*) - # DJGPP does not support shared libraries at all - _LT_TAGVAR(lt_prog_compiler_pic, $1)= - ;; - interix[[3-9]]*) - # Interix 3.x gcc -fpic/-fPIC options generate broken code. - # Instead, we relocate shared libraries at runtime. - ;; - sysv4*MP*) - if test -d /usr/nec; then - _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic - fi - ;; - hpux*) - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case $host_cpu in - hppa*64*|ia64*) - ;; - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - ;; - *qnx* | *nto*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' - ;; - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - else - case $host_os in - aix[[4-9]]*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - else - _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' - fi - ;; - chorus*) - case $cc_basename in - cxch68*) - # Green Hills C++ Compiler - # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" - ;; - esac - ;; - dgux*) - case $cc_basename in - ec++*) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - ;; - ghcx*) - # Green Hills C++ Compiler - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - *) - ;; - esac - ;; - freebsd* | dragonfly*) - # FreeBSD uses GNU C++ - ;; - hpux9* | hpux10* | hpux11*) - case $cc_basename in - CC*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' - if test "$host_cpu" != ia64; then - _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - fi - ;; - aCC*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' - case $host_cpu in - hppa*64*|ia64*) - # +Z the default - ;; - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - ;; - esac - ;; - *) - ;; - esac - ;; - interix*) - # This is c89, which is MS Visual C++ (no shared libs) - # Anyone wants to do a port? - ;; - irix5* | irix6* | nonstopux*) - case $cc_basename in - CC*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - # CC pic flag -KPIC is the default. - ;; - *) - ;; - esac - ;; - linux* | k*bsd*-gnu) - case $cc_basename in - KCC*) - # KAI C++ Compiler - _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - icpc* | ecpc* ) - # Intel C++ - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - pgCC* | pgcpp*) - # Portland Group C++ compiler - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - cxx*) - # Compaq C++ - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - _LT_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - xlc* | xlC*) - # IBM XL 8.0 on PPC - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' - ;; - *) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) - # Sun C++ 5.9 - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' - ;; - esac - ;; - esac - ;; - lynxos*) - ;; - m88k*) - ;; - mvs*) - case $cc_basename in - cxx*) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' - ;; - *) - ;; - esac - ;; - netbsd* | netbsdelf*-gnu) - ;; - *qnx* | *nto*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' - ;; - osf3* | osf4* | osf5*) - case $cc_basename in - KCC*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' - ;; - RCC*) - # Rational C++ 2.4.1 - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - cxx*) - # Digital/Compaq C++ - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - _LT_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - *) - ;; - esac - ;; - psos*) - ;; - solaris*) - case $cc_basename in - CC*) - # Sun C++ 4.2, 5.x and Centerline C++ - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' - ;; - gcx*) - # Green Hills C++ Compiler - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' - ;; - *) - ;; - esac - ;; - sunos4*) - case $cc_basename in - CC*) - # Sun C++ 4.x - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - lcc*) - # Lucid - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - *) - ;; - esac - ;; - sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) - case $cc_basename in - CC*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - esac - ;; - tandem*) - case $cc_basename in - NCC*) - # NonStop-UX NCC 3.20 - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - ;; - *) - ;; - esac - ;; - vxworks*) - ;; - *) - _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - ;; - esac - fi -], -[ - if test "$GCC" = yes; then - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - m68k) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' - ;; - esac - ;; - - beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - - mingw* | cygwin* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - # Although the cygwin gcc ignores -fPIC, still need this for old-style - # (--disable-auto-import) libraries - m4_if([$1], [GCJ], [], - [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) - ;; - - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' - ;; - - hpux*) - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case $host_cpu in - hppa*64*|ia64*) - # +Z the default - ;; - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - ;; - - interix[[3-9]]*) - # Interix 3.x gcc -fpic/-fPIC options generate broken code. - # Instead, we relocate shared libraries at runtime. - ;; - - msdosdjgpp*) - # Just because we use GCC doesn't mean we suddenly get shared libraries - # on systems that don't support them. - _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - enable_shared=no - ;; - - *nto* | *qnx*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic - fi - ;; - - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - else - # PORTME Check for flag to pass linker flags through the system compiler. - case $host_os in - aix*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - else - _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' - fi - ;; - - mingw* | cygwin* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - m4_if([$1], [GCJ], [], - [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) - ;; - - hpux9* | hpux10* | hpux11*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case $host_cpu in - hppa*64*|ia64*) - # +Z the default - ;; - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - ;; - esac - # Is there a better lt_prog_compiler_static that works with the bundled CC? - _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' - ;; - - irix5* | irix6* | nonstopux*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # PIC (with -KPIC) is the default. - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - - linux* | k*bsd*-gnu) - case $cc_basename in - icc* | ecc* | ifort*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - pgcc* | pgf77* | pgf90* | pgf95*) - # Portland Group compilers (*not* the Pentium gcc compiler, - # which looks to be a dead project) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - ccc*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # All Alpha code is PIC. - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - xl*) - # IBM XL C 8.0/Fortran 10.1 on PPC - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' - ;; - *) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) - # Sun C 5.9 - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - ;; - *Sun\ F*) - # Sun Fortran 8.3 passes all unrecognized flags to the linker - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_TAGVAR(lt_prog_compiler_wl, $1)='' - ;; - esac - ;; - esac - ;; - - newsos6) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - *nto* | *qnx*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' - ;; - - osf3* | osf4* | osf5*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # All OSF/1 code is PIC. - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - - rdos*) - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - - solaris*) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - case $cc_basename in - f77* | f90* | f95*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; - *) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; - esac - ;; - - sunos4*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - sysv4 | sysv4.2uw2* | sysv4.3*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - sysv4*MP*) - if test -d /usr/nec ;then - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - - sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - unicos*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - ;; - - uts4*) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - *) - _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - ;; - esac - fi -]) -case $host_os in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - _LT_TAGVAR(lt_prog_compiler_pic, $1)= - ;; - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" - ;; -esac -AC_MSG_RESULT([$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) -_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], - [How to pass a linker flag through the compiler]) - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then - _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works], - [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)], - [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [], - [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in - "" | " "*) ;; - *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;; - esac], - [_LT_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) -fi -_LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], - [Additional compiler flags for building library objects]) - -# -# Check to make sure the static flag actually works. -# -wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\" -_LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], - _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1), - $lt_tmp_static_flag, - [], - [_LT_TAGVAR(lt_prog_compiler_static, $1)=]) -_LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], - [Compiler flag to prevent dynamic linking]) -])# _LT_COMPILER_PIC - - -# _LT_LINKER_SHLIBS([TAGNAME]) -# ---------------------------- -# See if the linker supports building shared libraries. -m4_defun([_LT_LINKER_SHLIBS], -[AC_REQUIRE([LT_PATH_LD])dnl -AC_REQUIRE([LT_PATH_NM])dnl -m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_DECL_EGREP])dnl -m4_require([_LT_DECL_SED])dnl -m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl -m4_require([_LT_TAG_COMPILER])dnl -AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) -m4_if([$1], [CXX], [ - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - case $host_os in - aix[[4-9]]*) - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then - _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' - else - _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' - fi - ;; - pw32*) - _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" - ;; - cygwin* | mingw*) - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;/^.*[[ ]]__nm__/s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' - ;; - linux* | k*bsd*-gnu) - _LT_TAGVAR(link_all_deplibs, $1)=no - ;; - *) - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - ;; - esac - _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] -], [ - runpath_var= - _LT_TAGVAR(allow_undefined_flag, $1)= - _LT_TAGVAR(always_export_symbols, $1)=no - _LT_TAGVAR(archive_cmds, $1)= - _LT_TAGVAR(archive_expsym_cmds, $1)= - _LT_TAGVAR(compiler_needs_object, $1)=no - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no - _LT_TAGVAR(export_dynamic_flag_spec, $1)= - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - _LT_TAGVAR(hardcode_automatic, $1)=no - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_direct_absolute, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= - _LT_TAGVAR(hardcode_libdir_separator, $1)= - _LT_TAGVAR(hardcode_minus_L, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_TAGVAR(inherit_rpath, $1)=no - _LT_TAGVAR(link_all_deplibs, $1)=unknown - _LT_TAGVAR(module_cmds, $1)= - _LT_TAGVAR(module_expsym_cmds, $1)= - _LT_TAGVAR(old_archive_from_new_cmds, $1)= - _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)= - _LT_TAGVAR(thread_safe_flag_spec, $1)= - _LT_TAGVAR(whole_archive_flag_spec, $1)= - # include_expsyms should be a list of space-separated symbols to be *always* - # included in the symbol list - _LT_TAGVAR(include_expsyms, $1)= - # exclude_expsyms can be an extended regexp of symbols to exclude - # it will be wrapped by ` (' and `)$', so one must not match beginning or - # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', - # as well as any symbol that contains `d'. - _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] - # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out - # platforms (ab)use it in PIC code, but their linkers get confused if - # the symbol is explicitly referenced. Since portable code cannot - # rely on this symbol name, it's probably fine to never include it in - # preloaded symbol tables. - # Exclude shared library initialization/finalization symbols. -dnl Note also adjust exclude_expsyms for C++ above. - extract_expsyms_cmds= - - case $host_os in - cygwin* | mingw* | pw32*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$GCC" != yes; then - with_gnu_ld=no - fi - ;; - interix*) - # we just hope/assume this is gcc and not c89 (= MSVC++) - with_gnu_ld=yes - ;; - openbsd*) - with_gnu_ld=no - ;; - esac - - _LT_TAGVAR(ld_shlibs, $1)=yes - if test "$with_gnu_ld" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' - - # Set some defaults for GNU ld with shared library support. These - # are reset later if shared libraries are not supported. Putting them - # here allows them to be overridden if necessary. - runpath_var=LD_RUN_PATH - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then - _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - _LT_TAGVAR(whole_archive_flag_spec, $1)= - fi - supports_anon_versioning=no - case `$LD -v 2>&1` in - *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - - # See if GNU ld supports shared libraries. - case $host_os in - aix[[3-9]]*) - # On AIX/PPC, the GNU linker is very broken - if test "$host_cpu" != ia64; then - _LT_TAGVAR(ld_shlibs, $1)=no - cat <<_LT_EOF 1>&2 - -*** Warning: the GNU linker, at least up to release 2.9.1, is reported -*** to be unable to reliably create shared libraries on AIX. -*** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to modify your PATH -*** so that a non-GNU linker is found, and then restart. - -_LT_EOF - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='' - ;; - m68k) - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_minus_L, $1)=yes - ;; - esac - ;; - - beos*) - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - cygwin* | mingw* | pw32*) - # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, - # as there is no search path for DLLs. - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(always_export_symbols, $1)=no - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' - - if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - interix[[3-9]]*) - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. - # Instead, shared libraries are loaded at an image base (0x10000000 by - # default) and relocated if they conflict, which is a slow very memory - # consuming and fragmenting process. To avoid this, we pick a random, - # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link - # time. Moving up from 0x10000000 also allows more sbrk(2) space. - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - ;; - - gnu* | linux* | tpf* | k*bsd*-gnu) - tmp_diet=no - if test "$host_os" = linux-dietlibc; then - case $cc_basename in - diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) - esac - fi - if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ - && test "$tmp_diet" = no - then - tmp_addflag= - tmp_sharedflag='-shared' - case $cc_basename,$host_cpu in - pgcc*) # Portland Group C compiler - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag' - ;; - pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag -Mnomain' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - xl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) - tmp_sharedflag='-qmkshrobj' - tmp_addflag= ;; - esac - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) # Sun C 5.9 - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' - _LT_TAGVAR(compiler_needs_object, $1)=yes - tmp_sharedflag='-G' ;; - *Sun\ F*) # Sun Fortran 8.3 - tmp_sharedflag='-G' ;; - esac - _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - - if test "x$supports_anon_versioning" = xyes; then - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - fi - - case $cc_basename in - xlf*) - # IBM XL Fortran 10.1 on PPC cannot create shared libs itself - _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir' - _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib' - if test "x$supports_anon_versioning" = xyes; then - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' - fi - ;; - esac - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - netbsd* | netbsdelf*-gnu) - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; - - solaris*) - if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then - _LT_TAGVAR(ld_shlibs, $1)=no - cat <<_LT_EOF 1>&2 - -*** Warning: The releases 2.8.* of the GNU linker cannot reliably -*** create shared libraries on Solaris systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.9.1 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -_LT_EOF - elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) - case `$LD -v 2>&1` in - *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) - _LT_TAGVAR(ld_shlibs, $1)=no - cat <<_LT_EOF 1>&2 - -*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not -*** reliably create shared libraries on SCO systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.16.91.0.3 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -_LT_EOF - ;; - *) - # For security reasons, it is highly recommended that you always - # use absolute paths for naming shared libraries, and exclude the - # DT_RUNPATH tag from executables and libraries. But doing so - # requires that you compile everything twice, which is a pain. - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - - sunos4*) - _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - *) - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - - if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then - runpath_var= - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_TAGVAR(export_dynamic_flag_spec, $1)= - _LT_TAGVAR(whole_archive_flag_spec, $1)= - fi - else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(always_export_symbols, $1)=yes - _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - _LT_TAGVAR(hardcode_minus_L, $1)=yes - if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - _LT_TAGVAR(hardcode_direct, $1)=unsupported - fi - ;; - - aix[[4-9]]*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then - _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' - else - _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' - fi - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) - for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then - aix_use_runtimelinking=yes - break - fi - done - ;; - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - _LT_TAGVAR(archive_cmds, $1)='' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_TAGVAR(link_all_deplibs, $1)=yes - _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' - - if test "$GCC" = yes; then - case $host_os in aix4.[[012]]|aix4.[[012]].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && - strings "$collect2name" | $GREP resolve_lib_name >/dev/null - then - # We have reworked collect2 - : - else - # We have old collect2 - _LT_TAGVAR(hardcode_direct, $1)=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)= - fi - ;; - esac - shared_flag='-shared' - if test "$aix_use_runtimelinking" = yes; then - shared_flag="$shared_flag "'${wl}-G' - fi - _LT_TAGVAR(link_all_deplibs, $1)=no - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - _LT_TAGVAR(always_export_symbols, $1)=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - _LT_TAGVAR(allow_undefined_flag, $1)='-berok' - # Determine the default libpath from the value encoded in an - # empty executable. - _LT_SYS_MODULE_PATH_AIX - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' - _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" - _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an - # empty executable. - _LT_SYS_MODULE_PATH_AIX - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' - # Exported symbols can be pulled into shared objects from archives - _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' - _LT_TAGVAR(archive_cmds_need_lc, $1)=yes - # This is similar to how AIX traditionally builds its shared libraries. - _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='' - ;; - m68k) - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_minus_L, $1)=yes - ;; - esac - ;; - - bsdi[[45]]*) - _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic - ;; - - cygwin* | mingw* | pw32*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -e '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' - # FIXME: Should let the user specify the lib program. - _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' - _LT_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`' - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - ;; - - darwin* | rhapsody*) - _LT_DARWIN_LINKER_FEATURES($1) - ;; - - dgux*) - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - freebsd1*) - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2*) - _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | dragonfly*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - hpux9*) - if test "$GCC" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - fi - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(hardcode_direct, $1)=yes - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - ;; - - hpux10*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' - fi - if test "$with_gnu_ld" = no; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_TAGVAR(hardcode_minus_L, $1)=yes - fi - ;; - - hpux11*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then - case $host_cpu in - hppa*64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - ia64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - else - case $host_cpu in - hppa*64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - ia64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - fi - if test "$with_gnu_ld" = no; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - - case $host_cpu in - hppa*64*|ia64*) - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - *) - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_TAGVAR(hardcode_minus_L, $1)=yes - ;; - esac - fi - ;; - - irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - # Try to use the -exported_symbol ld option, if it does not - # work, assume that -exports_file does not work either and - # implicitly export all symbols. - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" - AC_LINK_IFELSE(int foo(void) {}, - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' - ) - LDFLAGS="$save_LDFLAGS" - else - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' - fi - _LT_TAGVAR(archive_cmds_need_lc, $1)='no' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(inherit_rpath, $1)=yes - _LT_TAGVAR(link_all_deplibs, $1)=yes - ;; - - netbsd* | netbsdelf*-gnu) - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - newsos6) - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - *nto* | *qnx*) - ;; - - openbsd*) - if test -f /usr/libexec/ld.so; then - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - else - case $host_os in - openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) - _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - ;; - esac - fi - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - os2*) - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$ECHO DATA >> $output_objdir/$libname.def~$ECHO " SINGLE NONSHARED" >> $output_objdir/$libname.def~$ECHO EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; - - osf3*) - if test "$GCC" = yes; then - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' - fi - _LT_TAGVAR(archive_cmds_need_lc, $1)='no' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - else - _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ - $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' - - # Both c and cxx compiler support -rpath directly - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - fi - _LT_TAGVAR(archive_cmds_need_lc, $1)='no' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - - solaris*) - _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' - if test "$GCC" = yes; then - wlarc='${wl}' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' - else - case `$CC -V 2>&1` in - *"Compilers 5.0"*) - wlarc='' - _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' - ;; - *) - wlarc='${wl}' - _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' - ;; - esac - fi - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - case $host_os in - solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; - *) - # The compiler driver will combine and reorder linker options, - # but understands `-z linker_flag'. GCC discards it without `$wl', - # but is careful enough not to reorder. - # Supported since Solaris 2.6 (maybe 2.5.1?) - if test "$GCC" = yes; then - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' - else - _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' - fi - ;; - esac - _LT_TAGVAR(link_all_deplibs, $1)=yes - ;; - - sunos4*) - if test "x$host_vendor" = xsequent; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - sysv4) - case $host_vendor in - sni) - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' - _LT_TAGVAR(hardcode_direct, $1)=no - ;; - motorola) - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - sysv4.3*) - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - _LT_TAGVAR(ld_shlibs, $1)=yes - fi - ;; - - sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) - _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - runpath_var='LD_RUN_PATH' - - if test "$GCC" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - ;; - - sysv5* | sco3.2v5* | sco5v6*) - # Note: We can NOT use -z defs as we might desire, because we do not - # link with -lc, and that would cause any symbols used from libc to - # always be unresolved, which means just about no library would - # ever link correctly. If we're not using GNU ld we use -z text - # though, which does catch some bad symbols but isn't as heavy-handed - # as -z defs. - _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' - _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_TAGVAR(link_all_deplibs, $1)=yes - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' - runpath_var='LD_RUN_PATH' - - if test "$GCC" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - ;; - - uts4*) - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - *) - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - - if test x$host_vendor = xsni; then - case $host in - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym' - ;; - esac - fi - fi -]) -AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) -test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no - -_LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld - -_LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl -_LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl -_LT_DECL([], [extract_expsyms_cmds], [2], - [The commands to extract the exported symbol list from a shared archive]) - -# -# Do we need to explicitly link libc? -# -case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in -x|xyes) - # Assume -lc should be added - _LT_TAGVAR(archive_cmds_need_lc, $1)=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $_LT_TAGVAR(archive_cmds, $1) in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - AC_MSG_CHECKING([whether -lc should be explicitly linked in]) - $RM conftest* - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - if AC_TRY_EVAL(ac_compile) 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) - pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) - _LT_TAGVAR(allow_undefined_flag, $1)= - if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) - then - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - else - _LT_TAGVAR(archive_cmds_need_lc, $1)=yes - fi - _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $RM conftest* - AC_MSG_RESULT([$_LT_TAGVAR(archive_cmds_need_lc, $1)]) - ;; - esac - fi - ;; -esac - -_LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0], - [Whether or not to add -lc for building shared libraries]) -_LT_TAGDECL([allow_libtool_libs_with_static_runtimes], - [enable_shared_with_static_runtimes], [0], - [Whether or not to disallow shared libs when runtime libs are static]) -_LT_TAGDECL([], [export_dynamic_flag_spec], [1], - [Compiler flag to allow reflexive dlopens]) -_LT_TAGDECL([], [whole_archive_flag_spec], [1], - [Compiler flag to generate shared objects directly from archives]) -_LT_TAGDECL([], [compiler_needs_object], [1], - [Whether the compiler copes with passing no objects directly]) -_LT_TAGDECL([], [old_archive_from_new_cmds], [2], - [Create an old-style archive from a shared archive]) -_LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2], - [Create a temporary old-style archive to link instead of a shared archive]) -_LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive]) -_LT_TAGDECL([], [archive_expsym_cmds], [2]) -_LT_TAGDECL([], [module_cmds], [2], - [Commands used to build a loadable module if different from building - a shared archive.]) -_LT_TAGDECL([], [module_expsym_cmds], [2]) -_LT_TAGDECL([], [with_gnu_ld], [1], - [Whether we are building with GNU ld or not]) -_LT_TAGDECL([], [allow_undefined_flag], [1], - [Flag that allows shared libraries with undefined symbols to be built]) -_LT_TAGDECL([], [no_undefined_flag], [1], - [Flag that enforces no undefined symbols]) -_LT_TAGDECL([], [hardcode_libdir_flag_spec], [1], - [Flag to hardcode $libdir into a binary during linking. - This must work even if $libdir does not exist]) -_LT_TAGDECL([], [hardcode_libdir_flag_spec_ld], [1], - [[If ld is used when linking, flag to hardcode $libdir into a binary - during linking. This must work even if $libdir does not exist]]) -_LT_TAGDECL([], [hardcode_libdir_separator], [1], - [Whether we need a single "-rpath" flag with a separated argument]) -_LT_TAGDECL([], [hardcode_direct], [0], - [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes - DIR into the resulting binary]) -_LT_TAGDECL([], [hardcode_direct_absolute], [0], - [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes - DIR into the resulting binary and the resulting library dependency is - "absolute", i.e impossible to change by setting ${shlibpath_var} if the - library is relocated]) -_LT_TAGDECL([], [hardcode_minus_L], [0], - [Set to "yes" if using the -LDIR flag during linking hardcodes DIR - into the resulting binary]) -_LT_TAGDECL([], [hardcode_shlibpath_var], [0], - [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR - into the resulting binary]) -_LT_TAGDECL([], [hardcode_automatic], [0], - [Set to "yes" if building a shared library automatically hardcodes DIR - into the library and all subsequent libraries and executables linked - against it]) -_LT_TAGDECL([], [inherit_rpath], [0], - [Set to yes if linker adds runtime paths of dependent libraries - to runtime path list]) -_LT_TAGDECL([], [link_all_deplibs], [0], - [Whether libtool must link a program against all its dependency libraries]) -_LT_TAGDECL([], [fix_srcfile_path], [1], - [Fix the shell variable $srcfile for the compiler]) -_LT_TAGDECL([], [always_export_symbols], [0], - [Set to "yes" if exported symbols are required]) -_LT_TAGDECL([], [export_symbols_cmds], [2], - [The commands to list exported symbols]) -_LT_TAGDECL([], [exclude_expsyms], [1], - [Symbols that should not be listed in the preloaded symbols]) -_LT_TAGDECL([], [include_expsyms], [1], - [Symbols that must always be exported]) -_LT_TAGDECL([], [prelink_cmds], [2], - [Commands necessary for linking programs (against libraries) with templates]) -_LT_TAGDECL([], [file_list_spec], [1], - [Specify filename containing input files]) -dnl FIXME: Not yet implemented -dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1], -dnl [Compiler flag to generate thread safe objects]) -])# _LT_LINKER_SHLIBS - - -# _LT_LANG_C_CONFIG([TAG]) -# ------------------------ -# Ensure that the configuration variables for a C compiler are suitably -# defined. These variables are subsequently used by _LT_CONFIG to write -# the compiler configuration to `libtool'. -m4_defun([_LT_LANG_C_CONFIG], -[m4_require([_LT_DECL_EGREP])dnl -lt_save_CC="$CC" -AC_LANG_PUSH(C) - -# Source file extension for C test sources. -ac_ext=c - -# Object file extension for compiled C test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;" - -# Code to be used in simple link tests -lt_simple_link_test_code='int main(){return(0);}' - -_LT_TAG_COMPILER -# Save the default compiler, since it gets overwritten when the other -# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. -compiler_DEFAULT=$CC - -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - -if test -n "$compiler"; then - _LT_COMPILER_NO_RTTI($1) - _LT_COMPILER_PIC($1) - _LT_COMPILER_C_O($1) - _LT_COMPILER_FILE_LOCKS($1) - _LT_LINKER_SHLIBS($1) - _LT_SYS_DYNAMIC_LINKER($1) - _LT_LINKER_HARDCODE_LIBPATH($1) - LT_SYS_DLOPEN_SELF - _LT_CMD_STRIPLIB - - # Report which library types will actually be built - AC_MSG_CHECKING([if libtool supports shared libraries]) - AC_MSG_RESULT([$can_build_shared]) - - AC_MSG_CHECKING([whether to build shared libraries]) - test "$can_build_shared" = "no" && enable_shared=no - - # On AIX, shared libraries and static libraries use the same namespace, and - # are all built from PIC. - case $host_os in - aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; - - aix[[4-9]]*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi - ;; - esac - AC_MSG_RESULT([$enable_shared]) - - AC_MSG_CHECKING([whether to build static libraries]) - # Make sure either enable_shared or enable_static is yes. - test "$enable_shared" = yes || enable_static=yes - AC_MSG_RESULT([$enable_static]) - - _LT_CONFIG($1) -fi -AC_LANG_POP -CC="$lt_save_CC" -])# _LT_LANG_C_CONFIG - - -# _LT_PROG_CXX -# ------------ -# Since AC_PROG_CXX is broken, in that it returns g++ if there is no c++ -# compiler, we have our own version here. -m4_defun([_LT_PROG_CXX], -[ -pushdef([AC_MSG_ERROR], [_lt_caught_CXX_error=yes]) -AC_PROG_CXX -if test -n "$CXX" && ( test "X$CXX" != "Xno" && - ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || - (test "X$CXX" != "Xg++"))) ; then - AC_PROG_CXXCPP -else - _lt_caught_CXX_error=yes -fi -popdef([AC_MSG_ERROR]) -])# _LT_PROG_CXX - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([_LT_PROG_CXX], []) - - -# _LT_LANG_CXX_CONFIG([TAG]) -# -------------------------- -# Ensure that the configuration variables for a C++ compiler are suitably -# defined. These variables are subsequently used by _LT_CONFIG to write -# the compiler configuration to `libtool'. -m4_defun([_LT_LANG_CXX_CONFIG], -[AC_REQUIRE([_LT_PROG_CXX])dnl -m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_DECL_EGREP])dnl - -AC_LANG_PUSH(C++) -_LT_TAGVAR(archive_cmds_need_lc, $1)=no -_LT_TAGVAR(allow_undefined_flag, $1)= -_LT_TAGVAR(always_export_symbols, $1)=no -_LT_TAGVAR(archive_expsym_cmds, $1)= -_LT_TAGVAR(compiler_needs_object, $1)=no -_LT_TAGVAR(export_dynamic_flag_spec, $1)= -_LT_TAGVAR(hardcode_direct, $1)=no -_LT_TAGVAR(hardcode_direct_absolute, $1)=no -_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= -_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= -_LT_TAGVAR(hardcode_libdir_separator, $1)= -_LT_TAGVAR(hardcode_minus_L, $1)=no -_LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported -_LT_TAGVAR(hardcode_automatic, $1)=no -_LT_TAGVAR(inherit_rpath, $1)=no -_LT_TAGVAR(module_cmds, $1)= -_LT_TAGVAR(module_expsym_cmds, $1)= -_LT_TAGVAR(link_all_deplibs, $1)=unknown -_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds -_LT_TAGVAR(no_undefined_flag, $1)= -_LT_TAGVAR(whole_archive_flag_spec, $1)= -_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no - -# Source file extension for C++ test sources. -ac_ext=cpp - -# Object file extension for compiled C++ test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# No sense in running all these tests if we already determined that -# the CXX compiler isn't working. Some variables (like enable_shared) -# are currently assumed to apply to all compilers on this platform, -# and will be corrupted by setting them based on a non-working compiler. -if test "$_lt_caught_CXX_error" != yes; then - # Code to be used in simple compile tests - lt_simple_compile_test_code="int some_variable = 0;" - - # Code to be used in simple link tests - lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' - - # ltmain only uses $CC for tagged configurations so make sure $CC is set. - _LT_TAG_COMPILER - - # save warnings/boilerplate of simple test code - _LT_COMPILER_BOILERPLATE - _LT_LINKER_BOILERPLATE - - # Allow CC to be a program name with arguments. - lt_save_CC=$CC - lt_save_LD=$LD - lt_save_GCC=$GCC - GCC=$GXX - lt_save_with_gnu_ld=$with_gnu_ld - lt_save_path_LD=$lt_cv_path_LD - if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then - lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx - else - $as_unset lt_cv_prog_gnu_ld - fi - if test -n "${lt_cv_path_LDCXX+set}"; then - lt_cv_path_LD=$lt_cv_path_LDCXX - else - $as_unset lt_cv_path_LD - fi - test -z "${LDCXX+set}" || LD=$LDCXX - CC=${CXX-"c++"} - compiler=$CC - _LT_TAGVAR(compiler, $1)=$CC - _LT_CC_BASENAME([$compiler]) - - if test -n "$compiler"; then - # We don't want -fno-exception when compiling C++ code, so set the - # no_builtin_flag separately - if test "$GXX" = yes; then - _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' - else - _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= - fi - - if test "$GXX" = yes; then - # Set up default GNU C++ configuration - - LT_PATH_LD - - # Check if GNU C++ uses GNU ld as the underlying linker, since the - # archiving commands below assume that GNU ld is being used. - if test "$with_gnu_ld" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - - # If archive_cmds runs LD, not CC, wlarc should be empty - # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to - # investigate it a little bit more. (MM) - wlarc='${wl}' - - # ancient GNU ld didn't support --whole-archive et. al. - if eval "`$CC -print-prog-name=ld` --help 2>&1" | - $GREP 'no-whole-archive' > /dev/null; then - _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - _LT_TAGVAR(whole_archive_flag_spec, $1)= - fi - else - with_gnu_ld=no - wlarc= - - # A generic and very simple default shared library creation - # command for GNU C++ for the case where it uses the native - # linker, instead of GNU ld. If possible, this setting should - # overridden to take advantage of the native linker features on - # the platform it is being used on. - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' - fi - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' - - else - GXX=no - with_gnu_ld=no - wlarc= - fi - - # PORTME: fill in a description of your system's C++ link characteristics - AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) - _LT_TAGVAR(ld_shlibs, $1)=yes - case $host_os in - aix3*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - aix[[4-9]]*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) - for ld_flag in $LDFLAGS; do - case $ld_flag in - *-brtl*) - aix_use_runtimelinking=yes - break - ;; - esac - done - ;; - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - _LT_TAGVAR(archive_cmds, $1)='' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_TAGVAR(link_all_deplibs, $1)=yes - _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' - - if test "$GXX" = yes; then - case $host_os in aix4.[[012]]|aix4.[[012]].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && - strings "$collect2name" | $GREP resolve_lib_name >/dev/null - then - # We have reworked collect2 - : - else - # We have old collect2 - _LT_TAGVAR(hardcode_direct, $1)=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)= - fi - esac - shared_flag='-shared' - if test "$aix_use_runtimelinking" = yes; then - shared_flag="$shared_flag "'${wl}-G' - fi - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to - # export. - _LT_TAGVAR(always_export_symbols, $1)=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - _LT_TAGVAR(allow_undefined_flag, $1)='-berok' - # Determine the default libpath from the value encoded in an empty - # executable. - _LT_SYS_MODULE_PATH_AIX - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' - _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" - _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an - # empty executable. - _LT_SYS_MODULE_PATH_AIX - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' - # Exported symbols can be pulled into shared objects from archives - _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' - _LT_TAGVAR(archive_cmds_need_lc, $1)=yes - # This is similar to how AIX traditionally builds its shared - # libraries. - _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - beos*) - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - chorus*) - case $cc_basename in - *) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - cygwin* | mingw* | pw32*) - # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, - # as there is no search path for DLLs. - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(always_export_symbols, $1)=no - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - - if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - darwin* | rhapsody*) - _LT_DARWIN_LINKER_FEATURES($1) - ;; - - dgux*) - case $cc_basename in - ec++*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - ghcx*) - # Green Hills C++ Compiler - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - freebsd[[12]]*) - # C++ shared libraries reported to be fairly broken before - # switch to ELF - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - freebsd-elf*) - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - ;; - - freebsd* | dragonfly*) - # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF - # conventions - _LT_TAGVAR(ld_shlibs, $1)=yes - ;; - - gnu*) - ;; - - hpux9*) - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, - # but as the default - # location of the library. - - case $cc_basename in - CC*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - aCC*) - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' - ;; - *) - if test "$GXX" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - - hpux10*|hpux11*) - if test $with_gnu_ld = no; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - - case $host_cpu in - hppa*64*|ia64*) - ;; - *) - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - ;; - esac - fi - case $host_cpu in - hppa*64*|ia64*) - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - *) - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, - # but as the default - # location of the library. - ;; - esac - - case $cc_basename in - CC*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - aCC*) - case $host_cpu in - hppa*64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - ia64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' - ;; - *) - if test "$GXX" = yes; then - if test $with_gnu_ld = no; then - case $host_cpu in - hppa*64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - ia64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - fi - else - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - - interix[[3-9]]*) - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. - # Instead, shared libraries are loaded at an image base (0x10000000 by - # default) and relocated if they conflict, which is a slow very memory - # consuming and fragmenting process. To avoid this, we pick a random, - # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link - # time. Moving up from 0x10000000 also allows more sbrk(2) space. - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - ;; - irix5* | irix6*) - case $cc_basename in - CC*) - # SGI C++ - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' - - # Archives containing C++ object files must be created using - # "CC -ar", where "CC" is the IRIX C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' - ;; - *) - if test "$GXX" = yes; then - if test "$with_gnu_ld" = no; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` -o $lib' - fi - fi - _LT_TAGVAR(link_all_deplibs, $1)=yes - ;; - esac - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(inherit_rpath, $1)=yes - ;; - - linux* | k*bsd*-gnu) - case $cc_basename in - KCC*) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - - # Archives containing C++ object files must be created using - # "CC -Bstatic", where "CC" is the KAI C++ compiler. - _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' - ;; - icpc* | ecpc* ) - # Intel C++ - with_gnu_ld=yes - # version 8.0 and above of icpc choke on multiply defined symbols - # if we add $predep_objects and $postdep_objects, however 7.1 and - # earlier do not add the objects themselves. - case `$CC -V 2>&1` in - *"Version 7."*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - ;; - *) # Version 8.0 or newer - tmp_idyn= - case $host_cpu in - ia64*) tmp_idyn=' -i_dynamic';; - esac - _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - ;; - esac - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' - ;; - pgCC* | pgcpp*) - # Portland Group C++ compiler - case `$CC -V` in - *pgCC\ [[1-5]]* | *pgcpp\ [[1-5]]*) - _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ - compile_command="$compile_command `find $tpldir -name \*.o | $NL2SP`"' - _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ - $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | $NL2SP`~ - $RANLIB $oldlib' - _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ - $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ - $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' - ;; - *) # Version 6 will use weak symbols - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' - ;; - esac - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' - ;; - cxx*) - # Compaq C++ - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' - - runpath_var=LD_RUN_PATH - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' - ;; - xl*) - # IBM XL 8.0 on PPC, with GNU ld - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - if test "x$supports_anon_versioning" = xyes; then - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - fi - ;; - *) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) - # Sun C++ 5.9 - _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' - _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' - _LT_TAGVAR(compiler_needs_object, $1)=yes - - # Not sure whether something based on - # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 - # would be better. - output_verbose_link_cmd='echo' - - # Archives containing C++ object files must be created using - # "CC -xar", where "CC" is the Sun C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' - ;; - esac - ;; - esac - ;; - - lynxos*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - m88k*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - mvs*) - case $cc_basename in - cxx*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' - wlarc= - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - fi - # Workaround some broken pre-1.5 toolchains - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' - ;; - - *nto* | *qnx*) - _LT_TAGVAR(ld_shlibs, $1)=yes - ;; - - openbsd2*) - # C++ shared libraries are fairly broken - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - openbsd*) - if test -f /usr/libexec/ld.so; then - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - fi - output_verbose_link_cmd=echo - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - osf3* | osf4* | osf5*) - case $cc_basename in - KCC*) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - - # Archives containing C++ object files must be created using - # the KAI C++ compiler. - case $host in - osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; - *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; - esac - ;; - RCC*) - # Rational C++ 2.4.1 - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - cxx*) - case $host in - osf3*) - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && $ECHO "X${wl}-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - ;; - *) - _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ - echo "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~ - $RM $lib.exp' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - ;; - esac - - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' - ;; - *) - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - case $host in - osf3*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - ;; - esac - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' - - else - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - - psos*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - sunos4*) - case $cc_basename in - CC*) - # Sun C++ 4.x - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - lcc*) - # Lucid - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - solaris*) - case $cc_basename in - CC*) - # Sun C++ 4.2, 5.x and Centerline C++ - _LT_TAGVAR(archive_cmds_need_lc,$1)=yes - _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' - _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - case $host_os in - solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; - *) - # The compiler driver will combine and reorder linker options, - # but understands `-z linker_flag'. - # Supported since Solaris 2.6 (maybe 2.5.1?) - _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' - ;; - esac - _LT_TAGVAR(link_all_deplibs, $1)=yes - - output_verbose_link_cmd='echo' - - # Archives containing C++ object files must be created using - # "CC -xar", where "CC" is the Sun C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' - ;; - gcx*) - # Green Hills C++ Compiler - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - - # The C++ compiler must be used to create the archive. - _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' - ;; - *) - # GNU C++ compiler with Solaris linker - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' - if $CC --version | $GREP -v '^2\.7' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' - else - # g++ 2.7 appears to require `-G' NOT `-shared' on this - # platform. - _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' - fi - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' - case $host_os in - solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; - *) - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' - ;; - esac - fi - ;; - esac - ;; - - sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) - _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - runpath_var='LD_RUN_PATH' - - case $cc_basename in - CC*) - _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - ;; - - sysv5* | sco3.2v5* | sco5v6*) - # Note: We can NOT use -z defs as we might desire, because we do not - # link with -lc, and that would cause any symbols used from libc to - # always be unresolved, which means just about no library would - # ever link correctly. If we're not using GNU ld we use -z text - # though, which does catch some bad symbols but isn't as heavy-handed - # as -z defs. - _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' - _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_TAGVAR(link_all_deplibs, $1)=yes - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' - runpath_var='LD_RUN_PATH' - - case $cc_basename in - CC*) - _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - ;; - - tandem*) - case $cc_basename in - NCC*) - # NonStop-UX NCC 3.20 - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - vxworks*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - *) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - - AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) - test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no - - _LT_TAGVAR(GCC, $1)="$GXX" - _LT_TAGVAR(LD, $1)="$LD" - - ## CAVEAT EMPTOR: - ## There is no encapsulation within the following macros, do not change - ## the running order or otherwise move them around unless you know exactly - ## what you are doing... - _LT_SYS_HIDDEN_LIBDEPS($1) - _LT_COMPILER_PIC($1) - _LT_COMPILER_C_O($1) - _LT_COMPILER_FILE_LOCKS($1) - _LT_LINKER_SHLIBS($1) - _LT_SYS_DYNAMIC_LINKER($1) - _LT_LINKER_HARDCODE_LIBPATH($1) - - _LT_CONFIG($1) - fi # test -n "$compiler" - - CC=$lt_save_CC - LDCXX=$LD - LD=$lt_save_LD - GCC=$lt_save_GCC - with_gnu_ld=$lt_save_with_gnu_ld - lt_cv_path_LDCXX=$lt_cv_path_LD - lt_cv_path_LD=$lt_save_path_LD - lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld - lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld -fi # test "$_lt_caught_CXX_error" != yes - -AC_LANG_POP -])# _LT_LANG_CXX_CONFIG - - -# _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) -# --------------------------------- -# Figure out "hidden" library dependencies from verbose -# compiler output when linking a shared library. -# Parse the compiler output and extract the necessary -# objects, libraries and library flags. -m4_defun([_LT_SYS_HIDDEN_LIBDEPS], -[m4_require([_LT_FILEUTILS_DEFAULTS])dnl -# Dependencies to place before and after the object being linked: -_LT_TAGVAR(predep_objects, $1)= -_LT_TAGVAR(postdep_objects, $1)= -_LT_TAGVAR(predeps, $1)= -_LT_TAGVAR(postdeps, $1)= -_LT_TAGVAR(compiler_lib_search_path, $1)= - -dnl we can't use the lt_simple_compile_test_code here, -dnl because it contains code intended for an executable, -dnl not a library. It's possible we should let each -dnl tag define a new lt_????_link_test_code variable, -dnl but it's only used here... -m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF -int a; -void foo (void) { a = 0; } -_LT_EOF -], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF -class Foo -{ -public: - Foo (void) { a = 0; } -private: - int a; -}; -_LT_EOF -], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF - subroutine foo - implicit none - integer*4 a - a=0 - return - end -_LT_EOF -], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF - subroutine foo - implicit none - integer a - a=0 - return - end -_LT_EOF -], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF -public class foo { - private int a; - public void bar (void) { - a = 0; - } -}; -_LT_EOF -]) -dnl Parse the compiler output and extract the necessary -dnl objects, libraries and library flags. -if AC_TRY_EVAL(ac_compile); then - # Parse the compiler output and extract the necessary - # objects, libraries and library flags. - - # Sentinel used to keep track of whether or not we are before - # the conftest object file. - pre_test_object_deps_done=no - - for p in `eval "$output_verbose_link_cmd"`; do - case $p in - - -L* | -R* | -l*) - # Some compilers place space between "-{L,R}" and the path. - # Remove the space. - if test $p = "-L" || - test $p = "-R"; then - prev=$p - continue - else - prev= - fi - - if test "$pre_test_object_deps_done" = no; then - case $p in - -L* | -R*) - # Internal compiler library paths should come after those - # provided the user. The postdeps already come after the - # user supplied libs so there is no need to process them. - if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then - _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}" - else - _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}" - fi - ;; - # The "-l" case would never come before the object being - # linked, so don't bother handling this case. - esac - else - if test -z "$_LT_TAGVAR(postdeps, $1)"; then - _LT_TAGVAR(postdeps, $1)="${prev}${p}" - else - _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}" - fi - fi - ;; - - *.$objext) - # This assumes that the test object file only shows up - # once in the compiler output. - if test "$p" = "conftest.$objext"; then - pre_test_object_deps_done=yes - continue - fi - - if test "$pre_test_object_deps_done" = no; then - if test -z "$_LT_TAGVAR(predep_objects, $1)"; then - _LT_TAGVAR(predep_objects, $1)="$p" - else - _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p" - fi - else - if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then - _LT_TAGVAR(postdep_objects, $1)="$p" - else - _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p" - fi - fi - ;; - - *) ;; # Ignore the rest. - - esac - done - - # Clean up. - rm -f a.out a.exe -else - echo "libtool.m4: error: problem compiling $1 test program" -fi - -$RM -f confest.$objext - -# PORTME: override above test on systems where it is broken -m4_if([$1], [CXX], -[case $host_os in -interix[[3-9]]*) - # Interix 3.5 installs completely hosed .la files for C++, so rather than - # hack all around it, let's just trust "g++" to DTRT. - _LT_TAGVAR(predep_objects,$1)= - _LT_TAGVAR(postdep_objects,$1)= - _LT_TAGVAR(postdeps,$1)= - ;; - -linux*) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) - # Sun C++ 5.9 - - # The more standards-conforming stlport4 library is - # incompatible with the Cstd library. Avoid specifying - # it if it's in CXXFLAGS. Ignore libCrun as - # -library=stlport4 depends on it. - case " $CXX $CXXFLAGS " in - *" -library=stlport4 "*) - solaris_use_stlport4=yes - ;; - esac - - if test "$solaris_use_stlport4" != yes; then - _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' - fi - ;; - esac - ;; - -solaris*) - case $cc_basename in - CC*) - # The more standards-conforming stlport4 library is - # incompatible with the Cstd library. Avoid specifying - # it if it's in CXXFLAGS. Ignore libCrun as - # -library=stlport4 depends on it. - case " $CXX $CXXFLAGS " in - *" -library=stlport4 "*) - solaris_use_stlport4=yes - ;; - esac - - # Adding this requires a known-good setup of shared libraries for - # Sun compiler versions before 5.6, else PIC objects from an old - # archive will be linked into the output, leading to subtle bugs. - if test "$solaris_use_stlport4" != yes; then - _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' - fi - ;; - esac - ;; -esac -]) - -case " $_LT_TAGVAR(postdeps, $1) " in -*" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; -esac - _LT_TAGVAR(compiler_lib_search_dirs, $1)= -if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then - _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` -fi -_LT_TAGDECL([], [compiler_lib_search_dirs], [1], - [The directories searched by this compiler when creating a shared library]) -_LT_TAGDECL([], [predep_objects], [1], - [Dependencies to place before and after the objects being linked to - create a shared library]) -_LT_TAGDECL([], [postdep_objects], [1]) -_LT_TAGDECL([], [predeps], [1]) -_LT_TAGDECL([], [postdeps], [1]) -_LT_TAGDECL([], [compiler_lib_search_path], [1], - [The library search path used internally by the compiler when linking - a shared library]) -])# _LT_SYS_HIDDEN_LIBDEPS - - -# _LT_PROG_F77 -# ------------ -# Since AC_PROG_F77 is broken, in that it returns the empty string -# if there is no fortran compiler, we have our own version here. -m4_defun([_LT_PROG_F77], -[ -pushdef([AC_MSG_ERROR], [_lt_disable_F77=yes]) -AC_PROG_F77 -if test -z "$F77" || test "X$F77" = "Xno"; then - _lt_disable_F77=yes -fi -popdef([AC_MSG_ERROR]) -])# _LT_PROG_F77 - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([_LT_PROG_F77], []) - - -# _LT_LANG_F77_CONFIG([TAG]) -# -------------------------- -# Ensure that the configuration variables for a Fortran 77 compiler are -# suitably defined. These variables are subsequently used by _LT_CONFIG -# to write the compiler configuration to `libtool'. -m4_defun([_LT_LANG_F77_CONFIG], -[AC_REQUIRE([_LT_PROG_F77])dnl -AC_LANG_PUSH(Fortran 77) - -_LT_TAGVAR(archive_cmds_need_lc, $1)=no -_LT_TAGVAR(allow_undefined_flag, $1)= -_LT_TAGVAR(always_export_symbols, $1)=no -_LT_TAGVAR(archive_expsym_cmds, $1)= -_LT_TAGVAR(export_dynamic_flag_spec, $1)= -_LT_TAGVAR(hardcode_direct, $1)=no -_LT_TAGVAR(hardcode_direct_absolute, $1)=no -_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= -_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= -_LT_TAGVAR(hardcode_libdir_separator, $1)= -_LT_TAGVAR(hardcode_minus_L, $1)=no -_LT_TAGVAR(hardcode_automatic, $1)=no -_LT_TAGVAR(inherit_rpath, $1)=no -_LT_TAGVAR(module_cmds, $1)= -_LT_TAGVAR(module_expsym_cmds, $1)= -_LT_TAGVAR(link_all_deplibs, $1)=unknown -_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds -_LT_TAGVAR(no_undefined_flag, $1)= -_LT_TAGVAR(whole_archive_flag_spec, $1)= -_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no - -# Source file extension for f77 test sources. -ac_ext=f - -# Object file extension for compiled f77 test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# No sense in running all these tests if we already determined that -# the F77 compiler isn't working. Some variables (like enable_shared) -# are currently assumed to apply to all compilers on this platform, -# and will be corrupted by setting them based on a non-working compiler. -if test "$_lt_disable_F77" != yes; then - # Code to be used in simple compile tests - lt_simple_compile_test_code="\ - subroutine t - return - end -" - - # Code to be used in simple link tests - lt_simple_link_test_code="\ - program t - end -" - - # ltmain only uses $CC for tagged configurations so make sure $CC is set. - _LT_TAG_COMPILER - - # save warnings/boilerplate of simple test code - _LT_COMPILER_BOILERPLATE - _LT_LINKER_BOILERPLATE - - # Allow CC to be a program name with arguments. - lt_save_CC="$CC" - lt_save_GCC=$GCC - CC=${F77-"f77"} - compiler=$CC - _LT_TAGVAR(compiler, $1)=$CC - _LT_CC_BASENAME([$compiler]) - GCC=$G77 - if test -n "$compiler"; then - AC_MSG_CHECKING([if libtool supports shared libraries]) - AC_MSG_RESULT([$can_build_shared]) - - AC_MSG_CHECKING([whether to build shared libraries]) - test "$can_build_shared" = "no" && enable_shared=no - - # On AIX, shared libraries and static libraries use the same namespace, and - # are all built from PIC. - case $host_os in - aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; - aix[[4-9]]*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi - ;; - esac - AC_MSG_RESULT([$enable_shared]) - - AC_MSG_CHECKING([whether to build static libraries]) - # Make sure either enable_shared or enable_static is yes. - test "$enable_shared" = yes || enable_static=yes - AC_MSG_RESULT([$enable_static]) - - _LT_TAGVAR(GCC, $1)="$G77" - _LT_TAGVAR(LD, $1)="$LD" - - ## CAVEAT EMPTOR: - ## There is no encapsulation within the following macros, do not change - ## the running order or otherwise move them around unless you know exactly - ## what you are doing... - _LT_COMPILER_PIC($1) - _LT_COMPILER_C_O($1) - _LT_COMPILER_FILE_LOCKS($1) - _LT_LINKER_SHLIBS($1) - _LT_SYS_DYNAMIC_LINKER($1) - _LT_LINKER_HARDCODE_LIBPATH($1) - - _LT_CONFIG($1) - fi # test -n "$compiler" - - GCC=$lt_save_GCC - CC="$lt_save_CC" -fi # test "$_lt_disable_F77" != yes - -AC_LANG_POP -])# _LT_LANG_F77_CONFIG - - -# _LT_PROG_FC -# ----------- -# Since AC_PROG_FC is broken, in that it returns the empty string -# if there is no fortran compiler, we have our own version here. -m4_defun([_LT_PROG_FC], -[ -pushdef([AC_MSG_ERROR], [_lt_disable_FC=yes]) -AC_PROG_FC -if test -z "$FC" || test "X$FC" = "Xno"; then - _lt_disable_FC=yes -fi -popdef([AC_MSG_ERROR]) -])# _LT_PROG_FC - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([_LT_PROG_FC], []) - - -# _LT_LANG_FC_CONFIG([TAG]) -# ------------------------- -# Ensure that the configuration variables for a Fortran compiler are -# suitably defined. These variables are subsequently used by _LT_CONFIG -# to write the compiler configuration to `libtool'. -m4_defun([_LT_LANG_FC_CONFIG], -[AC_REQUIRE([_LT_PROG_FC])dnl -AC_LANG_PUSH(Fortran) - -_LT_TAGVAR(archive_cmds_need_lc, $1)=no -_LT_TAGVAR(allow_undefined_flag, $1)= -_LT_TAGVAR(always_export_symbols, $1)=no -_LT_TAGVAR(archive_expsym_cmds, $1)= -_LT_TAGVAR(export_dynamic_flag_spec, $1)= -_LT_TAGVAR(hardcode_direct, $1)=no -_LT_TAGVAR(hardcode_direct_absolute, $1)=no -_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= -_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= -_LT_TAGVAR(hardcode_libdir_separator, $1)= -_LT_TAGVAR(hardcode_minus_L, $1)=no -_LT_TAGVAR(hardcode_automatic, $1)=no -_LT_TAGVAR(inherit_rpath, $1)=no -_LT_TAGVAR(module_cmds, $1)= -_LT_TAGVAR(module_expsym_cmds, $1)= -_LT_TAGVAR(link_all_deplibs, $1)=unknown -_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds -_LT_TAGVAR(no_undefined_flag, $1)= -_LT_TAGVAR(whole_archive_flag_spec, $1)= -_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no - -# Source file extension for fc test sources. -ac_ext=${ac_fc_srcext-f} - -# Object file extension for compiled fc test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# No sense in running all these tests if we already determined that -# the FC compiler isn't working. Some variables (like enable_shared) -# are currently assumed to apply to all compilers on this platform, -# and will be corrupted by setting them based on a non-working compiler. -if test "$_lt_disable_FC" != yes; then - # Code to be used in simple compile tests - lt_simple_compile_test_code="\ - subroutine t - return - end -" - - # Code to be used in simple link tests - lt_simple_link_test_code="\ - program t - end -" - - # ltmain only uses $CC for tagged configurations so make sure $CC is set. - _LT_TAG_COMPILER - - # save warnings/boilerplate of simple test code - _LT_COMPILER_BOILERPLATE - _LT_LINKER_BOILERPLATE - - # Allow CC to be a program name with arguments. - lt_save_CC="$CC" - lt_save_GCC=$GCC - CC=${FC-"f95"} - compiler=$CC - GCC=$ac_cv_fc_compiler_gnu - - _LT_TAGVAR(compiler, $1)=$CC - _LT_CC_BASENAME([$compiler]) - - if test -n "$compiler"; then - AC_MSG_CHECKING([if libtool supports shared libraries]) - AC_MSG_RESULT([$can_build_shared]) - - AC_MSG_CHECKING([whether to build shared libraries]) - test "$can_build_shared" = "no" && enable_shared=no - - # On AIX, shared libraries and static libraries use the same namespace, and - # are all built from PIC. - case $host_os in - aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; - aix[[4-9]]*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi - ;; - esac - AC_MSG_RESULT([$enable_shared]) - - AC_MSG_CHECKING([whether to build static libraries]) - # Make sure either enable_shared or enable_static is yes. - test "$enable_shared" = yes || enable_static=yes - AC_MSG_RESULT([$enable_static]) - - _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu" - _LT_TAGVAR(LD, $1)="$LD" - - ## CAVEAT EMPTOR: - ## There is no encapsulation within the following macros, do not change - ## the running order or otherwise move them around unless you know exactly - ## what you are doing... - _LT_SYS_HIDDEN_LIBDEPS($1) - _LT_COMPILER_PIC($1) - _LT_COMPILER_C_O($1) - _LT_COMPILER_FILE_LOCKS($1) - _LT_LINKER_SHLIBS($1) - _LT_SYS_DYNAMIC_LINKER($1) - _LT_LINKER_HARDCODE_LIBPATH($1) - - _LT_CONFIG($1) - fi # test -n "$compiler" - - GCC=$lt_save_GCC - CC="$lt_save_CC" -fi # test "$_lt_disable_FC" != yes - -AC_LANG_POP -])# _LT_LANG_FC_CONFIG - - -# _LT_LANG_GCJ_CONFIG([TAG]) -# -------------------------- -# Ensure that the configuration variables for the GNU Java Compiler compiler -# are suitably defined. These variables are subsequently used by _LT_CONFIG -# to write the compiler configuration to `libtool'. -m4_defun([_LT_LANG_GCJ_CONFIG], -[AC_REQUIRE([LT_PROG_GCJ])dnl -AC_LANG_SAVE - -# Source file extension for Java test sources. -ac_ext=java - -# Object file extension for compiled Java test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="class foo {}" - -# Code to be used in simple link tests -lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. -_LT_TAG_COMPILER - -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - -# Allow CC to be a program name with arguments. -lt_save_CC="$CC" -lt_save_GCC=$GCC -GCC=yes -CC=${GCJ-"gcj"} -compiler=$CC -_LT_TAGVAR(compiler, $1)=$CC -_LT_TAGVAR(LD, $1)="$LD" -_LT_CC_BASENAME([$compiler]) - -# GCJ did not exist at the time GCC didn't implicitly link libc in. -_LT_TAGVAR(archive_cmds_need_lc, $1)=no - -_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds - -if test -n "$compiler"; then - _LT_COMPILER_NO_RTTI($1) - _LT_COMPILER_PIC($1) - _LT_COMPILER_C_O($1) - _LT_COMPILER_FILE_LOCKS($1) - _LT_LINKER_SHLIBS($1) - _LT_LINKER_HARDCODE_LIBPATH($1) - - _LT_CONFIG($1) -fi - -AC_LANG_RESTORE - -GCC=$lt_save_GCC -CC="$lt_save_CC" -])# _LT_LANG_GCJ_CONFIG - - -# _LT_LANG_RC_CONFIG([TAG]) -# ------------------------- -# Ensure that the configuration variables for the Windows resource compiler -# are suitably defined. These variables are subsequently used by _LT_CONFIG -# to write the compiler configuration to `libtool'. -m4_defun([_LT_LANG_RC_CONFIG], -[AC_REQUIRE([LT_PROG_RC])dnl -AC_LANG_SAVE - -# Source file extension for RC test sources. -ac_ext=rc - -# Object file extension for compiled RC test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' - -# Code to be used in simple link tests -lt_simple_link_test_code="$lt_simple_compile_test_code" - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. -_LT_TAG_COMPILER - -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - -# Allow CC to be a program name with arguments. -lt_save_CC="$CC" -lt_save_GCC=$GCC -GCC= -CC=${RC-"windres"} -compiler=$CC -_LT_TAGVAR(compiler, $1)=$CC -_LT_CC_BASENAME([$compiler]) -_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes - -if test -n "$compiler"; then - : - _LT_CONFIG($1) -fi - -GCC=$lt_save_GCC -AC_LANG_RESTORE -CC="$lt_save_CC" -])# _LT_LANG_RC_CONFIG - - -# LT_PROG_GCJ -# ----------- -AC_DEFUN([LT_PROG_GCJ], -[m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], - [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], - [AC_CHECK_TOOL(GCJ, gcj,) - test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" - AC_SUBST(GCJFLAGS)])])[]dnl -]) - -# Old name: -AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([LT_AC_PROG_GCJ], []) - - -# LT_PROG_RC -# ---------- -AC_DEFUN([LT_PROG_RC], -[AC_CHECK_TOOL(RC, windres,) -]) - -# Old name: -AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([LT_AC_PROG_RC], []) - - -# _LT_DECL_EGREP -# -------------- -# If we don't have a new enough Autoconf to choose the best grep -# available, choose the one first in the user's PATH. -m4_defun([_LT_DECL_EGREP], -[AC_REQUIRE([AC_PROG_EGREP])dnl -AC_REQUIRE([AC_PROG_FGREP])dnl -test -z "$GREP" && GREP=grep -_LT_DECL([], [GREP], [1], [A grep program that handles long lines]) -_LT_DECL([], [EGREP], [1], [An ERE matcher]) -_LT_DECL([], [FGREP], [1], [A literal string matcher]) -dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too -AC_SUBST([GREP]) -]) - - -# _LT_DECL_SED -# ------------ -# Check for a fully-functional sed program, that truncates -# as few characters as possible. Prefer GNU sed if found. -m4_defun([_LT_DECL_SED], -[AC_PROG_SED -test -z "$SED" && SED=sed -Xsed="$SED -e 1s/^X//" -_LT_DECL([], [SED], [1], [A sed program that does not truncate output]) -_LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"], - [Sed that helps us avoid accidentally triggering echo(1) options like -n]) -])# _LT_DECL_SED - -m4_ifndef([AC_PROG_SED], [ -# NOTE: This macro has been submitted for inclusion into # -# GNU Autoconf as AC_PROG_SED. When it is available in # -# a released version of Autoconf we should remove this # -# macro and use it instead. # - -m4_defun([AC_PROG_SED], -[AC_MSG_CHECKING([for a sed that does not truncate output]) -AC_CACHE_VAL(lt_cv_path_SED, -[# Loop through the user's path and test for sed and gsed. -# Then use that list of sed's as ones to test for truncation. -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for lt_ac_prog in sed gsed; do - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then - lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" - fi - done - done -done -IFS=$as_save_IFS -lt_ac_max=0 -lt_ac_count=0 -# Add /usr/xpg4/bin/sed as it is typically found on Solaris -# along with /bin/sed that truncates output. -for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do - test ! -f $lt_ac_sed && continue - cat /dev/null > conftest.in - lt_ac_count=0 - echo $ECHO_N "0123456789$ECHO_C" >conftest.in - # Check for GNU sed and select it if it is found. - if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then - lt_cv_path_SED=$lt_ac_sed - break - fi - while true; do - cat conftest.in conftest.in >conftest.tmp - mv conftest.tmp conftest.in - cp conftest.in conftest.nl - echo >>conftest.nl - $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break - cmp -s conftest.out conftest.nl || break - # 10000 chars as input seems more than enough - test $lt_ac_count -gt 10 && break - lt_ac_count=`expr $lt_ac_count + 1` - if test $lt_ac_count -gt $lt_ac_max; then - lt_ac_max=$lt_ac_count - lt_cv_path_SED=$lt_ac_sed - fi - done -done -]) -SED=$lt_cv_path_SED -AC_SUBST([SED]) -AC_MSG_RESULT([$SED]) -])#AC_PROG_SED -])#m4_ifndef - -# Old name: -AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([LT_AC_PROG_SED], []) - - -# _LT_CHECK_SHELL_FEATURES -# ------------------------ -# Find out whether the shell is Bourne or XSI compatible, -# or has some other useful features. -m4_defun([_LT_CHECK_SHELL_FEATURES], -[AC_MSG_CHECKING([whether the shell understands some XSI constructs]) -# Try some XSI features -xsi_shell=no -( _lt_dummy="a/b/c" - test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \ - = c,a/b,, \ - && eval 'test $(( 1 + 1 )) -eq 2 \ - && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ - && xsi_shell=yes -AC_MSG_RESULT([$xsi_shell]) -_LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell']) - -AC_MSG_CHECKING([whether the shell understands "+="]) -lt_shell_append=no -( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \ - >/dev/null 2>&1 \ - && lt_shell_append=yes -AC_MSG_RESULT([$lt_shell_append]) -_LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append']) - -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - lt_unset=unset -else - lt_unset=false -fi -_LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl - -# test EBCDIC or ASCII -case `echo X|tr X '\101'` in - A) # ASCII based system - # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr - lt_SP2NL='tr \040 \012' - lt_NL2SP='tr \015\012 \040\040' - ;; - *) # EBCDIC based system - lt_SP2NL='tr \100 \n' - lt_NL2SP='tr \r\n \100\100' - ;; -esac -_LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl -_LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl -])# _LT_CHECK_SHELL_FEATURES - - -# _LT_PROG_XSI_SHELLFNS -# --------------------- -# Bourne and XSI compatible variants of some useful shell functions. -m4_defun([_LT_PROG_XSI_SHELLFNS], -[case $xsi_shell in - yes) - cat << \_LT_EOF >> "$cfgfile" - -# func_dirname file append nondir_replacement -# Compute the dirname of FILE. If nonempty, add APPEND to the result, -# otherwise set result to NONDIR_REPLACEMENT. -func_dirname () -{ - case ${1} in - */*) func_dirname_result="${1%/*}${2}" ;; - * ) func_dirname_result="${3}" ;; - esac -} - -# func_basename file -func_basename () -{ - func_basename_result="${1##*/}" -} - -# func_dirname_and_basename file append nondir_replacement -# perform func_basename and func_dirname in a single function -# call: -# dirname: Compute the dirname of FILE. If nonempty, -# add APPEND to the result, otherwise set result -# to NONDIR_REPLACEMENT. -# value returned in "$func_dirname_result" -# basename: Compute filename of FILE. -# value retuned in "$func_basename_result" -# Implementation must be kept synchronized with func_dirname -# and func_basename. For efficiency, we do not delegate to -# those functions but instead duplicate the functionality here. -func_dirname_and_basename () -{ - case ${1} in - */*) func_dirname_result="${1%/*}${2}" ;; - * ) func_dirname_result="${3}" ;; - esac - func_basename_result="${1##*/}" -} - -# func_stripname prefix suffix name -# strip PREFIX and SUFFIX off of NAME. -# PREFIX and SUFFIX must not contain globbing or regex special -# characters, hashes, percent signs, but SUFFIX may contain a leading -# dot (in which case that matches only a dot). -func_stripname () -{ - # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are - # positional parameters, so assign one to ordinary parameter first. - func_stripname_result=${3} - func_stripname_result=${func_stripname_result#"${1}"} - func_stripname_result=${func_stripname_result%"${2}"} -} - -# func_opt_split -func_opt_split () -{ - func_opt_split_opt=${1%%=*} - func_opt_split_arg=${1#*=} -} - -# func_lo2o object -func_lo2o () -{ - case ${1} in - *.lo) func_lo2o_result=${1%.lo}.${objext} ;; - *) func_lo2o_result=${1} ;; - esac -} - -# func_xform libobj-or-source -func_xform () -{ - func_xform_result=${1%.*}.lo -} - -# func_arith arithmetic-term... -func_arith () -{ - func_arith_result=$(( $[*] )) -} - -# func_len string -# STRING may not start with a hyphen. -func_len () -{ - func_len_result=${#1} -} - -_LT_EOF - ;; - *) # Bourne compatible functions. - cat << \_LT_EOF >> "$cfgfile" - -# func_dirname file append nondir_replacement -# Compute the dirname of FILE. If nonempty, add APPEND to the result, -# otherwise set result to NONDIR_REPLACEMENT. -func_dirname () -{ - # Extract subdirectory from the argument. - func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"` - if test "X$func_dirname_result" = "X${1}"; then - func_dirname_result="${3}" - else - func_dirname_result="$func_dirname_result${2}" - fi -} - -# func_basename file -func_basename () -{ - func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"` -} - -dnl func_dirname_and_basename -dnl A portable version of this function is already defined in general.m4sh -dnl so there is no need for it here. - -# func_stripname prefix suffix name -# strip PREFIX and SUFFIX off of NAME. -# PREFIX and SUFFIX must not contain globbing or regex special -# characters, hashes, percent signs, but SUFFIX may contain a leading -# dot (in which case that matches only a dot). -# func_strip_suffix prefix name -func_stripname () -{ - case ${2} in - .*) func_stripname_result=`$ECHO "X${3}" \ - | $Xsed -e "s%^${1}%%" -e "s%\\\\${2}\$%%"`;; - *) func_stripname_result=`$ECHO "X${3}" \ - | $Xsed -e "s%^${1}%%" -e "s%${2}\$%%"`;; - esac -} - -# sed scripts: -my_sed_long_opt='1s/^\(-[[^=]]*\)=.*/\1/;q' -my_sed_long_arg='1s/^-[[^=]]*=//' - -# func_opt_split -func_opt_split () -{ - func_opt_split_opt=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_opt"` - func_opt_split_arg=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_arg"` -} - -# func_lo2o object -func_lo2o () -{ - func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"` -} - -# func_xform libobj-or-source -func_xform () -{ - func_xform_result=`$ECHO "X${1}" | $Xsed -e 's/\.[[^.]]*$/.lo/'` -} - -# func_arith arithmetic-term... -func_arith () -{ - func_arith_result=`expr "$[@]"` -} - -# func_len string -# STRING may not start with a hyphen. -func_len () -{ - func_len_result=`expr "$[1]" : ".*" 2>/dev/null || echo $max_cmd_len` -} - -_LT_EOF -esac - -case $lt_shell_append in - yes) - cat << \_LT_EOF >> "$cfgfile" - -# func_append var value -# Append VALUE to the end of shell variable VAR. -func_append () -{ - eval "$[1]+=\$[2]" -} -_LT_EOF - ;; - *) - cat << \_LT_EOF >> "$cfgfile" - -# func_append var value -# Append VALUE to the end of shell variable VAR. -func_append () -{ - eval "$[1]=\$$[1]\$[2]" -} - -_LT_EOF - ;; - esac -]) - -# Helper functions for option handling. -*- Autoconf -*- -# -# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. -# Written by Gary V. Vaughan, 2004 -# -# This file is free software; the Free Software Foundation gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. - -# serial 6 ltoptions.m4 - -# This is to help aclocal find these macros, as it can't see m4_define. -AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) - - -# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) -# ------------------------------------------ -m4_define([_LT_MANGLE_OPTION], -[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) - - -# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) -# --------------------------------------- -# Set option OPTION-NAME for macro MACRO-NAME, and if there is a -# matching handler defined, dispatch to it. Other OPTION-NAMEs are -# saved as a flag. -m4_define([_LT_SET_OPTION], -[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl -m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), - _LT_MANGLE_DEFUN([$1], [$2]), - [m4_warning([Unknown $1 option `$2'])])[]dnl -]) - - -# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) -# ------------------------------------------------------------ -# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. -m4_define([_LT_IF_OPTION], -[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) - - -# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) -# ------------------------------------------------------- -# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME -# are set. -m4_define([_LT_UNLESS_OPTIONS], -[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), - [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), - [m4_define([$0_found])])])[]dnl -m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 -])[]dnl -]) - - -# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) -# ---------------------------------------- -# OPTION-LIST is a space-separated list of Libtool options associated -# with MACRO-NAME. If any OPTION has a matching handler declared with -# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about -# the unknown option and exit. -m4_defun([_LT_SET_OPTIONS], -[# Set options -m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), - [_LT_SET_OPTION([$1], _LT_Option)]) - -m4_if([$1],[LT_INIT],[ - dnl - dnl Simply set some default values (i.e off) if boolean options were not - dnl specified: - _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no - ]) - _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no - ]) - dnl - dnl If no reference was made to various pairs of opposing options, then - dnl we run the default mode handler for the pair. For example, if neither - dnl `shared' nor `disable-shared' was passed, we enable building of shared - dnl archives by default: - _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) - _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) - _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) - _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], - [_LT_ENABLE_FAST_INSTALL]) - ]) -])# _LT_SET_OPTIONS - - - -# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) -# ----------------------------------------- -m4_define([_LT_MANGLE_DEFUN], -[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) - - -# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) -# ----------------------------------------------- -m4_define([LT_OPTION_DEFINE], -[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl -])# LT_OPTION_DEFINE - - -# dlopen -# ------ -LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes -]) - -AU_DEFUN([AC_LIBTOOL_DLOPEN], -[_LT_SET_OPTION([LT_INIT], [dlopen]) -AC_DIAGNOSE([obsolete], -[$0: Remove this warning and the call to _LT_SET_OPTION when you -put the `dlopen' option into LT_INIT's first parameter.]) -]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) - - -# win32-dll -# --------- -# Declare package support for building win32 dll's. -LT_OPTION_DEFINE([LT_INIT], [win32-dll], -[enable_win32_dll=yes - -case $host in -*-*-cygwin* | *-*-mingw* | *-*-pw32*) - AC_CHECK_TOOL(AS, as, false) - AC_CHECK_TOOL(DLLTOOL, dlltool, false) - AC_CHECK_TOOL(OBJDUMP, objdump, false) - ;; -esac - -test -z "$AS" && AS=as -_LT_DECL([], [AS], [0], [Assembler program])dnl - -test -z "$DLLTOOL" && DLLTOOL=dlltool -_LT_DECL([], [DLLTOOL], [0], [DLL creation program])dnl - -test -z "$OBJDUMP" && OBJDUMP=objdump -_LT_DECL([], [OBJDUMP], [0], [Object dumper program])dnl -])# win32-dll - -AU_DEFUN([AC_LIBTOOL_WIN32_DLL], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -_LT_SET_OPTION([LT_INIT], [win32-dll]) -AC_DIAGNOSE([obsolete], -[$0: Remove this warning and the call to _LT_SET_OPTION when you -put the `win32-dll' option into LT_INIT's first parameter.]) -]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) - - -# _LT_ENABLE_SHARED([DEFAULT]) -# ---------------------------- -# implement the --enable-shared flag, and supports the `shared' and -# `disable-shared' LT_INIT options. -# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. -m4_define([_LT_ENABLE_SHARED], -[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl -AC_ARG_ENABLE([shared], - [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], - [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], - [p=${PACKAGE-default} - case $enableval in - yes) enable_shared=yes ;; - no) enable_shared=no ;; - *) - enable_shared=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_shared=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac], - [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) - - _LT_DECL([build_libtool_libs], [enable_shared], [0], - [Whether or not to build shared libraries]) -])# _LT_ENABLE_SHARED - -LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) -LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) - -# Old names: -AC_DEFUN([AC_ENABLE_SHARED], -[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) -]) - -AC_DEFUN([AC_DISABLE_SHARED], -[_LT_SET_OPTION([LT_INIT], [disable-shared]) -]) - -AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) -AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AM_ENABLE_SHARED], []) -dnl AC_DEFUN([AM_DISABLE_SHARED], []) - - - -# _LT_ENABLE_STATIC([DEFAULT]) -# ---------------------------- -# implement the --enable-static flag, and support the `static' and -# `disable-static' LT_INIT options. -# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. -m4_define([_LT_ENABLE_STATIC], -[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl -AC_ARG_ENABLE([static], - [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], - [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], - [p=${PACKAGE-default} - case $enableval in - yes) enable_static=yes ;; - no) enable_static=no ;; - *) - enable_static=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_static=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac], - [enable_static=]_LT_ENABLE_STATIC_DEFAULT) - - _LT_DECL([build_old_libs], [enable_static], [0], - [Whether or not to build static libraries]) -])# _LT_ENABLE_STATIC - -LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) -LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) - -# Old names: -AC_DEFUN([AC_ENABLE_STATIC], -[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) -]) - -AC_DEFUN([AC_DISABLE_STATIC], -[_LT_SET_OPTION([LT_INIT], [disable-static]) -]) - -AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) -AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AM_ENABLE_STATIC], []) -dnl AC_DEFUN([AM_DISABLE_STATIC], []) - - - -# _LT_ENABLE_FAST_INSTALL([DEFAULT]) -# ---------------------------------- -# implement the --enable-fast-install flag, and support the `fast-install' -# and `disable-fast-install' LT_INIT options. -# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. -m4_define([_LT_ENABLE_FAST_INSTALL], -[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl -AC_ARG_ENABLE([fast-install], - [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], - [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], - [p=${PACKAGE-default} - case $enableval in - yes) enable_fast_install=yes ;; - no) enable_fast_install=no ;; - *) - enable_fast_install=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_fast_install=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac], - [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) - -_LT_DECL([fast_install], [enable_fast_install], [0], - [Whether or not to optimize for fast installation])dnl -])# _LT_ENABLE_FAST_INSTALL - -LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) -LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) - -# Old names: -AU_DEFUN([AC_ENABLE_FAST_INSTALL], -[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) -AC_DIAGNOSE([obsolete], -[$0: Remove this warning and the call to _LT_SET_OPTION when you put -the `fast-install' option into LT_INIT's first parameter.]) -]) - -AU_DEFUN([AC_DISABLE_FAST_INSTALL], -[_LT_SET_OPTION([LT_INIT], [disable-fast-install]) -AC_DIAGNOSE([obsolete], -[$0: Remove this warning and the call to _LT_SET_OPTION when you put -the `disable-fast-install' option into LT_INIT's first parameter.]) -]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) -dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) - - -# _LT_WITH_PIC([MODE]) -# -------------------- -# implement the --with-pic flag, and support the `pic-only' and `no-pic' -# LT_INIT options. -# MODE is either `yes' or `no'. If omitted, it defaults to `both'. -m4_define([_LT_WITH_PIC], -[AC_ARG_WITH([pic], - [AS_HELP_STRING([--with-pic], - [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], - [pic_mode="$withval"], - [pic_mode=default]) - -test -z "$pic_mode" && pic_mode=m4_default([$1], [default]) - -_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl -])# _LT_WITH_PIC - -LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) -LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) - -# Old name: -AU_DEFUN([AC_LIBTOOL_PICMODE], -[_LT_SET_OPTION([LT_INIT], [pic-only]) -AC_DIAGNOSE([obsolete], -[$0: Remove this warning and the call to _LT_SET_OPTION when you -put the `pic-only' option into LT_INIT's first parameter.]) -]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) - - -m4_define([_LTDL_MODE], []) -LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], - [m4_define([_LTDL_MODE], [nonrecursive])]) -LT_OPTION_DEFINE([LTDL_INIT], [recursive], - [m4_define([_LTDL_MODE], [recursive])]) -LT_OPTION_DEFINE([LTDL_INIT], [subproject], - [m4_define([_LTDL_MODE], [subproject])]) - -m4_define([_LTDL_TYPE], []) -LT_OPTION_DEFINE([LTDL_INIT], [installable], - [m4_define([_LTDL_TYPE], [installable])]) -LT_OPTION_DEFINE([LTDL_INIT], [convenience], - [m4_define([_LTDL_TYPE], [convenience])]) - -# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- -# -# Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc. -# Written by Gary V. Vaughan, 2004 -# -# This file is free software; the Free Software Foundation gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. - -# serial 5 ltsugar.m4 - -# This is to help aclocal find these macros, as it can't see m4_define. -AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) - - -# lt_join(SEP, ARG1, [ARG2...]) -# ----------------------------- -# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their -# associated separator. -# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier -# versions in m4sugar had bugs. -m4_define([lt_join], -[m4_if([$#], [1], [], - [$#], [2], [[$2]], - [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) -m4_define([_lt_join], -[m4_if([$#$2], [2], [], - [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) - - -# lt_car(LIST) -# lt_cdr(LIST) -# ------------ -# Manipulate m4 lists. -# These macros are necessary as long as will still need to support -# Autoconf-2.59 which quotes differently. -m4_define([lt_car], [[$1]]) -m4_define([lt_cdr], -[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], - [$#], 1, [], - [m4_dquote(m4_shift($@))])]) -m4_define([lt_unquote], $1) - - -# lt_append(MACRO-NAME, STRING, [SEPARATOR]) -# ------------------------------------------ -# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'. -# Note that neither SEPARATOR nor STRING are expanded; they are appended -# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). -# No SEPARATOR is output if MACRO-NAME was previously undefined (different -# than defined and empty). -# -# This macro is needed until we can rely on Autoconf 2.62, since earlier -# versions of m4sugar mistakenly expanded SEPARATOR but not STRING. -m4_define([lt_append], -[m4_define([$1], - m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) - - - -# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) -# ---------------------------------------------------------- -# Produce a SEP delimited list of all paired combinations of elements of -# PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list -# has the form PREFIXmINFIXSUFFIXn. -m4_define([lt_combine], -[m4_if([$2], [], [], - [m4_if([$4], [], [], - [lt_join(m4_quote(m4_default([$1], [[, ]])), - lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_prefix, [$2], - [m4_foreach(_Lt_suffix, lt_car([m4_shiftn(3, $@)]), - [_Lt_prefix[]$3[]_Lt_suffix ])])))))])])dnl -]) - - -# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) -# ----------------------------------------------------------------------- -# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited -# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. -m4_define([lt_if_append_uniq], -[m4_ifdef([$1], - [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], - [lt_append([$1], [$2], [$3])$4], - [$5])], - [lt_append([$1], [$2], [$3])$4])]) - - -# lt_dict_add(DICT, KEY, VALUE) -# ----------------------------- -m4_define([lt_dict_add], -[m4_define([$1($2)], [$3])]) - - -# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) -# -------------------------------------------- -m4_define([lt_dict_add_subkey], -[m4_define([$1($2:$3)], [$4])]) - - -# lt_dict_fetch(DICT, KEY, [SUBKEY]) -# ---------------------------------- -m4_define([lt_dict_fetch], -[m4_ifval([$3], - m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), - m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) - - -# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) -# ----------------------------------------------------------------- -m4_define([lt_if_dict_fetch], -[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], - [$5], - [$6])]) - - -# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) -# -------------------------------------------------------------- -m4_define([lt_dict_filter], -[m4_if([$5], [], [], - [lt_join(m4_quote(m4_default([$4], [[, ]])), - lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), - [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl -]) - -# ltversion.m4 -- version numbers -*- Autoconf -*- -# -# Copyright (C) 2004 Free Software Foundation, Inc. -# Written by Scott James Remnant, 2004 -# -# This file is free software; the Free Software Foundation gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. - -# Generated from ltversion.in. - -# serial 2976 ltversion.m4 -# This file is part of GNU Libtool - -m4_define([LT_PACKAGE_VERSION], [2.2.4]) -m4_define([LT_PACKAGE_REVISION], [1.2976]) - -AC_DEFUN([LTVERSION_VERSION], -[macro_version='2.2.4' -macro_revision='1.2976' -_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) -_LT_DECL(, macro_revision, 0) -]) - -# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- -# -# Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc. -# Written by Scott James Remnant, 2004. -# -# This file is free software; the Free Software Foundation gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. - -# serial 4 lt~obsolete.m4 - -# These exist entirely to fool aclocal when bootstrapping libtool. -# -# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN) -# which have later been changed to m4_define as they aren't part of the -# exported API, or moved to Autoconf or Automake where they belong. -# -# The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN -# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us -# using a macro with the same name in our local m4/libtool.m4 it'll -# pull the old libtool.m4 in (it doesn't see our shiny new m4_define -# and doesn't know about Autoconf macros at all.) -# -# So we provide this file, which has a silly filename so it's always -# included after everything else. This provides aclocal with the -# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything -# because those macros already exist, or will be overwritten later. -# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. -# -# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. -# Yes, that means every name once taken will need to remain here until -# we give up compatibility with versions before 1.7, at which point -# we need to keep only those names which we still refer to. - -# This is to help aclocal find these macros, as it can't see m4_define. -AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) - -m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) -m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) -m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) -m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) -m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) -m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) -m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) -m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) -m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) -m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) -m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) -m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) -m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) -m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) -m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) -m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) -m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) -m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) -m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) -m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) -m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) -m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) -m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) -m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) -m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) -m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) -m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) -m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) -m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) -m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) -m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) -m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) -m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) -m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) -m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) -m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) -m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) -m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) -m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) -m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) -m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) -m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) -m4_ifndef([AC_LIBTOOL_RC], [AC_DEFUN([AC_LIBTOOL_RC])]) -m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) -m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) -m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) -m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) -m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) -m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) -m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) -m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) -m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) -m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) -m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) -m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) - -# Copyright (C) 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_AUTOMAKE_VERSION(VERSION) -# ---------------------------- -# Automake X.Y traces this macro to ensure aclocal.m4 has been -# generated from the m4 files accompanying Automake X.Y. -# (This private macro should not be called outside this file.) -AC_DEFUN([AM_AUTOMAKE_VERSION], -[am__api_version='1.10' -dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to -dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.10.1], [], - [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl -]) - -# _AM_AUTOCONF_VERSION(VERSION) -# ----------------------------- -# aclocal traces this macro to find the Autoconf version. -# This is a private macro too. Using m4_define simplifies -# the logic in aclocal, which can simply ignore this definition. -m4_define([_AM_AUTOCONF_VERSION], []) - -# AM_SET_CURRENT_AUTOMAKE_VERSION -# ------------------------------- -# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. -# This function is AC_REQUIREd by AC_INIT_AUTOMAKE. -AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -[AM_AUTOMAKE_VERSION([1.10.1])dnl -m4_ifndef([AC_AUTOCONF_VERSION], - [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl -_AM_AUTOCONF_VERSION(AC_AUTOCONF_VERSION)]) - -# AM_AUX_DIR_EXPAND -*- Autoconf -*- - -# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets -# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to -# `$srcdir', `$srcdir/..', or `$srcdir/../..'. -# -# Of course, Automake must honor this variable whenever it calls a -# tool from the auxiliary directory. The problem is that $srcdir (and -# therefore $ac_aux_dir as well) can be either absolute or relative, -# depending on how configure is run. This is pretty annoying, since -# it makes $ac_aux_dir quite unusable in subdirectories: in the top -# source directory, any form will work fine, but in subdirectories a -# relative path needs to be adjusted first. -# -# $ac_aux_dir/missing -# fails when called from a subdirectory if $ac_aux_dir is relative -# $top_srcdir/$ac_aux_dir/missing -# fails if $ac_aux_dir is absolute, -# fails when called from a subdirectory in a VPATH build with -# a relative $ac_aux_dir -# -# The reason of the latter failure is that $top_srcdir and $ac_aux_dir -# are both prefixed by $srcdir. In an in-source build this is usually -# harmless because $srcdir is `.', but things will broke when you -# start a VPATH build or use an absolute $srcdir. -# -# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, -# iff we strip the leading $srcdir from $ac_aux_dir. That would be: -# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` -# and then we would define $MISSING as -# MISSING="\${SHELL} $am_aux_dir/missing" -# This will work as long as MISSING is not called from configure, because -# unfortunately $(top_srcdir) has no meaning in configure. -# However there are other variables, like CC, which are often used in -# configure, and could therefore not use this "fixed" $ac_aux_dir. -# -# Another solution, used here, is to always expand $ac_aux_dir to an -# absolute PATH. The drawback is that using absolute paths prevent a -# configured tree to be moved without reconfiguration. - -AC_DEFUN([AM_AUX_DIR_EXPAND], -[dnl Rely on autoconf to set up CDPATH properly. -AC_PREREQ([2.50])dnl -# expand $ac_aux_dir to an absolute path -am_aux_dir=`cd $ac_aux_dir && pwd` -]) - -# AM_CONDITIONAL -*- Autoconf -*- - -# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006 -# Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 8 - -# AM_CONDITIONAL(NAME, SHELL-CONDITION) -# ------------------------------------- -# Define a conditional. -AC_DEFUN([AM_CONDITIONAL], -[AC_PREREQ(2.52)dnl - ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], - [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl -AC_SUBST([$1_TRUE])dnl -AC_SUBST([$1_FALSE])dnl -_AM_SUBST_NOTMAKE([$1_TRUE])dnl -_AM_SUBST_NOTMAKE([$1_FALSE])dnl -if $2; then - $1_TRUE= - $1_FALSE='#' -else - $1_TRUE='#' - $1_FALSE= -fi -AC_CONFIG_COMMANDS_PRE( -[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then - AC_MSG_ERROR([[conditional "$1" was never defined. -Usually this means the macro was only invoked conditionally.]]) -fi])]) - -# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 -# Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 9 - -# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be -# written in clear, in which case automake, when reading aclocal.m4, -# will think it sees a *use*, and therefore will trigger all it's -# C support machinery. Also note that it means that autoscan, seeing -# CC etc. in the Makefile, will ask for an AC_PROG_CC use... - - -# _AM_DEPENDENCIES(NAME) -# ---------------------- -# See how the compiler implements dependency checking. -# NAME is "CC", "CXX", "GCJ", or "OBJC". -# We try a few techniques and use that to set a single cache variable. -# -# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was -# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular -# dependency, and given that the user is not expected to run this macro, -# just rely on AC_PROG_CC. -AC_DEFUN([_AM_DEPENDENCIES], -[AC_REQUIRE([AM_SET_DEPDIR])dnl -AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl -AC_REQUIRE([AM_MAKE_INCLUDE])dnl -AC_REQUIRE([AM_DEP_TRACK])dnl - -ifelse([$1], CC, [depcc="$CC" am_compiler_list=], - [$1], CXX, [depcc="$CXX" am_compiler_list=], - [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], - [$1], UPC, [depcc="$UPC" am_compiler_list=], - [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], - [depcc="$$1" am_compiler_list=]) - -AC_CACHE_CHECK([dependency style of $depcc], - [am_cv_$1_dependencies_compiler_type], -[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then - # We make a subdir and do the tests there. Otherwise we can end up - # making bogus files that we don't know about and never remove. For - # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named `D' -- because `-MD' means `put the output - # in D'. - mkdir conftest.dir - # Copy depcomp to subdir because otherwise we won't find it if we're - # using a relative directory. - cp "$am_depcomp" conftest.dir - cd conftest.dir - # We will build objects and dependencies in a subdirectory because - # it helps to detect inapplicable dependency modes. For instance - # both Tru64's cc and ICC support -MD to output dependencies as a - # side effect of compilation, but ICC will put the dependencies in - # the current directory while Tru64 will put them in the object - # directory. - mkdir sub - - am_cv_$1_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` - fi - for depmode in $am_compiler_list; do - # Setup a source with many dependencies, because some compilers - # like to wrap large dependency lists on column 80 (with \), and - # we should not choose a depcomp mode which is confused by this. - # - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. - : > sub/conftest.c - for i in 1 2 3 4 5 6; do - echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with - # Solaris 8's {/usr,}/bin/sh. - touch sub/conftst$i.h - done - echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - - case $depmode in - nosideeffect) - # after this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested - if test "x$enable_dependency_tracking" = xyes; then - continue - else - break - fi - ;; - none) break ;; - esac - # We check with `-c' and `-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle `-M -o', and we need to detect this. - if depmode=$depmode \ - source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ - depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ - $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ - >/dev/null 2>conftest.err && - grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - # icc doesn't choke on unknown options, it will just issue warnings - # or remarks (even with -Werror). So we grep stderr for any message - # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thusly: - # icc: Command line warning: ignoring option '-M'; no argument required - # The diagnosis changed in icc 8.0: - # icc: Command line remark: option '-MP' not supported - if (grep 'ignoring option' conftest.err || - grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else - am_cv_$1_dependencies_compiler_type=$depmode - break - fi - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_$1_dependencies_compiler_type=none -fi -]) -AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) -AM_CONDITIONAL([am__fastdep$1], [ - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) -]) - - -# AM_SET_DEPDIR -# ------------- -# Choose a directory name for dependency files. -# This macro is AC_REQUIREd in _AM_DEPENDENCIES -AC_DEFUN([AM_SET_DEPDIR], -[AC_REQUIRE([AM_SET_LEADING_DOT])dnl -AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl -]) - - -# AM_DEP_TRACK -# ------------ -AC_DEFUN([AM_DEP_TRACK], -[AC_ARG_ENABLE(dependency-tracking, -[ --disable-dependency-tracking speeds up one-time build - --enable-dependency-tracking do not reject slow dependency extractors]) -if test "x$enable_dependency_tracking" != xno; then - am_depcomp="$ac_aux_dir/depcomp" - AMDEPBACKSLASH='\' -fi -AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) -AC_SUBST([AMDEPBACKSLASH])dnl -_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl -]) - -# Generate code to set up dependency tracking. -*- Autoconf -*- - -# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 -# Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -#serial 3 - -# _AM_OUTPUT_DEPENDENCY_COMMANDS -# ------------------------------ -AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], -[for mf in $CONFIG_FILES; do - # Strip MF so we end up with the name of the file. - mf=`echo "$mf" | sed -e 's/:.*$//'` - # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named `Makefile.in', but - # some people rename them; so instead we look at the file content. - # Grep'ing the first line is not enough: some people post-process - # each Makefile.in and add a new line on top of each file to say so. - # Grep'ing the whole file is not good either: AIX grep has a line - # limit of 2048, but all sed's we know have understand at least 4000. - if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then - dirpart=`AS_DIRNAME("$mf")` - else - continue - fi - # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running `make'. - DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` - test -z "$DEPDIR" && continue - am__include=`sed -n 's/^am__include = //p' < "$mf"` - test -z "am__include" && continue - am__quote=`sed -n 's/^am__quote = //p' < "$mf"` - # When using ansi2knr, U may be empty or an underscore; expand it - U=`sed -n 's/^U = //p' < "$mf"` - # Find all dependency output files, they are included files with - # $(DEPDIR) in their names. We invoke sed twice because it is the - # simplest approach to changing $(DEPDIR) to its actual value in the - # expansion. - for file in `sed -n " - s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do - # Make sure the directory exists. - test -f "$dirpart/$file" && continue - fdir=`AS_DIRNAME(["$file"])` - AS_MKDIR_P([$dirpart/$fdir]) - # echo "creating $dirpart/$file" - echo '# dummy' > "$dirpart/$file" - done -done -])# _AM_OUTPUT_DEPENDENCY_COMMANDS - - -# AM_OUTPUT_DEPENDENCY_COMMANDS -# ----------------------------- -# This macro should only be invoked once -- use via AC_REQUIRE. -# -# This code is only required when automatic dependency tracking -# is enabled. FIXME. This creates each `.P' file that we will -# need in order to bootstrap the dependency handling code. -AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], -[AC_CONFIG_COMMANDS([depfiles], - [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], - [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) -]) - -# Do all the work for Automake. -*- Autoconf -*- - -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -# 2005, 2006, 2008 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 13 - -# This macro actually does too much. Some checks are only needed if -# your package does certain things. But this isn't really a big deal. - -# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) -# AM_INIT_AUTOMAKE([OPTIONS]) -# ----------------------------------------------- -# The call with PACKAGE and VERSION arguments is the old style -# call (pre autoconf-2.50), which is being phased out. PACKAGE -# and VERSION should now be passed to AC_INIT and removed from -# the call to AM_INIT_AUTOMAKE. -# We support both call styles for the transition. After -# the next Automake release, Autoconf can make the AC_INIT -# arguments mandatory, and then we can depend on a new Autoconf -# release and drop the old call support. -AC_DEFUN([AM_INIT_AUTOMAKE], -[AC_PREREQ([2.60])dnl -dnl Autoconf wants to disallow AM_ names. We explicitly allow -dnl the ones we care about. -m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl -AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl -AC_REQUIRE([AC_PROG_INSTALL])dnl -if test "`cd $srcdir && pwd`" != "`pwd`"; then - # Use -I$(srcdir) only when $(srcdir) != ., so that make's output - # is not polluted with repeated "-I." - AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl - # test to see if srcdir already configured - if test -f $srcdir/config.status; then - AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) - fi -fi - -# test whether we have cygpath -if test -z "$CYGPATH_W"; then - if (cygpath --version) >/dev/null 2>/dev/null; then - CYGPATH_W='cygpath -w' - else - CYGPATH_W=echo - fi -fi -AC_SUBST([CYGPATH_W]) - -# Define the identity of the package. -dnl Distinguish between old-style and new-style calls. -m4_ifval([$2], -[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl - AC_SUBST([PACKAGE], [$1])dnl - AC_SUBST([VERSION], [$2])], -[_AM_SET_OPTIONS([$1])dnl -dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. -m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, - [m4_fatal([AC_INIT should be called with package and version arguments])])dnl - AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl - AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl - -_AM_IF_OPTION([no-define],, -[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) - AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl - -# Some tools Automake needs. -AC_REQUIRE([AM_SANITY_CHECK])dnl -AC_REQUIRE([AC_ARG_PROGRAM])dnl -AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) -AM_MISSING_PROG(AUTOCONF, autoconf) -AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) -AM_MISSING_PROG(AUTOHEADER, autoheader) -AM_MISSING_PROG(MAKEINFO, makeinfo) -AM_PROG_INSTALL_SH -AM_PROG_INSTALL_STRIP -AC_REQUIRE([AM_PROG_MKDIR_P])dnl -# We need awk for the "check" target. The system "awk" is bad on -# some platforms. -AC_REQUIRE([AC_PROG_AWK])dnl -AC_REQUIRE([AC_PROG_MAKE_SET])dnl -AC_REQUIRE([AM_SET_LEADING_DOT])dnl -_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], - [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], - [_AM_PROG_TAR([v7])])]) -_AM_IF_OPTION([no-dependencies],, -[AC_PROVIDE_IFELSE([AC_PROG_CC], - [_AM_DEPENDENCIES(CC)], - [define([AC_PROG_CC], - defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl -AC_PROVIDE_IFELSE([AC_PROG_CXX], - [_AM_DEPENDENCIES(CXX)], - [define([AC_PROG_CXX], - defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl -AC_PROVIDE_IFELSE([AC_PROG_OBJC], - [_AM_DEPENDENCIES(OBJC)], - [define([AC_PROG_OBJC], - defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl -]) -]) - - -# When config.status generates a header, we must update the stamp-h file. -# This file resides in the same directory as the config header -# that is generated. The stamp files are numbered to have different names. - -# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the -# loop where config.status creates the headers, so we can generate -# our stamp files there. -AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], -[# Compute $1's index in $config_headers. -_am_arg=$1 -_am_stamp_count=1 -for _am_header in $config_headers :; do - case $_am_header in - $_am_arg | $_am_arg:* ) - break ;; - * ) - _am_stamp_count=`expr $_am_stamp_count + 1` ;; - esac -done -echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) - -# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_PROG_INSTALL_SH -# ------------------ -# Define $install_sh. -AC_DEFUN([AM_PROG_INSTALL_SH], -[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"} -AC_SUBST(install_sh)]) - -# Copyright (C) 2003, 2005 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 2 - -# Check whether the underlying file-system supports filenames -# with a leading dot. For instance MS-DOS doesn't. -AC_DEFUN([AM_SET_LEADING_DOT], -[rm -rf .tst 2>/dev/null -mkdir .tst 2>/dev/null -if test -d .tst; then - am__leading_dot=. -else - am__leading_dot=_ -fi -rmdir .tst 2>/dev/null -AC_SUBST([am__leading_dot])]) - -# Add --enable-maintainer-mode option to configure. -*- Autoconf -*- -# From Jim Meyering - -# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005 -# Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 4 - -AC_DEFUN([AM_MAINTAINER_MODE], -[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) - dnl maintainer-mode is disabled by default - AC_ARG_ENABLE(maintainer-mode, -[ --enable-maintainer-mode enable make rules and dependencies not useful - (and sometimes confusing) to the casual installer], - USE_MAINTAINER_MODE=$enableval, - USE_MAINTAINER_MODE=no) - AC_MSG_RESULT([$USE_MAINTAINER_MODE]) - AM_CONDITIONAL(MAINTAINER_MODE, [test $USE_MAINTAINER_MODE = yes]) - MAINT=$MAINTAINER_MODE_TRUE - AC_SUBST(MAINT)dnl -] -) - -AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE]) - -# Check to see how 'make' treats includes. -*- Autoconf -*- - -# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 3 - -# AM_MAKE_INCLUDE() -# ----------------- -# Check to see how make treats includes. -AC_DEFUN([AM_MAKE_INCLUDE], -[am_make=${MAKE-make} -cat > confinc << 'END' -am__doit: - @echo done -.PHONY: am__doit -END -# If we don't find an include directive, just comment out the code. -AC_MSG_CHECKING([for style of include used by $am_make]) -am__include="#" -am__quote= -_am_result=none -# First try GNU make style include. -echo "include confinc" > confmf -# We grep out `Entering directory' and `Leaving directory' -# messages which can occur if `w' ends up in MAKEFLAGS. -# In particular we don't look at `^make:' because GNU make might -# be invoked under some other name (usually "gmake"), in which -# case it prints its new name instead of `make'. -if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then - am__include=include - am__quote= - _am_result=GNU -fi -# Now try BSD make style include. -if test "$am__include" = "#"; then - echo '.include "confinc"' > confmf - if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then - am__include=.include - am__quote="\"" - _am_result=BSD - fi -fi -AC_SUBST([am__include]) -AC_SUBST([am__quote]) -AC_MSG_RESULT([$_am_result]) -rm -f confinc confmf -]) - -# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- - -# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005 -# Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 5 - -# AM_MISSING_PROG(NAME, PROGRAM) -# ------------------------------ -AC_DEFUN([AM_MISSING_PROG], -[AC_REQUIRE([AM_MISSING_HAS_RUN]) -$1=${$1-"${am_missing_run}$2"} -AC_SUBST($1)]) - - -# AM_MISSING_HAS_RUN -# ------------------ -# Define MISSING if not defined so far and test if it supports --run. -# If it does, set am_missing_run to use it, otherwise, to nothing. -AC_DEFUN([AM_MISSING_HAS_RUN], -[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -AC_REQUIRE_AUX_FILE([missing])dnl -test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" -# Use eval to expand $SHELL -if eval "$MISSING --run true"; then - am_missing_run="$MISSING --run " -else - am_missing_run= - AC_MSG_WARN([`missing' script is too old or missing]) -fi -]) - -# Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_PROG_MKDIR_P -# --------------- -# Check for `mkdir -p'. -AC_DEFUN([AM_PROG_MKDIR_P], -[AC_PREREQ([2.60])dnl -AC_REQUIRE([AC_PROG_MKDIR_P])dnl -dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, -dnl while keeping a definition of mkdir_p for backward compatibility. -dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. -dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of -dnl Makefile.ins that do not define MKDIR_P, so we do our own -dnl adjustment using top_builddir (which is defined more often than -dnl MKDIR_P). -AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl -case $mkdir_p in - [[\\/$]]* | ?:[[\\/]]*) ;; - */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; -esac -]) - -# Helper functions for option handling. -*- Autoconf -*- - -# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 3 - -# _AM_MANGLE_OPTION(NAME) -# ----------------------- -AC_DEFUN([_AM_MANGLE_OPTION], -[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) - -# _AM_SET_OPTION(NAME) -# ------------------------------ -# Set option NAME. Presently that only means defining a flag for this option. -AC_DEFUN([_AM_SET_OPTION], -[m4_define(_AM_MANGLE_OPTION([$1]), 1)]) - -# _AM_SET_OPTIONS(OPTIONS) -# ---------------------------------- -# OPTIONS is a space-separated list of Automake options. -AC_DEFUN([_AM_SET_OPTIONS], -[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) - -# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) -# ------------------------------------------- -# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. -AC_DEFUN([_AM_IF_OPTION], -[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) - -# Check to make sure that the build environment is sane. -*- Autoconf -*- - -# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 -# Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 4 - -# AM_SANITY_CHECK -# --------------- -AC_DEFUN([AM_SANITY_CHECK], -[AC_MSG_CHECKING([whether build environment is sane]) -# Just in case -sleep 1 -echo timestamp > conftest.file -# Do `set' in a subshell so we don't clobber the current shell's -# arguments. Must try -L first in case configure is actually a -# symlink; some systems play weird games with the mod time of symlinks -# (eg FreeBSD returns the mod time of the symlink's containing -# directory). -if ( - set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` - if test "$[*]" = "X"; then - # -L didn't work. - set X `ls -t $srcdir/configure conftest.file` - fi - rm -f conftest.file - if test "$[*]" != "X $srcdir/configure conftest.file" \ - && test "$[*]" != "X conftest.file $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken -alias in your environment]) - fi - - test "$[2]" = conftest.file - ) -then - # Ok. - : -else - AC_MSG_ERROR([newly created file is older than distributed files! -Check your system clock]) -fi -AC_MSG_RESULT(yes)]) - -# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_PROG_INSTALL_STRIP -# --------------------- -# One issue with vendor `install' (even GNU) is that you can't -# specify the program used to strip binaries. This is especially -# annoying in cross-compiling environments, where the build's strip -# is unlikely to handle the host's binaries. -# Fortunately install-sh will honor a STRIPPROG variable, so we -# always use install-sh in `make install-strip', and initialize -# STRIPPROG with the value of the STRIP variable (set by the user). -AC_DEFUN([AM_PROG_INSTALL_STRIP], -[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl -# Installed binaries are usually stripped using `strip' when the user -# run `make install-strip'. However `strip' might not be the right -# tool to use in cross-compilation environments, therefore Automake -# will honor the `STRIP' environment variable to overrule this program. -dnl Don't test for $cross_compiling = yes, because it might be `maybe'. -if test "$cross_compiling" != no; then - AC_CHECK_TOOL([STRIP], [strip], :) -fi -INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" -AC_SUBST([INSTALL_STRIP_PROGRAM])]) - -# Copyright (C) 2006 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# _AM_SUBST_NOTMAKE(VARIABLE) -# --------------------------- -# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. -# This macro is traced by Automake. -AC_DEFUN([_AM_SUBST_NOTMAKE]) - -# Check how to create a tarball. -*- Autoconf -*- - -# Copyright (C) 2004, 2005 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 2 - -# _AM_PROG_TAR(FORMAT) -# -------------------- -# Check how to create a tarball in format FORMAT. -# FORMAT should be one of `v7', `ustar', or `pax'. -# -# Substitute a variable $(am__tar) that is a command -# writing to stdout a FORMAT-tarball containing the directory -# $tardir. -# tardir=directory && $(am__tar) > result.tar -# -# Substitute a variable $(am__untar) that extract such -# a tarball read from stdin. -# $(am__untar) < result.tar -AC_DEFUN([_AM_PROG_TAR], -[# Always define AMTAR for backward compatibility. -AM_MISSING_PROG([AMTAR], [tar]) -m4_if([$1], [v7], - [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], - [m4_case([$1], [ustar],, [pax],, - [m4_fatal([Unknown tar format])]) -AC_MSG_CHECKING([how to create a $1 tar archive]) -# Loop over all known methods to create a tar archive until one works. -_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' -_am_tools=${am_cv_prog_tar_$1-$_am_tools} -# Do not fold the above two line into one, because Tru64 sh and -# Solaris sh will not grok spaces in the rhs of `-'. -for _am_tool in $_am_tools -do - case $_am_tool in - gnutar) - for _am_tar in tar gnutar gtar; - do - AM_RUN_LOG([$_am_tar --version]) && break - done - am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' - am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' - am__untar="$_am_tar -xf -" - ;; - plaintar) - # Must skip GNU tar: if it does not support --format= it doesn't create - # ustar tarball either. - (tar --version) >/dev/null 2>&1 && continue - am__tar='tar chf - "$$tardir"' - am__tar_='tar chf - "$tardir"' - am__untar='tar xf -' - ;; - pax) - am__tar='pax -L -x $1 -w "$$tardir"' - am__tar_='pax -L -x $1 -w "$tardir"' - am__untar='pax -r' - ;; - cpio) - am__tar='find "$$tardir" -print | cpio -o -H $1 -L' - am__tar_='find "$tardir" -print | cpio -o -H $1 -L' - am__untar='cpio -i -H $1 -d' - ;; - none) - am__tar=false - am__tar_=false - am__untar=false - ;; - esac - - # If the value was cached, stop now. We just wanted to have am__tar - # and am__untar set. - test -n "${am_cv_prog_tar_$1}" && break - - # tar/untar a dummy directory, and stop if the command works - rm -rf conftest.dir - mkdir conftest.dir - echo GrepMe > conftest.dir/file - AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) - rm -rf conftest.dir - if test -s conftest.tar; then - AM_RUN_LOG([$am__untar /dev/null 2>&1 && break - fi -done -rm -rf conftest.dir - -AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) -AC_MSG_RESULT([$am_cv_prog_tar_$1])]) -AC_SUBST([am__tar]) -AC_SUBST([am__untar]) -]) # _AM_PROG_TAR - diff --git a/Build/source/libs/graphite/engine-2.3.1/build.bat b/Build/source/libs/graphite/engine-2.3.1/build.bat deleted file mode 100644 index a10f4e2c5c1..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/build.bat +++ /dev/null @@ -1 +0,0 @@ -nmake -f makefile.vc7 %1 %2 %3 diff --git a/Build/source/libs/graphite/engine-2.3.1/build_d.bat b/Build/source/libs/graphite/engine-2.3.1/build_d.bat deleted file mode 100644 index 656b492e2d0..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/build_d.bat +++ /dev/null @@ -1 +0,0 @@ -nmake CFG=DEBUG -f makefile.vc7 %1 %2 %3 diff --git a/Build/source/libs/graphite/engine-2.3.1/configure b/Build/source/libs/graphite/engine-2.3.1/configure deleted file mode 100755 index 29d3e23f82b..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/configure +++ /dev/null @@ -1,19424 +0,0 @@ -#! /bin/sh -# Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.61 for silgraphite 2.3.1. -# -# Report bugs to . -# -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -# 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. -# This configure script is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## - -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in - *posix*) set -o posix ;; -esac - -fi - - - - -# PATH needs CR -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' - else - PATH_SEPARATOR=: - fi - rm -f conf$$.sh -fi - -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false -fi - - -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -as_nl=' -' -IFS=" "" $as_nl" - -# Find who we are. Look in the path if we contain no directory separator. -case $0 in - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done -IFS=$as_save_IFS - - ;; -esac -# We did not find ourselves, most probably we were run as `sh COMMAND' -# in which case we are not to be found in the path. -if test "x$as_myself" = x; then - as_myself=$0 -fi -if test ! -f "$as_myself"; then - echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - { (exit 1); exit 1; } -fi - -# Work around bugs in pre-3.0 UWIN ksh. -for as_var in ENV MAIL MAILPATH -do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -for as_var in \ - LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ - LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ - LC_TELEPHONE LC_TIME -do - if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var - else - ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var - fi -done - -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - - -# Name of the executable. -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -# CDPATH. -$as_unset CDPATH - - -if test "x$CONFIG_SHELL" = x; then - if (eval ":") 2>/dev/null; then - as_have_required=yes -else - as_have_required=no -fi - - if test $as_have_required = yes && (eval ": -(as_func_return () { - (exit \$1) -} -as_func_success () { - as_func_return 0 -} -as_func_failure () { - as_func_return 1 -} -as_func_ret_success () { - return 0 -} -as_func_ret_failure () { - return 1 -} - -exitcode=0 -if as_func_success; then - : -else - exitcode=1 - echo as_func_success failed. -fi - -if as_func_failure; then - exitcode=1 - echo as_func_failure succeeded. -fi - -if as_func_ret_success; then - : -else - exitcode=1 - echo as_func_ret_success failed. -fi - -if as_func_ret_failure; then - exitcode=1 - echo as_func_ret_failure succeeded. -fi - -if ( set x; as_func_ret_success y && test x = \"\$1\" ); then - : -else - exitcode=1 - echo positional parameters were not saved. -fi - -test \$exitcode = 0) || { (exit 1); exit 1; } - -( - as_lineno_1=\$LINENO - as_lineno_2=\$LINENO - test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && - test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } -") 2> /dev/null; then - : -else - as_candidate_shells= - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - case $as_dir in - /*) - for as_base in sh bash ksh sh5; do - as_candidate_shells="$as_candidate_shells $as_dir/$as_base" - done;; - esac -done -IFS=$as_save_IFS - - - for as_shell in $as_candidate_shells $SHELL; do - # Try only shells that exist, to save several forks. - if { test -f "$as_shell" || test -f "$as_shell.exe"; } && - { ("$as_shell") 2> /dev/null <<\_ASEOF -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in - *posix*) set -o posix ;; -esac - -fi - - -: -_ASEOF -}; then - CONFIG_SHELL=$as_shell - as_have_required=yes - if { "$as_shell" 2> /dev/null <<\_ASEOF -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in - *posix*) set -o posix ;; -esac - -fi - - -: -(as_func_return () { - (exit $1) -} -as_func_success () { - as_func_return 0 -} -as_func_failure () { - as_func_return 1 -} -as_func_ret_success () { - return 0 -} -as_func_ret_failure () { - return 1 -} - -exitcode=0 -if as_func_success; then - : -else - exitcode=1 - echo as_func_success failed. -fi - -if as_func_failure; then - exitcode=1 - echo as_func_failure succeeded. -fi - -if as_func_ret_success; then - : -else - exitcode=1 - echo as_func_ret_success failed. -fi - -if as_func_ret_failure; then - exitcode=1 - echo as_func_ret_failure succeeded. -fi - -if ( set x; as_func_ret_success y && test x = "$1" ); then - : -else - exitcode=1 - echo positional parameters were not saved. -fi - -test $exitcode = 0) || { (exit 1); exit 1; } - -( - as_lineno_1=$LINENO - as_lineno_2=$LINENO - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } - -_ASEOF -}; then - break -fi - -fi - - done - - if test "x$CONFIG_SHELL" != x; then - for as_var in BASH_ENV ENV - do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var - done - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} -fi - - - if test $as_have_required = no; then - echo This script requires a shell more modern than all the - echo shells that I found on your system. Please install a - echo modern shell, or manually run the script under such a - echo shell if you do have one. - { (exit 1); exit 1; } -fi - - -fi - -fi - - - -(eval "as_func_return () { - (exit \$1) -} -as_func_success () { - as_func_return 0 -} -as_func_failure () { - as_func_return 1 -} -as_func_ret_success () { - return 0 -} -as_func_ret_failure () { - return 1 -} - -exitcode=0 -if as_func_success; then - : -else - exitcode=1 - echo as_func_success failed. -fi - -if as_func_failure; then - exitcode=1 - echo as_func_failure succeeded. -fi - -if as_func_ret_success; then - : -else - exitcode=1 - echo as_func_ret_success failed. -fi - -if as_func_ret_failure; then - exitcode=1 - echo as_func_ret_failure succeeded. -fi - -if ( set x; as_func_ret_success y && test x = \"\$1\" ); then - : -else - exitcode=1 - echo positional parameters were not saved. -fi - -test \$exitcode = 0") || { - echo No shell found that supports shell functions. - echo Please tell autoconf@gnu.org about your system, - echo including any error possibly output before this - echo message -} - - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { - - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line after each line using $LINENO; the second 'sed' - # does the real work. The second script uses 'N' to pair each - # line-number line with the line containing $LINENO, and appends - # trailing '-' during substitution so that $LINENO is not a special - # case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # scripts with optimization help from Paolo Bonzini. Blame Lee - # E. McMahon (1931-1989) for sed's syntax. :-) - sed -n ' - p - /[$]LINENO/= - ' <$as_myself | - sed ' - s/[$]LINENO.*/&-/ - t lineno - b - :lineno - N - :loop - s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ - t loop - s/-\n.*// - ' >$as_me.lineno && - chmod +x "$as_me.lineno" || - { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 - { (exit 1); exit 1; }; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensitive to this). - . "./$as_me.lineno" - # Exit status is that of the last command. - exit -} - - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in --n*) - case `echo 'x\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - *) ECHO_C='\c';; - esac;; -*) - ECHO_N='-n';; -esac - -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -rm -f conf$$ conf$$.exe conf$$.file -if test -d conf$$.dir; then - rm -f conf$$.dir/conf$$.file -else - rm -f conf$$.dir - mkdir conf$$.dir -fi -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file -rmdir conf$$.dir 2>/dev/null - -if mkdir -p . 2>/dev/null; then - as_mkdir_p=: -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - - - -# Check that we are running under the correct shell. -SHELL=${CONFIG_SHELL-/bin/sh} - -case X$lt_ECHO in -X*--fallback-echo) - # Remove one level of quotation (which was required for Make). - ECHO=`echo "$lt_ECHO" | sed 's,\\\\\$\\$0,'$0','` - ;; -esac - -ECHO=${lt_ECHO-echo} -if test "X$1" = X--no-reexec; then - # Discard the --no-reexec flag, and continue. - shift -elif test "X$1" = X--fallback-echo; then - # Avoid inline document here, it may be left over - : -elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' ; then - # Yippee, $ECHO works! - : -else - # Restart under the correct shell. - exec $SHELL "$0" --no-reexec ${1+"$@"} -fi - -if test "X$1" = X--fallback-echo; then - # used as fallback echo - shift - cat <<_LT_EOF -$* -_LT_EOF - exit 0 -fi - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -if test -z "$lt_ECHO"; then - if test "X${echo_test_string+set}" != Xset; then - # find a string as large as possible, as long as the shell can cope with it - for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do - # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... - if { echo_test_string=`eval $cmd`; } 2>/dev/null && - { test "X$echo_test_string" = "X$echo_test_string"; } 2>/dev/null - then - break - fi - done - fi - - if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' && - echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - : - else - # The Solaris, AIX, and Digital Unix default echo programs unquote - # backslashes. This makes it impossible to quote backslashes using - # echo "$something" | sed 's/\\/\\\\/g' - # - # So, first we look for a working echo in the user's PATH. - - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for dir in $PATH /usr/ucb; do - IFS="$lt_save_ifs" - if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && - test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - ECHO="$dir/echo" - break - fi - done - IFS="$lt_save_ifs" - - if test "X$ECHO" = Xecho; then - # We didn't find a better echo, so look for alternatives. - if test "X`{ print -r '\t'; } 2>/dev/null`" = 'X\t' && - echo_testing_string=`{ print -r "$echo_test_string"; } 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - # This shell has a builtin print -r that does the trick. - ECHO='print -r' - elif { test -f /bin/ksh || test -f /bin/ksh$ac_exeext; } && - test "X$CONFIG_SHELL" != X/bin/ksh; then - # If we have ksh, try running configure again with it. - ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} - export ORIGINAL_CONFIG_SHELL - CONFIG_SHELL=/bin/ksh - export CONFIG_SHELL - exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"} - else - # Try using printf. - ECHO='printf %s\n' - if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' && - echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - # Cool, printf works - : - elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && - test "X$echo_testing_string" = 'X\t' && - echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL - export CONFIG_SHELL - SHELL="$CONFIG_SHELL" - export SHELL - ECHO="$CONFIG_SHELL $0 --fallback-echo" - elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && - test "X$echo_testing_string" = 'X\t' && - echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - ECHO="$CONFIG_SHELL $0 --fallback-echo" - else - # maybe with a smaller string... - prev=: - - for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do - if { test "X$echo_test_string" = "X`eval $cmd`"; } 2>/dev/null - then - break - fi - prev="$cmd" - done - - if test "$prev" != 'sed 50q "$0"'; then - echo_test_string=`eval $prev` - export echo_test_string - exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"} - else - # Oops. We lost completely, so just stick with echo. - ECHO=echo - fi - fi - fi - fi - fi -fi - -# Copy echo and quote the copy suitably for passing to libtool from -# the Makefile, instead of quoting the original, which is used later. -lt_ECHO=$ECHO -if test "X$lt_ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then - lt_ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo" -fi - - - - -exec 7<&0 &1 - -# Name of the host. -# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, -# so uname gets run too. -ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` - -# -# Initializations. -# -ac_default_prefix=/usr/local -ac_clean_files= -ac_config_libobj_dir=. -LIBOBJS= -cross_compiling=no -subdirs= -MFLAGS= -MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} - -# Identity of this package. -PACKAGE_NAME='silgraphite' -PACKAGE_TARNAME='silgraphite' -PACKAGE_VERSION='2.3.1' -PACKAGE_STRING='silgraphite 2.3.1' -PACKAGE_BUGREPORT='silgraphite-devel@lists.sourceforge.net' - -ac_unique_file="src/segment/GrEngine.cpp" -# Factoring default headers for most tests. -ac_includes_default="\ -#include -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_SYS_STAT_H -# include -#endif -#ifdef STDC_HEADERS -# include -# include -#else -# ifdef HAVE_STDLIB_H -# include -# endif -#endif -#ifdef HAVE_STRING_H -# if !defined STDC_HEADERS && defined HAVE_MEMORY_H -# include -# endif -# include -#endif -#ifdef HAVE_STRINGS_H -# include -#endif -#ifdef HAVE_INTTYPES_H -# include -#endif -#ifdef HAVE_STDINT_H -# include -#endif -#ifdef HAVE_UNISTD_H -# include -#endif" - -ac_subst_vars='SHELL -PATH_SEPARATOR -PACKAGE_NAME -PACKAGE_TARNAME -PACKAGE_VERSION -PACKAGE_STRING -PACKAGE_BUGREPORT -exec_prefix -prefix -program_transform_name -bindir -sbindir -libexecdir -datarootdir -datadir -sysconfdir -sharedstatedir -localstatedir -includedir -oldincludedir -docdir -infodir -htmldir -dvidir -pdfdir -psdir -libdir -localedir -mandir -DEFS -ECHO_C -ECHO_N -ECHO_T -LIBS -build_alias -host_alias -target_alias -INSTALL_PROGRAM -INSTALL_SCRIPT -INSTALL_DATA -am__isrc -CYGPATH_W -PACKAGE -VERSION -ACLOCAL -AUTOCONF -AUTOMAKE -AUTOHEADER -MAKEINFO -install_sh -STRIP -INSTALL_STRIP_PROGRAM -mkdir_p -AWK -SET_MAKE -am__leading_dot -AMTAR -am__tar -am__untar -MAINTAINER_MODE_TRUE -MAINTAINER_MODE_FALSE -MAINT -build -build_cpu -build_vendor -build_os -host -host_cpu -host_vendor -host_os -CC -CFLAGS -LDFLAGS -CPPFLAGS -ac_ct_CC -EXEEXT -OBJEXT -DEPDIR -am__include -am__quote -AMDEP_TRUE -AMDEP_FALSE -AMDEPBACKSLASH -CCDEPMODE -am__fastdepCC_TRUE -am__fastdepCC_FALSE -CPP -GREP -EGREP -LIBTOOL -SED -FGREP -LD -DUMPBIN -ac_ct_DUMPBIN -NM -LN_S -AR -RANLIB -lt_ECHO -DSYMUTIL -NMEDIT -LIPO -OTOOL -OTOOL64 -CXX -CXXFLAGS -ac_ct_CXX -CXXDEPMODE -am__fastdepCXX_TRUE -am__fastdepCXX_FALSE -CXXCPP -LSB_RELEASE -SIZEOF_WCHAR_T -REL_CODENAME -LIBOBJS -LTLIBOBJS' -ac_subst_files='' - ac_precious_vars='build_alias -host_alias -target_alias -CC -CFLAGS -LDFLAGS -LIBS -CPPFLAGS -CPP -CXX -CXXFLAGS -CCC -CXXCPP' - - -# Initialize some variables set by options. -ac_init_help= -ac_init_version=false -# The variables have the same names as the options, with -# dashes changed to underlines. -cache_file=/dev/null -exec_prefix=NONE -no_create= -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -srcdir= -verbose= -x_includes=NONE -x_libraries=NONE - -# Installation directory options. -# These are left unexpanded so users can "make install exec_prefix=/foo" -# and all the variables that are supposed to be based on exec_prefix -# by default will actually change. -# Use braces instead of parens because sh, perl, etc. also accept them. -# (The list follows the same order as the GNU Coding Standards.) -bindir='${exec_prefix}/bin' -sbindir='${exec_prefix}/sbin' -libexecdir='${exec_prefix}/libexec' -datarootdir='${prefix}/share' -datadir='${datarootdir}' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -includedir='${prefix}/include' -oldincludedir='/usr/include' -docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' -infodir='${datarootdir}/info' -htmldir='${docdir}' -dvidir='${docdir}' -pdfdir='${docdir}' -psdir='${docdir}' -libdir='${exec_prefix}/lib' -localedir='${datarootdir}/locale' -mandir='${datarootdir}/man' - -ac_prev= -ac_dashdash= -for ac_option -do - # If the previous option needs an argument, assign it. - if test -n "$ac_prev"; then - eval $ac_prev=\$ac_option - ac_prev= - continue - fi - - case $ac_option in - *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; - *) ac_optarg=yes ;; - esac - - # Accept the important Cygnus configure options, so we can diagnose typos. - - case $ac_dashdash$ac_option in - --) - ac_dashdash=yes ;; - - -bindir | --bindir | --bindi | --bind | --bin | --bi) - ac_prev=bindir ;; - -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir=$ac_optarg ;; - - -build | --build | --buil | --bui | --bu) - ac_prev=build_alias ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build_alias=$ac_optarg ;; - - -cache-file | --cache-file | --cache-fil | --cache-fi \ - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) - ac_prev=cache_file ;; - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ - | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file=$ac_optarg ;; - - --config-cache | -C) - cache_file=config.cache ;; - - -datadir | --datadir | --datadi | --datad) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=*) - datadir=$ac_optarg ;; - - -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ - | --dataroo | --dataro | --datar) - ac_prev=datarootdir ;; - -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ - | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) - datarootdir=$ac_optarg ;; - - -disable-* | --disable-*) - ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid feature name: $ac_feature" >&2 - { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` - eval enable_$ac_feature=no ;; - - -docdir | --docdir | --docdi | --doc | --do) - ac_prev=docdir ;; - -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) - docdir=$ac_optarg ;; - - -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) - ac_prev=dvidir ;; - -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) - dvidir=$ac_optarg ;; - - -enable-* | --enable-*) - ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid feature name: $ac_feature" >&2 - { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` - eval enable_$ac_feature=\$ac_optarg ;; - - -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ - | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ - | --exec | --exe | --ex) - ac_prev=exec_prefix ;; - -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ - | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ - | --exec=* | --exe=* | --ex=*) - exec_prefix=$ac_optarg ;; - - -gas | --gas | --ga | --g) - # Obsolete; use --with-gas. - with_gas=yes ;; - - -help | --help | --hel | --he | -h) - ac_init_help=long ;; - -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) - ac_init_help=recursive ;; - -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) - ac_init_help=short ;; - - -host | --host | --hos | --ho) - ac_prev=host_alias ;; - -host=* | --host=* | --hos=* | --ho=*) - host_alias=$ac_optarg ;; - - -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) - ac_prev=htmldir ;; - -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ - | --ht=*) - htmldir=$ac_optarg ;; - - -includedir | --includedir | --includedi | --included | --include \ - | --includ | --inclu | --incl | --inc) - ac_prev=includedir ;; - -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ - | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir=$ac_optarg ;; - - -infodir | --infodir | --infodi | --infod | --info | --inf) - ac_prev=infodir ;; - -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir=$ac_optarg ;; - - -libdir | --libdir | --libdi | --libd) - ac_prev=libdir ;; - -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir=$ac_optarg ;; - - -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ - | --libexe | --libex | --libe) - ac_prev=libexecdir ;; - -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ - | --libexe=* | --libex=* | --libe=*) - libexecdir=$ac_optarg ;; - - -localedir | --localedir | --localedi | --localed | --locale) - ac_prev=localedir ;; - -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) - localedir=$ac_optarg ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst | --locals) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) - localstatedir=$ac_optarg ;; - - -mandir | --mandir | --mandi | --mand | --man | --ma | --m) - ac_prev=mandir ;; - -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir=$ac_optarg ;; - - -nfp | --nfp | --nf) - # Obsolete; use --without-fp. - with_fp=no ;; - - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c | -n) - no_create=yes ;; - - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) - no_recursion=yes ;; - - -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ - | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ - | --oldin | --oldi | --old | --ol | --o) - ac_prev=oldincludedir ;; - -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ - | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ - | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir=$ac_optarg ;; - - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) - ac_prev=prefix ;; - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix=$ac_optarg ;; - - -program-prefix | --program-prefix | --program-prefi | --program-pref \ - | --program-pre | --program-pr | --program-p) - ac_prev=program_prefix ;; - -program-prefix=* | --program-prefix=* | --program-prefi=* \ - | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix=$ac_optarg ;; - - -program-suffix | --program-suffix | --program-suffi | --program-suff \ - | --program-suf | --program-su | --program-s) - ac_prev=program_suffix ;; - -program-suffix=* | --program-suffix=* | --program-suffi=* \ - | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix=$ac_optarg ;; - - -program-transform-name | --program-transform-name \ - | --program-transform-nam | --program-transform-na \ - | --program-transform-n | --program-transform- \ - | --program-transform | --program-transfor \ - | --program-transfo | --program-transf \ - | --program-trans | --program-tran \ - | --progr-tra | --program-tr | --program-t) - ac_prev=program_transform_name ;; - -program-transform-name=* | --program-transform-name=* \ - | --program-transform-nam=* | --program-transform-na=* \ - | --program-transform-n=* | --program-transform-=* \ - | --program-transform=* | --program-transfor=* \ - | --program-transfo=* | --program-transf=* \ - | --program-trans=* | --program-tran=* \ - | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name=$ac_optarg ;; - - -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) - ac_prev=pdfdir ;; - -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) - pdfdir=$ac_optarg ;; - - -psdir | --psdir | --psdi | --psd | --ps) - ac_prev=psdir ;; - -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) - psdir=$ac_optarg ;; - - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - silent=yes ;; - - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) - ac_prev=sbindir ;; - -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ - | --sbi=* | --sb=*) - sbindir=$ac_optarg ;; - - -sharedstatedir | --sharedstatedir | --sharedstatedi \ - | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ - | --sharedst | --shareds | --shared | --share | --shar \ - | --sha | --sh) - ac_prev=sharedstatedir ;; - -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ - | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ - | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ - | --sha=* | --sh=*) - sharedstatedir=$ac_optarg ;; - - -site | --site | --sit) - ac_prev=site ;; - -site=* | --site=* | --sit=*) - site=$ac_optarg ;; - - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir=$ac_optarg ;; - - -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ - | --syscon | --sysco | --sysc | --sys | --sy) - ac_prev=sysconfdir ;; - -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ - | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir=$ac_optarg ;; - - -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target_alias ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target_alias=$ac_optarg ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers | -V) - ac_init_version=: ;; - - -with-* | --with-*) - ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid package name: $ac_package" >&2 - { (exit 1); exit 1; }; } - ac_package=`echo $ac_package | sed 's/[-.]/_/g'` - eval with_$ac_package=\$ac_optarg ;; - - -without-* | --without-*) - ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid package name: $ac_package" >&2 - { (exit 1); exit 1; }; } - ac_package=`echo $ac_package | sed 's/[-.]/_/g'` - eval with_$ac_package=no ;; - - --x) - # Obsolete; use --with-x. - with_x=yes ;; - - -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ - | --x-incl | --x-inc | --x-in | --x-i) - ac_prev=x_includes ;; - -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ - | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes=$ac_optarg ;; - - -x-libraries | --x-libraries | --x-librarie | --x-librari \ - | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) - ac_prev=x_libraries ;; - -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ - | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries=$ac_optarg ;; - - -*) { echo "$as_me: error: unrecognized option: $ac_option -Try \`$0 --help' for more information." >&2 - { (exit 1); exit 1; }; } - ;; - - *=*) - ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` - # Reject names that are not valid shell variable names. - expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 - { (exit 1); exit 1; }; } - eval $ac_envvar=\$ac_optarg - export $ac_envvar ;; - - *) - # FIXME: should be removed in autoconf 3.0. - echo "$as_me: WARNING: you should use --build, --host, --target" >&2 - expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} - ;; - - esac -done - -if test -n "$ac_prev"; then - ac_option=--`echo $ac_prev | sed 's/_/-/g'` - { echo "$as_me: error: missing argument to $ac_option" >&2 - { (exit 1); exit 1; }; } -fi - -# Be sure to have absolute directory names. -for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ - datadir sysconfdir sharedstatedir localstatedir includedir \ - oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir -do - eval ac_val=\$$ac_var - case $ac_val in - [\\/$]* | ?:[\\/]* ) continue;; - NONE | '' ) case $ac_var in *prefix ) continue;; esac;; - esac - { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 - { (exit 1); exit 1; }; } -done - -# There might be people who depend on the old broken behavior: `$host' -# used to hold the argument of --host etc. -# FIXME: To remove some day. -build=$build_alias -host=$host_alias -target=$target_alias - -# FIXME: To remove some day. -if test "x$host_alias" != x; then - if test "x$build_alias" = x; then - cross_compiling=maybe - echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. - If a cross compiler is detected then cross compile mode will be used." >&2 - elif test "x$build_alias" != "x$host_alias"; then - cross_compiling=yes - fi -fi - -ac_tool_prefix= -test -n "$host_alias" && ac_tool_prefix=$host_alias- - -test "$silent" = yes && exec 6>/dev/null - - -ac_pwd=`pwd` && test -n "$ac_pwd" && -ac_ls_di=`ls -di .` && -ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || - { echo "$as_me: error: Working directory cannot be determined" >&2 - { (exit 1); exit 1; }; } -test "X$ac_ls_di" = "X$ac_pwd_ls_di" || - { echo "$as_me: error: pwd does not report name of working directory" >&2 - { (exit 1); exit 1; }; } - - -# Find the source files, if location was not specified. -if test -z "$srcdir"; then - ac_srcdir_defaulted=yes - # Try the directory containing this script, then the parent directory. - ac_confdir=`$as_dirname -- "$0" || -$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$0" : 'X\(//\)[^/]' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -echo X"$0" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - srcdir=$ac_confdir - if test ! -r "$srcdir/$ac_unique_file"; then - srcdir=.. - fi -else - ac_srcdir_defaulted=no -fi -if test ! -r "$srcdir/$ac_unique_file"; then - test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." - { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 - { (exit 1); exit 1; }; } -fi -ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" -ac_abs_confdir=`( - cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2 - { (exit 1); exit 1; }; } - pwd)` -# When building in place, set srcdir=. -if test "$ac_abs_confdir" = "$ac_pwd"; then - srcdir=. -fi -# Remove unnecessary trailing slashes from srcdir. -# Double slashes in file names in object file debugging info -# mess up M-x gdb in Emacs. -case $srcdir in -*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; -esac -for ac_var in $ac_precious_vars; do - eval ac_env_${ac_var}_set=\${${ac_var}+set} - eval ac_env_${ac_var}_value=\$${ac_var} - eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} - eval ac_cv_env_${ac_var}_value=\$${ac_var} -done - -# -# Report the --help message. -# -if test "$ac_init_help" = "long"; then - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat <<_ACEOF -\`configure' configures silgraphite 2.3.1 to adapt to many kinds of systems. - -Usage: $0 [OPTION]... [VAR=VALUE]... - -To assign environment variables (e.g., CC, CFLAGS...), specify them as -VAR=VALUE. See below for descriptions of some of the useful variables. - -Defaults for the options are specified in brackets. - -Configuration: - -h, --help display this help and exit - --help=short display options specific to this package - --help=recursive display the short help of all the included packages - -V, --version display version information and exit - -q, --quiet, --silent do not print \`checking...' messages - --cache-file=FILE cache test results in FILE [disabled] - -C, --config-cache alias for \`--cache-file=config.cache' - -n, --no-create do not create output files - --srcdir=DIR find the sources in DIR [configure dir or \`..'] - -Installation directories: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [PREFIX] - -By default, \`make install' will install all the files in -\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify -an installation prefix other than \`$ac_default_prefix' using \`--prefix', -for instance \`--prefix=\$HOME'. - -For better control, use the options below. - -Fine tuning of the installation directories: - --bindir=DIR user executables [EPREFIX/bin] - --sbindir=DIR system admin executables [EPREFIX/sbin] - --libexecdir=DIR program executables [EPREFIX/libexec] - --sysconfdir=DIR read-only single-machine data [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] - --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --libdir=DIR object code libraries [EPREFIX/lib] - --includedir=DIR C header files [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc [/usr/include] - --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] - --datadir=DIR read-only architecture-independent data [DATAROOTDIR] - --infodir=DIR info documentation [DATAROOTDIR/info] - --localedir=DIR locale-dependent data [DATAROOTDIR/locale] - --mandir=DIR man documentation [DATAROOTDIR/man] - --docdir=DIR documentation root [DATAROOTDIR/doc/silgraphite] - --htmldir=DIR html documentation [DOCDIR] - --dvidir=DIR dvi documentation [DOCDIR] - --pdfdir=DIR pdf documentation [DOCDIR] - --psdir=DIR ps documentation [DOCDIR] -_ACEOF - - cat <<\_ACEOF - -Program names: - --program-prefix=PREFIX prepend PREFIX to installed program names - --program-suffix=SUFFIX append SUFFIX to installed program names - --program-transform-name=PROGRAM run sed PROGRAM on installed program names - -System types: - --build=BUILD configure for building on BUILD [guessed] - --host=HOST cross-compile to build programs to run on HOST [BUILD] -_ACEOF -fi - -if test -n "$ac_init_help"; then - case $ac_init_help in - short | recursive ) echo "Configuration of silgraphite 2.3.1:";; - esac - cat <<\_ACEOF - -Optional Features: - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --enable-maintainer-mode enable make rules and dependencies not useful - (and sometimes confusing) to the casual installer - --disable-dependency-tracking speeds up one-time build - --enable-dependency-tracking do not reject slow dependency extractors - --disable-tracing build without support for trace Graphite logs - --enable-debug build with debugging. (default=no) - --disable-final build without optimizations and no debugging. - --enable-strict treat warnings as errors, check for as much as we - can - --enable-profile allow profiling (default=no) - --enable-profilefn allow functioncheck profiling (default=no) - --enable-shared[=PKGS] build shared libraries [default=yes] - --enable-static[=PKGS] build static libraries [default=yes] - --enable-fast-install[=PKGS] - optimize for fast installation [default=yes] - --disable-libtool-lock avoid locking (might break parallel builds) - -Optional Packages: - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --with-pic try to use only PIC/non-PIC objects [default=use - both] - --with-gnu-ld assume the C compiler uses GNU ld [default=no] - -Some influential environment variables: - CC C compiler command - CFLAGS C compiler flags - LDFLAGS linker flags, e.g. -L if you have libraries in a - nonstandard directory - LIBS libraries to pass to the linker, e.g. -l - CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if - you have headers in a nonstandard directory - CPP C preprocessor - CXX C++ compiler command - CXXFLAGS C++ compiler flags - CXXCPP C++ preprocessor - -Use these variables to override the choices made by `configure' or to help -it to find libraries and programs with nonstandard names/locations. - -Report bugs to . -_ACEOF -ac_status=$? -fi - -if test "$ac_init_help" = "recursive"; then - # If there are subdirs, report their specific --help. - for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue - test -d "$ac_dir" || continue - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - cd "$ac_dir" || { ac_status=$?; continue; } - # Check for guested configure. - if test -f "$ac_srcdir/configure.gnu"; then - echo && - $SHELL "$ac_srcdir/configure.gnu" --help=recursive - elif test -f "$ac_srcdir/configure"; then - echo && - $SHELL "$ac_srcdir/configure" --help=recursive - else - echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 - fi || ac_status=$? - cd "$ac_pwd" || { ac_status=$?; break; } - done -fi - -test -n "$ac_init_help" && exit $ac_status -if $ac_init_version; then - cat <<\_ACEOF -silgraphite configure 2.3.1 -generated by GNU Autoconf 2.61 - -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. -This configure script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it. -_ACEOF - exit -fi -cat >config.log <<_ACEOF -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. - -It was created by silgraphite $as_me 2.3.1, which was -generated by GNU Autoconf 2.61. Invocation command line was - - $ $0 $@ - -_ACEOF -exec 5>>config.log -{ -cat <<_ASUNAME -## --------- ## -## Platform. ## -## --------- ## - -hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` - -/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` -/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` -/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` -/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` - -_ASUNAME - -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - echo "PATH: $as_dir" -done -IFS=$as_save_IFS - -} >&5 - -cat >&5 <<_ACEOF - - -## ----------- ## -## Core tests. ## -## ----------- ## - -_ACEOF - - -# Keep a trace of the command line. -# Strip out --no-create and --no-recursion so they do not pile up. -# Strip out --silent because we don't want to record it for future runs. -# Also quote any args containing shell meta-characters. -# Make two passes to allow for proper duplicate-argument suppression. -ac_configure_args= -ac_configure_args0= -ac_configure_args1= -ac_must_keep_next=false -for ac_pass in 1 2 -do - for ac_arg - do - case $ac_arg in - -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - continue ;; - *\'*) - ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - case $ac_pass in - 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; - 2) - ac_configure_args1="$ac_configure_args1 '$ac_arg'" - if test $ac_must_keep_next = true; then - ac_must_keep_next=false # Got value, back to normal. - else - case $ac_arg in - *=* | --config-cache | -C | -disable-* | --disable-* \ - | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ - | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ - | -with-* | --with-* | -without-* | --without-* | --x) - case "$ac_configure_args0 " in - "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; - esac - ;; - -* ) ac_must_keep_next=true ;; - esac - fi - ac_configure_args="$ac_configure_args '$ac_arg'" - ;; - esac - done -done -$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } -$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } - -# When interrupted or exit'd, cleanup temporary files, and complete -# config.log. We remove comments because anyway the quotes in there -# would cause problems or look ugly. -# WARNING: Use '\'' to represent an apostrophe within the trap. -# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. -trap 'exit_status=$? - # Save into config.log some information that might help in debugging. - { - echo - - cat <<\_ASBOX -## ---------------- ## -## Cache variables. ## -## ---------------- ## -_ASBOX - echo - # The following way of writing the cache mishandles newlines in values, -( - for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do - eval ac_val=\$$ac_var - case $ac_val in #( - *${as_nl}*) - case $ac_var in #( - *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 -echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; - esac - case $ac_var in #( - _ | IFS | as_nl) ;; #( - *) $as_unset $ac_var ;; - esac ;; - esac - done - (set) 2>&1 | - case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( - *${as_nl}ac_space=\ *) - sed -n \ - "s/'\''/'\''\\\\'\'''\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" - ;; #( - *) - sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" - ;; - esac | - sort -) - echo - - cat <<\_ASBOX -## ----------------- ## -## Output variables. ## -## ----------------- ## -_ASBOX - echo - for ac_var in $ac_subst_vars - do - eval ac_val=\$$ac_var - case $ac_val in - *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; - esac - echo "$ac_var='\''$ac_val'\''" - done | sort - echo - - if test -n "$ac_subst_files"; then - cat <<\_ASBOX -## ------------------- ## -## File substitutions. ## -## ------------------- ## -_ASBOX - echo - for ac_var in $ac_subst_files - do - eval ac_val=\$$ac_var - case $ac_val in - *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; - esac - echo "$ac_var='\''$ac_val'\''" - done | sort - echo - fi - - if test -s confdefs.h; then - cat <<\_ASBOX -## ----------- ## -## confdefs.h. ## -## ----------- ## -_ASBOX - echo - cat confdefs.h - echo - fi - test "$ac_signal" != 0 && - echo "$as_me: caught signal $ac_signal" - echo "$as_me: exit $exit_status" - } >&5 - rm -f core *.core core.conftest.* && - rm -f -r conftest* confdefs* conf$$* $ac_clean_files && - exit $exit_status -' 0 -for ac_signal in 1 2 13 15; do - trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal -done -ac_signal=0 - -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -f -r conftest* confdefs.h - -# Predefined preprocessor variables. - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_NAME "$PACKAGE_NAME" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_TARNAME "$PACKAGE_TARNAME" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_VERSION "$PACKAGE_VERSION" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_STRING "$PACKAGE_STRING" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" -_ACEOF - - -# Let the site file select an alternate cache file if it wants to. -# Prefer explicitly selected file to automatically selected ones. -if test -n "$CONFIG_SITE"; then - set x "$CONFIG_SITE" -elif test "x$prefix" != xNONE; then - set x "$prefix/share/config.site" "$prefix/etc/config.site" -else - set x "$ac_default_prefix/share/config.site" \ - "$ac_default_prefix/etc/config.site" -fi -shift -for ac_site_file -do - if test -r "$ac_site_file"; then - { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 -echo "$as_me: loading site script $ac_site_file" >&6;} - sed 's/^/| /' "$ac_site_file" >&5 - . "$ac_site_file" - fi -done - -if test -r "$cache_file"; then - # Some versions of bash will fail to source /dev/null (special - # files actually), so we avoid doing that. - if test -f "$cache_file"; then - { echo "$as_me:$LINENO: loading cache $cache_file" >&5 -echo "$as_me: loading cache $cache_file" >&6;} - case $cache_file in - [\\/]* | ?:[\\/]* ) . "$cache_file";; - *) . "./$cache_file";; - esac - fi -else - { echo "$as_me:$LINENO: creating cache $cache_file" >&5 -echo "$as_me: creating cache $cache_file" >&6;} - >$cache_file -fi - -# Check that the precious variables saved in the cache have kept the same -# value. -ac_cache_corrupted=false -for ac_var in $ac_precious_vars; do - eval ac_old_set=\$ac_cv_env_${ac_var}_set - eval ac_new_set=\$ac_env_${ac_var}_set - eval ac_old_val=\$ac_cv_env_${ac_var}_value - eval ac_new_val=\$ac_env_${ac_var}_value - case $ac_old_set,$ac_new_set in - set,) - { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,set) - { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 -echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,);; - *) - if test "x$ac_old_val" != "x$ac_new_val"; then - { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 -echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 -echo "$as_me: former value: $ac_old_val" >&2;} - { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 -echo "$as_me: current value: $ac_new_val" >&2;} - ac_cache_corrupted=: - fi;; - esac - # Pass precious variables to config.status. - if test "$ac_new_set" = set; then - case $ac_new_val in - *\'*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; - *) ac_arg=$ac_var=$ac_new_val ;; - esac - case " $ac_configure_args " in - *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. - *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; - esac - fi -done -if $ac_cache_corrupted; then - { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 -echo "$as_me: error: changes in the environment can compromise the build" >&2;} - { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 -echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} - { (exit 1); exit 1; }; } -fi - - - - - - - - - - - - - - - - - - - - - - - - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - - -ac_aux_dir= -for ac_dir in config "$srcdir"/config; do - if test -f "$ac_dir/install-sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f "$ac_dir/install.sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - elif test -f "$ac_dir/shtool"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/shtool install -c" - break - fi -done -if test -z "$ac_aux_dir"; then - { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in config \"$srcdir\"/config" >&5 -echo "$as_me: error: cannot find install-sh or install.sh in config \"$srcdir\"/config" >&2;} - { (exit 1); exit 1; }; } -fi - -# These three variables are undocumented and unsupported, -# and are intended to be withdrawn in a future Autoconf release. -# They can cause serious problems if a builder's source tree is in a directory -# whose full name contains unusual characters. -ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. -ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. -ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. - - - -# setup automake -am__api_version='1.10' - -# Find a good install program. We prefer a C program (faster), -# so one script is as good as another. But avoid the broken or -# incompatible versions: -# SysV /etc/install, /usr/sbin/install -# SunOS /usr/etc/install -# IRIX /sbin/install -# AIX /bin/install -# AmigaOS /C/install, which installs bootblocks on floppy discs -# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag -# AFS /usr/afsws/bin/install, which mishandles nonexistent args -# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" -# OS/2's system install, which has a completely different semantic -# ./install, which can be erroneously created by make from ./install.sh. -{ echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 -echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; } -if test -z "$INSTALL"; then -if test "${ac_cv_path_install+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - # Account for people who put trailing slashes in PATH elements. -case $as_dir/ in - ./ | .// | /cC/* | \ - /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ - ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ - /usr/ucb/* ) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - # Don't use installbsd from OSF since it installs stuff as root - # by default. - for ac_prog in ginstall scoinst install; do - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then - if test $ac_prog = install && - grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - : - elif test $ac_prog = install && - grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # program-specific install script used by HP pwplus--don't use. - : - else - ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" - break 3 - fi - fi - done - done - ;; -esac -done -IFS=$as_save_IFS - - -fi - if test "${ac_cv_path_install+set}" = set; then - INSTALL=$ac_cv_path_install - else - # As a last resort, use the slow shell script. Don't cache a - # value for INSTALL within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the value is a relative name. - INSTALL=$ac_install_sh - fi -fi -{ echo "$as_me:$LINENO: result: $INSTALL" >&5 -echo "${ECHO_T}$INSTALL" >&6; } - -# Use test -z because SunOS4 sh mishandles braces in ${var-val}. -# It thinks the first close brace ends the variable substitution. -test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' - -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' - -test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' - -{ echo "$as_me:$LINENO: checking whether build environment is sane" >&5 -echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6; } -# Just in case -sleep 1 -echo timestamp > conftest.file -# Do `set' in a subshell so we don't clobber the current shell's -# arguments. Must try -L first in case configure is actually a -# symlink; some systems play weird games with the mod time of symlinks -# (eg FreeBSD returns the mod time of the symlink's containing -# directory). -if ( - set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` - if test "$*" = "X"; then - # -L didn't work. - set X `ls -t $srcdir/configure conftest.file` - fi - rm -f conftest.file - if test "$*" != "X $srcdir/configure conftest.file" \ - && test "$*" != "X conftest.file $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken -alias in your environment" >&5 -echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken -alias in your environment" >&2;} - { (exit 1); exit 1; }; } - fi - - test "$2" = conftest.file - ) -then - # Ok. - : -else - { { echo "$as_me:$LINENO: error: newly created file is older than distributed files! -Check your system clock" >&5 -echo "$as_me: error: newly created file is older than distributed files! -Check your system clock" >&2;} - { (exit 1); exit 1; }; } -fi -{ echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6; } -test "$program_prefix" != NONE && - program_transform_name="s&^&$program_prefix&;$program_transform_name" -# Use a double $ so make ignores it. -test "$program_suffix" != NONE && - program_transform_name="s&\$&$program_suffix&;$program_transform_name" -# Double any \ or $. echo might interpret backslashes. -# By default was `s,x,x', remove it if useless. -cat <<\_ACEOF >conftest.sed -s/[\\$]/&&/g;s/;s,x,x,$// -_ACEOF -program_transform_name=`echo $program_transform_name | sed -f conftest.sed` -rm -f conftest.sed - -# expand $ac_aux_dir to an absolute path -am_aux_dir=`cd $ac_aux_dir && pwd` - -test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" -# Use eval to expand $SHELL -if eval "$MISSING --run true"; then - am_missing_run="$MISSING --run " -else - am_missing_run= - { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 -echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} -fi - -{ echo "$as_me:$LINENO: checking for a thread-safe mkdir -p" >&5 -echo $ECHO_N "checking for a thread-safe mkdir -p... $ECHO_C" >&6; } -if test -z "$MKDIR_P"; then - if test "${ac_cv_path_mkdir+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in mkdir gmkdir; do - for ac_exec_ext in '' $ac_executable_extensions; do - { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue - case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( - 'mkdir (GNU coreutils) '* | \ - 'mkdir (coreutils) '* | \ - 'mkdir (fileutils) '4.1*) - ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext - break 3;; - esac - done - done -done -IFS=$as_save_IFS - -fi - - if test "${ac_cv_path_mkdir+set}" = set; then - MKDIR_P="$ac_cv_path_mkdir -p" - else - # As a last resort, use the slow shell script. Don't cache a - # value for MKDIR_P within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the value is a relative name. - test -d ./--version && rmdir ./--version - MKDIR_P="$ac_install_sh -d" - fi -fi -{ echo "$as_me:$LINENO: result: $MKDIR_P" >&5 -echo "${ECHO_T}$MKDIR_P" >&6; } - -mkdir_p="$MKDIR_P" -case $mkdir_p in - [\\/$]* | ?:[\\/]*) ;; - */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; -esac - -for ac_prog in gawk mawk nawk awk -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_AWK+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$AWK"; then - ac_cv_prog_AWK="$AWK" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_AWK="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -AWK=$ac_cv_prog_AWK -if test -n "$AWK"; then - { echo "$as_me:$LINENO: result: $AWK" >&5 -echo "${ECHO_T}$AWK" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - - test -n "$AWK" && break -done - -{ echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 -echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6; } -set x ${MAKE-make}; ac_make=`echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` -if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.make <<\_ACEOF -SHELL = /bin/sh -all: - @echo '@@@%%%=$(MAKE)=@@@%%%' -_ACEOF -# GNU make sometimes prints "make[1]: Entering...", which would confuse us. -case `${MAKE-make} -f conftest.make 2>/dev/null` in - *@@@%%%=?*=@@@%%%*) - eval ac_cv_prog_make_${ac_make}_set=yes;; - *) - eval ac_cv_prog_make_${ac_make}_set=no;; -esac -rm -f conftest.make -fi -if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then - { echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6; } - SET_MAKE= -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } - SET_MAKE="MAKE=${MAKE-make}" -fi - -rm -rf .tst 2>/dev/null -mkdir .tst 2>/dev/null -if test -d .tst; then - am__leading_dot=. -else - am__leading_dot=_ -fi -rmdir .tst 2>/dev/null - -if test "`cd $srcdir && pwd`" != "`pwd`"; then - # Use -I$(srcdir) only when $(srcdir) != ., so that make's output - # is not polluted with repeated "-I." - am__isrc=' -I$(srcdir)' - # test to see if srcdir already configured - if test -f $srcdir/config.status; then - { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 -echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} - { (exit 1); exit 1; }; } - fi -fi - -# test whether we have cygpath -if test -z "$CYGPATH_W"; then - if (cygpath --version) >/dev/null 2>/dev/null; then - CYGPATH_W='cygpath -w' - else - CYGPATH_W=echo - fi -fi - - -# Define the identity of the package. - PACKAGE='silgraphite' - VERSION='2.3.1' - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE "$PACKAGE" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define VERSION "$VERSION" -_ACEOF - -# Some tools Automake needs. - -ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} - - -AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} - - -AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} - - -AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} - - -MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} - -install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"} - -# Installed binaries are usually stripped using `strip' when the user -# run `make install-strip'. However `strip' might not be the right -# tool to use in cross-compilation environments, therefore Automake -# will honor the `STRIP' environment variable to overrule this program. -if test "$cross_compiling" != no; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. -set dummy ${ac_tool_prefix}strip; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_STRIP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$STRIP"; then - ac_cv_prog_STRIP="$STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_STRIP="${ac_tool_prefix}strip" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -STRIP=$ac_cv_prog_STRIP -if test -n "$STRIP"; then - { echo "$as_me:$LINENO: result: $STRIP" >&5 -echo "${ECHO_T}$STRIP" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_STRIP"; then - ac_ct_STRIP=$STRIP - # Extract the first word of "strip", so it can be a program name with args. -set dummy strip; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_STRIP"; then - ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_STRIP="strip" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP -if test -n "$ac_ct_STRIP"; then - { echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 -echo "${ECHO_T}$ac_ct_STRIP" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - if test "x$ac_ct_STRIP" = x; then - STRIP=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&5 -echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&2;} -ac_tool_warned=yes ;; -esac - STRIP=$ac_ct_STRIP - fi -else - STRIP="$ac_cv_prog_STRIP" -fi - -fi -INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" - -# We need awk for the "check" target. The system "awk" is bad on -# some platforms. -# Always define AMTAR for backward compatibility. - -AMTAR=${AMTAR-"${am_missing_run}tar"} - -am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' - - - - - -{ echo "$as_me:$LINENO: checking whether to enable maintainer-specific portions of Makefiles" >&5 -echo $ECHO_N "checking whether to enable maintainer-specific portions of Makefiles... $ECHO_C" >&6; } - # Check whether --enable-maintainer-mode was given. -if test "${enable_maintainer_mode+set}" = set; then - enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval -else - USE_MAINTAINER_MODE=no -fi - - { echo "$as_me:$LINENO: result: $USE_MAINTAINER_MODE" >&5 -echo "${ECHO_T}$USE_MAINTAINER_MODE" >&6; } - if test $USE_MAINTAINER_MODE = yes; then - MAINTAINER_MODE_TRUE= - MAINTAINER_MODE_FALSE='#' -else - MAINTAINER_MODE_TRUE='#' - MAINTAINER_MODE_FALSE= -fi - - MAINT=$MAINTAINER_MODE_TRUE - - - -# System checks. -# Make sure we can run config.sub. -$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || - { { echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5 -echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;} - { (exit 1); exit 1; }; } - -{ echo "$as_me:$LINENO: checking build system type" >&5 -echo $ECHO_N "checking build system type... $ECHO_C" >&6; } -if test "${ac_cv_build+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_build_alias=$build_alias -test "x$ac_build_alias" = x && - ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` -test "x$ac_build_alias" = x && - { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 -echo "$as_me: error: cannot guess build type; you must specify one" >&2;} - { (exit 1); exit 1; }; } -ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || - { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5 -echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;} - { (exit 1); exit 1; }; } - -fi -{ echo "$as_me:$LINENO: result: $ac_cv_build" >&5 -echo "${ECHO_T}$ac_cv_build" >&6; } -case $ac_cv_build in -*-*-*) ;; -*) { { echo "$as_me:$LINENO: error: invalid value of canonical build" >&5 -echo "$as_me: error: invalid value of canonical build" >&2;} - { (exit 1); exit 1; }; };; -esac -build=$ac_cv_build -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_build -shift -build_cpu=$1 -build_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -build_os=$* -IFS=$ac_save_IFS -case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac - - -{ echo "$as_me:$LINENO: checking host system type" >&5 -echo $ECHO_N "checking host system type... $ECHO_C" >&6; } -if test "${ac_cv_host+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "x$host_alias" = x; then - ac_cv_host=$ac_cv_build -else - ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || - { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5 -echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;} - { (exit 1); exit 1; }; } -fi - -fi -{ echo "$as_me:$LINENO: result: $ac_cv_host" >&5 -echo "${ECHO_T}$ac_cv_host" >&6; } -case $ac_cv_host in -*-*-*) ;; -*) { { echo "$as_me:$LINENO: error: invalid value of canonical host" >&5 -echo "$as_me: error: invalid value of canonical host" >&2;} - { (exit 1); exit 1; }; };; -esac -host=$ac_cv_host -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_host -shift -host_cpu=$1 -host_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -host_os=$* -IFS=$ac_save_IFS -case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac - - -DEPDIR="${am__leading_dot}deps" - -ac_config_commands="$ac_config_commands depfiles" - - -am_make=${MAKE-make} -cat > confinc << 'END' -am__doit: - @echo done -.PHONY: am__doit -END -# If we don't find an include directive, just comment out the code. -{ echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 -echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6; } -am__include="#" -am__quote= -_am_result=none -# First try GNU make style include. -echo "include confinc" > confmf -# We grep out `Entering directory' and `Leaving directory' -# messages which can occur if `w' ends up in MAKEFLAGS. -# In particular we don't look at `^make:' because GNU make might -# be invoked under some other name (usually "gmake"), in which -# case it prints its new name instead of `make'. -if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then - am__include=include - am__quote= - _am_result=GNU -fi -# Now try BSD make style include. -if test "$am__include" = "#"; then - echo '.include "confinc"' > confmf - if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then - am__include=.include - am__quote="\"" - _am_result=BSD - fi -fi - - -{ echo "$as_me:$LINENO: result: $_am_result" >&5 -echo "${ECHO_T}$_am_result" >&6; } -rm -f confinc confmf - -# Check whether --enable-dependency-tracking was given. -if test "${enable_dependency_tracking+set}" = set; then - enableval=$enable_dependency_tracking; -fi - -if test "x$enable_dependency_tracking" != xno; then - am_depcomp="$ac_aux_dir/depcomp" - AMDEPBACKSLASH='\' -fi - if test "x$enable_dependency_tracking" != xno; then - AMDEP_TRUE= - AMDEP_FALSE='#' -else - AMDEP_TRUE='#' - AMDEP_FALSE= -fi - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. -set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CC="gcc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&5 -echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -else - CC="$ac_cv_prog_CC" -fi - -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. -set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="${ac_tool_prefix}cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - - fi -fi -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - ac_prog_rejected=no -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# != 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" - fi -fi -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl.exe - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - - test -n "$CC" && break - done -fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl.exe -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CC="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - - test -n "$ac_ct_CC" && break -done - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&5 -echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -fi - -fi - - -test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&5 -echo "$as_me: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } - -# Provide some information about the compiler. -echo "$as_me:$LINENO: checking for C compiler version" >&5 -ac_compiler=`set X $ac_compile; echo $2` -{ (ac_try="$ac_compiler --version >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compiler --version >&5") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (ac_try="$ac_compiler -v >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compiler -v >&5") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (ac_try="$ac_compiler -V >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compiler -V >&5") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.exe b.out" -# Try to create an executable without -o first, disregard a.out. -# It will help us diagnose broken compilers, and finding out an intuition -# of exeext. -{ echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 -echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6; } -ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` -# -# List of possible output files, starting from the most likely. -# The algorithm is not robust to junk in `.', hence go to wildcards (a.*) -# only as a last resort. b.out is created by i960 compilers. -ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out' -# -# The IRIX 6 linker writes into existing files which may not be -# executable, retaining their permissions. Remove them first so a -# subsequent execution test works. -ac_rmfiles= -for ac_file in $ac_files -do - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; - * ) ac_rmfiles="$ac_rmfiles $ac_file";; - esac -done -rm -f $ac_rmfiles - -if { (ac_try="$ac_link_default" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link_default") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. -# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' -# in a Makefile. We should not override ac_cv_exeext if it was cached, -# so that the user can short-circuit this test for compilers unknown to -# Autoconf. -for ac_file in $ac_files '' -do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) - ;; - [ab].out ) - # We found the default executable, but exeext='' is most - # certainly right. - break;; - *.* ) - if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; - then :; else - ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - fi - # We set ac_cv_exeext here because the later test for it is not - # safe: cross compilers may not add the suffix if given an `-o' - # argument, so we may need to know it at that point already. - # Even if this section looks crufty: it has the advantage of - # actually working. - break;; - * ) - break;; - esac -done -test "$ac_cv_exeext" = no && ac_cv_exeext= - -else - ac_file='' -fi - -{ echo "$as_me:$LINENO: result: $ac_file" >&5 -echo "${ECHO_T}$ac_file" >&6; } -if test -z "$ac_file"; then - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { echo "$as_me:$LINENO: error: C compiler cannot create executables -See \`config.log' for more details." >&5 -echo "$as_me: error: C compiler cannot create executables -See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; } -fi - -ac_exeext=$ac_cv_exeext - -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ echo "$as_me:$LINENO: checking whether the C compiler works" >&5 -echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6; } -# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 -# If not cross compiling, check that we can run a simple program. -if test "$cross_compiling" != yes; then - if { ac_try='./$ac_file' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { echo "$as_me:$LINENO: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } - fi - fi -fi -{ echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6; } - -rm -f a.out a.exe conftest$ac_cv_exeext b.out -ac_clean_files=$ac_clean_files_save -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 -echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6; } -{ echo "$as_me:$LINENO: result: $cross_compiling" >&5 -echo "${ECHO_T}$cross_compiling" >&6; } - -{ echo "$as_me:$LINENO: checking for suffix of executables" >&5 -echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; } -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # If both `conftest.exe' and `conftest' are `present' (well, observable) -# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will -# work properly (i.e., refer to `conftest.exe'), while it won't with -# `rm'. -for ac_file in conftest.exe conftest conftest.*; do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; - *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - break;; - * ) break;; - esac -done -else - { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi - -rm -f conftest$ac_cv_exeext -{ echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 -echo "${ECHO_T}$ac_cv_exeext" >&6; } - -rm -f conftest.$ac_ext -EXEEXT=$ac_cv_exeext -ac_exeext=$EXEEXT -{ echo "$as_me:$LINENO: checking for suffix of object files" >&5 -echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; } -if test "${ac_cv_objext+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.o conftest.obj -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - for ac_file in conftest.o conftest.obj conftest.*; do - test -f "$ac_file" || continue; - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;; - *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` - break;; - esac -done -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi - -rm -f conftest.$ac_cv_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 -echo "${ECHO_T}$ac_cv_objext" >&6; } -OBJEXT=$ac_cv_objext -ac_objext=$OBJEXT -{ echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 -echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; } -if test "${ac_cv_c_compiler_gnu+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_compiler_gnu=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_compiler_gnu=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - -fi -{ echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 -echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; } -GCC=`test $ac_compiler_gnu = yes && echo yes` -ac_test_CFLAGS=${CFLAGS+set} -ac_save_CFLAGS=$CFLAGS -{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 -echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; } -if test "${ac_cv_prog_cc_g+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_save_c_werror_flag=$ac_c_werror_flag - ac_c_werror_flag=yes - ac_cv_prog_cc_g=no - CFLAGS="-g" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_prog_cc_g=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - CFLAGS="" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_c_werror_flag=$ac_save_c_werror_flag - CFLAGS="-g" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_prog_cc_g=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_c_werror_flag=$ac_save_c_werror_flag -fi -{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; } -if test "$ac_test_CFLAGS" = set; then - CFLAGS=$ac_save_CFLAGS -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi -{ echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 -echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } -if test "${ac_cv_prog_cc_c89+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_prog_cc_c89=no -ac_save_CC=$CC -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -#include -#include -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; - -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) 'x' -int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; - -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} -_ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_prog_cc_c89=$ac_arg -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c89" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC - -fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { echo "$as_me:$LINENO: result: none needed" >&5 -echo "${ECHO_T}none needed" >&6; } ;; - xno) - { echo "$as_me:$LINENO: result: unsupported" >&5 -echo "${ECHO_T}unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; -esac - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -depcc="$CC" am_compiler_list= - -{ echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 -echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6; } -if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then - # We make a subdir and do the tests there. Otherwise we can end up - # making bogus files that we don't know about and never remove. For - # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named `D' -- because `-MD' means `put the output - # in D'. - mkdir conftest.dir - # Copy depcomp to subdir because otherwise we won't find it if we're - # using a relative directory. - cp "$am_depcomp" conftest.dir - cd conftest.dir - # We will build objects and dependencies in a subdirectory because - # it helps to detect inapplicable dependency modes. For instance - # both Tru64's cc and ICC support -MD to output dependencies as a - # side effect of compilation, but ICC will put the dependencies in - # the current directory while Tru64 will put them in the object - # directory. - mkdir sub - - am_cv_CC_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` - fi - for depmode in $am_compiler_list; do - # Setup a source with many dependencies, because some compilers - # like to wrap large dependency lists on column 80 (with \), and - # we should not choose a depcomp mode which is confused by this. - # - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. - : > sub/conftest.c - for i in 1 2 3 4 5 6; do - echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with - # Solaris 8's {/usr,}/bin/sh. - touch sub/conftst$i.h - done - echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - - case $depmode in - nosideeffect) - # after this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested - if test "x$enable_dependency_tracking" = xyes; then - continue - else - break - fi - ;; - none) break ;; - esac - # We check with `-c' and `-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle `-M -o', and we need to detect this. - if depmode=$depmode \ - source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ - depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ - $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ - >/dev/null 2>conftest.err && - grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - # icc doesn't choke on unknown options, it will just issue warnings - # or remarks (even with -Werror). So we grep stderr for any message - # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thusly: - # icc: Command line warning: ignoring option '-M'; no argument required - # The diagnosis changed in icc 8.0: - # icc: Command line remark: option '-MP' not supported - if (grep 'ignoring option' conftest.err || - grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else - am_cv_CC_dependencies_compiler_type=$depmode - break - fi - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_CC_dependencies_compiler_type=none -fi - -fi -{ echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 -echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6; } -CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type - - if - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then - am__fastdepCC_TRUE= - am__fastdepCC_FALSE='#' -else - am__fastdepCC_TRUE='#' - am__fastdepCC_FALSE= -fi - - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 -echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6; } -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then - if test "${ac_cv_prog_CPP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # Double quotes because CPP needs to be expanded - for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" - do - ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Broken: fails on valid input. -continue -fi - -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - # Broken: success on invalid input. -continue -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Passes both tests. -ac_preproc_ok=: -break -fi - -rm -f conftest.err conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then - break -fi - - done - ac_cv_prog_CPP=$CPP - -fi - CPP=$ac_cv_prog_CPP -else - ac_cv_prog_CPP=$CPP -fi -{ echo "$as_me:$LINENO: result: $CPP" >&5 -echo "${ECHO_T}$CPP" >&6; } -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Broken: fails on valid input. -continue -fi - -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - # Broken: success on invalid input. -continue -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Passes both tests. -ac_preproc_ok=: -break -fi - -rm -f conftest.err conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then - : -else - { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&5 -echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -{ echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5 -echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; } -if test "${ac_cv_path_GREP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # Extract the first word of "grep ggrep" to use in msg output -if test -z "$GREP"; then -set dummy grep ggrep; ac_prog_name=$2 -if test "${ac_cv_path_GREP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_path_GREP_found=false -# Loop through the user's path and test for each of PROGNAME-LIST -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in grep ggrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue - # Check for GNU ac_path_GREP and select it if it is found. - # Check for GNU $ac_path_GREP -case `"$ac_path_GREP" --version 2>&1` in -*GNU*) - ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; -*) - ac_count=0 - echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - echo 'GREP' >> "conftest.nl" - "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - ac_count=`expr $ac_count + 1` - if test $ac_count -gt ${ac_path_GREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_GREP="$ac_path_GREP" - ac_path_GREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - - $ac_path_GREP_found && break 3 - done -done - -done -IFS=$as_save_IFS - - -fi - -GREP="$ac_cv_path_GREP" -if test -z "$GREP"; then - { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 -echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} - { (exit 1); exit 1; }; } -fi - -else - ac_cv_path_GREP=$GREP -fi - - -fi -{ echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 -echo "${ECHO_T}$ac_cv_path_GREP" >&6; } - GREP="$ac_cv_path_GREP" - - -{ echo "$as_me:$LINENO: checking for egrep" >&5 -echo $ECHO_N "checking for egrep... $ECHO_C" >&6; } -if test "${ac_cv_path_EGREP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 - then ac_cv_path_EGREP="$GREP -E" - else - # Extract the first word of "egrep" to use in msg output -if test -z "$EGREP"; then -set dummy egrep; ac_prog_name=$2 -if test "${ac_cv_path_EGREP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_path_EGREP_found=false -# Loop through the user's path and test for each of PROGNAME-LIST -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in egrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue - # Check for GNU ac_path_EGREP and select it if it is found. - # Check for GNU $ac_path_EGREP -case `"$ac_path_EGREP" --version 2>&1` in -*GNU*) - ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; -*) - ac_count=0 - echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - echo 'EGREP' >> "conftest.nl" - "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - ac_count=`expr $ac_count + 1` - if test $ac_count -gt ${ac_path_EGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_EGREP="$ac_path_EGREP" - ac_path_EGREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - - $ac_path_EGREP_found && break 3 - done -done - -done -IFS=$as_save_IFS - - -fi - -EGREP="$ac_cv_path_EGREP" -if test -z "$EGREP"; then - { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 -echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} - { (exit 1); exit 1; }; } -fi - -else - ac_cv_path_EGREP=$EGREP -fi - - - fi -fi -{ echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 -echo "${ECHO_T}$ac_cv_path_EGREP" >&6; } - EGREP="$ac_cv_path_EGREP" - - -{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5 -echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; } -if test "${ac_cv_header_stdc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -#include -#include - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_header_stdc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_header_stdc=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then - : -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then - : -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then - : -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif - -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int -main () -{ - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - return 2; - return 0; -} -_ACEOF -rm -f conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -ac_cv_header_stdc=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi - - -fi -fi -{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 -echo "${ECHO_T}$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then - -cat >>confdefs.h <<\_ACEOF -#define STDC_HEADERS 1 -_ACEOF - -fi - -# On IRIX 5.3, sys/types and inttypes.h are conflicting. - - - - - - - - - -for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -{ echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default - -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - eval "$as_ac_Header=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - eval "$as_ac_Header=no" -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - -{ echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5 -echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6; } -if test "${ac_cv_c_bigendian+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # See if sys/param.h defines the BYTE_ORDER macro. -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include - -int -main () -{ -#if ! (defined BYTE_ORDER && defined BIG_ENDIAN && defined LITTLE_ENDIAN \ - && BYTE_ORDER && BIG_ENDIAN && LITTLE_ENDIAN) - bogus endian macros -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - # It does; now see whether it defined to BIG_ENDIAN or not. -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include - -int -main () -{ -#if BYTE_ORDER != BIG_ENDIAN - not big endian -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_c_bigendian=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_c_bigendian=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # It does not; compile a test program. -if test "$cross_compiling" = yes; then - # try to guess the endianness by grepping values into an object file - ac_cv_c_bigendian=unknown - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; -short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; -void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; } -short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; -short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; -void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; } -int -main () -{ - _ascii (); _ebcdic (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then - ac_cv_c_bigendian=yes -fi -if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then - if test "$ac_cv_c_bigendian" = unknown; then - ac_cv_c_bigendian=no - else - # finding both strings is unlikely to happen, but who knows? - ac_cv_c_bigendian=unknown - fi -fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ - - /* Are we little or big endian? From Harbison&Steele. */ - union - { - long int l; - char c[sizeof (long int)]; - } u; - u.l = 1; - return u.c[sizeof (long int) - 1] == 1; - - ; - return 0; -} -_ACEOF -rm -f conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_c_bigendian=no -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -ac_cv_c_bigendian=yes -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi - - -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5 -echo "${ECHO_T}$ac_cv_c_bigendian" >&6; } -case $ac_cv_c_bigendian in - yes) - -cat >>confdefs.h <<\_ACEOF -#define WORDS_BIGENDIAN 1 -_ACEOF - ;; - no) - ;; - *) - { { echo "$as_me:$LINENO: error: unknown endianness -presetting ac_cv_c_bigendian=no (or yes) will help" >&5 -echo "$as_me: error: unknown endianness -presetting ac_cv_c_bigendian=no (or yes) will help" >&2;} - { (exit 1); exit 1; }; } ;; -esac - - -# Optional features -# Check whether --enable-tracing was given. -if test "${enable_tracing+set}" = set; then - enableval=$enable_tracing; -fi - - test "x$enable_tracing" != xno && enable_tracing=yes - -# Check whether --enable-debug was given. -if test "${enable_debug+set}" = set; then - enableval=$enable_debug; -fi - -# Check whether --enable-final was given. -if test "${enable_final+set}" = set; then - enableval=$enable_final; -fi - - test "x$enable_final" != xno && enable_final=yes -# Check whether --enable-strict was given. -if test "${enable_strict+set}" = set; then - enableval=$enable_strict; -fi - - -# Check whether --enable-profile was given. -if test "${enable_profile+set}" = set; then - enableval=$enable_profile; -fi - -# Check whether --enable-profilefn was given. -if test "${enable_profilefn+set}" = set; then - enableval=$enable_profilefn; -fi - - -# Checks for programs. -# Find a good install program. We prefer a C program (faster), -# so one script is as good as another. But avoid the broken or -# incompatible versions: -# SysV /etc/install, /usr/sbin/install -# SunOS /usr/etc/install -# IRIX /sbin/install -# AIX /bin/install -# AmigaOS /C/install, which installs bootblocks on floppy discs -# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag -# AFS /usr/afsws/bin/install, which mishandles nonexistent args -# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" -# OS/2's system install, which has a completely different semantic -# ./install, which can be erroneously created by make from ./install.sh. -{ echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 -echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; } -if test -z "$INSTALL"; then -if test "${ac_cv_path_install+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - # Account for people who put trailing slashes in PATH elements. -case $as_dir/ in - ./ | .// | /cC/* | \ - /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ - ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ - /usr/ucb/* ) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - # Don't use installbsd from OSF since it installs stuff as root - # by default. - for ac_prog in ginstall scoinst install; do - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then - if test $ac_prog = install && - grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - : - elif test $ac_prog = install && - grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # program-specific install script used by HP pwplus--don't use. - : - else - ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" - break 3 - fi - fi - done - done - ;; -esac -done -IFS=$as_save_IFS - - -fi - if test "${ac_cv_path_install+set}" = set; then - INSTALL=$ac_cv_path_install - else - # As a last resort, use the slow shell script. Don't cache a - # value for INSTALL within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the value is a relative name. - INSTALL=$ac_install_sh - fi -fi -{ echo "$as_me:$LINENO: result: $INSTALL" >&5 -echo "${ECHO_T}$INSTALL" >&6; } - -# Use test -z because SunOS4 sh mishandles braces in ${var-val}. -# It thinks the first close brace ends the variable substitution. -test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' - -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' - -test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' - -case `pwd` in - *\ * | *\ *) - { echo "$as_me:$LINENO: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 -echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; -esac - - - -macro_version='2.2.4' -macro_revision='1.2976' - - - - - - - - - - - - - -ltmain="$ac_aux_dir/ltmain.sh" - -{ echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5 -echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6; } -if test "${ac_cv_path_SED+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ - for ac_i in 1 2 3 4 5 6 7; do - ac_script="$ac_script$as_nl$ac_script" - done - echo "$ac_script" | sed 99q >conftest.sed - $as_unset ac_script || ac_script= - # Extract the first word of "sed gsed" to use in msg output -if test -z "$SED"; then -set dummy sed gsed; ac_prog_name=$2 -if test "${ac_cv_path_SED+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_path_SED_found=false -# Loop through the user's path and test for each of PROGNAME-LIST -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in sed gsed; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue - # Check for GNU ac_path_SED and select it if it is found. - # Check for GNU $ac_path_SED -case `"$ac_path_SED" --version 2>&1` in -*GNU*) - ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; -*) - ac_count=0 - echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - echo '' >> "conftest.nl" - "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - ac_count=`expr $ac_count + 1` - if test $ac_count -gt ${ac_path_SED_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_SED="$ac_path_SED" - ac_path_SED_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - - $ac_path_SED_found && break 3 - done -done - -done -IFS=$as_save_IFS - - -fi - -SED="$ac_cv_path_SED" -if test -z "$SED"; then - { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in \$PATH" >&5 -echo "$as_me: error: no acceptable $ac_prog_name could be found in \$PATH" >&2;} - { (exit 1); exit 1; }; } -fi - -else - ac_cv_path_SED=$SED -fi - -fi -{ echo "$as_me:$LINENO: result: $ac_cv_path_SED" >&5 -echo "${ECHO_T}$ac_cv_path_SED" >&6; } - SED="$ac_cv_path_SED" - rm -f conftest.sed - -test -z "$SED" && SED=sed -Xsed="$SED -e 1s/^X//" - - - - - - - - - - - -{ echo "$as_me:$LINENO: checking for fgrep" >&5 -echo $ECHO_N "checking for fgrep... $ECHO_C" >&6; } -if test "${ac_cv_path_FGREP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 - then ac_cv_path_FGREP="$GREP -F" - else - # Extract the first word of "fgrep" to use in msg output -if test -z "$FGREP"; then -set dummy fgrep; ac_prog_name=$2 -if test "${ac_cv_path_FGREP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_path_FGREP_found=false -# Loop through the user's path and test for each of PROGNAME-LIST -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in fgrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue - # Check for GNU ac_path_FGREP and select it if it is found. - # Check for GNU $ac_path_FGREP -case `"$ac_path_FGREP" --version 2>&1` in -*GNU*) - ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; -*) - ac_count=0 - echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - echo 'FGREP' >> "conftest.nl" - "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - ac_count=`expr $ac_count + 1` - if test $ac_count -gt ${ac_path_FGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_FGREP="$ac_path_FGREP" - ac_path_FGREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - - $ac_path_FGREP_found && break 3 - done -done - -done -IFS=$as_save_IFS - - -fi - -FGREP="$ac_cv_path_FGREP" -if test -z "$FGREP"; then - { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 -echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} - { (exit 1); exit 1; }; } -fi - -else - ac_cv_path_FGREP=$FGREP -fi - - - fi -fi -{ echo "$as_me:$LINENO: result: $ac_cv_path_FGREP" >&5 -echo "${ECHO_T}$ac_cv_path_FGREP" >&6; } - FGREP="$ac_cv_path_FGREP" - - -test -z "$GREP" && GREP=grep - - - - - - - - - - - - - - - - - - - -# Check whether --with-gnu-ld was given. -if test "${with_gnu_ld+set}" = set; then - withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes -else - with_gnu_ld=no -fi - -ac_prog=ld -if test "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - { echo "$as_me:$LINENO: checking for ld used by $CC" >&5 -echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6; } - case $host in - *-*-mingw*) - # gcc leaves a trailing carriage return which upsets mingw - ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; - *) - ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; - esac - case $ac_prog in - # Accept absolute paths. - [\\/]* | ?:[\\/]*) - re_direlt='/[^/][^/]*/\.\./' - # Canonicalize the pathname of ld - ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` - while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do - ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` - done - test -z "$LD" && LD="$ac_prog" - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac -elif test "$with_gnu_ld" = yes; then - { echo "$as_me:$LINENO: checking for GNU ld" >&5 -echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6; } -else - { echo "$as_me:$LINENO: checking for non-GNU ld" >&5 -echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6; } -fi -if test "${lt_cv_path_LD+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -z "$LD"; then - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - lt_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some variants of GNU ld only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - case `"$lt_cv_path_LD" -v 2>&1 &5 -echo "${ECHO_T}$LD" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi -test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5 -echo "$as_me: error: no acceptable ld found in \$PATH" >&2;} - { (exit 1); exit 1; }; } -{ echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5 -echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6; } -if test "${lt_cv_prog_gnu_ld+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # I'd rather use --version here, but apparently some GNU lds only accept -v. -case `$LD -v 2>&1 &5 -echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6; } -with_gnu_ld=$lt_cv_prog_gnu_ld - - - - - - - - - -{ echo "$as_me:$LINENO: checking for BSD- or MS-compatible name lister (nm)" >&5 -echo $ECHO_N "checking for BSD- or MS-compatible name lister (nm)... $ECHO_C" >&6; } -if test "${lt_cv_path_NM+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$NM"; then - # Let the user override the test. - lt_cv_path_NM="$NM" -else - lt_nm_to_check="${ac_tool_prefix}nm" - if test -n "$ac_tool_prefix" && test "$build" = "$host"; then - lt_nm_to_check="$lt_nm_to_check nm" - fi - for lt_tmp_nm in $lt_nm_to_check; do - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - tmp_nm="$ac_dir/$lt_tmp_nm" - if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then - # Check to see if the nm accepts a BSD-compat flag. - # Adding the `sed 1q' prevents false positives on HP-UX, which says: - # nm: unknown option "B" ignored - # Tru64's nm complains that /dev/null is an invalid object file - case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in - */dev/null* | *'Invalid file or object type'*) - lt_cv_path_NM="$tmp_nm -B" - break - ;; - *) - case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in - */dev/null*) - lt_cv_path_NM="$tmp_nm -p" - break - ;; - *) - lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but - continue # so that we can try to find one that supports BSD flags - ;; - esac - ;; - esac - fi - done - IFS="$lt_save_ifs" - done - : ${lt_cv_path_NM=no} -fi -fi -{ echo "$as_me:$LINENO: result: $lt_cv_path_NM" >&5 -echo "${ECHO_T}$lt_cv_path_NM" >&6; } -if test "$lt_cv_path_NM" != "no"; then - NM="$lt_cv_path_NM" -else - # Didn't find any BSD compatible name lister, look for dumpbin. - if test -n "$ac_tool_prefix"; then - for ac_prog in "dumpbin -symbols" "link -dump -symbols" - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_DUMPBIN+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$DUMPBIN"; then - ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -DUMPBIN=$ac_cv_prog_DUMPBIN -if test -n "$DUMPBIN"; then - { echo "$as_me:$LINENO: result: $DUMPBIN" >&5 -echo "${ECHO_T}$DUMPBIN" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - - test -n "$DUMPBIN" && break - done -fi -if test -z "$DUMPBIN"; then - ac_ct_DUMPBIN=$DUMPBIN - for ac_prog in "dumpbin -symbols" "link -dump -symbols" -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_ac_ct_DUMPBIN+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_DUMPBIN"; then - ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN -if test -n "$ac_ct_DUMPBIN"; then - { echo "$as_me:$LINENO: result: $ac_ct_DUMPBIN" >&5 -echo "${ECHO_T}$ac_ct_DUMPBIN" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - - test -n "$ac_ct_DUMPBIN" && break -done - - if test "x$ac_ct_DUMPBIN" = x; then - DUMPBIN=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&5 -echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&2;} -ac_tool_warned=yes ;; -esac - DUMPBIN=$ac_ct_DUMPBIN - fi -fi - - - if test "$DUMPBIN" != ":"; then - NM="$DUMPBIN" - fi -fi -test -z "$NM" && NM=nm - - - - - - -{ echo "$as_me:$LINENO: checking the name lister ($NM) interface" >&5 -echo $ECHO_N "checking the name lister ($NM) interface... $ECHO_C" >&6; } -if test "${lt_cv_nm_interface+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_cv_nm_interface="BSD nm" - echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:5135: $ac_compile\"" >&5) - (eval "$ac_compile" 2>conftest.err) - cat conftest.err >&5 - (eval echo "\"\$as_me:5138: $NM \\\"conftest.$ac_objext\\\"\"" >&5) - (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) - cat conftest.err >&5 - (eval echo "\"\$as_me:5141: output\"" >&5) - cat conftest.out >&5 - if $GREP 'External.*some_variable' conftest.out > /dev/null; then - lt_cv_nm_interface="MS dumpbin" - fi - rm -f conftest* -fi -{ echo "$as_me:$LINENO: result: $lt_cv_nm_interface" >&5 -echo "${ECHO_T}$lt_cv_nm_interface" >&6; } - -{ echo "$as_me:$LINENO: checking whether ln -s works" >&5 -echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6; } -LN_S=$as_ln_s -if test "$LN_S" = "ln -s"; then - { echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6; } -else - { echo "$as_me:$LINENO: result: no, using $LN_S" >&5 -echo "${ECHO_T}no, using $LN_S" >&6; } -fi - -# find the maximum length of command line arguments -{ echo "$as_me:$LINENO: checking the maximum length of command line arguments" >&5 -echo $ECHO_N "checking the maximum length of command line arguments... $ECHO_C" >&6; } -if test "${lt_cv_sys_max_cmd_len+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - i=0 - teststring="ABCD" - - case $build_os in - msdosdjgpp*) - # On DJGPP, this test can blow up pretty badly due to problems in libc - # (any single argument exceeding 2000 bytes causes a buffer overrun - # during glob expansion). Even if it were fixed, the result of this - # check would be larger than it should be. - lt_cv_sys_max_cmd_len=12288; # 12K is about right - ;; - - gnu*) - # Under GNU Hurd, this test is not required because there is - # no limit to the length of command line arguments. - # Libtool will interpret -1 as no limit whatsoever - lt_cv_sys_max_cmd_len=-1; - ;; - - cygwin* | mingw*) - # On Win9x/ME, this test blows up -- it succeeds, but takes - # about 5 minutes as the teststring grows exponentially. - # Worse, since 9x/ME are not pre-emptively multitasking, - # you end up with a "frozen" computer, even though with patience - # the test eventually succeeds (with a max line length of 256k). - # Instead, let's just punt: use the minimum linelength reported by - # all of the supported platforms: 8192 (on NT/2K/XP). - lt_cv_sys_max_cmd_len=8192; - ;; - - amigaos*) - # On AmigaOS with pdksh, this test takes hours, literally. - # So we just punt and use a minimum line length of 8192. - lt_cv_sys_max_cmd_len=8192; - ;; - - netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) - # This has been around since 386BSD, at least. Likely further. - if test -x /sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` - elif test -x /usr/sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` - else - lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs - fi - # And add a safety zone - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` - ;; - - interix*) - # We know the value 262144 and hardcode it with a safety zone (like BSD) - lt_cv_sys_max_cmd_len=196608 - ;; - - osf*) - # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure - # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not - # nice to cause kernel panics so lets avoid the loop below. - # First set a reasonable default. - lt_cv_sys_max_cmd_len=16384 - # - if test -x /sbin/sysconfig; then - case `/sbin/sysconfig -q proc exec_disable_arg_limit` in - *1*) lt_cv_sys_max_cmd_len=-1 ;; - esac - fi - ;; - sco3.2v5*) - lt_cv_sys_max_cmd_len=102400 - ;; - sysv5* | sco5v6* | sysv4.2uw2*) - kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` - if test -n "$kargmax"; then - lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` - else - lt_cv_sys_max_cmd_len=32768 - fi - ;; - *) - lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` - if test -n "$lt_cv_sys_max_cmd_len"; then - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` - else - # Make teststring a little bigger before we do anything with it. - # a 1K string should be a reasonable start. - for i in 1 2 3 4 5 6 7 8 ; do - teststring=$teststring$teststring - done - SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} - # If test is not a shell built-in, we'll probably end up computing a - # maximum length that is only half of the actual maximum length, but - # we can't tell. - while { test "X"`$SHELL $0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \ - = "XX$teststring$teststring"; } >/dev/null 2>&1 && - test $i != 17 # 1/2 MB should be enough - do - i=`expr $i + 1` - teststring=$teststring$teststring - done - # Only check the string length outside the loop. - lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` - teststring= - # Add a significant safety factor because C++ compilers can tack on - # massive amounts of additional arguments before passing them to the - # linker. It appears as though 1/2 is a usable value. - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` - fi - ;; - esac - -fi - -if test -n $lt_cv_sys_max_cmd_len ; then - { echo "$as_me:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5 -echo "${ECHO_T}$lt_cv_sys_max_cmd_len" >&6; } -else - { echo "$as_me:$LINENO: result: none" >&5 -echo "${ECHO_T}none" >&6; } -fi -max_cmd_len=$lt_cv_sys_max_cmd_len - - - - - - -: ${CP="cp -f"} -: ${MV="mv -f"} -: ${RM="rm -f"} - -{ echo "$as_me:$LINENO: checking whether the shell understands some XSI constructs" >&5 -echo $ECHO_N "checking whether the shell understands some XSI constructs... $ECHO_C" >&6; } -# Try some XSI features -xsi_shell=no -( _lt_dummy="a/b/c" - test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \ - = c,a/b,, \ - && eval 'test $(( 1 + 1 )) -eq 2 \ - && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ - && xsi_shell=yes -{ echo "$as_me:$LINENO: result: $xsi_shell" >&5 -echo "${ECHO_T}$xsi_shell" >&6; } - - -{ echo "$as_me:$LINENO: checking whether the shell understands \"+=\"" >&5 -echo $ECHO_N "checking whether the shell understands \"+=\"... $ECHO_C" >&6; } -lt_shell_append=no -( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \ - >/dev/null 2>&1 \ - && lt_shell_append=yes -{ echo "$as_me:$LINENO: result: $lt_shell_append" >&5 -echo "${ECHO_T}$lt_shell_append" >&6; } - - -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - lt_unset=unset -else - lt_unset=false -fi - - - - - -# test EBCDIC or ASCII -case `echo X|tr X '\101'` in - A) # ASCII based system - # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr - lt_SP2NL='tr \040 \012' - lt_NL2SP='tr \015\012 \040\040' - ;; - *) # EBCDIC based system - lt_SP2NL='tr \100 \n' - lt_NL2SP='tr \r\n \100\100' - ;; -esac - - - - - - - - - -{ echo "$as_me:$LINENO: checking for $LD option to reload object files" >&5 -echo $ECHO_N "checking for $LD option to reload object files... $ECHO_C" >&6; } -if test "${lt_cv_ld_reload_flag+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_cv_ld_reload_flag='-r' -fi -{ echo "$as_me:$LINENO: result: $lt_cv_ld_reload_flag" >&5 -echo "${ECHO_T}$lt_cv_ld_reload_flag" >&6; } -reload_flag=$lt_cv_ld_reload_flag -case $reload_flag in -"" | " "*) ;; -*) reload_flag=" $reload_flag" ;; -esac -reload_cmds='$LD$reload_flag -o $output$reload_objs' -case $host_os in - darwin*) - if test "$GCC" = yes; then - reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' - else - reload_cmds='$LD$reload_flag -o $output$reload_objs' - fi - ;; -esac - - - - - - - - - - -{ echo "$as_me:$LINENO: checking how to recognize dependent libraries" >&5 -echo $ECHO_N "checking how to recognize dependent libraries... $ECHO_C" >&6; } -if test "${lt_cv_deplibs_check_method+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_cv_file_magic_cmd='$MAGIC_CMD' -lt_cv_file_magic_test_file= -lt_cv_deplibs_check_method='unknown' -# Need to set the preceding variable on all platforms that support -# interlibrary dependencies. -# 'none' -- dependencies not supported. -# `unknown' -- same as none, but documents that we really don't know. -# 'pass_all' -- all dependencies passed with no checks. -# 'test_compile' -- check by making test program. -# 'file_magic [[regex]]' -- check by looking for files in library path -# which responds to the $file_magic_cmd with a given extended regex. -# If you have `file' or equivalent on your system and you're not sure -# whether `pass_all' will *always* work, you probably want this one. - -case $host_os in -aix[4-9]*) - lt_cv_deplibs_check_method=pass_all - ;; - -beos*) - lt_cv_deplibs_check_method=pass_all - ;; - -bsdi[45]*) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' - lt_cv_file_magic_cmd='/usr/bin/file -L' - lt_cv_file_magic_test_file=/shlib/libc.so - ;; - -cygwin*) - # func_win32_libid is a shell function defined in ltmain.sh - lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' - lt_cv_file_magic_cmd='func_win32_libid' - ;; - -mingw* | pw32*) - # Base MSYS/MinGW do not provide the 'file' command needed by - # func_win32_libid shell function, so use a weaker test based on 'objdump', - # unless we find 'file', for example because we are cross-compiling. - if ( file / ) >/dev/null 2>&1; then - lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' - lt_cv_file_magic_cmd='func_win32_libid' - else - lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' - lt_cv_file_magic_cmd='$OBJDUMP -f' - fi - ;; - -darwin* | rhapsody*) - lt_cv_deplibs_check_method=pass_all - ;; - -freebsd* | dragonfly*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then - case $host_cpu in - i*86 ) - # Not sure whether the presence of OpenBSD here was a mistake. - # Let's accept both of them until this is cleared up. - lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` - ;; - esac - else - lt_cv_deplibs_check_method=pass_all - fi - ;; - -gnu*) - lt_cv_deplibs_check_method=pass_all - ;; - -hpux10.20* | hpux11*) - lt_cv_file_magic_cmd=/usr/bin/file - case $host_cpu in - ia64*) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' - lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so - ;; - hppa*64*) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]' - lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl - ;; - *) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library' - lt_cv_file_magic_test_file=/usr/lib/libc.sl - ;; - esac - ;; - -interix[3-9]*) - # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' - ;; - -irix5* | irix6* | nonstopux*) - case $LD in - *-32|*"-32 ") libmagic=32-bit;; - *-n32|*"-n32 ") libmagic=N32;; - *-64|*"-64 ") libmagic=64-bit;; - *) libmagic=never-match;; - esac - lt_cv_deplibs_check_method=pass_all - ;; - -# This must be Linux ELF. -linux* | k*bsd*-gnu) - lt_cv_deplibs_check_method=pass_all - ;; - -netbsd* | netbsdelf*-gnu) - if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' - fi - ;; - -newos6*) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=/usr/lib/libnls.so - ;; - -*nto* | *qnx*) - lt_cv_deplibs_check_method=pass_all - ;; - -openbsd*) - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' - fi - ;; - -osf3* | osf4* | osf5*) - lt_cv_deplibs_check_method=pass_all - ;; - -rdos*) - lt_cv_deplibs_check_method=pass_all - ;; - -solaris*) - lt_cv_deplibs_check_method=pass_all - ;; - -sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - lt_cv_deplibs_check_method=pass_all - ;; - -sysv4 | sysv4.3*) - case $host_vendor in - motorola) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` - ;; - ncr) - lt_cv_deplibs_check_method=pass_all - ;; - sequent) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' - ;; - sni) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" - lt_cv_file_magic_test_file=/lib/libc.so - ;; - siemens) - lt_cv_deplibs_check_method=pass_all - ;; - pc) - lt_cv_deplibs_check_method=pass_all - ;; - esac - ;; - -tpf*) - lt_cv_deplibs_check_method=pass_all - ;; -esac - -fi -{ echo "$as_me:$LINENO: result: $lt_cv_deplibs_check_method" >&5 -echo "${ECHO_T}$lt_cv_deplibs_check_method" >&6; } -file_magic_cmd=$lt_cv_file_magic_cmd -deplibs_check_method=$lt_cv_deplibs_check_method -test -z "$deplibs_check_method" && deplibs_check_method=unknown - - - - - - - - - - - - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. -set dummy ${ac_tool_prefix}ar; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_AR+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$AR"; then - ac_cv_prog_AR="$AR" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_AR="${ac_tool_prefix}ar" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -AR=$ac_cv_prog_AR -if test -n "$AR"; then - { echo "$as_me:$LINENO: result: $AR" >&5 -echo "${ECHO_T}$AR" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_AR"; then - ac_ct_AR=$AR - # Extract the first word of "ar", so it can be a program name with args. -set dummy ar; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_ac_ct_AR+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_AR"; then - ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_AR="ar" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -ac_ct_AR=$ac_cv_prog_ac_ct_AR -if test -n "$ac_ct_AR"; then - { echo "$as_me:$LINENO: result: $ac_ct_AR" >&5 -echo "${ECHO_T}$ac_ct_AR" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - if test "x$ac_ct_AR" = x; then - AR="false" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&5 -echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&2;} -ac_tool_warned=yes ;; -esac - AR=$ac_ct_AR - fi -else - AR="$ac_cv_prog_AR" -fi - -test -z "$AR" && AR=ar -test -z "$AR_FLAGS" && AR_FLAGS=cru - - - - - - - - - - - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. -set dummy ${ac_tool_prefix}strip; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_STRIP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$STRIP"; then - ac_cv_prog_STRIP="$STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_STRIP="${ac_tool_prefix}strip" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -STRIP=$ac_cv_prog_STRIP -if test -n "$STRIP"; then - { echo "$as_me:$LINENO: result: $STRIP" >&5 -echo "${ECHO_T}$STRIP" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_STRIP"; then - ac_ct_STRIP=$STRIP - # Extract the first word of "strip", so it can be a program name with args. -set dummy strip; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_STRIP"; then - ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_STRIP="strip" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP -if test -n "$ac_ct_STRIP"; then - { echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 -echo "${ECHO_T}$ac_ct_STRIP" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - if test "x$ac_ct_STRIP" = x; then - STRIP=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&5 -echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&2;} -ac_tool_warned=yes ;; -esac - STRIP=$ac_ct_STRIP - fi -else - STRIP="$ac_cv_prog_STRIP" -fi - -test -z "$STRIP" && STRIP=: - - - - - - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. -set dummy ${ac_tool_prefix}ranlib; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_RANLIB+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$RANLIB"; then - ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -RANLIB=$ac_cv_prog_RANLIB -if test -n "$RANLIB"; then - { echo "$as_me:$LINENO: result: $RANLIB" >&5 -echo "${ECHO_T}$RANLIB" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_RANLIB"; then - ac_ct_RANLIB=$RANLIB - # Extract the first word of "ranlib", so it can be a program name with args. -set dummy ranlib; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_RANLIB"; then - ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_RANLIB="ranlib" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB -if test -n "$ac_ct_RANLIB"; then - { echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 -echo "${ECHO_T}$ac_ct_RANLIB" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - if test "x$ac_ct_RANLIB" = x; then - RANLIB=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&5 -echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&2;} -ac_tool_warned=yes ;; -esac - RANLIB=$ac_ct_RANLIB - fi -else - RANLIB="$ac_cv_prog_RANLIB" -fi - -test -z "$RANLIB" && RANLIB=: - - - - - - -# Determine commands to create old-style static archives. -old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' -old_postinstall_cmds='chmod 644 $oldlib' -old_postuninstall_cmds= - -if test -n "$RANLIB"; then - case $host_os in - openbsd*) - old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" - ;; - *) - old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" - ;; - esac - old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" -fi - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# If no C compiler flags were specified, use CFLAGS. -LTCFLAGS=${LTCFLAGS-"$CFLAGS"} - -# Allow CC to be a program name with arguments. -compiler=$CC - - -# Check for command to grab the raw symbol name followed by C symbol from nm. -{ echo "$as_me:$LINENO: checking command to parse $NM output from $compiler object" >&5 -echo $ECHO_N "checking command to parse $NM output from $compiler object... $ECHO_C" >&6; } -if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - -# These are sane defaults that work on at least a few old systems. -# [They come from Ultrix. What could be older than Ultrix?!! ;)] - -# Character class describing NM global symbol codes. -symcode='[BCDEGRST]' - -# Regexp to match symbols that can be accessed directly from C. -sympat='\([_A-Za-z][_A-Za-z0-9]*\)' - -# Define system-specific variables. -case $host_os in -aix*) - symcode='[BCDT]' - ;; -cygwin* | mingw* | pw32*) - symcode='[ABCDGISTW]' - ;; -hpux*) - if test "$host_cpu" = ia64; then - symcode='[ABCDEGRST]' - fi - ;; -irix* | nonstopux*) - symcode='[BCDEGRST]' - ;; -osf*) - symcode='[BCDEGQRST]' - ;; -solaris*) - symcode='[BDRT]' - ;; -sco3.2v5*) - symcode='[DT]' - ;; -sysv4.2uw2*) - symcode='[DT]' - ;; -sysv5* | sco5v6* | unixware* | OpenUNIX*) - symcode='[ABDT]' - ;; -sysv4) - symcode='[DFNSTU]' - ;; -esac - -# If we're using GNU nm, then use its standard symbol codes. -case `$NM -V 2>&1` in -*GNU* | *'with BFD'*) - symcode='[ABCDGIRSTW]' ;; -esac - -# Transform an extracted symbol line into a proper C declaration. -# Some systems (esp. on ia64) link data and code symbols differently, -# so use this general approach. -lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" - -# Transform an extracted symbol line into symbol name and symbol address -lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'" -lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'" - -# Handle CRLF in mingw tool chain -opt_cr= -case $build_os in -mingw*) - opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp - ;; -esac - -# Try without a prefix underscore, then with it. -for ac_symprfx in "" "_"; do - - # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. - symxfrm="\\1 $ac_symprfx\\2 \\2" - - # Write the raw and C identifiers. - if test "$lt_cv_nm_interface" = "MS dumpbin"; then - # Fake it for dumpbin and say T for any non-static function - # and D for any global variable. - # Also find C++ and __fastcall symbols from MSVC++, - # which start with @ or ?. - lt_cv_sys_global_symbol_pipe="$AWK '"\ -" {last_section=section; section=\$ 3};"\ -" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ -" \$ 0!~/External *\|/{next};"\ -" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ -" {if(hide[section]) next};"\ -" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ -" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ -" s[1]~/^[@?]/{print s[1], s[1]; next};"\ -" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ -" ' prfx=^$ac_symprfx" - else - lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" - fi - - # Check to see that the pipe works correctly. - pipe_works=no - - rm -f conftest* - cat > conftest.$ac_ext <<_LT_EOF -#ifdef __cplusplus -extern "C" { -#endif -char nm_test_var; -void nm_test_func(void); -void nm_test_func(void){} -#ifdef __cplusplus -} -#endif -int main(){nm_test_var='a';nm_test_func();return(0);} -_LT_EOF - - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # Now try to grab the symbols. - nlist=conftest.nm - if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5 - (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && test -s "$nlist"; then - # Try sorting and uniquifying the output. - if sort "$nlist" | uniq > "$nlist"T; then - mv -f "$nlist"T "$nlist" - else - rm -f "$nlist"T - fi - - # Make sure that we snagged all the symbols we need. - if $GREP ' nm_test_var$' "$nlist" >/dev/null; then - if $GREP ' nm_test_func$' "$nlist" >/dev/null; then - cat <<_LT_EOF > conftest.$ac_ext -#ifdef __cplusplus -extern "C" { -#endif - -_LT_EOF - # Now generate the symbol file. - eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' - - cat <<_LT_EOF >> conftest.$ac_ext - -/* The mapping between symbol names and symbols. */ -const struct { - const char *name; - void *address; -} -lt__PROGRAM__LTX_preloaded_symbols[] = -{ - { "@PROGRAM@", (void *) 0 }, -_LT_EOF - $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext - cat <<\_LT_EOF >> conftest.$ac_ext - {0, (void *) 0} -}; - -/* This works around a problem in FreeBSD linker */ -#ifdef FREEBSD_WORKAROUND -static const void *lt_preloaded_setup() { - return lt__PROGRAM__LTX_preloaded_symbols; -} -#endif - -#ifdef __cplusplus -} -#endif -_LT_EOF - # Now try linking the two files. - mv conftest.$ac_objext conftstm.$ac_objext - lt_save_LIBS="$LIBS" - lt_save_CFLAGS="$CFLAGS" - LIBS="conftstm.$ac_objext" - CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" - if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && test -s conftest${ac_exeext}; then - pipe_works=yes - fi - LIBS="$lt_save_LIBS" - CFLAGS="$lt_save_CFLAGS" - else - echo "cannot find nm_test_func in $nlist" >&5 - fi - else - echo "cannot find nm_test_var in $nlist" >&5 - fi - else - echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 - fi - else - echo "$progname: failed program was:" >&5 - cat conftest.$ac_ext >&5 - fi - rm -rf conftest* conftst* - - # Do not use the global_symbol_pipe unless it works. - if test "$pipe_works" = yes; then - break - else - lt_cv_sys_global_symbol_pipe= - fi -done - -fi - -if test -z "$lt_cv_sys_global_symbol_pipe"; then - lt_cv_sys_global_symbol_to_cdecl= -fi -if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then - { echo "$as_me:$LINENO: result: failed" >&5 -echo "${ECHO_T}failed" >&6; } -else - { echo "$as_me:$LINENO: result: ok" >&5 -echo "${ECHO_T}ok" >&6; } -fi - - - - - - - - - - - - - - - - - - - - - - -# Check whether --enable-libtool-lock was given. -if test "${enable_libtool_lock+set}" = set; then - enableval=$enable_libtool_lock; -fi - -test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes - -# Some flags need to be propagated to the compiler or linker for good -# libtool support. -case $host in -ia64-*-hpux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - case `/usr/bin/file conftest.$ac_objext` in - *ELF-32*) - HPUX_IA64_MODE="32" - ;; - *ELF-64*) - HPUX_IA64_MODE="64" - ;; - esac - fi - rm -rf conftest* - ;; -*-*-irix6*) - # Find out which ABI we are using. - echo '#line 6251 "configure"' > conftest.$ac_ext - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - if test "$lt_cv_prog_gnu_ld" = yes; then - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -melf32bsmip" - ;; - *N32*) - LD="${LD-ld} -melf32bmipn32" - ;; - *64-bit*) - LD="${LD-ld} -melf64bmip" - ;; - esac - else - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -32" - ;; - *N32*) - LD="${LD-ld} -n32" - ;; - *64-bit*) - LD="${LD-ld} -64" - ;; - esac - fi - fi - rm -rf conftest* - ;; - -x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ -s390*-*linux*|s390*-*tpf*|sparc*-*linux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - case `/usr/bin/file conftest.o` in - *32-bit*) - case $host in - x86_64-*kfreebsd*-gnu) - LD="${LD-ld} -m elf_i386_fbsd" - ;; - x86_64-*linux*) - LD="${LD-ld} -m elf_i386" - ;; - ppc64-*linux*|powerpc64-*linux*) - LD="${LD-ld} -m elf32ppclinux" - ;; - s390x-*linux*) - LD="${LD-ld} -m elf_s390" - ;; - sparc64-*linux*) - LD="${LD-ld} -m elf32_sparc" - ;; - esac - ;; - *64-bit*) - case $host in - x86_64-*kfreebsd*-gnu) - LD="${LD-ld} -m elf_x86_64_fbsd" - ;; - x86_64-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; - ppc*-*linux*|powerpc*-*linux*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*|s390*-*tpf*) - LD="${LD-ld} -m elf64_s390" - ;; - sparc*-*linux*) - LD="${LD-ld} -m elf64_sparc" - ;; - esac - ;; - esac - fi - rm -rf conftest* - ;; - -*-*-sco3.2v5*) - # On SCO OpenServer 5, we need -belf to get full-featured binaries. - SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -belf" - { echo "$as_me:$LINENO: checking whether the C compiler needs -belf" >&5 -echo $ECHO_N "checking whether the C compiler needs -belf... $ECHO_C" >&6; } -if test "${lt_cv_cc_needs_belf+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - lt_cv_cc_needs_belf=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - lt_cv_cc_needs_belf=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -fi -{ echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5 -echo "${ECHO_T}$lt_cv_cc_needs_belf" >&6; } - if test x"$lt_cv_cc_needs_belf" != x"yes"; then - # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf - CFLAGS="$SAVE_CFLAGS" - fi - ;; -sparc*-*solaris*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - case `/usr/bin/file conftest.o` in - *64-bit*) - case $lt_cv_prog_gnu_ld in - yes*) LD="${LD-ld} -m elf64_sparc" ;; - *) - if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then - LD="${LD-ld} -64" - fi - ;; - esac - ;; - esac - fi - rm -rf conftest* - ;; -esac - -need_locks="$enable_libtool_lock" - - - case $host_os in - rhapsody* | darwin*) - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. -set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_DSYMUTIL+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$DSYMUTIL"; then - ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -DSYMUTIL=$ac_cv_prog_DSYMUTIL -if test -n "$DSYMUTIL"; then - { echo "$as_me:$LINENO: result: $DSYMUTIL" >&5 -echo "${ECHO_T}$DSYMUTIL" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_DSYMUTIL"; then - ac_ct_DSYMUTIL=$DSYMUTIL - # Extract the first word of "dsymutil", so it can be a program name with args. -set dummy dsymutil; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_ac_ct_DSYMUTIL+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_DSYMUTIL"; then - ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL -if test -n "$ac_ct_DSYMUTIL"; then - { echo "$as_me:$LINENO: result: $ac_ct_DSYMUTIL" >&5 -echo "${ECHO_T}$ac_ct_DSYMUTIL" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - if test "x$ac_ct_DSYMUTIL" = x; then - DSYMUTIL=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&5 -echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&2;} -ac_tool_warned=yes ;; -esac - DSYMUTIL=$ac_ct_DSYMUTIL - fi -else - DSYMUTIL="$ac_cv_prog_DSYMUTIL" -fi - - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. -set dummy ${ac_tool_prefix}nmedit; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_NMEDIT+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$NMEDIT"; then - ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -NMEDIT=$ac_cv_prog_NMEDIT -if test -n "$NMEDIT"; then - { echo "$as_me:$LINENO: result: $NMEDIT" >&5 -echo "${ECHO_T}$NMEDIT" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_NMEDIT"; then - ac_ct_NMEDIT=$NMEDIT - # Extract the first word of "nmedit", so it can be a program name with args. -set dummy nmedit; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_ac_ct_NMEDIT+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_NMEDIT"; then - ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_NMEDIT="nmedit" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT -if test -n "$ac_ct_NMEDIT"; then - { echo "$as_me:$LINENO: result: $ac_ct_NMEDIT" >&5 -echo "${ECHO_T}$ac_ct_NMEDIT" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - if test "x$ac_ct_NMEDIT" = x; then - NMEDIT=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&5 -echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&2;} -ac_tool_warned=yes ;; -esac - NMEDIT=$ac_ct_NMEDIT - fi -else - NMEDIT="$ac_cv_prog_NMEDIT" -fi - - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. -set dummy ${ac_tool_prefix}lipo; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_LIPO+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$LIPO"; then - ac_cv_prog_LIPO="$LIPO" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_LIPO="${ac_tool_prefix}lipo" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -LIPO=$ac_cv_prog_LIPO -if test -n "$LIPO"; then - { echo "$as_me:$LINENO: result: $LIPO" >&5 -echo "${ECHO_T}$LIPO" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_LIPO"; then - ac_ct_LIPO=$LIPO - # Extract the first word of "lipo", so it can be a program name with args. -set dummy lipo; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_ac_ct_LIPO+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_LIPO"; then - ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_LIPO="lipo" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO -if test -n "$ac_ct_LIPO"; then - { echo "$as_me:$LINENO: result: $ac_ct_LIPO" >&5 -echo "${ECHO_T}$ac_ct_LIPO" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - if test "x$ac_ct_LIPO" = x; then - LIPO=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&5 -echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&2;} -ac_tool_warned=yes ;; -esac - LIPO=$ac_ct_LIPO - fi -else - LIPO="$ac_cv_prog_LIPO" -fi - - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. -set dummy ${ac_tool_prefix}otool; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_OTOOL+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$OTOOL"; then - ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_OTOOL="${ac_tool_prefix}otool" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -OTOOL=$ac_cv_prog_OTOOL -if test -n "$OTOOL"; then - { echo "$as_me:$LINENO: result: $OTOOL" >&5 -echo "${ECHO_T}$OTOOL" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_OTOOL"; then - ac_ct_OTOOL=$OTOOL - # Extract the first word of "otool", so it can be a program name with args. -set dummy otool; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_ac_ct_OTOOL+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_OTOOL"; then - ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_OTOOL="otool" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL -if test -n "$ac_ct_OTOOL"; then - { echo "$as_me:$LINENO: result: $ac_ct_OTOOL" >&5 -echo "${ECHO_T}$ac_ct_OTOOL" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - if test "x$ac_ct_OTOOL" = x; then - OTOOL=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&5 -echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&2;} -ac_tool_warned=yes ;; -esac - OTOOL=$ac_ct_OTOOL - fi -else - OTOOL="$ac_cv_prog_OTOOL" -fi - - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. -set dummy ${ac_tool_prefix}otool64; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_OTOOL64+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$OTOOL64"; then - ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -OTOOL64=$ac_cv_prog_OTOOL64 -if test -n "$OTOOL64"; then - { echo "$as_me:$LINENO: result: $OTOOL64" >&5 -echo "${ECHO_T}$OTOOL64" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_OTOOL64"; then - ac_ct_OTOOL64=$OTOOL64 - # Extract the first word of "otool64", so it can be a program name with args. -set dummy otool64; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_ac_ct_OTOOL64+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_OTOOL64"; then - ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_OTOOL64="otool64" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 -if test -n "$ac_ct_OTOOL64"; then - { echo "$as_me:$LINENO: result: $ac_ct_OTOOL64" >&5 -echo "${ECHO_T}$ac_ct_OTOOL64" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - if test "x$ac_ct_OTOOL64" = x; then - OTOOL64=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&5 -echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&2;} -ac_tool_warned=yes ;; -esac - OTOOL64=$ac_ct_OTOOL64 - fi -else - OTOOL64="$ac_cv_prog_OTOOL64" -fi - - - - - - - - - - - - - - - - - - - - - - - - - - - - { echo "$as_me:$LINENO: checking for -single_module linker flag" >&5 -echo $ECHO_N "checking for -single_module linker flag... $ECHO_C" >&6; } -if test "${lt_cv_apple_cc_single_mod+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_cv_apple_cc_single_mod=no - if test -z "${LT_MULTI_MODULE}"; then - # By default we will add the -single_module flag. You can override - # by either setting the environment variable LT_MULTI_MODULE - # non-empty at configure time, or by adding -multi_module to the - # link flags. - rm -rf libconftest.dylib* - echo "int foo(void){return 1;}" > conftest.c - echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ --dynamiclib -Wl,-single_module conftest.c" >&5 - $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ - -dynamiclib -Wl,-single_module conftest.c 2>conftest.err - _lt_result=$? - if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then - lt_cv_apple_cc_single_mod=yes - else - cat conftest.err >&5 - fi - rm -rf libconftest.dylib* - rm -f conftest.* - fi -fi -{ echo "$as_me:$LINENO: result: $lt_cv_apple_cc_single_mod" >&5 -echo "${ECHO_T}$lt_cv_apple_cc_single_mod" >&6; } - { echo "$as_me:$LINENO: checking for -exported_symbols_list linker flag" >&5 -echo $ECHO_N "checking for -exported_symbols_list linker flag... $ECHO_C" >&6; } -if test "${lt_cv_ld_exported_symbols_list+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_cv_ld_exported_symbols_list=no - save_LDFLAGS=$LDFLAGS - echo "_main" > conftest.sym - LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - lt_cv_ld_exported_symbols_list=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - lt_cv_ld_exported_symbols_list=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext - LDFLAGS="$save_LDFLAGS" - -fi -{ echo "$as_me:$LINENO: result: $lt_cv_ld_exported_symbols_list" >&5 -echo "${ECHO_T}$lt_cv_ld_exported_symbols_list" >&6; } - case $host_os in - rhapsody* | darwin1.[012]) - _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; - darwin1.*) - _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; - darwin*) # darwin 5.x on - # if running on 10.5 or later, the deployment target defaults - # to the OS version, if on x86, and 10.4, the deployment - # target defaults to 10.4. Don't you love it? - case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in - 10.0,*86*-darwin8*|10.0,*-darwin[91]*) - _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; - 10.[012]*) - _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; - 10.*) - _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; - esac - ;; - esac - if test "$lt_cv_apple_cc_single_mod" = "yes"; then - _lt_dar_single_mod='$single_module' - fi - if test "$lt_cv_ld_exported_symbols_list" = "yes"; then - _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' - else - _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - if test "$DSYMUTIL" != ":"; then - _lt_dsymutil='~$DSYMUTIL $lib || :' - else - _lt_dsymutil= - fi - ;; - esac - - -for ac_header in dlfcn.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -{ echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default - -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - eval "$as_ac_Header=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - eval "$as_ac_Header=no" -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - - -# Set options - - - - enable_dlopen=no - - - enable_win32_dll=no - - - # Check whether --enable-shared was given. -if test "${enable_shared+set}" = set; then - enableval=$enable_shared; p=${PACKAGE-default} - case $enableval in - yes) enable_shared=yes ;; - no) enable_shared=no ;; - *) - enable_shared=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_shared=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac -else - enable_shared=yes -fi - - - - - - - - - - # Check whether --enable-static was given. -if test "${enable_static+set}" = set; then - enableval=$enable_static; p=${PACKAGE-default} - case $enableval in - yes) enable_static=yes ;; - no) enable_static=no ;; - *) - enable_static=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_static=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac -else - enable_static=yes -fi - - - - - - - - - - -# Check whether --with-pic was given. -if test "${with_pic+set}" = set; then - withval=$with_pic; pic_mode="$withval" -else - pic_mode=default -fi - - -test -z "$pic_mode" && pic_mode=default - - - - - - - - # Check whether --enable-fast-install was given. -if test "${enable_fast_install+set}" = set; then - enableval=$enable_fast_install; p=${PACKAGE-default} - case $enableval in - yes) enable_fast_install=yes ;; - no) enable_fast_install=no ;; - *) - enable_fast_install=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_fast_install=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac -else - enable_fast_install=yes -fi - - - - - - - - - - - -# This can be used to rebuild libtool when needed -LIBTOOL_DEPS="$ltmain" - -# Always use our own libtool. -LIBTOOL='$(SHELL) $(top_builddir)/libtool' - - - - - - - - - - - - - - - - - - - - - - - - - -test -z "$LN_S" && LN_S="ln -s" - - - - - - - - - - - - - - -if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST -fi - -{ echo "$as_me:$LINENO: checking for objdir" >&5 -echo $ECHO_N "checking for objdir... $ECHO_C" >&6; } -if test "${lt_cv_objdir+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - rm -f .libs 2>/dev/null -mkdir .libs 2>/dev/null -if test -d .libs; then - lt_cv_objdir=.libs -else - # MS-DOS does not allow filenames that begin with a dot. - lt_cv_objdir=_libs -fi -rmdir .libs 2>/dev/null -fi -{ echo "$as_me:$LINENO: result: $lt_cv_objdir" >&5 -echo "${ECHO_T}$lt_cv_objdir" >&6; } -objdir=$lt_cv_objdir - - - - - -cat >>confdefs.h <<_ACEOF -#define LT_OBJDIR "$lt_cv_objdir/" -_ACEOF - - - - - - - - - - - - - - - - - -case $host_os in -aix3*) - # AIX sometimes has problems with the GCC collect2 program. For some - # reason, if we set the COLLECT_NAMES environment variable, the problems - # vanish in a puff of smoke. - if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES - fi - ;; -esac - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -sed_quote_subst='s/\(["`$\\]\)/\\\1/g' - -# Same as above, but do not quote variable references. -double_quote_subst='s/\(["`\\]\)/\\\1/g' - -# Sed substitution to delay expansion of an escaped shell variable in a -# double_quote_subst'ed string. -delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' - -# Sed substitution to delay expansion of an escaped single quote. -delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' - -# Sed substitution to avoid accidental globbing in evaled expressions -no_glob_subst='s/\*/\\\*/g' - -# Global variables: -ofile=libtool -can_build_shared=yes - -# All known linkers require a `.a' archive for static linking (except MSVC, -# which needs '.lib'). -libext=a - -with_gnu_ld="$lt_cv_prog_gnu_ld" - -old_CC="$CC" -old_CFLAGS="$CFLAGS" - -# Set sane defaults for various variables -test -z "$CC" && CC=cc -test -z "$LTCC" && LTCC=$CC -test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS -test -z "$LD" && LD=ld -test -z "$ac_objext" && ac_objext=o - -for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` - - -# Only perform the check for file, if the check method requires it -test -z "$MAGIC_CMD" && MAGIC_CMD=file -case $deplibs_check_method in -file_magic*) - if test "$file_magic_cmd" = '$MAGIC_CMD'; then - { echo "$as_me:$LINENO: checking for ${ac_tool_prefix}file" >&5 -echo $ECHO_N "checking for ${ac_tool_prefix}file... $ECHO_C" >&6; } -if test "${lt_cv_path_MAGIC_CMD+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case $MAGIC_CMD in -[\\/*] | ?:[\\/]*) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. - ;; -*) - lt_save_MAGIC_CMD="$MAGIC_CMD" - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" - for ac_dir in $ac_dummy; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/${ac_tool_prefix}file; then - lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" - if test -n "$file_magic_test_file"; then - case $deplibs_check_method in - "file_magic "*) - file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` - MAGIC_CMD="$lt_cv_path_MAGIC_CMD" - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - $EGREP "$file_magic_regex" > /dev/null; then - : - else - cat <<_LT_EOF 1>&2 - -*** Warning: the command libtool uses to detect shared libraries, -*** $file_magic_cmd, produces output that libtool cannot recognize. -*** The result is that libtool may fail to recognize shared libraries -*** as such. This will affect the creation of libtool libraries that -*** depend on shared libraries, but programs linked with such libtool -*** libraries will work regardless of this problem. Nevertheless, you -*** may want to report the problem to your system manager and/or to -*** bug-libtool@gnu.org - -_LT_EOF - fi ;; - esac - fi - break - fi - done - IFS="$lt_save_ifs" - MAGIC_CMD="$lt_save_MAGIC_CMD" - ;; -esac -fi - -MAGIC_CMD="$lt_cv_path_MAGIC_CMD" -if test -n "$MAGIC_CMD"; then - { echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5 -echo "${ECHO_T}$MAGIC_CMD" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - - - - -if test -z "$lt_cv_path_MAGIC_CMD"; then - if test -n "$ac_tool_prefix"; then - { echo "$as_me:$LINENO: checking for file" >&5 -echo $ECHO_N "checking for file... $ECHO_C" >&6; } -if test "${lt_cv_path_MAGIC_CMD+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case $MAGIC_CMD in -[\\/*] | ?:[\\/]*) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. - ;; -*) - lt_save_MAGIC_CMD="$MAGIC_CMD" - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" - for ac_dir in $ac_dummy; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/file; then - lt_cv_path_MAGIC_CMD="$ac_dir/file" - if test -n "$file_magic_test_file"; then - case $deplibs_check_method in - "file_magic "*) - file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` - MAGIC_CMD="$lt_cv_path_MAGIC_CMD" - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - $EGREP "$file_magic_regex" > /dev/null; then - : - else - cat <<_LT_EOF 1>&2 - -*** Warning: the command libtool uses to detect shared libraries, -*** $file_magic_cmd, produces output that libtool cannot recognize. -*** The result is that libtool may fail to recognize shared libraries -*** as such. This will affect the creation of libtool libraries that -*** depend on shared libraries, but programs linked with such libtool -*** libraries will work regardless of this problem. Nevertheless, you -*** may want to report the problem to your system manager and/or to -*** bug-libtool@gnu.org - -_LT_EOF - fi ;; - esac - fi - break - fi - done - IFS="$lt_save_ifs" - MAGIC_CMD="$lt_save_MAGIC_CMD" - ;; -esac -fi - -MAGIC_CMD="$lt_cv_path_MAGIC_CMD" -if test -n "$MAGIC_CMD"; then - { echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5 -echo "${ECHO_T}$MAGIC_CMD" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - - else - MAGIC_CMD=: - fi -fi - - fi - ;; -esac - -# Use C for the default configuration in the libtool script - -lt_save_CC="$CC" -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -# Source file extension for C test sources. -ac_ext=c - -# Object file extension for compiled C test sources. -objext=o -objext=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;" - -# Code to be used in simple link tests -lt_simple_link_test_code='int main(){return(0);}' - - - - - - - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# If no C compiler flags were specified, use CFLAGS. -LTCFLAGS=${LTCFLAGS-"$CFLAGS"} - -# Allow CC to be a program name with arguments. -compiler=$CC - -# Save the default compiler, since it gets overwritten when the other -# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. -compiler_DEFAULT=$CC - -# save warnings/boilerplate of simple test code -ac_outfile=conftest.$ac_objext -echo "$lt_simple_compile_test_code" >conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$RM conftest* - -ac_outfile=conftest.$ac_objext -echo "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$RM -r conftest* - - -if test -n "$compiler"; then - -lt_prog_compiler_no_builtin_flag= - -if test "$GCC" = yes; then - lt_prog_compiler_no_builtin_flag=' -fno-builtin' - - { echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 -echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6; } -if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_cv_prog_compiler_rtti_exceptions=no - ac_outfile=conftest.$ac_objext - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="-fno-rtti -fno-exceptions" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7624: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:7628: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then - lt_cv_prog_compiler_rtti_exceptions=yes - fi - fi - $RM conftest* - -fi -{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 -echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6; } - -if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then - lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" -else - : -fi - -fi - - - - - - - lt_prog_compiler_wl= -lt_prog_compiler_pic= -lt_prog_compiler_static= - -{ echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 -echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; } - - if test "$GCC" = yes; then - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_static='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static='-Bstatic' - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - lt_prog_compiler_pic='-fPIC' - ;; - m68k) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' - ;; - esac - ;; - - beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - - mingw* | cygwin* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - # Although the cygwin gcc ignores -fPIC, still need this for old-style - # (--disable-auto-import) libraries - lt_prog_compiler_pic='-DDLL_EXPORT' - ;; - - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - lt_prog_compiler_pic='-fno-common' - ;; - - hpux*) - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case $host_cpu in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic='-fPIC' - ;; - esac - ;; - - interix[3-9]*) - # Interix 3.x gcc -fpic/-fPIC options generate broken code. - # Instead, we relocate shared libraries at runtime. - ;; - - msdosdjgpp*) - # Just because we use GCC doesn't mean we suddenly get shared libraries - # on systems that don't support them. - lt_prog_compiler_can_build_shared=no - enable_shared=no - ;; - - *nto* | *qnx*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - lt_prog_compiler_pic='-fPIC -shared' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - lt_prog_compiler_pic=-Kconform_pic - fi - ;; - - *) - lt_prog_compiler_pic='-fPIC' - ;; - esac - else - # PORTME Check for flag to pass linker flags through the system compiler. - case $host_os in - aix*) - lt_prog_compiler_wl='-Wl,' - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static='-Bstatic' - else - lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' - fi - ;; - - mingw* | cygwin* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_prog_compiler_pic='-DDLL_EXPORT' - ;; - - hpux9* | hpux10* | hpux11*) - lt_prog_compiler_wl='-Wl,' - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case $host_cpu in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic='+Z' - ;; - esac - # Is there a better lt_prog_compiler_static that works with the bundled CC? - lt_prog_compiler_static='${wl}-a ${wl}archive' - ;; - - irix5* | irix6* | nonstopux*) - lt_prog_compiler_wl='-Wl,' - # PIC (with -KPIC) is the default. - lt_prog_compiler_static='-non_shared' - ;; - - linux* | k*bsd*-gnu) - case $cc_basename in - icc* | ecc* | ifort*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-static' - ;; - pgcc* | pgf77* | pgf90* | pgf95*) - # Portland Group compilers (*not* the Pentium gcc compiler, - # which looks to be a dead project) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-fpic' - lt_prog_compiler_static='-Bstatic' - ;; - ccc*) - lt_prog_compiler_wl='-Wl,' - # All Alpha code is PIC. - lt_prog_compiler_static='-non_shared' - ;; - xl*) - # IBM XL C 8.0/Fortran 10.1 on PPC - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-qpic' - lt_prog_compiler_static='-qstaticlink' - ;; - *) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) - # Sun C 5.9 - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - lt_prog_compiler_wl='-Wl,' - ;; - *Sun\ F*) - # Sun Fortran 8.3 passes all unrecognized flags to the linker - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - lt_prog_compiler_wl='' - ;; - esac - ;; - esac - ;; - - newsos6) - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - ;; - - *nto* | *qnx*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - lt_prog_compiler_pic='-fPIC -shared' - ;; - - osf3* | osf4* | osf5*) - lt_prog_compiler_wl='-Wl,' - # All OSF/1 code is PIC. - lt_prog_compiler_static='-non_shared' - ;; - - rdos*) - lt_prog_compiler_static='-non_shared' - ;; - - solaris*) - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - case $cc_basename in - f77* | f90* | f95*) - lt_prog_compiler_wl='-Qoption ld ';; - *) - lt_prog_compiler_wl='-Wl,';; - esac - ;; - - sunos4*) - lt_prog_compiler_wl='-Qoption ld ' - lt_prog_compiler_pic='-PIC' - lt_prog_compiler_static='-Bstatic' - ;; - - sysv4 | sysv4.2uw2* | sysv4.3*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - ;; - - sysv4*MP*) - if test -d /usr/nec ;then - lt_prog_compiler_pic='-Kconform_pic' - lt_prog_compiler_static='-Bstatic' - fi - ;; - - sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - ;; - - unicos*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_can_build_shared=no - ;; - - uts4*) - lt_prog_compiler_pic='-pic' - lt_prog_compiler_static='-Bstatic' - ;; - - *) - lt_prog_compiler_can_build_shared=no - ;; - esac - fi - -case $host_os in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - lt_prog_compiler_pic= - ;; - *) - lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" - ;; -esac -{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic" >&5 -echo "${ECHO_T}$lt_prog_compiler_pic" >&6; } - - - - - - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$lt_prog_compiler_pic"; then - { echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 -echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic works... $ECHO_C" >&6; } -if test "${lt_cv_prog_compiler_pic_works+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_cv_prog_compiler_pic_works=no - ac_outfile=conftest.$ac_objext - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$lt_prog_compiler_pic -DPIC" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7948: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:7952: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then - lt_cv_prog_compiler_pic_works=yes - fi - fi - $RM conftest* - -fi -{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_pic_works" >&5 -echo "${ECHO_T}$lt_cv_prog_compiler_pic_works" >&6; } - -if test x"$lt_cv_prog_compiler_pic_works" = xyes; then - case $lt_prog_compiler_pic in - "" | " "*) ;; - *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; - esac -else - lt_prog_compiler_pic= - lt_prog_compiler_can_build_shared=no -fi - -fi - - - - - - -# -# Check to make sure the static flag actually works. -# -wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" -{ echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5 -echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; } -if test "${lt_cv_prog_compiler_static_works+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_cv_prog_compiler_static_works=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $lt_tmp_static_flag" - echo "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The linker can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - # Append any errors to the config.log. - cat conftest.err 1>&5 - $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if diff conftest.exp conftest.er2 >/dev/null; then - lt_cv_prog_compiler_static_works=yes - fi - else - lt_cv_prog_compiler_static_works=yes - fi - fi - $RM -r conftest* - LDFLAGS="$save_LDFLAGS" - -fi -{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_static_works" >&5 -echo "${ECHO_T}$lt_cv_prog_compiler_static_works" >&6; } - -if test x"$lt_cv_prog_compiler_static_works" = xyes; then - : -else - lt_prog_compiler_static= -fi - - - - - - - - { echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 -echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; } -if test "${lt_cv_prog_compiler_c_o+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_cv_prog_compiler_c_o=no - $RM -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:8053: $lt_compile\"" >&5) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&5 - echo "$as_me:8057: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp - $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then - lt_cv_prog_compiler_c_o=yes - fi - fi - chmod u+w . 2>&5 - $RM conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files - $RM out/* && rmdir out - cd .. - $RM -r conftest - $RM conftest* - -fi -{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5 -echo "${ECHO_T}$lt_cv_prog_compiler_c_o" >&6; } - - - - - - - { echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 -echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; } -if test "${lt_cv_prog_compiler_c_o+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_cv_prog_compiler_c_o=no - $RM -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:8108: $lt_compile\"" >&5) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&5 - echo "$as_me:8112: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp - $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then - lt_cv_prog_compiler_c_o=yes - fi - fi - chmod u+w . 2>&5 - $RM conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files - $RM out/* && rmdir out - cd .. - $RM -r conftest - $RM conftest* - -fi -{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5 -echo "${ECHO_T}$lt_cv_prog_compiler_c_o" >&6; } - - - - -hard_links="nottested" -if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then - # do not overwrite the value of need_locks provided by the user - { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 -echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6; } - hard_links=yes - $RM conftest* - ln conftest.a conftest.b 2>/dev/null && hard_links=no - touch conftest.a - ln conftest.a conftest.b 2>&5 || hard_links=no - ln conftest.a conftest.b 2>/dev/null && hard_links=no - { echo "$as_me:$LINENO: result: $hard_links" >&5 -echo "${ECHO_T}$hard_links" >&6; } - if test "$hard_links" = no; then - { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 -echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} - need_locks=warn - fi -else - need_locks=no -fi - - - - - - - { echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; } - - runpath_var= - allow_undefined_flag= - always_export_symbols=no - archive_cmds= - archive_expsym_cmds= - compiler_needs_object=no - enable_shared_with_static_runtimes=no - export_dynamic_flag_spec= - export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - hardcode_automatic=no - hardcode_direct=no - hardcode_direct_absolute=no - hardcode_libdir_flag_spec= - hardcode_libdir_flag_spec_ld= - hardcode_libdir_separator= - hardcode_minus_L=no - hardcode_shlibpath_var=unsupported - inherit_rpath=no - link_all_deplibs=unknown - module_cmds= - module_expsym_cmds= - old_archive_from_new_cmds= - old_archive_from_expsyms_cmds= - thread_safe_flag_spec= - whole_archive_flag_spec= - # include_expsyms should be a list of space-separated symbols to be *always* - # included in the symbol list - include_expsyms= - # exclude_expsyms can be an extended regexp of symbols to exclude - # it will be wrapped by ` (' and `)$', so one must not match beginning or - # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', - # as well as any symbol that contains `d'. - exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' - # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out - # platforms (ab)use it in PIC code, but their linkers get confused if - # the symbol is explicitly referenced. Since portable code cannot - # rely on this symbol name, it's probably fine to never include it in - # preloaded symbol tables. - # Exclude shared library initialization/finalization symbols. - extract_expsyms_cmds= - - case $host_os in - cygwin* | mingw* | pw32*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$GCC" != yes; then - with_gnu_ld=no - fi - ;; - interix*) - # we just hope/assume this is gcc and not c89 (= MSVC++) - with_gnu_ld=yes - ;; - openbsd*) - with_gnu_ld=no - ;; - esac - - ld_shlibs=yes - if test "$with_gnu_ld" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' - - # Set some defaults for GNU ld with shared library support. These - # are reset later if shared libraries are not supported. Putting them - # here allows them to be overridden if necessary. - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - export_dynamic_flag_spec='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec= - fi - supports_anon_versioning=no - case `$LD -v 2>&1` in - *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - - # See if GNU ld supports shared libraries. - case $host_os in - aix[3-9]*) - # On AIX/PPC, the GNU linker is very broken - if test "$host_cpu" != ia64; then - ld_shlibs=no - cat <<_LT_EOF 1>&2 - -*** Warning: the GNU linker, at least up to release 2.9.1, is reported -*** to be unable to reliably create shared libraries on AIX. -*** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to modify your PATH -*** so that a non-GNU linker is found, and then restart. - -_LT_EOF - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='' - ;; - m68k) - archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - ;; - esac - ;; - - beos*) - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - allow_undefined_flag=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - ld_shlibs=no - fi - ;; - - cygwin* | mingw* | pw32*) - # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, - # as there is no search path for DLLs. - hardcode_libdir_flag_spec='-L$libdir' - allow_undefined_flag=unsupported - always_export_symbols=no - enable_shared_with_static_runtimes=yes - export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' - - if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - else - ld_shlibs=no - fi - ;; - - interix[3-9]*) - hardcode_direct=no - hardcode_shlibpath_var=no - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - export_dynamic_flag_spec='${wl}-E' - # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. - # Instead, shared libraries are loaded at an image base (0x10000000 by - # default) and relocated if they conflict, which is a slow very memory - # consuming and fragmenting process. To avoid this, we pick a random, - # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link - # time. Moving up from 0x10000000 also allows more sbrk(2) space. - archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - ;; - - gnu* | linux* | tpf* | k*bsd*-gnu) - tmp_diet=no - if test "$host_os" = linux-dietlibc; then - case $cc_basename in - diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) - esac - fi - if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ - && test "$tmp_diet" = no - then - tmp_addflag= - tmp_sharedflag='-shared' - case $cc_basename,$host_cpu in - pgcc*) # Portland Group C compiler - whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag' - ;; - pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers - whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag -Mnomain' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - xl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) - tmp_sharedflag='-qmkshrobj' - tmp_addflag= ;; - esac - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) # Sun C 5.9 - whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' - compiler_needs_object=yes - tmp_sharedflag='-G' ;; - *Sun\ F*) # Sun Fortran 8.3 - tmp_sharedflag='-G' ;; - esac - archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - - if test "x$supports_anon_versioning" = xyes; then - archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - fi - - case $cc_basename in - xlf*) - # IBM XL Fortran 10.1 on PPC cannot create shared libs itself - whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' - hardcode_libdir_flag_spec= - hardcode_libdir_flag_spec_ld='-rpath $libdir' - archive_cmds='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib' - if test "x$supports_anon_versioning" = xyes; then - archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' - fi - ;; - esac - else - ld_shlibs=no - fi - ;; - - netbsd* | netbsdelf*-gnu) - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; - - solaris*) - if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then - ld_shlibs=no - cat <<_LT_EOF 1>&2 - -*** Warning: The releases 2.8.* of the GNU linker cannot reliably -*** create shared libraries on Solaris systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.9.1 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -_LT_EOF - elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - - sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) - case `$LD -v 2>&1` in - *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) - ld_shlibs=no - cat <<_LT_EOF 1>&2 - -*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not -*** reliably create shared libraries on SCO systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.16.91.0.3 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -_LT_EOF - ;; - *) - # For security reasons, it is highly recommended that you always - # use absolute paths for naming shared libraries, and exclude the - # DT_RUNPATH tag from executables and libraries. But doing so - # requires that you compile everything twice, which is a pain. - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - esac - ;; - - sunos4*) - archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - *) - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - esac - - if test "$ld_shlibs" = no; then - runpath_var= - hardcode_libdir_flag_spec= - export_dynamic_flag_spec= - whole_archive_flag_spec= - fi - else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - allow_undefined_flag=unsupported - always_export_symbols=yes - archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - hardcode_minus_L=yes - if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - hardcode_direct=unsupported - fi - ;; - - aix[4-9]*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then - export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' - else - export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' - fi - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) - for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then - aix_use_runtimelinking=yes - break - fi - done - ;; - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - archive_cmds='' - hardcode_direct=yes - hardcode_direct_absolute=yes - hardcode_libdir_separator=':' - link_all_deplibs=yes - file_list_spec='${wl}-f,' - - if test "$GCC" = yes; then - case $host_os in aix4.[012]|aix4.[012].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && - strings "$collect2name" | $GREP resolve_lib_name >/dev/null - then - # We have reworked collect2 - : - else - # We have old collect2 - hardcode_direct=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - hardcode_minus_L=yes - hardcode_libdir_flag_spec='-L$libdir' - hardcode_libdir_separator= - fi - ;; - esac - shared_flag='-shared' - if test "$aix_use_runtimelinking" = yes; then - shared_flag="$shared_flag "'${wl}-G' - fi - link_all_deplibs=no - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - always_export_symbols=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - allow_undefined_flag='-berok' - # Determine the default libpath from the value encoded in an - # empty executable. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - -lt_aix_libpath_sed=' - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\(.*\)$/\1/ - p - } - }' -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then - aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" - archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' - allow_undefined_flag="-z nodefs" - archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an - # empty executable. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - -lt_aix_libpath_sed=' - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\(.*\)$/\1/ - p - } - }' -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then - aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - no_undefined_flag=' ${wl}-bernotok' - allow_undefined_flag=' ${wl}-berok' - # Exported symbols can be pulled into shared objects from archives - whole_archive_flag_spec='$convenience' - archive_cmds_need_lc=yes - # This is similar to how AIX traditionally builds its shared libraries. - archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='' - ;; - m68k) - archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - ;; - esac - ;; - - bsdi[45]*) - export_dynamic_flag_spec=-rdynamic - ;; - - cygwin* | mingw* | pw32*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - hardcode_libdir_flag_spec=' ' - allow_undefined_flag=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - archive_cmds='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -e '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - old_archive_from_new_cmds='true' - # FIXME: Should let the user specify the lib program. - old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' - fix_srcfile_path='`cygpath -w "$srcfile"`' - enable_shared_with_static_runtimes=yes - ;; - - darwin* | rhapsody*) - - - archive_cmds_need_lc=no - hardcode_direct=no - hardcode_automatic=yes - hardcode_shlibpath_var=unsupported - whole_archive_flag_spec='' - link_all_deplibs=yes - allow_undefined_flag="$_lt_dar_allow_undefined" - if test "$GCC" = "yes"; then - output_verbose_link_cmd=echo - archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" - module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" - archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" - module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" - - else - ld_shlibs=no - fi - - ;; - - dgux*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; - - freebsd1*) - ld_shlibs=no - ;; - - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | dragonfly*) - archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - hpux9*) - if test "$GCC" = yes; then - archive_cmds='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - fi - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_direct=yes - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - export_dynamic_flag_spec='${wl}-E' - ;; - - hpux10*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then - archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' - fi - if test "$with_gnu_ld" = no; then - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_flag_spec_ld='+b $libdir' - hardcode_libdir_separator=: - hardcode_direct=yes - hardcode_direct_absolute=yes - export_dynamic_flag_spec='${wl}-E' - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - fi - ;; - - hpux11*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then - case $host_cpu in - hppa*64*) - archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - ia64*) - archive_cmds='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - else - case $host_cpu in - hppa*64*) - archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - ia64*) - archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - fi - if test "$with_gnu_ld" = no; then - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_separator=: - - case $host_cpu in - hppa*64*|ia64*) - hardcode_direct=no - hardcode_shlibpath_var=no - ;; - *) - hardcode_direct=yes - hardcode_direct_absolute=yes - export_dynamic_flag_spec='${wl}-E' - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - ;; - esac - fi - ;; - - irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - # Try to use the -exported_symbol ld option, if it does not - # work, assume that -exports_file does not work either and - # implicitly export all symbols. - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" - cat >conftest.$ac_ext <<_ACEOF -int foo(void) {} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' - -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext - LDFLAGS="$save_LDFLAGS" - else - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' - fi - archive_cmds_need_lc='no' - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - inherit_rpath=yes - link_all_deplibs=yes - ;; - - netbsd* | netbsdelf*-gnu) - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - newsos6) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_shlibpath_var=no - ;; - - *nto* | *qnx*) - ;; - - openbsd*) - if test -f /usr/libexec/ld.so; then - hardcode_direct=yes - hardcode_shlibpath_var=no - hardcode_direct_absolute=yes - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - export_dynamic_flag_spec='${wl}-E' - else - case $host_os in - openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-R$libdir' - ;; - *) - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - ;; - esac - fi - else - ld_shlibs=no - fi - ;; - - os2*) - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - allow_undefined_flag=unsupported - archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$ECHO DATA >> $output_objdir/$libname.def~$ECHO " SINGLE NONSHARED" >> $output_objdir/$libname.def~$ECHO EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; - - osf3*) - if test "$GCC" = yes; then - allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' - fi - archive_cmds_need_lc='no' - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' - archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ - $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' - - # Both c and cxx compiler support -rpath directly - hardcode_libdir_flag_spec='-rpath $libdir' - fi - archive_cmds_need_lc='no' - hardcode_libdir_separator=: - ;; - - solaris*) - no_undefined_flag=' -z defs' - if test "$GCC" = yes; then - wlarc='${wl}' - archive_cmds='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' - else - case `$CC -V 2>&1` in - *"Compilers 5.0"*) - wlarc='' - archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' - ;; - *) - wlarc='${wl}' - archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' - ;; - esac - fi - hardcode_libdir_flag_spec='-R$libdir' - hardcode_shlibpath_var=no - case $host_os in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) - # The compiler driver will combine and reorder linker options, - # but understands `-z linker_flag'. GCC discards it without `$wl', - # but is careful enough not to reorder. - # Supported since Solaris 2.6 (maybe 2.5.1?) - if test "$GCC" = yes; then - whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' - else - whole_archive_flag_spec='-z allextract$convenience -z defaultextract' - fi - ;; - esac - link_all_deplibs=yes - ;; - - sunos4*) - if test "x$host_vendor" = xsequent; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - hardcode_libdir_flag_spec='-L$libdir' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; - - sysv4) - case $host_vendor in - sni) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' - reload_cmds='$CC -r -o $output$reload_objs' - hardcode_direct=no - ;; - motorola) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var=no - ;; - - sysv4.3*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - export_dynamic_flag_spec='-Bexport' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ld_shlibs=yes - fi - ;; - - sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) - no_undefined_flag='${wl}-z,text' - archive_cmds_need_lc=no - hardcode_shlibpath_var=no - runpath_var='LD_RUN_PATH' - - if test "$GCC" = yes; then - archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - ;; - - sysv5* | sco3.2v5* | sco5v6*) - # Note: We can NOT use -z defs as we might desire, because we do not - # link with -lc, and that would cause any symbols used from libc to - # always be unresolved, which means just about no library would - # ever link correctly. If we're not using GNU ld we use -z text - # though, which does catch some bad symbols but isn't as heavy-handed - # as -z defs. - no_undefined_flag='${wl}-z,text' - allow_undefined_flag='${wl}-z,nodefs' - archive_cmds_need_lc=no - hardcode_shlibpath_var=no - hardcode_libdir_flag_spec='${wl}-R,$libdir' - hardcode_libdir_separator=':' - link_all_deplibs=yes - export_dynamic_flag_spec='${wl}-Bexport' - runpath_var='LD_RUN_PATH' - - if test "$GCC" = yes; then - archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - ;; - - uts4*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; - - *) - ld_shlibs=no - ;; - esac - - if test x$host_vendor = xsni; then - case $host in - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - export_dynamic_flag_spec='${wl}-Blargedynsym' - ;; - esac - fi - fi - -{ echo "$as_me:$LINENO: result: $ld_shlibs" >&5 -echo "${ECHO_T}$ld_shlibs" >&6; } -test "$ld_shlibs" = no && can_build_shared=no - -with_gnu_ld=$with_gnu_ld - - - - - - - - - - - - - - - -# -# Do we need to explicitly link libc? -# -case "x$archive_cmds_need_lc" in -x|xyes) - # Assume -lc should be added - archive_cmds_need_lc=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $archive_cmds in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 -echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; } - $RM conftest* - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$lt_prog_compiler_wl - pic_flag=$lt_prog_compiler_pic - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$allow_undefined_flag - allow_undefined_flag= - if { (eval echo "$as_me:$LINENO: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\"") >&5 - (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - then - archive_cmds_need_lc=no - else - archive_cmds_need_lc=yes - fi - allow_undefined_flag=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $RM conftest* - { echo "$as_me:$LINENO: result: $archive_cmds_need_lc" >&5 -echo "${ECHO_T}$archive_cmds_need_lc" >&6; } - ;; - esac - fi - ;; -esac - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 -echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6; } - -if test "$GCC" = yes; then - case $host_os in - darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; - *) lt_awk_arg="/^libraries:/" ;; - esac - lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if $ECHO "$lt_search_path_spec" | $GREP ';' >/dev/null ; then - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e 's/;/ /g'` - else - lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - # Ok, now we have the path, separated by spaces, we can step through it - # and add multilib dir if necessary. - lt_tmp_lt_search_path_spec= - lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` - for lt_sys_path in $lt_search_path_spec; do - if test -d "$lt_sys_path/$lt_multi_os_dir"; then - lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" - else - test -d "$lt_sys_path" && \ - lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" - fi - done - lt_search_path_spec=`$ECHO $lt_tmp_lt_search_path_spec | awk ' -BEGIN {RS=" "; FS="/|\n";} { - lt_foo=""; - lt_count=0; - for (lt_i = NF; lt_i > 0; lt_i--) { - if ($lt_i != "" && $lt_i != ".") { - if ($lt_i == "..") { - lt_count++; - } else { - if (lt_count == 0) { - lt_foo="/" $lt_i lt_foo; - } else { - lt_count--; - } - } - } - } - if (lt_foo != "") { lt_freq[lt_foo]++; } - if (lt_freq[lt_foo] == 1) { print lt_foo; } -}'` - sys_lib_search_path_spec=`$ECHO $lt_search_path_spec` -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi -library_names_spec= -libname_spec='lib$name' -soname_spec= -shrext_cmds=".so" -postinstall_cmds= -postuninstall_cmds= -finish_cmds= -finish_eval= -shlibpath_var= -shlibpath_overrides_runpath=unknown -version_type=none -dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown - -case $host_os in -aix3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' - shlibpath_var=LIBPATH - - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' - ;; - -aix[4-9]*) - version_type=linux - need_lib_prefix=no - need_version=no - hardcode_into_libs=yes - if test "$host_cpu" = ia64; then - # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - else - # With GCC up to 2.95.x, collect2 would create an import file - # for dependence libraries. The import file would start with - # the line `#! .'. This would cause the generated library to - # depend on `.', always an invalid library. This was fixed in - # development snapshots of GCC prior to 3.0. - case $host_os in - aix4 | aix4.[01] | aix4.[01].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; - esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. - if test "$aix_use_runtimelinking" = yes; then - # If using run time linking (on AIX 4.2 or later) use lib.so - # instead of lib.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - else - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' - fi - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - case $host_cpu in - powerpc) - # Since July 2007 AmigaOS4 officially supports .so libraries. - # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - ;; - m68k) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' - ;; - esac - ;; - -beos*) - library_names_spec='${libname}${shared_ext}' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - ;; - -bsdi[45]*) - version_type=linux - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" - sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - # the default ld.so.conf also contains /usr/contrib/lib and - # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow - # libtool to hard-code these into programs - ;; - -cygwin* | mingw* | pw32*) - version_type=windows - shrext_cmds=".dll" - need_version=no - need_lib_prefix=no - - case $GCC,$host_os in - yes,cygwin* | yes,mingw* | yes,pw32*) - library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname~ - chmod a+x \$dldir/$dlname~ - if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then - eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; - fi' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $RM \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" - ;; - mingw*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then - # It is most probably a Windows format PATH printed by - # mingw gcc, but we are running on Cygwin. Gcc prints its search - # path with ; separators, and with drive letters. We can handle the - # drive letters (cygwin fileutils understands them), so leave them, - # especially as we might pass files found there to a mingw objdump, - # which wouldn't understand a cygwinified path. Ahh. - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - ;; - esac - ;; - - *) - library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' - ;; - esac - dynamic_linker='Win32 ld.exe' - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - ;; - -darwin* | rhapsody*) - dynamic_linker="$host_os dyld" - version_type=darwin - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' - shlibpath_overrides_runpath=yes - shlibpath_var=DYLD_LIBRARY_PATH - shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' - - sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -freebsd1*) - dynamic_linker=no - ;; - -freebsd* | dragonfly*) - # DragonFly does not have aout. When/if they implement a new - # versioning mechanism, adjust this. - if test -x /usr/bin/objformat; then - objformat=`/usr/bin/objformat` - else - case $host_os in - freebsd[123]*) objformat=aout ;; - *) objformat=elf ;; - esac - fi - version_type=freebsd-$objformat - case $version_type in - freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case $host_os in - freebsd2*) - shlibpath_overrides_runpath=yes - ;; - freebsd3.[01]* | freebsdelf3.[01]*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ - freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - *) # from 4.6 on, and DragonFly - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - esac - ;; - -gnu*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - hardcode_into_libs=yes - ;; - -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - version_type=sunos - need_lib_prefix=no - need_version=no - case $host_cpu in - ia64*) - shrext_cmds='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - if test "X$HPUX_IA64_MODE" = X32; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - hppa*64*) - shrext_cmds='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext_cmds='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - ;; - esac - # HP-UX runs *really* slowly unless shared libraries are mode 555. - postinstall_cmds='chmod 555 $lib' - ;; - -interix[3-9]*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -irix5* | irix6* | nonstopux*) - case $host_os in - nonstopux*) version_type=nonstopux ;; - *) - if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux - else - version_type=irix - fi ;; - esac - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' - case $host_os in - irix5* | nonstopux*) - libsuff= shlibsuff= - ;; - *) - case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; - esac - ;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" - sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - hardcode_into_libs=yes - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) - dynamic_linker=no - ;; - -# This must be Linux ELF. -linux* | k*bsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - # Some binutils ld are patched to set DT_RUNPATH - save_LDFLAGS=$LDFLAGS - save_libdir=$libdir - eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ - LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then - shlibpath_overrides_runpath=yes -fi - -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext - LDFLAGS=$save_LDFLAGS - libdir=$save_libdir - - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - # Append ld.so.conf contents to the search path - if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" - fi - - # We used to test for /lib/ld.so.1 and disable shared libraries on - # powerpc, because MkLinux only supported shared libraries with the - # GNU dynamic linker. Since this was broken with cross compilers, - # most powerpc-linux boxes support dynamic linking these days and - # people can always --disable-shared, the test was removed, and we - # assume the GNU/Linux dynamic linker is in use. - dynamic_linker='GNU/Linux ld.so' - ;; - -netbsdelf*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='NetBSD ld.elf_so' - ;; - -netbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='NetBSD ld.elf_so' - fi - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - -newsos6) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -*nto* | *qnx*) - version_type=qnx - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='ldqnx.so' - ;; - -openbsd*) - version_type=sunos - sys_lib_dlsearch_path_spec="/usr/lib" - need_lib_prefix=no - # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. - case $host_os in - openbsd3.3 | openbsd3.3.*) need_version=yes ;; - *) need_version=no ;; - esac - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case $host_os in - openbsd2.[89] | openbsd2.[89].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac - else - shlibpath_overrides_runpath=yes - fi - ;; - -os2*) - libname_spec='$name' - shrext_cmds=".dll" - need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=LIBPATH - ;; - -osf3* | osf4* | osf5*) - version_type=osf - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - ;; - -rdos*) - dynamic_linker=no - ;; - -solaris*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - ;; - -sunos4*) - version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - if test "$with_gnu_ld" = yes; then - need_lib_prefix=no - fi - need_version=yes - ;; - -sysv4 | sysv4.3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - case $host_vendor in - sni) - shlibpath_overrides_runpath=no - need_lib_prefix=no - runpath_var=LD_RUN_PATH - ;; - siemens) - need_lib_prefix=no - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - ;; - esac - ;; - -sysv4*MP*) - if test -d /usr/nec ;then - version_type=linux - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; - -sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - version_type=freebsd-elf - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - if test "$with_gnu_ld" = yes; then - sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' - else - sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' - case $host_os in - sco3.2v5*) - sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" - ;; - esac - fi - sys_lib_dlsearch_path_spec='/usr/lib' - ;; - -tpf*) - # TPF is a cross-target only. Preferred cross-host = GNU/Linux. - version_type=linux - need_lib_prefix=no - need_version=no - library_name_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -uts4*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -*) - dynamic_linker=no - ;; -esac -{ echo "$as_me:$LINENO: result: $dynamic_linker" >&5 -echo "${ECHO_T}$dynamic_linker" >&6; } -test "$dynamic_linker" = no && can_build_shared=no - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - -if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then - sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" -fi -if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then - sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" -fi - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 -echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; } -hardcode_action= -if test -n "$hardcode_libdir_flag_spec" || - test -n "$runpath_var" || - test "X$hardcode_automatic" = "Xyes" ; then - - # We can hardcode non-existent directories. - if test "$hardcode_direct" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no && - test "$hardcode_minus_L" != no; then - # Linking always hardcodes the temporary library directory. - hardcode_action=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - hardcode_action=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - hardcode_action=unsupported -fi -{ echo "$as_me:$LINENO: result: $hardcode_action" >&5 -echo "${ECHO_T}$hardcode_action" >&6; } - -if test "$hardcode_action" = relink || - test "$inherit_rpath" = yes; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi - - - - - - - if test "x$enable_dlopen" != xyes; then - enable_dlopen=unknown - enable_dlopen_self=unknown - enable_dlopen_self_static=unknown -else - lt_cv_dlopen=no - lt_cv_dlopen_libs= - - case $host_os in - beos*) - lt_cv_dlopen="load_add_on" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ;; - - mingw* | pw32*) - lt_cv_dlopen="LoadLibrary" - lt_cv_dlopen_libs= - ;; - - cygwin*) - lt_cv_dlopen="dlopen" - lt_cv_dlopen_libs= - ;; - - darwin*) - # if libdl is installed we need to link against it - { echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 -echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6; } -if test "${ac_cv_lib_dl_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dlopen (); -int -main () -{ -return dlopen (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - ac_cv_lib_dl_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_lib_dl_dlopen=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 -echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6; } -if test $ac_cv_lib_dl_dlopen = yes; then - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -else - - lt_cv_dlopen="dyld" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - -fi - - ;; - - *) - { echo "$as_me:$LINENO: checking for shl_load" >&5 -echo $ECHO_N "checking for shl_load... $ECHO_C" >&6; } -if test "${ac_cv_func_shl_load+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define shl_load to an innocuous variant, in case declares shl_load. - For example, HP-UX 11i declares gettimeofday. */ -#define shl_load innocuous_shl_load - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char shl_load (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef shl_load - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char shl_load (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined __stub_shl_load || defined __stub___shl_load -choke me -#endif - -int -main () -{ -return shl_load (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - ac_cv_func_shl_load=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_func_shl_load=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 -echo "${ECHO_T}$ac_cv_func_shl_load" >&6; } -if test $ac_cv_func_shl_load = yes; then - lt_cv_dlopen="shl_load" -else - { echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 -echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6; } -if test "${ac_cv_lib_dld_shl_load+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldld $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char shl_load (); -int -main () -{ -return shl_load (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - ac_cv_lib_dld_shl_load=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_lib_dld_shl_load=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 -echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6; } -if test $ac_cv_lib_dld_shl_load = yes; then - lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" -else - { echo "$as_me:$LINENO: checking for dlopen" >&5 -echo $ECHO_N "checking for dlopen... $ECHO_C" >&6; } -if test "${ac_cv_func_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define dlopen to an innocuous variant, in case declares dlopen. - For example, HP-UX 11i declares gettimeofday. */ -#define dlopen innocuous_dlopen - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char dlopen (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef dlopen - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dlopen (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined __stub_dlopen || defined __stub___dlopen -choke me -#endif - -int -main () -{ -return dlopen (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - ac_cv_func_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_func_dlopen=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 -echo "${ECHO_T}$ac_cv_func_dlopen" >&6; } -if test $ac_cv_func_dlopen = yes; then - lt_cv_dlopen="dlopen" -else - { echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 -echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6; } -if test "${ac_cv_lib_dl_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dlopen (); -int -main () -{ -return dlopen (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - ac_cv_lib_dl_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_lib_dl_dlopen=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 -echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6; } -if test $ac_cv_lib_dl_dlopen = yes; then - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -else - { echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5 -echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6; } -if test "${ac_cv_lib_svld_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lsvld $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dlopen (); -int -main () -{ -return dlopen (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - ac_cv_lib_svld_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_lib_svld_dlopen=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5 -echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6; } -if test $ac_cv_lib_svld_dlopen = yes; then - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" -else - { echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5 -echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6; } -if test "${ac_cv_lib_dld_dld_link+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldld $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dld_link (); -int -main () -{ -return dld_link (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - ac_cv_lib_dld_dld_link=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_lib_dld_dld_link=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5 -echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6; } -if test $ac_cv_lib_dld_dld_link = yes; then - lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" -fi - - -fi - - -fi - - -fi - - -fi - - -fi - - ;; - esac - - if test "x$lt_cv_dlopen" != xno; then - enable_dlopen=yes - else - enable_dlopen=no - fi - - case $lt_cv_dlopen in - dlopen) - save_CPPFLAGS="$CPPFLAGS" - test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" - - save_LDFLAGS="$LDFLAGS" - wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" - - save_LIBS="$LIBS" - LIBS="$lt_cv_dlopen_libs $LIBS" - - { echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5 -echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6; } -if test "${lt_cv_dlopen_self+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then : - lt_cv_dlopen_self=cross -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF -#line 10869 "configure" -#include "confdefs.h" - -#if HAVE_DLFCN_H -#include -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -#ifdef __cplusplus -extern "C" void exit (int); -#endif - -void fnord() { int i=42;} -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - /* dlclose (self); */ - } - else - puts (dlerror ()); - - exit (status); -} -_LT_EOF - if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) >&5 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; - x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; - x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; - esac - else : - # compilation failed - lt_cv_dlopen_self=no - fi -fi -rm -fr conftest* - - -fi -{ echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5 -echo "${ECHO_T}$lt_cv_dlopen_self" >&6; } - - if test "x$lt_cv_dlopen_self" = xyes; then - wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" - { echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5 -echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6; } -if test "${lt_cv_dlopen_self_static+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then : - lt_cv_dlopen_self_static=cross -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF -#line 10969 "configure" -#include "confdefs.h" - -#if HAVE_DLFCN_H -#include -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -#ifdef __cplusplus -extern "C" void exit (int); -#endif - -void fnord() { int i=42;} -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - /* dlclose (self); */ - } - else - puts (dlerror ()); - - exit (status); -} -_LT_EOF - if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) >&5 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; - x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; - x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; - esac - else : - # compilation failed - lt_cv_dlopen_self_static=no - fi -fi -rm -fr conftest* - - -fi -{ echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5 -echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6; } - fi - - CPPFLAGS="$save_CPPFLAGS" - LDFLAGS="$save_LDFLAGS" - LIBS="$save_LIBS" - ;; - esac - - case $lt_cv_dlopen_self in - yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; - *) enable_dlopen_self=unknown ;; - esac - - case $lt_cv_dlopen_self_static in - yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; - *) enable_dlopen_self_static=unknown ;; - esac -fi - - - - - - - - - - - - - - - - - -striplib= -old_striplib= -{ echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 -echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6; } -if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - { echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6; } -else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP" ; then - striplib="$STRIP -x" - old_striplib="$STRIP -S" - { echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6; } - else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } - fi - ;; - *) - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } - ;; - esac -fi - - - - - - - - - - - - - # Report which library types will actually be built - { echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 -echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6; } - { echo "$as_me:$LINENO: result: $can_build_shared" >&5 -echo "${ECHO_T}$can_build_shared" >&6; } - - { echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 -echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6; } - test "$can_build_shared" = "no" && enable_shared=no - - # On AIX, shared libraries and static libraries use the same namespace, and - # are all built from PIC. - case $host_os in - aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; - - aix[4-9]*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi - ;; - esac - { echo "$as_me:$LINENO: result: $enable_shared" >&5 -echo "${ECHO_T}$enable_shared" >&6; } - - { echo "$as_me:$LINENO: checking whether to build static libraries" >&5 -echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6; } - # Make sure either enable_shared or enable_static is yes. - test "$enable_shared" = yes || enable_static=yes - { echo "$as_me:$LINENO: result: $enable_static" >&5 -echo "${ECHO_T}$enable_static" >&6; } - - - - -fi -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -CC="$lt_save_CC" - - - - - - - - - - - - - - ac_config_commands="$ac_config_commands libtool" - - - - -# Only expand once: - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. -set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CC="gcc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&5 -echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -else - CC="$ac_cv_prog_CC" -fi - -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. -set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="${ac_tool_prefix}cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - - fi -fi -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - ac_prog_rejected=no -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# != 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" - fi -fi -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl.exe - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - - test -n "$CC" && break - done -fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl.exe -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CC="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - - test -n "$ac_ct_CC" && break -done - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&5 -echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -fi - -fi - - -test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&5 -echo "$as_me: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } - -# Provide some information about the compiler. -echo "$as_me:$LINENO: checking for C compiler version" >&5 -ac_compiler=`set X $ac_compile; echo $2` -{ (ac_try="$ac_compiler --version >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compiler --version >&5") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (ac_try="$ac_compiler -v >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compiler -v >&5") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (ac_try="$ac_compiler -V >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compiler -V >&5") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - -{ echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 -echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; } -if test "${ac_cv_c_compiler_gnu+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_compiler_gnu=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_compiler_gnu=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - -fi -{ echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 -echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; } -GCC=`test $ac_compiler_gnu = yes && echo yes` -ac_test_CFLAGS=${CFLAGS+set} -ac_save_CFLAGS=$CFLAGS -{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 -echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; } -if test "${ac_cv_prog_cc_g+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_save_c_werror_flag=$ac_c_werror_flag - ac_c_werror_flag=yes - ac_cv_prog_cc_g=no - CFLAGS="-g" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_prog_cc_g=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - CFLAGS="" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_c_werror_flag=$ac_save_c_werror_flag - CFLAGS="-g" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_prog_cc_g=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_c_werror_flag=$ac_save_c_werror_flag -fi -{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; } -if test "$ac_test_CFLAGS" = set; then - CFLAGS=$ac_save_CFLAGS -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi -{ echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 -echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } -if test "${ac_cv_prog_cc_c89+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_prog_cc_c89=no -ac_save_CC=$CC -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -#include -#include -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; - -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) 'x' -int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; - -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} -_ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_prog_cc_c89=$ac_arg -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c89" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC - -fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { echo "$as_me:$LINENO: result: none needed" >&5 -echo "${ECHO_T}none needed" >&6; } ;; - xno) - { echo "$as_me:$LINENO: result: unsupported" >&5 -echo "${ECHO_T}unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; -esac - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -depcc="$CC" am_compiler_list= - -{ echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 -echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6; } -if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then - # We make a subdir and do the tests there. Otherwise we can end up - # making bogus files that we don't know about and never remove. For - # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named `D' -- because `-MD' means `put the output - # in D'. - mkdir conftest.dir - # Copy depcomp to subdir because otherwise we won't find it if we're - # using a relative directory. - cp "$am_depcomp" conftest.dir - cd conftest.dir - # We will build objects and dependencies in a subdirectory because - # it helps to detect inapplicable dependency modes. For instance - # both Tru64's cc and ICC support -MD to output dependencies as a - # side effect of compilation, but ICC will put the dependencies in - # the current directory while Tru64 will put them in the object - # directory. - mkdir sub - - am_cv_CC_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` - fi - for depmode in $am_compiler_list; do - # Setup a source with many dependencies, because some compilers - # like to wrap large dependency lists on column 80 (with \), and - # we should not choose a depcomp mode which is confused by this. - # - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. - : > sub/conftest.c - for i in 1 2 3 4 5 6; do - echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with - # Solaris 8's {/usr,}/bin/sh. - touch sub/conftst$i.h - done - echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - - case $depmode in - nosideeffect) - # after this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested - if test "x$enable_dependency_tracking" = xyes; then - continue - else - break - fi - ;; - none) break ;; - esac - # We check with `-c' and `-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle `-M -o', and we need to detect this. - if depmode=$depmode \ - source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ - depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ - $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ - >/dev/null 2>conftest.err && - grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - # icc doesn't choke on unknown options, it will just issue warnings - # or remarks (even with -Werror). So we grep stderr for any message - # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thusly: - # icc: Command line warning: ignoring option '-M'; no argument required - # The diagnosis changed in icc 8.0: - # icc: Command line remark: option '-MP' not supported - if (grep 'ignoring option' conftest.err || - grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else - am_cv_CC_dependencies_compiler_type=$depmode - break - fi - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_CC_dependencies_compiler_type=none -fi - -fi -{ echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 -echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6; } -CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type - - if - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then - am__fastdepCC_TRUE= - am__fastdepCC_FALSE='#' -else - am__fastdepCC_TRUE='#' - am__fastdepCC_FALSE= -fi - - -ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -if test -z "$CXX"; then - if test -n "$CCC"; then - CXX=$CCC - else - if test -n "$ac_tool_prefix"; then - for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_CXX+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CXX"; then - ac_cv_prog_CXX="$CXX" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -CXX=$ac_cv_prog_CXX -if test -n "$CXX"; then - { echo "$as_me:$LINENO: result: $CXX" >&5 -echo "${ECHO_T}$CXX" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - - test -n "$CXX" && break - done -fi -if test -z "$CXX"; then - ac_ct_CXX=$CXX - for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CXX"; then - ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CXX="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -ac_ct_CXX=$ac_cv_prog_ac_ct_CXX -if test -n "$ac_ct_CXX"; then - { echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5 -echo "${ECHO_T}$ac_ct_CXX" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - - test -n "$ac_ct_CXX" && break -done - - if test "x$ac_ct_CXX" = x; then - CXX="g++" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&5 -echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&2;} -ac_tool_warned=yes ;; -esac - CXX=$ac_ct_CXX - fi -fi - - fi -fi -# Provide some information about the compiler. -echo "$as_me:$LINENO: checking for C++ compiler version" >&5 -ac_compiler=`set X $ac_compile; echo $2` -{ (ac_try="$ac_compiler --version >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compiler --version >&5") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (ac_try="$ac_compiler -v >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compiler -v >&5") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (ac_try="$ac_compiler -V >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compiler -V >&5") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - -{ echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5 -echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6; } -if test "${ac_cv_cxx_compiler_gnu+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_cxx_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_compiler_gnu=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_compiler_gnu=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_cxx_compiler_gnu=$ac_compiler_gnu - -fi -{ echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5 -echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6; } -GXX=`test $ac_compiler_gnu = yes && echo yes` -ac_test_CXXFLAGS=${CXXFLAGS+set} -ac_save_CXXFLAGS=$CXXFLAGS -{ echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5 -echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6; } -if test "${ac_cv_prog_cxx_g+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_save_cxx_werror_flag=$ac_cxx_werror_flag - ac_cxx_werror_flag=yes - ac_cv_prog_cxx_g=no - CXXFLAGS="-g" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_cxx_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_prog_cxx_g=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - CXXFLAGS="" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_cxx_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cxx_werror_flag=$ac_save_cxx_werror_flag - CXXFLAGS="-g" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_cxx_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_prog_cxx_g=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_cxx_werror_flag=$ac_save_cxx_werror_flag -fi -{ echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 -echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6; } -if test "$ac_test_CXXFLAGS" = set; then - CXXFLAGS=$ac_save_CXXFLAGS -elif test $ac_cv_prog_cxx_g = yes; then - if test "$GXX" = yes; then - CXXFLAGS="-g -O2" - else - CXXFLAGS="-g" - fi -else - if test "$GXX" = yes; then - CXXFLAGS="-O2" - else - CXXFLAGS= - fi -fi -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -depcc="$CXX" am_compiler_list= - -{ echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 -echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6; } -if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then - # We make a subdir and do the tests there. Otherwise we can end up - # making bogus files that we don't know about and never remove. For - # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named `D' -- because `-MD' means `put the output - # in D'. - mkdir conftest.dir - # Copy depcomp to subdir because otherwise we won't find it if we're - # using a relative directory. - cp "$am_depcomp" conftest.dir - cd conftest.dir - # We will build objects and dependencies in a subdirectory because - # it helps to detect inapplicable dependency modes. For instance - # both Tru64's cc and ICC support -MD to output dependencies as a - # side effect of compilation, but ICC will put the dependencies in - # the current directory while Tru64 will put them in the object - # directory. - mkdir sub - - am_cv_CXX_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` - fi - for depmode in $am_compiler_list; do - # Setup a source with many dependencies, because some compilers - # like to wrap large dependency lists on column 80 (with \), and - # we should not choose a depcomp mode which is confused by this. - # - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. - : > sub/conftest.c - for i in 1 2 3 4 5 6; do - echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with - # Solaris 8's {/usr,}/bin/sh. - touch sub/conftst$i.h - done - echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - - case $depmode in - nosideeffect) - # after this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested - if test "x$enable_dependency_tracking" = xyes; then - continue - else - break - fi - ;; - none) break ;; - esac - # We check with `-c' and `-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle `-M -o', and we need to detect this. - if depmode=$depmode \ - source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ - depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ - $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ - >/dev/null 2>conftest.err && - grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - # icc doesn't choke on unknown options, it will just issue warnings - # or remarks (even with -Werror). So we grep stderr for any message - # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thusly: - # icc: Command line warning: ignoring option '-M'; no argument required - # The diagnosis changed in icc 8.0: - # icc: Command line remark: option '-MP' not supported - if (grep 'ignoring option' conftest.err || - grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else - am_cv_CXX_dependencies_compiler_type=$depmode - break - fi - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_CXX_dependencies_compiler_type=none -fi - -fi -{ echo "$as_me:$LINENO: result: $am_cv_CXX_dependencies_compiler_type" >&5 -echo "${ECHO_T}$am_cv_CXX_dependencies_compiler_type" >&6; } -CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type - - if - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then - am__fastdepCXX_TRUE= - am__fastdepCXX_FALSE='#' -else - am__fastdepCXX_TRUE='#' - am__fastdepCXX_FALSE= -fi - - - -ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -if test -z "$CXX"; then - if test -n "$CCC"; then - CXX=$CCC - else - if test -n "$ac_tool_prefix"; then - for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_CXX+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CXX"; then - ac_cv_prog_CXX="$CXX" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -CXX=$ac_cv_prog_CXX -if test -n "$CXX"; then - { echo "$as_me:$LINENO: result: $CXX" >&5 -echo "${ECHO_T}$CXX" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - - test -n "$CXX" && break - done -fi -if test -z "$CXX"; then - ac_ct_CXX=$CXX - for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CXX"; then - ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CXX="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -ac_ct_CXX=$ac_cv_prog_ac_ct_CXX -if test -n "$ac_ct_CXX"; then - { echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5 -echo "${ECHO_T}$ac_ct_CXX" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - - test -n "$ac_ct_CXX" && break -done - - if test "x$ac_ct_CXX" = x; then - CXX="g++" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&5 -echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&2;} -ac_tool_warned=yes ;; -esac - CXX=$ac_ct_CXX - fi -fi - - fi -fi -# Provide some information about the compiler. -echo "$as_me:$LINENO: checking for C++ compiler version" >&5 -ac_compiler=`set X $ac_compile; echo $2` -{ (ac_try="$ac_compiler --version >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compiler --version >&5") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (ac_try="$ac_compiler -v >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compiler -v >&5") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (ac_try="$ac_compiler -V >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compiler -V >&5") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - -{ echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5 -echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6; } -if test "${ac_cv_cxx_compiler_gnu+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_cxx_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_compiler_gnu=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_compiler_gnu=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_cxx_compiler_gnu=$ac_compiler_gnu - -fi -{ echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5 -echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6; } -GXX=`test $ac_compiler_gnu = yes && echo yes` -ac_test_CXXFLAGS=${CXXFLAGS+set} -ac_save_CXXFLAGS=$CXXFLAGS -{ echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5 -echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6; } -if test "${ac_cv_prog_cxx_g+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_save_cxx_werror_flag=$ac_cxx_werror_flag - ac_cxx_werror_flag=yes - ac_cv_prog_cxx_g=no - CXXFLAGS="-g" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_cxx_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_prog_cxx_g=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - CXXFLAGS="" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_cxx_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cxx_werror_flag=$ac_save_cxx_werror_flag - CXXFLAGS="-g" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_cxx_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_prog_cxx_g=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_cxx_werror_flag=$ac_save_cxx_werror_flag -fi -{ echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 -echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6; } -if test "$ac_test_CXXFLAGS" = set; then - CXXFLAGS=$ac_save_CXXFLAGS -elif test $ac_cv_prog_cxx_g = yes; then - if test "$GXX" = yes; then - CXXFLAGS="-g -O2" - else - CXXFLAGS="-g" - fi -else - if test "$GXX" = yes; then - CXXFLAGS="-O2" - else - CXXFLAGS= - fi -fi -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -depcc="$CXX" am_compiler_list= - -{ echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 -echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6; } -if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then - # We make a subdir and do the tests there. Otherwise we can end up - # making bogus files that we don't know about and never remove. For - # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named `D' -- because `-MD' means `put the output - # in D'. - mkdir conftest.dir - # Copy depcomp to subdir because otherwise we won't find it if we're - # using a relative directory. - cp "$am_depcomp" conftest.dir - cd conftest.dir - # We will build objects and dependencies in a subdirectory because - # it helps to detect inapplicable dependency modes. For instance - # both Tru64's cc and ICC support -MD to output dependencies as a - # side effect of compilation, but ICC will put the dependencies in - # the current directory while Tru64 will put them in the object - # directory. - mkdir sub - - am_cv_CXX_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` - fi - for depmode in $am_compiler_list; do - # Setup a source with many dependencies, because some compilers - # like to wrap large dependency lists on column 80 (with \), and - # we should not choose a depcomp mode which is confused by this. - # - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. - : > sub/conftest.c - for i in 1 2 3 4 5 6; do - echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with - # Solaris 8's {/usr,}/bin/sh. - touch sub/conftst$i.h - done - echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - - case $depmode in - nosideeffect) - # after this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested - if test "x$enable_dependency_tracking" = xyes; then - continue - else - break - fi - ;; - none) break ;; - esac - # We check with `-c' and `-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle `-M -o', and we need to detect this. - if depmode=$depmode \ - source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ - depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ - $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ - >/dev/null 2>conftest.err && - grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - # icc doesn't choke on unknown options, it will just issue warnings - # or remarks (even with -Werror). So we grep stderr for any message - # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thusly: - # icc: Command line warning: ignoring option '-M'; no argument required - # The diagnosis changed in icc 8.0: - # icc: Command line remark: option '-MP' not supported - if (grep 'ignoring option' conftest.err || - grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else - am_cv_CXX_dependencies_compiler_type=$depmode - break - fi - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_CXX_dependencies_compiler_type=none -fi - -fi -{ echo "$as_me:$LINENO: result: $am_cv_CXX_dependencies_compiler_type" >&5 -echo "${ECHO_T}$am_cv_CXX_dependencies_compiler_type" >&6; } -CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type - - if - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then - am__fastdepCXX_TRUE= - am__fastdepCXX_FALSE='#' -else - am__fastdepCXX_TRUE='#' - am__fastdepCXX_FALSE= -fi - - -if test -n "$CXX" && ( test "X$CXX" != "Xno" && - ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || - (test "X$CXX" != "Xg++"))) ; then - ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -{ echo "$as_me:$LINENO: checking how to run the C++ preprocessor" >&5 -echo $ECHO_N "checking how to run the C++ preprocessor... $ECHO_C" >&6; } -if test -z "$CXXCPP"; then - if test "${ac_cv_prog_CXXCPP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # Double quotes because CXXCPP needs to be expanded - for CXXCPP in "$CXX -E" "/lib/cpp" - do - ac_preproc_ok=false -for ac_cxx_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || - test ! -s conftest.err - }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Broken: fails on valid input. -continue -fi - -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || - test ! -s conftest.err - }; then - # Broken: success on invalid input. -continue -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Passes both tests. -ac_preproc_ok=: -break -fi - -rm -f conftest.err conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then - break -fi - - done - ac_cv_prog_CXXCPP=$CXXCPP - -fi - CXXCPP=$ac_cv_prog_CXXCPP -else - ac_cv_prog_CXXCPP=$CXXCPP -fi -{ echo "$as_me:$LINENO: result: $CXXCPP" >&5 -echo "${ECHO_T}$CXXCPP" >&6; } -ac_preproc_ok=false -for ac_cxx_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || - test ! -s conftest.err - }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Broken: fails on valid input. -continue -fi - -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || - test ! -s conftest.err - }; then - # Broken: success on invalid input. -continue -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Passes both tests. -ac_preproc_ok=: -break -fi - -rm -f conftest.err conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then - : -else - _lt_caught_CXX_error=yes -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -else - _lt_caught_CXX_error=yes -fi - - - - -ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - -archive_cmds_need_lc_CXX=no -allow_undefined_flag_CXX= -always_export_symbols_CXX=no -archive_expsym_cmds_CXX= -compiler_needs_object_CXX=no -export_dynamic_flag_spec_CXX= -hardcode_direct_CXX=no -hardcode_direct_absolute_CXX=no -hardcode_libdir_flag_spec_CXX= -hardcode_libdir_flag_spec_ld_CXX= -hardcode_libdir_separator_CXX= -hardcode_minus_L_CXX=no -hardcode_shlibpath_var_CXX=unsupported -hardcode_automatic_CXX=no -inherit_rpath_CXX=no -module_cmds_CXX= -module_expsym_cmds_CXX= -link_all_deplibs_CXX=unknown -old_archive_cmds_CXX=$old_archive_cmds -no_undefined_flag_CXX= -whole_archive_flag_spec_CXX= -enable_shared_with_static_runtimes_CXX=no - -# Source file extension for C++ test sources. -ac_ext=cpp - -# Object file extension for compiled C++ test sources. -objext=o -objext_CXX=$objext - -# No sense in running all these tests if we already determined that -# the CXX compiler isn't working. Some variables (like enable_shared) -# are currently assumed to apply to all compilers on this platform, -# and will be corrupted by setting them based on a non-working compiler. -if test "$_lt_caught_CXX_error" != yes; then - # Code to be used in simple compile tests - lt_simple_compile_test_code="int some_variable = 0;" - - # Code to be used in simple link tests - lt_simple_link_test_code='int main(int, char *[]) { return(0); }' - - # ltmain only uses $CC for tagged configurations so make sure $CC is set. - - - - - - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# If no C compiler flags were specified, use CFLAGS. -LTCFLAGS=${LTCFLAGS-"$CFLAGS"} - -# Allow CC to be a program name with arguments. -compiler=$CC - - - # save warnings/boilerplate of simple test code - ac_outfile=conftest.$ac_objext -echo "$lt_simple_compile_test_code" >conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$RM conftest* - - ac_outfile=conftest.$ac_objext -echo "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$RM -r conftest* - - - # Allow CC to be a program name with arguments. - lt_save_CC=$CC - lt_save_LD=$LD - lt_save_GCC=$GCC - GCC=$GXX - lt_save_with_gnu_ld=$with_gnu_ld - lt_save_path_LD=$lt_cv_path_LD - if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then - lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx - else - $as_unset lt_cv_prog_gnu_ld - fi - if test -n "${lt_cv_path_LDCXX+set}"; then - lt_cv_path_LD=$lt_cv_path_LDCXX - else - $as_unset lt_cv_path_LD - fi - test -z "${LDCXX+set}" || LD=$LDCXX - CC=${CXX-"c++"} - compiler=$CC - compiler_CXX=$CC - for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` - - - if test -n "$compiler"; then - # We don't want -fno-exception when compiling C++ code, so set the - # no_builtin_flag separately - if test "$GXX" = yes; then - lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin' - else - lt_prog_compiler_no_builtin_flag_CXX= - fi - - if test "$GXX" = yes; then - # Set up default GNU C++ configuration - - - -# Check whether --with-gnu-ld was given. -if test "${with_gnu_ld+set}" = set; then - withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes -else - with_gnu_ld=no -fi - -ac_prog=ld -if test "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - { echo "$as_me:$LINENO: checking for ld used by $CC" >&5 -echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6; } - case $host in - *-*-mingw*) - # gcc leaves a trailing carriage return which upsets mingw - ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; - *) - ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; - esac - case $ac_prog in - # Accept absolute paths. - [\\/]* | ?:[\\/]*) - re_direlt='/[^/][^/]*/\.\./' - # Canonicalize the pathname of ld - ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` - while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do - ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` - done - test -z "$LD" && LD="$ac_prog" - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac -elif test "$with_gnu_ld" = yes; then - { echo "$as_me:$LINENO: checking for GNU ld" >&5 -echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6; } -else - { echo "$as_me:$LINENO: checking for non-GNU ld" >&5 -echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6; } -fi -if test "${lt_cv_path_LD+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -z "$LD"; then - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - lt_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some variants of GNU ld only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - case `"$lt_cv_path_LD" -v 2>&1 &5 -echo "${ECHO_T}$LD" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi -test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5 -echo "$as_me: error: no acceptable ld found in \$PATH" >&2;} - { (exit 1); exit 1; }; } -{ echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5 -echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6; } -if test "${lt_cv_prog_gnu_ld+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # I'd rather use --version here, but apparently some GNU lds only accept -v. -case `$LD -v 2>&1 &5 -echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6; } -with_gnu_ld=$lt_cv_prog_gnu_ld - - - - - - - - # Check if GNU C++ uses GNU ld as the underlying linker, since the - # archiving commands below assume that GNU ld is being used. - if test "$with_gnu_ld" = yes; then - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - - hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' - export_dynamic_flag_spec_CXX='${wl}--export-dynamic' - - # If archive_cmds runs LD, not CC, wlarc should be empty - # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to - # investigate it a little bit more. (MM) - wlarc='${wl}' - - # ancient GNU ld didn't support --whole-archive et. al. - if eval "`$CC -print-prog-name=ld` --help 2>&1" | - $GREP 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec_CXX= - fi - else - with_gnu_ld=no - wlarc= - - # A generic and very simple default shared library creation - # command for GNU C++ for the case where it uses the native - # linker, instead of GNU ld. If possible, this setting should - # overridden to take advantage of the native linker features on - # the platform it is being used on. - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' - fi - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' - - else - GXX=no - with_gnu_ld=no - wlarc= - fi - - # PORTME: fill in a description of your system's C++ link characteristics - { echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; } - ld_shlibs_CXX=yes - case $host_os in - aix3*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - aix[4-9]*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) - for ld_flag in $LDFLAGS; do - case $ld_flag in - *-brtl*) - aix_use_runtimelinking=yes - break - ;; - esac - done - ;; - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - archive_cmds_CXX='' - hardcode_direct_CXX=yes - hardcode_direct_absolute_CXX=yes - hardcode_libdir_separator_CXX=':' - link_all_deplibs_CXX=yes - file_list_spec_CXX='${wl}-f,' - - if test "$GXX" = yes; then - case $host_os in aix4.[012]|aix4.[012].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && - strings "$collect2name" | $GREP resolve_lib_name >/dev/null - then - # We have reworked collect2 - : - else - # We have old collect2 - hardcode_direct_CXX=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - hardcode_minus_L_CXX=yes - hardcode_libdir_flag_spec_CXX='-L$libdir' - hardcode_libdir_separator_CXX= - fi - esac - shared_flag='-shared' - if test "$aix_use_runtimelinking" = yes; then - shared_flag="$shared_flag "'${wl}-G' - fi - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to - # export. - always_export_symbols_CXX=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - allow_undefined_flag_CXX='-berok' - # Determine the default libpath from the value encoded in an empty - # executable. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_cxx_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - -lt_aix_libpath_sed=' - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\(.*\)$/\1/ - p - } - }' -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then - aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" - - archive_expsym_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib' - allow_undefined_flag_CXX="-z nodefs" - archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an - # empty executable. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_cxx_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - -lt_aix_libpath_sed=' - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\(.*\)$/\1/ - p - } - }' -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then - aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - no_undefined_flag_CXX=' ${wl}-bernotok' - allow_undefined_flag_CXX=' ${wl}-berok' - # Exported symbols can be pulled into shared objects from archives - whole_archive_flag_spec_CXX='$convenience' - archive_cmds_need_lc_CXX=yes - # This is similar to how AIX traditionally builds its shared - # libraries. - archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - beos*) - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - allow_undefined_flag_CXX=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - archive_cmds_CXX='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - ld_shlibs_CXX=no - fi - ;; - - chorus*) - case $cc_basename in - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - ;; - - cygwin* | mingw* | pw32*) - # _LT_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless, - # as there is no search path for DLLs. - hardcode_libdir_flag_spec_CXX='-L$libdir' - allow_undefined_flag_CXX=unsupported - always_export_symbols_CXX=no - enable_shared_with_static_runtimes_CXX=yes - - if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - else - ld_shlibs_CXX=no - fi - ;; - darwin* | rhapsody*) - - - archive_cmds_need_lc_CXX=no - hardcode_direct_CXX=no - hardcode_automatic_CXX=yes - hardcode_shlibpath_var_CXX=unsupported - whole_archive_flag_spec_CXX='' - link_all_deplibs_CXX=yes - allow_undefined_flag_CXX="$_lt_dar_allow_undefined" - if test "$GCC" = "yes"; then - output_verbose_link_cmd=echo - archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" - module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" - archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" - module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" - if test "$lt_cv_apple_cc_single_mod" != "yes"; then - archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" - archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" - fi - - else - ld_shlibs_CXX=no - fi - - ;; - - dgux*) - case $cc_basename in - ec++*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - ghcx*) - # Green Hills C++ Compiler - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - ;; - - freebsd[12]*) - # C++ shared libraries reported to be fairly broken before - # switch to ELF - ld_shlibs_CXX=no - ;; - - freebsd-elf*) - archive_cmds_need_lc_CXX=no - ;; - - freebsd* | dragonfly*) - # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF - # conventions - ld_shlibs_CXX=yes - ;; - - gnu*) - ;; - - hpux9*) - hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' - hardcode_libdir_separator_CXX=: - export_dynamic_flag_spec_CXX='${wl}-E' - hardcode_direct_CXX=yes - hardcode_minus_L_CXX=yes # Not in the search PATH, - # but as the default - # location of the library. - - case $cc_basename in - CC*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - aCC*) - archive_cmds_CXX='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' - ;; - *) - if test "$GXX" = yes; then - archive_cmds_CXX='$RM $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - fi - ;; - esac - ;; - - hpux10*|hpux11*) - if test $with_gnu_ld = no; then - hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' - hardcode_libdir_separator_CXX=: - - case $host_cpu in - hppa*64*|ia64*) - ;; - *) - export_dynamic_flag_spec_CXX='${wl}-E' - ;; - esac - fi - case $host_cpu in - hppa*64*|ia64*) - hardcode_direct_CXX=no - hardcode_shlibpath_var_CXX=no - ;; - *) - hardcode_direct_CXX=yes - hardcode_direct_absolute_CXX=yes - hardcode_minus_L_CXX=yes # Not in the search PATH, - # but as the default - # location of the library. - ;; - esac - - case $cc_basename in - CC*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - aCC*) - case $host_cpu in - hppa*64*) - archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - ia64*) - archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - *) - archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' - ;; - *) - if test "$GXX" = yes; then - if test $with_gnu_ld = no; then - case $host_cpu in - hppa*64*) - archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - ia64*) - archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - *) - archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - fi - else - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - fi - ;; - esac - ;; - - interix[3-9]*) - hardcode_direct_CXX=no - hardcode_shlibpath_var_CXX=no - hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' - export_dynamic_flag_spec_CXX='${wl}-E' - # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. - # Instead, shared libraries are loaded at an image base (0x10000000 by - # default) and relocated if they conflict, which is a slow very memory - # consuming and fragmenting process. To avoid this, we pick a random, - # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link - # time. Moving up from 0x10000000 also allows more sbrk(2) space. - archive_cmds_CXX='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - archive_expsym_cmds_CXX='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - ;; - irix5* | irix6*) - case $cc_basename in - CC*) - # SGI C++ - archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' - - # Archives containing C++ object files must be created using - # "CC -ar", where "CC" is the IRIX C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs' - ;; - *) - if test "$GXX" = yes; then - if test "$with_gnu_ld" = no; then - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` -o $lib' - fi - fi - link_all_deplibs_CXX=yes - ;; - esac - hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_CXX=: - inherit_rpath_CXX=yes - ;; - - linux* | k*bsd*-gnu) - case $cc_basename in - KCC*) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' - - hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' - export_dynamic_flag_spec_CXX='${wl}--export-dynamic' - - # Archives containing C++ object files must be created using - # "CC -Bstatic", where "CC" is the KAI C++ compiler. - old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' - ;; - icpc* | ecpc* ) - # Intel C++ - with_gnu_ld=yes - # version 8.0 and above of icpc choke on multiply defined symbols - # if we add $predep_objects and $postdep_objects, however 7.1 and - # earlier do not add the objects themselves. - case `$CC -V 2>&1` in - *"Version 7."*) - archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - ;; - *) # Version 8.0 or newer - tmp_idyn= - case $host_cpu in - ia64*) tmp_idyn=' -i_dynamic';; - esac - archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - ;; - esac - archive_cmds_need_lc_CXX=no - hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' - export_dynamic_flag_spec_CXX='${wl}--export-dynamic' - whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive' - ;; - pgCC* | pgcpp*) - # Portland Group C++ compiler - case `$CC -V` in - *pgCC\ [1-5]* | *pgcpp\ [1-5]*) - prelink_cmds_CXX='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ - compile_command="$compile_command `find $tpldir -name \*.o | $NL2SP`"' - old_archive_cmds_CXX='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ - $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | $NL2SP`~ - $RANLIB $oldlib' - archive_cmds_CXX='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ - $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' - archive_expsym_cmds_CXX='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ - $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' - ;; - *) # Version 6 will use weak symbols - archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' - ;; - esac - - hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec_CXX='${wl}--export-dynamic' - whole_archive_flag_spec_CXX='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' - ;; - cxx*) - # Compaq C++ - archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' - - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec_CXX='-rpath $libdir' - hardcode_libdir_separator_CXX=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' - ;; - xl*) - # IBM XL 8.0 on PPC, with GNU ld - hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' - export_dynamic_flag_spec_CXX='${wl}--export-dynamic' - archive_cmds_CXX='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - if test "x$supports_anon_versioning" = xyes; then - archive_expsym_cmds_CXX='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - fi - ;; - *) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) - # Sun C++ 5.9 - no_undefined_flag_CXX=' -zdefs' - archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - archive_expsym_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' - hardcode_libdir_flag_spec_CXX='-R$libdir' - whole_archive_flag_spec_CXX='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' - compiler_needs_object_CXX=yes - - # Not sure whether something based on - # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 - # would be better. - output_verbose_link_cmd='echo' - - # Archives containing C++ object files must be created using - # "CC -xar", where "CC" is the Sun C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' - ;; - esac - ;; - esac - ;; - - lynxos*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - - m88k*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - - mvs*) - case $cc_basename in - cxx*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - archive_cmds_CXX='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' - wlarc= - hardcode_libdir_flag_spec_CXX='-R$libdir' - hardcode_direct_CXX=yes - hardcode_shlibpath_var_CXX=no - fi - # Workaround some broken pre-1.5 toolchains - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' - ;; - - *nto* | *qnx*) - ld_shlibs_CXX=yes - ;; - - openbsd2*) - # C++ shared libraries are fairly broken - ld_shlibs_CXX=no - ;; - - openbsd*) - if test -f /usr/libexec/ld.so; then - hardcode_direct_CXX=yes - hardcode_shlibpath_var_CXX=no - hardcode_direct_absolute_CXX=yes - archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' - hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' - export_dynamic_flag_spec_CXX='${wl}-E' - whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - fi - output_verbose_link_cmd=echo - else - ld_shlibs_CXX=no - fi - ;; - - osf3* | osf4* | osf5*) - case $cc_basename in - KCC*) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - - hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' - hardcode_libdir_separator_CXX=: - - # Archives containing C++ object files must be created using - # the KAI C++ compiler. - case $host in - osf3*) old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; - *) old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' ;; - esac - ;; - RCC*) - # Rational C++ 2.4.1 - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - cxx*) - case $host in - osf3*) - allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && $ECHO "X${wl}-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' - ;; - *) - allow_undefined_flag_CXX=' -expect_unresolved \*' - archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' - archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ - echo "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~ - $RM $lib.exp' - hardcode_libdir_flag_spec_CXX='-rpath $libdir' - ;; - esac - - hardcode_libdir_separator_CXX=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' - ;; - *) - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' - case $host in - osf3*) - archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - ;; - *) - archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - ;; - esac - - hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_CXX=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' - - else - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - fi - ;; - esac - ;; - - psos*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - - sunos4*) - case $cc_basename in - CC*) - # Sun C++ 4.x - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - lcc*) - # Lucid - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - ;; - - solaris*) - case $cc_basename in - CC*) - # Sun C++ 4.2, 5.x and Centerline C++ - archive_cmds_need_lc_CXX=yes - no_undefined_flag_CXX=' -zdefs' - archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' - - hardcode_libdir_flag_spec_CXX='-R$libdir' - hardcode_shlibpath_var_CXX=no - case $host_os in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) - # The compiler driver will combine and reorder linker options, - # but understands `-z linker_flag'. - # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec_CXX='-z allextract$convenience -z defaultextract' - ;; - esac - link_all_deplibs_CXX=yes - - output_verbose_link_cmd='echo' - - # Archives containing C++ object files must be created using - # "CC -xar", where "CC" is the Sun C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' - ;; - gcx*) - # Green Hills C++ Compiler - archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - - # The C++ compiler must be used to create the archive. - old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs' - ;; - *) - # GNU C++ compiler with Solaris linker - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - no_undefined_flag_CXX=' ${wl}-z ${wl}defs' - if $CC --version | $GREP -v '^2\.7' > /dev/null; then - archive_cmds_CXX='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' - else - # g++ 2.7 appears to require `-G' NOT `-shared' on this - # platform. - archive_cmds_CXX='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' - fi - - hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir' - case $host_os in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) - whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' - ;; - esac - fi - ;; - esac - ;; - - sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) - no_undefined_flag_CXX='${wl}-z,text' - archive_cmds_need_lc_CXX=no - hardcode_shlibpath_var_CXX=no - runpath_var='LD_RUN_PATH' - - case $cc_basename in - CC*) - archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - ;; - - sysv5* | sco3.2v5* | sco5v6*) - # Note: We can NOT use -z defs as we might desire, because we do not - # link with -lc, and that would cause any symbols used from libc to - # always be unresolved, which means just about no library would - # ever link correctly. If we're not using GNU ld we use -z text - # though, which does catch some bad symbols but isn't as heavy-handed - # as -z defs. - no_undefined_flag_CXX='${wl}-z,text' - allow_undefined_flag_CXX='${wl}-z,nodefs' - archive_cmds_need_lc_CXX=no - hardcode_shlibpath_var_CXX=no - hardcode_libdir_flag_spec_CXX='${wl}-R,$libdir' - hardcode_libdir_separator_CXX=':' - link_all_deplibs_CXX=yes - export_dynamic_flag_spec_CXX='${wl}-Bexport' - runpath_var='LD_RUN_PATH' - - case $cc_basename in - CC*) - archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - ;; - - tandem*) - case $cc_basename in - NCC*) - # NonStop-UX NCC 3.20 - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - ;; - - vxworks*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - - { echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5 -echo "${ECHO_T}$ld_shlibs_CXX" >&6; } - test "$ld_shlibs_CXX" = no && can_build_shared=no - - GCC_CXX="$GXX" - LD_CXX="$LD" - - ## CAVEAT EMPTOR: - ## There is no encapsulation within the following macros, do not change - ## the running order or otherwise move them around unless you know exactly - ## what you are doing... - # Dependencies to place before and after the object being linked: -predep_objects_CXX= -postdep_objects_CXX= -predeps_CXX= -postdeps_CXX= -compiler_lib_search_path_CXX= - -cat > conftest.$ac_ext <<_LT_EOF -class Foo -{ -public: - Foo (void) { a = 0; } -private: - int a; -}; -_LT_EOF - -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # Parse the compiler output and extract the necessary - # objects, libraries and library flags. - - # Sentinel used to keep track of whether or not we are before - # the conftest object file. - pre_test_object_deps_done=no - - for p in `eval "$output_verbose_link_cmd"`; do - case $p in - - -L* | -R* | -l*) - # Some compilers place space between "-{L,R}" and the path. - # Remove the space. - if test $p = "-L" || - test $p = "-R"; then - prev=$p - continue - else - prev= - fi - - if test "$pre_test_object_deps_done" = no; then - case $p in - -L* | -R*) - # Internal compiler library paths should come after those - # provided the user. The postdeps already come after the - # user supplied libs so there is no need to process them. - if test -z "$compiler_lib_search_path_CXX"; then - compiler_lib_search_path_CXX="${prev}${p}" - else - compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} ${prev}${p}" - fi - ;; - # The "-l" case would never come before the object being - # linked, so don't bother handling this case. - esac - else - if test -z "$postdeps_CXX"; then - postdeps_CXX="${prev}${p}" - else - postdeps_CXX="${postdeps_CXX} ${prev}${p}" - fi - fi - ;; - - *.$objext) - # This assumes that the test object file only shows up - # once in the compiler output. - if test "$p" = "conftest.$objext"; then - pre_test_object_deps_done=yes - continue - fi - - if test "$pre_test_object_deps_done" = no; then - if test -z "$predep_objects_CXX"; then - predep_objects_CXX="$p" - else - predep_objects_CXX="$predep_objects_CXX $p" - fi - else - if test -z "$postdep_objects_CXX"; then - postdep_objects_CXX="$p" - else - postdep_objects_CXX="$postdep_objects_CXX $p" - fi - fi - ;; - - *) ;; # Ignore the rest. - - esac - done - - # Clean up. - rm -f a.out a.exe -else - echo "libtool.m4: error: problem compiling CXX test program" -fi - -$RM -f confest.$objext - -# PORTME: override above test on systems where it is broken -case $host_os in -interix[3-9]*) - # Interix 3.5 installs completely hosed .la files for C++, so rather than - # hack all around it, let's just trust "g++" to DTRT. - predep_objects_CXX= - postdep_objects_CXX= - postdeps_CXX= - ;; - -linux*) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) - # Sun C++ 5.9 - - # The more standards-conforming stlport4 library is - # incompatible with the Cstd library. Avoid specifying - # it if it's in CXXFLAGS. Ignore libCrun as - # -library=stlport4 depends on it. - case " $CXX $CXXFLAGS " in - *" -library=stlport4 "*) - solaris_use_stlport4=yes - ;; - esac - - if test "$solaris_use_stlport4" != yes; then - postdeps_CXX='-library=Cstd -library=Crun' - fi - ;; - esac - ;; - -solaris*) - case $cc_basename in - CC*) - # The more standards-conforming stlport4 library is - # incompatible with the Cstd library. Avoid specifying - # it if it's in CXXFLAGS. Ignore libCrun as - # -library=stlport4 depends on it. - case " $CXX $CXXFLAGS " in - *" -library=stlport4 "*) - solaris_use_stlport4=yes - ;; - esac - - # Adding this requires a known-good setup of shared libraries for - # Sun compiler versions before 5.6, else PIC objects from an old - # archive will be linked into the output, leading to subtle bugs. - if test "$solaris_use_stlport4" != yes; then - postdeps_CXX='-library=Cstd -library=Crun' - fi - ;; - esac - ;; -esac - - -case " $postdeps_CXX " in -*" -lc "*) archive_cmds_need_lc_CXX=no ;; -esac - compiler_lib_search_dirs_CXX= -if test -n "${compiler_lib_search_path_CXX}"; then - compiler_lib_search_dirs_CXX=`echo " ${compiler_lib_search_path_CXX}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` -fi - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - lt_prog_compiler_wl_CXX= -lt_prog_compiler_pic_CXX= -lt_prog_compiler_static_CXX= - -{ echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 -echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; } - - # C++ specific cases for pic, static, wl, etc. - if test "$GXX" = yes; then - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_static_CXX='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static_CXX='-Bstatic' - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - lt_prog_compiler_pic_CXX='-fPIC' - ;; - m68k) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4' - ;; - esac - ;; - - beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - mingw* | cygwin* | os2* | pw32*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - # Although the cygwin gcc ignores -fPIC, still need this for old-style - # (--disable-auto-import) libraries - lt_prog_compiler_pic_CXX='-DDLL_EXPORT' - ;; - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - lt_prog_compiler_pic_CXX='-fno-common' - ;; - *djgpp*) - # DJGPP does not support shared libraries at all - lt_prog_compiler_pic_CXX= - ;; - interix[3-9]*) - # Interix 3.x gcc -fpic/-fPIC options generate broken code. - # Instead, we relocate shared libraries at runtime. - ;; - sysv4*MP*) - if test -d /usr/nec; then - lt_prog_compiler_pic_CXX=-Kconform_pic - fi - ;; - hpux*) - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case $host_cpu in - hppa*64*|ia64*) - ;; - *) - lt_prog_compiler_pic_CXX='-fPIC' - ;; - esac - ;; - *qnx* | *nto*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - lt_prog_compiler_pic_CXX='-fPIC -shared' - ;; - *) - lt_prog_compiler_pic_CXX='-fPIC' - ;; - esac - else - case $host_os in - aix[4-9]*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static_CXX='-Bstatic' - else - lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp' - fi - ;; - chorus*) - case $cc_basename in - cxch68*) - # Green Hills C++ Compiler - # _LT_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" - ;; - esac - ;; - dgux*) - case $cc_basename in - ec++*) - lt_prog_compiler_pic_CXX='-KPIC' - ;; - ghcx*) - # Green Hills C++ Compiler - lt_prog_compiler_pic_CXX='-pic' - ;; - *) - ;; - esac - ;; - freebsd* | dragonfly*) - # FreeBSD uses GNU C++ - ;; - hpux9* | hpux10* | hpux11*) - case $cc_basename in - CC*) - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_static_CXX='${wl}-a ${wl}archive' - if test "$host_cpu" != ia64; then - lt_prog_compiler_pic_CXX='+Z' - fi - ;; - aCC*) - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_static_CXX='${wl}-a ${wl}archive' - case $host_cpu in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic_CXX='+Z' - ;; - esac - ;; - *) - ;; - esac - ;; - interix*) - # This is c89, which is MS Visual C++ (no shared libs) - # Anyone wants to do a port? - ;; - irix5* | irix6* | nonstopux*) - case $cc_basename in - CC*) - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_static_CXX='-non_shared' - # CC pic flag -KPIC is the default. - ;; - *) - ;; - esac - ;; - linux* | k*bsd*-gnu) - case $cc_basename in - KCC*) - # KAI C++ Compiler - lt_prog_compiler_wl_CXX='--backend -Wl,' - lt_prog_compiler_pic_CXX='-fPIC' - ;; - icpc* | ecpc* ) - # Intel C++ - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_pic_CXX='-KPIC' - lt_prog_compiler_static_CXX='-static' - ;; - pgCC* | pgcpp*) - # Portland Group C++ compiler - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_pic_CXX='-fpic' - lt_prog_compiler_static_CXX='-Bstatic' - ;; - cxx*) - # Compaq C++ - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - lt_prog_compiler_pic_CXX= - lt_prog_compiler_static_CXX='-non_shared' - ;; - xlc* | xlC*) - # IBM XL 8.0 on PPC - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_pic_CXX='-qpic' - lt_prog_compiler_static_CXX='-qstaticlink' - ;; - *) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) - # Sun C++ 5.9 - lt_prog_compiler_pic_CXX='-KPIC' - lt_prog_compiler_static_CXX='-Bstatic' - lt_prog_compiler_wl_CXX='-Qoption ld ' - ;; - esac - ;; - esac - ;; - lynxos*) - ;; - m88k*) - ;; - mvs*) - case $cc_basename in - cxx*) - lt_prog_compiler_pic_CXX='-W c,exportall' - ;; - *) - ;; - esac - ;; - netbsd* | netbsdelf*-gnu) - ;; - *qnx* | *nto*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - lt_prog_compiler_pic_CXX='-fPIC -shared' - ;; - osf3* | osf4* | osf5*) - case $cc_basename in - KCC*) - lt_prog_compiler_wl_CXX='--backend -Wl,' - ;; - RCC*) - # Rational C++ 2.4.1 - lt_prog_compiler_pic_CXX='-pic' - ;; - cxx*) - # Digital/Compaq C++ - lt_prog_compiler_wl_CXX='-Wl,' - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - lt_prog_compiler_pic_CXX= - lt_prog_compiler_static_CXX='-non_shared' - ;; - *) - ;; - esac - ;; - psos*) - ;; - solaris*) - case $cc_basename in - CC*) - # Sun C++ 4.2, 5.x and Centerline C++ - lt_prog_compiler_pic_CXX='-KPIC' - lt_prog_compiler_static_CXX='-Bstatic' - lt_prog_compiler_wl_CXX='-Qoption ld ' - ;; - gcx*) - # Green Hills C++ Compiler - lt_prog_compiler_pic_CXX='-PIC' - ;; - *) - ;; - esac - ;; - sunos4*) - case $cc_basename in - CC*) - # Sun C++ 4.x - lt_prog_compiler_pic_CXX='-pic' - lt_prog_compiler_static_CXX='-Bstatic' - ;; - lcc*) - # Lucid - lt_prog_compiler_pic_CXX='-pic' - ;; - *) - ;; - esac - ;; - sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) - case $cc_basename in - CC*) - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_pic_CXX='-KPIC' - lt_prog_compiler_static_CXX='-Bstatic' - ;; - esac - ;; - tandem*) - case $cc_basename in - NCC*) - # NonStop-UX NCC 3.20 - lt_prog_compiler_pic_CXX='-KPIC' - ;; - *) - ;; - esac - ;; - vxworks*) - ;; - *) - lt_prog_compiler_can_build_shared_CXX=no - ;; - esac - fi - -case $host_os in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - lt_prog_compiler_pic_CXX= - ;; - *) - lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC" - ;; -esac -{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_CXX" >&5 -echo "${ECHO_T}$lt_prog_compiler_pic_CXX" >&6; } - - - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$lt_prog_compiler_pic_CXX"; then - { echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5 -echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... $ECHO_C" >&6; } -if test "${lt_cv_prog_compiler_pic_works_CXX+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_cv_prog_compiler_pic_works_CXX=no - ac_outfile=conftest.$ac_objext - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14952: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:14956: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then - lt_cv_prog_compiler_pic_works_CXX=yes - fi - fi - $RM conftest* - -fi -{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_pic_works_CXX" >&5 -echo "${ECHO_T}$lt_cv_prog_compiler_pic_works_CXX" >&6; } - -if test x"$lt_cv_prog_compiler_pic_works_CXX" = xyes; then - case $lt_prog_compiler_pic_CXX in - "" | " "*) ;; - *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;; - esac -else - lt_prog_compiler_pic_CXX= - lt_prog_compiler_can_build_shared_CXX=no -fi - -fi - - - -# -# Check to make sure the static flag actually works. -# -wl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\"$lt_prog_compiler_static_CXX\" -{ echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5 -echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; } -if test "${lt_cv_prog_compiler_static_works_CXX+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_cv_prog_compiler_static_works_CXX=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $lt_tmp_static_flag" - echo "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The linker can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - # Append any errors to the config.log. - cat conftest.err 1>&5 - $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if diff conftest.exp conftest.er2 >/dev/null; then - lt_cv_prog_compiler_static_works_CXX=yes - fi - else - lt_cv_prog_compiler_static_works_CXX=yes - fi - fi - $RM -r conftest* - LDFLAGS="$save_LDFLAGS" - -fi -{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_static_works_CXX" >&5 -echo "${ECHO_T}$lt_cv_prog_compiler_static_works_CXX" >&6; } - -if test x"$lt_cv_prog_compiler_static_works_CXX" = xyes; then - : -else - lt_prog_compiler_static_CXX= -fi - - - - - { echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 -echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; } -if test "${lt_cv_prog_compiler_c_o_CXX+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_cv_prog_compiler_c_o_CXX=no - $RM -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15051: $lt_compile\"" >&5) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&5 - echo "$as_me:15055: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp - $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then - lt_cv_prog_compiler_c_o_CXX=yes - fi - fi - chmod u+w . 2>&5 - $RM conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files - $RM out/* && rmdir out - cd .. - $RM -r conftest - $RM conftest* - -fi -{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_CXX" >&5 -echo "${ECHO_T}$lt_cv_prog_compiler_c_o_CXX" >&6; } - - - - { echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 -echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; } -if test "${lt_cv_prog_compiler_c_o_CXX+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_cv_prog_compiler_c_o_CXX=no - $RM -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15103: $lt_compile\"" >&5) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&5 - echo "$as_me:15107: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp - $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then - lt_cv_prog_compiler_c_o_CXX=yes - fi - fi - chmod u+w . 2>&5 - $RM conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files - $RM out/* && rmdir out - cd .. - $RM -r conftest - $RM conftest* - -fi -{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_CXX" >&5 -echo "${ECHO_T}$lt_cv_prog_compiler_c_o_CXX" >&6; } - - - - -hard_links="nottested" -if test "$lt_cv_prog_compiler_c_o_CXX" = no && test "$need_locks" != no; then - # do not overwrite the value of need_locks provided by the user - { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 -echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6; } - hard_links=yes - $RM conftest* - ln conftest.a conftest.b 2>/dev/null && hard_links=no - touch conftest.a - ln conftest.a conftest.b 2>&5 || hard_links=no - ln conftest.a conftest.b 2>/dev/null && hard_links=no - { echo "$as_me:$LINENO: result: $hard_links" >&5 -echo "${ECHO_T}$hard_links" >&6; } - if test "$hard_links" = no; then - { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 -echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} - need_locks=warn - fi -else - need_locks=no -fi - - - - { echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; } - - export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - case $host_os in - aix[4-9]*) - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then - export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' - else - export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' - fi - ;; - pw32*) - export_symbols_cmds_CXX="$ltdll_cmds" - ;; - cygwin* | mingw*) - export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;/^.*[ ]__nm__/s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' - ;; - linux* | k*bsd*-gnu) - link_all_deplibs_CXX=no - ;; - *) - export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - ;; - esac - exclude_expsyms_CXX='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' - -{ echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5 -echo "${ECHO_T}$ld_shlibs_CXX" >&6; } -test "$ld_shlibs_CXX" = no && can_build_shared=no - -with_gnu_ld_CXX=$with_gnu_ld - - - - - - -# -# Do we need to explicitly link libc? -# -case "x$archive_cmds_need_lc_CXX" in -x|xyes) - # Assume -lc should be added - archive_cmds_need_lc_CXX=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $archive_cmds_CXX in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 -echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; } - $RM conftest* - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$lt_prog_compiler_wl_CXX - pic_flag=$lt_prog_compiler_pic_CXX - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$allow_undefined_flag_CXX - allow_undefined_flag_CXX= - if { (eval echo "$as_me:$LINENO: \"$archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\"") >&5 - (eval $archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - then - archive_cmds_need_lc_CXX=no - else - archive_cmds_need_lc_CXX=yes - fi - allow_undefined_flag_CXX=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $RM conftest* - { echo "$as_me:$LINENO: result: $archive_cmds_need_lc_CXX" >&5 -echo "${ECHO_T}$archive_cmds_need_lc_CXX" >&6; } - ;; - esac - fi - ;; -esac - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 -echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6; } - -library_names_spec= -libname_spec='lib$name' -soname_spec= -shrext_cmds=".so" -postinstall_cmds= -postuninstall_cmds= -finish_cmds= -finish_eval= -shlibpath_var= -shlibpath_overrides_runpath=unknown -version_type=none -dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown - -case $host_os in -aix3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' - shlibpath_var=LIBPATH - - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' - ;; - -aix[4-9]*) - version_type=linux - need_lib_prefix=no - need_version=no - hardcode_into_libs=yes - if test "$host_cpu" = ia64; then - # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - else - # With GCC up to 2.95.x, collect2 would create an import file - # for dependence libraries. The import file would start with - # the line `#! .'. This would cause the generated library to - # depend on `.', always an invalid library. This was fixed in - # development snapshots of GCC prior to 3.0. - case $host_os in - aix4 | aix4.[01] | aix4.[01].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; - esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. - if test "$aix_use_runtimelinking" = yes; then - # If using run time linking (on AIX 4.2 or later) use lib.so - # instead of lib.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - else - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' - fi - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - case $host_cpu in - powerpc) - # Since July 2007 AmigaOS4 officially supports .so libraries. - # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - ;; - m68k) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' - ;; - esac - ;; - -beos*) - library_names_spec='${libname}${shared_ext}' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - ;; - -bsdi[45]*) - version_type=linux - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" - sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - # the default ld.so.conf also contains /usr/contrib/lib and - # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow - # libtool to hard-code these into programs - ;; - -cygwin* | mingw* | pw32*) - version_type=windows - shrext_cmds=".dll" - need_version=no - need_lib_prefix=no - - case $GCC,$host_os in - yes,cygwin* | yes,mingw* | yes,pw32*) - library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname~ - chmod a+x \$dldir/$dlname~ - if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then - eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; - fi' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $RM \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" - ;; - mingw*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then - # It is most probably a Windows format PATH printed by - # mingw gcc, but we are running on Cygwin. Gcc prints its search - # path with ; separators, and with drive letters. We can handle the - # drive letters (cygwin fileutils understands them), so leave them, - # especially as we might pass files found there to a mingw objdump, - # which wouldn't understand a cygwinified path. Ahh. - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - ;; - esac - ;; - - *) - library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' - ;; - esac - dynamic_linker='Win32 ld.exe' - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - ;; - -darwin* | rhapsody*) - dynamic_linker="$host_os dyld" - version_type=darwin - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' - shlibpath_overrides_runpath=yes - shlibpath_var=DYLD_LIBRARY_PATH - shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' - - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -freebsd1*) - dynamic_linker=no - ;; - -freebsd* | dragonfly*) - # DragonFly does not have aout. When/if they implement a new - # versioning mechanism, adjust this. - if test -x /usr/bin/objformat; then - objformat=`/usr/bin/objformat` - else - case $host_os in - freebsd[123]*) objformat=aout ;; - *) objformat=elf ;; - esac - fi - version_type=freebsd-$objformat - case $version_type in - freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case $host_os in - freebsd2*) - shlibpath_overrides_runpath=yes - ;; - freebsd3.[01]* | freebsdelf3.[01]*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ - freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - *) # from 4.6 on, and DragonFly - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - esac - ;; - -gnu*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - hardcode_into_libs=yes - ;; - -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - version_type=sunos - need_lib_prefix=no - need_version=no - case $host_cpu in - ia64*) - shrext_cmds='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - if test "X$HPUX_IA64_MODE" = X32; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - hppa*64*) - shrext_cmds='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext_cmds='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - ;; - esac - # HP-UX runs *really* slowly unless shared libraries are mode 555. - postinstall_cmds='chmod 555 $lib' - ;; - -interix[3-9]*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -irix5* | irix6* | nonstopux*) - case $host_os in - nonstopux*) version_type=nonstopux ;; - *) - if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux - else - version_type=irix - fi ;; - esac - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' - case $host_os in - irix5* | nonstopux*) - libsuff= shlibsuff= - ;; - *) - case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; - esac - ;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" - sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - hardcode_into_libs=yes - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) - dynamic_linker=no - ;; - -# This must be Linux ELF. -linux* | k*bsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - # Some binutils ld are patched to set DT_RUNPATH - save_LDFLAGS=$LDFLAGS - save_libdir=$libdir - eval "libdir=/foo; wl=\"$lt_prog_compiler_wl_CXX\"; \ - LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec_CXX\"" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_cxx_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then - shlibpath_overrides_runpath=yes -fi - -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext - LDFLAGS=$save_LDFLAGS - libdir=$save_libdir - - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - # Append ld.so.conf contents to the search path - if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" - fi - - # We used to test for /lib/ld.so.1 and disable shared libraries on - # powerpc, because MkLinux only supported shared libraries with the - # GNU dynamic linker. Since this was broken with cross compilers, - # most powerpc-linux boxes support dynamic linking these days and - # people can always --disable-shared, the test was removed, and we - # assume the GNU/Linux dynamic linker is in use. - dynamic_linker='GNU/Linux ld.so' - ;; - -netbsdelf*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='NetBSD ld.elf_so' - ;; - -netbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='NetBSD ld.elf_so' - fi - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - -newsos6) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -*nto* | *qnx*) - version_type=qnx - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='ldqnx.so' - ;; - -openbsd*) - version_type=sunos - sys_lib_dlsearch_path_spec="/usr/lib" - need_lib_prefix=no - # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. - case $host_os in - openbsd3.3 | openbsd3.3.*) need_version=yes ;; - *) need_version=no ;; - esac - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case $host_os in - openbsd2.[89] | openbsd2.[89].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac - else - shlibpath_overrides_runpath=yes - fi - ;; - -os2*) - libname_spec='$name' - shrext_cmds=".dll" - need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=LIBPATH - ;; - -osf3* | osf4* | osf5*) - version_type=osf - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - ;; - -rdos*) - dynamic_linker=no - ;; - -solaris*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - ;; - -sunos4*) - version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - if test "$with_gnu_ld" = yes; then - need_lib_prefix=no - fi - need_version=yes - ;; - -sysv4 | sysv4.3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - case $host_vendor in - sni) - shlibpath_overrides_runpath=no - need_lib_prefix=no - runpath_var=LD_RUN_PATH - ;; - siemens) - need_lib_prefix=no - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - ;; - esac - ;; - -sysv4*MP*) - if test -d /usr/nec ;then - version_type=linux - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; - -sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - version_type=freebsd-elf - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - if test "$with_gnu_ld" = yes; then - sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' - else - sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' - case $host_os in - sco3.2v5*) - sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" - ;; - esac - fi - sys_lib_dlsearch_path_spec='/usr/lib' - ;; - -tpf*) - # TPF is a cross-target only. Preferred cross-host = GNU/Linux. - version_type=linux - need_lib_prefix=no - need_version=no - library_name_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -uts4*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -*) - dynamic_linker=no - ;; -esac -{ echo "$as_me:$LINENO: result: $dynamic_linker" >&5 -echo "${ECHO_T}$dynamic_linker" >&6; } -test "$dynamic_linker" = no && can_build_shared=no - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - -if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then - sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" -fi -if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then - sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" -fi - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 -echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; } -hardcode_action_CXX= -if test -n "$hardcode_libdir_flag_spec_CXX" || - test -n "$runpath_var_CXX" || - test "X$hardcode_automatic_CXX" = "Xyes" ; then - - # We can hardcode non-existent directories. - if test "$hardcode_direct_CXX" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$_LT_TAGVAR(hardcode_shlibpath_var, CXX)" != no && - test "$hardcode_minus_L_CXX" != no; then - # Linking always hardcodes the temporary library directory. - hardcode_action_CXX=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - hardcode_action_CXX=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - hardcode_action_CXX=unsupported -fi -{ echo "$as_me:$LINENO: result: $hardcode_action_CXX" >&5 -echo "${ECHO_T}$hardcode_action_CXX" >&6; } - -if test "$hardcode_action_CXX" = relink || - test "$inherit_rpath_CXX" = yes; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi - - - - - - - - fi # test -n "$compiler" - - CC=$lt_save_CC - LDCXX=$LD - LD=$lt_save_LD - GCC=$lt_save_GCC - with_gnu_ld=$lt_save_with_gnu_ld - lt_cv_path_LDCXX=$lt_cv_path_LD - lt_cv_path_LD=$lt_save_path_LD - lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld - lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld -fi # test "$_lt_caught_CXX_error" != yes - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - - -# Extract the first word of "lsb_release", so it can be a program name with args. -set dummy lsb_release; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_path_LSB_RELEASE+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case $LSB_RELEASE in - [\\/]* | ?:[\\/]*) - ac_cv_path_LSB_RELEASE="$LSB_RELEASE" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_path_LSB_RELEASE="$as_dir/$ac_word$ac_exec_ext" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - - test -z "$ac_cv_path_LSB_RELEASE" && ac_cv_path_LSB_RELEASE="no" - ;; -esac -fi -LSB_RELEASE=$ac_cv_path_LSB_RELEASE -if test -n "$LSB_RELEASE"; then - { echo "$as_me:$LINENO: result: $LSB_RELEASE" >&5 -echo "${ECHO_T}$LSB_RELEASE" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - - -# Checks for libraries. - -# Checks for header files. - -{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5 -echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; } -if test "${ac_cv_header_stdc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -#include -#include - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_cxx_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_header_stdc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_header_stdc=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then - : -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then - : -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then - : -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif - -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int -main () -{ - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - return 2; - return 0; -} -_ACEOF -rm -f conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -ac_cv_header_stdc=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi - - -fi -fi -{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 -echo "${ECHO_T}$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then - -cat >>confdefs.h <<\_ACEOF -#define STDC_HEADERS 1 -_ACEOF - -fi - - -# Checks for typedefs, structures, and compiler characteristics. -{ echo "$as_me:$LINENO: checking for size_t" >&5 -echo $ECHO_N "checking for size_t... $ECHO_C" >&6; } -if test "${ac_cv_type_size_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -typedef size_t ac__type_new_; -int -main () -{ -if ((ac__type_new_ *) 0) - return 0; -if (sizeof (ac__type_new_)) - return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_cxx_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_type_size_t=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_type_size_t=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5 -echo "${ECHO_T}$ac_cv_type_size_t" >&6; } -if test $ac_cv_type_size_t = yes; then - : -else - -cat >>confdefs.h <<_ACEOF -#define size_t unsigned int -_ACEOF - -fi - -{ echo "$as_me:$LINENO: checking for wchar_t" >&5 -echo $ECHO_N "checking for wchar_t... $ECHO_C" >&6; } -if test "${ac_cv_type_wchar_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -typedef wchar_t ac__type_new_; -int -main () -{ -if ((ac__type_new_ *) 0) - return 0; -if (sizeof (ac__type_new_)) - return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_cxx_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_type_wchar_t=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_type_wchar_t=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_type_wchar_t" >&5 -echo "${ECHO_T}$ac_cv_type_wchar_t" >&6; } - -# The cast to long int works around a bug in the HP C Compiler -# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects -# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. -# This bug is HP SR number 8606223364. -{ echo "$as_me:$LINENO: checking size of wchar_t" >&5 -echo $ECHO_N "checking size of wchar_t... $ECHO_C" >&6; } -if test "${ac_cv_sizeof_wchar_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then - # Depending upon the size, compute the lo and hi bounds. -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default - typedef wchar_t ac__type_sizeof_; -int -main () -{ -static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_cxx_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_lo=0 ac_mid=0 - while :; do - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default - typedef wchar_t ac__type_sizeof_; -int -main () -{ -static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_cxx_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_hi=$ac_mid; break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_lo=`expr $ac_mid + 1` - if test $ac_lo -le $ac_mid; then - ac_lo= ac_hi= - break - fi - ac_mid=`expr 2 '*' $ac_mid + 1` -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - done -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default - typedef wchar_t ac__type_sizeof_; -int -main () -{ -static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_cxx_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_hi=-1 ac_mid=-1 - while :; do - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default - typedef wchar_t ac__type_sizeof_; -int -main () -{ -static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_cxx_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_lo=$ac_mid; break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_hi=`expr '(' $ac_mid ')' - 1` - if test $ac_mid -le $ac_hi; then - ac_lo= ac_hi= - break - fi - ac_mid=`expr 2 '*' $ac_mid` -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - done -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_lo= ac_hi= -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -# Binary search between lo and hi bounds. -while test "x$ac_lo" != "x$ac_hi"; do - ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default - typedef wchar_t ac__type_sizeof_; -int -main () -{ -static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_cxx_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_hi=$ac_mid -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_lo=`expr '(' $ac_mid ')' + 1` -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -done -case $ac_lo in -?*) ac_cv_sizeof_wchar_t=$ac_lo;; -'') if test "$ac_cv_type_wchar_t" = yes; then - { { echo "$as_me:$LINENO: error: cannot compute sizeof (wchar_t) -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute sizeof (wchar_t) -See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; } - else - ac_cv_sizeof_wchar_t=0 - fi ;; -esac -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default - typedef wchar_t ac__type_sizeof_; -static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); } -static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); } -#include -#include -int -main () -{ - - FILE *f = fopen ("conftest.val", "w"); - if (! f) - return 1; - if (((long int) (sizeof (ac__type_sizeof_))) < 0) - { - long int i = longval (); - if (i != ((long int) (sizeof (ac__type_sizeof_)))) - return 1; - fprintf (f, "%ld\n", i); - } - else - { - unsigned long int i = ulongval (); - if (i != ((long int) (sizeof (ac__type_sizeof_)))) - return 1; - fprintf (f, "%lu\n", i); - } - return ferror (f) || fclose (f) != 0; - - ; - return 0; -} -_ACEOF -rm -f conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_sizeof_wchar_t=`cat conftest.val` -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -if test "$ac_cv_type_wchar_t" = yes; then - { { echo "$as_me:$LINENO: error: cannot compute sizeof (wchar_t) -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute sizeof (wchar_t) -See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; } - else - ac_cv_sizeof_wchar_t=0 - fi -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi -rm -f conftest.val -fi -{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_wchar_t" >&5 -echo "${ECHO_T}$ac_cv_sizeof_wchar_t" >&6; } - - - -cat >>confdefs.h <<_ACEOF -#define SIZEOF_WCHAR_T $ac_cv_sizeof_wchar_t -_ACEOF - - - - - -for ac_func in fabsf -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -{ echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } -if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case declares $ac_func. - For example, HP-UX 11i declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $ac_func - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char $ac_func (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined __stub_$ac_func || defined __stub___$ac_func -choke me -#endif - -int -main () -{ -return $ac_func (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_cxx_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - eval "$as_ac_var=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - eval "$as_ac_var=no" -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -fi -ac_res=`eval echo '${'$as_ac_var'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - - -# Checks for library functions. - -# Setup the build compiler flags and linker flags. -# Enable debug -# (note: the flags here are gcc-specific and may fail with other compilers) -build_flags="" -if test "$enable_debug" = yes; then - build_flags="$build_flags -O0 -g -Wall -Wno-unknown-pragmas -Wparentheses -Werror" -elif test "$enable_strict" = yes; then - build_flags="$build_flags -DNDEBUG -Wall -Wno-unknown-pragmas -Wparentheses -Werror" -else - build_flags="$build_flags -DNDEBUG" -fi - -# Enable Graphite Trace logs - these are only used if a -# LayoutEnvironment has a valid ostream pointer -if test "$enable_tracing" = yes; then - build_flags="$build_flags -DTRACING" -fi - -# Enable final -if test "$enable_final" = yes; then - build_flags="$build_flags -O3 -DNDEBUG" -fi - -# Enable profile -if test "$enable_profile" = yes; then - build_flags="$build_flags -pg " -fi -if test "$enable_profilefn" = yes; then - build_flags="$build_flags -g -finstrument-functions " - LIBS="$LIBS -g -finstrument-functions -lfnccheck " -fi - -# Find distrib codename - -{ echo "$as_me:$LINENO: checking if already have REL_CODENAME" >&5 -echo $ECHO_N "checking if already have REL_CODENAME... $ECHO_C" >&6; } -if test -z "${REL_CODENAME}"; then - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } - { echo "$as_me:$LINENO: checking if have lsb_release" >&5 -echo $ECHO_N "checking if have lsb_release... $ECHO_C" >&6; } - if test "${LSB_RELEASE}" = "no"; then - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } - REL_CODENAME="unstable" - else - { echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6; } - { echo "$as_me:$LINENO: checking if LSB_RELEASE is empty" >&5 -echo $ECHO_N "checking if LSB_RELEASE is empty... $ECHO_C" >&6; } - if test -z ${LSB_RELEASE}; then - { echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6; } - REL_CODENAME="unstable" - else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } - CODENAME=`${LSB_RELEASE} -c | sed -e 's/^\S*\s*//'` - { echo "$as_me:$LINENO: checking if release is sid" >&5 -echo $ECHO_N "checking if release is sid... $ECHO_C" >&6; } - if test ${CODENAME} = 'sid'; then - { echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6; } - REL_CODENAME="unstable" - else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } - REL_CODENAME=${CODENAME} - fi - fi - fi -else - { echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6; } -fi - - - -CFLAGS="$CFLAGS $build_flags" -CXXFLAGS="$CXXFLAGS $build_flags" - -ac_config_files="$ac_config_files Makefile silgraphite.pc:installed-top.pc.in:silgraphite.pc.in silgraphite-uninstalled.pc:uninstalled-top.pc.in:silgraphite.pc.in src/Makefile test/Makefile test/RegressionTest/Makefile test/ProfileHarness/Makefile" - - -cat >confcache <<\_ACEOF -# This file is a shell script that caches the results of configure -# tests run on this system so they can be shared between configure -# scripts and configure runs, see configure's option --config-cache. -# It is not useful on other systems. If it contains results you don't -# want to keep, you may remove or edit it. -# -# config.status only pays attention to the cache file if you give it -# the --recheck option to rerun configure. -# -# `ac_cv_env_foo' variables (set or unset) will be overridden when -# loading this file, other *unset* `ac_cv_foo' will be assigned the -# following values. - -_ACEOF - -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, we kill variables containing newlines. -# Ultrix sh set writes to stderr and can't be redirected directly, -# and sets the high bit in the cache file unless we assign to the vars. -( - for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do - eval ac_val=\$$ac_var - case $ac_val in #( - *${as_nl}*) - case $ac_var in #( - *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 -echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; - esac - case $ac_var in #( - _ | IFS | as_nl) ;; #( - *) $as_unset $ac_var ;; - esac ;; - esac - done - - (set) 2>&1 | - case $as_nl`(ac_space=' '; set) 2>&1` in #( - *${as_nl}ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote - # substitution turns \\\\ into \\, and sed turns \\ into \). - sed -n \ - "s/'/'\\\\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" - ;; #( - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" - ;; - esac | - sort -) | - sed ' - /^ac_cv_env_/b end - t clear - :clear - s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ - t end - s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ - :end' >>confcache -if diff "$cache_file" confcache >/dev/null 2>&1; then :; else - if test -w "$cache_file"; then - test "x$cache_file" != "x/dev/null" && - { echo "$as_me:$LINENO: updating cache $cache_file" >&5 -echo "$as_me: updating cache $cache_file" >&6;} - cat confcache >$cache_file - else - { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 -echo "$as_me: not updating unwritable cache $cache_file" >&6;} - fi -fi -rm -f confcache - -test "x$prefix" = xNONE && prefix=$ac_default_prefix -# Let make expand exec_prefix. -test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - -# Transform confdefs.h into DEFS. -# Protect against shell expansion while executing Makefile rules. -# Protect against Makefile macro expansion. -# -# If the first sed substitution is executed (which looks for macros that -# take arguments), then branch to the quote section. Otherwise, -# look for a macro that doesn't take arguments. -ac_script=' -t clear -:clear -s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g -t quote -s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g -t quote -b any -:quote -s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g -s/\[/\\&/g -s/\]/\\&/g -s/\$/$$/g -H -:any -${ - g - s/^\n// - s/\n/ /g - p -} -' -DEFS=`sed -n "$ac_script" confdefs.h` - - -ac_libobjs= -ac_ltlibobjs= -for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue - # 1. Remove the extension, and $U if already installed. - ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' - ac_i=`echo "$ac_i" | sed "$ac_script"` - # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR - # will be set to the directory where LIBOBJS objects are built. - ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" - ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' -done -LIBOBJS=$ac_libobjs - -LTLIBOBJS=$ac_ltlibobjs - - -if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"MAINTAINER_MODE\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -echo "$as_me: error: conditional \"MAINTAINER_MODE\" was never defined. -Usually this means the macro was only invoked conditionally." >&2;} - { (exit 1); exit 1; }; } -fi -if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -echo "$as_me: error: conditional \"AMDEP\" was never defined. -Usually this means the macro was only invoked conditionally." >&2;} - { (exit 1); exit 1; }; } -fi -if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. -Usually this means the macro was only invoked conditionally." >&2;} - { (exit 1); exit 1; }; } -fi -if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. -Usually this means the macro was only invoked conditionally." >&2;} - { (exit 1); exit 1; }; } -fi -if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCXX\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -echo "$as_me: error: conditional \"am__fastdepCXX\" was never defined. -Usually this means the macro was only invoked conditionally." >&2;} - { (exit 1); exit 1; }; } -fi -if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCXX\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -echo "$as_me: error: conditional \"am__fastdepCXX\" was never defined. -Usually this means the macro was only invoked conditionally." >&2;} - { (exit 1); exit 1; }; } -fi - -: ${CONFIG_STATUS=./config.status} -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 -echo "$as_me: creating $CONFIG_STATUS" >&6;} -cat >$CONFIG_STATUS <<_ACEOF -#! $SHELL -# Generated by $as_me. -# Run this file to recreate the current configuration. -# Compiler output produced by configure, useful for debugging -# configure, is in config.log if it exists. - -debug=false -ac_cs_recheck=false -ac_cs_silent=false -SHELL=\${CONFIG_SHELL-$SHELL} -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## - -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in - *posix*) set -o posix ;; -esac - -fi - - - - -# PATH needs CR -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' - else - PATH_SEPARATOR=: - fi - rm -f conf$$.sh -fi - -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false -fi - - -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -as_nl=' -' -IFS=" "" $as_nl" - -# Find who we are. Look in the path if we contain no directory separator. -case $0 in - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done -IFS=$as_save_IFS - - ;; -esac -# We did not find ourselves, most probably we were run as `sh COMMAND' -# in which case we are not to be found in the path. -if test "x$as_myself" = x; then - as_myself=$0 -fi -if test ! -f "$as_myself"; then - echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - { (exit 1); exit 1; } -fi - -# Work around bugs in pre-3.0 UWIN ksh. -for as_var in ENV MAIL MAILPATH -do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -for as_var in \ - LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ - LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ - LC_TELEPHONE LC_TIME -do - if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var - else - ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var - fi -done - -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - - -# Name of the executable. -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -# CDPATH. -$as_unset CDPATH - - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { - - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line after each line using $LINENO; the second 'sed' - # does the real work. The second script uses 'N' to pair each - # line-number line with the line containing $LINENO, and appends - # trailing '-' during substitution so that $LINENO is not a special - # case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # scripts with optimization help from Paolo Bonzini. Blame Lee - # E. McMahon (1931-1989) for sed's syntax. :-) - sed -n ' - p - /[$]LINENO/= - ' <$as_myself | - sed ' - s/[$]LINENO.*/&-/ - t lineno - b - :lineno - N - :loop - s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ - t loop - s/-\n.*// - ' >$as_me.lineno && - chmod +x "$as_me.lineno" || - { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 - { (exit 1); exit 1; }; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensitive to this). - . "./$as_me.lineno" - # Exit status is that of the last command. - exit -} - - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in --n*) - case `echo 'x\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - *) ECHO_C='\c';; - esac;; -*) - ECHO_N='-n';; -esac - -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -rm -f conf$$ conf$$.exe conf$$.file -if test -d conf$$.dir; then - rm -f conf$$.dir/conf$$.file -else - rm -f conf$$.dir - mkdir conf$$.dir -fi -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file -rmdir conf$$.dir 2>/dev/null - -if mkdir -p . 2>/dev/null; then - as_mkdir_p=: -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - -exec 6>&1 - -# Save the log message, to keep $[0] and so on meaningful, and to -# report actual input values of CONFIG_FILES etc. instead of their -# values after options handling. -ac_log=" -This file was extended by silgraphite $as_me 2.3.1, which was -generated by GNU Autoconf 2.61. Invocation command line was - - CONFIG_FILES = $CONFIG_FILES - CONFIG_HEADERS = $CONFIG_HEADERS - CONFIG_LINKS = $CONFIG_LINKS - CONFIG_COMMANDS = $CONFIG_COMMANDS - $ $0 $@ - -on `(hostname || uname -n) 2>/dev/null | sed 1q` -" - -_ACEOF - -cat >>$CONFIG_STATUS <<_ACEOF -# Files that config.status was made for. -config_files="$ac_config_files" -config_commands="$ac_config_commands" - -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF -ac_cs_usage="\ -\`$as_me' instantiates files from templates according to the -current configuration. - -Usage: $0 [OPTIONS] [FILE]... - - -h, --help print this help, then exit - -V, --version print version number and configuration settings, then exit - -q, --quiet do not print progress messages - -d, --debug don't remove temporary files - --recheck update $as_me by reconfiguring in the same conditions - --file=FILE[:TEMPLATE] - instantiate the configuration file FILE - -Configuration files: -$config_files - -Configuration commands: -$config_commands - -Report bugs to ." - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF -ac_cs_version="\\ -silgraphite config.status 2.3.1 -configured by $0, generated by GNU Autoconf 2.61, - with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" - -Copyright (C) 2006 Free Software Foundation, Inc. -This config.status script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it." - -ac_pwd='$ac_pwd' -srcdir='$srcdir' -INSTALL='$INSTALL' -MKDIR_P='$MKDIR_P' -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF -# If no file are specified by the user, then we need to provide default -# value. By we need to know if files were specified by the user. -ac_need_defaults=: -while test $# != 0 -do - case $1 in - --*=*) - ac_option=`expr "X$1" : 'X\([^=]*\)='` - ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` - ac_shift=: - ;; - *) - ac_option=$1 - ac_optarg=$2 - ac_shift=shift - ;; - esac - - case $ac_option in - # Handling of the options. - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - ac_cs_recheck=: ;; - --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) - echo "$ac_cs_version"; exit ;; - --debug | --debu | --deb | --de | --d | -d ) - debug=: ;; - --file | --fil | --fi | --f ) - $ac_shift - CONFIG_FILES="$CONFIG_FILES $ac_optarg" - ac_need_defaults=false;; - --he | --h | --help | --hel | -h ) - echo "$ac_cs_usage"; exit ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil | --si | --s) - ac_cs_silent=: ;; - - # This is an error. - -*) { echo "$as_me: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&2 - { (exit 1); exit 1; }; } ;; - - *) ac_config_targets="$ac_config_targets $1" - ac_need_defaults=false ;; - - esac - shift -done - -ac_configure_extra_args= - -if $ac_cs_silent; then - exec 6>/dev/null - ac_configure_extra_args="$ac_configure_extra_args --silent" -fi - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF -if \$ac_cs_recheck; then - echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 - CONFIG_SHELL=$SHELL - export CONFIG_SHELL - exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion -fi - -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -exec 5>>config.log -{ - echo - sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX -## Running $as_me. ## -_ASBOX - echo "$ac_log" -} >&5 - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF -# -# INIT-COMMANDS -# -AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" - - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -sed_quote_subst='$sed_quote_subst' -double_quote_subst='$double_quote_subst' -delay_variable_subst='$delay_variable_subst' -macro_version='`$ECHO "X$macro_version" | $Xsed -e "$delay_single_quote_subst"`' -macro_revision='`$ECHO "X$macro_revision" | $Xsed -e "$delay_single_quote_subst"`' -enable_shared='`$ECHO "X$enable_shared" | $Xsed -e "$delay_single_quote_subst"`' -enable_static='`$ECHO "X$enable_static" | $Xsed -e "$delay_single_quote_subst"`' -pic_mode='`$ECHO "X$pic_mode" | $Xsed -e "$delay_single_quote_subst"`' -enable_fast_install='`$ECHO "X$enable_fast_install" | $Xsed -e "$delay_single_quote_subst"`' -host_alias='`$ECHO "X$host_alias" | $Xsed -e "$delay_single_quote_subst"`' -host='`$ECHO "X$host" | $Xsed -e "$delay_single_quote_subst"`' -host_os='`$ECHO "X$host_os" | $Xsed -e "$delay_single_quote_subst"`' -build_alias='`$ECHO "X$build_alias" | $Xsed -e "$delay_single_quote_subst"`' -build='`$ECHO "X$build" | $Xsed -e "$delay_single_quote_subst"`' -build_os='`$ECHO "X$build_os" | $Xsed -e "$delay_single_quote_subst"`' -SED='`$ECHO "X$SED" | $Xsed -e "$delay_single_quote_subst"`' -Xsed='`$ECHO "X$Xsed" | $Xsed -e "$delay_single_quote_subst"`' -GREP='`$ECHO "X$GREP" | $Xsed -e "$delay_single_quote_subst"`' -EGREP='`$ECHO "X$EGREP" | $Xsed -e "$delay_single_quote_subst"`' -FGREP='`$ECHO "X$FGREP" | $Xsed -e "$delay_single_quote_subst"`' -LD='`$ECHO "X$LD" | $Xsed -e "$delay_single_quote_subst"`' -NM='`$ECHO "X$NM" | $Xsed -e "$delay_single_quote_subst"`' -LN_S='`$ECHO "X$LN_S" | $Xsed -e "$delay_single_quote_subst"`' -max_cmd_len='`$ECHO "X$max_cmd_len" | $Xsed -e "$delay_single_quote_subst"`' -ac_objext='`$ECHO "X$ac_objext" | $Xsed -e "$delay_single_quote_subst"`' -exeext='`$ECHO "X$exeext" | $Xsed -e "$delay_single_quote_subst"`' -lt_unset='`$ECHO "X$lt_unset" | $Xsed -e "$delay_single_quote_subst"`' -lt_SP2NL='`$ECHO "X$lt_SP2NL" | $Xsed -e "$delay_single_quote_subst"`' -lt_NL2SP='`$ECHO "X$lt_NL2SP" | $Xsed -e "$delay_single_quote_subst"`' -reload_flag='`$ECHO "X$reload_flag" | $Xsed -e "$delay_single_quote_subst"`' -reload_cmds='`$ECHO "X$reload_cmds" | $Xsed -e "$delay_single_quote_subst"`' -deplibs_check_method='`$ECHO "X$deplibs_check_method" | $Xsed -e "$delay_single_quote_subst"`' -file_magic_cmd='`$ECHO "X$file_magic_cmd" | $Xsed -e "$delay_single_quote_subst"`' -AR='`$ECHO "X$AR" | $Xsed -e "$delay_single_quote_subst"`' -AR_FLAGS='`$ECHO "X$AR_FLAGS" | $Xsed -e "$delay_single_quote_subst"`' -STRIP='`$ECHO "X$STRIP" | $Xsed -e "$delay_single_quote_subst"`' -RANLIB='`$ECHO "X$RANLIB" | $Xsed -e "$delay_single_quote_subst"`' -old_postinstall_cmds='`$ECHO "X$old_postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' -old_postuninstall_cmds='`$ECHO "X$old_postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' -old_archive_cmds='`$ECHO "X$old_archive_cmds" | $Xsed -e "$delay_single_quote_subst"`' -CC='`$ECHO "X$CC" | $Xsed -e "$delay_single_quote_subst"`' -CFLAGS='`$ECHO "X$CFLAGS" | $Xsed -e "$delay_single_quote_subst"`' -compiler='`$ECHO "X$compiler" | $Xsed -e "$delay_single_quote_subst"`' -GCC='`$ECHO "X$GCC" | $Xsed -e "$delay_single_quote_subst"`' -lt_cv_sys_global_symbol_pipe='`$ECHO "X$lt_cv_sys_global_symbol_pipe" | $Xsed -e "$delay_single_quote_subst"`' -lt_cv_sys_global_symbol_to_cdecl='`$ECHO "X$lt_cv_sys_global_symbol_to_cdecl" | $Xsed -e "$delay_single_quote_subst"`' -lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "X$lt_cv_sys_global_symbol_to_c_name_address" | $Xsed -e "$delay_single_quote_subst"`' -lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "X$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $Xsed -e "$delay_single_quote_subst"`' -objdir='`$ECHO "X$objdir" | $Xsed -e "$delay_single_quote_subst"`' -SHELL='`$ECHO "X$SHELL" | $Xsed -e "$delay_single_quote_subst"`' -ECHO='`$ECHO "X$ECHO" | $Xsed -e "$delay_single_quote_subst"`' -MAGIC_CMD='`$ECHO "X$MAGIC_CMD" | $Xsed -e "$delay_single_quote_subst"`' -lt_prog_compiler_no_builtin_flag='`$ECHO "X$lt_prog_compiler_no_builtin_flag" | $Xsed -e "$delay_single_quote_subst"`' -lt_prog_compiler_wl='`$ECHO "X$lt_prog_compiler_wl" | $Xsed -e "$delay_single_quote_subst"`' -lt_prog_compiler_pic='`$ECHO "X$lt_prog_compiler_pic" | $Xsed -e "$delay_single_quote_subst"`' -lt_prog_compiler_static='`$ECHO "X$lt_prog_compiler_static" | $Xsed -e "$delay_single_quote_subst"`' -lt_cv_prog_compiler_c_o='`$ECHO "X$lt_cv_prog_compiler_c_o" | $Xsed -e "$delay_single_quote_subst"`' -need_locks='`$ECHO "X$need_locks" | $Xsed -e "$delay_single_quote_subst"`' -DSYMUTIL='`$ECHO "X$DSYMUTIL" | $Xsed -e "$delay_single_quote_subst"`' -NMEDIT='`$ECHO "X$NMEDIT" | $Xsed -e "$delay_single_quote_subst"`' -LIPO='`$ECHO "X$LIPO" | $Xsed -e "$delay_single_quote_subst"`' -OTOOL='`$ECHO "X$OTOOL" | $Xsed -e "$delay_single_quote_subst"`' -OTOOL64='`$ECHO "X$OTOOL64" | $Xsed -e "$delay_single_quote_subst"`' -libext='`$ECHO "X$libext" | $Xsed -e "$delay_single_quote_subst"`' -shrext_cmds='`$ECHO "X$shrext_cmds" | $Xsed -e "$delay_single_quote_subst"`' -extract_expsyms_cmds='`$ECHO "X$extract_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`' -archive_cmds_need_lc='`$ECHO "X$archive_cmds_need_lc" | $Xsed -e "$delay_single_quote_subst"`' -enable_shared_with_static_runtimes='`$ECHO "X$enable_shared_with_static_runtimes" | $Xsed -e "$delay_single_quote_subst"`' -export_dynamic_flag_spec='`$ECHO "X$export_dynamic_flag_spec" | $Xsed -e "$delay_single_quote_subst"`' -whole_archive_flag_spec='`$ECHO "X$whole_archive_flag_spec" | $Xsed -e "$delay_single_quote_subst"`' -compiler_needs_object='`$ECHO "X$compiler_needs_object" | $Xsed -e "$delay_single_quote_subst"`' -old_archive_from_new_cmds='`$ECHO "X$old_archive_from_new_cmds" | $Xsed -e "$delay_single_quote_subst"`' -old_archive_from_expsyms_cmds='`$ECHO "X$old_archive_from_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`' -archive_cmds='`$ECHO "X$archive_cmds" | $Xsed -e "$delay_single_quote_subst"`' -archive_expsym_cmds='`$ECHO "X$archive_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`' -module_cmds='`$ECHO "X$module_cmds" | $Xsed -e "$delay_single_quote_subst"`' -module_expsym_cmds='`$ECHO "X$module_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`' -with_gnu_ld='`$ECHO "X$with_gnu_ld" | $Xsed -e "$delay_single_quote_subst"`' -allow_undefined_flag='`$ECHO "X$allow_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`' -no_undefined_flag='`$ECHO "X$no_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_libdir_flag_spec='`$ECHO "X$hardcode_libdir_flag_spec" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_libdir_flag_spec_ld='`$ECHO "X$hardcode_libdir_flag_spec_ld" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_libdir_separator='`$ECHO "X$hardcode_libdir_separator" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_direct='`$ECHO "X$hardcode_direct" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_direct_absolute='`$ECHO "X$hardcode_direct_absolute" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_minus_L='`$ECHO "X$hardcode_minus_L" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_shlibpath_var='`$ECHO "X$hardcode_shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_automatic='`$ECHO "X$hardcode_automatic" | $Xsed -e "$delay_single_quote_subst"`' -inherit_rpath='`$ECHO "X$inherit_rpath" | $Xsed -e "$delay_single_quote_subst"`' -link_all_deplibs='`$ECHO "X$link_all_deplibs" | $Xsed -e "$delay_single_quote_subst"`' -fix_srcfile_path='`$ECHO "X$fix_srcfile_path" | $Xsed -e "$delay_single_quote_subst"`' -always_export_symbols='`$ECHO "X$always_export_symbols" | $Xsed -e "$delay_single_quote_subst"`' -export_symbols_cmds='`$ECHO "X$export_symbols_cmds" | $Xsed -e "$delay_single_quote_subst"`' -exclude_expsyms='`$ECHO "X$exclude_expsyms" | $Xsed -e "$delay_single_quote_subst"`' -include_expsyms='`$ECHO "X$include_expsyms" | $Xsed -e "$delay_single_quote_subst"`' -prelink_cmds='`$ECHO "X$prelink_cmds" | $Xsed -e "$delay_single_quote_subst"`' -file_list_spec='`$ECHO "X$file_list_spec" | $Xsed -e "$delay_single_quote_subst"`' -variables_saved_for_relink='`$ECHO "X$variables_saved_for_relink" | $Xsed -e "$delay_single_quote_subst"`' -need_lib_prefix='`$ECHO "X$need_lib_prefix" | $Xsed -e "$delay_single_quote_subst"`' -need_version='`$ECHO "X$need_version" | $Xsed -e "$delay_single_quote_subst"`' -version_type='`$ECHO "X$version_type" | $Xsed -e "$delay_single_quote_subst"`' -runpath_var='`$ECHO "X$runpath_var" | $Xsed -e "$delay_single_quote_subst"`' -shlibpath_var='`$ECHO "X$shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`' -shlibpath_overrides_runpath='`$ECHO "X$shlibpath_overrides_runpath" | $Xsed -e "$delay_single_quote_subst"`' -libname_spec='`$ECHO "X$libname_spec" | $Xsed -e "$delay_single_quote_subst"`' -library_names_spec='`$ECHO "X$library_names_spec" | $Xsed -e "$delay_single_quote_subst"`' -soname_spec='`$ECHO "X$soname_spec" | $Xsed -e "$delay_single_quote_subst"`' -postinstall_cmds='`$ECHO "X$postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' -postuninstall_cmds='`$ECHO "X$postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' -finish_cmds='`$ECHO "X$finish_cmds" | $Xsed -e "$delay_single_quote_subst"`' -finish_eval='`$ECHO "X$finish_eval" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_into_libs='`$ECHO "X$hardcode_into_libs" | $Xsed -e "$delay_single_quote_subst"`' -sys_lib_search_path_spec='`$ECHO "X$sys_lib_search_path_spec" | $Xsed -e "$delay_single_quote_subst"`' -sys_lib_dlsearch_path_spec='`$ECHO "X$sys_lib_dlsearch_path_spec" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_action='`$ECHO "X$hardcode_action" | $Xsed -e "$delay_single_quote_subst"`' -enable_dlopen='`$ECHO "X$enable_dlopen" | $Xsed -e "$delay_single_quote_subst"`' -enable_dlopen_self='`$ECHO "X$enable_dlopen_self" | $Xsed -e "$delay_single_quote_subst"`' -enable_dlopen_self_static='`$ECHO "X$enable_dlopen_self_static" | $Xsed -e "$delay_single_quote_subst"`' -old_striplib='`$ECHO "X$old_striplib" | $Xsed -e "$delay_single_quote_subst"`' -striplib='`$ECHO "X$striplib" | $Xsed -e "$delay_single_quote_subst"`' -compiler_lib_search_dirs='`$ECHO "X$compiler_lib_search_dirs" | $Xsed -e "$delay_single_quote_subst"`' -predep_objects='`$ECHO "X$predep_objects" | $Xsed -e "$delay_single_quote_subst"`' -postdep_objects='`$ECHO "X$postdep_objects" | $Xsed -e "$delay_single_quote_subst"`' -predeps='`$ECHO "X$predeps" | $Xsed -e "$delay_single_quote_subst"`' -postdeps='`$ECHO "X$postdeps" | $Xsed -e "$delay_single_quote_subst"`' -compiler_lib_search_path='`$ECHO "X$compiler_lib_search_path" | $Xsed -e "$delay_single_quote_subst"`' -LD_CXX='`$ECHO "X$LD_CXX" | $Xsed -e "$delay_single_quote_subst"`' -old_archive_cmds_CXX='`$ECHO "X$old_archive_cmds_CXX" | $Xsed -e "$delay_single_quote_subst"`' -compiler_CXX='`$ECHO "X$compiler_CXX" | $Xsed -e "$delay_single_quote_subst"`' -GCC_CXX='`$ECHO "X$GCC_CXX" | $Xsed -e "$delay_single_quote_subst"`' -lt_prog_compiler_no_builtin_flag_CXX='`$ECHO "X$lt_prog_compiler_no_builtin_flag_CXX" | $Xsed -e "$delay_single_quote_subst"`' -lt_prog_compiler_wl_CXX='`$ECHO "X$lt_prog_compiler_wl_CXX" | $Xsed -e "$delay_single_quote_subst"`' -lt_prog_compiler_pic_CXX='`$ECHO "X$lt_prog_compiler_pic_CXX" | $Xsed -e "$delay_single_quote_subst"`' -lt_prog_compiler_static_CXX='`$ECHO "X$lt_prog_compiler_static_CXX" | $Xsed -e "$delay_single_quote_subst"`' -lt_cv_prog_compiler_c_o_CXX='`$ECHO "X$lt_cv_prog_compiler_c_o_CXX" | $Xsed -e "$delay_single_quote_subst"`' -archive_cmds_need_lc_CXX='`$ECHO "X$archive_cmds_need_lc_CXX" | $Xsed -e "$delay_single_quote_subst"`' -enable_shared_with_static_runtimes_CXX='`$ECHO "X$enable_shared_with_static_runtimes_CXX" | $Xsed -e "$delay_single_quote_subst"`' -export_dynamic_flag_spec_CXX='`$ECHO "X$export_dynamic_flag_spec_CXX" | $Xsed -e "$delay_single_quote_subst"`' -whole_archive_flag_spec_CXX='`$ECHO "X$whole_archive_flag_spec_CXX" | $Xsed -e "$delay_single_quote_subst"`' -compiler_needs_object_CXX='`$ECHO "X$compiler_needs_object_CXX" | $Xsed -e "$delay_single_quote_subst"`' -old_archive_from_new_cmds_CXX='`$ECHO "X$old_archive_from_new_cmds_CXX" | $Xsed -e "$delay_single_quote_subst"`' -old_archive_from_expsyms_cmds_CXX='`$ECHO "X$old_archive_from_expsyms_cmds_CXX" | $Xsed -e "$delay_single_quote_subst"`' -archive_cmds_CXX='`$ECHO "X$archive_cmds_CXX" | $Xsed -e "$delay_single_quote_subst"`' -archive_expsym_cmds_CXX='`$ECHO "X$archive_expsym_cmds_CXX" | $Xsed -e "$delay_single_quote_subst"`' -module_cmds_CXX='`$ECHO "X$module_cmds_CXX" | $Xsed -e "$delay_single_quote_subst"`' -module_expsym_cmds_CXX='`$ECHO "X$module_expsym_cmds_CXX" | $Xsed -e "$delay_single_quote_subst"`' -with_gnu_ld_CXX='`$ECHO "X$with_gnu_ld_CXX" | $Xsed -e "$delay_single_quote_subst"`' -allow_undefined_flag_CXX='`$ECHO "X$allow_undefined_flag_CXX" | $Xsed -e "$delay_single_quote_subst"`' -no_undefined_flag_CXX='`$ECHO "X$no_undefined_flag_CXX" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_libdir_flag_spec_CXX='`$ECHO "X$hardcode_libdir_flag_spec_CXX" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_libdir_flag_spec_ld_CXX='`$ECHO "X$hardcode_libdir_flag_spec_ld_CXX" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_libdir_separator_CXX='`$ECHO "X$hardcode_libdir_separator_CXX" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_direct_CXX='`$ECHO "X$hardcode_direct_CXX" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_direct_absolute_CXX='`$ECHO "X$hardcode_direct_absolute_CXX" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_minus_L_CXX='`$ECHO "X$hardcode_minus_L_CXX" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_shlibpath_var_CXX='`$ECHO "X$hardcode_shlibpath_var_CXX" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_automatic_CXX='`$ECHO "X$hardcode_automatic_CXX" | $Xsed -e "$delay_single_quote_subst"`' -inherit_rpath_CXX='`$ECHO "X$inherit_rpath_CXX" | $Xsed -e "$delay_single_quote_subst"`' -link_all_deplibs_CXX='`$ECHO "X$link_all_deplibs_CXX" | $Xsed -e "$delay_single_quote_subst"`' -fix_srcfile_path_CXX='`$ECHO "X$fix_srcfile_path_CXX" | $Xsed -e "$delay_single_quote_subst"`' -always_export_symbols_CXX='`$ECHO "X$always_export_symbols_CXX" | $Xsed -e "$delay_single_quote_subst"`' -export_symbols_cmds_CXX='`$ECHO "X$export_symbols_cmds_CXX" | $Xsed -e "$delay_single_quote_subst"`' -exclude_expsyms_CXX='`$ECHO "X$exclude_expsyms_CXX" | $Xsed -e "$delay_single_quote_subst"`' -include_expsyms_CXX='`$ECHO "X$include_expsyms_CXX" | $Xsed -e "$delay_single_quote_subst"`' -prelink_cmds_CXX='`$ECHO "X$prelink_cmds_CXX" | $Xsed -e "$delay_single_quote_subst"`' -file_list_spec_CXX='`$ECHO "X$file_list_spec_CXX" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_action_CXX='`$ECHO "X$hardcode_action_CXX" | $Xsed -e "$delay_single_quote_subst"`' -compiler_lib_search_dirs_CXX='`$ECHO "X$compiler_lib_search_dirs_CXX" | $Xsed -e "$delay_single_quote_subst"`' -predep_objects_CXX='`$ECHO "X$predep_objects_CXX" | $Xsed -e "$delay_single_quote_subst"`' -postdep_objects_CXX='`$ECHO "X$postdep_objects_CXX" | $Xsed -e "$delay_single_quote_subst"`' -predeps_CXX='`$ECHO "X$predeps_CXX" | $Xsed -e "$delay_single_quote_subst"`' -postdeps_CXX='`$ECHO "X$postdeps_CXX" | $Xsed -e "$delay_single_quote_subst"`' -compiler_lib_search_path_CXX='`$ECHO "X$compiler_lib_search_path_CXX" | $Xsed -e "$delay_single_quote_subst"`' - -LTCC='$LTCC' -LTCFLAGS='$LTCFLAGS' -compiler='$compiler_DEFAULT' - -# Quote evaled strings. -for var in SED \ -GREP \ -EGREP \ -FGREP \ -LD \ -NM \ -LN_S \ -lt_SP2NL \ -lt_NL2SP \ -reload_flag \ -deplibs_check_method \ -file_magic_cmd \ -AR \ -AR_FLAGS \ -STRIP \ -RANLIB \ -CC \ -CFLAGS \ -compiler \ -lt_cv_sys_global_symbol_pipe \ -lt_cv_sys_global_symbol_to_cdecl \ -lt_cv_sys_global_symbol_to_c_name_address \ -lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ -SHELL \ -ECHO \ -lt_prog_compiler_no_builtin_flag \ -lt_prog_compiler_wl \ -lt_prog_compiler_pic \ -lt_prog_compiler_static \ -lt_cv_prog_compiler_c_o \ -need_locks \ -DSYMUTIL \ -NMEDIT \ -LIPO \ -OTOOL \ -OTOOL64 \ -shrext_cmds \ -export_dynamic_flag_spec \ -whole_archive_flag_spec \ -compiler_needs_object \ -with_gnu_ld \ -allow_undefined_flag \ -no_undefined_flag \ -hardcode_libdir_flag_spec \ -hardcode_libdir_flag_spec_ld \ -hardcode_libdir_separator \ -fix_srcfile_path \ -exclude_expsyms \ -include_expsyms \ -file_list_spec \ -variables_saved_for_relink \ -libname_spec \ -library_names_spec \ -soname_spec \ -finish_eval \ -old_striplib \ -striplib \ -compiler_lib_search_dirs \ -predep_objects \ -postdep_objects \ -predeps \ -postdeps \ -compiler_lib_search_path \ -LD_CXX \ -compiler_CXX \ -lt_prog_compiler_no_builtin_flag_CXX \ -lt_prog_compiler_wl_CXX \ -lt_prog_compiler_pic_CXX \ -lt_prog_compiler_static_CXX \ -lt_cv_prog_compiler_c_o_CXX \ -export_dynamic_flag_spec_CXX \ -whole_archive_flag_spec_CXX \ -compiler_needs_object_CXX \ -with_gnu_ld_CXX \ -allow_undefined_flag_CXX \ -no_undefined_flag_CXX \ -hardcode_libdir_flag_spec_CXX \ -hardcode_libdir_flag_spec_ld_CXX \ -hardcode_libdir_separator_CXX \ -fix_srcfile_path_CXX \ -exclude_expsyms_CXX \ -include_expsyms_CXX \ -file_list_spec_CXX \ -compiler_lib_search_dirs_CXX \ -predep_objects_CXX \ -postdep_objects_CXX \ -predeps_CXX \ -postdeps_CXX \ -compiler_lib_search_path_CXX; do - case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in - *[\\\\\\\`\\"\\\$]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" - ;; - *) - eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" - ;; - esac -done - -# Double-quote double-evaled strings. -for var in reload_cmds \ -old_postinstall_cmds \ -old_postuninstall_cmds \ -old_archive_cmds \ -extract_expsyms_cmds \ -old_archive_from_new_cmds \ -old_archive_from_expsyms_cmds \ -archive_cmds \ -archive_expsym_cmds \ -module_cmds \ -module_expsym_cmds \ -export_symbols_cmds \ -prelink_cmds \ -postinstall_cmds \ -postuninstall_cmds \ -finish_cmds \ -sys_lib_search_path_spec \ -sys_lib_dlsearch_path_spec \ -old_archive_cmds_CXX \ -old_archive_from_new_cmds_CXX \ -old_archive_from_expsyms_cmds_CXX \ -archive_cmds_CXX \ -archive_expsym_cmds_CXX \ -module_cmds_CXX \ -module_expsym_cmds_CXX \ -export_symbols_cmds_CXX \ -prelink_cmds_CXX; do - case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in - *[\\\\\\\`\\"\\\$]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" - ;; - *) - eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" - ;; - esac -done - -# Fix-up fallback echo if it was mangled by the above quoting rules. -case \$lt_ECHO in -*'\\\$0 --fallback-echo"') lt_ECHO=\`\$ECHO "X\$lt_ECHO" | \$Xsed -e 's/\\\\\\\\\\\\\\\$0 --fallback-echo"\$/\$0 --fallback-echo"/'\` - ;; -esac - -ac_aux_dir='$ac_aux_dir' -xsi_shell='$xsi_shell' -lt_shell_append='$lt_shell_append' - -# See if we are running on zsh, and set the options which allow our -# commands through without removal of \ escapes INIT. -if test -n "\${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST -fi - - - PACKAGE='$PACKAGE' - VERSION='$VERSION' - TIMESTAMP='$TIMESTAMP' - RM='$RM' - ofile='$ofile' - - - - - - -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF - -# Handling of arguments. -for ac_config_target in $ac_config_targets -do - case $ac_config_target in - "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; - "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; - "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; - "silgraphite.pc") CONFIG_FILES="$CONFIG_FILES silgraphite.pc:installed-top.pc.in:silgraphite.pc.in" ;; - "silgraphite-uninstalled.pc") CONFIG_FILES="$CONFIG_FILES silgraphite-uninstalled.pc:uninstalled-top.pc.in:silgraphite.pc.in" ;; - "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; - "test/Makefile") CONFIG_FILES="$CONFIG_FILES test/Makefile" ;; - "test/RegressionTest/Makefile") CONFIG_FILES="$CONFIG_FILES test/RegressionTest/Makefile" ;; - "test/ProfileHarness/Makefile") CONFIG_FILES="$CONFIG_FILES test/ProfileHarness/Makefile" ;; - - *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 -echo "$as_me: error: invalid argument: $ac_config_target" >&2;} - { (exit 1); exit 1; }; };; - esac -done - - -# If the user did not use the arguments to specify the items to instantiate, -# then the envvar interface is used. Set only those that are not. -# We use the long form for the default assignment because of an extremely -# bizarre bug on SunOS 4.1.3. -if $ac_need_defaults; then - test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files - test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands -fi - -# Have a temporary directory for convenience. Make it in the build tree -# simply because there is no reason against having it here, and in addition, -# creating and moving files from /tmp can sometimes cause problems. -# Hook for its removal unless debugging. -# Note that there is a small window in which the directory will not be cleaned: -# after its creation but before its name has been assigned to `$tmp'. -$debug || -{ - tmp= - trap 'exit_status=$? - { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status -' 0 - trap '{ (exit 1); exit 1; }' 1 2 13 15 -} -# Create a (secure) tmp directory for tmp files. - -{ - tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" -} || -{ - tmp=./conf$$-$RANDOM - (umask 077 && mkdir "$tmp") -} || -{ - echo "$me: cannot create a temporary directory in ." >&2 - { (exit 1); exit 1; } -} - -# -# Set up the sed scripts for CONFIG_FILES section. -# - -# No need to generate the scripts if there are no CONFIG_FILES. -# This happens for instance when ./config.status config.h -if test -n "$CONFIG_FILES"; then - -_ACEOF - - - -ac_delim='%!_!# ' -for ac_last_try in false false false false false :; do - cat >conf$$subs.sed <<_ACEOF -SHELL!$SHELL$ac_delim -PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim -PACKAGE_NAME!$PACKAGE_NAME$ac_delim -PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim -PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim -PACKAGE_STRING!$PACKAGE_STRING$ac_delim -PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim -exec_prefix!$exec_prefix$ac_delim -prefix!$prefix$ac_delim -program_transform_name!$program_transform_name$ac_delim -bindir!$bindir$ac_delim -sbindir!$sbindir$ac_delim -libexecdir!$libexecdir$ac_delim -datarootdir!$datarootdir$ac_delim -datadir!$datadir$ac_delim -sysconfdir!$sysconfdir$ac_delim -sharedstatedir!$sharedstatedir$ac_delim -localstatedir!$localstatedir$ac_delim -includedir!$includedir$ac_delim -oldincludedir!$oldincludedir$ac_delim -docdir!$docdir$ac_delim -infodir!$infodir$ac_delim -htmldir!$htmldir$ac_delim -dvidir!$dvidir$ac_delim -pdfdir!$pdfdir$ac_delim -psdir!$psdir$ac_delim -libdir!$libdir$ac_delim -localedir!$localedir$ac_delim -mandir!$mandir$ac_delim -DEFS!$DEFS$ac_delim -ECHO_C!$ECHO_C$ac_delim -ECHO_N!$ECHO_N$ac_delim -ECHO_T!$ECHO_T$ac_delim -LIBS!$LIBS$ac_delim -build_alias!$build_alias$ac_delim -host_alias!$host_alias$ac_delim -target_alias!$target_alias$ac_delim -INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim -INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim -INSTALL_DATA!$INSTALL_DATA$ac_delim -am__isrc!$am__isrc$ac_delim -CYGPATH_W!$CYGPATH_W$ac_delim -PACKAGE!$PACKAGE$ac_delim -VERSION!$VERSION$ac_delim -ACLOCAL!$ACLOCAL$ac_delim -AUTOCONF!$AUTOCONF$ac_delim -AUTOMAKE!$AUTOMAKE$ac_delim -AUTOHEADER!$AUTOHEADER$ac_delim -MAKEINFO!$MAKEINFO$ac_delim -install_sh!$install_sh$ac_delim -STRIP!$STRIP$ac_delim -INSTALL_STRIP_PROGRAM!$INSTALL_STRIP_PROGRAM$ac_delim -mkdir_p!$mkdir_p$ac_delim -AWK!$AWK$ac_delim -SET_MAKE!$SET_MAKE$ac_delim -am__leading_dot!$am__leading_dot$ac_delim -AMTAR!$AMTAR$ac_delim -am__tar!$am__tar$ac_delim -am__untar!$am__untar$ac_delim -MAINTAINER_MODE_TRUE!$MAINTAINER_MODE_TRUE$ac_delim -MAINTAINER_MODE_FALSE!$MAINTAINER_MODE_FALSE$ac_delim -MAINT!$MAINT$ac_delim -build!$build$ac_delim -build_cpu!$build_cpu$ac_delim -build_vendor!$build_vendor$ac_delim -build_os!$build_os$ac_delim -host!$host$ac_delim -host_cpu!$host_cpu$ac_delim -host_vendor!$host_vendor$ac_delim -host_os!$host_os$ac_delim -CC!$CC$ac_delim -CFLAGS!$CFLAGS$ac_delim -LDFLAGS!$LDFLAGS$ac_delim -CPPFLAGS!$CPPFLAGS$ac_delim -ac_ct_CC!$ac_ct_CC$ac_delim -EXEEXT!$EXEEXT$ac_delim -OBJEXT!$OBJEXT$ac_delim -DEPDIR!$DEPDIR$ac_delim -am__include!$am__include$ac_delim -am__quote!$am__quote$ac_delim -AMDEP_TRUE!$AMDEP_TRUE$ac_delim -AMDEP_FALSE!$AMDEP_FALSE$ac_delim -AMDEPBACKSLASH!$AMDEPBACKSLASH$ac_delim -CCDEPMODE!$CCDEPMODE$ac_delim -am__fastdepCC_TRUE!$am__fastdepCC_TRUE$ac_delim -am__fastdepCC_FALSE!$am__fastdepCC_FALSE$ac_delim -CPP!$CPP$ac_delim -GREP!$GREP$ac_delim -EGREP!$EGREP$ac_delim -LIBTOOL!$LIBTOOL$ac_delim -SED!$SED$ac_delim -FGREP!$FGREP$ac_delim -LD!$LD$ac_delim -DUMPBIN!$DUMPBIN$ac_delim -ac_ct_DUMPBIN!$ac_ct_DUMPBIN$ac_delim -NM!$NM$ac_delim -LN_S!$LN_S$ac_delim -_ACEOF - - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then - break - elif $ac_last_try; then - { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 -echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} - { (exit 1); exit 1; }; } - else - ac_delim="$ac_delim!$ac_delim _$ac_delim!! " - fi -done - -ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` -if test -n "$ac_eof"; then - ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` - ac_eof=`expr $ac_eof + 1` -fi - -cat >>$CONFIG_STATUS <<_ACEOF -cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof -/@[a-zA-Z_][a-zA-Z_0-9]*@/!b -_ACEOF -sed ' -s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g -s/^/s,@/; s/!/@,|#_!!_#|/ -:n -t n -s/'"$ac_delim"'$/,g/; t -s/$/\\/; p -N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n -' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF -CEOF$ac_eof -_ACEOF - - -ac_delim='%!_!# ' -for ac_last_try in false false false false false :; do - cat >conf$$subs.sed <<_ACEOF -AR!$AR$ac_delim -RANLIB!$RANLIB$ac_delim -lt_ECHO!$lt_ECHO$ac_delim -DSYMUTIL!$DSYMUTIL$ac_delim -NMEDIT!$NMEDIT$ac_delim -LIPO!$LIPO$ac_delim -OTOOL!$OTOOL$ac_delim -OTOOL64!$OTOOL64$ac_delim -CXX!$CXX$ac_delim -CXXFLAGS!$CXXFLAGS$ac_delim -ac_ct_CXX!$ac_ct_CXX$ac_delim -CXXDEPMODE!$CXXDEPMODE$ac_delim -am__fastdepCXX_TRUE!$am__fastdepCXX_TRUE$ac_delim -am__fastdepCXX_FALSE!$am__fastdepCXX_FALSE$ac_delim -CXXCPP!$CXXCPP$ac_delim -LSB_RELEASE!$LSB_RELEASE$ac_delim -SIZEOF_WCHAR_T!$SIZEOF_WCHAR_T$ac_delim -REL_CODENAME!$REL_CODENAME$ac_delim -LIBOBJS!$LIBOBJS$ac_delim -LTLIBOBJS!$LTLIBOBJS$ac_delim -_ACEOF - - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 20; then - break - elif $ac_last_try; then - { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 -echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} - { (exit 1); exit 1; }; } - else - ac_delim="$ac_delim!$ac_delim _$ac_delim!! " - fi -done - -ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` -if test -n "$ac_eof"; then - ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` - ac_eof=`expr $ac_eof + 1` -fi - -cat >>$CONFIG_STATUS <<_ACEOF -cat >"\$tmp/subs-2.sed" <<\CEOF$ac_eof -/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end -_ACEOF -sed ' -s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g -s/^/s,@/; s/!/@,|#_!!_#|/ -:n -t n -s/'"$ac_delim"'$/,g/; t -s/$/\\/; p -N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n -' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF -:end -s/|#_!!_#|//g -CEOF$ac_eof -_ACEOF - - -# VPATH may cause trouble with some makes, so we remove $(srcdir), -# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and -# trailing colons and then remove the whole line if VPATH becomes empty -# (actually we leave an empty line to preserve line numbers). -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=/{ -s/:*\$(srcdir):*/:/ -s/:*\${srcdir}:*/:/ -s/:*@srcdir@:*/:/ -s/^\([^=]*=[ ]*\):*/\1/ -s/:*$// -s/^[^=]*=[ ]*$// -}' -fi - -cat >>$CONFIG_STATUS <<\_ACEOF -fi # test -n "$CONFIG_FILES" - - -for ac_tag in :F $CONFIG_FILES :C $CONFIG_COMMANDS -do - case $ac_tag in - :[FHLC]) ac_mode=$ac_tag; continue;; - esac - case $ac_mode$ac_tag in - :[FHL]*:*);; - :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5 -echo "$as_me: error: Invalid tag $ac_tag." >&2;} - { (exit 1); exit 1; }; };; - :[FH]-) ac_tag=-:-;; - :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; - esac - ac_save_IFS=$IFS - IFS=: - set x $ac_tag - IFS=$ac_save_IFS - shift - ac_file=$1 - shift - - case $ac_mode in - :L) ac_source=$1;; - :[FH]) - ac_file_inputs= - for ac_f - do - case $ac_f in - -) ac_f="$tmp/stdin";; - *) # Look for the file first in the build tree, then in the source tree - # (if the path is not absolute). The absolute path cannot be DOS-style, - # because $ac_f cannot contain `:'. - test -f "$ac_f" || - case $ac_f in - [\\/$]*) false;; - *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; - esac || - { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 -echo "$as_me: error: cannot find input file: $ac_f" >&2;} - { (exit 1); exit 1; }; };; - esac - ac_file_inputs="$ac_file_inputs $ac_f" - done - - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - configure_input="Generated from "`IFS=: - echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure." - if test x"$ac_file" != x-; then - configure_input="$ac_file. $configure_input" - { echo "$as_me:$LINENO: creating $ac_file" >&5 -echo "$as_me: creating $ac_file" >&6;} - fi - - case $ac_tag in - *:-:* | *:-) cat >"$tmp/stdin";; - esac - ;; - esac - - ac_dir=`$as_dirname -- "$ac_file" || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || -echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - { as_dir="$ac_dir" - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 -echo "$as_me: error: cannot create directory $as_dir" >&2;} - { (exit 1); exit 1; }; }; } - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - - case $ac_mode in - :F) - # - # CONFIG_FILE - # - - case $INSTALL in - [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; - *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; - esac - ac_MKDIR_P=$MKDIR_P - case $MKDIR_P in - [\\/$]* | ?:[\\/]* ) ;; - */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; - esac -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF -# If the template does not know about datarootdir, expand it. -# FIXME: This hack should be removed a few years after 2.60. -ac_datarootdir_hack=; ac_datarootdir_seen= - -case `sed -n '/datarootdir/ { - p - q -} -/@datadir@/p -/@docdir@/p -/@infodir@/p -/@localedir@/p -/@mandir@/p -' $ac_file_inputs` in -*datarootdir*) ac_datarootdir_seen=yes;; -*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) - { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 -echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF - ac_datarootdir_hack=' - s&@datadir@&$datadir&g - s&@docdir@&$docdir&g - s&@infodir@&$infodir&g - s&@localedir@&$localedir&g - s&@mandir@&$mandir&g - s&\\\${datarootdir}&$datarootdir&g' ;; -esac -_ACEOF - -# Neutralize VPATH when `$srcdir' = `.'. -# Shell code in configure.ac might set extrasub. -# FIXME: do we really want to maintain this feature? -cat >>$CONFIG_STATUS <<_ACEOF - sed "$ac_vpsub -$extrasub -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -:t -/@[a-zA-Z_][a-zA-Z_0-9]*@/!b -s&@configure_input@&$configure_input&;t t -s&@top_builddir@&$ac_top_builddir_sub&;t t -s&@srcdir@&$ac_srcdir&;t t -s&@abs_srcdir@&$ac_abs_srcdir&;t t -s&@top_srcdir@&$ac_top_srcdir&;t t -s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t -s&@builddir@&$ac_builddir&;t t -s&@abs_builddir@&$ac_abs_builddir&;t t -s&@abs_top_builddir@&$ac_abs_top_builddir&;t t -s&@INSTALL@&$ac_INSTALL&;t t -s&@MKDIR_P@&$ac_MKDIR_P&;t t -$ac_datarootdir_hack -" $ac_file_inputs | sed -f "$tmp/subs-1.sed" | sed -f "$tmp/subs-2.sed" >$tmp/out - -test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && - { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && - { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && - { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined." >&5 -echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined." >&2;} - - rm -f "$tmp/stdin" - case $ac_file in - -) cat "$tmp/out"; rm -f "$tmp/out";; - *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;; - esac - ;; - - - :C) { echo "$as_me:$LINENO: executing $ac_file commands" >&5 -echo "$as_me: executing $ac_file commands" >&6;} - ;; - esac - - - case $ac_file$ac_mode in - "depfiles":C) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do - # Strip MF so we end up with the name of the file. - mf=`echo "$mf" | sed -e 's/:.*$//'` - # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named `Makefile.in', but - # some people rename them; so instead we look at the file content. - # Grep'ing the first line is not enough: some people post-process - # each Makefile.in and add a new line on top of each file to say so. - # Grep'ing the whole file is not good either: AIX grep has a line - # limit of 2048, but all sed's we know have understand at least 4000. - if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then - dirpart=`$as_dirname -- "$mf" || -$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$mf" : 'X\(//\)[^/]' \| \ - X"$mf" : 'X\(//\)$' \| \ - X"$mf" : 'X\(/\)' \| . 2>/dev/null || -echo X"$mf" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - else - continue - fi - # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running `make'. - DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` - test -z "$DEPDIR" && continue - am__include=`sed -n 's/^am__include = //p' < "$mf"` - test -z "am__include" && continue - am__quote=`sed -n 's/^am__quote = //p' < "$mf"` - # When using ansi2knr, U may be empty or an underscore; expand it - U=`sed -n 's/^U = //p' < "$mf"` - # Find all dependency output files, they are included files with - # $(DEPDIR) in their names. We invoke sed twice because it is the - # simplest approach to changing $(DEPDIR) to its actual value in the - # expansion. - for file in `sed -n " - s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do - # Make sure the directory exists. - test -f "$dirpart/$file" && continue - fdir=`$as_dirname -- "$file" || -$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$file" : 'X\(//\)[^/]' \| \ - X"$file" : 'X\(//\)$' \| \ - X"$file" : 'X\(/\)' \| . 2>/dev/null || -echo X"$file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - { as_dir=$dirpart/$fdir - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 -echo "$as_me: error: cannot create directory $as_dir" >&2;} - { (exit 1); exit 1; }; }; } - # echo "creating $dirpart/$file" - echo '# dummy' > "$dirpart/$file" - done -done - ;; - "libtool":C) - - # See if we are running on zsh, and set the options which allow our - # commands through without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST - fi - - cfgfile="${ofile}T" - trap "$RM \"$cfgfile\"; exit 1" 1 2 15 - $RM "$cfgfile" - - cat <<_LT_EOF >> "$cfgfile" -#! $SHELL - -# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. -# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: -# NOTE: Changes made to this file will be lost: look at ltmain.sh. -# -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, -# 2006, 2007, 2008 Free Software Foundation, Inc. -# Written by Gordon Matzigkeit, 1996 -# -# This file is part of GNU Libtool. -# -# GNU Libtool is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or (at your option) any later version. -# -# As a special exception to the GNU General Public License, -# if you distribute this file as part of a program or library that -# is built using GNU Libtool, you may include this file under the -# same distribution terms that you use for the rest of that program. -# -# GNU Libtool is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Libtool; see the file COPYING. If not, a copy -# can be downloaded from http://www.gnu.org/licenses/gpl.html, or -# obtained by writing to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - - -# The names of the tagged configurations supported by this script. -available_tags="CXX " - -# ### BEGIN LIBTOOL CONFIG - -# Which release of libtool.m4 was used? -macro_version=$macro_version -macro_revision=$macro_revision - -# Whether or not to build shared libraries. -build_libtool_libs=$enable_shared - -# Whether or not to build static libraries. -build_old_libs=$enable_static - -# What type of objects to build. -pic_mode=$pic_mode - -# Whether or not to optimize for fast installation. -fast_install=$enable_fast_install - -# The host system. -host_alias=$host_alias -host=$host -host_os=$host_os - -# The build system. -build_alias=$build_alias -build=$build -build_os=$build_os - -# A sed program that does not truncate output. -SED=$lt_SED - -# Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="\$SED -e 1s/^X//" - -# A grep program that handles long lines. -GREP=$lt_GREP - -# An ERE matcher. -EGREP=$lt_EGREP - -# A literal string matcher. -FGREP=$lt_FGREP - -# A BSD- or MS-compatible name lister. -NM=$lt_NM - -# Whether we need soft or hard links. -LN_S=$lt_LN_S - -# What is the maximum length of a command? -max_cmd_len=$max_cmd_len - -# Object file suffix (normally "o"). -objext=$ac_objext - -# Executable file suffix (normally ""). -exeext=$exeext - -# whether the shell understands "unset". -lt_unset=$lt_unset - -# turn spaces into newlines. -SP2NL=$lt_lt_SP2NL - -# turn newlines into spaces. -NL2SP=$lt_lt_NL2SP - -# How to create reloadable object files. -reload_flag=$lt_reload_flag -reload_cmds=$lt_reload_cmds - -# Method to check whether dependent libraries are shared objects. -deplibs_check_method=$lt_deplibs_check_method - -# Command to use when deplibs_check_method == "file_magic". -file_magic_cmd=$lt_file_magic_cmd - -# The archiver. -AR=$lt_AR -AR_FLAGS=$lt_AR_FLAGS - -# A symbol stripping program. -STRIP=$lt_STRIP - -# Commands used to install an old-style archive. -RANLIB=$lt_RANLIB -old_postinstall_cmds=$lt_old_postinstall_cmds -old_postuninstall_cmds=$lt_old_postuninstall_cmds - -# A C compiler. -LTCC=$lt_CC - -# LTCC compiler flags. -LTCFLAGS=$lt_CFLAGS - -# Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe - -# Transform the output of nm in a proper C declaration. -global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl - -# Transform the output of nm in a C name address pair. -global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address - -# Transform the output of nm in a C name address pair when lib prefix is needed. -global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix - -# The name of the directory that contains temporary libtool files. -objdir=$objdir - -# Shell to use when invoking shell scripts. -SHELL=$lt_SHELL - -# An echo program that does not interpret backslashes. -ECHO=$lt_ECHO - -# Used to examine libraries when file_magic_cmd begins with "file". -MAGIC_CMD=$MAGIC_CMD - -# Must we lock files when doing compilation? -need_locks=$lt_need_locks - -# Tool to manipulate archived DWARF debug symbol files on Mac OS X. -DSYMUTIL=$lt_DSYMUTIL - -# Tool to change global to local symbols on Mac OS X. -NMEDIT=$lt_NMEDIT - -# Tool to manipulate fat objects and archives on Mac OS X. -LIPO=$lt_LIPO - -# ldd/readelf like tool for Mach-O binaries on Mac OS X. -OTOOL=$lt_OTOOL - -# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. -OTOOL64=$lt_OTOOL64 - -# Old archive suffix (normally "a"). -libext=$libext - -# Shared library suffix (normally ".so"). -shrext_cmds=$lt_shrext_cmds - -# The commands to extract the exported symbol list from a shared archive. -extract_expsyms_cmds=$lt_extract_expsyms_cmds - -# Variables whose values should be saved in libtool wrapper scripts and -# restored at link time. -variables_saved_for_relink=$lt_variables_saved_for_relink - -# Do we need the "lib" prefix for modules? -need_lib_prefix=$need_lib_prefix - -# Do we need a version for libraries? -need_version=$need_version - -# Library versioning type. -version_type=$version_type - -# Shared library runtime path variable. -runpath_var=$runpath_var - -# Shared library path variable. -shlibpath_var=$shlibpath_var - -# Is shlibpath searched before the hard-coded library search path? -shlibpath_overrides_runpath=$shlibpath_overrides_runpath - -# Format of library name prefix. -libname_spec=$lt_libname_spec - -# List of archive names. First name is the real one, the rest are links. -# The last name is the one that the linker finds with -lNAME -library_names_spec=$lt_library_names_spec - -# The coded name of the library, if different from the real name. -soname_spec=$lt_soname_spec - -# Command to use after installation of a shared archive. -postinstall_cmds=$lt_postinstall_cmds - -# Command to use after uninstallation of a shared archive. -postuninstall_cmds=$lt_postuninstall_cmds - -# Commands used to finish a libtool library installation in a directory. -finish_cmds=$lt_finish_cmds - -# As "finish_cmds", except a single script fragment to be evaled but -# not shown. -finish_eval=$lt_finish_eval - -# Whether we should hardcode library paths into libraries. -hardcode_into_libs=$hardcode_into_libs - -# Compile-time system search path for libraries. -sys_lib_search_path_spec=$lt_sys_lib_search_path_spec - -# Run-time system search path for libraries. -sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec - -# Whether dlopen is supported. -dlopen_support=$enable_dlopen - -# Whether dlopen of programs is supported. -dlopen_self=$enable_dlopen_self - -# Whether dlopen of statically linked programs is supported. -dlopen_self_static=$enable_dlopen_self_static - -# Commands to strip libraries. -old_striplib=$lt_old_striplib -striplib=$lt_striplib - - -# The linker used to build libraries. -LD=$lt_LD - -# Commands used to build an old-style archive. -old_archive_cmds=$lt_old_archive_cmds - -# A language specific compiler. -CC=$lt_compiler - -# Is the compiler the GNU compiler? -with_gcc=$GCC - -# Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag - -# How to pass a linker flag through the compiler. -wl=$lt_lt_prog_compiler_wl - -# Additional compiler flags for building library objects. -pic_flag=$lt_lt_prog_compiler_pic - -# Compiler flag to prevent dynamic linking. -link_static_flag=$lt_lt_prog_compiler_static - -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_lt_cv_prog_compiler_c_o - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$archive_cmds_need_lc - -# Whether or not to disallow shared libs when runtime libs are static. -allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_export_dynamic_flag_spec - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_whole_archive_flag_spec - -# Whether the compiler copes with passing no objects directly. -compiler_needs_object=$lt_compiler_needs_object - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_old_archive_from_new_cmds - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds - -# Commands used to build a shared archive. -archive_cmds=$lt_archive_cmds -archive_expsym_cmds=$lt_archive_expsym_cmds - -# Commands used to build a loadable module if different from building -# a shared archive. -module_cmds=$lt_module_cmds -module_expsym_cmds=$lt_module_expsym_cmds - -# Whether we are building with GNU ld or not. -with_gnu_ld=$lt_with_gnu_ld - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_allow_undefined_flag - -# Flag that enforces no undefined symbols. -no_undefined_flag=$lt_no_undefined_flag - -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist -hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec - -# If ld is used when linking, flag to hardcode \$libdir into a binary -# during linking. This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld - -# Whether we need a single "-rpath" flag with a separated argument. -hardcode_libdir_separator=$lt_hardcode_libdir_separator - -# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes -# DIR into the resulting binary. -hardcode_direct=$hardcode_direct - -# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes -# DIR into the resulting binary and the resulting library dependency is -# "absolute",i.e impossible to change by setting \${shlibpath_var} if the -# library is relocated. -hardcode_direct_absolute=$hardcode_direct_absolute - -# Set to "yes" if using the -LDIR flag during linking hardcodes DIR -# into the resulting binary. -hardcode_minus_L=$hardcode_minus_L - -# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR -# into the resulting binary. -hardcode_shlibpath_var=$hardcode_shlibpath_var - -# Set to "yes" if building a shared library automatically hardcodes DIR -# into the library and all subsequent libraries and executables linked -# against it. -hardcode_automatic=$hardcode_automatic - -# Set to yes if linker adds runtime paths of dependent libraries -# to runtime path list. -inherit_rpath=$inherit_rpath - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$link_all_deplibs - -# Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path=$lt_fix_srcfile_path - -# Set to "yes" if exported symbols are required. -always_export_symbols=$always_export_symbols - -# The commands to list exported symbols. -export_symbols_cmds=$lt_export_symbols_cmds - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_exclude_expsyms - -# Symbols that must always be exported. -include_expsyms=$lt_include_expsyms - -# Commands necessary for linking programs (against libraries) with templates. -prelink_cmds=$lt_prelink_cmds - -# Specify filename containing input files. -file_list_spec=$lt_file_list_spec - -# How to hardcode a shared library path into an executable. -hardcode_action=$hardcode_action - -# The directories searched by this compiler when creating a shared library. -compiler_lib_search_dirs=$lt_compiler_lib_search_dirs - -# Dependencies to place before and after the objects being linked to -# create a shared library. -predep_objects=$lt_predep_objects -postdep_objects=$lt_postdep_objects -predeps=$lt_predeps -postdeps=$lt_postdeps - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path=$lt_compiler_lib_search_path - -# ### END LIBTOOL CONFIG - -_LT_EOF - - case $host_os in - aix3*) - cat <<\_LT_EOF >> "$cfgfile" -# AIX sometimes has problems with the GCC collect2 program. For some -# reason, if we set the COLLECT_NAMES environment variable, the problems -# vanish in a puff of smoke. -if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES -fi -_LT_EOF - ;; - esac - - -ltmain="$ac_aux_dir/ltmain.sh" - - - # We use sed instead of cat because bash on DJGPP gets confused if - # if finds mixed CR/LF and LF-only lines. Since sed operates in - # text mode, it properly converts lines to CR/LF. This bash problem - # is reportedly fixed, but why not run on old versions too? - sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \ - || (rm -f "$cfgfile"; exit 1) - - case $xsi_shell in - yes) - cat << \_LT_EOF >> "$cfgfile" - -# func_dirname file append nondir_replacement -# Compute the dirname of FILE. If nonempty, add APPEND to the result, -# otherwise set result to NONDIR_REPLACEMENT. -func_dirname () -{ - case ${1} in - */*) func_dirname_result="${1%/*}${2}" ;; - * ) func_dirname_result="${3}" ;; - esac -} - -# func_basename file -func_basename () -{ - func_basename_result="${1##*/}" -} - -# func_dirname_and_basename file append nondir_replacement -# perform func_basename and func_dirname in a single function -# call: -# dirname: Compute the dirname of FILE. If nonempty, -# add APPEND to the result, otherwise set result -# to NONDIR_REPLACEMENT. -# value returned in "$func_dirname_result" -# basename: Compute filename of FILE. -# value retuned in "$func_basename_result" -# Implementation must be kept synchronized with func_dirname -# and func_basename. For efficiency, we do not delegate to -# those functions but instead duplicate the functionality here. -func_dirname_and_basename () -{ - case ${1} in - */*) func_dirname_result="${1%/*}${2}" ;; - * ) func_dirname_result="${3}" ;; - esac - func_basename_result="${1##*/}" -} - -# func_stripname prefix suffix name -# strip PREFIX and SUFFIX off of NAME. -# PREFIX and SUFFIX must not contain globbing or regex special -# characters, hashes, percent signs, but SUFFIX may contain a leading -# dot (in which case that matches only a dot). -func_stripname () -{ - # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are - # positional parameters, so assign one to ordinary parameter first. - func_stripname_result=${3} - func_stripname_result=${func_stripname_result#"${1}"} - func_stripname_result=${func_stripname_result%"${2}"} -} - -# func_opt_split -func_opt_split () -{ - func_opt_split_opt=${1%%=*} - func_opt_split_arg=${1#*=} -} - -# func_lo2o object -func_lo2o () -{ - case ${1} in - *.lo) func_lo2o_result=${1%.lo}.${objext} ;; - *) func_lo2o_result=${1} ;; - esac -} - -# func_xform libobj-or-source -func_xform () -{ - func_xform_result=${1%.*}.lo -} - -# func_arith arithmetic-term... -func_arith () -{ - func_arith_result=$(( $* )) -} - -# func_len string -# STRING may not start with a hyphen. -func_len () -{ - func_len_result=${#1} -} - -_LT_EOF - ;; - *) # Bourne compatible functions. - cat << \_LT_EOF >> "$cfgfile" - -# func_dirname file append nondir_replacement -# Compute the dirname of FILE. If nonempty, add APPEND to the result, -# otherwise set result to NONDIR_REPLACEMENT. -func_dirname () -{ - # Extract subdirectory from the argument. - func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"` - if test "X$func_dirname_result" = "X${1}"; then - func_dirname_result="${3}" - else - func_dirname_result="$func_dirname_result${2}" - fi -} - -# func_basename file -func_basename () -{ - func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"` -} - - -# func_stripname prefix suffix name -# strip PREFIX and SUFFIX off of NAME. -# PREFIX and SUFFIX must not contain globbing or regex special -# characters, hashes, percent signs, but SUFFIX may contain a leading -# dot (in which case that matches only a dot). -# func_strip_suffix prefix name -func_stripname () -{ - case ${2} in - .*) func_stripname_result=`$ECHO "X${3}" \ - | $Xsed -e "s%^${1}%%" -e "s%\\\\${2}\$%%"`;; - *) func_stripname_result=`$ECHO "X${3}" \ - | $Xsed -e "s%^${1}%%" -e "s%${2}\$%%"`;; - esac -} - -# sed scripts: -my_sed_long_opt='1s/^\(-[^=]*\)=.*/\1/;q' -my_sed_long_arg='1s/^-[^=]*=//' - -# func_opt_split -func_opt_split () -{ - func_opt_split_opt=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_opt"` - func_opt_split_arg=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_arg"` -} - -# func_lo2o object -func_lo2o () -{ - func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"` -} - -# func_xform libobj-or-source -func_xform () -{ - func_xform_result=`$ECHO "X${1}" | $Xsed -e 's/\.[^.]*$/.lo/'` -} - -# func_arith arithmetic-term... -func_arith () -{ - func_arith_result=`expr "$@"` -} - -# func_len string -# STRING may not start with a hyphen. -func_len () -{ - func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len` -} - -_LT_EOF -esac - -case $lt_shell_append in - yes) - cat << \_LT_EOF >> "$cfgfile" - -# func_append var value -# Append VALUE to the end of shell variable VAR. -func_append () -{ - eval "$1+=\$2" -} -_LT_EOF - ;; - *) - cat << \_LT_EOF >> "$cfgfile" - -# func_append var value -# Append VALUE to the end of shell variable VAR. -func_append () -{ - eval "$1=\$$1\$2" -} - -_LT_EOF - ;; - esac - - - sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \ - || (rm -f "$cfgfile"; exit 1) - - mv -f "$cfgfile" "$ofile" || - (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") - chmod +x "$ofile" - - - cat <<_LT_EOF >> "$ofile" - -# ### BEGIN LIBTOOL TAG CONFIG: CXX - -# The linker used to build libraries. -LD=$lt_LD_CXX - -# Commands used to build an old-style archive. -old_archive_cmds=$lt_old_archive_cmds_CXX - -# A language specific compiler. -CC=$lt_compiler_CXX - -# Is the compiler the GNU compiler? -with_gcc=$GCC_CXX - -# Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX - -# How to pass a linker flag through the compiler. -wl=$lt_lt_prog_compiler_wl_CXX - -# Additional compiler flags for building library objects. -pic_flag=$lt_lt_prog_compiler_pic_CXX - -# Compiler flag to prevent dynamic linking. -link_static_flag=$lt_lt_prog_compiler_static_CXX - -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$archive_cmds_need_lc_CXX - -# Whether or not to disallow shared libs when runtime libs are static. -allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX - -# Whether the compiler copes with passing no objects directly. -compiler_needs_object=$lt_compiler_needs_object_CXX - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX - -# Commands used to build a shared archive. -archive_cmds=$lt_archive_cmds_CXX -archive_expsym_cmds=$lt_archive_expsym_cmds_CXX - -# Commands used to build a loadable module if different from building -# a shared archive. -module_cmds=$lt_module_cmds_CXX -module_expsym_cmds=$lt_module_expsym_cmds_CXX - -# Whether we are building with GNU ld or not. -with_gnu_ld=$lt_with_gnu_ld_CXX - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_allow_undefined_flag_CXX - -# Flag that enforces no undefined symbols. -no_undefined_flag=$lt_no_undefined_flag_CXX - -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist -hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX - -# If ld is used when linking, flag to hardcode \$libdir into a binary -# during linking. This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_CXX - -# Whether we need a single "-rpath" flag with a separated argument. -hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX - -# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes -# DIR into the resulting binary. -hardcode_direct=$hardcode_direct_CXX - -# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes -# DIR into the resulting binary and the resulting library dependency is -# "absolute",i.e impossible to change by setting \${shlibpath_var} if the -# library is relocated. -hardcode_direct_absolute=$hardcode_direct_absolute_CXX - -# Set to "yes" if using the -LDIR flag during linking hardcodes DIR -# into the resulting binary. -hardcode_minus_L=$hardcode_minus_L_CXX - -# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR -# into the resulting binary. -hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX - -# Set to "yes" if building a shared library automatically hardcodes DIR -# into the library and all subsequent libraries and executables linked -# against it. -hardcode_automatic=$hardcode_automatic_CXX - -# Set to yes if linker adds runtime paths of dependent libraries -# to runtime path list. -inherit_rpath=$inherit_rpath_CXX - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$link_all_deplibs_CXX - -# Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path=$lt_fix_srcfile_path_CXX - -# Set to "yes" if exported symbols are required. -always_export_symbols=$always_export_symbols_CXX - -# The commands to list exported symbols. -export_symbols_cmds=$lt_export_symbols_cmds_CXX - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_exclude_expsyms_CXX - -# Symbols that must always be exported. -include_expsyms=$lt_include_expsyms_CXX - -# Commands necessary for linking programs (against libraries) with templates. -prelink_cmds=$lt_prelink_cmds_CXX - -# Specify filename containing input files. -file_list_spec=$lt_file_list_spec_CXX - -# How to hardcode a shared library path into an executable. -hardcode_action=$hardcode_action_CXX - -# The directories searched by this compiler when creating a shared library. -compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_CXX - -# Dependencies to place before and after the objects being linked to -# create a shared library. -predep_objects=$lt_predep_objects_CXX -postdep_objects=$lt_postdep_objects_CXX -predeps=$lt_predeps_CXX -postdeps=$lt_postdeps_CXX - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path=$lt_compiler_lib_search_path_CXX - -# ### END LIBTOOL TAG CONFIG: CXX -_LT_EOF - - ;; - - esac -done # for ac_tag - - -{ (exit 0); exit 0; } -_ACEOF -chmod +x $CONFIG_STATUS -ac_clean_files=$ac_clean_files_save - - -# configure is writing to config.log, and then calls config.status. -# config.status does its own redirection, appending to config.log. -# Unfortunately, on DOS this fails, as config.log is still kept open -# by configure, so config.status won't be able to write to it; its -# output is simply discarded. So we exec the FD to /dev/null, -# effectively closing config.log, so it can be properly (re)opened and -# appended to by config.status. When coming back to configure, we -# need to make the FD available again. -if test "$no_create" != yes; then - ac_cs_success=: - ac_config_status_args= - test "$silent" = yes && - ac_config_status_args="$ac_config_status_args --quiet" - exec 5>/dev/null - $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false - exec 5>>config.log - # Use ||, not &&, to avoid exiting from the if with $? = 1, which - # would make configure fail if this is the last instruction. - $ac_cs_success || { (exit 1); exit 1; } -fi - diff --git a/Build/source/libs/graphite/engine-2.3.1/configure.ac b/Build/source/libs/graphite/engine-2.3.1/configure.ac deleted file mode 100644 index daad80cafca..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/configure.ac +++ /dev/null @@ -1,140 +0,0 @@ -AC_PREREQ(2.54) - -AC_INIT(silgraphite, 2.3.1, silgraphite-devel@lists.sourceforge.net) -AC_CONFIG_MACRO_DIR([m4]) -AC_CONFIG_SRCDIR(src/segment/GrEngine.cpp) -AC_CONFIG_AUX_DIR(config) - -# setup automake -AM_INIT_AUTOMAKE(foreign) -AM_MAINTAINER_MODE - -# System checks. -AC_CANONICAL_HOST -AC_C_BIGENDIAN - -# Optional features -AC_ARG_ENABLE(tracing, - AC_HELP_STRING([--disable-tracing], - [build without support for trace Graphite logs])) - test "x$enable_tracing" != xno && enable_tracing=yes - -AC_ARG_ENABLE(debug, - AC_HELP_STRING([--enable-debug], - [build with debugging. (default=no)])) -AC_ARG_ENABLE(final, - AC_HELP_STRING([--disable-final], - [build without optimizations and no debugging.])) - test "x$enable_final" != xno && enable_final=yes -AC_ARG_ENABLE(strict, - AC_HELP_STRING([--enable-strict], - [treat warnings as errors, check for as much as we can])) - -AC_ARG_ENABLE(profile, - AC_HELP_STRING([--enable-profile], - [allow profiling (default=no)])) -AC_ARG_ENABLE(profilefn, - AC_HELP_STRING([--enable-profilefn], - [allow functioncheck profiling (default=no)])) - -# Checks for programs. -AC_PROG_INSTALL -AC_PROG_LIBTOOL -AC_PROG_CC -AC_PROG_CXX -AC_LANG_CPLUSPLUS - -AC_PATH_PROG(LSB_RELEASE, lsb_release, no) - -# Checks for libraries. - -# Checks for header files. -AC_HEADER_STDC - -# Checks for typedefs, structures, and compiler characteristics. -AC_TYPE_SIZE_T -AC_CHECK_SIZEOF(wchar_t) -AC_SUBST(SIZEOF_WCHAR_T) - -AC_CHECK_FUNCS(fabsf) - -# Checks for library functions. - -# Setup the build compiler flags and linker flags. -# Enable debug -# (note: the flags here are gcc-specific and may fail with other compilers) -build_flags="" -if test "$enable_debug" = yes; then - build_flags="$build_flags -O0 -g -Wall -Wno-unknown-pragmas -Wparentheses" -elif test "$enable_strict" = yes; then - build_flags="$build_flags -DNDEBUG -Wall -Wno-unknown-pragmas -Wparentheses -Werror" -else - build_flags="$build_flags -DNDEBUG" -fi - -# Enable Graphite Trace logs - these are only used if a -# LayoutEnvironment has a valid ostream pointer -if test "$enable_tracing" = yes; then - build_flags="$build_flags -DTRACING" -fi - -# Enable final -if test "$enable_final" = yes; then - build_flags="$build_flags -O3 -DNDEBUG" -fi - -# Enable profile -if test "$enable_profile" = yes; then - build_flags="$build_flags -pg " -fi -if test "$enable_profilefn" = yes; then - build_flags="$build_flags -g -finstrument-functions " - LIBS="$LIBS -g -finstrument-functions -lfnccheck " -fi - -# Find distrib codename - -AC_MSG_CHECKING(if already have REL_CODENAME) -if test -z "${REL_CODENAME}"; then - AC_MSG_RESULT(no) - AC_MSG_CHECKING(if have lsb_release) - if test "${LSB_RELEASE}" = "no"; then - AC_MSG_RESULT(no) - REL_CODENAME="unstable" - else - AC_MSG_RESULT(yes) - AC_MSG_CHECKING(if LSB_RELEASE is empty) - if test -z ${LSB_RELEASE}; then - AC_MSG_RESULT(yes) - REL_CODENAME="unstable" - else - AC_MSG_RESULT(no) - CODENAME=`${LSB_RELEASE} -c | sed -e 's/^\S*\s*//'` - AC_MSG_CHECKING(if release is sid) - if test ${CODENAME} = 'sid'; then - AC_MSG_RESULT(yes) - REL_CODENAME="unstable" - else - AC_MSG_RESULT(no, ${CODENAME}) - REL_CODENAME=${CODENAME} - fi - fi - fi -else - AC_MSG_RESULT(yes) -fi - -AC_SUBST(REL_CODENAME) - -CFLAGS="$CFLAGS $build_flags" -CXXFLAGS="$CXXFLAGS $build_flags" - -AC_CONFIG_FILES(Makefile \ - silgraphite.pc:installed-top.pc.in:silgraphite.pc.in \ - silgraphite-uninstalled.pc:uninstalled-top.pc.in:silgraphite.pc.in \ - src/Makefile \ - test/Makefile \ - test/RegressionTest/Makefile \ - test/ProfileHarness/Makefile) - -AC_OUTPUT diff --git a/Build/source/libs/graphite/engine-2.3.1/doc/GTF_3_0.odt b/Build/source/libs/graphite/engine-2.3.1/doc/GTF_3_0.odt deleted file mode 100644 index 36b3e136dd9..00000000000 Binary files a/Build/source/libs/graphite/engine-2.3.1/doc/GTF_3_0.odt and /dev/null differ diff --git a/Build/source/libs/graphite/engine-2.3.1/doc/V2_Engine_Interface.odt b/Build/source/libs/graphite/engine-2.3.1/doc/V2_Engine_Interface.odt deleted file mode 100644 index 63b874c16fa..00000000000 Binary files a/Build/source/libs/graphite/engine-2.3.1/doc/V2_Engine_Interface.odt and /dev/null differ diff --git a/Build/source/libs/graphite/engine-2.3.1/doc/V2_Segment_Interface.odt b/Build/source/libs/graphite/engine-2.3.1/doc/V2_Segment_Interface.odt deleted file mode 100644 index 0c8b98f1e9a..00000000000 Binary files a/Build/source/libs/graphite/engine-2.3.1/doc/V2_Segment_Interface.odt and /dev/null differ diff --git a/Build/source/libs/graphite/engine-2.3.1/doc/V2_TextSource_Interface.odt b/Build/source/libs/graphite/engine-2.3.1/doc/V2_TextSource_Interface.odt deleted file mode 100644 index dc869c986c3..00000000000 Binary files a/Build/source/libs/graphite/engine-2.3.1/doc/V2_TextSource_Interface.odt and /dev/null differ diff --git a/Build/source/libs/graphite/engine-2.3.1/doc/hungarian.txt b/Build/source/libs/graphite/engine-2.3.1/doc/hungarian.txt deleted file mode 100644 index 946c9a4bc97..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/doc/hungarian.txt +++ /dev/null @@ -1,126 +0,0 @@ -GRAPHITE HUNGARIAN NOTATION - -General rules for variable names: - -* Syntax is: - scope indicator (if any) - combining prefix (zero or more) - type/class indicator (required) - usage labels (optional) - -* The only places underscores are used are after the scoping prefixes. Uppercase is used to separate the prefixes from the main label, if any; eg: strName, m_psegNew. - -* If you are creating a new class, make up a short indicator for it and use it consistently. Class indicators should be 3-6 characters long. - -* An appropriate way to indicate method arguments where necessary is with an "Arg" usage label, eg: nValueArg. Generally method arguments have no special indication. - -* Usage labels can be made up arbitrarily, but the ones listed below should be used if they apply. - - -*** Scope indicators: - -m_ member variable -s_ static (global) variable - - -*** Combining prefixes: - -i index -c counter -p pointer -pp double pointer -rg range (array, especially stack-allocated) -prg pointer to the start of an array (often used for method arguments) -v vector -d delta or difference -k constant (combines with an enumeration identifier: eg, klb, kest, kgmet, etc) - - -*** Basic type indicators: - -f boolean (flag) -n integer (simple numerical value--not a counter, index, glyph id, char, measurement, etc.) -b byte -l long integer (whatever that means) -ch character (width irrelevant) -chs short character (8-bit) -chw wide character (16-bit) -chl long (32-bit) character -str string (char-width irrelevant) -sta ANSI string (8-bit) -stu Unicode string (16-bit) -fxd fixed-field integer -v void (yes, this duplicates vector) - -Graphite specific integer types: - -gid glyph id -m em-units -xs logical units, x-coordinates (source) -ys logical units, y-coordinates (source) -xys logical units, x- or y-coordinates (source) -xd display units, x-coordinates -yd display units, y-coordinates -xyd display units, x- or y-coordinates - - -*** Common Graphite-specific class prefixes (not a complete list) - -seg Segment -font Font -txsrc TextSource -fface FontFace -pass GrPass -greng GrEngine -tman GrTableManager -sstrm GrSlotStream -slot GrSlotState -slout GrSlotOutput -chstrm GrCharStream -gbb glyph bounding box - - -*** Enumeration prefixes (see the GrConstants.h and GrData.h files for a more complete list) - -lb line break (breakweight) -twsh trailing whitespace handling -est end-segment type (why the segment was terminated) -dm draw mode (for insertion points) -dirc directionality code -slat slot attribute name -clr color -op operator in Graphite's stack machine - - -*** Usage labels (somewhat optional, depending on context) - -Min first in a sequence or array (used with Lim); minimum (used with Max) -Lim 1 + last in a sequence or array -Max maximum -First first in a sequence (used with Last) -Last last in a sequence -Prev previous -Next next -Ret return value -In input -Out output -New newly created object -Arg method argument - ------------------ - -EXAMPLES - -pf pointer to boolean -cch character count -ipassPrev index of previous pass -pppass pointer to a pointer to a pass -iislot index to an index to a GrSlotState -vich vector of character indices -prgchw pointer to the start of a wide-char buffer -dislot delta to apply to an index of a GrSlotState -m_ipass index of pass (member variable) -ppassNew pointer to a newly created pass -clrBack background color -m_igbbFirst index to the first glyph bounding box (member variable) -islotLim 1 + index of the last slot \ No newline at end of file diff --git a/Build/source/libs/graphite/engine-2.3.1/doc/policy.txt b/Build/source/libs/graphite/engine-2.3.1/doc/policy.txt deleted file mode 100644 index e3acbb4bcec..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/doc/policy.txt +++ /dev/null @@ -1,19 +0,0 @@ -POLICIES - -This document keeps a dated list of policy changes that we may come up with -or recind or generally do whatever we want with. There's no carefully worked -out framework in which these policies sit, they are just rules we intend -to keep and break when we need to! - -2007-04-02 - -API Changes Policy - -Any changes to the public API will be documented on the developers' list along -with a branch into which the corresponding code changes will be placed. -Following the announcement, the branch will not be merged into the trunk for -at least 1 week. After which, depending on how the development has gone and -the comments or otherwise, the merge may: take place unannounced, be delayed -unannounced or be dropped and not take place, in which case an announcement -will be made on the developers' list. - diff --git a/Build/source/libs/graphite/engine-2.3.1/include/Makefile.am b/Build/source/libs/graphite/engine-2.3.1/include/Makefile.am deleted file mode 100644 index 83286118d8d..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/include/Makefile.am +++ /dev/null @@ -1,29 +0,0 @@ -graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/FileFont.h -graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/Font.h -graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/GraphiteProcess.h -graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/GrAppData.h -graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/GrClient.h -graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/GrCommon.h -graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/GrConstants.h -graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/GrData.h -graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/GrDebug.h -graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/GrExt.h -graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/GrFeature.h -graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/GrMstypes.h -graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/GrPlatform.h -graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/GrResult.h -graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/GrStructs.h -graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/GrWrappers.h -graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/IGraphiteProcess.h -graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/IGrEngine.h -graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/IGrJustifier.h -graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/ITextSource.h -graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/MemoryUsage.h -graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/SegmentAux.h -graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/Segment.h -graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/SegmentPainter.h - -EXTRA_DIST += $(top_srcdir)/include/graphite/BinTree.h -EXTRA_DIST += $(top_srcdir)/include/graphite/GenericResource.h -EXTRA_DIST += $(top_srcdir)/include/graphite/HashMap.h - diff --git a/Build/source/libs/graphite/engine-2.3.1/include/graphite/BinTree.h b/Build/source/libs/graphite/engine-2.3.1/include/graphite/BinTree.h deleted file mode 100644 index a487df03770..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/include/graphite/BinTree.h +++ /dev/null @@ -1,71 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 1999, 2001 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: BinTree.h -Responsibility: Darrell Zook -Last reviewed: 9/8/99 - -Description: - This file provides declarations of binary tree class(es). -----------------------------------------------------------------------------------------------*/ -#ifdef _MSC_VER -#pragma once -#endif -#ifndef BINTREE_H_INCLUDED -#define BINTREE_H_INCLUDED - -/*---------------------------------------------------------------------------------------------- - This template class implements a balanced tree, which is a binary tree where the height of - the two children of any node in the tree can only be different by +/- 1 or 0. - - The class of objects to be stored in the tree should be derived from BalTreeBase, because - the constructor of BalTreeBase adds an object to the tree in sorted order without - allocating any memory. - - Classes that derive from BalTreeBase must have a CompareKey member function that compares - a given key with this->key to determine which should be first when sorting the tree. - The declaration of CompareKey should be as follows: - int CompareKey(const Key & key); - and it should return: - <0 if key is less than the key in the current node (this->key) - 0 if key is equal to the key in the current node (this->key) - >0 if key is greater than the key in the current node (this->key) - - CAUTION: Classes that use this template should never be dynamically instantiated (by using - local variables or new/NewObj). This class is meant to be used only for global - instances of a class. The reason for this restriction is that the tree is never - destroyed, so using dynamic instantiations of objects would result in stale pointers - in the tree. - - Hungarian: btb -----------------------------------------------------------------------------------------------*/ - -template class BalTreeBase -{ -protected: - // Pointers to the left and right subtrees. - Obj * m_rgpobj[2]; - - // The difference between the height of the right sub tree and the height of the left - // sub tree. This should be -1, 0, or +1. Insert may temporarily set it to -2 or +2. - short m_dht; - - // Which way we went from this node when inserting the new node. - short m_ipobj; - - // Inserts this in the balanced tree. - BalTreeBase(Obj ** ppobjRoot, const Key & key); - - // Returns a node with the given key from the tree rooted at pobjRoot. - static Obj * Find(Obj * pobjRoot, const Key & key); - -private: - // Inserts a node in the tree rooted at *ppobjRoot, sorting it based on key. - void Insert(Obj ** ppobjRoot, const Key & key); -}; - -#endif // !BINTREE_H_INCLUDED - diff --git a/Build/source/libs/graphite/engine-2.3.1/include/graphite/FileFont.h b/Build/source/libs/graphite/engine-2.3.1/include/graphite/FileFont.h deleted file mode 100644 index bbb26266c71..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/include/graphite/FileFont.h +++ /dev/null @@ -1,260 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 1999, 2001, 2005 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: XftFont.h -Responsibility: Keith Stribley -Last reviewed: Not yet. - -Description: - A Font is an object that represents a font-family + bold + italic setting, that contains - Graphite tables. -----------------------------------------------------------------------------------------------*/ -#ifndef FILEFONT_INCLUDED -#define FILEFONT_INCLUDED -#include "Font.h" - - -//:End Ignore - - -namespace gr -{ - -class FontTableCache; -class GrEngine; -/*----------------------------------------------------------------------------- - Stock implementation of an Xft font class. -------------------------------------------------------------------------------*/ -/** -* An implementation of the Graphite gr::Font class for Xft fonts for use on -* systems using X. Freetype is used to retrieve font information. -* If you are using Freetype directly, without Xft, you can pass in a FT_Face -* directly. -*/ -class FileFont : public Font -{ -public: - /** - * The main user constructor. Constructs the font from the supplied FILE pointer. - * @param file the FILE pointer to initialise from (must not be null) - */ - FileFont(FILE * file, float pointSize, unsigned int DPIx, unsigned int DPIy = 0); - - /** - * Alternative user constructor. Constructs the font from the supplied filename. - * @param filename character array - */ - FileFont(char * filename, float pointSize, unsigned int DPIx, unsigned int DPIy = 0); - - /** - * Alternative user constructor. Constructs the font from the supplied filename. - * @param filename as a string - */ - FileFont(std::string filename, float pointSize, - unsigned int DPIx, unsigned int DPIy = 0); - - - /** - * Destructor - cleans up the tables that it has allocated if all other copies - * of this font have been deleted. - */ - virtual ~FileFont(); - - /** - * Returns a copy of the recipient. Specifically needed to store the Font - * in a segment. - * @internal - */ - virtual Font * copyThis(); - - /** - * Copy constructor - note the tables are shared between the copy and the - * original font for efficiency reasons. - * The last copy to be deleted will delete the tables. - * @param font the XftGrFont object to copy from. - * @internal - */ - FileFont(const FileFont & font, float pointSize = 0, unsigned int DPIx = 0, unsigned int DPIy = 0); - - //virtual FontErrorCode isValidForGraphite(int * pnVersion = NULL, int * pnSubVersion = NULL); - /** - * Returns a pointer to the start of a table in the font. The ftblid32 type - * is a 32-bit unsigned integer. - * If the Font class cannot easily determine the length of the table, it may - * set 0 as the length (while returning a non-NULL pointer to the table). This - * means that certain kinds of error checking cannot be done by the Graphite - * engine. - * Throws an exception if there is some other error in reading the table, or if - * the table asked for is not one of the expected ones (cmap, head, name, Sile, - * Silf, Feat, Gloc, Glat). [If we want to be able to read “non-standard” - * tables, then the caller needs to be responsible for freeing the memory.] - */ - virtual const void * getTable(fontTableId32 tableID, size_t * pcbSize); - - /** - * Returns the basic metrics of the font. It corresponds to the current - * GrGraphics::get_FontAscent, get_FontDescent and GetFontEmSquare methods. - * @param pAscent pointer to hold font ascent - * @param pDescent pointer to hold font descent - * @param pEmSquare pointer to hold font EM square - */ - virtual void getFontMetrics(float * pAscent, float * pDescent = NULL, - float * pEmSquare = NULL); - - /** - * Returns true if the given arguments specify a font that contains Graphite - * tables—specfically a “Silf” table. - * @param xftFont XftFont pointer - * @return true if this font has the silf table - */ - bool fontHasGraphiteTables(); - - /** - * Returns true if the given arguments specify a font that contains Graphite - * tables—specfically a “Silf” table. - * @param xftFont XftFont pointer - * @return true if this font has the silf table - */ - static bool FontHasGraphiteTables(FILE * file); - - /** - * Returns true if the given arguments specify a font that contains Graphite - * tables—specfically a “Silf” table. - * @param face FT_Face handle - * @return true if this font has the silf table - */ - static bool FontHasGraphiteTables(char * filename); - - // Temporary, until interface gets thoroughly reworked: - GrEngine * GraphiteEngine(); - - /** - * Returns the font ascent in pixels. Using floating point allows us to - * avoid rounding errors. - * Value is the same as that returned by getFontMetrics() - * @return the font ascent - */ - virtual float ascent() - { - float pixAscent; - getFontMetrics(&pixAscent); - return pixAscent; - } - /** - * Returns the font descent in pixels with a positive sign. - * Value is the same as that returned by getFontMetrics() - * @return the font descent in pixels. - */ - virtual float descent() - { - float pixDescent; - getFontMetrics(NULL, &pixDescent); - return pixDescent; - } - /** - * Returns the total height of the font. - * Equivalent to ascent() + descent(). - * @return font height - */ - virtual float height() - { - float pixAscent; - float pixDescent; - getFontMetrics(&pixAscent, &pixDescent); - return (pixAscent + pixDescent); - } - /** - * @return true if the font is a bold styled one. - */ - virtual bool bold() - { - return m_fBold; - } - /** - * @return true if the font is italic - */ - virtual bool italic() - { - return m_fItalic; - } - /** @return the DPI for the x-axis. - */ - virtual unsigned int getDPIx() - { - return m_dpiX; - } - /** @return Returns the DPI for the y-axis. - */ - virtual unsigned int getDPIy() - { - return m_dpiY; - } - // Specific to XftGrFont: - - /** @return set the DPI for the x-axis. - */ - virtual void setDPIx(unsigned int dpi) - { - m_dpiX = dpi; - m_xScale = scaleFromDpi(dpi); - } - /** @return set the DPI for the y-axis. - */ - virtual void setDPIy(unsigned int dpi) - { - m_dpiY = dpi; - m_yScale = scaleFromDpi(dpi); - } - - bool isValid() { return m_fIsValid; }; -protected: - /** Default constructor is not used */ - FileFont(); - /** - * Common initialisation between the XftFont and FT_Face constructors. - */ - void initializeFromFace(void); - // this uses an int to avoid having to include TtfUtil.h in the include - // directory - byte * readTable(int /*TableId*/ tableId, size_t & size); - - // pixels-per-em = dpi * point-size / 72 - // pixel-coord = design-coord * pixels-per-em / font-em-square - float scaleFromDpi(int dpi) - { - return (dpi * m_pointSize) / (72.0f * m_mEmSquare); - } - - // Member variables: - FILE * m_pfile; - - unsigned long m_clrFore; - unsigned long m_clrBack; - bool m_fBold; - bool m_fItalic; - // font table caches: - FontTableCache * m_pTableCache; - - // KRS: I think these should be cached otherwise Segment::LineContextSegment doesn't work - float m_mAscent; - float m_mDescent; - float m_mEmSquare; - float m_pointSize; - int m_dpiX; - int m_dpiY; - bool m_fIsValid; - std::wstring m_stuFaceName; - byte * m_pHeader; - byte * m_pTableDir; - float m_xScale; - float m_yScale; -}; - - -} // namespace gr - -#endif - diff --git a/Build/source/libs/graphite/engine-2.3.1/include/graphite/Font.h b/Build/source/libs/graphite/engine-2.3.1/include/graphite/Font.h deleted file mode 100644 index 64f62b3ff62..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/include/graphite/Font.h +++ /dev/null @@ -1,416 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 1999, 2001 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: Font.h -Responsibility: Sharon Correll -Last reviewed: Not yet. - -Description: - A Font is an object that represents a font-family + bold + italic setting, that contains - Graphite tables. This file also includes related iterators: FeatureIterator, - FeatureSettingIterator, FeatLabelLangIterator, LanguageIterator. -----------------------------------------------------------------------------------------------*/ -#ifdef _MSC_VER -#pragma once -#endif -#ifndef FONT_INCLUDED -#define FONT_INCLUDED - -//:End Ignore - -namespace gr -{ - -class Font; -class FontFace; -class FeatureSettingIterator; -class Segment; -class LayoutEnvironment; -class ITextSource; -class FontMemoryUsage; - -typedef struct tagFontProps -{ - unsigned long clrFore; - unsigned long clrBack; - bool fBold; - bool fItalic; - float pixHeight; - wchar_t szFaceName[ 32 ]; -} FontProps; - - -/*---------------------------------------------------------------------------------------------- - A FontError object is an exception that is thrown when there is an error in initializing - a Graphite font. -----------------------------------------------------------------------------------------------*/ -struct FontException -{ - FontErrorCode errorCode; - int version; - int subVersion; -}; - -/*---------------------------------------------------------------------------------------------- - Iterator to provide access to a font's features. -----------------------------------------------------------------------------------------------*/ -class FeatureIterator -{ - friend class Font; - friend class FeatureSettingIterator; - -public: - FeatureIterator() // needed for creating std::pair of these, and for default FSI - { - m_pfont = NULL; - m_ifeat = 0; - m_cfeat = 0; - } - -protected: - FeatureIterator(Font * pfont, int ifeat, size_t cfeat) - { - m_pfont = pfont; - m_ifeat = ifeat; - m_cfeat = cfeat; - } -public: - featid operator*(); - FeatureIterator operator++(); - FeatureIterator operator+=(int n); - bool operator==(FeatureIterator &); - bool operator!=(FeatureIterator &); - int operator-(FeatureIterator &); - -protected: - Font * m_pfont; - size_t m_ifeat; // feature being pointed at - size_t m_cfeat; // number of features for this font - - FeatureSettingIterator BeginSetting(); - FeatureSettingIterator EndSetting(); -}; - -/*---------------------------------------------------------------------------------------------- - Iterator to provide access to the defined values for a single font feature. -----------------------------------------------------------------------------------------------*/ -class FeatureSettingIterator -{ - friend class Font; - friend class FeatureIterator; - -public: - FeatureSettingIterator() // needed for creating std::pair of these, I think - { - m_ifset = 0; - m_cfset = 0; - } -protected: - FeatureSettingIterator(FeatureIterator fit, int ifset, size_t cfset) - { - m_fit = fit; - m_ifset = ifset; - m_cfset = cfset; - } -public: - int operator*(); - FeatureSettingIterator operator++(); - FeatureSettingIterator operator +=(int n); - bool operator==(FeatureSettingIterator &); - bool operator!=(FeatureSettingIterator &); - int operator-(FeatureSettingIterator); - -protected: - FeatureIterator m_fit; - size_t m_ifset; // which setting being pointed at - size_t m_cfset; // number of settings for this feature -}; - -/*---------------------------------------------------------------------------------------------- - Iterator to provide access to the languages available for the feature label strings. -----------------------------------------------------------------------------------------------*/ -class FeatLabelLangIterator -{ - friend class Font; - -public: - FeatLabelLangIterator() // needed for creating std::pair of these, and for default FSI - { - m_pfont = NULL; - m_ilang = 0; - m_clang = 0; - } - -protected: - FeatLabelLangIterator(Font * pfont, int ilang, size_t clang) - { - m_pfont = pfont; - m_ilang = ilang; - m_clang = clang; - } -public: - data16 operator*(); - FeatLabelLangIterator operator++(); - FeatLabelLangIterator operator+=(int n); - bool operator==(FeatLabelLangIterator &); - bool operator!=(FeatLabelLangIterator &); - int operator-(FeatLabelLangIterator &); - -protected: - Font * m_pfont; - size_t m_ilang; // language being pointed at - size_t m_clang; // number of languages for this font -}; - -/*---------------------------------------------------------------------------------------------- - Iterator to provide access to a font's defined languages--ie, those that have feature - settings associated with them. -----------------------------------------------------------------------------------------------*/ -class LanguageIterator -{ - friend class Font; - -public: - LanguageIterator() // needed for creating std::pair of these, and for default FSI - { - m_pfont = NULL; - m_ilang = 0; - m_clang = 0; - } - -protected: - LanguageIterator(Font * pfont, int ilang, size_t clang) - { - m_pfont = pfont; - m_ilang = ilang; - m_clang = clang; - } -public: - isocode operator*(); // returns a 4-char array - LanguageIterator operator++(); - LanguageIterator operator+=(int n); - bool operator==(LanguageIterator &); - bool operator!=(LanguageIterator &); - int operator-(LanguageIterator &); - -protected: - Font * m_pfont; - size_t m_ilang; // language being pointed at - size_t m_clang; // number of languages for this font -}; - -/*---------------------------------------------------------------------------------------------- - Abstract superclass for Graphite fonts. A font represents a face name, size, and bold and - italic styles. -----------------------------------------------------------------------------------------------*/ -class Font { - - friend class FeatureIterator; - friend class FeatureSettingIterator; - friend class FeatLabelLangIterator; - friend class LanguageIterator; - friend class FontMemoryUsage; - -public: - virtual ~Font(); - - /** - * Returns a copy of the recipient. Specifically needed to store the - * Font in a segment. - * @internal - * @return pointer to copy - */ - virtual Font * copyThis() = 0; - - /** - * Return wether the font is bold. - * @return true when bold - */ - virtual bool bold() = 0; - /** - * Return wether the font is italic. - * @return true when italic - */ - virtual bool italic() = 0; - - /** - * Returns the slope of the italic (if the font is italic) - * @return ratio of slope from the vertical - */ - virtual float fakeItalicRatio() { return 0; } // no support for fake italic - - /** - * Returns the font ascent. - * Value is the same as that returned by getFontMetrics() - * @return the font ascent in device co-ordinates - */ - virtual float ascent() = 0; - - /** - * Returns the font descent. - * Value is the same as that returned by getFontMetrics() - * @return the font descent in device co-ordinates - */ - virtual float descent() = 0; - - /** - * Returns the total height of the font. - * @return font height in device co-ordinates - */ - virtual float height() = 0; - - /** - * Returns the x and y resolution of the device co-ordinate space. - */ - virtual unsigned int getDPIx() = 0; - virtual unsigned int getDPIy() = 0; - - /** - * Returns a pointer to the start of a table in the font. - * If the Font class cannot easily determine the length of the table, - * it may set 0 as the length (while returning a non-NULL pointer to - * the table). This means that certain kinds of error checking cannot - * be done by the Graphite engine. - * Throws an exception if there is some other error in reading the - * table, or if the table asked for is not in the font. - * @param tableID the TTF ID of the table as a 32-bit long in native machine byte order - * @param pcbSize pointer to a size_t to hold the table size. - * @return address of the buffer containing the table or 0 - */ - virtual const void * getTable(fontTableId32 tableID, size_t * pcbSize) = 0; - /** - * Fetches the basic metrics of the font in device co-ordinates - * (normaly pixels). - * @param pAscent pointer to hold font ascent. - * @param pDescent pointer to hold font descent. - * @param pEmSquare pointer to hold font EM square. - */ - virtual void getFontMetrics(float * pAscent, float * pDescent = NULL, - float * pEmSquare = NULL) = 0; - /** - * Converts the point number of a glyph’s on-curve point to a pair of - * x/y coordinates in pixels. The default implementation will read the - * curve information directly from the font and perform a simple - * transformation to pixels. Some subclasses (e.g., WinFont) will use - * a system-level API call to return hinted metrics. - * Note that the coordinates returned are floating point values in the - * device co-ordinate space (normaly pixels). - * @param gid glyph id - * @param pointNum within glyph - * @param xyReturn reference to a Point object to hold the x,y result - */ - virtual void getGlyphPoint(gid16 glyphID, unsigned int pointNum, gr::Point & pointReturn); - - /** - * Returns the metrics of a glyph in the font. The default - * implementation will read the information directly from the font and - * perform a simple transformation to pixels. Some subclasses (e.g., - * WinFont) will use a system-level API call to return hinted metrics. - * Note that the coordinates returned are floating point values in the - * device co-ordinate space (normaly pixels). - * @param glyphID - * @param boundingBox reference to gr::Rect to hold bounding box of glyph - * @param advances refererence to gr::Point to hold the horizontal / vertical advances - */ - virtual void getGlyphMetrics(gid16 glyphID, gr::Rect & boundingBox, gr::Point & advances); - - static void SetFlushMode(int); - static int GetFlushMode(); - - // obsolete: - //virtual FontErrorCode isValidForGraphite(int * pnVersion = NULL, int * pnSubVersion = NULL) = 0; - - // Features: - std::pair getFeatures(); - FeatureIterator featureWithID(featid id); - bool getFeatureLabel(FeatureIterator, lgid language, utf16 * label); - FeatureSettingIterator getDefaultFeatureValue(FeatureIterator); - std::pair getFeatureSettings(FeatureIterator); - bool getFeatureSettingLabel(FeatureSettingIterator, lgid language, utf16 * label); - - std::pair getFeatureLabelLanguages(); - - // Languages: - std::pair getSupportedLanguages(); - - // Script directions, Verticle, LTR, RTL etc see enum ScriptDirCode - // the posibilities. This returns a bit set where more than one scripts may - // be set, it's up to the app to decide which is the prefered direction to use. - ScriptDirCode getSupportedScriptDirections() const throw(); - - // Debugging: - //static bool DbgCheckFontCache(); - - static FontMemoryUsage calculateMemoryUsage(); - ///FontMemoryUsage calculateMemoryUsage(bool fBold = false, bool fItalic = false); - -public: - // For use in segment creation: - void RenderLineFillSegment(Segment * pseg, ITextSource * pts, LayoutEnvironment & layout, - toffset ichStart, toffset ichStop, float xsMaxWidth, bool fBacktracking); - void RenderRangeSegment(Segment * pseg, ITextSource * pts, LayoutEnvironment & layout, - toffset ichStart, toffset ichEnd); - void RenderJustifiedSegment(Segment * pseg, ITextSource * pts, LayoutEnvironment & layout, - toffset ichStart, toffset ichEnd, float xsCurrentWidth, float xsDesiredWidth); - -protected: - Font(); - Font(const Font &); - - FontFace & fontFace(bool fDumbFallback = false); - - // Feature access: - FeatureIterator BeginFeature(); - FeatureIterator EndFeature(); - - size_t NumberOfFeatures(); - featid FeatureID(size_t ifeat); - size_t FeatureWithID(featid id); - bool GetFeatureLabel(size_t ifeat, lgid language, utf16 * label); - int GetFeatureDefault(size_t ifeat); - size_t NumberOfSettings(size_t ifeat); - int GetFeatureSettingValue(size_t ifeat, size_t ifset); - bool GetFeatureSettingLabel(size_t ifeat, size_t ifset, lgid language, utf16 * label); - - // Feature-label languages: - FeatLabelLangIterator BeginFeatLang(); - FeatLabelLangIterator EndFeatLang(); - - size_t NumberOfFeatLangs(); - short FeatLabelLang(size_t ilang); - - // Language access: - LanguageIterator BeginLanguage(); - LanguageIterator EndLanguage(); - - size_t NumberOfLanguages(); - isocode LanguageCode(size_t ilang); - - virtual void UniqueCacheInfo(std::wstring & stuFace, bool & fBold, bool & fItalic); - -private: - FontFace * m_pfface; // set up with Graphite tables - - // Cache of common tables: - const void * m_pHead; - const void * m_pHmtx; - const void * m_pLoca; - const void * m_pGlyf; - size_t m_cbHmtxSize; - size_t m_cbLocaSize; - bool m_fTablesCached; - - void initialiseFontFace(bool fDumbFallback); - void EnsureTablesCached(); -}; - -inline Font::Font() : m_pfface(0), m_fTablesCached(false) -{ } - -} // namespace gr - - -#endif // !FONT_INCLUDED diff --git a/Build/source/libs/graphite/engine-2.3.1/include/graphite/GenericResource.h b/Build/source/libs/graphite/engine-2.3.1/include/graphite/GenericResource.h deleted file mode 100644 index 119c6317bcd..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/include/graphite/GenericResource.h +++ /dev/null @@ -1,86 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 1999, 2001 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: GenericResource.h -Responsibility: John Thomson -Last reviewed: - - Resources needed by certain generic components (but must be created in app's or AppCore's - resource file). -----------------------------------------------------------------------------------------------*/ -#ifdef _MSC_VER -#pragma once -#endif -#ifndef GenericResource_H -#define GenericResource_H 1 -// Create suitable resources for these if your app uses StackDumper. -// For example -// STRINGTABLE DISCARDABLE -// BEGIN -// "A programming error (%s) has been detected in module %s.\n Please report this to the developers", kstidInternalError -// "Out of memory. To attempt Save, close other apps and click OK. To quit without saving click Cancel", kstidOutOfMemory -// END - - -// Date qualifier string IDs: -#define kstidDateQualBefore 24200 -#define kstidDateQualOn 24201 -#define kstidDateQualAbout 24202 -#define kstidDateQualAfter 24203 -#define kstidDateQualAbt 24204 -#define kstidDateQualBC 24205 -#define kstidDateQualAD 24206 -#define kstidDateBlank 24207 -#define kstidDateBlankM 24208 -#define kstidDateBlankD 24209 - - -#define kstidInternalError 25900 -#define khcidHelpOutOfMemory 25901 -#define khcidNoHelpAvailable 25902 // default help module when there is no specific one. -#define kstidOutOfMemory 25903 -#define kstidUndoFrame 25904 -#define kstidRedoFrame 25905 - -#define kstidFileErrUnknown 25920 -#define kstidFileErrNotFound 25921 -#define kstidFileErrPathNotFound 25922 -#define kstidFileErrTooManyFiles 25923 -#define kstidFileErrAccDenied 25924 -#define kstidFileErrBadHandle 25925 -#define kstidFileErrBadDrive 25926 -#define kstidFileErrWriteProtect 25927 -#define kstidFileErrBadUnit 25928 -#define kstidFileErrNotReady 25929 -#define kstidFileErrSeek 25930 -#define kstidFileErrNotDosDisk 25931 -#define kstidFileErrBadSector 25932 -#define kstidFileErrWriteFault 25933 -#define kstidFileErrReadFault 25934 -#define kstidFileErrGeneral 25935 -#define kstidFileErrSharing 25936 -#define kstidFileErrLock 25937 -#define kstidFileErrEof 25938 -#define kstidFileErrHandleDiskFull 25939 -#define kstidFileErrBadNetPath 25940 -#define kstidFileErrNetworkBusy 25941 -#define kstidFileErrNoDevice 25942 -#define kstidFileErrNoNetAccess 25943 -#define kstidFileErrBadDevice 25944 -#define kstidFileErrBadNetName 25945 -#define kstidFileErrExists 25946 -#define kstidFileErrCantMake 25947 -#define kstidFileErrBadPassword 25948 -#define kstidFileErrNetWriteFault 25949 -#define kstidFileErrDriveLocked 25950 -#define kstidFileErrOpenFailed 25951 -#define kstidFileErrBufOverflow 25952 -#define kstidFileErrDiskFull 25953 -#define kstidFileErrBadName 25954 -#define kstidFileErrNoVolLabel 25955 -#define kstidFileErrAlreadyExists 25956 - -#endif // !GenericResource_H diff --git a/Build/source/libs/graphite/engine-2.3.1/include/graphite/GrAppData.h b/Build/source/libs/graphite/engine-2.3.1/include/graphite/GrAppData.h deleted file mode 100644 index 3a2024b8a10..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/include/graphite/GrAppData.h +++ /dev/null @@ -1,39 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 1999, 2001 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: GrAppData.h -Responsibility: Sharon Correll -Last reviewed: not yet - -Description: - Data structures need by applications that use the Graphite engine. -----------------------------------------------------------------------------------------------*/ - - -#ifndef GRAPPDATA_INCLUDED -#define GRAPPDATA_INCLUDED - -#include "GrData.h" - -namespace gr -{ - -typedef unsigned int featid; // font feature IDs -typedef unsigned int lgid; // language ID (for access feature UI strings) -typedef unsigned int toffset; // text-source index - -typedef struct { // ISO-639-3 language code (for mapping onto features) - char rgch[4]; -} isocode; - -} // namespace gr - -#if defined(GR_NO_NAMESPACE) -using namespace gr; -#endif - -#endif // GRAPPDATA_INCLUDED - diff --git a/Build/source/libs/graphite/engine-2.3.1/include/graphite/GrClient.h b/Build/source/libs/graphite/engine-2.3.1/include/graphite/GrClient.h deleted file mode 100644 index 0ef5127c81a..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/include/graphite/GrClient.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef GR_CLIENT_H -#define GR_CLIENT_H - -#include "GrCommon.h" -#include "GrConstants.h" - -#define __RPC_FAR - -namespace gr -{ - -// These are internal classes, whose forward declarations are needed to allow the public interfaces -// to compile but are not intended for client use. -class GrSlotState; -class GrSlotStream; -class GrGlyphTable; -class GrClassTable; -class GrTableManager; -class GrPseudoMap; -class GrFileIStream; -class GrSlotOutput; -class GrCharStream; -class GrIStream; - -// Forward declarations of client APIs and classes. -class Segment; -} - -#include "GrAppData.h" -#include "GrResult.h" -#include "GrFeature.h" - - -#if defined(GR_NO_NAMESPACE) -using namespace gr; -#endif - -#endif //GR_CLIENT_H - diff --git a/Build/source/libs/graphite/engine-2.3.1/include/graphite/GrCommon.h b/Build/source/libs/graphite/engine-2.3.1/include/graphite/GrCommon.h deleted file mode 100644 index 8bb5728ecb3..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/include/graphite/GrCommon.h +++ /dev/null @@ -1,145 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 1999, 2001, 2003 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: GrCommon.h -Responsibility: Sharon Correll -Last reviewed: - - Common generic header file. - - This header file checks for the following compile time switches: - - USING_MFC -----------------------------------------------------------------------------------------------*/ - -#ifndef GRCOMMON_INCLUDED -#define GRCOMMON_INCLUDED - - -// Standard Headers. - -#include -#include -#include -#include -//#include -#include - -#include -#include -#include -#include -#include - -// Uncomment this to allow multiple versions of gr to coexist -// in the same program e.g. pangographite with gtk uses namespace gr -// mozilla graphite defines this to gr2moz incase the 2 libraries are -// incompatible. -// Provided the client includes GrClient.h first this #define is -// picked up by all files. - -//#define gr gr2 - -// Project headers -#include "GrPlatform.h" - -#ifndef GrAssert -#include -#define GrAssert(exp) assert(exp) -#endif - -using std::max; -using std::min; - -namespace gr -{ - - -/*********************************************************************************************** - Simple types. -***********************************************************************************************/ -typedef char schar; - -// TODO ShonK: Make generic use these where appropriate. -#ifdef UNICODE -typedef utf16 achar; -#else // !UNICODE -typedef schar achar; -#endif // UNICODE - -typedef achar *Psz; -//typedef const achar * Pcsz; - - - -// This is to make a signed isizeof operator, otherwise we get tons of warnings about -// signed / unsigned mismatches. -#define isizeof(T) (sizeof(T)) - -#define SizeOfArray(rgt) (isizeof(rgt) / isizeof(rgt[0])) - - -/*********************************************************************************************** - Tests for valid strings and pointers. -***********************************************************************************************/ -inline bool ValidPsz(const data16 *pszw) -{ - // TODO ShonK: Determine if IsBadStringPtrW is implemented on Win9x. - return pszw != 0 && !GrIsBadStringPtrW(pszw, 0x10000000); -} - -inline bool ValidPsz(const schar *pszs) -{ - return pszs != 0 && !GrIsBadStringPtrA(pszs, 0x10000000); -} - -template inline bool ValidReadPtr(T *pt) -{ - return pt != 0 && !GrIsBadReadPtr(pt, isizeof(T)); -} - -template inline bool ValidWritePtr(T *pt) -{ - return pt != 0 && !GrIsBadWritePtr(pt, isizeof(T)); -} - -inline bool ValidReadPtrSize(const void *pv, int cb) -{ - if (cb < 0) return false; - if (cb == 0) return true; - - return pv != 0 && !GrIsBadReadPtr(pv, cb); -} - -inline bool ValidWritePtrSize(void *pv, int cb) -{ -// if (!bstr || ::IsBadReadPtr((byte *)bstr - isizeof(int), isizeof(int) + isizeof(OLECHAR))) -// return false; -// int cb = ((int *)bstr)[-1]; -// if (::IsBadReadPtr((byte *)bstr - isizeof(int), isizeof(int) + isizeof(OLECHAR) + cb)) -// return false; - if (cb < 0) return false; - if (cb == 0) return true; - - return pv != 0 && !GrIsBadWritePtr(pv, cb); -} - - -} // namespace gr - - -// TODO Remove these as soon as they are no longer needed by GrCompiler: -//#include "UtilMem.h" -//#include "UtilRect.h" -//#include "UtilString.h" -//#include "UtilVector.h" - -#if defined(GR_NO_NAMESPACE) -using namespace gr; -#endif - -#endif // !GRCOMMON_INCLUDED - diff --git a/Build/source/libs/graphite/engine-2.3.1/include/graphite/GrConstants.h b/Build/source/libs/graphite/engine-2.3.1/include/graphite/GrConstants.h deleted file mode 100644 index 210c5229ec8..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/include/graphite/GrConstants.h +++ /dev/null @@ -1,268 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 1999, 2001 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: constants.h -Responsibility: Sharon Correll -Last reviewed: Not yet. - -Description: - Various global constants. -----------------------------------------------------------------------------------------------*/ -#ifdef _MSC_VER -#pragma once -#endif -#ifndef GRCONSTANTS_INCLUDED -#define GRCONSTANTS_INCLUDED - -//:End Ignore - -namespace gr -{ - -// Maximum table versions handled by this engine: -enum { - - kSilfVersion = 0x00030000, - kRuleVersion = 0x00030000, - kGlatVersion = 0x00010000, - kGlocVersion = 0x00010000, - kFeatVersion = 0x00020000, - kSileVersion = 0x00010000, - kSillVersion = 0x00010000 - -}; - -enum { - - kMaxFeatures = 64, - kMaxComponentsPerGlyph = 32, - kFieldsPerComponent = 4, - kMaxSlotsPerRule = 64, - kMaxSubTablesInFont = 256, - kMaxUserDefinableSlotAttrs = 64, - kMaxJLevels = 4 - -}; - -// Maxima permitted by the binary format of the TrueType tables. -enum { - - kMaxSubTables = 256, - kMaxRenderingBehavior = 65536, // ie, the maximum value allowed for an ID - kMaxGlyphAttrs = 65536, // Gloc table - kMinGlyphAttrValue =-32768, - kMaxGlyphAttrValue = 32768, - kMaxPasses = 128, // Sil_sub table allows 256 - kMaxPseudos = 65536, - kMaxRendBehaviors = 256, - kMaxReplcmtClasses = 65536, // Class map - kMaxReplcmtClassesV1_2 = 256, - kMaxComponents = 16383 - -}; - - -enum { - - kPosInfinity = 0x3FFFFFF, - kNegInfinity = kPosInfinity * -1, - - kInvalid = kNegInfinity - -}; - -#define kPosInfFloat (float)kPosInfinity -#define kNegInfFloat (float)kNegInfinity - - -enum { - kGpointZero = -2 -}; - - -// for stream processing -enum { - kBacktrack = -2, - kNextPass = -1 -}; - - -// internal justification modes -enum { - kjmodiNormal = 0, - kjmodiMeasure, - kjmodiJustify, - kjmodiCanShrink // like normal, but shrinking is possible -}; - - -enum DirCode { // Hungarian: dirc - - kdircUnknown = -1, - kdircNeutral = 0, // other neutrals (default) - ON - kdircL = 1, // left-to-right, strong - L - kdircR = 2, // right-to-left, strong - R - kdircRArab = 3, // Arabic letter, right-to-left, strong, AR - kdircEuroNum = 4, // European number, left-to-right, weak - EN - kdircEuroSep = 5, // European separator, left-to-right, weak - ES - kdircEuroTerm = 6, // European number terminator, left-to-right, weak - ET - kdircArabNum = 7, // Arabic number, left-to-right, weak - AN - kdircComSep = 8, // Common number separator, left-to-right, weak - CS - kdircWhiteSpace = 9, // white space, neutral - WS - kdircBndNeutral = 10, // boundary neutral - BN - - kdircLRO = 11, // LTR override - kdircRLO = 12, // RTL override - kdircLRE = 13, // LTR embedding - kdircRLE = 14, // RTL embedding - kdircPDF = 15, // pop directional format - - // I think we need this too: - kdircNSM = 16, // non-space mark - - // Special values for internal use: - kdircLlb = 32, // left-to-right line-break - kdircRlb = 33, // right-to-left line-break - kdircPdfL = 34, // PDF marker matching an LRO or LRE - kdircPdfR = 35 // PDF marker matching an RLO or RLE - -}; - - -bool StrongDir(DirCode dirc); -bool WeakDir(DirCode dirc); -bool NeutralDir(DirCode dirc); -bool RightToLeftDir(DirCode dirc); - - -// Unicode characters with special treatments -enum DefinedChars { - - knSpace = 0x0020, // space - knHyphen = 0x002D, // hyphen - - knTab = 0x0009, // tab (horizontal) - knLF = 0x000A, // line feed - knCR = 0x000D, // carriage return - knLineSep = 0x2028, // line separator (soft return) - knParaSep = 0x2029, // paragraph separator - - knLRM = 0x200E, // left-to-right mark - knRLM = 0x200F, // right-to-left mark - knLRE = 0x202A, // left-to-right embedding - knRLE = 0x202B, // right-to-left embedding - knPDF = 0x202C, // pop directional format - knLRO = 0x202D, // left-to-right override - knRLO = 0x202E, // right-to-left override - - knORC = 0xFFFC // Object Replacement Character -}; - -bool BidiCode(int nUnicode); - - -typedef enum SpecialSlots { - - kspslNone = 0, - - kspslLbInitial = 1, - kspslLbFinal = 2, - - kspslLRM = 3, - kspslRLM = 4, - kspslLRO = 5, - kspslRLO = 6, - kspslLRE = 7, - kspslRLE = 8, - kspslPDF = 9 - -} SpecialSlots; - - -// version 1.0 breakweights -enum BreakWeightsV1 -{ - klbv1WordBreak = 1, - klbv1HyphenBreak = 2, - klbv1LetterBreak = 3, - klbv1ClipBreak = 4 -}; - - -typedef enum SlotAttrName { - - kslatAdvX = 0, kslatAdvY, - kslatAttTo, - kslatAttAtX, kslatAttAtY, kslatAttAtGpt, - kslatAttAtXoff, kslatAttAtYoff, - kslatAttWithX, kslatAttWithY, kslatAttWithGpt, - kslatAttWithXoff, kslatAttWithYoff, - kslatAttLevel, - kslatBreak, - kslatCompRef, - kslatDir, - kslatInsert, - kslatPosX, kslatPosY, - kslatShiftX, kslatShiftY, - kslatUserDefnV1, // version 1.0 of the font tables - kslatMeasureSol, kslatMeasureEol, - kslatJStretch, kslatJShrink, kslatJStep, kslatJWeight, kslatJWidth, - // this must be last: - kslatUserDefn = kslatJStretch + 30, - // I think 30 is somewhat arbitrary. We at least need to save 15 slots for more levels of - // justification attributes. - - kslatMax, - - kslatNoEffect = kslatMax + 1 // for internal use -} SlotAttrName; - - -typedef enum GlyphMetric { - kgmetLsb = 0, kgmetRsb, - kgmetBbTop, kgmetBbBottom, kgmetBbLeft, kgmetBbRight, - kgmetBbHeight, kgmetBbWidth, - kgmetAdvWidth, kgmetAdvHeight, - kgmetAscent, kgmetDescent -} GlyphMetric; - - -enum ProcessStates -{ - kpstatJustifyMode = 1, - kpstatJustifyLevel = 2 -}; - -// user justification modes: these must match the values in stddef.gdh -enum JustifyModes -{ - kjmoduNormal = 0, - kjmoduMeasure = 1, - kjmoduJustify = 2 -}; - -enum TruetypeTableId { - kttiCmap = 0x636D6170, - kttiFeat = 0x46656174, - kttiGlat = 0x476C6174, - kttiGloc = 0x476C6F63, - kttiGlyf = 0x676C7966, - kttiHead = 0x68656164, - kttiHhea = 0x68686561, - kttiHmtx = 0x686D7478, - kttiLoca = 0x6C6F6361, - kttiMaxp = 0x6D617870, - kttiName = 0x6E616D65, - kttiOs2 = 0x4F532F32, - kttiPost = 0x706F7374, - kttiSile = 0x53696C65, - kttiSilf = 0x53696C66, - kttiSill = 0x53696C6C -}; - -} // namespace gr - -#endif // CONSTANTS_INCLUDED diff --git a/Build/source/libs/graphite/engine-2.3.1/include/graphite/GrData.h b/Build/source/libs/graphite/engine-2.3.1/include/graphite/GrData.h deleted file mode 100644 index db263e473f8..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/include/graphite/GrData.h +++ /dev/null @@ -1,227 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 1999, 2001 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: GrData.h -Responsibility: Sharon Correll -Last reviewed: Not yet. - -Description: - Data structures needed by the Graphite engine, particularly for argument passing. - NOT to be used within FieldWorks. - -Special Note: - This file needs to be used by C files. Please do not use C++ style comments; use - ONLY C style comments in this file to make the C compiler happy. -----------------------------------------------------------------------------------------------*/ -#ifdef _MSC_VER -#pragma once -#endif -#ifndef GRDATA_INCLUDED -#define GRDATA_INCLUDED - -#include "GrCommon.h" - -/* -//:End Ignore - */ - -#include "GrStructs.h" - -namespace gr -{ - -struct Point -{ - float x; - float y; - - Point() - { - x = y = 0; - } - -#if defined(_WIN32) - Point(POINT & p) - { - x = (float)p.x; - y = (float)p.y; - } -#endif -}; - - -struct Rect -{ - float top; - float bottom; - float left; - float right; - - Rect() - { - top = bottom = left = right = 0; - }; - -#if defined(_WIN32) - Rect(RECT & r) - { - top = (float)r.top; - bottom = (float)r.bottom; - left = (float)r.left; - right = (float)r.right; - }; -#endif -}; - -enum { - kttvOff = 0, - kttvForceOn = 1, - kttvInvert = 2 -}; - -//typedef struct tagLgParaRenderProps -//{ -// int dummy; -//} LgParaRenderProps; - -typedef enum tagSegEnd -{ kestNoMore = 0, - kestMoreLines = kestNoMore + 1, - kestHardBreak = kestMoreLines + 1, - kestBadBreak = kestHardBreak + 1, - kestOkayBreak = kestBadBreak + 1, - kestWsBreak = kestOkayBreak + 1, - kestMoreWhtsp = kestWsBreak + 1, - kestNothingFit = kestMoreWhtsp + 1 -} SegEnd; - -typedef enum tagLgIPDrawMode // TODO: remove -{ kdmNormal = 0, - kdmSplitPrimary = kdmNormal + 1, - kdmSplitSecondary = kdmSplitPrimary + 1 -} LgIPDrawMode; - -typedef enum tagLgIpValidResult -{ kipvrOK = 0, - kipvrBad = kipvrOK + 1, - kipvrUnknown = kipvrBad + 1 -} LgIpValidResult; - -typedef enum tagLineBrk -{ klbNoBreak = 0, - klbWsBreak = 10, - klbWordBreak = 15, - klbHyphenBreak = 20, - klbLetterBreak = 30, - klbClipBreak = 40 -} LineBrk; - -typedef enum tagTrWsHandling -{ ktwshAll = 0, - ktwshNoWs = ktwshAll + 1, - ktwshOnlyWs = ktwshNoWs + 1 -} TrWsHandling; - -typedef enum tagUtfType -{ - kutf8 = 0, - kutf16 = kutf8 + 1, - kutf32 = kutf16 + 1 -} UtfType; - -enum tagFlushMode -{ - kflushAuto = 0, - kflushManual = kflushAuto + 1 -}; - -typedef enum ScriptDirCode -{ kfsdcNone = 0, - kfsdcHorizLtr = 1, - kfsdcHorizRtl = 2, - kfsdcVertFromLeft = 4, - kfsdcVertFromRight = 8 -} ScriptDirCode; - -typedef enum tagFwTextColor -{ kclrWhite = 0xffffff, - kclrBlack = 0, - kclrRed = 0x0000ff, - kclrGreen = 0x00ff00, - kclrBlue = 0xff0000, -/* -// kclrYellow = 0x00ffff, -// kclrMagenta = 0xff00ff, -// kclrCyan = 0xffff00, - */ - kclrReserved1 = 0x80000000, - kclrReserved2 = 0x80000001, - kclrTransparent = 0xc0000000 -} FwTextColor; - - -typedef enum FwSuperscriptVal -{ kssvOff = 0, - kssvSuper = 1, - kssvSub = 2 -} FwSuperscriptVal; - - -// Glyph attributes for justification -typedef enum tagJustGlyphAttr -{ - kjgatStretch = 1, - kjgatShrink, - kjgatWeight, - kjgatStep, - kjgatChunk, - kjgatWidth, - kjgatBreak, - // pseudo-attributes for handling steps: - kjgatStretchInSteps, - kjgatWidthInSteps, - // also metrics: - kjgatAdvWidth, - kjgatAdvHeight, - kjgatBbLeft, - kjgatBbRight, - kjgatBbTop, - kjgatBbBottom -} JustGlyphAttr; // Hungarian: jgat - -class GrSlotState; -typedef union { - int nValue; - short smallint[2]; // min = smallint[0], max = smallint[1] - GrSlotState * pslot; -} u_intslot; - -/***** -#undef ATTACH_GUID_TO_CLASS -#if defined(__cplusplus) -#define ATTACH_GUID_TO_CLASS(type, guid, cls) \ - type __declspec(uuid(#guid)) cls; -#else // !defined(__cplusplus) -#define ATTACH_GUID_TO_CLASS(type, guid, cls) -#endif // !defined(__cplusplus) - -#ifndef DEFINE_COM_PTR -#define DEFINE_COM_PTR(cls) -#endif - -#undef GENERIC_DECLARE_SMART_INTERFACE_PTR -#define GENERIC_DECLARE_SMART_INTERFACE_PTR(cls, iid) \ - ATTACH_GUID_TO_CLASS(interface, iid, cls); \ - DEFINE_COM_PTR(cls); -*****/ - -} // namespace gr - -#if defined(GR_NO_NAMESPACE) -using namespace gr; -#endif - -#endif /* !GRDATA_INCLUDED */ diff --git a/Build/source/libs/graphite/engine-2.3.1/include/graphite/GrDebug.h b/Build/source/libs/graphite/engine-2.3.1/include/graphite/GrDebug.h deleted file mode 100644 index dc02fac0134..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/include/graphite/GrDebug.h +++ /dev/null @@ -1,200 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 1999, 2001 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: debug.h -Responsibility: -Last reviewed: - -Description: - Assert and debug definitions. -----------------------------------------------------------------------------------------------*/ - -#ifndef __DEBUG_H__ -#define __DEBUG_H__ - -#include - -namespace gr -{ - -#ifdef _DEBUG - #undef DEBUG - #define DEBUG 1 - #undef NDEBUG - #define DEFINE_THIS_FILE static char THIS_FILE[] = __FILE__; - #undef THIS_FILE - #define THIS_FILE __FILE__ -#else //!_DEBUG - #undef DEBUG - #define DEFINE_THIS_FILE - - //#define Debug(foo) -#endif //!_DEBUG - -#if 0 -//#ifdef DEBUG - -//#include - - typedef void (WINAPI * Pfn_Assert)(const char * pszExp, const char * pszFile, int nLine, - HMODULE hmod); - typedef Pfn_Assert Pfn_Warn; - - /*__declspec(dllimport)*/ void WINAPI WarnProc(const char * pszExp, const char * pszFile, - int nLine, bool fCritical, HMODULE hmod); - /*__declspec(dllimport)*/ void WINAPI AssertProc(const char * pszExp, const char * pszFile, - int nLine, bool fCritical, HMODULE hmod); - - __declspec(dllimport) Pfn_Assert WINAPI SetAssertProc(Pfn_Assert pfnAssert); - __declspec(dllimport) Pfn_Warn WINAPI SetWarnProc(Pfn_Warn pfnWarn); - __declspec(dllimport) int WINAPI HideWarnings(bool f); - __declspec(dllimport) int WINAPI HideAsserts(bool f); - __declspec(dllimport) int WINAPI HideErrors(bool f); - - void WINAPI WarnHrProc(HRESULT hr, const char * pszFile, int nLine, bool fCritical); - void WINAPI WarnProcLocal(const char * pszExp, const char * pszFile, int nLine, - bool fCritical); - void WINAPI AssertProcLocal(const char * pszExp, const char * pszFile, int nLine, - bool fCritical); - - #define Assert(exp) ((exp) || (AssertProcLocal(#exp, THIS_FILE, __LINE__, false), 0)) - #define AssertC(exp) ((exp) || (AssertProcLocal(#exp, THIS_FILE, __LINE__, true), 0)) - #define AssertMsg(exp, msg) ((exp) || (AssertProcLocal(msg, THIS_FILE, __LINE__, false), 0)) - #define AssertMsgC(exp, msg) ((exp) || (AssertProcLocal(msg, THIS_FILE, __LINE__, true), 0)) - - #undef Warn - #define Warn(psz) (void)(WarnProcLocal(psz, THIS_FILE, __LINE__, false)) - #define WarnC(psz) (void)(WarnProcLocal(psz, THIS_FILE, __LINE__, true)) - - #undef WarnIf - #define WarnIf(exp) (void)(!(exp) || (WarnProcLocal("(" #exp ") is true", THIS_FILE, \ - __LINE__, false), 0)) - #define WarnIfC(exp) (void)(!(exp) || (WarnProcLocal("(" #exp ") is true", THIS_FILE, \ - __LINE__, true), 0)) - - #undef WarnUnless - #define WarnUnless(exp) (void)((exp) || (WarnProcLocal("(" #exp ") is false", \ - THIS_FILE, __LINE__, false), 0)) - #define WarnUnlessC(exp) (void)((exp) || (WarnProcLocal("(" #exp ") is false", \ - THIS_FILE, __LINE__, true), 0)) - - #undef WarnHr - #define WarnHr(hr) ((SUCCEEDED(hr) || (WarnHrProc(hr, THIS_FILE, __LINE__, false), 0)), \ - (hr)) - #define WarnHrC(hr) ((SUCCEEDED(hr) || (WarnHrProc(hr, THIS_FILE, __LINE__, true), 0)), \ - (hr)) - - class IgnoreWarnings - { - public: - IgnoreWarnings() - { HideWarnings(true); } - ~IgnoreWarnings() - { HideWarnings(false); } - }; - - class IgnoreAsserts - { - public: - IgnoreAsserts() - { HideAsserts(true); } - ~IgnoreAsserts() - { HideAsserts(false); } - }; - - class IgnoreErrors - { - private: - IgnoreWarnings iw; - IgnoreAsserts ia; - }; - - #define Debug(exp) exp - #define DoAssert(exp) Assert(exp) - #define DoAssertC(exp) AssertC(exp) - #define DoAssertHr(hr) Assert(SUCCEEDED(hr)) - #define DoAssertHrC(hr) AssertC(SUCCEEDED(hr)) -#else - #define Assert(exp) assert(exp) - #define AssertC(exp) - #define AssertMsg(exp, msg) - #define AssertMsgC(exp, msg) - #define Warn(psz) - #define WarnC(psz) - #define WarnIf(exp) - #define WarnIfC(exp) - #define WarnUnless(exp) - #define WarnUnlessC(exp) - #define WarnHr(hr) (hr) - #define WarnHrC(hr) (hr) - #define Debug(exp) - #define DoAssert(exp) (exp) - #define DoAssertC(exp) (exp) - #define DoAssertHr(hr) (hr) - #define DoAssertHrC(hr) (hr) -#endif //DEBUG - -#define AssertPtr(pv) Assert(ValidReadPtr(pv)) -#define AssertPtrN(pv) Assert(!(pv) || ValidReadPtr(pv)) -#define AssertArray(pv, cv) Assert((cv) >= 0 && ValidReadPtrSize((pv), isizeof(*(pv)) * (cv))) -#define AssertArrayN(pv, cv) Assert((cv) >= 0 && (!(pv) || ValidReadPtrSize((pv), isizeof(*(pv)) * (cv)))) -#define AssertPtrSize(pv, cb) Assert((cb) >= 0 && ValidReadPtrSize((pv), cb)) - -#define AssertPfn(pfn) Assert(!IsBadCodePtr((FARPROC)(pfn))) -#define AssertPfnN(pfn) Assert(!(pfn) || !IsBadCodePtr((FARPROC)(pfn))) - -#define AssertPsz(psz) Assert(ValidPsz(psz)) -#define AssertPszN(psz) Assert(!(psz) || ValidPsz(psz)) - -#define AssertBstr(bstr) Assert(ValidBstr(bstr)) -#define AssertBstrN(bstr) Assert(!(bstr) || ValidBstr(bstr)) - -#define AssertObj(pv) Assert(ValidReadPtr(pv) && (pv)->AssertValid()) -#define AssertObjN(pv) Assert(!(pv) || ValidReadPtr(pv) && (pv)->AssertValid()) - -/*---------------------------------------------------------------------------------------------- - This class implements custom output to the debugger. The results of Watch() can be - viewed on a line in the Watch window. Output() writes to the Debugger Output window. - Calls to Output() should be included in the Watch() function as needed. Watch() - is executed every time the debugger displays this class in the Watch window. - To use it: - - 1) Put the following line in: - \program files\Microsoft Visual Studio\Common\MSDev98\bin\AutoExp.dat - in the [AutoExpand] section: - DebugWatch= - - 2) In the class from which you want custom debug output, add the equivalent of: - #ifdef DEBUG - class Dbw1 : public DebugWatch { virtual OLECHAR * Watch(); ... }; - Dbw1 m_dbw1; - #endif //DEBUG - - 3) Implement the Watch() function to display the data you want to see, bracketed by - #ifdef DEBUG / #endif. Note that Output() is LIMITED to 10 pointer-sized arguments. - If you must have more, then call _CrtDbgReport() directly. Note also that - _CrtDbgReport() is not implemented for wide characters, so neither is Output(). -----------------------------------------------------------------------------------------------*/ -#if 0 -//#ifdef DEBUG -class DebugWatch -{ -public: - int m_nSerial; // increment and display this for positive affirmation of refresh - DebugWatch() { m_nSerial = 0; } - OLECHAR * WatchNV(); // debugger won't find it if it is virtual or inline. - virtual OLECHAR * Watch() { return L"No DebugWatch string implemented"; } - void Output (char *fmt, ...); // LIMITED to 10 pointer-sized arguments -}; -#endif //DEBUG - -} // namespace gr - -#if defined(GR_NO_NAMESPACE) -using namespace gr; -#endif - -#endif diff --git a/Build/source/libs/graphite/engine-2.3.1/include/graphite/GrExt.h b/Build/source/libs/graphite/engine-2.3.1/include/graphite/GrExt.h deleted file mode 100644 index 518683db29e..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/include/graphite/GrExt.h +++ /dev/null @@ -1,13 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 1999, 2001, 2003 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: GrHelperClases.h -Responsibility: Sharon Correll -Last reviewed: - - External helper classes to be included in the open-source version of the Graphite DLL. - Currently there are none. -----------------------------------------------------------------------------------------------*/ diff --git a/Build/source/libs/graphite/engine-2.3.1/include/graphite/GrFeature.h b/Build/source/libs/graphite/engine-2.3.1/include/graphite/GrFeature.h deleted file mode 100644 index 4cc396a11d9..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/include/graphite/GrFeature.h +++ /dev/null @@ -1,203 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 1999, 2001 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: GrFeature.h -Responsibility: Sharon Correll -Last reviewed: Not yet. - -Description: - -Note: - The body of methods not complete contained in this file are located in GrEngine.cpp. -----------------------------------------------------------------------------------------------*/ -#ifdef _MSC_VER -#pragma once -#endif -#ifndef GR_FEATURE_INCLUDED -#define GR_FEATURE_INCLUDED - -//:End Ignore - -#include "GrAppData.h" - -namespace gr -{ - - -/*---------------------------------------------------------------------------------------------- - A valid setting and its UI labels in potentially various languages. - - Hungarian: fset -----------------------------------------------------------------------------------------------*/ -/**** -class GrFeatureSetting -{ - friend class GrFeature; -public: - GrFeatureSetting() - { - m_hmnstuLabels.Clear(); - } - GrFeatureSetting(GrFeatureSetting & fset) - { - m_hmnstuLabels.Clear(); - } -protected: - int m_nVal; - HashMap m_hmnstuLabels; -}; -****/ - -class GrEngine; - -/*---------------------------------------------------------------------------------------------- - Each Graphite feature defines a way to customize or parameterize the rendering processs. - - Hungarian: feat -----------------------------------------------------------------------------------------------*/ -class GrFeature -{ - //friend class GrFeatureSetting; -public: - enum { - knLangFeatV2 = 1 - }; - - GrFeature() - { - m_vnVal.clear(); - m_vnNameId.clear(); - } - - void Initialize(featid nID, int nNameId, int cfset, int nDefault = 0); - - featid ID() - { - return m_nID; - } - - int DefaultValue() - { - return m_nDefault; - } - - void SetDefault(int nDefault) - { - m_nDefault = nDefault; - } - - int NameId() - { - return m_nNameId; - } - - void SetNameId(int n) - { - m_nNameId = n; - } - - int NumberOfSettings() - { - return (int)m_vnVal.size(); - } - - int Settings(int cMax, int * prgnVal); - void AddSetting(int nVal, int nNameId); - bool IsValidSetting(int nVal); - std::wstring Label(GrEngine * pgreng, int nLang); - std::wstring SettingLabel(GrEngine * pgreng, int nVal, int nLang); - int NthSetting(int ifset); - std::wstring NthSettingLabel(GrEngine * pgreng, int ifset, int nLang); -// void SetSettingLabel(int nVal, std::wstring stuLabel, int nLang); - -protected: - featid m_nID; - int m_nDefault; - int m_nNameId; -// HashMap m_hmnstuLabels; - - // These are parallel arrays. The first gives the setting value for a given feature, - // the second gives the index into the name table that is used to read UI strings. - std::vector m_vnVal; - std::vector m_vnNameId; -}; - - -/*---------------------------------------------------------------------------------------------- - GrLangTable handles looking up language information. - GrEngine has one instance of this class. - Hungarian: langtbl -----------------------------------------------------------------------------------------------*/ -class GrIStream; - -class GrLangTable -{ - friend class FontMemoryUsage; - -public: - GrLangTable() - { - m_prglang = NULL; - m_clang = 0; - m_prgfset = NULL; - } - ~GrLangTable() - { - delete[] m_prglang; - delete[] m_prgfset; - } - - bool ReadFromFont(GrIStream * pgrstrm, int fxdVersion); - void CreateEmpty(); - - size_t NumberOfLanguages() - { - return m_clang; - } - void LanguageFeatureSettings(isocode lgcode, - std::vector & vnFeatId, std::vector & vnValues); - isocode LanguageCode(size_t ilang); - -protected: - size_t m_clang; - // constants for fast binary search of language list - data16 m_dilangInit; // (max power of 2 <= m_clang); - // size of initial range to consider - data16 m_cLoop; // log2(max power of 2 <= m_clang); - // indicates how many iterations are necessary - data16 m_ilangStart; // m_clang - m_dilangInit; - // where to start search - - struct LangEntry - { - char rgchCode[4]; - data16 cFeaturesBIG; // big endian - data16 cbOffsetBIG; // big endian - }; - LangEntry * m_prglang; - int m_cbOffset0; // offset of first entry - - struct FeatSet - { - featid featidBIG; // big endian - data16 valueBIG; // big endian - data16 padBIG; - }; - FeatSet * m_prgfset; - int m_cfset; // needed for memory instrumentation only - - int FindIndex(isocode lgcode); -}; - -} // namespace gr - - -#if defined(GR_NO_NAMESPACE) -using namespace gr; -#endif - - -#endif // !GR_FEATURE_INCLUDED diff --git a/Build/source/libs/graphite/engine-2.3.1/include/graphite/GrMstypes.h b/Build/source/libs/graphite/engine-2.3.1/include/graphite/GrMstypes.h deleted file mode 100644 index 2fc9f108009..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/include/graphite/GrMstypes.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef _MSTYPES_H -#define _MSTYPES_H -/******** -This header contains the MS Win32 specific types that are still used -throughout the Graphite code. - -It is intended to allow Graphite to build on non-Win32 platforms. - - **Do NOT include this when building against WIN32** - - TSE - 15/07/2003 -********/ - -#if defined(_WIN32) - #error Do not include this header when building against Win32 APIs -#else - -#if defined(GR_NAMESPACE) -namespace gr -{ -#endif - -typedef wchar_t OLECHAR; - -typedef signed long HRESULT; - -inline const long InterlockedIncrement(long *const intr_lck) { - return ++*intr_lck; -} - -inline const long InterlockedDecrement(long *const intr_lck) { - return --*intr_lck; -} - -#if defined(GR_NAMESPACE) -} -#endif - -#endif // defined(_WIN32) -#endif // include guard diff --git a/Build/source/libs/graphite/engine-2.3.1/include/graphite/GrPlatform.h b/Build/source/libs/graphite/engine-2.3.1/include/graphite/GrPlatform.h deleted file mode 100644 index d72abbc6412..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/include/graphite/GrPlatform.h +++ /dev/null @@ -1,189 +0,0 @@ -#ifndef _GR_PLATFORM_H -#define _GR_PLATFORM_H - -/*********************************************************************************************** - Turn off the goofy warnings for MS VisualStudio. -***********************************************************************************************/ -#ifdef _MSC_VER -#pragma warning(disable: 4065) // Switch statement contains default but no case. -#pragma warning(disable: 4097) // typedef-name 'xxx' used as synonym for class-name 'yyy'. -#pragma warning(disable: 4100) // unreferenced formal parameter. -#pragma warning(disable: 4127) // conditional expression is constant -#pragma warning(disable: 4192) // automatically excluding while importing. -#pragma warning(disable: 4201) // nonstandard extension used : nameless struct/union. -#pragma warning(disable: 4290) // exception specification ignored. -#pragma warning(disable: 4310) // cast truncates constant value. -#pragma warning(disable: 4355) // 'this' used in base member initializer list. -#pragma warning(disable: 4505) // unreferenced local function has been removed. -#pragma warning(disable: 4510) // default constructor could not be generated - caused by - // applying ComSmartPtr to a non-interface class. -#pragma warning(disable: 4511) // copy constructor could not be generated. -#pragma warning(disable: 4512) // assignment operator could not be generated. -#pragma warning(disable: 4610) // class 'xxx' can never be instantiated - user defined - // constructor required - caused by applying ComSmartPtr to a non-interface class. -#pragma warning(disable: 4660) // template-class specialization is already instantiated. -#pragma warning(disable: 4701) // local variable 'xxx' may be used without being initialized. - // We would like to keep this warning (4701) enabled but the compiler applies it in - // places that are obviously OK. -#pragma warning(disable: 4702) // unreachable code. We would like to keep this warning (4702) - // enabled but the compiler applies it in places that are obviously OK. -#pragma warning(disable: 4706) // assignment in conditional expression -#pragma warning(disable: 4710) // not inlined. -#pragma warning(disable: 4786) // identifier truncated in debug info. -#pragma warning(disable: 4800) // forcing value to bool 'true' or 'false' (performance warning). -#endif - - -// Standard headers -#include - -// Platform headers -// -#if defined(_WIN32) -#include -#include - -#ifdef SIZEOF_WCHAR_T -#define SIZEOF_WCHAR_T 2 -#endif - -#endif - -// Project headers -#if defined(_WIN32) -#include -#endif -#include - - -#if defined(_WIN32) -// TSE: We need to define std::max and std::min, because VC6.0 seems to omit -// these from their version of and rely on the macro versions -// to silently take their place. This breaks the use of the name max in any -// other scope e.g. as in std::numeric_limits<..>::max(). - -#undef min -#undef max - -// SJC: Only do this for version 6, otherwise the definitions conflict with the -// built-in STL definitions, and the compiler really struggles. -#if _MSC_VER == 1200 // VC version 6 -namespace std -{ - template inline T max(const T a, const T b) { return a < b ? b : a; } - template inline T min(const T a, const T b) { return a > b ? b : a; } -} -#endif // _MSC_VER == 1200 -//////using std::max; // SJC moved to GrCommon.h -//////using std::min; -#endif // _WIN32 - - -namespace gr -{ - -// Typedefs -// These are correct for the x86_64 architecture too. -typedef unsigned char byte; -typedef unsigned int utf32; // UTF32 encoded Unicode codepoints -typedef unsigned short int utf16; // UTF16 encoded Unicode codepoints -typedef unsigned char utf8; // UTF-8 encoded Unicode codepoints -typedef unsigned short int gid16; // glyph ID -typedef unsigned int fontTableId32; // ID to pass to getTable() - -typedef unsigned char data8; -typedef unsigned short int data16; // generic 16-bit data -typedef unsigned int data32; // generic 32-bit data -typedef signed char sdata8; -typedef signed short int sdata16; // generic 16-bit data -typedef signed int sdata32; // generic 32-bit data - -#ifndef NO_ASM -#define NO_ASM -#endif - -#ifndef NULL -#define NULL 0 -#endif -// std::_Ios_Openmode isn't defined in the Windows compiler -#if !defined(_WIN32) - typedef std::ios_base::openmode openmode_t; -#else - typedef int openmode_t; -#endif - -/************************************************************************************* - Offsets and addresses. AddrOf is useful for taking the address of an object - that overloads the & operator. -*************************************************************************************/ -#if defined(_WIN32) -#undef offsetof -#define offsetof(cls,fld) ((int)&((cls *)0)->fld) -#endif - -// #ifndef NO_ASM -// #define addrsafe_offsetof(cls,fld) reinterpret_cast(AddrOf(((cls *)0)->fld)) -// -// template inline T * AddrOf(T & x) { -// T * pt; -// __asm -// { -// mov eax,x -// mov pt,eax -// } -// return pt; -// } -// #endif - - -inline bool GrIsBadStringPtrW(const utf16 *const pszw, const long) -{ - return !pszw; -} - -inline bool GrIsBadStringPtrA(const char *const psza, const long) -{ - return !psza; -} - -inline bool GrIsBadReadPtr(const void *const, const unsigned int) -{ - return false; -} - -inline bool GrIsBadWritePtr(const void *const, const unsigned int) -{ - return false; -} - - -size_t Platform_UnicodeToANSI(const utf16 * prgchwSrc, size_t cchwSrc, char * prgchsDst, size_t cchsDst); -size_t Platform_AnsiToUnicode(const char * prgchsSrc, size_t cchsSrc, utf16 * prgchwDst, size_t cchwDst); -//size_t Platform_UnicodeToANSI(const wchar * prgchwSrc, size_t cchwSrc, char * prgchsDst, size_t cchsDst); -//size_t Platform_AnsiToUnicode(const char * prgchsSrc, size_t cchsSrc, wchar * prgchwDst, size_t cchwDst); -size_t Platform_8bitToUnicode(int nCodePage, const char * prgchsSrc, int cchsSrc, utf16 * prgchwDst, int cchwDst); - -utf16 *utf16cpy(utf16 *dest, const utf16 *src); -utf16 *utf16cpy(utf16 *dest, const char *src); -utf16 *utf16cpy(utf16 *dest, const utf32 *src); - -utf16 *utf16ncpy(utf16 *dest, const utf16 *src, size_t n); -utf16 *utf16ncpy(utf16 *dest, const char *src, size_t n); - -#ifdef UTF16DEBUG -void utf16Output(const utf16 *input); -#endif - -size_t utf16len(const utf16 *s); - -int utf16cmp(const utf16 *s1, const utf16 *s2); -int utf16ncmp(const utf16 *s1, const utf16 *s2, size_t n); -int utf16cmp(const utf16 *s1, const char *s2); - -} // namespace gr - -#if defined(GR_NO_NAMESPACE) -using namespace gr; -#endif - -#endif diff --git a/Build/source/libs/graphite/engine-2.3.1/include/graphite/GrResult.h b/Build/source/libs/graphite/engine-2.3.1/include/graphite/GrResult.h deleted file mode 100644 index d2c418dc9df..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/include/graphite/GrResult.h +++ /dev/null @@ -1,171 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 1999, 2001 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: GrResult.h -Responsibility: Sharon Correll -Last reviewed: Not yet. - -Description: - Support for the GrResult and error handling in the Graphite engine. Also argument - checking. Much of this is set up to parallel standard COM behavior. - -Special Note: - This file needs to be used by C files. Please do not use C++ style comments; use - ONLY C style comments in this file to make the C compiler happy. -----------------------------------------------------------------------------------------------*/ -#ifdef _MSC_VER -#pragma once -#endif -#ifndef GRRESULT_INCLUDED -#define GRRESULT_INCLUDED - -/* -//:End Ignore - */ - - -namespace gr -{ - - - -/*:>********************************************************************************************/ -/*:> Result flags */ -/*:>********************************************************************************************/ - -/* These are return values for the main interface methods to indicate various kinds of */ -/* error conditions. To facilitate COM compatibiliy, they match the standard COM HRESULT codes. */ -enum GrResult -{ - kresOk = 0, // S_OK - kresFalse = 1, // S_FALSE - kresFail = 0x80004005L, // E_FAIL - kresOutOfMemory = 0x8007000EL, // E_OUTOFMEMORY - kresInvalidArg = 0x80000002L, // E_INVALIDARG - kresReadFault = 0x80000001L, // STG_E_READFAULT - kresUnexpected = 0x80000003L, // E_UNEXPECTED - kresNotImpl = 0x80000004L, // E_NOTIMPL - kresPointer = 0x80004003L//, // E_POINTER -}; - -#define ResultFailed(res) (res != kresOk) /* && res != kresFalse */ - -#define ResultSucceeded(res) (res == kresOk) /* || res == kresFalse */ - -enum FontErrorCode -{ - kferrOkay, - kferrUninitialized, - kferrUnknown, - kferrFindHeadTable, - kferrReadDesignUnits, - kferrFindCmapTable, - kferrLoadCmapSubtable, - kferrCheckCmapSubtable, - kferrFindNameTable, - kferrLoadSilfTable, - kferrLoadFeatTable, - kferrLoadGlatTable, - kferrLoadGlocTable, - kferrReadSilfTable, - kferrReadGlocGlatTable, - kferrReadFeatTable, - kferrBadVersion, - kferrSileTableMismatch, - kferrReadSillTable -}; - -/*:>********************************************************************************************/ -/*:> Error handling */ -/*:>********************************************************************************************/ -/* These are set up as #defines so we can easily adjust them once we know how errors should */ -/* be handled. */ - -#define ReturnResult(res) return res - -#ifdef GR_FW -#define THROW(res) ThrowInternalError(res) -#else -#define THROW(res) throw res -#endif /* GR_FW */ - - -// #if !defined(NDEBUG) - -#if (0) // can't get E_POINTER to work so no debugging this way for now - -} // namespace gr - -#include - -namespace gr -{ - -#define WARN(warning) (std::cerr << __FILE__ << ':' << __LINE__ << ": WARN: " << #warning, warning) - -/*:>********************************************************************************************/ -/*:> Argument checking */ -/*:>********************************************************************************************/ - -#define ChkGrArgPtr(p) \ -{ \ - AssertPtrN(p); \ - if (!p) \ - THROW(E_POINTER); \ -} \ - -#define ChkGrOutPtr(p) \ -{ \ - AssertPtrN(p); \ - if (!p) \ - THROW(E_POINTER); \ -} \ - -#define ChkGrArgPtrN(p) \ - AssertPtrN(p); \ - -#define ChkGrArrayArg(prgv, cv) \ -{ \ - AssertArray(prgv, cv); \ - if (cv && !prgv) \ - THROW(E_POINTER); \ -} \ - -#define ChkGrBstrArg(bstr) \ - AssertBstr(bstr); \ - -#define ChkGrBstrArgN(bstr) \ - AssertBstrN(bstr); \ - -#else // debugging is off - -#define WARN(warning) (warning) - -/*:>********************************************************************************************/ -/*:> Argument checking */ -/*:>********************************************************************************************/ - -#define ChkGrArgPtr(p) (static_cast(0)) - -#define ChkGrOutPtr(p) (static_cast(0)) - -#define ChkGrArgPtrN(p) (static_cast(0)) - -#define ChkGrArrayArg(prgv, cv) (static_cast(0)) - -#define ChkGrBstrArg(bstr) (static_cast(0)) - -#define ChkGrBstrArgN(bstr) (static_cast(0)) - -#endif // !defined(NDEBUG) - -} // namespace gr - -#if defined(GR_NO_NAMESPACE) -using namespace gr; -#endif - -#endif /* !GRRESULT_INCLUDED */ diff --git a/Build/source/libs/graphite/engine-2.3.1/include/graphite/GrStructs.h b/Build/source/libs/graphite/engine-2.3.1/include/graphite/GrStructs.h deleted file mode 100644 index a1c9debe238..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/include/graphite/GrStructs.h +++ /dev/null @@ -1,97 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 1999, 2001 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: GrStructs.h -Responsibility: Sharon Correll -Last reviewed: Not yet. - -Copyright (C) 1999 by SIL International. All rights reserved. - -Description: - Cross-platform structure definitions. -----------------------------------------------------------------------------------------------*/ -#ifdef _MSC_VER -#pragma once -#endif -#ifndef GRSTRUCTS_INCLUDED -#define GRSTRUCTS_INCLUDED -#include "GrPlatform.h" - -namespace gr -{ - -//:End Ignore - -typedef struct tagGrCharProps -{ - unsigned long clrFore; - unsigned long clrBack; - int dympOffset; - int ws; - int ows; - byte fWsRtl; - int nDirDepth; - byte ssv; - byte ttvBold; - byte ttvItalic; - int dympHeight; - wchar_t szFaceName[ 32 ]; - wchar_t szFontVar[ 64 ]; -} GrCharProps; - -// Used to pass feature information among the Graphite engine and the application. -typedef struct tagFeatureSetting -{ - int id; - int value; -} FeatureSetting; - -/***** -struct Point -{ - float x; - float y; - - Point() - { - x = y = 0; - } - - Point(POINT & p) - { - x = (float)p.x; - y = (float)p.y; - } -}; - - -struct Rect -{ - float top; - float bottom; - float left; - float right; - - Rect() - { - top = bottom = left = right = 0; - }; - - Rect(RECT & r) - { - top = (float)r.top; - bottom = (float)r.bottom; - left = (float)r.left; - right = (float)r.right; - }; -}; -****/ - -} // namespace gr - - -#endif // !STRUCTS_INCLUDED - diff --git a/Build/source/libs/graphite/engine-2.3.1/include/graphite/GrWrappers.h b/Build/source/libs/graphite/engine-2.3.1/include/graphite/GrWrappers.h deleted file mode 100644 index 077b4695d80..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/include/graphite/GrWrappers.h +++ /dev/null @@ -1,13 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 1999, 2001, 2003 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: GrWrapperClases.h -Responsibility: Sharon Correll -Last reviewed: - - Wrapper classes to be included in the open-source version of the Graphite DLL. - Currently there are none. -----------------------------------------------------------------------------------------------*/ diff --git a/Build/source/libs/graphite/engine-2.3.1/include/graphite/GraphiteProcess.h b/Build/source/libs/graphite/engine-2.3.1/include/graphite/GraphiteProcess.h deleted file mode 100644 index 60f81860c2e..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/include/graphite/GraphiteProcess.h +++ /dev/null @@ -1,45 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 1999, 2001 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: GraphiteProcess.h -Responsibility: Sharon Correll -Last reviewed: Not yet. - -Description: - The interface that is needed for the Justifier object to call back to the Graphite engine. -----------------------------------------------------------------------------------------------*/ -#ifdef _MSC_VER -#pragma once -#endif -#ifndef GRAPHITEPROCESS_INCLUDED -#define GRAPHITEPROCESS_INCLUDED - -#include "GrResult.h" -//:End Ignore -namespace gr -{ - -/*---------------------------------------------------------------------------------------------- - - Hungarian: fgje -----------------------------------------------------------------------------------------------*/ -class GraphiteProcess -{ -public: - virtual ~GraphiteProcess() {}; - virtual GrResult getGlyphAttribute(int iGlyph, int jgat, int nLevel, float * pValueRet) = 0; - virtual GrResult getGlyphAttribute(int iGlyph, int jgat, int nLevel, int * pValueRet) = 0; - virtual GrResult setGlyphAttribute(int iGlyph, int jgat, int nLevel, float value) = 0; - virtual GrResult setGlyphAttribute(int iGlyph, int jgat, int nLevel, int value) = 0; -}; - -} // namespace gr - -#if defined(GR_NO_NAMESPACE) -using namespace gr; -#endif - -#endif // !IGR_JENGINE_INCLUDED diff --git a/Build/source/libs/graphite/engine-2.3.1/include/graphite/HashMap.h b/Build/source/libs/graphite/engine-2.3.1/include/graphite/HashMap.h deleted file mode 100644 index aa925ac608d..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/include/graphite/HashMap.h +++ /dev/null @@ -1,328 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 2001 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: HashMap.h -Responsibility: Steve McConnel -Last reviewed: Not yet. - -Description: - This provides a set of template collection classes to replace std::map. Their primary - reason to exist is to allow explicit checking for internal memory allocation failures. -----------------------------------------------------------------------------------------------*/ -#pragma once -#ifndef HASHMAP_H_INCLUDED -#define HASHMAP_H_INCLUDED -//:End Ignore - -/*---------------------------------------------------------------------------------------------- - Functor class for computing a hash value from an arbitrary object. - - Hungarian: hsho -----------------------------------------------------------------------------------------------*/ -class HashObj -{ -public: - int operator () (void * pKey, int cbKey); -}; - -/*---------------------------------------------------------------------------------------------- - Functor class for comparing two arbitrary objects (of the same class) for equality. - - Hungarian: eqlo -----------------------------------------------------------------------------------------------*/ -class EqlObj -{ -public: - bool operator () (void * pKey1, void * pKey2, int cbKey); -}; - -/*---------------------------------------------------------------------------------------------- - Hash map template collection class whose keys are objects of an arbitrary class. - - Hungarian: hm[K][T] -----------------------------------------------------------------------------------------------*/ -template class HashMap -{ -public: - //:> Member classes - - /*------------------------------------------------------------------------------------------ - This is the basic data structure for storing one key-value pair in a hash map. In - order to handle hash collisions, this structure is a member of a linked list. - Hungarian: hsnd - ------------------------------------------------------------------------------------------*/ - class HashNode - { - public: - //:> Constructors/destructors/etc. - - HashNode(void) - : m_key(K()), m_value(T()), m_nHash(0), m_ihsndNext(0) - { - } - HashNode(K & key, T & value, int nHash, int ihsndNext = -1) - : m_key(key), m_value(value), m_nHash(nHash), m_ihsndNext(ihsndNext) - { - } - ~HashNode() - { - } - - //:> Member variable access - - void PutKey(K & key) - { - m_key = key; - } - K & GetKey() - { - return m_key; - } - void PutValue(T & value) - { - m_value = value; - } - T & GetValue() - { - return m_value; - } - void PutHash(int nHash) - { - m_nHash = nHash; - } - int GetHash() - { - return m_nHash; - } - void PutNext(int ihsndNext) - { - m_ihsndNext = ihsndNext; - } - int GetNext() - { - return m_ihsndNext; - } - - /*-------------------------------------------------------------------------------------- - Check whether the given HashNode is being used. - --------------------------------------------------------------------------------------*/ - bool InUse() - { - return m_ihsndNext >= -1; - } - - protected: - //:> Member variables - - K m_key; - T m_value; - int m_nHash; - int m_ihsndNext; // -1 means end of list, -(ihsnd + 3) for free list members - }; - - /*------------------------------------------------------------------------------------------ - This provides an iterator for stepping through all HashNodes stored in the hash map. - This is useful primarily for saving the contents of a hash map to a file. - - Hungarian: ithm[K][T] - ------------------------------------------------------------------------------------------*/ - class iterator - { - public: - // Constructors/destructors/etc. - - iterator() : m_phmParent(0), m_ihsnd(0) - { - } - iterator(HashMap * phm, int ihsnd) : m_phmParent(phm), m_ihsnd(ihsnd) - { - } - iterator(const iterator & v) : m_phmParent(v.m_phmParent), m_ihsnd(v.m_ihsnd) - { - } - ~iterator() - { - } - - // Other public methods - - iterator & operator = (const iterator & ithm) - { - m_phmParent = ithm.m_phmParent; - m_ihsnd = ithm.m_ihsnd; - return *this; - } - T & operator * (void) - { - Assert(m_phmParent); - Assert(m_phmParent->m_prghsnd); - Assert(m_ihsnd < m_phmParent->m_ihsndLim); - return m_phmParent->m_prghsnd[m_ihsnd].GetValue(); - } - HashNode * operator -> (void) - { - Assert(m_phmParent); - Assert(m_phmParent->m_prghsnd); - Assert(m_ihsnd < m_phmParent->m_ihsndLim); - return &m_phmParent->m_prghsnd[m_ihsnd]; - } - iterator & operator ++ (void) - { - Assert(m_phmParent); - ++m_ihsnd; - // make sure that this new HashNode is actually in use - while (m_ihsnd < m_phmParent->m_ihsndLim) - { - if (m_phmParent->m_prghsnd[m_ihsnd].InUse()) - return *this; - // skip to the next one and check it - ++m_ihsnd; - } - if (m_ihsnd > m_phmParent->m_ihsndLim) - m_ihsnd = m_phmParent->m_ihsndLim; - return *this; - } - bool operator == (const iterator & ithm) - { - return (m_phmParent == ithm.m_phmParent) && (m_ihsnd == ithm.m_ihsnd); - } - bool operator != (const iterator & ithm) - { - return (m_phmParent != ithm.m_phmParent) || (m_ihsnd != ithm.m_ihsnd); - } - T & GetValue(void) - { - Assert(m_phmParent); - Assert(m_phmParent->m_prghsnd); - Assert(m_ihsnd < m_phmParent->m_ihsndLim); - Assert(m_phmParent->m_prghsnd[m_ihsnd].InUse()); - return m_phmParent->m_prghsnd[m_ihsnd].GetValue(); - } - K & GetKey(void) - { - Assert(m_phmParent); - Assert(m_phmParent->m_prghsnd); - Assert(m_ihsnd < m_phmParent->m_ihsndLim); - Assert(m_phmParent->m_prghsnd[m_ihsnd].InUse()); - return m_phmParent->m_prghsnd[m_ihsnd].GetKey(); - } - int GetHash() - { - Assert(m_phmParent); - Assert(m_phmParent->m_prghsnd); - Assert(m_ihsnd < m_phmParent->m_ihsndLim); - Assert(m_phmParent->m_prghsnd[m_ihsnd].InUse()); - return m_phmParent->m_prghsnd[m_ihsnd].GetHash(); - } - int GetIndex() - { - Assert(m_phmParent); - Assert(m_phmParent->m_prghsnd); - Assert(m_ihsnd < m_phmParent->m_ihsndLim); - Assert(m_phmParent->m_prghsnd[m_ihsnd].InUse()); - return m_ihsnd; - } - - protected: - //:> Member variables - - HashMap * m_phmParent; - int m_ihsnd; - }; - friend class iterator; - - //:> Constructors/destructors/etc. - - HashMap(); - ~HashMap(); - HashMap(HashMap & hm); - - //:> Other public methods - - iterator Begin(); - iterator End(); - void Insert(K & key, T & value, bool fOverwrite = false, int * pihsndOut = 0); - bool Retrieve(K & key, T * pvalueRet); - bool Delete(K & key); - void Clear(); - void CopyTo(HashMap & hmKT); - void CopyTo(HashMap * phmKT); - - bool GetIndex(K & key, int * pihsndRet); - bool IndexKey(int ihsnd, K * pkeyRet); - bool IndexValue(int ihsnd, T * pvalueRet); - - int Size(); - - /*------------------------------------------------------------------------------------------ - The assignment operator allows an entire hashmap to be assigned as the value of another - hashmap. It throws an error if it runs out of memory. - - @return a reference to this hashmap. (That is how the assignment operator is defined!) - - @param hm is a reference to the other hashmap. - ------------------------------------------------------------------------------------------*/ - HashMap & operator = (HashMap & hm) - { - hm.CopyTo(this); - return *this; - } - - //:Ignore -#ifdef DEBUG - int _BucketCount(); - int _EmptyBuckets(); - int _BucketsUsed(); - int _FullestBucket(); - bool AssertValid() - { - AssertPtrN(m_prgihsndBuckets); - Assert(m_prgihsndBuckets || !m_cBuckets); - Assert(!m_prgihsndBuckets || m_cBuckets); - AssertArray(m_prgihsndBuckets, m_cBuckets); - AssertPtrN(m_prghsnd); - Assert(m_prghsnd || !m_ihsndMax); - Assert(!m_prghsnd || m_ihsndMax); - AssertArray(m_prghsnd, m_ihsndMax); - Assert(0 <= m_ihsndLim && m_ihsndLim <= m_ihsndMax); - Assert(-1 <= FreeListIdx(m_ihsndFirstFree)); - Assert(FreeListIdx(m_ihsndFirstFree) < m_ihsndLim); - return true; - } -#endif - //:End Ignore - -protected: - //:> Member variables - - int * m_prgihsndBuckets; - int m_cBuckets; - HashNode * m_prghsnd; - int m_ihsndLim; - int m_ihsndMax; - int m_ihsndFirstFree; // stores -(ihsnd + 3) - - //:> Protected methods - //:Ignore - - /*------------------------------------------------------------------------------------------ - Map between real index and "free list" index. Note that this mapping is bidirectional. - ------------------------------------------------------------------------------------------*/ - int FreeListIdx(int ihsnd) - { - return -(ihsnd + 3); - } - //:End Ignore -}; - - -// Local Variables: -// mode:C++ -// c-file-style:"cellar" -// tab-width:4 -// End: - -#endif /*HASHMAP_H_INCLUDED*/ diff --git a/Build/source/libs/graphite/engine-2.3.1/include/graphite/IGrEngine.h b/Build/source/libs/graphite/engine-2.3.1/include/graphite/IGrEngine.h deleted file mode 100644 index 481cb534b46..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/include/graphite/IGrEngine.h +++ /dev/null @@ -1,36 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 2003 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -NU Lesser General Public License, as specified in the LICENSING.txt file. - -File: IGrEngine.h -Responsibility: Sharon Correll -Last reviewed: Not yet. - -Description: - A very minimal interface representing the Graphite engine, for passing to the - GrJustifier. --------------------------------------------------------------------------------*//*:End Ignore*/ -#ifdef _MSC_VER -#pragma once -#endif -#ifndef IGRENG_INCLUDED -#define IGRENG_INCLUDED - -namespace gr -{ -/*---------------------------------------------------------------------------------------------- - Class: IGrEngine -----------------------------------------------------------------------------------------------*/ -class IGrEngine -{ -}; - -} // namespace gr - -#if defined(GR_NO_NAMESPACE) -using namespace gr; -#endif - -#endif // !IGRENG_INCLUDED diff --git a/Build/source/libs/graphite/engine-2.3.1/include/graphite/IGrJustifier.h b/Build/source/libs/graphite/engine-2.3.1/include/graphite/IGrJustifier.h deleted file mode 100644 index a9ba6e51c07..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/include/graphite/IGrJustifier.h +++ /dev/null @@ -1,58 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 2003 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: IGrJustifier.h -Responsibility: Sharon Correll -Last reviewed: Not yet. - -Description: - An interface for a justification agent that is used by the Graphite engine. --------------------------------------------------------------------------------*//*:End Ignore*/ -#ifdef _MSC_VER -#pragma once -#endif -#ifndef IGRJUSTIFIER_INCLUDED -#define IGRJUSTIFIER_INCLUDED - -#include "GrResult.h" - -namespace gr -{ - -class GraphiteProcess; - -/*---------------------------------------------------------------------------------------------- - Class: IGrJustifier - This class provides an interface for a justification agent for the Graphite engine. -----------------------------------------------------------------------------------------------*/ -class IGrJustifier -{ -public: - virtual ~IGrJustifier() {}; - virtual GrResult adjustGlyphWidths(GraphiteProcess * pgje, int iGlyphMin, int iGlyphLim, - float dxCurrWidth, float dxDesiredWidth) = 0; - - //virtual GrResult suggestShrinkAndBreak(GraphiteProcess * pfgjwe, - // int iGlyphMin, int iGlyphLim, float dxsWidth, LgLineBreak lbPref, LgLineBreak lbMax, - // float * pdxShrink, LgLineBreak * plbToTry) = 0; - - // Return a Graphite-compatible justifier that can be stored in a Graphite segment. - // TODO: remove - //virtual void JustifierObject(IGrJustifier ** ppgjus) = 0; - - // When a segment is being destroyed, delete this object, which is the wrapper for the - // text source inside of it. - // TODO: remove - //virtual void DeleteJustifierPtr() = 0; -}; - -} // namespace gr - -#if defined(GR_NO_NAMESPACE) -using namespace gr; -#endif - -#endif // !IGRJUSTIFIER_INCLUDED diff --git a/Build/source/libs/graphite/engine-2.3.1/include/graphite/IGraphiteProcess.h b/Build/source/libs/graphite/engine-2.3.1/include/graphite/IGraphiteProcess.h deleted file mode 100644 index ee84a94cdb1..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/include/graphite/IGraphiteProcess.h +++ /dev/null @@ -1,44 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 1999, 2001 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: GraphiteProcess.h -Responsibility: Sharon Correll -Last reviewed: Not yet. - -Description: - The interface that is needed for the Justifier object to call back to the Graphite engine. -----------------------------------------------------------------------------------------------*/ -#ifdef _MSC_VER -#pragma once -#endif -#ifndef IGRAPHITEPROCESS_INCLUDED -#define IGRAPHITEPROCESS_INCLUDED - -#include "GrResult.h" -//:End Ignore -namespace gr -{ - -/*---------------------------------------------------------------------------------------------- - - Hungarian: fgje -----------------------------------------------------------------------------------------------*/ -class GraphiteProcess -{ -public: - virtual GrResult GetGlyphAttribute(int iGlyph, int jgat, int nLevel, float * pValueRet) = 0; - virtual GrResult GetGlyphAttribute(int iGlyph, int jgat, int nLevel, int * pValueRet) = 0; - virtual GrResult SetGlyphAttribute(int iGlyph, int jgat, int nLevel, float value) = 0; - virtual GrResult SetGlyphAttribute(int iGlyph, int jgat, int nLevel, int value) = 0; -}; - -} // namespace gr - -#if defined(GR_NO_NAMESPACE) -using namespace gr; -#endif - -#endif // !IGR_JENGINE_INCLUDED diff --git a/Build/source/libs/graphite/engine-2.3.1/include/graphite/ITextSource.h b/Build/source/libs/graphite/engine-2.3.1/include/graphite/ITextSource.h deleted file mode 100644 index 154d80296e3..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/include/graphite/ITextSource.h +++ /dev/null @@ -1,69 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 1999, 2001 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: ITextSource.h -Responsibility: Sharon Correll -Last reviewed: Not yet. - -Description: - An interface for a text source that is used by the Graphite engine. --------------------------------------------------------------------------------*//*:End Ignore*/ -#ifdef _MSC_VER -#pragma once -#endif -#ifndef IGRTXTSRC_INCLUDED -#define IGRTXTSRC_INCLUDED - - -#include "GrAppData.h" -#include "GrStructs.h" -#include "GrResult.h" - -namespace gr -{ - -/*---------------------------------------------------------------------------------------------- - Class: ITextSource - This class provides an interface for a text source for the Graphite engine. -----------------------------------------------------------------------------------------------*/ -class ITextSource -{ -public: - virtual ~ITextSource() {}; - virtual UtfType utfEncodingForm() = 0; - virtual size_t getLength() = 0; - virtual size_t fetch(toffset ichMin, size_t cch, utf32 * prgchBuffer) = 0; - virtual size_t fetch(toffset ichMin, size_t cch, utf16 * prgchwBuffer) = 0; - virtual size_t fetch(toffset ichMin, size_t cch, utf8 * prgchsBuffer) = 0; - virtual bool getRightToLeft(toffset ich) = 0; - virtual unsigned int getDirectionDepth(toffset ich) = 0; - virtual float getVerticalOffset(toffset ich) = 0; - virtual isocode getLanguage(toffset ich) = 0; - - virtual std::pair propertyRange(toffset ich) = 0; - virtual size_t getFontFeatures(toffset ich, FeatureSetting * prgfset) = 0; - virtual bool sameSegment(toffset ich1, toffset ich2) = 0; -}; - - -/*---------------------------------------------------------------------------------------------- - Class: IColorTextSource - Defines a method to get the color informtion from the text source. - It is needed for SegmentPainters that want to handle color. -----------------------------------------------------------------------------------------------*/ -class IColorTextSource : public ITextSource -{ -public: - virtual void getColors(toffset ich, int * pclrFore, int * pclrBack) = 0; -}; - -} // namespace gr - -#if defined(GR_NO_NAMESPACE) -using namespace gr; -#endif - -#endif // !IGRTXTSRC_INCLUDED diff --git a/Build/source/libs/graphite/engine-2.3.1/include/graphite/MemoryUsage.h b/Build/source/libs/graphite/engine-2.3.1/include/graphite/MemoryUsage.h deleted file mode 100644 index d59ff165f75..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/include/graphite/MemoryUsage.h +++ /dev/null @@ -1,156 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 2007 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: MemoryUsage.h -Responsibility: Sharon Correll -Last reviewed: not yet - -Description: - Data structures to hold the calculations for memory usage. -----------------------------------------------------------------------------------------------*/ - -#ifdef _MSC_VER -#pragma once -#endif -#ifndef MEMORYUSAGE_INCLUDED -#define MEMORYUSAGE_INCLUDED - -//:End Ignore - - -namespace gr -{ - -/*---------------------------------------------------------------------------------------------- - A data structure that holds information about the memory usage for font/engine objects -----------------------------------------------------------------------------------------------*/ -class FontMemoryUsage -{ - friend class FontCache; - friend class FontFace; - -public: - FontMemoryUsage() - { - initialize(); - } - void addEngine(GrEngine * pgreng); - void prettyPrint(std::ostream & strm); - -protected: - // member variables: - std::vector vFontTotalsReg; - std::vector vFontTotalsBold; - std::vector vFontTotalsItalic; - std::vector vFontTotalsBI; - std::vector vstrFontNames; - std::vector vFaceCount; - - size_t font; - size_t fontCache; - size_t fontFace; - - size_t eng_count; - size_t eng_overhead; - size_t eng_scalars; - size_t eng_strings; - size_t eng_pointers; - size_t eng_cmap; - size_t eng_nameTable; - - size_t pseudoMap; - - size_t clstbl_counters; - size_t clstbl_offsets; - size_t clstbl_glyphList; - - size_t glftbl_general; - size_t glftbl_compDefns; - size_t glftbl_attrTable; - size_t glftbl_attrOffsets; - - size_t lngtbl_general; - size_t lngtbl_entries; - size_t lngtbl_featureSets; - - size_t tman_general; - - size_t pass_count; - size_t pass_general; - size_t pass_fsm; - size_t pass_ruleExtras; - size_t pass_constraintOffsets; - size_t pass_constraintCode; - size_t pass_actionOffsets; - size_t pass_actionCode; - - size_t engst_general; - size_t engst_passState; - - size_t sstrm_count; - size_t sstrm_general; - size_t sstrm_chunkMapsUsed; - size_t sstrm_chunkMapsAlloc; - size_t sstrm_reprocBuf; - - size_t slot_count; - size_t slot_general; - size_t slot_abstract; - size_t slot_varLenBuf; - size_t slot_assocsUsed; - size_t slot_assocsAlloc; - size_t slot_attachUsed; - size_t slot_attachAlloc; - - // methods: - void initialize(); - int total(); - void add(FontMemoryUsage & fmu); -}; - -/*---------------------------------------------------------------------------------------------- - A data structure that holds information about the memory usage for segment objects. -----------------------------------------------------------------------------------------------*/ -class SegmentMemoryUsage -{ -public: - SegmentMemoryUsage() - { - initialize(); - } - void addSegment(Segment & seg); - void prettyPrint(std::ostream & strm); - -protected: - // member variables: - size_t seg_count; - size_t overhead; - size_t pointers; - size_t scalars; - size_t strings; - size_t metrics; - size_t associations; - size_t init; - size_t obsolete; - - size_t slot_count; - size_t slot_abstract; - size_t slot_varLenBuf; - size_t slot_scalars; - size_t slot_clusterMembers; - - size_t glyphInfo_count; - size_t glyphInfo; - - size_t wastedVector; // allocated space that is not used in vectors - - // methods: - void initialize(); -}; - -} // namespace gr - -#endif // !MEMORYUSAGE_INCLUDED diff --git a/Build/source/libs/graphite/engine-2.3.1/include/graphite/Segment.h b/Build/source/libs/graphite/engine-2.3.1/include/graphite/Segment.h deleted file mode 100644 index dc5557a36e6..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/include/graphite/Segment.h +++ /dev/null @@ -1,623 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 1999, 2001 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: Segment.h -Responsibility: Sharon Correll -Last reviewed: Not yet. - -Description: - Defines the class for a Graphite text segment. -----------------------------------------------------------------------------------------------*/ -#ifdef _MSC_VER -#pragma once -#endif -#ifndef GR_SEGMENT_INCLUDED -#define GR_SEGMENT_INCLUDED - -#include "Font.h" -#include "GrConstants.h" -#include "SegmentAux.h" - -// undo automagic DrawTextA DrawTextW stuff -// #undef DrawText - -//:End Ignore - -namespace gr -{ -class GrEngine; -class SegmentMemoryUsage; - -class IGrJustifier; -class GrTableManager; -class GrSlotStream; -class GrSlotOutput; - -/*---------------------------------------------------------------------------------------------- - A Graphite segment consists of a sequence of well-positioned glyphs all on one line, - Each glyph understands its relationship to the underlying text that was used to generate - the segment. - - Hungarian: seg -----------------------------------------------------------------------------------------------*/ -class Segment -{ - friend class GrEngine; - friend class SegmentPainter; - friend class GlyphInfo; - friend class GlyphIterator; - friend class GlyphSetIterator; - friend class SegmentMemoryUsage; - -public: - // Static methods - - // Constructors, destructors, etc. - Segment(); -// Segment(ITextSource * pgts, int ichMin, int ichLim, -// LineBrk lbStart, LineBrk lbEnd, -// bool fStartLine, bool fEndLine, bool fWsRtl); - - virtual ~Segment(); - - // Basic copy constructor: - Segment(const Segment & seg); - - // For making modified copies of segments: - static Segment * LineContextSegment(Segment & seg, bool fStartLine, bool fEndLine); - static Segment * JustifiedSegment(Segment & seg, float xsNewWidth); - static Segment * WhiteSpaceSegment(Segment & seg, int newDirDepth); - - static int GetSegmentCount(); - -public: - - long IncRefCount(); - long DecRefCount(); - - Font & getFont(); - ITextSource & getText(); - float advanceWidth(); - Rect boundingRect(); - - bool rightToLeft(); - bool paraRightToLeft() { return m_fParaRtl; } - int directionDepth(bool * pfWeak = NULL); - bool setDirectionDepth(int nNewDepth); - int startCharacter(); - int stopCharacter(); - bool startOfLine(); - bool endOfLine(); - bool hasLineBoundaryContext(); - SegEnd segmentTermination(); - LineBrk startBreakWeight(); - LineBrk endBreakWeight(); - float stretch(); - float maxStretch(); - float maxShrink(); - void setTextSourceOffset(int ichMin) - { - m_ichwMin = ichMin; - } - - //GrResult changeLineEnds(bool fNewStart, bool fNewEnd); - - std::pair glyphs(); - std::pair charToGlyphs(toffset ich); - - // OBSOLETE: - GrResult GetCharData(int cchMax, utf16 * prgch, int * pcchRet); - GrResult GlyphToChar(int iginf, bool fFirst, int * pich); - GrResult GlyphToAllChars(int iginf, int cichMax, int * prgich, int *pcichRet); - GrResult CharToGlyph(int ich, bool fFirst, int * pigbb); - - // Not part of FW interface: - - float getRangeWidth(int ichMin, int ichLim, - bool fStartLine = true, bool fEndLine = true, bool fSkipSpace = true); - int findNextBreakPoint(int ichStart, - LineBrk lbPref, LineBrk lbWorst, float dxMaxWidth, - float * pdxBreakWidth, bool fStartLine = true, bool fEndLine = true); - - GrResult getUniscribeClusters( - int * prgigbb1stOfCluster, int cchMax, int * pcch, - bool * pfClusterStart, int cfMax, int * pcf); - - //GrResult GetGlyphsAndPositions( - // Rect rsArg, Rect rdArg, int cgidMax, int * pcgidRet, utf16 * prggid, - // float * prgxd, float * prgyd, float * prgdxdAdv); - //GrResult GetUniscribePositions( - // Rect rs, Rect rd, int cgidMax, int * pcgidRet, - // float * prgxd, float * prgyd, float * prgdxdAdv); - //GrResult GetUniscribeGlyphsAndPositions( - // Rect rsArg, Rect rdArg, int cgidMax, int * pcchRet, utf16 * prgchGlyphs, - // float * prgxd, float * prgyd, float * prgdxdAdv); - - // Other public methods: - - void Initialize(ITextSource * pgts, int ichMin, int ichLim, - LineBrk lbStart, LineBrk lbEnd, SegEnd est, - bool fStartLine, bool fEndLine, bool fWsRtl); - void DestroyContents(); - void SwapWith(Segment * pgrseg); - void ClearAltEndLineSeg(); - - ITextSource * GetString(); // client is responsible to Release() - - // The following three functions handle storing and retrieving information that - // allows us to restart a new segment following a line break. This is necessary - // in case there is some sort of contextualization across the line break. - void StoreRestartInfo(int cslotRestartBackup, std::vector& vnSkipOffsets) - { - m_cslotRestartBackup = cslotRestartBackup; - m_vnSkipOffsets.resize(vnSkipOffsets.size()); - for (size_t i = 0; i < vnSkipOffsets.size(); i++) - m_vnSkipOffsets[i] = sdata8(vnSkipOffsets[i]); - } - int NextRestartBackup() - { - return m_cslotRestartBackup; - } - int RestartBackup() - { - //return (m_psegPrev)? m_psegPrev->NextRestartBackup(): 0; - return 0; - } - int SkipOffset(int ipass) - { - return int(m_vnSkipOffsets[ipass]); - } - DirCode PreviousStrongDir() - { - return m_dircPrevStrong; - } - void SetPreviousStrongDir(DirCode dirc) - { - m_dircPrevStrong = dirc; - } - DirCode PreviousTermDir() - { - return m_dircPrevTerm; - } - void SetPreviousTermDir(DirCode dirc) - { - m_dircPrevTerm = dirc; - } - - int NextSegInitBuffer(byte ** ppbDat) - { - *ppbDat = m_prgbNextSegDat; - return m_cbNextSegDat; - } - int ThisSegInitBuffer(byte ** ppbDat) - { - *ppbDat = m_prgInitDat; - return m_cbInitDat; - } - -// void SetNextSeg(Segment * psegNext) -// { -// m_psegNext = psegNext; -// } - - void SetFaceName(std::wstring /*stu*/, std::wstring /*stuBase*/) - { -// m_stuFaceName = stu; -// m_stuBaseFaceName = stuBase; -// m_fUseSepBase = (m_stuBaseFaceName.size() > 0); - } - - void SetEngine(GrEngine * pgreng); - void SetFont(Font * pfont); - void SwitchFont(Font * pfont); - GrEngine * EngineImpl(); - - void SetJustifier(IGrJustifier * pgjus); - IGrJustifier * Justifier() - { - return m_pgjus; - } - - void SetPreContext(int dich) - { - m_dichPreContext = dich; - } - - //void SetToBaseFont(IGrGraphics * pgg); - //void RestoreFont(IGrGraphics * pgg); - - void SetUpOutputArrays(Font * pfont, GrTableManager * ptm, - GrSlotStream * psstrmFinal, - int cchwUnderlying, int csloutSurface, gid16 chwLB, - TrWsHandling twsh, bool fParaRtl, int nDirDepth, - bool fEmpty = false); - void RecordSurfaceAssoc(int ichw, int islot, int nDir); - void RecordLigature(int ichwUnder, int islotSurface, int iComponent); - void AdjustForOverlapsWithPrevSeg(); - void MarkSlotInPrevSeg(int ichw, int islot); - void MarkSlotInNextSeg(int ichw, int islot); - - void CleanUpAssocsVectors() - { - for (int iv = 0; iv < m_ichwAssocsLim - m_ichwAssocsMin; iv++) - { - std::vector * pvislout = m_prgpvisloutAssocs[iv]; - if (pvislout->size() <= 1) - { - delete pvislout; - *(m_prgpvisloutAssocs + iv) = NULL; - } - } - } - - GrSlotOutput * OutputSlot(int islout); - - void RecordInitializationForNextSeg(int cbNextSegDat, byte * pbNextSegDat) - { - m_cbNextSegDat = cbNextSegDat; - m_prgbNextSegDat = new byte[m_cbNextSegDat]; - std::copy(pbNextSegDat, pbNextSegDat + cbNextSegDat, m_prgbNextSegDat); - } - void RecordInitializationForThisSeg(int cbDat, byte * pbDat) - { - m_cbInitDat = cbDat; - if (cbDat == 0) - m_prgInitDat = NULL; - else - { - m_prgInitDat = new byte[m_cbInitDat]; - std::copy(pbDat, pbDat + cbDat, m_prgInitDat); - } - } - - void SetWidths(float dxsVisWidth, float dxsTotalWidth) - { - m_dxsVisibleWidth = dxsVisWidth; - m_dxsTotalWidth = dxsTotalWidth; - } - - void SetLayout(LayoutEnvironment & layout) - { - m_layout.setStartOfLine(layout.startOfLine()); - m_layout.setEndOfLine(layout.endOfLine()); - m_layout.setBestBreak(layout.bestBreak()); - m_layout.setWorstBreak(layout.worstBreak()); - m_layout.setRightToLeft(layout.rightToLeft()); - m_layout.setTrailingWs(layout.trailingWs()); - m_layout.setPrevSegment(layout.prevSegment()); - m_layout.setJustifier(layout.justifier()); - m_layout.setLoggingStream(layout.loggingStream()); - m_layout.setDumbFallback(layout.dumbFallback()); - } - LayoutEnvironment & Layout() - { - return m_layout; - } - - bool Erroneous() - { - return m_fErroneous; - } - void SetErroneous(bool f) - { - m_fErroneous = f; - } - - void FixTermination(SegEnd est) - { - m_est = est; - } - - // Convert from em-units to logical units. - float EmToLogUnits(int m); - - Rect ComponentRect(GrSlotOutput * pslout, int icomp); - - void ClusterMembersForGlyph(int islout, int disloutCluster, std::vector & visloutRet); - - // for transduction logging: - // implementations are empty unless TRACING is defined - void LogUnderlyingToSurface(GrTableManager * ptman, std::ostream & strmOut, - GrCharStream * pchstrm); - void LogSurfaceToUnderlying(GrTableManager * ptman, std::ostream & strmOut); - - // calculate memory usage - void calculateMemoryUsage(SegmentMemoryUsage & smu); - -protected: - // Member variables: - long m_cref; // standard COM ref count - - ITextSource * m_pgts; // the string we are a segment of - int m_dichwLim; // number of characters officially in this segment - int m_ichwMin; // first character relative to the text-source - - Font * m_pfont; - GrEngine * m_preneng; - - bool m_fErroneous; // an error occurred in generating this segment - - IGrJustifier * m_pgjus; - - LayoutEnvironment m_layout; - - bool m_fWsRtl; // writing system direction - bool m_fParaRtl; // paragraph direction; redundant with layout? - - TrWsHandling m_twsh; // // redundant with layout? - int m_nDirDepth; // segment direction (white-space-only segments can switch) - - byte * m_prgbNextSegDat; // for initializing the following segment - int m_cbNextSegDat; // length of above buffer - - byte * m_prgInitDat; // what was used to initialize this segment - int m_cbInitDat; - - int m_dichPreContext; // what part of this segment affects the previous; - // not really used for anything right now - -// Segment * m_psegPrev; // OBSOLETE -// Segment * m_psegNext; - - // Font information: -// std::wstring m_stuFaceName; -// std::wstring m_stuBaseFaceName; -// bool m_fUseSepBase; - -// float m_pixHeight; // character height of font in pixels (NOT = ascent + descent) -// bool m_fBold; -// bool m_fItalic; - - LineBrk m_lbStart; - LineBrk m_lbEnd; - - bool m_fStartLine; // redundant with layout? - bool m_fEndLine; // redundant with layout? - - SegEnd m_est; - - //Segment * m_psegAltEndLine; // segment having the alternate m_fEndLine value - - int m_mFontEmUnits; - float m_dysFontAscent; - float m_dysFontDescent; - float m_xysEmSquare; // em-square of the font in display units -// float m_xsDPI; // DPI of device on which segment was measured -// float m_ysDPI; - - float m_dxsStretch; // difference between actual and natural width - float m_dxsWidth; // width in absence of any stretch. -1 if not computed. - float m_dysHeight; - float m_dysAscent; // distance from common baseline to top of this segment, - // including extra ascent - - float m_dysXAscent; // extra for this renderer, beyond what is standard for the font - float m_dysXDescent; - - float m_dysAscentOverhang; // extra height above official top of segment; >= 0 - float m_dysDescentOverhang; // extra height below bottom of segment; <= 0; - float m_dxsLeftOverhang; // <= 0 - float m_dxsRightOverhang; - - float m_dxsVisibleWidth; // not including trailing white space - float m_dxsTotalWidth; // including trailing white space - - int m_isloutVisLim; // lim of visible stuff (to handle trailing ws underlines) - - float m_dysOffset; - - // Index of the first item in the before/after arrays and the ligature/component arrays, - // relative to the start of the segment. Normally == 0, but will be some negative number - // if there are slots "borrowed" from the previous segment (officially located in the - // previous segment but rendered in this one). - int m_ichwAssocsMin; - - // 1 + index of last item in the before/after arrays and the ligature/component arrays, - // relative to the start of the segment. Normally == m_dichwLim, but will be - // larger if there are slots "borrowed" from the following segment. - int m_ichwAssocsLim; - - // Underlying-to-surface associations: - int * m_prgisloutBefore; // logical first - int * m_prgisloutAfter; // logical last - std::vector ** m_prgpvisloutAssocs; // all; used by range selections - - int * m_prgisloutLigature; // similar to above, index of associated ligature, or kNegInfinity - - sdata8 * m_prgiComponent; // component of the ligature that the corresponding character - // represents; only meaningful if corresponding item in - // m_prgisloutLigature is set - -// GrSlotStream * m_psstrm; // TODO: rework to remove this - int m_cslout; - GrSlotOutput * m_prgslout; // final output slots - u_intslot * m_prgnSlotVarLenBuf; // var-length buffer for slots--one big buffer managed by the - // segment, but pointed to by the slots - -// int m_cnUserDefn; // this information is not stored in the segment itself - int m_cnCompPerLig; -// int m_cnFeat; // this information is not stored in the segment itself - - int m_cginf; - int m_isloutGinf0; // islout index for m_prgginf[0]; - GlyphInfo * m_prgginf; - - // Data structures to hold glyphs for rendering: -////#include "GrSegmentPlatform.h" - - // For initializing the following segment: - int m_cslotRestartBackup; // the number of slots in the underlying - // input that need to be reprocessed when starting - // the next segment - - std::vector m_vnSkipOffsets; // skip offset for each pass when restarting - - DirCode m_dircPrevStrong; // previous strong directionality code - DirCode m_dircPrevTerm; // previous terminator code, if any - - - // Other protected methods: - - void InitLineContextSegment(bool fStartLine, bool fEndLine); - void InitWhiteSpaceSegment(int nNewDepth); - - void ComputeDimensions(); - - void SetUpGlyphInfo(GrTableManager * ptman, GrSlotStream * psstrmFinal, - gid16 chwLB, int nDirDepth, int islotMin, int cslot); - void SetUpLigInfo(GrTableManager * ptman, GlyphInfo & ginf, GrSlotOutput * pslout); - - void InitBeforeArrayFromPrevSeg(); // obsolete - void AdjustBeforeArrayFromPrevSeg(); - void AdjustAfterArrayFromNextSeg(); - void EnsureSpaceAtLineBoundaries(int ichwUnder); - - int LogicalSurfaceToUnderlying(int islout, - float xsOffset, float ysOffset, - float dxsGlyphWidth = 0, float dysGlyphHeight = 0, bool * pfAfter = NULL); - int LogicalSurfaceToUnderlying(int islout, bool fBefore); - int PhysicalSurfaceToUnderlying(int iginf, - float xsOffset, float xyOffset, - float dxsGlyphWidth = 0, float dysGlyphHeight = 0, bool * pfAfter = NULL); - int PhysicalSurfaceToUnderlying(int iginf, bool fBefore); - int UnderlyingToLogicalSurface(int ichw, bool fBefore); - int UnderlyingToPhysicalSurface(int ichw, bool fBefore); - int LogicalToPhysicalSurface(int islout); - void UnderlyingToPhysicalAssocs(int ichw, std::vector & viginf); - std::vector UnderlyingToLogicalAssocs(int ichw); - int UnderlyingToLogicalInThisSeg(int ichw); - bool SameSurfaceGlyphs(int ichw1, int ichw2); - - void ShiftGlyphs(float dxsShift); - - float GlyphLeftEdge(int iginf); - - int DirLevelOfChar(int ichw, bool fBefore); - int CharIsRightToLeft(int ichw, bool fBefore); - int SlotIsRightToLeft(GrSlotOutput * pslout); - int TopDirLevel() - { - if (m_fWsRtl) - return 1; - else - return 0; - } - - void AssertValidClusters(GrSlotStream * psstrm); - - void MergeUniscribeCluster( - std::vector & visloutBefore, std::vector & visloutAfter, - int ich1, int ich2); - - int GlyphHit(float xsClick, float ysClick); - int SelectBb(std::vector & viginf, bool fRTL); - - int RightMostGlyph(); - int LeftMostGlyph(); - - void ComputeOverhangs(float * pdysVisAscent, float * pdysNegVisDescent, - float * pdxsVisLeft, float * pdxsVisRight); - -public: - LineBrk getBreakWeight(int ich, bool fBreakBefore = false); - - // Platform-specific routines: -protected: - //void ShiftGlyphsPlatform(float dxsShift); - //bool SetDirectionDepthPlatform(int nNewDepth); - - //void InitializePlatform(); - //void DestroyContentsPlatform(); - //GrResult GetGlyphsAndPositionsPlatform(float xs, float ys, - // Rect rsArg, Rect rdArg, - // utf16 * prgchGlyphs, float * prgxd, float * prgyd, float * prgdxdAdv); - //void SetUpOutputArraysPlatform(GrTableManager * ptman, gid16 chwLB, int nDirDepth, - // int islotMin, int cslot); - - // Temporary - for WinSegmentPainter -public: - int CSlout() - { - return m_cslout; - } - gid16 LBGlyphID(); - float AscentOffset() - { - if (m_dysAscent == -1) - ComputeDimensions(); - return m_dysAscent - m_dysFontAscent; - } -}; - - -//:>******************************************************************************************** -//:> The purpose of these subclasses is simply to provide meaningful names for the -//:> constructors. Instances of these classes are in every way equivalent to Segment. -//:>******************************************************************************************** - -/*---------------------------------------------------------------------------------------------- - Creating a LineFillSegment fits as much of the text on the line as possible, - finding a reasonable break point if necessary. -----------------------------------------------------------------------------------------------*/ -class LineFillSegment : public Segment -{ -public: - LineFillSegment( - Font * pfont, - ITextSource * pts, - LayoutEnvironment * playout, - toffset ichStart, - toffset ichStop, - float maxWidth, - bool fBacktracking = false); -protected: - // Default constructor: - LineFillSegment() : Segment() - { - } -}; - -/*---------------------------------------------------------------------------------------------- - Creating a RangeSegment makes a segment representing the given range of characters, or - the entire text-source. -----------------------------------------------------------------------------------------------*/ -class RangeSegment : public Segment -{ -public: - RangeSegment( - Font * pfont, - ITextSource * pts, - LayoutEnvironment * playout, - toffset ichStart = 0, - toffset ichStop = kPosInfinity, - Segment * psegInitLike = NULL); -}; - -/*---------------------------------------------------------------------------------------------- - The JustSegmentAux class is used by the factory method that creates a justified segment. - It is called JustSegmentAux to avoid conflicting with the factory method. -----------------------------------------------------------------------------------------------*/ -class JustSegmentAux : public Segment -{ -public: - JustSegmentAux( - Font * pfont, - ITextSource * pts, - LayoutEnvironment * playout, - toffset ichStart, - toffset ichStop, - float xsNaturalWidth, - float xsJustifiedWidth, - Segment * psegInitLike = NULL); -}; - -} // namespace gr - -#if defined(GR_NO_NAMESPACE) -using namespace gr; -#endif - -#endif // !GR_SEGMENT_INCLUDED diff --git a/Build/source/libs/graphite/engine-2.3.1/include/graphite/SegmentAux.h b/Build/source/libs/graphite/engine-2.3.1/include/graphite/SegmentAux.h deleted file mode 100644 index 293ba291436..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/include/graphite/SegmentAux.h +++ /dev/null @@ -1,392 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 2005 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: SegmentAux.h -Responsibility: Sharon Correll -Last reviewed: Not yet. - -Description: - Auxiliary classes for the Segment class: - - GlyphInfo - - GlyphIterator - - LayoutEnvironment -----------------------------------------------------------------------------------------------*/ -#ifdef _MSC_VER -#pragma once -#endif -#ifndef SEGMENTAUX_INCLUDED -#define SEGMENTAUX_INCLUDED - -//:End Ignore - -namespace gr -{ - -class Segment; -class GrSlotOutput; -class IGrJustifier; -class GlyphInfo; -class GlyphIterator; -class GlyphSetIterator; - - -/*---------------------------------------------------------------------------------------------- - The GlyphInfo class provides access to details about a single glyph within a segment. -----------------------------------------------------------------------------------------------*/ -class GlyphInfo // hungarian: ginf -{ - friend class Segment; - -public: - // Default constructor: - GlyphInfo() - { - m_pseg = NULL; - m_pslout = NULL; - m_islout = kInvalid; - } - - gid16 glyphID(); - gid16 pseudoGlyphID(); - - // Index of this glyph in the logical sequence; zero-based. - size_t logicalIndex(); - - // glyph's position relative to the left of the segment - float origin(); - float advanceWidth(); // logical units - float advanceHeight(); // logical units; zero for horizontal fonts - float yOffset(); - gr::Rect bb(); // logical units - bool isSpace(); - - // first char associated with this glyph, relative to start of seg - toffset firstChar(); - // last char associated with this glyph, relative to start of seg - toffset lastChar(); - - // Unicode bidi value - unsigned int directionality(); - // Embedding depth - unsigned int directionLevel(); - bool insertBefore(); - int breakweight(); - - bool isAttached() const throw(); - gr::GlyphIterator attachedClusterBase() const throw(); - float attachedClusterAdvance() const throw(); - std::pair attachedClusterGlyphs() const; - - float maxStretch(size_t level); - float maxShrink(size_t level); - float stretchStep(size_t level); - byte justWeight(size_t level); - float justWidth(size_t level); - float measureStartOfLine(); - float measureEndOfLine(); - - size_t numberOfComponents(); - gr::Rect componentBox(size_t icomp); - toffset componentFirstChar(size_t icomp); - toffset componentLastChar(size_t icomp); - - bool erroneous(); - - const Segment & segment() const throw(); - Segment & segment() throw(); - -protected: - Segment * m_pseg; - GrSlotOutput * m_pslout; - int m_islout; // signed, so it can return kInvalid -}; - -inline Segment & GlyphInfo::segment() throw () { - return * m_pseg; -} - -inline const Segment & GlyphInfo::segment() const throw () { - return * m_pseg; -} - - -/*---------------------------------------------------------------------------------------------- - The GlyphIterator class allows the Graphite client to iterate over a contiguous - range of glyphs for the segment. -----------------------------------------------------------------------------------------------*/ -class GlyphIterator -: public std::iterator -{ - friend class GlyphInfo; - friend class Segment; - - // Pointers into the glyph info store - GlyphInfo * m_pginf; - -protected: - // Constructor - GlyphIterator(Segment & seg, size_t iginf); - -public: - // Default constructor. - GlyphIterator() throw (): m_pginf(0) {} - - explicit GlyphIterator(const GlyphSetIterator &); - - // Forward iterator requirements. - reference operator*() const { assert(m_pginf != 0); return *m_pginf; } - pointer operator->() const { return m_pginf; } - GlyphIterator & operator++() throw() { ++m_pginf; return *this; } - GlyphIterator operator++(int) throw() { GlyphIterator tmp = *this; operator++(); return tmp; } - - // Bidirectional iterator requirements - GlyphIterator & operator--() throw() { --m_pginf; return *this; } - GlyphIterator operator--(int) throw() { GlyphIterator tmp = *this; operator--(); return tmp; } - - // Random access iterator requirements - reference operator[](difference_type n) const { return m_pginf[n]; } - GlyphIterator & operator+=(difference_type n) throw() { m_pginf += n; return *this; } - GlyphIterator operator+(difference_type n) const throw() { GlyphIterator r = *this; return r += n; } - GlyphIterator & operator-=(difference_type n) throw() { m_pginf -= n; return *this; } - GlyphIterator operator-(difference_type n) const throw() { GlyphIterator r = *this; return r += -n; } - - // Relational operators. - // Forward iterator requirements - bool operator==(const GlyphIterator & rhs) const throw() { return m_pginf == rhs.m_pginf; } - bool operator!=(const GlyphIterator & rhs) const throw() { return !(*this == rhs); } - - // Random access iterator requirements - bool operator<(const GlyphIterator & rhs) const throw() { return m_pginf < rhs.m_pginf; } - bool operator>(const GlyphIterator & rhs) const throw() { return m_pginf > rhs.m_pginf; } - bool operator<=(const GlyphIterator & rhs) const throw() { return !(*this > rhs); } - bool operator>=(const GlyphIterator & rhs) const throw() { return !(*this < rhs); } - - difference_type operator-(const GlyphIterator & rhs) const throw() { return m_pginf - rhs.m_pginf; } -}; - -inline GlyphIterator operator+(const GlyphIterator::difference_type n, const GlyphIterator & rhs) -{ - return rhs + n; -} - - -/*---------------------------------------------------------------------------------------------- - This reference-counted vector is used as the basis of GlyphSetIterator. This is because - multiple iterators are based on the same vector, so it needs to hang around appropriately. -----------------------------------------------------------------------------------------------*/ -class RcVector -{ - friend class GlyphSetIterator; - -public: - RcVector(std::vector & vn) - { - m_vn = vn; - m_cref = 0; - } - -protected: - void IncRefCount() const - { - m_cref++; - } - void DecRefCount() const - { - m_cref--; - if (m_cref <= 0) - delete this; - } - - const std::vector & Vector() const { return m_vn; }; - - // member variables: - mutable int m_cref; - std::vector m_vn; -}; - -/*---------------------------------------------------------------------------------------------- - The GlyphSetIterator class allows the Graphite client to iterate over a non-contiguous - set of glyphs for the segment, this is almost always the set of glyphs for a character. -----------------------------------------------------------------------------------------------*/ -class GlyphSetIterator -: public std::iterator -{ - friend class GlyphInfo; - friend class Segment; - - // Segment containing the glyphs being iterated over. - const Segment * m_pseg; - - // Sometimes, in the case of character-to-glyph look-ups or attached - // children, we need to represent a non-contiguous list; in these cases - // we first map through a vector of output-slot objects into the actual - // glyph-info store. - std::vector::const_iterator m_vit; - - // Store a reliable copy of the vector we are iterating over: - const RcVector * m_qvislout; - -protected: - // Constructor that includes output-slot mapping list, used for non-contiguous lists: - GlyphSetIterator(Segment & seg, size_t islout, RcVector * qvislout) - : m_pseg(&seg), m_vit(qvislout->Vector().begin() + islout) - { - m_qvislout = qvislout; - m_qvislout->IncRefCount(); - } -public: - // Default constructor--no output-slot mapping: - GlyphSetIterator() throw() : m_pseg(0), m_vit(std::vector::const_iterator()) - { - m_qvislout = NULL; - } - - // Copy constructor: - GlyphSetIterator(const GlyphSetIterator & sit) throw() - { - m_pseg = sit.m_pseg; - m_vit = sit.m_vit; - m_qvislout = sit.m_qvislout; - if (m_qvislout) - m_qvislout->IncRefCount(); - } - // Assignment operator: - GlyphSetIterator & operator=(const GlyphSetIterator & sit) throw() - { - m_pseg = sit.m_pseg; - m_vit = sit.m_vit; - m_qvislout = sit.m_qvislout; - if (m_qvislout) - m_qvislout->IncRefCount(); - return *this; - } - // Destructor: - ~GlyphSetIterator() - { - if (m_qvislout) - m_qvislout->DecRefCount(); - } - - // Forward iterator requirements. - reference operator*() const; - pointer operator->() const { return &(operator*()); } - GlyphSetIterator & operator++() throw() { ++m_vit; return *this; } - GlyphSetIterator operator++(int) throw() { GlyphSetIterator tmp = *this; operator++(); return tmp; } - - // Bidirectional iterator requirements - GlyphSetIterator & operator--() throw() { --m_vit; return *this; } - GlyphSetIterator operator--(int) throw() { GlyphSetIterator tmp = *this; operator--(); return tmp; } - - // Random access iterator requirements - reference operator[](difference_type n) const { return *operator+(n); } - GlyphSetIterator & operator+=(difference_type n) throw() { m_vit += n; return *this; } - GlyphSetIterator operator+(difference_type n) const throw() { GlyphSetIterator r = *this; return r += n; } - GlyphSetIterator & operator-=(difference_type n) throw() { operator+=(-n); return *this; } - GlyphSetIterator operator-(difference_type n) const throw() { GlyphSetIterator r = *this; return r += -n; } - - // Relational operators. - // Forward iterator requirements - bool operator==(const GlyphSetIterator & rhs) const throw() { return m_vit == rhs.m_vit; } - bool operator!=(const GlyphSetIterator & rhs) const throw() { return !(*this == rhs); } - - // Random access iterator requirements - bool operator<(const GlyphSetIterator & rhs) const throw() { return m_vit < rhs.m_vit; } - bool operator>(const GlyphSetIterator & rhs) const throw() { return m_vit > rhs.m_vit; } - bool operator<=(const GlyphSetIterator & rhs) const throw() { return !(*this > rhs); } - bool operator>=(const GlyphSetIterator & rhs) const throw() { return !(*this < rhs); } - - difference_type operator-(const GlyphSetIterator & rhs) const throw() { return m_vit - rhs.m_vit; } -}; - -inline GlyphSetIterator operator+(const GlyphSetIterator::difference_type n, const GlyphSetIterator & rhs) -{ - return rhs + n; -} - - -/*---------------------------------------------------------------------------------------------- - The GlyphInfo class provides access to details about a single glyph within a segment. -----------------------------------------------------------------------------------------------*/ -class LayoutEnvironment -{ -public: - LayoutEnvironment() - { - // Defaults: - m_fStartOfLine = true; - m_fEndOfLine = true; - m_lbBest = klbWordBreak; - m_lbWorst = klbClipBreak; - m_fRightToLeft = false; - m_twsh = ktwshAll; - m_pstrmLog = NULL; - m_fDumbFallback = false; - m_psegPrev = NULL; - m_psegInit = NULL; - m_pjust = NULL; - } - LayoutEnvironment(LayoutEnvironment & layout) - { - m_fStartOfLine = layout.m_fStartOfLine; - m_fEndOfLine = layout.m_fEndOfLine; - m_lbBest = layout.m_lbBest; - m_lbWorst = layout.m_lbWorst; - m_fRightToLeft = layout.m_fRightToLeft; - m_twsh = layout.m_twsh; - m_pstrmLog = layout.m_pstrmLog; - m_fDumbFallback = layout.m_fDumbFallback; - m_psegPrev = layout.m_psegPrev; - m_psegInit = layout.m_psegInit; - m_pjust = layout.m_pjust; - } - - // Setters: - inline void setStartOfLine(bool f) { m_fStartOfLine = f; } - inline void setEndOfLine(bool f) { m_fEndOfLine = f; } - inline void setBestBreak(LineBrk lb) { m_lbBest = lb; } - inline void setWorstBreak(LineBrk lb) { m_lbWorst = lb; } - inline void setRightToLeft(bool f) { m_fRightToLeft = f; } - inline void setTrailingWs(TrWsHandling twsh) { m_twsh = twsh; } - inline void setLoggingStream(std::ostream * pstrm) { m_pstrmLog = pstrm; } - inline void setDumbFallback(bool f) { m_fDumbFallback = f; } - inline void setPrevSegment(Segment * pseg) { m_psegPrev = pseg; } - inline void setSegmentForInit(Segment * pseg) { m_psegInit = pseg; } - inline void setJustifier(IGrJustifier * pjust) { m_pjust = pjust; } - - // Getters: - inline bool startOfLine() { return m_fStartOfLine; } - inline bool endOfLine() { return m_fEndOfLine; } - inline LineBrk bestBreak() { return m_lbBest; } - inline LineBrk worstBreak() { return m_lbWorst; } - inline bool rightToLeft() { return m_fRightToLeft; } - inline TrWsHandling trailingWs() { return m_twsh; } - inline std::ostream * loggingStream() { return m_pstrmLog; } - inline bool dumbFallback() { return m_fDumbFallback; } - inline Segment * prevSegment() { return m_psegPrev; } - inline Segment * segmentForInit() { return m_psegInit; } - inline IGrJustifier * justifier() { return m_pjust; } - -protected: - bool m_fStartOfLine; - bool m_fEndOfLine; - LineBrk m_lbBest; - LineBrk m_lbWorst; - bool m_fRightToLeft; - TrWsHandling m_twsh; - std::ostream * m_pstrmLog; - bool m_fDumbFallback; - Segment * m_psegPrev; - Segment * m_psegInit; - IGrJustifier * m_pjust; -}; - -} // namespace gr - -#if defined(GR_NO_NAMESPACE) -using namespace gr; -#endif - -#endif // !SEGMENTAUX_INCLUDED diff --git a/Build/source/libs/graphite/engine-2.3.1/include/graphite/SegmentPainter.h b/Build/source/libs/graphite/engine-2.3.1/include/graphite/SegmentPainter.h deleted file mode 100644 index c1e0231bf08..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/include/graphite/SegmentPainter.h +++ /dev/null @@ -1,234 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 1999, 2001 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: SegmentPainter.h -Responsibility: Sharon Correll -Last reviewed: Not yet. - -Description: - Defines the class for a Graphite text segment. -----------------------------------------------------------------------------------------------*/ -#ifdef _MSC_VER -#pragma once -#endif -#ifndef GR_SEGPAINTER_INCLUDED -#define GR_SEGPAINTER_INCLUDED - -// undo automagic DrawTextA DrawTextW stuff -// #undef DrawText - -//:End Ignore - - -namespace gr -{ - -class Segment; - -/*---------------------------------------------------------------------------------------------- - A SegmentPainter handles the UI-related operations on for segment. - - This superclass does not know how to do any actual drawing, because it has no access - to a device. Subclasses are needed to handle drawing on the various platforms. In addition, - it is legitimate to make a subclass to override the behavior of a specific piece of - functionality. - - Hungarian: segp -----------------------------------------------------------------------------------------------*/ -class SegmentPainter -{ -public: - // Static methods - - // Constructors/destructors/etc. - SegmentPainter(Segment * pseg, float xOrigin = 0, float yOrigin = 0); - //SegmentPainter(Segment * pseg, float xOrigin, float yOrigin); - - virtual ~SegmentPainter(); - - virtual void setOrigin(float xsOrigin, float ysOrigin); - virtual void setPosition(float xdPosition, float ydPosition); - virtual void setScalingFactors(float xFactor, float yFactor); - - virtual void setBuggyDisplayFormat(int /*strategy*/, long /*textColor*/, long /*backColor*/, - long /*underlineColor*/) - { - // Currently not implemented to do anything useful. - } - - // The paint method must be implemented by a concrete subclass: - virtual void paint() = 0; - - virtual void drawInsertionPoint(int ichwIP, bool fAssocPrev, bool bOn, bool fForceSplit); - virtual void positionsOfIP(int ichwIP, bool fAssocPrev, bool fForceSplit, - Rect * prdPrimary, Rect * prdSecondary); - virtual bool drawSelectionRange(int ichwMin, int ichwLim, - float ydTop, float ydBottom, bool bOn); - virtual bool positionsOfRange(int ichwMin, int ichwLim, - float ydTop, float ydBottom, Rect * prsBounds); - virtual size_t getUnderlinePlacement(int ichwMin, int ichwLim, - bool fSkipSpace, - size_t crgMax, // number of ranges allowed - float * prgxdLefts, float * prgxdRights, float * prgydUnderline); - - virtual void pointToChar(Point zptdClickPosition, int * pichw, bool * pfAssocPrev); - virtual LgIpValidResult isValidInsertionPoint(int ichwIP); - virtual bool doBoundariesCoincide(bool fBoundaryEnd, bool fBoundaryRight); - virtual int arrowKeyPosition(int ichwIP, bool * pfAssocPrev, - bool fRight, bool * pfInThisSeg); - virtual int extendSelectionPosition( - int charIndex, bool assocPrevMatch, bool assocPrevNeeded, - int anchorIndex, bool movingRight, bool * inThisSeg); - - // For calculating underlines: - struct LineSeg { // hungarian: ls - float left; - float right; - }; - - static float ScaleX(float xs, Rect rs, Rect rd); - static float ScaleY(float ys, Rect rs, Rect rd); - - float ScaleXToDest(float xs) - { - float xd = ((xs + m_xsOrigin) * m_xFactor) + m_xdPosition; - return xd; - } - //int ScaleXToDest(int xs) - //{ - // int xd = (((xs + m_xsOriginInt) * m_xFactor64) >> 6) + m_xdPositionInt; - // return xd; // >> 6 means div by 64 - //} - float ScaleYToDest(float ys) - { - float yd = ((ys + m_ysOrigin) * m_yFactor) + m_ydPosition; - return yd; - } - - float ScaleXToSource(float xd) - { - float xs = ((xd - m_xdPosition) / m_xFactor) - m_xsOrigin; - return xs; - } - float ScaleYToSource(float yd) - { - float ys = ((yd - m_ydPosition) / m_yFactor) - m_ysOrigin; - return ys; - } - -protected: - // Member variables: - - Segment * m_pseg; - - // transformation factors: - float m_xsOrigin; - float m_ysOrigin; - float m_xdPosition; - float m_ydPosition; - float m_xFactor; // destination / source - float m_yFactor; // destination / source - - // optimizations for when we need integer arithmetic (converting between int and float is - // very slow) - DELETE these. - //int m_xsOriginInt; - //int m_xdPositionInt; - //int m_xFactor64; - - //gr::Rect m_rectSrc; - - // Other methods: - - void CalcOrDrawInsertionPoint( - int ich, bool fAssocPrev, bool bOn, bool fForceSplit, - Rect * prectPrimary, Rect * prectSecondary); - void InvertIBeam(float xs, float ysTop, float ysBottom, bool fAssocPrev, - Rect * prdRet); - void InvertSplitIP(float xs, float ysTop, float ysBottom, - bool fTop, bool fAssocRight, bool fSecondary, float ysMinSplitHt, - Rect * prdRet); - void CalcIP(int ichw, bool fBefore, - float * pxs, float * pysTop, float * pysBottom, bool * pfRtl); - bool CloseIPPositions( - float * pxsBefore, float ysBeforeTop, float ysBeforeBottom, - float * pxsAfter, float ysAfterTop, float ysAfterBottom); - bool AtEdgeOfCluster(GrSlotOutput * pslout, int islout, bool fBefore); - bool AtEdgeOfCluster(GrSlotOutput * psloutBase, int isloutBase, - GrSlotOutput * pslout, int islout, bool fBefore); - bool CanInsertIntoCluster(GrSlotOutput * pslout, int islout); - - void CalcPartialLigatures(bool * prgfAllSelected, - int ichwMinSeg, int ichwLimSeg, - int ichwMinSel, int ichwLimSel); - void CalcHighlightRect(int ichw, - std::vector & vrs, std::vector & vfEntireLineHt, - bool fJustComponent, bool * rgfHighlighted, bool fSkipTrSpace); - void CalcCompleteCluster(int islout, - std::vector & vrs, std::vector & vfEntireLineHt, bool * prgfHighlighted); - void AddRectWithoutOverlaps(std::vector & vrect, Rect rectToAdd); - bool AnyArea(Rect * prect); - bool AdjustRectsToNotOverlap(std::vector & vrect, int irect, Rect * prect2, - std::vector & vrectMoreToAdd); - void AssertNoOverlaps(std::vector & vrect); - - void AddLineSegWithoutOverlaps(std::vector & vls, LineSeg lsToAdd); - bool AnyLength(LineSeg * pls); - bool AdjustLineSegsToNotOverlap(std::vector & vls, int ils, LineSeg * pls2, - std::vector & vlsMoreToAdd); - void AssertNoOverlaps(std::vector & vls); - - GrResult ArrowKeyPositionAux(int * pichwIP, bool * pfAssocPrev, - bool fRight, bool fMovingIn, - bool fAssocPrevMatch, bool fAssocPrevNeeded, - bool * pfResult); - bool ArrowKeyPositionInternal(int * pichw, bool * pfAssocPrev, - bool fRight, bool fAssocPrevMatch, bool fAssocPrevNeeded, int * nNextOrPrevSeg); - bool AdjacentLigComponent(int * pichw, bool * pfAssocPrev, bool fRight, bool fMove); - - int PointToCharAux(float xsTry, float ysTry, - float * pxsGlyphOffset, float * pxsGlyphWidth); - - // Platform-specific routines: - - GrResult DrawSegmentPlatform(float xs, float ys); - - // Low-level routines--these must be implemented appropriate by subclasses: - - virtual void InvertRect(float /*xLeft*/, float /*yTop*/, float /*xRight*/, float /*yBottom*/) - { - GrAssert(false); // no device context - } - - //void SetFontProps(); - virtual void SetFontProps(unsigned long clrFore, unsigned long clrBack); - -}; - -/*---------------------------------------------------------------------------------------------- - This is a subclass of SegmentPainter for which the paint operation is unnecessary. -----------------------------------------------------------------------------------------------*/ -class SegmentNonPainter : public SegmentPainter -{ -public: - SegmentNonPainter(Segment * pseg) - : SegmentPainter(pseg) - { - } - - void paint() - { - GrAssert(false); - throw; - } -}; - -} // namespace gr - -#if defined(GR_NO_NAMESPACE) -using namespace gr; -#endif - -#endif // !GR_SEGPAINTER_INCLUDED diff --git a/Build/source/libs/graphite/engine-2.3.1/installed-top.pc.in b/Build/source/libs/graphite/engine-2.3.1/installed-top.pc.in deleted file mode 100644 index 7609afda4e4..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/installed-top.pc.in +++ /dev/null @@ -1,5 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ -version=@VERSION@ diff --git a/Build/source/libs/graphite/engine-2.3.1/license/LICENSING.txt b/Build/source/libs/graphite/engine-2.3.1/license/LICENSING.txt deleted file mode 100644 index 33a150a94d6..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/license/LICENSING.txt +++ /dev/null @@ -1,43 +0,0 @@ - Graphite 2.1 Licensing - - Copyright 1999-2006, SIL International - All rights reserved. - - This library is free software; you can redistribute it and/or modify - it under the terms of either: - - a) the Common Public License as published by the "Agreement - Steward" for that license (currently IBM); either version 0.5 - of the License, or (at your option) any later version, - - or - - b) the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2.1 of License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See either - the Common Public License or the GNU Lesser General Public License - for more details. - - You should have received a plain text copy of the Common Public License - Version 0.5 with this distribution in the file named "License_CPLv05.txt". - That text came from http://www.opensource.org/licenses/cpl.html. The - initial "Agreement Steward" for the CPL displays currently the license at - http://www-124.ibm.com/developerworks/oss/license-cpl.html. - - You should also have received a copy of the GNU Lesser General Public - License along with this library in the file named "License_LGPLv21.txt". - If not, write to the Free Software Foundation, Inc., 59 Temple Place, - Suite 330, Boston, MA 02111-1307, USA or visit their web page on the - internet at http://www.fsf.org/licenses/lgpl.html. - - The GNU General Public License to which the GNU Lesser General Public - License refers can be found at http://www.gnu.org/copyleft/gpl.html. - For convenient reference, a text version has been included with this - distribution in the file named "License_GPLv2.txt". All of the licenses - mentioned above can also be found at http://www.opensource.org/licenses/. - --------------------------------------------------------------------------- diff --git a/Build/source/libs/graphite/engine-2.3.1/license/License_CPLv05.txt b/Build/source/libs/graphite/engine-2.3.1/license/License_CPLv05.txt deleted file mode 100644 index 4cac5dfe069..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/license/License_CPLv05.txt +++ /dev/null @@ -1,86 +0,0 @@ -Common Public License Version 0.5 -THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS COMMON PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. - -1. DEFINITIONS - -"Contribution" means: - -a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and - -b) in the case of each subsequent Contributor: - -i) changes to the Program, and - -ii) additions to the Program; - -where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program. - -"Contributor" means any person or entity that distributes the Program. - -"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program. - -"Program" means the Contributions distributed in accordance with this Agreement. - -"Recipient" means anyone who receives the Program under this Agreement, including all Contributors. - -2. GRANT OF RIGHTS - -a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form. - -b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder. - -c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program. - -d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement. - -3. REQUIREMENTS - -A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that: - -a) it complies with the terms and conditions of this Agreement; and - -b) its license agreement: - -i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose; - -ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits; - -iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and - -iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange. - -When the Program is made available in source code form: - -a) it must be made available under this Agreement; and - -b) a copy of this Agreement must be included with each copy of the Program. - -Contributors may not remove or alter any copyright notices contained within the Program. - -Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution. - -4. COMMERCIAL DISTRIBUTION - -Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense. - -For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages. - -5. NO WARRANTY - -EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations. - -6. DISCLAIMER OF LIABILITY - -EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -7. GENERAL - -If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. - -If Recipient institutes patent litigation against a Contributor with respect to a patent applicable to software (including a cross-claim or counterclaim in a lawsuit), then any patent licenses granted by that Contributor to such Recipient under this Agreement shall terminate as of the date such litigation is filed. In addition, If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed. - -All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive. - -Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. IBM is the initial Agreement Steward. IBM may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved. - -This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation. diff --git a/Build/source/libs/graphite/engine-2.3.1/license/License_GPLv2.txt b/Build/source/libs/graphite/engine-2.3.1/license/License_GPLv2.txt deleted file mode 100644 index 1bcc46f53a6..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/license/License_GPLv2.txt +++ /dev/null @@ -1,342 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. - - diff --git a/Build/source/libs/graphite/engine-2.3.1/license/License_LGPLv21.txt b/Build/source/libs/graphite/engine-2.3.1/license/License_LGPLv21.txt deleted file mode 100644 index 807db791666..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/license/License_LGPLv21.txt +++ /dev/null @@ -1,506 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! - - - - diff --git a/Build/source/libs/graphite/engine-2.3.1/makefile.vc7 b/Build/source/libs/graphite/engine-2.3.1/makefile.vc7 deleted file mode 100644 index ae340b27b8f..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/makefile.vc7 +++ /dev/null @@ -1,814 +0,0 @@ - -TARGET=graphite - -CPP=cl.exe -CPPFLAGS=/nologo /W4 /GR /GX /I "./src/font" /I "./src/painter" /I "./src/segment" /I "./src/textsource" /I "./src/generic" /I "./include/graphite" /I "../wrappers/win32" /D "GR_NAMESPACE" /D "WIN32" /D "_WINDOWS" /D "_UNICODE" /D "UNICODE" /D "TRACING" /Fp"$(INTDIR)\graphite.pch" /YX /Fd"$(INTDIR)\\" /FD /c -# /Wp62 - -LINK=link.exe -LINK_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /dll /pdb:"$(OUTDIR)\\graphite.pdb" /machine:I386 /out:"$(OUTDIR)\\$(TARGET).dll" /implib:"$(OUTDIR)\\$(TARGET).lib" - -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\\$(TARGET).bsc" - -AR=lib -AR_FLAGS=/OUT:$@ - -!IF "$(MLIB)" == "MD" -MLIB=MD -!ELSE -MLIB=MT -!ENDIF - -OBJEXT = .obj -SBREXT = .sbr - -!IF "$(CFG)" == "DEBUG" -CPP_DEBUG=/D "DEBUG" /Gm /GR /ZI /Od /GZ /FR"$(INTDIR)\\" /$(MLIB)d -# CPP_DEBUG=/D "DEBUG" /Gm /GR /ZI /Od /GZ /FR"$(INTDIR)\\" /MDd - -OUTDIR=.\debug -INTDIR=.\debug_temp -LINK_DEBUG= MSVCRTD.lib /debug /incremental:yes #/pdbtype:sept - -all : lib lib_dll bsc - -!ELSE -CPP_DEBUG=/D "NDEBUG" /O2 /$(MLIB) -# CPP_DEBUG=/D "NDEBUG" /O2 /MD -OUTDIR=.\release -INTDIR=.\release_temp -LINK_DEBUG= MSVCRT.lib /incremental:no /NODEFAULTLIB:libc - -all : lib lib_dll - -!ENDIF - -!IF "$(TRACING)" == "1" -CPP_DEBUG=/D "TRACING" $(CPP_DEBUG) -!ENDIF - -!IF "$(OS)" == "Windows_NT" -NULL= -!ELSE -NULL=nul -!ENDIF - -clean : - @- rd /s/q .\release_temp - @- rd /s/q .\debug_temp - -realclean : clean - @- rd /s/q .\release - @- rd /s/q .\debug - -LINK_OBJS=\ -# "$(INTDIR)\BinTree_i$(OBJEXT)"\ -# "$(INTDIR)\HashMap_i$(OBJEXT)"\ - "$(INTDIR)\Debug$(OBJEXT)"\ - "$(INTDIR)\Util$(OBJEXT)"\ - "$(INTDIR)\Font$(OBJEXT)"\ - "$(INTDIR)\FileFont$(OBJEXT)"\ - "$(INTDIR)\FontCache$(OBJEXT)"\ - "$(INTDIR)\FontFace$(OBJEXT)"\ - "$(INTDIR)\FileInput$(OBJEXT)"\ - "$(INTDIR)\GrCharStream$(OBJEXT)"\ - "$(INTDIR)\GrClassTable$(OBJEXT)"\ - "$(INTDIR)\GrEngine$(OBJEXT)"\ - "$(INTDIR)\GrFeature$(OBJEXT)"\ - "$(INTDIR)\GrFSM$(OBJEXT)"\ - "$(INTDIR)\GrGlyphTable$(OBJEXT)"\ - "$(INTDIR)\GrPass$(OBJEXT)"\ - "$(INTDIR)\GrPassActionCode$(OBJEXT)"\ - "$(INTDIR)\GrSlotState$(OBJEXT)"\ - "$(INTDIR)\GrSlotStream$(OBJEXT)"\ - "$(INTDIR)\GrTableManager$(OBJEXT)"\ - "$(INTDIR)\MemoryUsage$(OBJEXT)"\ - "$(INTDIR)\Segment$(OBJEXT)"\ - "$(INTDIR)\SegmentAux$(OBJEXT)"\ - "$(INTDIR)\SegmentPainter$(OBJEXT)"\ -# "$(INTDIR)\TestFSM$(OBJEXT)"\ -# "$(INTDIR)\TestPasses$(OBJEXT)"\ - "$(INTDIR)\TransductionLog$(OBJEXT)"\ -### "$(INTDIR)\XmlTransductionLog$(OBJEXT)"\ - "$(INTDIR)\Platform$(OBJEXT)"\ - "$(INTDIR)\TtfUtil$(OBJEXT)"\ - "$(INTDIR)\WinFont$(OBJEXT)"\ - "$(INTDIR)\WinSegmentPainter$(OBJEXT)" - -LINK_DLL_OBJS=\ -# "$(INTDIR)\BinTree_i_dll$(OBJEXT)"\ -# "$(INTDIR)\HashMap_i_dll$(OBJEXT)"\ - "$(INTDIR)\Debug_dll$(OBJEXT)"\ - "$(INTDIR)\Util_dll$(OBJEXT)"\ - "$(INTDIR)\Font_dll$(OBJEXT)"\ - "$(INTDIR)\WinFont_dll$(OBJEXT)"\ - "$(INTDIR)\FileFont_dll$(OBJEXT)"\ - "$(INTDIR)\FontCache_dll$(OBJEXT)"\ - "$(INTDIR)\FontFace_dll$(OBJEXT)"\ - "$(INTDIR)\FileInput_dll$(OBJEXT)"\ - "$(INTDIR)\GrCharStream_dll$(OBJEXT)"\ - "$(INTDIR)\GrClassTable_dll$(OBJEXT)"\ - "$(INTDIR)\GrEngine_dll$(OBJEXT)"\ - "$(INTDIR)\GrFeature_dll$(OBJEXT)"\ - "$(INTDIR)\GrFSM_dll$(OBJEXT)"\ - "$(INTDIR)\GrGlyphTable_dll$(OBJEXT)"\ - "$(INTDIR)\GrPass_dll$(OBJEXT)"\ - "$(INTDIR)\GrPassActionCode_dll$(OBJEXT)"\ - "$(INTDIR)\GrSlotState_dll$(OBJEXT)"\ - "$(INTDIR)\GrSlotStream_dll$(OBJEXT)"\ - "$(INTDIR)\GrTableManager_dll$(OBJEXT)"\ - "$(INTDIR)\MemoryUsage_dll$(OBJEXT)"\ - "$(INTDIR)\Segment_dll$(OBJEXT)"\ - "$(INTDIR)\SegmentAux_dll$(OBJEXT)"\ - "$(INTDIR)\SegmentPainter_dll$(OBJEXT)"\ -# "$(INTDIR)\TestFSM_dll$(OBJEXT)"\ -# "$(INTDIR)\TestPasses_dll$(OBJEXT)"\ - "$(INTDIR)\TransductionLog_dll$(OBJEXT)"\ -### "$(INTDIR)\XmlTransductionLog_dll$(OBJEXT)"\ - "$(INTDIR)\WinSegmentPainter_dll$(OBJEXT)"\ - "$(INTDIR)\Platform_dll$(OBJEXT)"\ - "$(INTDIR)\TtfUtil_dll$(OBJEXT)" - -DLL_LINK_OBJS=\ - "$(INTDIR)\win32_dll_dll$(OBJEXT)" - -BSC32_SBRS=\ -# "$(INTDIR)\BinTree_i$(SBREXT)"\ -# "$(INTDIR)\HashMap_i$(SBREXT)"\ - "$(INTDIR)\Debug$(SBREXT)"\ - "$(INTDIR)\Util$(SBREXT)"\ - "$(INTDIR)\Font$(SBREXT)"\ - "$(INTDIR)\WinFont$(SBREXT)"\ - "$(INTDIR)\FileFont$(SBREXT)"\ - "$(INTDIR)\FontCache$(SBREXT)"\ - "$(INTDIR)\FontFace$(SBREXT)"\ - "$(INTDIR)\FileInput$(SBREXT)"\ - "$(INTDIR)\GrCharStream$(SBREXT)"\ - "$(INTDIR)\GrClassTable$(SBREXT)"\ - "$(INTDIR)\GrEngine$(SBREXT)"\ - "$(INTDIR)\GrFeature$(SBREXT)"\ - "$(INTDIR)\GrFSM$(SBREXT)"\ - "$(INTDIR)\GrGlyphTable$(SBREXT)"\ - "$(INTDIR)\GrPass$(SBREXT)"\ - "$(INTDIR)\GrPassActionCode$(SBREXT)"\ - "$(INTDIR)\GrSlotState$(SBREXT)"\ - "$(INTDIR)\GrSlotStream$(SBREXT)"\ - "$(INTDIR)\GrTableManager$(SBREXT)"\ - "$(INTDIR)\MemoryUsage$(SBREXT)"\ - "$(INTDIR)\Segment$(SBREXT)"\ - "$(INTDIR)\SegmentAux$(SBREXT)"\ - "$(INTDIR)\SegmentPainter$(SBREXT)"\ -# "$(INTDIR)\TestFSM$(SBREXT)"\ -# "$(INTDIR)\TestPasses$(SBREXT)"\ - "$(INTDIR)\TransductionLog$(SBREXT)"\ -### "$(INTDIR)\XmlTransductionLog$(SBREXT)"\ - "$(INTDIR)\WinSegmentPainter$(SBREXT)"\ - "$(INTDIR)\Platform$(SBREXT)"\ - "$(INTDIR)\TtfUtil$(SBREXT)"\ - "$(INTDIR)\win32_dll$(SBREXT)" - -$(OUTDIR) : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -$(INTDIR) : - if not exist "$(INTDIR)/$(NULL)" mkdir "$(INTDIR)" - -lib : "$(OUTDIR)/$(TARGET).lib" - -lib_dll : "$(OUTDIR)/$(TARGET)_dll.lib" - -"$(OUTDIR)/$(TARGET).lib" : "$(OUTDIR)" "$(INTDIR)" $(LINK_OBJS) - $(AR) @<< - $(AR_FLAGS) $(LINK_OBJS) -<< - -"$(OUTDIR)/$(TARGET)_dll.lib" : "$(OUTDIR)" "$(INTDIR)" $(LINK_DLL_OBJS) - $(AR) @<< - $(AR_FLAGS) $(LINK_DLL_OBJS) -<< - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\BinTree_i$(OBJEXT)" "$(INTDIR)\BinTree_i$(SBREXT)" : "src/generic/BinTree_i.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\BinTree_i$(OBJEXT)" $? - -"$(INTDIR)\BinTree_i_dll$(OBJEXT)" "$(INTDIR)\BinTree_i_dll$(SBREXT)" : "src/generic/BinTree_i.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\BinTree_i_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\BinTree_i$(OBJEXT)" : "src/generic/BinTree_i.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\BinTree_i$(OBJEXT)" $? - -"$(INTDIR)\BinTree_i_dll$(OBJEXT)" : "src/generic/BinTree_i.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /D "_DLL" /Fo"$(INTDIR)\BinTree_i_dll$(OBJEXT)" $? - -!ENDIF - - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\Debug$(OBJEXT)" "$(INTDIR)\Debug$(SBREXT)" : "src/generic/Debug.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\Debug$(OBJEXT)" $? - -"$(INTDIR)\Debug_dll$(OBJEXT)" "$(INTDIR)\Debug_dll$(SBREXT)" : "src/generic/Debug.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\Debug_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\Debug$(OBJEXT)" : "src/generic/Debug.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\Debug$(OBJEXT)" $? - -"$(INTDIR)\Debug_dll$(OBJEXT)" : "src/generic/Debug.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\Debug_dll$(OBJEXT)" $? - -!ENDIF - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\HashMap$(OBJEXT)" "$(INTDIR)\HashMap$(SBREXT)" : "src/generic/HashMap.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\HashMap$(OBJEXT)" $? - -"$(INTDIR)\HashMap_dll$(OBJEXT)" "$(INTDIR)\HashMap_dll$(SBREXT)" : "src/generic/HashMap.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\HashMap_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\HashMap$(OBJEXT)" : "src/generic/HashMap.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\HashMap$(OBJEXT)" $? - -"$(INTDIR)\HashMap_dll$(OBJEXT)" : "src/generic/HashMap.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\HashMap_dll$(OBJEXT)" $? - -!ENDIF - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\HashMap_i$(OBJEXT)" "$(INTDIR)\HashMap_i$(SBREXT)" : "src/generic/HashMap_i.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\HashMap_i$(OBJEXT)" $? - -"$(INTDIR)\HashMap_i_dll$(OBJEXT)" "$(INTDIR)\HashMap_i_dll$(SBREXT)" : "src/generic/HashMap_i.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\HashMap_i_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\HashMap_i$(OBJEXT)" : "src/generic/HashMap_i.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\HashMap_i$(OBJEXT)" $? - -"$(INTDIR)\HashMap_i_dll$(OBJEXT)" : "src/generic/HashMap_i.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\HashMap_i_dll$(OBJEXT)" $? - -!ENDIF - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\Set_i$(OBJEXT)" "$(INTDIR)\Set_i$(SBREXT)" : "src/generic/Set_i.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\Set_i$(OBJEXT)" $? - -"$(INTDIR)\Set_i_dll$(OBJEXT)" "$(INTDIR)\Set_i_dll$(SBREXT)" : "src/generic/Set_i.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\Set_i_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\Set_i$(OBJEXT)" : "src/generic/Set_i.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\Set_i$(OBJEXT)" $? - -"$(INTDIR)\Set_i_dll$(OBJEXT)" : "src/generic/Set_i.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\Set_i_dll$(OBJEXT)" $? - -!ENDIF - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\Util$(OBJEXT)" "$(INTDIR)\Util$(SBREXT)" : "src/generic/Util.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\Util$(OBJEXT)" $? - -"$(INTDIR)\Util_dll$(OBJEXT)" "$(INTDIR)\Util_dll$(SBREXT)" : "src/generic/Util.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\Util_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\Util$(OBJEXT)" : "src/generic/Util.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\Util$(OBJEXT)" $? - -"$(INTDIR)\Util_dll$(OBJEXT)" : "src/generic/Util.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\Util_dll$(OBJEXT)" $? - -!ENDIF - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\UtilString$(OBJEXT)" "$(INTDIR)\UtilString$(SBREXT)" : "src/generic/UtilString.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\UtilString$(OBJEXT)" $? - -"$(INTDIR)\UtilString_dll$(OBJEXT)" "$(INTDIR)\UtilString_dll$(SBREXT)" : "src/generic/UtilString.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\UtilString_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\UtilString$(OBJEXT)" : "src/generic/UtilString.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\UtilString$(OBJEXT)" $? - -"$(INTDIR)\UtilString_dll$(OBJEXT)" : "src/generic/UtilString.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\UtilString_dll$(OBJEXT)" $? - -!ENDIF - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\Vector_i$(OBJEXT)" "$(INTDIR)\Vector_i$(SBREXT)" : "src/generic/Vector_i.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\Vector_i$(OBJEXT)" $? - -"$(INTDIR)\Vector_i_dll$(OBJEXT)" "$(INTDIR)\Vector_i_dll$(SBREXT)" : "src/generic/Vector_i.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\Vector_i_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\Vector_i$(OBJEXT)" : "src/generic/Vector_i.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\Vector_i$(OBJEXT)" $? - -"$(INTDIR)\Vector_i_dll$(OBJEXT)" : "src/generic/Vector_i.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\Vector_i_dll$(OBJEXT)" $? - -!ENDIF - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\Font$(OBJEXT)" "$(INTDIR)\Font$(SBREXT)" : "src/font/Font.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\Font$(OBJEXT)" $? - -"$(INTDIR)\Font_dll$(OBJEXT)" "$(INTDIR)\Font_dll$(SBREXT)" : "src/font/Font.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\Font_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\Font$(OBJEXT)" : "src/font/Font.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\Font$(OBJEXT)" $? - -"$(INTDIR)\Font_dll$(OBJEXT)" : "src/font/Font.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\Font_dll$(OBJEXT)" $? - -!ENDIF - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\GrUtil$(OBJEXT)" "$(INTDIR)\GrUtil$(SBREXT)" : "src/font/GrUtil.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrUtil$(OBJEXT)" $? - -"$(INTDIR)\GrUtil_dll$(OBJEXT)" "$(INTDIR)\GrUtil_dll$(SBREXT)" : "src/font/GrUtil.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\GrUtil_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\GrUtil$(OBJEXT)" : "src/font/GrUtil.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrUtil$(OBJEXT)" $? - -"$(INTDIR)\GrUtil_dll$(OBJEXT)" : "src/font/GrUtil.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\GrUtil_dll$(OBJEXT)" $? - -!ENDIF - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\TtfUtil$(OBJEXT)" "$(INTDIR)\TtfUtil$(SBREXT)" : "src/font/TtfUtil.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\TtfUtil$(OBJEXT)" $? - -"$(INTDIR)\TtfUtil_dll$(OBJEXT)" "$(INTDIR)\TtfUtil_dll$(SBREXT)" : "src/font/TtfUtil.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\TtfUtil_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\TtfUtil$(OBJEXT)" : "src/font/TtfUtil.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\TtfUtil$(OBJEXT)" $? - -"$(INTDIR)\TtfUtil_dll$(OBJEXT)" : "src/font/TtfUtil.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\TtfUtil_dll$(OBJEXT)" $? - -!ENDIF - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\FontCache$(OBJEXT)" "$(INTDIR)\FontCache$(SBREXT)" : "src/segment/FontCache.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\FontCache$(OBJEXT)" $? - -"$(INTDIR)\FontCache_dll$(OBJEXT)" "$(INTDIR)\FontCache_dll$(SBREXT)" : "src/segment/FontCache.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\FontCache_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\FontCache$(OBJEXT)" : "src/segment/FontCache.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\FontCache$(OBJEXT)" $? - -"$(INTDIR)\FontCache_dll$(OBJEXT)" : "src/segment/FontCache.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\FontCache_dll$(OBJEXT)" $? - -!ENDIF - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\FontFace$(OBJEXT)" "$(INTDIR)\FontFace$(SBREXT)" : "src/segment/FontFace.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\FontFace$(OBJEXT)" $? - -"$(INTDIR)\FontFace_dll$(OBJEXT)" "$(INTDIR)\FontFace_dll$(SBREXT)" : "src/segment/FontFace.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\FontFace_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\FontFace$(OBJEXT)" : "src/segment/FontFace.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\FontFace$(OBJEXT)" $? - -"$(INTDIR)\FontFace_dll$(OBJEXT)" : "src/segment/FontFace.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\FontFace_dll$(OBJEXT)" $? - -!ENDIF - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\FileInput$(OBJEXT)" "$(INTDIR)\FileInput$(SBREXT)" : "src/segment/FileInput.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\FileInput$(OBJEXT)" $? - -"$(INTDIR)\FileInput_dll$(OBJEXT)" "$(INTDIR)\FileInput_dll$(SBREXT)" : "src/segment/FileInput.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\FileInput_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\FileInput$(OBJEXT)" : "src/segment/FileInput.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\FileInput$(OBJEXT)" $? - -"$(INTDIR)\FileInput_dll$(OBJEXT)" : "src/segment/FileInput.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\FileInput_dll$(OBJEXT)" $? - -!ENDIF - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\GrCharStream$(OBJEXT)" "$(INTDIR)\GrCharStream$(SBREXT)" : "src/segment/GrCharStream.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrCharStream$(OBJEXT)" $? - -"$(INTDIR)\GrCharStream_dll$(OBJEXT)" "$(INTDIR)\GrCharStream_dll$(SBREXT)" : "src/segment/GrCharStream.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\GrCharStream_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\GrCharStream$(OBJEXT)" : "src/segment/GrCharStream.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrCharStream$(OBJEXT)" $? - -"$(INTDIR)\GrCharStream_dll$(OBJEXT)" : "src/segment/GrCharStream.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\GrCharStream_dll$(OBJEXT)" $? - -!ENDIF - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\GrClassTable$(OBJEXT)" "$(INTDIR)\GrClassTable$(SBREXT)" : "src/segment/GrClassTable.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrClassTable$(OBJEXT)" $? - -"$(INTDIR)\GrClassTable_dll$(OBJEXT)" "$(INTDIR)\GrClassTable_dll$(SBREXT)" : "src/segment/GrClassTable.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\GrClassTable_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\GrClassTable$(OBJEXT)" : "src/segment/GrClassTable.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrClassTable$(OBJEXT)" $? - -"$(INTDIR)\GrClassTable_dll$(OBJEXT)" : "src/segment/GrClassTable.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\GrClassTable_dll$(OBJEXT)" $? - -!ENDIF - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\GrEngine$(OBJEXT)" "$(INTDIR)\GrEngine$(SBREXT)" : "src/segment/GrEngine.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrEngine$(OBJEXT)" $? - -"$(INTDIR)\GrEngine_dll$(OBJEXT)" "$(INTDIR)\GrEngine_dll$(SBREXT)" : "src/segment/GrEngine.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\GrEngine_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\GrEngine$(OBJEXT)" : "src/segment/GrEngine.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrEngine$(OBJEXT)" $? - -"$(INTDIR)\GrEngine_dll$(OBJEXT)" : "src/segment/GrEngine.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\GrEngine_dll$(OBJEXT)" $? - -!ENDIF - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\GrFeature$(OBJEXT)" "$(INTDIR)\GrFeature$(SBREXT)" : "src/segment/GrFeature.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrFeature$(OBJEXT)" $? - -"$(INTDIR)\GrFeature_dll$(OBJEXT)" "$(INTDIR)\GrFeature_dll$(SBREXT)" : "src/segment/GrFeature.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\GrFeature_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\GrFeature$(OBJEXT)" : "src/segment/GrFeature.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrFeature$(OBJEXT)" $? - -"$(INTDIR)\GrFeature_dll$(OBJEXT)" : "src/segment/GrFeature.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\GrFeature_dll$(OBJEXT)" $? - -!ENDIF - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\GrFSM$(OBJEXT)" "$(INTDIR)\GrFSM$(SBREXT)" : "src/segment/GrFSM.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrFSM$(OBJEXT)" $? - -"$(INTDIR)\GrFSM_dll$(OBJEXT)" "$(INTDIR)\GrFSM_dll$(SBREXT)" : "src/segment/GrFSM.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\GrFSM_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\GrFSM$(OBJEXT)" : "src/segment/GrFSM.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrFSM$(OBJEXT)" $? - -"$(INTDIR)\GrFSM_dll$(OBJEXT)" : "src/segment/GrFSM.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\GrFSM_dll$(OBJEXT)" $? - -!ENDIF - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\GrGlyphTable$(OBJEXT)" "$(INTDIR)\GrGlyphTable$(SBREXT)" : "src/segment/GrGlyphTable.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrGlyphTable$(OBJEXT)" $? - -"$(INTDIR)\GrGlyphTable_dll$(OBJEXT)" "$(INTDIR)\GrGlyphTable_dll$(SBREXT)" : "src/segment/GrGlyphTable.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\GrGlyphTable_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\GrGlyphTable$(OBJEXT)" : "src/segment/GrGlyphTable.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrGlyphTable$(OBJEXT)" $? - -"$(INTDIR)\GrGlyphTable_dll$(OBJEXT)" : "src/segment/GrGlyphTable.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\GrGlyphTable_dll$(OBJEXT)" $? - -!ENDIF - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\GrPass$(OBJEXT)" "$(INTDIR)\GrPass$(SBREXT)" : "src/segment/GrPass.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrPass$(OBJEXT)" $? - -"$(INTDIR)\GrPass_dll$(OBJEXT)" "$(INTDIR)\GrPass_dll$(SBREXT)" : "src/segment/GrPass.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\GrPass_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\GrPass$(OBJEXT)" : "src/segment/GrPass.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrPass$(OBJEXT)" $? - -"$(INTDIR)\GrPass_dll$(OBJEXT)" : "src/segment/GrPass.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\GrPass_dll$(OBJEXT)" $? - -!ENDIF - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\GrPassActionCode$(OBJEXT)" "$(INTDIR)\GrPassActionCode$(SBREXT)" : "src/segment/GrPassActionCode.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrPassActionCode$(OBJEXT)" $? - -"$(INTDIR)\GrPassActionCode_dll$(OBJEXT)" "$(INTDIR)\GrPassActionCode_dll$(SBREXT)" : "src/segment/GrPassActionCode.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\GrPassActionCode_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\GrPassActionCode$(OBJEXT)" : "src/segment/GrPassActionCode.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrPassActionCode$(OBJEXT)" $? - -"$(INTDIR)\GrPassActionCode_dll$(OBJEXT)" : "src/segment/GrPassActionCode.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\GrPassActionCode_dll$(OBJEXT)" $? - -!ENDIF - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\GrSlotState$(OBJEXT)" "$(INTDIR)\GrSlotState$(SBREXT)" : "src/segment/GrSlotState.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrSlotState$(OBJEXT)" $? - -"$(INTDIR)\GrSlotState_dll$(OBJEXT)" "$(INTDIR)\GrSlotState_dll$(SBREXT)" : "src/segment/GrSlotState.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\GrSlotState_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\GrSlotState$(OBJEXT)" : "src/segment/GrSlotState.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrSlotState$(OBJEXT)" $? - -"$(INTDIR)\GrSlotState_dll$(OBJEXT)" : "src/segment/GrSlotState.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\GrSlotState_dll$(OBJEXT)" $? - -!ENDIF - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\GrSlotStream$(OBJEXT)" "$(INTDIR)\GrSlotStream$(SBREXT)" : "src/segment/GrSlotStream.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrSlotStream$(OBJEXT)" $? - -"$(INTDIR)\GrSlotStream_dll$(OBJEXT)" "$(INTDIR)\GrSlotStream_dll$(SBREXT)" : "src/segment/GrSlotStream.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\GrSlotStream_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\GrSlotStream$(OBJEXT)" : "src/segment/GrSlotStream.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrSlotStream$(OBJEXT)" $? - -"$(INTDIR)\GrSlotStream_dll$(OBJEXT)" : "src/segment/GrSlotStream.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\GrSlotStream_dll$(OBJEXT)" $? - -!ENDIF - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\GrTableManager$(OBJEXT)" "$(INTDIR)\GrTableManager$(SBREXT)" : "src/segment/GrTableManager.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrTableManager$(OBJEXT)" $? - -"$(INTDIR)\GrTableManager_dll$(OBJEXT)" "$(INTDIR)\GrTableManager_dll$(SBREXT)" : "src/segment/GrTableManager.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\GrTableManager_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\GrTableManager$(OBJEXT)" : "src/segment/GrTableManager.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrTableManager$(OBJEXT)" $? - -"$(INTDIR)\GrTableManager_dll$(OBJEXT)" : "src/segment/GrTableManager.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\GrTableManager_dll$(OBJEXT)" $? - -!ENDIF - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\MemoryUsage$(OBJEXT)" "$(INTDIR)\MemoryUsage$(SBREXT)" : "src/segment/MemoryUsage.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\MemoryUsage$(OBJEXT)" $? - -"$(INTDIR)\MemoryUsage_dll$(OBJEXT)" "$(INTDIR)\MemoryUsage_dll$(SBREXT)" : "src/segment/MemoryUsage.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\MemoryUsage_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\MemoryUsage$(OBJEXT)" : "src/segment/MemoryUsage.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\MemoryUsage$(OBJEXT)" $? - -"$(INTDIR)\MemoryUsage_dll$(OBJEXT)" : "src/segment/MemoryUsage.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\MemoryUsage_dll$(OBJEXT)" $? - -!ENDIF - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\Segment$(OBJEXT)" "$(INTDIR)\Segment$(SBREXT)" : "src/segment/Segment.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\Segment$(OBJEXT)" $? - -"$(INTDIR)\Segment_dll$(OBJEXT)" "$(INTDIR)\Segment_dll$(SBREXT)" : "src/segment/Segment.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\Segment_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\Segment$(OBJEXT)" : "src/segment/Segment.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\Segment$(OBJEXT)" $? - -"$(INTDIR)\Segment_dll$(OBJEXT)" : "src/segment/Segment.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\Segment_dll$(OBJEXT)" $? - -!ENDIF - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\SegmentAux$(OBJEXT)" "$(INTDIR)\SegmentAux$(SBREXT)" : "src/segment/SegmentAux.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\SegmentAux$(OBJEXT)" $? - -"$(INTDIR)\SegmentAux_dll$(OBJEXT)" "$(INTDIR)\SegmentAux_dll$(SBREXT)" : "src/segment/SegmentAux.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\SegmentAux_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\SegmentAux$(OBJEXT)" : "src/segment/SegmentAux.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\SegmentAux$(OBJEXT)" $? - -"$(INTDIR)\SegmentAux_dll$(OBJEXT)" : "src/segment/SegmentAux.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\SegmentAux_dll$(OBJEXT)" $? - -!ENDIF - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\TestFSM$(OBJEXT)" "$(INTDIR)\TestFSM$(SBREXT)" : "src/segment/TestFSM.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\TestFSM$(OBJEXT)" $? - -"$(INTDIR)\TestFSM_dll$(OBJEXT)" "$(INTDIR)\TestFSM_dll$(SBREXT)" : "src/segment/TestFSM.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\TestFSM_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\TestFSM$(OBJEXT)" : "src/segment/TestFSM.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\TestFSM$(OBJEXT)" $? - -"$(INTDIR)\TestFSM_dll$(OBJEXT)" : "src/segment/TestFSM.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\TestFSM_dll$(OBJEXT)" $? - -!ENDIF - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\TestPasses$(OBJEXT)" "$(INTDIR)\TestPasses$(SBREXT)" : "src/segment/TestPasses.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\TestPasses$(OBJEXT)" $? - -"$(INTDIR)\TestPasses_dll$(OBJEXT)" "$(INTDIR)\TestPasses_dll$(SBREXT)" : "src/segment/TestPasses.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\TestPasses_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\TestPasses$(OBJEXT)" : "src/segment/TestPasses.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\TestPasses$(OBJEXT)" $? - -"$(INTDIR)\TestPasses_dll$(OBJEXT)" : "src/segment/TestPasses.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\TestPasses_dll$(OBJEXT)" $? - -!ENDIF - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\TransductionLog$(OBJEXT)" "$(INTDIR)\TransductionLog$(SBREXT)" : "src/segment/TransductionLog.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\TransductionLog$(OBJEXT)" $? - -"$(INTDIR)\TransductionLog_dll$(OBJEXT)" "$(INTDIR)\TransductionLog_dll$(SBREXT)" : "src/segment/TransductionLog.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\TransductionLog_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\TransductionLog$(OBJEXT)" : "src/segment/TransductionLog.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\TransductionLog$(OBJEXT)" $? - -"$(INTDIR)\TransductionLog_dll$(OBJEXT)" : "src/segment/TransductionLog.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\TransductionLog_dll$(OBJEXT)" $? - -!ENDIF - -#!IF "$(CFG)" == "DEBUG" -#"$(INTDIR)\XmlTransductionLog$(OBJEXT)" "$(INTDIR)\XmlTransductionLog$(SBREXT)" : "src/segment/XmlTransductionLog.cpp" -# @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\XmlTransductionLog$(OBJEXT)" $? -# -#"$(INTDIR)\XmlTransductionLog_dll$(OBJEXT)" "$(INTDIR)\XmlTransductionLog_dll$(SBREXT)" : "src/segment/XmlTransductionLog.cpp" -# @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\XmlTransductionLog_dll$(OBJEXT)" $? -# -#!ELSE -#"$(INTDIR)\XmlTransductionLog$(OBJEXT)" : "src/segment/XmlTransductionLog.cpp" -# @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\XmlTransductionLog$(OBJEXT)" $? -# -#"$(INTDIR)\XmlTransductionLog_dll$(OBJEXT)" : "src/segment/XmlTransductionLog.cpp" -# @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\XmlTransductionLog_dll$(OBJEXT)" $? -# -#!ENDIF - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\Platform$(OBJEXT)" "$(INTDIR)\Platform$(SBREXT)" : "src/segment/Platform.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\Platform$(OBJEXT)" $? - -"$(INTDIR)\Platform_dll$(OBJEXT)" "$(INTDIR)\Platform_dll$(SBREXT)" : "src/segment/Platform.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\Platform_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\Platform$(OBJEXT)" : "src/segment/Platform.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\Platform$(OBJEXT)" $? - -"$(INTDIR)\Platform_dll$(OBJEXT)" : "src/segment/Platform.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\Platform_dll$(OBJEXT)" $? - -!ENDIF - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\SegmentPainter$(OBJEXT)" "$(INTDIR)\SegmentPainter$(SBREXT)" : "src/painter/SegmentPainter.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\SegmentPainter$(OBJEXT)" $? - -"$(INTDIR)\SegmentPainter_dll$(OBJEXT)" "$(INTDIR)\SegmentPainter_dll$(SBREXT)" : "src/painter/SegmentPainter.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\SegmentPainter_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\SegmentPainter$(OBJEXT)" : "src/painter/SegmentPainter.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\SegmentPainter$(OBJEXT)" $? - -"$(INTDIR)\SegmentPainter_dll$(OBJEXT)" : "src/painter/SegmentPainter.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\SegmentPainter_dll$(OBJEXT)" $? - -!ENDIF - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\WinSegmentPainter$(OBJEXT)" "$(INTDIR)\WinSegmentPainter$(SBREXT)" : "..\wrappers\win32\WinSegmentPainter.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\WinSegmentPainter$(OBJEXT)" $? - -"$(INTDIR)\WinSegmentPainter_dll$(OBJEXT)" "$(INTDIR)\WinSegmentPainter_dll$(SBREXT)" : "..\wrappers\win32\WinSegmentPainter.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\WinSegmentPainter_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\WinSegmentPainter$(OBJEXT)" : "..\wrappers\win32\WinSegmentPainter.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\WinSegmentPainter$(OBJEXT)" $? - -"$(INTDIR)\WinSegmentPainter_dll$(OBJEXT)" : "..\wrappers\win32\WinSegmentPainter.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\WinSegmentPainter_dll$(OBJEXT)" $? - -!ENDIF - - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\WinFont$(OBJEXT)" "$(INTDIR)\WinFont$(SBREXT)" : "../wrappers/win32/WinFont.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\WinFont$(OBJEXT)" $? - -"$(INTDIR)\WinFont_dll$(OBJEXT)" "$(INTDIR)\WinFont_dll$(SBREXT)" : "../wrappers/win32/WinFont.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\WinFont_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\WinFont$(OBJEXT)" : "../wrappers/win32/WinFont.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\WinFont$(OBJEXT)" $? - -"$(INTDIR)\WinFont_dll$(OBJEXT)" : "../wrappers/win32/WinFont.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\WinFont_dll$(OBJEXT)" $? - -!ENDIF - - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\FileFont$(OBJEXT)" "$(INTDIR)\FileFont$(SBREXT)" : "src/font/FileFont.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\FileFont$(OBJEXT)" $? - -"$(INTDIR)\FileFont_dll$(OBJEXT)" "$(INTDIR)\FileFont_dll$(SBREXT)" : "src/font/FileFont.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\FileFont_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\FileFont$(OBJEXT)" : "src/font/FileFont.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\FileFont$(OBJEXT)" $? - -"$(INTDIR)\FileFont_dll$(OBJEXT)" : "src/font/FileFont.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\FileFont_dll$(OBJEXT)" $? - -!ENDIF - - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\..\wrappers\win32\win32_dll$(OBJEXT)" "$(INTDIR)\win32_dll$(SBREXT)" : "..\wrappers\win32\win32_dll.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\win32_dll$(OBJEXT)" $? - -"$(INTDIR)\win32_dll_dll$(OBJEXT)" "$(INTDIR)\win32_dll_dll$(SBREXT)" : "..\wrappers\win32\win32_dll.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\win32_dll_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\win32_dll$(OBJEXT)" : "..\wrappers\win32\win32_dll.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\win32_dll$(OBJEXT)" $? - -"$(INTDIR)\win32_dll_dll$(OBJEXT)" : "..\wrappers\win32\win32_dll.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\win32_dll_dll$(OBJEXT)" $? - -!ENDIF - -bsc : "$(OUTDIR)/$(TARGET).bsc" - -"$(OUTDIR)/$(TARGET).bsc" : "$(OUTDIR)" $(BSC32_SBRS) - $(BSC32) @<< - $(BSC32_FLAGS) $(BSC32_SBRS) -<< - -dll : $(OUTDIR)/$(TARGET).dll - -"$(OUTDIR)/$(TARGET).dll" : "$(OUTDIR)" $(DEF_FILE) lib_dll $(DLL_LINK_OBJS) - $(LINK) $(LINK_FLAGS) $(LINK_DEBUG) $(OUTDIR)/$(TARGET)_dll.lib $(DLL_LINK_OBJS) - diff --git a/Build/source/libs/graphite/engine-2.3.1/makefile.vc8 b/Build/source/libs/graphite/engine-2.3.1/makefile.vc8 deleted file mode 100644 index e922a82164b..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/makefile.vc8 +++ /dev/null @@ -1,814 +0,0 @@ - -TARGET=graphite - -CPP=cl.exe -CPPFLAGS=/Zc:wchar_t- /nologo /W4 /GR /EHsc /I "./src/font" /I "./src/painter" /I "./src/segment" /I "./src/textsource" /I "./src/generic" /I "./include/graphite" /I "../wrappers/win32" /D "GR_NAMESPACE" /D "WIN32" /D "_WINDOWS" /D "_UNICODE" /D "UNICODE" /D "TRACING" /Fp"$(INTDIR)\graphite.pch" /Fd"$(INTDIR)\\" /FD /c -# /Wp62 - -LINK=link.exe -LINK_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /dll /pdb:"$(OUTDIR)\\graphite.pdb" /machine:I386 /out:"$(OUTDIR)\\$(TARGET).dll" /implib:"$(OUTDIR)\\$(TARGET).lib" - -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\\$(TARGET).bsc" - -AR=lib -AR_FLAGS=/OUT:$@ - -!IF "$(MLIB)" == "MD" -MLIB=MD -!ELSE -MLIB=MT -!ENDIF - -OBJEXT = .obj -SBREXT = .sbr - -!IF "$(CFG)" == "DEBUG" -CPP_DEBUG=/D "DEBUG" /Gm /GR /ZI /Od /RTC1 /FR"$(INTDIR)\\" /$(MLIB)d -# CPP_DEBUG=/D "DEBUG" /Gm /GR /ZI /Od /RTC1 /FR"$(INTDIR)\\" /MDd - -OUTDIR=.\debug -INTDIR=.\debug_temp -LINK_DEBUG= MSVCRTD.lib /debug /incremental:yes #/pdbtype:sept - -all : lib lib_dll bsc - -!ELSE -CPP_DEBUG=/D "NDEBUG" /O2 /$(MLIB) -# CPP_DEBUG=/D "NDEBUG" /O2 /MD -OUTDIR=.\release -INTDIR=.\release_temp -LINK_DEBUG= MSVCRT.lib /incremental:no /NODEFAULTLIB:libc - -all : lib lib_dll - -!ENDIF - -!IF "$(TRACING)" == "1" -CPP_DEBUG=/D "TRACING" $(CPP_DEBUG) -!ENDIF - -!IF "$(OS)" == "Windows_NT" -NULL= -!ELSE -NULL=nul -!ENDIF - -clean : - @- rd /s/q .\release_temp - @- rd /s/q .\debug_temp - -realclean : clean - @- rd /s/q .\release - @- rd /s/q .\debug - -LINK_OBJS=\ -# "$(INTDIR)\BinTree_i$(OBJEXT)"\ -# "$(INTDIR)\HashMap_i$(OBJEXT)"\ - "$(INTDIR)\Debug$(OBJEXT)"\ - "$(INTDIR)\Util$(OBJEXT)"\ - "$(INTDIR)\Font$(OBJEXT)"\ - "$(INTDIR)\FileFont$(OBJEXT)"\ - "$(INTDIR)\FontCache$(OBJEXT)"\ - "$(INTDIR)\FontFace$(OBJEXT)"\ - "$(INTDIR)\FileInput$(OBJEXT)"\ - "$(INTDIR)\GrCharStream$(OBJEXT)"\ - "$(INTDIR)\GrClassTable$(OBJEXT)"\ - "$(INTDIR)\GrEngine$(OBJEXT)"\ - "$(INTDIR)\GrFeature$(OBJEXT)"\ - "$(INTDIR)\GrFSM$(OBJEXT)"\ - "$(INTDIR)\GrGlyphTable$(OBJEXT)"\ - "$(INTDIR)\GrPass$(OBJEXT)"\ - "$(INTDIR)\GrPassActionCode$(OBJEXT)"\ - "$(INTDIR)\GrSlotState$(OBJEXT)"\ - "$(INTDIR)\GrSlotStream$(OBJEXT)"\ - "$(INTDIR)\GrTableManager$(OBJEXT)"\ - "$(INTDIR)\MemoryUsage$(OBJEXT)"\ - "$(INTDIR)\Segment$(OBJEXT)"\ - "$(INTDIR)\SegmentAux$(OBJEXT)"\ - "$(INTDIR)\SegmentPainter$(OBJEXT)"\ -# "$(INTDIR)\TestFSM$(OBJEXT)"\ -# "$(INTDIR)\TestPasses$(OBJEXT)"\ - "$(INTDIR)\TransductionLog$(OBJEXT)"\ -### "$(INTDIR)\XmlTransductionLog$(OBJEXT)"\ - "$(INTDIR)\Platform$(OBJEXT)"\ - "$(INTDIR)\TtfUtil$(OBJEXT)"\ - "$(INTDIR)\WinFont$(OBJEXT)"\ - "$(INTDIR)\WinSegmentPainter$(OBJEXT)" - -LINK_DLL_OBJS=\ -# "$(INTDIR)\BinTree_i_dll$(OBJEXT)"\ -# "$(INTDIR)\HashMap_i_dll$(OBJEXT)"\ - "$(INTDIR)\Debug_dll$(OBJEXT)"\ - "$(INTDIR)\Util_dll$(OBJEXT)"\ - "$(INTDIR)\Font_dll$(OBJEXT)"\ - "$(INTDIR)\WinFont_dll$(OBJEXT)"\ - "$(INTDIR)\FileFont_dll$(OBJEXT)"\ - "$(INTDIR)\FontCache_dll$(OBJEXT)"\ - "$(INTDIR)\FontFace_dll$(OBJEXT)"\ - "$(INTDIR)\FileInput_dll$(OBJEXT)"\ - "$(INTDIR)\GrCharStream_dll$(OBJEXT)"\ - "$(INTDIR)\GrClassTable_dll$(OBJEXT)"\ - "$(INTDIR)\GrEngine_dll$(OBJEXT)"\ - "$(INTDIR)\GrFeature_dll$(OBJEXT)"\ - "$(INTDIR)\GrFSM_dll$(OBJEXT)"\ - "$(INTDIR)\GrGlyphTable_dll$(OBJEXT)"\ - "$(INTDIR)\GrPass_dll$(OBJEXT)"\ - "$(INTDIR)\GrPassActionCode_dll$(OBJEXT)"\ - "$(INTDIR)\GrSlotState_dll$(OBJEXT)"\ - "$(INTDIR)\GrSlotStream_dll$(OBJEXT)"\ - "$(INTDIR)\GrTableManager_dll$(OBJEXT)"\ - "$(INTDIR)\MemoryUsage_dll$(OBJEXT)"\ - "$(INTDIR)\Segment_dll$(OBJEXT)"\ - "$(INTDIR)\SegmentAux_dll$(OBJEXT)"\ - "$(INTDIR)\SegmentPainter_dll$(OBJEXT)"\ -# "$(INTDIR)\TestFSM_dll$(OBJEXT)"\ -# "$(INTDIR)\TestPasses_dll$(OBJEXT)"\ - "$(INTDIR)\TransductionLog_dll$(OBJEXT)"\ -### "$(INTDIR)\XmlTransductionLog_dll$(OBJEXT)"\ - "$(INTDIR)\WinSegmentPainter_dll$(OBJEXT)"\ - "$(INTDIR)\Platform_dll$(OBJEXT)"\ - "$(INTDIR)\TtfUtil_dll$(OBJEXT)" - -DLL_LINK_OBJS=\ - "$(INTDIR)\win32_dll_dll$(OBJEXT)" - -BSC32_SBRS=\ -# "$(INTDIR)\BinTree_i$(SBREXT)"\ -# "$(INTDIR)\HashMap_i$(SBREXT)"\ - "$(INTDIR)\Debug$(SBREXT)"\ - "$(INTDIR)\Util$(SBREXT)"\ - "$(INTDIR)\Font$(SBREXT)"\ - "$(INTDIR)\WinFont$(SBREXT)"\ - "$(INTDIR)\FileFont$(SBREXT)"\ - "$(INTDIR)\FontCache$(SBREXT)"\ - "$(INTDIR)\FontFace$(SBREXT)"\ - "$(INTDIR)\FileInput$(SBREXT)"\ - "$(INTDIR)\GrCharStream$(SBREXT)"\ - "$(INTDIR)\GrClassTable$(SBREXT)"\ - "$(INTDIR)\GrEngine$(SBREXT)"\ - "$(INTDIR)\GrFeature$(SBREXT)"\ - "$(INTDIR)\GrFSM$(SBREXT)"\ - "$(INTDIR)\GrGlyphTable$(SBREXT)"\ - "$(INTDIR)\GrPass$(SBREXT)"\ - "$(INTDIR)\GrPassActionCode$(SBREXT)"\ - "$(INTDIR)\GrSlotState$(SBREXT)"\ - "$(INTDIR)\GrSlotStream$(SBREXT)"\ - "$(INTDIR)\GrTableManager$(SBREXT)"\ - "$(INTDIR)\MemoryUsage$(SBREXT)"\ - "$(INTDIR)\Segment$(SBREXT)"\ - "$(INTDIR)\SegmentAux$(SBREXT)"\ - "$(INTDIR)\SegmentPainter$(SBREXT)"\ -# "$(INTDIR)\TestFSM$(SBREXT)"\ -# "$(INTDIR)\TestPasses$(SBREXT)"\ - "$(INTDIR)\TransductionLog$(SBREXT)"\ -### "$(INTDIR)\XmlTransductionLog$(SBREXT)"\ - "$(INTDIR)\WinSegmentPainter$(SBREXT)"\ - "$(INTDIR)\Platform$(SBREXT)"\ - "$(INTDIR)\TtfUtil$(SBREXT)"\ - "$(INTDIR)\win32_dll$(SBREXT)" - -$(OUTDIR) : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -$(INTDIR) : - if not exist "$(INTDIR)/$(NULL)" mkdir "$(INTDIR)" - -lib : "$(OUTDIR)/$(TARGET).lib" - -lib_dll : "$(OUTDIR)/$(TARGET)_dll.lib" - -"$(OUTDIR)/$(TARGET).lib" : "$(OUTDIR)" "$(INTDIR)" $(LINK_OBJS) - $(AR) @<< - $(AR_FLAGS) $(LINK_OBJS) -<< - -"$(OUTDIR)/$(TARGET)_dll.lib" : "$(OUTDIR)" "$(INTDIR)" $(LINK_DLL_OBJS) - $(AR) @<< - $(AR_FLAGS) $(LINK_DLL_OBJS) -<< - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\BinTree_i$(OBJEXT)" "$(INTDIR)\BinTree_i$(SBREXT)" : "src/generic/BinTree_i.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\BinTree_i$(OBJEXT)" $? - -"$(INTDIR)\BinTree_i_dll$(OBJEXT)" "$(INTDIR)\BinTree_i_dll$(SBREXT)" : "src/generic/BinTree_i.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\BinTree_i_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\BinTree_i$(OBJEXT)" : "src/generic/BinTree_i.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\BinTree_i$(OBJEXT)" $? - -"$(INTDIR)\BinTree_i_dll$(OBJEXT)" : "src/generic/BinTree_i.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /D "_DLL" /Fo"$(INTDIR)\BinTree_i_dll$(OBJEXT)" $? - -!ENDIF - - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\Debug$(OBJEXT)" "$(INTDIR)\Debug$(SBREXT)" : "src/generic/Debug.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\Debug$(OBJEXT)" $? - -"$(INTDIR)\Debug_dll$(OBJEXT)" "$(INTDIR)\Debug_dll$(SBREXT)" : "src/generic/Debug.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\Debug_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\Debug$(OBJEXT)" : "src/generic/Debug.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\Debug$(OBJEXT)" $? - -"$(INTDIR)\Debug_dll$(OBJEXT)" : "src/generic/Debug.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\Debug_dll$(OBJEXT)" $? - -!ENDIF - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\HashMap$(OBJEXT)" "$(INTDIR)\HashMap$(SBREXT)" : "src/generic/HashMap.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\HashMap$(OBJEXT)" $? - -"$(INTDIR)\HashMap_dll$(OBJEXT)" "$(INTDIR)\HashMap_dll$(SBREXT)" : "src/generic/HashMap.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\HashMap_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\HashMap$(OBJEXT)" : "src/generic/HashMap.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\HashMap$(OBJEXT)" $? - -"$(INTDIR)\HashMap_dll$(OBJEXT)" : "src/generic/HashMap.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\HashMap_dll$(OBJEXT)" $? - -!ENDIF - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\HashMap_i$(OBJEXT)" "$(INTDIR)\HashMap_i$(SBREXT)" : "src/generic/HashMap_i.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\HashMap_i$(OBJEXT)" $? - -"$(INTDIR)\HashMap_i_dll$(OBJEXT)" "$(INTDIR)\HashMap_i_dll$(SBREXT)" : "src/generic/HashMap_i.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\HashMap_i_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\HashMap_i$(OBJEXT)" : "src/generic/HashMap_i.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\HashMap_i$(OBJEXT)" $? - -"$(INTDIR)\HashMap_i_dll$(OBJEXT)" : "src/generic/HashMap_i.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\HashMap_i_dll$(OBJEXT)" $? - -!ENDIF - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\Set_i$(OBJEXT)" "$(INTDIR)\Set_i$(SBREXT)" : "src/generic/Set_i.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\Set_i$(OBJEXT)" $? - -"$(INTDIR)\Set_i_dll$(OBJEXT)" "$(INTDIR)\Set_i_dll$(SBREXT)" : "src/generic/Set_i.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\Set_i_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\Set_i$(OBJEXT)" : "src/generic/Set_i.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\Set_i$(OBJEXT)" $? - -"$(INTDIR)\Set_i_dll$(OBJEXT)" : "src/generic/Set_i.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\Set_i_dll$(OBJEXT)" $? - -!ENDIF - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\Util$(OBJEXT)" "$(INTDIR)\Util$(SBREXT)" : "src/generic/Util.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\Util$(OBJEXT)" $? - -"$(INTDIR)\Util_dll$(OBJEXT)" "$(INTDIR)\Util_dll$(SBREXT)" : "src/generic/Util.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\Util_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\Util$(OBJEXT)" : "src/generic/Util.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\Util$(OBJEXT)" $? - -"$(INTDIR)\Util_dll$(OBJEXT)" : "src/generic/Util.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\Util_dll$(OBJEXT)" $? - -!ENDIF - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\UtilString$(OBJEXT)" "$(INTDIR)\UtilString$(SBREXT)" : "src/generic/UtilString.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\UtilString$(OBJEXT)" $? - -"$(INTDIR)\UtilString_dll$(OBJEXT)" "$(INTDIR)\UtilString_dll$(SBREXT)" : "src/generic/UtilString.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\UtilString_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\UtilString$(OBJEXT)" : "src/generic/UtilString.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\UtilString$(OBJEXT)" $? - -"$(INTDIR)\UtilString_dll$(OBJEXT)" : "src/generic/UtilString.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\UtilString_dll$(OBJEXT)" $? - -!ENDIF - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\Vector_i$(OBJEXT)" "$(INTDIR)\Vector_i$(SBREXT)" : "src/generic/Vector_i.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\Vector_i$(OBJEXT)" $? - -"$(INTDIR)\Vector_i_dll$(OBJEXT)" "$(INTDIR)\Vector_i_dll$(SBREXT)" : "src/generic/Vector_i.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\Vector_i_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\Vector_i$(OBJEXT)" : "src/generic/Vector_i.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\Vector_i$(OBJEXT)" $? - -"$(INTDIR)\Vector_i_dll$(OBJEXT)" : "src/generic/Vector_i.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\Vector_i_dll$(OBJEXT)" $? - -!ENDIF - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\Font$(OBJEXT)" "$(INTDIR)\Font$(SBREXT)" : "src/font/Font.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\Font$(OBJEXT)" $? - -"$(INTDIR)\Font_dll$(OBJEXT)" "$(INTDIR)\Font_dll$(SBREXT)" : "src/font/Font.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\Font_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\Font$(OBJEXT)" : "src/font/Font.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\Font$(OBJEXT)" $? - -"$(INTDIR)\Font_dll$(OBJEXT)" : "src/font/Font.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\Font_dll$(OBJEXT)" $? - -!ENDIF - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\GrUtil$(OBJEXT)" "$(INTDIR)\GrUtil$(SBREXT)" : "src/font/GrUtil.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrUtil$(OBJEXT)" $? - -"$(INTDIR)\GrUtil_dll$(OBJEXT)" "$(INTDIR)\GrUtil_dll$(SBREXT)" : "src/font/GrUtil.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\GrUtil_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\GrUtil$(OBJEXT)" : "src/font/GrUtil.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrUtil$(OBJEXT)" $? - -"$(INTDIR)\GrUtil_dll$(OBJEXT)" : "src/font/GrUtil.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\GrUtil_dll$(OBJEXT)" $? - -!ENDIF - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\TtfUtil$(OBJEXT)" "$(INTDIR)\TtfUtil$(SBREXT)" : "src/font/TtfUtil.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\TtfUtil$(OBJEXT)" $? - -"$(INTDIR)\TtfUtil_dll$(OBJEXT)" "$(INTDIR)\TtfUtil_dll$(SBREXT)" : "src/font/TtfUtil.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\TtfUtil_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\TtfUtil$(OBJEXT)" : "src/font/TtfUtil.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\TtfUtil$(OBJEXT)" $? - -"$(INTDIR)\TtfUtil_dll$(OBJEXT)" : "src/font/TtfUtil.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\TtfUtil_dll$(OBJEXT)" $? - -!ENDIF - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\FontCache$(OBJEXT)" "$(INTDIR)\FontCache$(SBREXT)" : "src/segment/FontCache.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\FontCache$(OBJEXT)" $? - -"$(INTDIR)\FontCache_dll$(OBJEXT)" "$(INTDIR)\FontCache_dll$(SBREXT)" : "src/segment/FontCache.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\FontCache_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\FontCache$(OBJEXT)" : "src/segment/FontCache.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\FontCache$(OBJEXT)" $? - -"$(INTDIR)\FontCache_dll$(OBJEXT)" : "src/segment/FontCache.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\FontCache_dll$(OBJEXT)" $? - -!ENDIF - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\FontFace$(OBJEXT)" "$(INTDIR)\FontFace$(SBREXT)" : "src/segment/FontFace.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\FontFace$(OBJEXT)" $? - -"$(INTDIR)\FontFace_dll$(OBJEXT)" "$(INTDIR)\FontFace_dll$(SBREXT)" : "src/segment/FontFace.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\FontFace_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\FontFace$(OBJEXT)" : "src/segment/FontFace.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\FontFace$(OBJEXT)" $? - -"$(INTDIR)\FontFace_dll$(OBJEXT)" : "src/segment/FontFace.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\FontFace_dll$(OBJEXT)" $? - -!ENDIF - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\FileInput$(OBJEXT)" "$(INTDIR)\FileInput$(SBREXT)" : "src/segment/FileInput.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\FileInput$(OBJEXT)" $? - -"$(INTDIR)\FileInput_dll$(OBJEXT)" "$(INTDIR)\FileInput_dll$(SBREXT)" : "src/segment/FileInput.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\FileInput_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\FileInput$(OBJEXT)" : "src/segment/FileInput.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\FileInput$(OBJEXT)" $? - -"$(INTDIR)\FileInput_dll$(OBJEXT)" : "src/segment/FileInput.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\FileInput_dll$(OBJEXT)" $? - -!ENDIF - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\GrCharStream$(OBJEXT)" "$(INTDIR)\GrCharStream$(SBREXT)" : "src/segment/GrCharStream.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrCharStream$(OBJEXT)" $? - -"$(INTDIR)\GrCharStream_dll$(OBJEXT)" "$(INTDIR)\GrCharStream_dll$(SBREXT)" : "src/segment/GrCharStream.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\GrCharStream_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\GrCharStream$(OBJEXT)" : "src/segment/GrCharStream.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrCharStream$(OBJEXT)" $? - -"$(INTDIR)\GrCharStream_dll$(OBJEXT)" : "src/segment/GrCharStream.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\GrCharStream_dll$(OBJEXT)" $? - -!ENDIF - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\GrClassTable$(OBJEXT)" "$(INTDIR)\GrClassTable$(SBREXT)" : "src/segment/GrClassTable.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrClassTable$(OBJEXT)" $? - -"$(INTDIR)\GrClassTable_dll$(OBJEXT)" "$(INTDIR)\GrClassTable_dll$(SBREXT)" : "src/segment/GrClassTable.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\GrClassTable_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\GrClassTable$(OBJEXT)" : "src/segment/GrClassTable.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrClassTable$(OBJEXT)" $? - -"$(INTDIR)\GrClassTable_dll$(OBJEXT)" : "src/segment/GrClassTable.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\GrClassTable_dll$(OBJEXT)" $? - -!ENDIF - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\GrEngine$(OBJEXT)" "$(INTDIR)\GrEngine$(SBREXT)" : "src/segment/GrEngine.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrEngine$(OBJEXT)" $? - -"$(INTDIR)\GrEngine_dll$(OBJEXT)" "$(INTDIR)\GrEngine_dll$(SBREXT)" : "src/segment/GrEngine.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\GrEngine_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\GrEngine$(OBJEXT)" : "src/segment/GrEngine.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrEngine$(OBJEXT)" $? - -"$(INTDIR)\GrEngine_dll$(OBJEXT)" : "src/segment/GrEngine.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\GrEngine_dll$(OBJEXT)" $? - -!ENDIF - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\GrFeature$(OBJEXT)" "$(INTDIR)\GrFeature$(SBREXT)" : "src/segment/GrFeature.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrFeature$(OBJEXT)" $? - -"$(INTDIR)\GrFeature_dll$(OBJEXT)" "$(INTDIR)\GrFeature_dll$(SBREXT)" : "src/segment/GrFeature.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\GrFeature_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\GrFeature$(OBJEXT)" : "src/segment/GrFeature.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrFeature$(OBJEXT)" $? - -"$(INTDIR)\GrFeature_dll$(OBJEXT)" : "src/segment/GrFeature.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\GrFeature_dll$(OBJEXT)" $? - -!ENDIF - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\GrFSM$(OBJEXT)" "$(INTDIR)\GrFSM$(SBREXT)" : "src/segment/GrFSM.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrFSM$(OBJEXT)" $? - -"$(INTDIR)\GrFSM_dll$(OBJEXT)" "$(INTDIR)\GrFSM_dll$(SBREXT)" : "src/segment/GrFSM.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\GrFSM_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\GrFSM$(OBJEXT)" : "src/segment/GrFSM.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrFSM$(OBJEXT)" $? - -"$(INTDIR)\GrFSM_dll$(OBJEXT)" : "src/segment/GrFSM.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\GrFSM_dll$(OBJEXT)" $? - -!ENDIF - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\GrGlyphTable$(OBJEXT)" "$(INTDIR)\GrGlyphTable$(SBREXT)" : "src/segment/GrGlyphTable.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrGlyphTable$(OBJEXT)" $? - -"$(INTDIR)\GrGlyphTable_dll$(OBJEXT)" "$(INTDIR)\GrGlyphTable_dll$(SBREXT)" : "src/segment/GrGlyphTable.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\GrGlyphTable_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\GrGlyphTable$(OBJEXT)" : "src/segment/GrGlyphTable.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrGlyphTable$(OBJEXT)" $? - -"$(INTDIR)\GrGlyphTable_dll$(OBJEXT)" : "src/segment/GrGlyphTable.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\GrGlyphTable_dll$(OBJEXT)" $? - -!ENDIF - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\GrPass$(OBJEXT)" "$(INTDIR)\GrPass$(SBREXT)" : "src/segment/GrPass.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrPass$(OBJEXT)" $? - -"$(INTDIR)\GrPass_dll$(OBJEXT)" "$(INTDIR)\GrPass_dll$(SBREXT)" : "src/segment/GrPass.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\GrPass_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\GrPass$(OBJEXT)" : "src/segment/GrPass.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrPass$(OBJEXT)" $? - -"$(INTDIR)\GrPass_dll$(OBJEXT)" : "src/segment/GrPass.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\GrPass_dll$(OBJEXT)" $? - -!ENDIF - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\GrPassActionCode$(OBJEXT)" "$(INTDIR)\GrPassActionCode$(SBREXT)" : "src/segment/GrPassActionCode.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrPassActionCode$(OBJEXT)" $? - -"$(INTDIR)\GrPassActionCode_dll$(OBJEXT)" "$(INTDIR)\GrPassActionCode_dll$(SBREXT)" : "src/segment/GrPassActionCode.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\GrPassActionCode_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\GrPassActionCode$(OBJEXT)" : "src/segment/GrPassActionCode.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrPassActionCode$(OBJEXT)" $? - -"$(INTDIR)\GrPassActionCode_dll$(OBJEXT)" : "src/segment/GrPassActionCode.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\GrPassActionCode_dll$(OBJEXT)" $? - -!ENDIF - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\GrSlotState$(OBJEXT)" "$(INTDIR)\GrSlotState$(SBREXT)" : "src/segment/GrSlotState.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrSlotState$(OBJEXT)" $? - -"$(INTDIR)\GrSlotState_dll$(OBJEXT)" "$(INTDIR)\GrSlotState_dll$(SBREXT)" : "src/segment/GrSlotState.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\GrSlotState_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\GrSlotState$(OBJEXT)" : "src/segment/GrSlotState.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrSlotState$(OBJEXT)" $? - -"$(INTDIR)\GrSlotState_dll$(OBJEXT)" : "src/segment/GrSlotState.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\GrSlotState_dll$(OBJEXT)" $? - -!ENDIF - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\GrSlotStream$(OBJEXT)" "$(INTDIR)\GrSlotStream$(SBREXT)" : "src/segment/GrSlotStream.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrSlotStream$(OBJEXT)" $? - -"$(INTDIR)\GrSlotStream_dll$(OBJEXT)" "$(INTDIR)\GrSlotStream_dll$(SBREXT)" : "src/segment/GrSlotStream.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\GrSlotStream_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\GrSlotStream$(OBJEXT)" : "src/segment/GrSlotStream.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrSlotStream$(OBJEXT)" $? - -"$(INTDIR)\GrSlotStream_dll$(OBJEXT)" : "src/segment/GrSlotStream.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\GrSlotStream_dll$(OBJEXT)" $? - -!ENDIF - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\GrTableManager$(OBJEXT)" "$(INTDIR)\GrTableManager$(SBREXT)" : "src/segment/GrTableManager.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrTableManager$(OBJEXT)" $? - -"$(INTDIR)\GrTableManager_dll$(OBJEXT)" "$(INTDIR)\GrTableManager_dll$(SBREXT)" : "src/segment/GrTableManager.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\GrTableManager_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\GrTableManager$(OBJEXT)" : "src/segment/GrTableManager.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrTableManager$(OBJEXT)" $? - -"$(INTDIR)\GrTableManager_dll$(OBJEXT)" : "src/segment/GrTableManager.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\GrTableManager_dll$(OBJEXT)" $? - -!ENDIF - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\MemoryUsage$(OBJEXT)" "$(INTDIR)\MemoryUsage$(SBREXT)" : "src/segment/MemoryUsage.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\MemoryUsage$(OBJEXT)" $? - -"$(INTDIR)\MemoryUsage_dll$(OBJEXT)" "$(INTDIR)\MemoryUsage_dll$(SBREXT)" : "src/segment/MemoryUsage.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\MemoryUsage_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\MemoryUsage$(OBJEXT)" : "src/segment/MemoryUsage.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\MemoryUsage$(OBJEXT)" $? - -"$(INTDIR)\MemoryUsage_dll$(OBJEXT)" : "src/segment/MemoryUsage.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\MemoryUsage_dll$(OBJEXT)" $? - -!ENDIF - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\Segment$(OBJEXT)" "$(INTDIR)\Segment$(SBREXT)" : "src/segment/Segment.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\Segment$(OBJEXT)" $? - -"$(INTDIR)\Segment_dll$(OBJEXT)" "$(INTDIR)\Segment_dll$(SBREXT)" : "src/segment/Segment.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\Segment_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\Segment$(OBJEXT)" : "src/segment/Segment.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\Segment$(OBJEXT)" $? - -"$(INTDIR)\Segment_dll$(OBJEXT)" : "src/segment/Segment.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\Segment_dll$(OBJEXT)" $? - -!ENDIF - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\SegmentAux$(OBJEXT)" "$(INTDIR)\SegmentAux$(SBREXT)" : "src/segment/SegmentAux.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\SegmentAux$(OBJEXT)" $? - -"$(INTDIR)\SegmentAux_dll$(OBJEXT)" "$(INTDIR)\SegmentAux_dll$(SBREXT)" : "src/segment/SegmentAux.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\SegmentAux_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\SegmentAux$(OBJEXT)" : "src/segment/SegmentAux.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\SegmentAux$(OBJEXT)" $? - -"$(INTDIR)\SegmentAux_dll$(OBJEXT)" : "src/segment/SegmentAux.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\SegmentAux_dll$(OBJEXT)" $? - -!ENDIF - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\TestFSM$(OBJEXT)" "$(INTDIR)\TestFSM$(SBREXT)" : "src/segment/TestFSM.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\TestFSM$(OBJEXT)" $? - -"$(INTDIR)\TestFSM_dll$(OBJEXT)" "$(INTDIR)\TestFSM_dll$(SBREXT)" : "src/segment/TestFSM.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\TestFSM_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\TestFSM$(OBJEXT)" : "src/segment/TestFSM.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\TestFSM$(OBJEXT)" $? - -"$(INTDIR)\TestFSM_dll$(OBJEXT)" : "src/segment/TestFSM.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\TestFSM_dll$(OBJEXT)" $? - -!ENDIF - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\TestPasses$(OBJEXT)" "$(INTDIR)\TestPasses$(SBREXT)" : "src/segment/TestPasses.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\TestPasses$(OBJEXT)" $? - -"$(INTDIR)\TestPasses_dll$(OBJEXT)" "$(INTDIR)\TestPasses_dll$(SBREXT)" : "src/segment/TestPasses.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\TestPasses_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\TestPasses$(OBJEXT)" : "src/segment/TestPasses.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\TestPasses$(OBJEXT)" $? - -"$(INTDIR)\TestPasses_dll$(OBJEXT)" : "src/segment/TestPasses.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\TestPasses_dll$(OBJEXT)" $? - -!ENDIF - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\TransductionLog$(OBJEXT)" "$(INTDIR)\TransductionLog$(SBREXT)" : "src/segment/TransductionLog.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\TransductionLog$(OBJEXT)" $? - -"$(INTDIR)\TransductionLog_dll$(OBJEXT)" "$(INTDIR)\TransductionLog_dll$(SBREXT)" : "src/segment/TransductionLog.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\TransductionLog_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\TransductionLog$(OBJEXT)" : "src/segment/TransductionLog.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\TransductionLog$(OBJEXT)" $? - -"$(INTDIR)\TransductionLog_dll$(OBJEXT)" : "src/segment/TransductionLog.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\TransductionLog_dll$(OBJEXT)" $? - -!ENDIF - -#!IF "$(CFG)" == "DEBUG" -#"$(INTDIR)\XmlTransductionLog$(OBJEXT)" "$(INTDIR)\XmlTransductionLog$(SBREXT)" : "src/segment/XmlTransductionLog.cpp" -# @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\XmlTransductionLog$(OBJEXT)" $? -# -#"$(INTDIR)\XmlTransductionLog_dll$(OBJEXT)" "$(INTDIR)\XmlTransductionLog_dll$(SBREXT)" : "src/segment/XmlTransductionLog.cpp" -# @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\XmlTransductionLog_dll$(OBJEXT)" $? -# -#!ELSE -#"$(INTDIR)\XmlTransductionLog$(OBJEXT)" : "src/segment/XmlTransductionLog.cpp" -# @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\XmlTransductionLog$(OBJEXT)" $? -# -#"$(INTDIR)\XmlTransductionLog_dll$(OBJEXT)" : "src/segment/XmlTransductionLog.cpp" -# @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\XmlTransductionLog_dll$(OBJEXT)" $? -# -#!ENDIF - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\Platform$(OBJEXT)" "$(INTDIR)\Platform$(SBREXT)" : "src/segment/Platform.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\Platform$(OBJEXT)" $? - -"$(INTDIR)\Platform_dll$(OBJEXT)" "$(INTDIR)\Platform_dll$(SBREXT)" : "src/segment/Platform.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\Platform_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\Platform$(OBJEXT)" : "src/segment/Platform.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\Platform$(OBJEXT)" $? - -"$(INTDIR)\Platform_dll$(OBJEXT)" : "src/segment/Platform.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\Platform_dll$(OBJEXT)" $? - -!ENDIF - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\SegmentPainter$(OBJEXT)" "$(INTDIR)\SegmentPainter$(SBREXT)" : "src/painter/SegmentPainter.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\SegmentPainter$(OBJEXT)" $? - -"$(INTDIR)\SegmentPainter_dll$(OBJEXT)" "$(INTDIR)\SegmentPainter_dll$(SBREXT)" : "src/painter/SegmentPainter.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\SegmentPainter_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\SegmentPainter$(OBJEXT)" : "src/painter/SegmentPainter.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\SegmentPainter$(OBJEXT)" $? - -"$(INTDIR)\SegmentPainter_dll$(OBJEXT)" : "src/painter/SegmentPainter.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\SegmentPainter_dll$(OBJEXT)" $? - -!ENDIF - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\WinSegmentPainter$(OBJEXT)" "$(INTDIR)\WinSegmentPainter$(SBREXT)" : "..\wrappers\win32\WinSegmentPainter.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\WinSegmentPainter$(OBJEXT)" $? - -"$(INTDIR)\WinSegmentPainter_dll$(OBJEXT)" "$(INTDIR)\WinSegmentPainter_dll$(SBREXT)" : "..\wrappers\win32\WinSegmentPainter.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\WinSegmentPainter_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\WinSegmentPainter$(OBJEXT)" : "..\wrappers\win32\WinSegmentPainter.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\WinSegmentPainter$(OBJEXT)" $? - -"$(INTDIR)\WinSegmentPainter_dll$(OBJEXT)" : "..\wrappers\win32\WinSegmentPainter.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\WinSegmentPainter_dll$(OBJEXT)" $? - -!ENDIF - - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\WinFont$(OBJEXT)" "$(INTDIR)\WinFont$(SBREXT)" : "../wrappers/win32/WinFont.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\WinFont$(OBJEXT)" $? - -"$(INTDIR)\WinFont_dll$(OBJEXT)" "$(INTDIR)\WinFont_dll$(SBREXT)" : "../wrappers/win32/WinFont.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\WinFont_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\WinFont$(OBJEXT)" : "../wrappers/win32/WinFont.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\WinFont$(OBJEXT)" $? - -"$(INTDIR)\WinFont_dll$(OBJEXT)" : "../wrappers/win32/WinFont.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\WinFont_dll$(OBJEXT)" $? - -!ENDIF - - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\FileFont$(OBJEXT)" "$(INTDIR)\FileFont$(SBREXT)" : "src/font/FileFont.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\FileFont$(OBJEXT)" $? - -"$(INTDIR)\FileFont_dll$(OBJEXT)" "$(INTDIR)\FileFont_dll$(SBREXT)" : "src/font/FileFont.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\FileFont_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\FileFont$(OBJEXT)" : "src/font/FileFont.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\FileFont$(OBJEXT)" $? - -"$(INTDIR)\FileFont_dll$(OBJEXT)" : "src/font/FileFont.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\FileFont_dll$(OBJEXT)" $? - -!ENDIF - - -!IF "$(CFG)" == "DEBUG" -"$(INTDIR)\..\wrappers\win32\win32_dll$(OBJEXT)" "$(INTDIR)\win32_dll$(SBREXT)" : "..\wrappers\win32\win32_dll.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\win32_dll$(OBJEXT)" $? - -"$(INTDIR)\win32_dll_dll$(OBJEXT)" "$(INTDIR)\win32_dll_dll$(SBREXT)" : "..\wrappers\win32\win32_dll.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\win32_dll_dll$(OBJEXT)" $? - -!ELSE -"$(INTDIR)\win32_dll$(OBJEXT)" : "..\wrappers\win32\win32_dll.cpp" - @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\win32_dll$(OBJEXT)" $? - -"$(INTDIR)\win32_dll_dll$(OBJEXT)" : "..\wrappers\win32\win32_dll.cpp" - @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\win32_dll_dll$(OBJEXT)" $? - -!ENDIF - -bsc : "$(OUTDIR)/$(TARGET).bsc" - -"$(OUTDIR)/$(TARGET).bsc" : "$(OUTDIR)" $(BSC32_SBRS) - $(BSC32) @<< - $(BSC32_FLAGS) $(BSC32_SBRS) -<< - -dll : $(OUTDIR)/$(TARGET).dll - -"$(OUTDIR)/$(TARGET).dll" : "$(OUTDIR)" $(DEF_FILE) lib_dll $(DLL_LINK_OBJS) - $(LINK) $(LINK_FLAGS) $(LINK_DEBUG) $(OUTDIR)/$(TARGET)_dll.lib $(DLL_LINK_OBJS) - diff --git a/Build/source/libs/graphite/engine-2.3.1/silgraphite.pc.in b/Build/source/libs/graphite/engine-2.3.1/silgraphite.pc.in deleted file mode 100644 index 6a57ab7838b..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/silgraphite.pc.in +++ /dev/null @@ -1,7 +0,0 @@ - -Name: SILGraphite -Description: Script rendering engine -Version: ${version} -Libs: -L${libdir} -lgraphite -Cflags: -I${includedir} - diff --git a/Build/source/libs/graphite/engine-2.3.1/src/Makefile.am b/Build/source/libs/graphite/engine-2.3.1/src/Makefile.am deleted file mode 100644 index 7d55c002a23..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/src/Makefile.am +++ /dev/null @@ -1,22 +0,0 @@ -AUTOMAKE_OPTIONS = 1.6 - -AM_CPPFLAGS = -I$(top_srcdir)/include/graphite -I$(top_srcdir)/src/generic -AM_CPPFLAGS += -I$(top_srcdir)/src/font -I$(top_srcdir)/src/segment -#AM_CPPFLAGS += $(FT_CFLAGS) $(XFT_CFLAGS) -#AM_CPPFLAGS += -D_UNICODE -DUNICODE -DNO_ASM - -lib_LTLIBRARIES = libgraphite.la - -libgraphite_la_LDFLAGS = -version-info 3:0:0 - -#EXTRA_DIST=textsource -EXTRA_DIST= -graphiteinclude_HEADERS = -graphiteincludedir = $(includedir)/graphite -include ../include/Makefile.am - -libgraphite_la_SOURCES = -include generic/Makefile.am -include font/Makefile.am -include segment/Makefile.am -include painter/Makefile.am diff --git a/Build/source/libs/graphite/engine-2.3.1/src/Makefile.in b/Build/source/libs/graphite/engine-2.3.1/src/Makefile.in deleted file mode 100644 index 487f21dc19c..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/src/Makefile.in +++ /dev/null @@ -1,781 +0,0 @@ -# Makefile.in generated by automake 1.10.1 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - - -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -DIST_COMMON = $(graphiteinclude_HEADERS) \ - $(srcdir)/../include/Makefile.am $(srcdir)/Makefile.am \ - $(srcdir)/Makefile.in $(srcdir)/font/Makefile.am \ - $(srcdir)/generic/Makefile.am $(srcdir)/painter/Makefile.am \ - $(srcdir)/segment/Makefile.am -subdir = src -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_CLEAN_FILES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(libdir)" \ - "$(DESTDIR)$(graphiteincludedir)" -libLTLIBRARIES_INSTALL = $(INSTALL) -LTLIBRARIES = $(lib_LTLIBRARIES) -libgraphite_la_LIBADD = -am_libgraphite_la_OBJECTS = Debug.lo Util.lo Font.lo TtfUtil.lo \ - FileFont.lo FileInput.lo FontCache.lo FontFace.lo \ - GrCharStream.lo GrClassTable.lo GrEngine.lo GrFeature.lo \ - GrFSM.lo GrGlyphTable.lo GrPassActionCode.lo GrPass.lo \ - GrSlotState.lo GrSlotStream.lo GrTableManager.lo \ - MemoryUsage.lo Platform.lo SegmentAux.lo Segment.lo TestFSM.lo \ - TestPasses.lo TransductionLog.lo SegmentPainter.lo -libgraphite_la_OBJECTS = $(am_libgraphite_la_OBJECTS) -libgraphite_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ - $(CXXFLAGS) $(libgraphite_la_LDFLAGS) $(LDFLAGS) -o $@ -DEFAULT_INCLUDES = -I.@am__isrc@ -depcomp = $(SHELL) $(top_srcdir)/config/depcomp -am__depfiles_maybe = depfiles -CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -CXXLD = $(CXX) -CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ - $(LDFLAGS) -o $@ -SOURCES = $(libgraphite_la_SOURCES) -DIST_SOURCES = $(libgraphite_la_SOURCES) -graphiteincludeHEADERS_INSTALL = $(INSTALL_HEADER) -HEADERS = $(graphiteinclude_HEADERS) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -GREP = @GREP@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LSB_RELEASE = @LSB_RELEASE@ -LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ -MAKEINFO = @MAKEINFO@ -MKDIR_P = @MKDIR_P@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -RANLIB = @RANLIB@ -REL_CODENAME = @REL_CODENAME@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SIZEOF_WCHAR_T = @SIZEOF_WCHAR_T@ -STRIP = @STRIP@ -VERSION = @VERSION@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -AUTOMAKE_OPTIONS = 1.6 -AM_CPPFLAGS = -I$(top_srcdir)/include/graphite \ - -I$(top_srcdir)/src/generic -I$(top_srcdir)/src/font \ - -I$(top_srcdir)/src/segment -#AM_CPPFLAGS += $(FT_CFLAGS) $(XFT_CFLAGS) -#AM_CPPFLAGS += -D_UNICODE -DUNICODE -DNO_ASM -lib_LTLIBRARIES = libgraphite.la -libgraphite_la_LDFLAGS = -version-info 3:0:0 - -#EXTRA_DIST=textsource -EXTRA_DIST = $(top_srcdir)/include/graphite/BinTree.h \ - $(top_srcdir)/include/graphite/GenericResource.h \ - $(top_srcdir)/include/graphite/HashMap.h $(genericdir)/*.h \ - $(genericdir)/BinTree_i.cpp $(genericdir)/HashMap_i.cpp \ - $(fontdir)/*.h $(segmentdir)/*.h -graphiteinclude_HEADERS = $(top_srcdir)/include/graphite/FileFont.h \ - $(top_srcdir)/include/graphite/Font.h \ - $(top_srcdir)/include/graphite/GraphiteProcess.h \ - $(top_srcdir)/include/graphite/GrAppData.h \ - $(top_srcdir)/include/graphite/GrClient.h \ - $(top_srcdir)/include/graphite/GrCommon.h \ - $(top_srcdir)/include/graphite/GrConstants.h \ - $(top_srcdir)/include/graphite/GrData.h \ - $(top_srcdir)/include/graphite/GrDebug.h \ - $(top_srcdir)/include/graphite/GrExt.h \ - $(top_srcdir)/include/graphite/GrFeature.h \ - $(top_srcdir)/include/graphite/GrMstypes.h \ - $(top_srcdir)/include/graphite/GrPlatform.h \ - $(top_srcdir)/include/graphite/GrResult.h \ - $(top_srcdir)/include/graphite/GrStructs.h \ - $(top_srcdir)/include/graphite/GrWrappers.h \ - $(top_srcdir)/include/graphite/IGraphiteProcess.h \ - $(top_srcdir)/include/graphite/IGrEngine.h \ - $(top_srcdir)/include/graphite/IGrJustifier.h \ - $(top_srcdir)/include/graphite/ITextSource.h \ - $(top_srcdir)/include/graphite/MemoryUsage.h \ - $(top_srcdir)/include/graphite/SegmentAux.h \ - $(top_srcdir)/include/graphite/Segment.h \ - $(top_srcdir)/include/graphite/SegmentPainter.h -graphiteincludedir = $(includedir)/graphite -libgraphite_la_SOURCES = $(genericdir)/Debug.cpp \ - $(genericdir)/Util.cpp $(fontdir)/Font.cpp \ - $(fontdir)/TtfUtil.cpp $(fontdir)/FileFont.cpp \ - $(segmentdir)/FileInput.cpp $(segmentdir)/FontCache.cpp \ - $(segmentdir)/FontFace.cpp $(segmentdir)/GrCharStream.cpp \ - $(segmentdir)/GrClassTable.cpp $(segmentdir)/GrEngine.cpp \ - $(segmentdir)/GrFeature.cpp $(segmentdir)/GrFSM.cpp \ - $(segmentdir)/GrGlyphTable.cpp \ - $(segmentdir)/GrPassActionCode.cpp $(segmentdir)/GrPass.cpp \ - $(segmentdir)/GrSlotState.cpp $(segmentdir)/GrSlotStream.cpp \ - $(segmentdir)/GrTableManager.cpp $(segmentdir)/MemoryUsage.cpp \ - $(segmentdir)/Platform.cpp $(segmentdir)/SegmentAux.cpp \ - $(segmentdir)/Segment.cpp $(segmentdir)/TestFSM.cpp \ - $(segmentdir)/TestPasses.cpp $(segmentdir)/TransductionLog.cpp \ - $(painterdir)/SegmentPainter.cpp -genericdir = $(top_srcdir)/src/generic -fontdir = $(top_srcdir)/src/font -segmentdir = $(top_srcdir)/src/segment -painterdir = $(top_srcdir)/src/painter -all: all-am - -.SUFFIXES: -.SUFFIXES: .cpp .lo .o .obj -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/../include/Makefile.am $(srcdir)/generic/Makefile.am $(srcdir)/font/Makefile.am $(srcdir)/segment/Makefile.am $(srcdir)/painter/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --foreign src/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -install-libLTLIBRARIES: $(lib_LTLIBRARIES) - @$(NORMAL_INSTALL) - test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" - @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - f=$(am__strip_dir) \ - echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ - $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ - else :; fi; \ - done - -uninstall-libLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ - p=$(am__strip_dir) \ - echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \ - $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \ - done - -clean-libLTLIBRARIES: - -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) - @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libgraphite.la: $(libgraphite_la_OBJECTS) $(libgraphite_la_DEPENDENCIES) - $(libgraphite_la_LINK) -rpath $(libdir) $(libgraphite_la_OBJECTS) $(libgraphite_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Debug.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FileFont.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FileInput.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Font.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FontCache.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FontFace.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GrCharStream.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GrClassTable.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GrEngine.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GrFSM.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GrFeature.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GrGlyphTable.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GrPass.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GrPassActionCode.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GrSlotState.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GrSlotStream.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GrTableManager.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MemoryUsage.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Platform.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Segment.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SegmentAux.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SegmentPainter.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TestFSM.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TestPasses.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TransductionLog.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TtfUtil.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Util.Plo@am__quote@ - -.cpp.o: -@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< - -.cpp.obj: -@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` - -.cpp.lo: -@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< - -Debug.lo: $(genericdir)/Debug.cpp -@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Debug.lo -MD -MP -MF $(DEPDIR)/Debug.Tpo -c -o Debug.lo `test -f '$(genericdir)/Debug.cpp' || echo '$(srcdir)/'`$(genericdir)/Debug.cpp -@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/Debug.Tpo $(DEPDIR)/Debug.Plo -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(genericdir)/Debug.cpp' object='Debug.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Debug.lo `test -f '$(genericdir)/Debug.cpp' || echo '$(srcdir)/'`$(genericdir)/Debug.cpp - -Util.lo: $(genericdir)/Util.cpp -@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Util.lo -MD -MP -MF $(DEPDIR)/Util.Tpo -c -o Util.lo `test -f '$(genericdir)/Util.cpp' || echo '$(srcdir)/'`$(genericdir)/Util.cpp -@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/Util.Tpo $(DEPDIR)/Util.Plo -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(genericdir)/Util.cpp' object='Util.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Util.lo `test -f '$(genericdir)/Util.cpp' || echo '$(srcdir)/'`$(genericdir)/Util.cpp - -Font.lo: $(fontdir)/Font.cpp -@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Font.lo -MD -MP -MF $(DEPDIR)/Font.Tpo -c -o Font.lo `test -f '$(fontdir)/Font.cpp' || echo '$(srcdir)/'`$(fontdir)/Font.cpp -@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/Font.Tpo $(DEPDIR)/Font.Plo -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(fontdir)/Font.cpp' object='Font.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Font.lo `test -f '$(fontdir)/Font.cpp' || echo '$(srcdir)/'`$(fontdir)/Font.cpp - -TtfUtil.lo: $(fontdir)/TtfUtil.cpp -@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT TtfUtil.lo -MD -MP -MF $(DEPDIR)/TtfUtil.Tpo -c -o TtfUtil.lo `test -f '$(fontdir)/TtfUtil.cpp' || echo '$(srcdir)/'`$(fontdir)/TtfUtil.cpp -@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/TtfUtil.Tpo $(DEPDIR)/TtfUtil.Plo -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(fontdir)/TtfUtil.cpp' object='TtfUtil.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o TtfUtil.lo `test -f '$(fontdir)/TtfUtil.cpp' || echo '$(srcdir)/'`$(fontdir)/TtfUtil.cpp - -FileFont.lo: $(fontdir)/FileFont.cpp -@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT FileFont.lo -MD -MP -MF $(DEPDIR)/FileFont.Tpo -c -o FileFont.lo `test -f '$(fontdir)/FileFont.cpp' || echo '$(srcdir)/'`$(fontdir)/FileFont.cpp -@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/FileFont.Tpo $(DEPDIR)/FileFont.Plo -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(fontdir)/FileFont.cpp' object='FileFont.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o FileFont.lo `test -f '$(fontdir)/FileFont.cpp' || echo '$(srcdir)/'`$(fontdir)/FileFont.cpp - -FileInput.lo: $(segmentdir)/FileInput.cpp -@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT FileInput.lo -MD -MP -MF $(DEPDIR)/FileInput.Tpo -c -o FileInput.lo `test -f '$(segmentdir)/FileInput.cpp' || echo '$(srcdir)/'`$(segmentdir)/FileInput.cpp -@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/FileInput.Tpo $(DEPDIR)/FileInput.Plo -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(segmentdir)/FileInput.cpp' object='FileInput.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o FileInput.lo `test -f '$(segmentdir)/FileInput.cpp' || echo '$(srcdir)/'`$(segmentdir)/FileInput.cpp - -FontCache.lo: $(segmentdir)/FontCache.cpp -@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT FontCache.lo -MD -MP -MF $(DEPDIR)/FontCache.Tpo -c -o FontCache.lo `test -f '$(segmentdir)/FontCache.cpp' || echo '$(srcdir)/'`$(segmentdir)/FontCache.cpp -@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/FontCache.Tpo $(DEPDIR)/FontCache.Plo -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(segmentdir)/FontCache.cpp' object='FontCache.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o FontCache.lo `test -f '$(segmentdir)/FontCache.cpp' || echo '$(srcdir)/'`$(segmentdir)/FontCache.cpp - -FontFace.lo: $(segmentdir)/FontFace.cpp -@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT FontFace.lo -MD -MP -MF $(DEPDIR)/FontFace.Tpo -c -o FontFace.lo `test -f '$(segmentdir)/FontFace.cpp' || echo '$(srcdir)/'`$(segmentdir)/FontFace.cpp -@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/FontFace.Tpo $(DEPDIR)/FontFace.Plo -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(segmentdir)/FontFace.cpp' object='FontFace.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o FontFace.lo `test -f '$(segmentdir)/FontFace.cpp' || echo '$(srcdir)/'`$(segmentdir)/FontFace.cpp - -GrCharStream.lo: $(segmentdir)/GrCharStream.cpp -@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT GrCharStream.lo -MD -MP -MF $(DEPDIR)/GrCharStream.Tpo -c -o GrCharStream.lo `test -f '$(segmentdir)/GrCharStream.cpp' || echo '$(srcdir)/'`$(segmentdir)/GrCharStream.cpp -@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/GrCharStream.Tpo $(DEPDIR)/GrCharStream.Plo -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(segmentdir)/GrCharStream.cpp' object='GrCharStream.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o GrCharStream.lo `test -f '$(segmentdir)/GrCharStream.cpp' || echo '$(srcdir)/'`$(segmentdir)/GrCharStream.cpp - -GrClassTable.lo: $(segmentdir)/GrClassTable.cpp -@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT GrClassTable.lo -MD -MP -MF $(DEPDIR)/GrClassTable.Tpo -c -o GrClassTable.lo `test -f '$(segmentdir)/GrClassTable.cpp' || echo '$(srcdir)/'`$(segmentdir)/GrClassTable.cpp -@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/GrClassTable.Tpo $(DEPDIR)/GrClassTable.Plo -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(segmentdir)/GrClassTable.cpp' object='GrClassTable.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o GrClassTable.lo `test -f '$(segmentdir)/GrClassTable.cpp' || echo '$(srcdir)/'`$(segmentdir)/GrClassTable.cpp - -GrEngine.lo: $(segmentdir)/GrEngine.cpp -@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT GrEngine.lo -MD -MP -MF $(DEPDIR)/GrEngine.Tpo -c -o GrEngine.lo `test -f '$(segmentdir)/GrEngine.cpp' || echo '$(srcdir)/'`$(segmentdir)/GrEngine.cpp -@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/GrEngine.Tpo $(DEPDIR)/GrEngine.Plo -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(segmentdir)/GrEngine.cpp' object='GrEngine.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o GrEngine.lo `test -f '$(segmentdir)/GrEngine.cpp' || echo '$(srcdir)/'`$(segmentdir)/GrEngine.cpp - -GrFeature.lo: $(segmentdir)/GrFeature.cpp -@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT GrFeature.lo -MD -MP -MF $(DEPDIR)/GrFeature.Tpo -c -o GrFeature.lo `test -f '$(segmentdir)/GrFeature.cpp' || echo '$(srcdir)/'`$(segmentdir)/GrFeature.cpp -@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/GrFeature.Tpo $(DEPDIR)/GrFeature.Plo -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(segmentdir)/GrFeature.cpp' object='GrFeature.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o GrFeature.lo `test -f '$(segmentdir)/GrFeature.cpp' || echo '$(srcdir)/'`$(segmentdir)/GrFeature.cpp - -GrFSM.lo: $(segmentdir)/GrFSM.cpp -@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT GrFSM.lo -MD -MP -MF $(DEPDIR)/GrFSM.Tpo -c -o GrFSM.lo `test -f '$(segmentdir)/GrFSM.cpp' || echo '$(srcdir)/'`$(segmentdir)/GrFSM.cpp -@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/GrFSM.Tpo $(DEPDIR)/GrFSM.Plo -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(segmentdir)/GrFSM.cpp' object='GrFSM.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o GrFSM.lo `test -f '$(segmentdir)/GrFSM.cpp' || echo '$(srcdir)/'`$(segmentdir)/GrFSM.cpp - -GrGlyphTable.lo: $(segmentdir)/GrGlyphTable.cpp -@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT GrGlyphTable.lo -MD -MP -MF $(DEPDIR)/GrGlyphTable.Tpo -c -o GrGlyphTable.lo `test -f '$(segmentdir)/GrGlyphTable.cpp' || echo '$(srcdir)/'`$(segmentdir)/GrGlyphTable.cpp -@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/GrGlyphTable.Tpo $(DEPDIR)/GrGlyphTable.Plo -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(segmentdir)/GrGlyphTable.cpp' object='GrGlyphTable.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o GrGlyphTable.lo `test -f '$(segmentdir)/GrGlyphTable.cpp' || echo '$(srcdir)/'`$(segmentdir)/GrGlyphTable.cpp - -GrPassActionCode.lo: $(segmentdir)/GrPassActionCode.cpp -@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT GrPassActionCode.lo -MD -MP -MF $(DEPDIR)/GrPassActionCode.Tpo -c -o GrPassActionCode.lo `test -f '$(segmentdir)/GrPassActionCode.cpp' || echo '$(srcdir)/'`$(segmentdir)/GrPassActionCode.cpp -@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/GrPassActionCode.Tpo $(DEPDIR)/GrPassActionCode.Plo -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(segmentdir)/GrPassActionCode.cpp' object='GrPassActionCode.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o GrPassActionCode.lo `test -f '$(segmentdir)/GrPassActionCode.cpp' || echo '$(srcdir)/'`$(segmentdir)/GrPassActionCode.cpp - -GrPass.lo: $(segmentdir)/GrPass.cpp -@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT GrPass.lo -MD -MP -MF $(DEPDIR)/GrPass.Tpo -c -o GrPass.lo `test -f '$(segmentdir)/GrPass.cpp' || echo '$(srcdir)/'`$(segmentdir)/GrPass.cpp -@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/GrPass.Tpo $(DEPDIR)/GrPass.Plo -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(segmentdir)/GrPass.cpp' object='GrPass.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o GrPass.lo `test -f '$(segmentdir)/GrPass.cpp' || echo '$(srcdir)/'`$(segmentdir)/GrPass.cpp - -GrSlotState.lo: $(segmentdir)/GrSlotState.cpp -@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT GrSlotState.lo -MD -MP -MF $(DEPDIR)/GrSlotState.Tpo -c -o GrSlotState.lo `test -f '$(segmentdir)/GrSlotState.cpp' || echo '$(srcdir)/'`$(segmentdir)/GrSlotState.cpp -@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/GrSlotState.Tpo $(DEPDIR)/GrSlotState.Plo -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(segmentdir)/GrSlotState.cpp' object='GrSlotState.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o GrSlotState.lo `test -f '$(segmentdir)/GrSlotState.cpp' || echo '$(srcdir)/'`$(segmentdir)/GrSlotState.cpp - -GrSlotStream.lo: $(segmentdir)/GrSlotStream.cpp -@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT GrSlotStream.lo -MD -MP -MF $(DEPDIR)/GrSlotStream.Tpo -c -o GrSlotStream.lo `test -f '$(segmentdir)/GrSlotStream.cpp' || echo '$(srcdir)/'`$(segmentdir)/GrSlotStream.cpp -@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/GrSlotStream.Tpo $(DEPDIR)/GrSlotStream.Plo -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(segmentdir)/GrSlotStream.cpp' object='GrSlotStream.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o GrSlotStream.lo `test -f '$(segmentdir)/GrSlotStream.cpp' || echo '$(srcdir)/'`$(segmentdir)/GrSlotStream.cpp - -GrTableManager.lo: $(segmentdir)/GrTableManager.cpp -@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT GrTableManager.lo -MD -MP -MF $(DEPDIR)/GrTableManager.Tpo -c -o GrTableManager.lo `test -f '$(segmentdir)/GrTableManager.cpp' || echo '$(srcdir)/'`$(segmentdir)/GrTableManager.cpp -@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/GrTableManager.Tpo $(DEPDIR)/GrTableManager.Plo -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(segmentdir)/GrTableManager.cpp' object='GrTableManager.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o GrTableManager.lo `test -f '$(segmentdir)/GrTableManager.cpp' || echo '$(srcdir)/'`$(segmentdir)/GrTableManager.cpp - -MemoryUsage.lo: $(segmentdir)/MemoryUsage.cpp -@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT MemoryUsage.lo -MD -MP -MF $(DEPDIR)/MemoryUsage.Tpo -c -o MemoryUsage.lo `test -f '$(segmentdir)/MemoryUsage.cpp' || echo '$(srcdir)/'`$(segmentdir)/MemoryUsage.cpp -@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/MemoryUsage.Tpo $(DEPDIR)/MemoryUsage.Plo -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(segmentdir)/MemoryUsage.cpp' object='MemoryUsage.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o MemoryUsage.lo `test -f '$(segmentdir)/MemoryUsage.cpp' || echo '$(srcdir)/'`$(segmentdir)/MemoryUsage.cpp - -Platform.lo: $(segmentdir)/Platform.cpp -@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Platform.lo -MD -MP -MF $(DEPDIR)/Platform.Tpo -c -o Platform.lo `test -f '$(segmentdir)/Platform.cpp' || echo '$(srcdir)/'`$(segmentdir)/Platform.cpp -@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/Platform.Tpo $(DEPDIR)/Platform.Plo -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(segmentdir)/Platform.cpp' object='Platform.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Platform.lo `test -f '$(segmentdir)/Platform.cpp' || echo '$(srcdir)/'`$(segmentdir)/Platform.cpp - -SegmentAux.lo: $(segmentdir)/SegmentAux.cpp -@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT SegmentAux.lo -MD -MP -MF $(DEPDIR)/SegmentAux.Tpo -c -o SegmentAux.lo `test -f '$(segmentdir)/SegmentAux.cpp' || echo '$(srcdir)/'`$(segmentdir)/SegmentAux.cpp -@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/SegmentAux.Tpo $(DEPDIR)/SegmentAux.Plo -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(segmentdir)/SegmentAux.cpp' object='SegmentAux.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o SegmentAux.lo `test -f '$(segmentdir)/SegmentAux.cpp' || echo '$(srcdir)/'`$(segmentdir)/SegmentAux.cpp - -Segment.lo: $(segmentdir)/Segment.cpp -@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Segment.lo -MD -MP -MF $(DEPDIR)/Segment.Tpo -c -o Segment.lo `test -f '$(segmentdir)/Segment.cpp' || echo '$(srcdir)/'`$(segmentdir)/Segment.cpp -@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/Segment.Tpo $(DEPDIR)/Segment.Plo -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(segmentdir)/Segment.cpp' object='Segment.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Segment.lo `test -f '$(segmentdir)/Segment.cpp' || echo '$(srcdir)/'`$(segmentdir)/Segment.cpp - -TestFSM.lo: $(segmentdir)/TestFSM.cpp -@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT TestFSM.lo -MD -MP -MF $(DEPDIR)/TestFSM.Tpo -c -o TestFSM.lo `test -f '$(segmentdir)/TestFSM.cpp' || echo '$(srcdir)/'`$(segmentdir)/TestFSM.cpp -@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/TestFSM.Tpo $(DEPDIR)/TestFSM.Plo -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(segmentdir)/TestFSM.cpp' object='TestFSM.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o TestFSM.lo `test -f '$(segmentdir)/TestFSM.cpp' || echo '$(srcdir)/'`$(segmentdir)/TestFSM.cpp - -TestPasses.lo: $(segmentdir)/TestPasses.cpp -@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT TestPasses.lo -MD -MP -MF $(DEPDIR)/TestPasses.Tpo -c -o TestPasses.lo `test -f '$(segmentdir)/TestPasses.cpp' || echo '$(srcdir)/'`$(segmentdir)/TestPasses.cpp -@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/TestPasses.Tpo $(DEPDIR)/TestPasses.Plo -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(segmentdir)/TestPasses.cpp' object='TestPasses.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o TestPasses.lo `test -f '$(segmentdir)/TestPasses.cpp' || echo '$(srcdir)/'`$(segmentdir)/TestPasses.cpp - -TransductionLog.lo: $(segmentdir)/TransductionLog.cpp -@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT TransductionLog.lo -MD -MP -MF $(DEPDIR)/TransductionLog.Tpo -c -o TransductionLog.lo `test -f '$(segmentdir)/TransductionLog.cpp' || echo '$(srcdir)/'`$(segmentdir)/TransductionLog.cpp -@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/TransductionLog.Tpo $(DEPDIR)/TransductionLog.Plo -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(segmentdir)/TransductionLog.cpp' object='TransductionLog.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o TransductionLog.lo `test -f '$(segmentdir)/TransductionLog.cpp' || echo '$(srcdir)/'`$(segmentdir)/TransductionLog.cpp - -SegmentPainter.lo: $(painterdir)/SegmentPainter.cpp -@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT SegmentPainter.lo -MD -MP -MF $(DEPDIR)/SegmentPainter.Tpo -c -o SegmentPainter.lo `test -f '$(painterdir)/SegmentPainter.cpp' || echo '$(srcdir)/'`$(painterdir)/SegmentPainter.cpp -@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/SegmentPainter.Tpo $(DEPDIR)/SegmentPainter.Plo -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(painterdir)/SegmentPainter.cpp' object='SegmentPainter.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o SegmentPainter.lo `test -f '$(painterdir)/SegmentPainter.cpp' || echo '$(srcdir)/'`$(painterdir)/SegmentPainter.cpp - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs -install-graphiteincludeHEADERS: $(graphiteinclude_HEADERS) - @$(NORMAL_INSTALL) - test -z "$(graphiteincludedir)" || $(MKDIR_P) "$(DESTDIR)$(graphiteincludedir)" - @list='$(graphiteinclude_HEADERS)'; for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - f=$(am__strip_dir) \ - echo " $(graphiteincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(graphiteincludedir)/$$f'"; \ - $(graphiteincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(graphiteincludedir)/$$f"; \ - done - -uninstall-graphiteincludeHEADERS: - @$(NORMAL_UNINSTALL) - @list='$(graphiteinclude_HEADERS)'; for p in $$list; do \ - f=$(am__strip_dir) \ - echo " rm -f '$(DESTDIR)$(graphiteincludedir)/$$f'"; \ - rm -f "$(DESTDIR)$(graphiteincludedir)/$$f"; \ - done - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) $(HEADERS) -installdirs: - for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(graphiteincludedir)"; do \ - test -z "$$dir" || $(MKDIR_P) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ - mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: install-graphiteincludeHEADERS - -install-dvi: install-dvi-am - -install-exec-am: install-libLTLIBRARIES - -install-html: install-html-am - -install-info: install-info-am - -install-man: - -install-pdf: install-pdf-am - -install-ps: install-ps-am - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-graphiteincludeHEADERS \ - uninstall-libLTLIBRARIES - -.MAKE: install-am install-strip - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libLTLIBRARIES clean-libtool ctags distclean \ - distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am \ - install-graphiteincludeHEADERS install-html install-html-am \ - install-info install-info-am install-libLTLIBRARIES \ - install-man install-pdf install-pdf-am install-ps \ - install-ps-am install-strip installcheck installcheck-am \ - installdirs maintainer-clean maintainer-clean-generic \ - mostlyclean mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ - uninstall-am uninstall-graphiteincludeHEADERS \ - uninstall-libLTLIBRARIES - - -#EXTRA_DIST += $(painterdir)/*.h -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/Build/source/libs/graphite/engine-2.3.1/src/font/FileFont.cpp b/Build/source/libs/graphite/engine-2.3.1/src/font/FileFont.cpp deleted file mode 100644 index 59e69903fce..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/src/font/FileFont.cpp +++ /dev/null @@ -1,429 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 1999 - 2008 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: FileFont.cpp -Responsibility: Keith Stribley -Last reviewed: Not yet. - -Description: - A Font is an object that represents a font-family + bold + italic setting, that contains - Graphite tables. -----------------------------------------------------------------------------------------------*/ - -#include "Main.h" - -#include "FontTableCache.h" -#include "FileFont.h" -#include - - -// TBD do this properly -#define FUDGE_FACTOR 72 -#define fix26_6(x) (x >> 6) + (x & 32 ? (x > 0 ? 1 : 0) : (x < 0 ? -1 : 0)) - -namespace gr -{ - - -FileFont::FileFont() - : Font(), - m_pfile(NULL), - m_pTableCache(NULL), - m_mAscent(0), - m_mDescent(0), - m_mEmSquare(0), - m_pointSize(0), - m_dpiX(FUDGE_FACTOR), - m_dpiY(FUDGE_FACTOR), - m_fIsValid(false), - m_pHeader(NULL), - m_pTableDir(NULL), - m_xScale(1.0f), - m_yScale(1.0f) -{ - m_fItalic = false; - m_fBold = false; - // colors are not used - m_clrFore = (unsigned long)kclrBlack; - m_clrBack = (unsigned long)kclrTransparent; -} - -FileFont::FileFont(FILE * pfile, float pointSize, - unsigned int dpiX, unsigned int dpiY) - : Font(), - m_pfile(pfile), - m_pTableCache(NULL), - m_mAscent(0), - m_mDescent(0), - m_mEmSquare(0), - m_pointSize(pointSize), - m_dpiX(dpiX), - m_dpiY(dpiY), - m_fIsValid(false), - m_pHeader(NULL), - m_pTableDir(NULL), - m_xScale(1.0f), - m_yScale(1.0f) -{ - Assert(m_pfile); // shouldn't be null - initializeFromFace(); - -} - -FileFont::FileFont(char * fileName, float pointSize, - unsigned int dpiX, unsigned int dpiY) - : Font(), - m_pfile(NULL), - m_pTableCache(NULL), - m_mAscent(0), - m_mDescent(0), - m_mEmSquare(0), - m_pointSize(pointSize), - m_dpiX(dpiX), - m_dpiY(dpiY), - m_fIsValid(false), - m_pHeader(NULL), - m_pTableDir(NULL), - m_xScale(1.0f), - m_yScale(1.0f) -{ - Assert(fileName); // shouldn't be null but we play safe anyway - m_pfile = fopen(fileName, "rb"); - - initializeFromFace(); -} - -FileFont::FileFont(std::string fileName, float pointSize, - unsigned int dpiX, unsigned int dpiY) - : Font(), - m_pfile(NULL), - m_pTableCache(NULL), - m_mAscent(0), - m_mDescent(0), - m_mEmSquare(0), - m_pointSize(pointSize), - m_dpiX(dpiX), - m_dpiY(dpiY), - m_fIsValid(false), - m_pHeader(NULL), - m_pTableDir(NULL), - m_xScale(1.0f), - m_yScale(1.0f) -{ - Assert(fileName.length()); // shouldn't be null but we play safe anyway - m_pfile = fopen(fileName.c_str(), "rb"); - - initializeFromFace(); -} - - -void -FileFont::initializeFromFace() -{ - if (m_dpiY == 0) m_dpiY = m_dpiX; - m_fItalic = false; - m_fBold = false; - // colors are not used - m_clrFore = (unsigned long)kclrBlack; - m_clrBack = (unsigned long)kclrTransparent; - - if (m_pfile) - { - size_t lOffset, lSize; - TtfUtil::GetHeaderInfo(lOffset, lSize); - m_pHeader = new byte [lSize]; - m_fIsValid = true; - if (!m_pHeader) - { - m_fIsValid = false; - return; - } - m_fIsValid = (fseek(m_pfile, lOffset, SEEK_SET) == 0); - size_t bytesRead = fread(m_pHeader, 1, lSize, m_pfile); - Assert(bytesRead == lSize); - m_fIsValid = TtfUtil::CheckHeader(m_pHeader); - - if (!m_fIsValid) return; - m_fIsValid = TtfUtil::GetTableDirInfo(m_pHeader, lOffset, lSize); - m_pTableDir = new byte[lSize]; - if (!m_pTableDir) - { - m_fIsValid = false; - return; - } - // if lOffset hasn't changed this isn't needed - fseek(m_pfile, lOffset, SEEK_SET); - bytesRead = fread(m_pTableDir, 1, lSize, m_pfile); - Assert(bytesRead == lSize); - - // now read head tables - m_fIsValid = TtfUtil::GetTableInfo(ktiOs2, m_pHeader, m_pTableDir, - lOffset, lSize); - if (!m_fIsValid) - { - return; - } - byte * pTable = readTable(ktiOs2, lSize); - // get ascent, descent, style while we have the OS2 table loaded - if (!m_fIsValid || !pTable) - { - return; - } - m_fIsValid = TtfUtil::FontOs2Style(pTable, m_fBold, m_fItalic); - m_mAscent = static_cast(TtfUtil::FontAscent(pTable)); - m_mDescent = static_cast(TtfUtil::FontDescent(pTable)); - - pTable = readTable(ktiName, lSize); - if (!m_fIsValid || !pTable) - { - return; - } - if (!TtfUtil::Get31EngFamilyInfo(pTable, lOffset, lSize)) - { - // not English name - m_fIsValid = false; - return; - } - Assert(lSize %2 == 0);// should be utf16 - utf16 rgchwFace[128]; - int cchw = (lSize / isizeof(utf16)) + 1; - cchw = min(cchw, 128); - utf16 * pTable16 = reinterpret_cast(pTable + lOffset); - std::copy(pTable16, pTable16 + cchw - 1, rgchwFace); - rgchwFace[cchw - 1] = 0; // zero terminate - TtfUtil::SwapWString(rgchwFace, cchw - 1); -// We could use something like "if (sizeof(std::wstring::value_type) == 4)" here, -// but a compile-time switch is preferable. -#if SIZEOF_WCHAR_T == 4 - for (int cch16 = 0; cch16 < cchw; ) - { - int cch16Used = 0; - utf32 ch32 = GrCharStream::Utf16ToUtf32(&(rgchwFace[cch16]), - cchw - cch16, &cch16Used); - m_stuFaceName.push_back(ch32); - cch16 += cch16Used; - } -// } -#else - // m_stuFaceName.assign(rgchwFace); - // VS 2005, MinGW32, and AIX need this: - for (int cch16 = 0; cch16 < cchw; cch16++) - m_stuFaceName.push_back(rgchwFace[cch16]); -#endif - pTable = readTable(ktiHead, lSize); - if (!m_fIsValid || !pTable) - { - return; - } - m_mEmSquare = static_cast(TtfUtil::DesignUnits(pTable)); - // can now set the scale - m_xScale = scaleFromDpi(m_dpiX); - m_yScale = scaleFromDpi(m_dpiY); - } - else - { - m_fIsValid = false; - } -} - -byte * -FileFont::readTable(int /*TableId*/ tid, size_t & size) -{ - const TableId tableId = TableId(tid); - bool isValid = true; - size_t lOffset = 0, lSize = 0; - if (!m_pTableCache) - { - m_pTableCache = new FontTableCache(); - } - if (!m_pTableCache) return NULL; - - byte * pTable = m_pTableCache->getTable(tableId); - size = m_pTableCache->getTableSize(tableId); - // check whether it is already in the cache - if (pTable) return pTable; - isValid &= TtfUtil::GetTableInfo(tableId, m_pHeader, m_pTableDir, - lOffset, lSize); - if (!isValid) - return NULL; - fseek(m_pfile, lOffset, SEEK_SET); - // only allocate if needed - pTable = m_pTableCache->allocateTable(tableId, lSize); - - if (!pTable) - { - isValid = false; - return NULL; - } - size_t bytesRead = fread(pTable, 1, lSize, m_pfile); - isValid = bytesRead == lSize; - if (isValid) - { - isValid &= TtfUtil::CheckTable(tableId, pTable, lSize); - } - if (!isValid) - { - return 0; - } - size = lSize; - return pTable; -} - - -FileFont::~FileFont() -{ - - // if this is the last copy of the font sharing these tables - // delete them - if (m_pTableCache) - { - m_pTableCache->decrementFontCount(); - if (m_pTableCache->getFontCount() == 0) - { - delete [] m_pHeader; - delete [] m_pTableDir; - delete m_pTableCache; - m_pTableCache = NULL; - if (m_pfile) - fclose(m_pfile); - } - } - else - { - delete [] m_pHeader; - delete [] m_pTableDir; - if (m_pfile) - fclose(m_pfile); - } - // note the DecFontCount(); is done in the Font base class -} - -Font * FileFont::copyThis() -{ - FileFont * copy = new FileFont(*this); - return copy; -} - -/** -* A copy constructor that allows a change of point size or dpi -* The underlying table cache will be shared between the fonts, so -* this should have a low overhead. -*/ -FileFont::FileFont(const FileFont & font, float pointSize, - unsigned int dpiX, unsigned int dpiY) -: Font(font), - m_pfile(font.m_pfile), - m_mAscent(font.m_mAscent), - m_mDescent(font.m_mDescent), - m_mEmSquare(font.m_mEmSquare), - m_pointSize(font.m_pointSize), - m_dpiX(font.m_dpiX), - m_dpiY(font.m_dpiY), - m_fIsValid(font.m_fIsValid), - m_pHeader(font.m_pHeader), - m_pTableDir(font.m_pTableDir), - m_xScale(font.m_xScale), - m_yScale(font.m_yScale) -{ - if (pointSize > 0) - { - m_pointSize = pointSize; - if (dpiX > 0) - { - m_dpiX = dpiX; - if (dpiY > 0) m_dpiY = dpiY; - else dpiY = dpiX; - } - m_xScale = scaleFromDpi(m_dpiX); - m_yScale = scaleFromDpi(m_dpiY); - } - m_fItalic = font.m_fItalic; - m_fBold = font.m_fBold; - // colors are not used - m_clrFore = font.m_clrFore; - m_clrBack = font.m_clrBack; - m_stuFaceName.assign(font.m_stuFaceName); - - m_pTableCache = font.m_pTableCache; - // use the same table cache between instances - if (m_pTableCache) - m_pTableCache->incrementFontCount(); - - - // I dont' see why we need to reget the face, but WinFont does - //m_pfface = FontFace::GetFontFace(this, m_fpropDef.szFaceName, - // m_fpropDef.fBold, m_fpropDef.fItalic); -} - - - - //virtual FontErrorCode isValidForGraphite(int * pnVersion = NULL, int * pnSubVersion = NULL); - -/*---------------------------------------------------------------------------------------------- - Read a table from the font. -----------------------------------------------------------------------------------------------*/ -const void * -FileFont::getTable(fontTableId32 tableID, size_t * pcbSize) -{ - *pcbSize = 0; - // use a cache to reduce the number of times tables have to be reloaded - if (m_pTableCache == NULL) - { - // constructor automatically sets the font count to 1 - m_pTableCache = new FontTableCache(); - } - TableId tid; - for (int i = 0; i(i); - if (tableID == TtfUtil::TableIdTag(tid)) - { - if (m_pTableCache->getTable(tid)) - { - *pcbSize = m_pTableCache->getTableSize(tid); - return m_pTableCache->getTable(tid); - } - break; - } - } - Assert(tid < ktiLast); - size_t tableSize = 0; - void * pTable = readTable(tid, tableSize); - *pcbSize = static_cast(tableSize); - return pTable; -} - - -void FileFont::getFontMetrics(float * pAscent, float * pDescent, - float * pEmSquare) -{ - if (pEmSquare) *pEmSquare = m_mEmSquare * m_xScale; - if (pAscent) *pAscent = m_mAscent * m_yScale; - if (pDescent) *pDescent = m_mDescent * m_yScale; -} - - -bool FileFont::FontHasGraphiteTables(FILE * file) -{ - FileFont testFont(file, 1.0f, FUDGE_FACTOR); - return testFont.fontHasGraphiteTables(); -} - -bool FileFont::FontHasGraphiteTables(char * fileName) -{ - FileFont testFont(fileName, 1.0f, FUDGE_FACTOR); - return testFont.fontHasGraphiteTables(); -} - -bool FileFont::fontHasGraphiteTables() -{ - size_t tableSize; - bool isGraphiteFont = m_fIsValid; - isGraphiteFont &= (readTable(ktiSilf, tableSize) != NULL); - return isGraphiteFont; -} - -} // namespace gr diff --git a/Build/source/libs/graphite/engine-2.3.1/src/font/Font.cpp b/Build/source/libs/graphite/engine-2.3.1/src/font/Font.cpp deleted file mode 100644 index 02a5769d809..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/src/font/Font.cpp +++ /dev/null @@ -1,949 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 1999 - 2008 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: Font.cpp -Responsibility: Sharon Correll -Last reviewed: Not yet. - -Description: - A font is an object that knows how to read tables from a (platform-specific) font resource. -----------------------------------------------------------------------------------------------*/ - -//:>******************************************************************************************** -//:> Include files -//:>******************************************************************************************** -#include "Main.h" -#ifdef _MSC_VER -#pragma hdrstop -#endif -// any other headers (not precompiled) - -#undef THIS_FILE -DEFINE_THIS_FILE - -//:End Ignore - -//:>******************************************************************************************** -//:> Forward declarations -//:>******************************************************************************************** - -//:>******************************************************************************************** -//:> Local Constants and static variables -//:>******************************************************************************************** - - -namespace gr -{ - -//:>******************************************************************************************** -//:> Font methods -//:>******************************************************************************************** - -/*---------------------------------------------------------------------------------------------- - Constructor. -----------------------------------------------------------------------------------------------*/ -Font::Font(const Font & fontSrc) : m_pfface(fontSrc.m_pfface), m_fTablesCached(false) -{ - if (m_pfface) - m_pfface->IncFontCount(); -} - -/*---------------------------------------------------------------------------------------------- - Destructor. -----------------------------------------------------------------------------------------------*/ -Font::~Font() -{ - if (m_pfface) - m_pfface->DecFontCount(); -} - -/*---------------------------------------------------------------------------------------------- - Mark the font-cache as to whether it should be deleted when all the font instances go away. -----------------------------------------------------------------------------------------------*/ -void Font::SetFlushMode(int flush) -{ - FontFace::SetFlushMode(flush); -} - -/*---------------------------------------------------------------------------------------------- - Cache the common tables if necessary. -----------------------------------------------------------------------------------------------*/ -void Font::EnsureTablesCached() -{ - if (m_fTablesCached) - return; - - size_t cbBogus; - m_pHead = getTable(TtfUtil::TableIdTag(ktiHead), &cbBogus); - m_pHmtx = getTable(TtfUtil::TableIdTag(ktiHmtx), &m_cbHmtxSize); - m_pGlyf = getTable(TtfUtil::TableIdTag(ktiGlyf), &cbBogus); - m_pLoca = getTable(TtfUtil::TableIdTag(ktiLoca), &m_cbLocaSize); - - // getTable can return 0 for the lengths if it is hard to calculate them, but it should - // never do that for hmtx or loca. - Assert(m_cbHmtxSize > 0); - Assert(m_cbLocaSize > 0); - - m_fTablesCached = true; -} - -/*---------------------------------------------------------------------------------------------- - Return the flush mode of the font-cache. -----------------------------------------------------------------------------------------------*/ -int Font::GetFlushMode() -{ - return FontFace::GetFlushMode(); -} - -/*---------------------------------------------------------------------------------------------- - Return the internal object representing the font-face. This is the object that is stored - in Graphite's internal cache. -----------------------------------------------------------------------------------------------*/ -inline FontFace & Font::fontFace(bool fDumbFallback) -{ - if (m_pfface == 0) - initialiseFontFace(fDumbFallback); - return *m_pfface; -} - -void Font::initialiseFontFace(bool fDumbFallback) -{ - std::wstring stuFaceName; - bool fBold, fItalic; - - UniqueCacheInfo(stuFaceName, fBold, fItalic); - - m_pfface = FontFace::GetFontFace(this, stuFaceName, fBold, fItalic, fDumbFallback); - - Assert(m_pfface != 0); - - m_pfface->IncFontCount(); - - FontException fexptn; - fexptn.version = -1; - fexptn.subVersion = -1; - if (m_pfface->BadFont(&fexptn.errorCode) - || (!fDumbFallback && m_pfface->DumbFallback(&fexptn.errorCode))) - { - throw fexptn; - } -} - -/*---------------------------------------------------------------------------------------------- - Return uniquely identifying information that will be used as the key for this font - in the font cache. This includes the font face name and the bold and italic flags. -----------------------------------------------------------------------------------------------*/ -void Font::UniqueCacheInfo(std::wstring & stuFace, bool & fBold, bool & fItalic) -{ - size_t cbSize; - const byte * pNameTbl = static_cast(getTable(TtfUtil::TableIdTag(ktiName), &cbSize)); - size_t lOffset, lSize; - if (!TtfUtil::Get31EngFamilyInfo(pNameTbl, lOffset, lSize)) - { - // TODO: try to find any name in any arbitrary language. - Assert(false); - return; - } - // byte * pvName = (byte *)pNameTbl + lOffset; - utf16 rgchwFace[128]; - const size_t cchw = min(long(lSize / sizeof(utf16)), long(sizeof rgchwFace - 1)); - const utf16 *src_start = reinterpret_cast(pNameTbl+ lOffset); - std::copy(src_start, src_start + cchw, rgchwFace); - rgchwFace[cchw] = 0; // zero terminate - TtfUtil::SwapWString(rgchwFace, cchw); - for (size_t ich16 = 0; ich16 < cchw; ich16++) // to handle situation where wchar_t is 4 bytes - stuFace.push_back(wchar_t(rgchwFace[ich16])); - ///stuFace.assign(rgchwFace, rgchwFace + cchw); - - const void * pOs2Tbl = getTable(TtfUtil::TableIdTag(ktiOs2), &cbSize); - TtfUtil::FontOs2Style(pOs2Tbl, fBold, fItalic); - // Do we need to compare the results from the OS2 table with the italic flag in the - // head table? (There is no requirement that they be consistent!) -} - - -/*---------------------------------------------------------------------------------------------- - A default unhinted implmentation of getGlyphPoint(..) -----------------------------------------------------------------------------------------------*/ -void Font::getGlyphPoint(gid16 glyphID, unsigned int pointNum, Point & pointReturn) -{ - EnsureTablesCached(); - - // Default values - pointReturn.x = 0; - pointReturn.y = 0; - - if (m_pGlyf == 0) return; - if (m_pHead == 0) return; - if (m_pLoca == 0) return; - - size_t cContours; - size_t cPoints; - - const size_t CONTOUR_BUF_SIZE = 16; - const size_t POINT_BUF_SIZE = 64; - // Fixed-size buffers that will be used in most cases: - bool rgfOnCurveFixedBuf[POINT_BUF_SIZE], *rgfOnCurveHeapBuf=0; - int rgnEndPtFixedBuf[CONTOUR_BUF_SIZE], *rgnEndPtHeapBuf=0, - rgnXFixedBuf[POINT_BUF_SIZE], *rgnXHeapBuf=0, - rgnYFixedBuf[POINT_BUF_SIZE], *rgnYHeapBuf=0; - - if (!TtfUtil::GlyfContourCount(glyphID, m_pGlyf, m_pLoca, m_cbLocaSize, m_pHead, cContours)) - return; // can't figure it out - - int * prgnEndPt = (cContours > CONTOUR_BUF_SIZE) ? - rgnEndPtHeapBuf = new int[cContours] : - rgnEndPtFixedBuf; - - if (!TtfUtil::GlyfContourEndPoints(glyphID, m_pGlyf, m_pLoca, m_cbLocaSize, m_pHead, - prgnEndPt, cContours)) - { - return; // should have been caught above - } - cPoints = prgnEndPt[cContours - 1] + 1; - - bool* prgfOnCurve = (cPoints > POINT_BUF_SIZE) ? rgfOnCurveHeapBuf= new bool[cPoints] : rgfOnCurveFixedBuf; - int * prgnX = (cPoints > POINT_BUF_SIZE) ? rgnXHeapBuf= new int[cPoints] : rgnXFixedBuf; - int * prgnY = (cPoints > POINT_BUF_SIZE) ? rgnYHeapBuf= new int[cPoints] : rgnYFixedBuf; - - if (TtfUtil::GlyfPoints(glyphID, m_pGlyf, m_pLoca, m_cbLocaSize, m_pHead, 0, 0, - prgnX, prgnY, prgfOnCurve, cPoints)) - { - float nPixEmSquare; - getFontMetrics(0, 0, &nPixEmSquare); - - const float nDesignUnitsPerPixel = float(TtfUtil::DesignUnits(m_pHead)) / nPixEmSquare; - pointReturn.x = prgnX[pointNum] / nDesignUnitsPerPixel; - pointReturn.y = prgnY[pointNum] / nDesignUnitsPerPixel; - } - - delete[] rgnEndPtHeapBuf; - delete[] rgfOnCurveHeapBuf; - delete[] rgnXHeapBuf; - delete[] rgnYHeapBuf; -} - - -/*---------------------------------------------------------------------------------------------- - A default unhinted implmentation of getGlyphMetrics(..) -----------------------------------------------------------------------------------------------*/ -void Font::getGlyphMetrics(gid16 glyphID, gr::Rect & boundingBox, gr::Point & advances) -{ - EnsureTablesCached(); - - // Setup default return values in case of failiure. - boundingBox.left = 0; - boundingBox.right = 0; - boundingBox.bottom = 0; - boundingBox.top = 0; - advances.x = 0; - advances.y = 0; - - if (m_pHead == 0) return; - - // Calculate the number of design units per pixel. - float pixelEmSquare; - getFontMetrics(0, 0, &pixelEmSquare); - const float pixelsPerDesignUnit = - pixelEmSquare / float(TtfUtil::DesignUnits(m_pHead)); - - // getTable can return 0 for the lengths if it is hard to calculate them, but it should - // never do that for hmtx or loca. - Assert(m_cbHmtxSize > 0); - - // Use the Hmtx and Head tables to find the glyph advances. - int lsb; - unsigned int advance = 0; - if (TtfUtil::HorMetrics(glyphID, m_pHmtx, m_cbHmtxSize, m_pHead, - lsb, advance)) - { - advances.x = (advance * pixelsPerDesignUnit); - advances.y = 0.0f; - } - - if (m_pGlyf == 0) return; - if (m_pLoca == 0) return; - Assert(m_cbLocaSize > 0); - - // Fetch the glyph bounding box. GlyphBox may return false for a whitespace glyph. - // Note that using GlyfBox here allows attachment points (ie, points lying outside - // the glyph's outline) to affect the bounding box, which might not be what we want. - int xMin, xMax, yMin, yMax; - if (TtfUtil::GlyfBox(glyphID, m_pGlyf, m_pLoca, m_cbLocaSize, m_pHead, - xMin, yMin, xMax, yMax)) - { - boundingBox.left = (xMin * pixelsPerDesignUnit); - boundingBox.bottom = (yMin * pixelsPerDesignUnit); - boundingBox.right = (xMax * pixelsPerDesignUnit); - boundingBox.top = (yMax * pixelsPerDesignUnit); - } -} - - -/*---------------------------------------------------------------------------------------------- - Return a pair of iterators over a sequence of features defined for the font. -----------------------------------------------------------------------------------------------*/ -std::pair Font::getFeatures() -{ - std::pair pairRet; - pairRet.first = BeginFeature(); - pairRet.second = EndFeature(); - return pairRet; -} - -/*---------------------------------------------------------------------------------------------- - Returns an iterator indicating the feature with the given ID. If no such feature, - returns the end iterator. -----------------------------------------------------------------------------------------------*/ -FeatureIterator Font::featureWithID(featid id) -{ - FeatureIterator fit = BeginFeature(); - FeatureIterator fitEnd = EndFeature(); - for ( ; fit != fitEnd ; ++fit) - { - if (*fit == id) - return fit; - } - return fitEnd; // invalid -} - -/*---------------------------------------------------------------------------------------------- - Returns the UI label for the indicated feature. Return false if there is no label for the - language, or it is empty. -----------------------------------------------------------------------------------------------*/ -bool Font::getFeatureLabel(FeatureIterator fit, lgid nLanguage, utf16 * label) -{ - return GetFeatureLabel(fit.m_ifeat, nLanguage, label); -} - -/*---------------------------------------------------------------------------------------------- - Returns an iterator pointing at the default value for the feature. -----------------------------------------------------------------------------------------------*/ -FeatureSettingIterator Font::getDefaultFeatureValue(FeatureIterator fit) -{ - size_t ifset = GetFeatureDefault(fit.m_ifeat); - FeatureSettingIterator fsit = fit.BeginSetting(); - fsit += ifset; - return fsit; -} - -/*---------------------------------------------------------------------------------------------- - Returns a pair of iterators spanning the defined settings for the feature. -----------------------------------------------------------------------------------------------*/ -std::pair - Font::getFeatureSettings(FeatureIterator fit) -{ - std::pair pairRet; - pairRet.first = fit.BeginSetting(); - pairRet.second = fit.EndSetting(); - return pairRet; -} - -/*---------------------------------------------------------------------------------------------- - Returns the UI label for the indicated feature. Return false if there is no label for the - language, or it is empty. -----------------------------------------------------------------------------------------------*/ -bool Font::getFeatureSettingLabel(FeatureSettingIterator fsit, lgid nLanguage, utf16 * label) -{ - //FeatureIterator * pfit = static_cast(fsit.m_pfit); - return GetFeatureSettingLabel(fsit.m_fit.m_ifeat, fsit.m_ifset, nLanguage, label); -} - -/*---------------------------------------------------------------------------------------------- - Private methods for feature and language access. -----------------------------------------------------------------------------------------------*/ -size_t Font::NumberOfFeatures() -{ - try { - return fontFace().NumberOfFeatures(); - } - catch (...) { return 0; } -} -featid Font::FeatureID(size_t ifeat) -{ - try { - return fontFace().FeatureID(ifeat); - } - catch (...) { return 0; } -} -size_t Font::FeatureWithID(featid id) -{ - try { - return fontFace().FeatureWithID(id); - } - catch (...) { return 0; } -} -bool Font::GetFeatureLabel(size_t ifeat, lgid language, utf16 * label) -{ - try { - return fontFace().GetFeatureLabel(ifeat, language, label); - } - catch (...) - { - *label = 0; - return false; - } -} -int Font::GetFeatureDefault(size_t ifeat) // index of default setting -{ - try { - return fontFace().GetFeatureDefault(ifeat); - } - catch (...) { return 0; } -} -size_t Font::NumberOfSettings(size_t ifeat) -{ - try { - return fontFace().NumberOfSettings(ifeat); - } - catch (...) { return 0; } -} -int Font::GetFeatureSettingValue(size_t ifeat, size_t ifset) -{ - try { - return fontFace().GetFeatureSettingValue(ifeat, ifset); - } - catch (...) { return 0; } -} -bool Font::GetFeatureSettingLabel(size_t ifeat, size_t ifset, lgid language, utf16 * label) -{ - try { - return fontFace().GetFeatureSettingLabel(ifeat, ifset, language, label); - } - catch (...) - { - *label = 0; - return false; - } -} -size_t Font::NumberOfFeatLangs() -{ - try { - return fontFace().NumberOfFeatLangs(); - } - catch (...) { return 0; } -} -short Font::FeatLabelLang(size_t ilang) -{ - try { - return fontFace().FeatLabelLang(ilang); - } - catch (...) { return 0; } -} -size_t Font::NumberOfLanguages() -{ - try { - return fontFace().NumberOfLanguages(); - } - catch (...) { return 0; } -} -isocode Font::LanguageCode(size_t ilang) -{ - try { - return fontFace().LanguageCode(ilang); - } - catch (...) - { - isocode ret; - std::fill_n(ret.rgch, sizeof(ret.rgch), '\0'); - return ret; - } -} - -/*---------------------------------------------------------------------------------------------- - Return a pair of iterators over a sequence of feature-label languages for this font. -----------------------------------------------------------------------------------------------*/ -std::pair Font::getFeatureLabelLanguages() -{ - std::pair pairRet; - pairRet.first = BeginFeatLang(); - pairRet.second = EndFeatLang(); - return pairRet; -} - -/*---------------------------------------------------------------------------------------------- - Return a pair of iterators over a sequence of languages defined for the font, that is, - those that have features specified for them. -----------------------------------------------------------------------------------------------*/ -std::pair Font::getSupportedLanguages() -{ - std::pair pairRet; - pairRet.first = BeginLanguage(); - pairRet.second = EndLanguage(); - return pairRet; -} - -/*---------------------------------------------------------------------------------------------- - Return a bitmap indicating which directions are supported by the font. -----------------------------------------------------------------------------------------------*/ -ScriptDirCode Font::getSupportedScriptDirections() const throw() -{ - try { - Font * pfontThis = const_cast(this); - FontFace & fface = pfontThis->fontFace(); - return fface.ScriptDirection(); - } - catch (...) { - return kfsdcHorizLtr; - } -} - -/*---------------------------------------------------------------------------------------------- - For segment creation. -----------------------------------------------------------------------------------------------*/ -void Font::RenderLineFillSegment(Segment * pseg, ITextSource * pts, LayoutEnvironment & layout, - toffset ichStart, toffset ichStop, float xsMaxWidth, bool fBacktracking) -{ - fontFace(layout.dumbFallback()).RenderLineFillSegment(pseg, this, pts, layout, - ichStart, ichStop, xsMaxWidth, fBacktracking); -} - -void Font::RenderRangeSegment(Segment * pseg, ITextSource * pts, LayoutEnvironment & layout, - toffset ichStart, toffset ichStop) -{ - fontFace(layout.dumbFallback()).RenderRangeSegment(pseg, this, pts, layout, ichStart, ichStop); -} - -void Font::RenderJustifiedSegment(Segment * pseg, ITextSource * pts, - LayoutEnvironment & layout, toffset ichStart, toffset ichStop, - float xsCurrentWidth, float xsDesiredWidth) -{ - fontFace(layout.dumbFallback()).RenderJustifiedSegment(pseg, this, pts, layout, - ichStart, ichStop, xsCurrentWidth, xsDesiredWidth); -} - -/*---------------------------------------------------------------------------------------------- - Feature iterators. -----------------------------------------------------------------------------------------------*/ -FeatureIterator Font::BeginFeature() -{ - FeatureIterator fit(this, 0, NumberOfFeatures()); - return fit; -} - -FeatureIterator Font::EndFeature() -{ - int cfeat = NumberOfFeatures(); - FeatureIterator fit (this, cfeat, cfeat); - return fit; -} - -/*---------------------------------------------------------------------------------------------- - Feature-label language iterators. -----------------------------------------------------------------------------------------------*/ -FeatLabelLangIterator Font::BeginFeatLang() -{ - FeatLabelLangIterator lgit(this, 0, NumberOfFeatLangs()); - return lgit; -} - -FeatLabelLangIterator Font::EndFeatLang() -{ - int clang = NumberOfFeatLangs(); - FeatLabelLangIterator lgit(this, clang, clang); - return lgit; -} - - -/*---------------------------------------------------------------------------------------------- - Language iterators. -----------------------------------------------------------------------------------------------*/ -LanguageIterator Font::BeginLanguage() -{ - LanguageIterator lgit(this, 0, NumberOfLanguages()); - return lgit; -} - -LanguageIterator Font::EndLanguage() -{ - int clang = NumberOfLanguages(); - LanguageIterator lgit(this, clang, clang); - return lgit; -} - - -/*---------------------------------------------------------------------------------------------- - Debugging. -----------------------------------------------------------------------------------------------*/ -//bool Font::DbgCheckFontCache() -//{ -// return FontFace::DbgCheckFontCache(); -//} - - -//:>******************************************************************************************** -//:> FeatureIterator methods -//:>******************************************************************************************** - -//FeatureIterator::FeatureIterator(FeatureIterator & fitToCopy) -//{ -// m_pfont = fitToCopy.m_pfont; -// m_ifeat = fitToCopy.m_ifeat; -// m_cfeat = fitToCopy.m_cfeat; -//} - -/*---------------------------------------------------------------------------------------------- - Dereference the iterator, returning a feature ID. -----------------------------------------------------------------------------------------------*/ -featid FeatureIterator::operator*() -{ - if (m_ifeat >= m_cfeat) - { - Assert(false); - return (unsigned int)kInvalid; - } - - return m_pfont->FeatureID(m_ifeat); -} - -/*---------------------------------------------------------------------------------------------- - Increment the iterator. -----------------------------------------------------------------------------------------------*/ -FeatureIterator FeatureIterator::operator++() -{ - if (m_ifeat >= m_cfeat) - { - // Can't increment. - Assert(false); - } - else - m_ifeat++; - - return *this; -} - -/*---------------------------------------------------------------------------------------------- - Increment the iterator by the given value. -----------------------------------------------------------------------------------------------*/ -FeatureIterator FeatureIterator::operator+=(int n) -{ - if (m_ifeat + n >= m_cfeat) - { - // Can't increment. - Assert(false); - m_ifeat = m_cfeat; - } - else if (m_ifeat + n < 0) - { - // Can't decrement. - Assert(false); - m_ifeat = 0; - } - else - m_ifeat += m_cfeat; - - return *this; -} - -/*---------------------------------------------------------------------------------------------- - Test whether the two iterators are equal. -----------------------------------------------------------------------------------------------*/ -bool FeatureIterator::operator==(FeatureIterator & fit) -{ - return (fit.m_ifeat == m_ifeat && fit.m_pfont == m_pfont); -} - -bool FeatureIterator::operator!=(FeatureIterator & fit) -{ - return (fit.m_ifeat != m_ifeat || fit.m_pfont != m_pfont); -} - -/*---------------------------------------------------------------------------------------------- - Return the number of items represented by the range of the two iterators. -----------------------------------------------------------------------------------------------*/ -int FeatureIterator::operator-(FeatureIterator & fit) -{ - if (m_pfont != fit.m_pfont) - { - throw; - } - return (m_ifeat - fit.m_ifeat); -} - - -/*---------------------------------------------------------------------------------------------- - Iterators. -----------------------------------------------------------------------------------------------*/ -FeatureSettingIterator FeatureIterator::BeginSetting() -{ - int cfset = m_pfont->NumberOfSettings(m_ifeat); - FeatureSettingIterator fsit(*this, 0, cfset); - return fsit; -} - -FeatureSettingIterator FeatureIterator::EndSetting() -{ - int cfset = m_pfont->NumberOfSettings(m_ifeat); - FeatureSettingIterator fsit(*this, cfset, cfset); - return fsit; -} - - -//:>******************************************************************************************** -//:> FeatureSettingIterator methods -//:>******************************************************************************************** - -/*---------------------------------------------------------------------------------------------- - Dereference the iterator, returning a feature value. -----------------------------------------------------------------------------------------------*/ -int FeatureSettingIterator::operator*() -{ - if (m_ifset >= m_cfset) - { - Assert(false); - return kInvalid; - } - - return m_fit.m_pfont->GetFeatureSettingValue(m_fit.m_ifeat, m_ifset); -} - -/*---------------------------------------------------------------------------------------------- - Increment the iterator. -----------------------------------------------------------------------------------------------*/ -FeatureSettingIterator FeatureSettingIterator::operator++() -{ - if (m_ifset >= m_cfset) - { - // Can't increment. - Assert(false); - } - else - m_ifset++; - - return *this; -} - -/*---------------------------------------------------------------------------------------------- - Increment the iterator by the given value. -----------------------------------------------------------------------------------------------*/ -FeatureSettingIterator FeatureSettingIterator::operator+=(int n) -{ - if (m_ifset + n >= m_cfset) - { - // Can't increment. - Assert(false); - m_ifset = m_cfset; - } - if (m_ifset + n < 0) - { - // Can't decrement. - Assert(false); - m_ifset = 0; - } - else - m_ifset += n; - - return *this; -} - -/*---------------------------------------------------------------------------------------------- - Test whether the two iterators are equal. -----------------------------------------------------------------------------------------------*/ -bool FeatureSettingIterator::operator==(FeatureSettingIterator & fsit) -{ - //FeatureIterator * pfit = static_cast(m_pfit); - //FeatureIterator * pfitOther = static_cast(fsit.m_pfit); - //return (m_ifset == fsit.m_ifset && pfit == pfitOther); - return (m_ifset == fsit.m_ifset && m_fit == fsit.m_fit); -} - -bool FeatureSettingIterator::operator!=(FeatureSettingIterator & fsit) -{ - //FeatureIterator * pfit = static_cast(m_pfit); - //FeatureIterator * pfitOther = static_cast(fsit.m_pfit); - //return (m_ifset != fsit.m_ifset || pfit != pfitOther); - - return (m_ifset != fsit.m_ifset || m_fit != fsit.m_fit); -} - -/*---------------------------------------------------------------------------------------------- - Return the number of items represented by the range of the two iterators. -----------------------------------------------------------------------------------------------*/ -int FeatureSettingIterator::operator-(FeatureSettingIterator fsit) -{ - //FeatureIterator * pfit = static_cast(m_pfit); - //FeatureIterator * pfitOther = static_cast(fsit.m_pfit); - //if (pfit != pfitOther) - - if (m_fit != fsit.m_fit) - { - throw; - } - return (m_ifset - fsit.m_ifset); -} - -//:>******************************************************************************************** -//:> FeatLabelLangIterator methods -//:>******************************************************************************************** - -/*---------------------------------------------------------------------------------------------- - Dereference the iterator, returning a language LCID. -----------------------------------------------------------------------------------------------*/ -data16 FeatLabelLangIterator::operator*() -{ - if (m_ilang >= m_clang) - { - Assert(false); - return 0; - } - - return m_pfont->FeatLabelLang(m_ilang); -} - -/*---------------------------------------------------------------------------------------------- - Increment the iterator. -----------------------------------------------------------------------------------------------*/ -FeatLabelLangIterator FeatLabelLangIterator::operator++() -{ - if (m_ilang >= m_clang) - { - // Can't increment. - Assert(false); - } - else - m_ilang++; - - return *this; -} - -/*---------------------------------------------------------------------------------------------- - Increment the iterator by the given value. -----------------------------------------------------------------------------------------------*/ -FeatLabelLangIterator FeatLabelLangIterator::operator+=(int n) -{ - if (m_ilang + n >= m_clang) - { - // Can't increment. - Assert(false); - m_ilang = m_clang; - } - else if (m_ilang + n < 0) - { - // Can't decrement. - Assert(false); - m_ilang = 0; - } - else - m_ilang += m_clang; - - return *this; -} - -/*---------------------------------------------------------------------------------------------- - Test whether the two iterators are equal. -----------------------------------------------------------------------------------------------*/ -bool FeatLabelLangIterator::operator==(FeatLabelLangIterator & fllit) -{ - return (fllit.m_ilang == m_ilang && fllit.m_pfont == m_pfont); -} - -bool FeatLabelLangIterator::operator!=(FeatLabelLangIterator & fllit) -{ - return (fllit.m_ilang != m_ilang || fllit.m_pfont != m_pfont); -} - -/*---------------------------------------------------------------------------------------------- - Return the number of items represented by the range of the two iterators. -----------------------------------------------------------------------------------------------*/ -int FeatLabelLangIterator::operator-(FeatLabelLangIterator & fllit) -{ - if (m_pfont != fllit.m_pfont) - { - throw; - } - return (m_ilang - fllit.m_ilang); -} - - -//:>******************************************************************************************** -//:> LanguageIterator methods -//:>******************************************************************************************** - -/*---------------------------------------------------------------------------------------------- - Dereference the iterator, returning a language code. -----------------------------------------------------------------------------------------------*/ -isocode LanguageIterator::operator*() -{ - if (m_ilang >= m_clang) - { - Assert(false); - isocode codeRet; - codeRet.rgch[0] = '?'; codeRet.rgch[1] = '?'; - codeRet.rgch[2] = '?'; codeRet.rgch[3] = 0; - return codeRet; - } - - return m_pfont->LanguageCode(m_ilang); -} - -/*---------------------------------------------------------------------------------------------- - Increment the iterator. -----------------------------------------------------------------------------------------------*/ -LanguageIterator LanguageIterator::operator++() -{ - if (m_ilang >= m_clang) - { - // Can't increment. - Assert(false); - } - else - m_ilang++; - - return *this; -} - -/*---------------------------------------------------------------------------------------------- - Increment the iterator by the given value. -----------------------------------------------------------------------------------------------*/ -LanguageIterator LanguageIterator::operator+=(int n) -{ - if (m_ilang + n >= m_clang) - { - // Can't increment. - Assert(false); - m_ilang = m_clang; - } - else if (m_ilang + n < 0) - { - // Can't decrement. - Assert(false); - m_ilang = 0; - } - else - m_ilang += m_clang; - - return *this; -} - -/*---------------------------------------------------------------------------------------------- - Test whether the two iterators are equal. -----------------------------------------------------------------------------------------------*/ -bool LanguageIterator::operator==(LanguageIterator & lgit) -{ - return (lgit.m_ilang == m_ilang && lgit.m_pfont == m_pfont); -} - -bool LanguageIterator::operator!=(LanguageIterator & lgit) -{ - return (lgit.m_ilang != m_ilang || lgit.m_pfont != m_pfont); -} - -/*---------------------------------------------------------------------------------------------- - Return the number of items represented by the range of the two iterators. -----------------------------------------------------------------------------------------------*/ -int LanguageIterator::operator-(LanguageIterator & lgit) -{ - if (m_pfont != lgit.m_pfont) - { - throw; - } - return (m_ilang - lgit.m_ilang); -} - - -} // namespace gr - - diff --git a/Build/source/libs/graphite/engine-2.3.1/src/font/FontTableCache.h b/Build/source/libs/graphite/engine-2.3.1/src/font/FontTableCache.h deleted file mode 100644 index 461b00d745f..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/src/font/FontTableCache.h +++ /dev/null @@ -1,52 +0,0 @@ - -#include "TtfUtil.h" - -namespace gr -{ - - -// used to allow table sharing among font copies -// TBD: should this be a real class or is it acceptable to -// make the attributes public -class FontTableCache -{ -public: - FontTableCache() - : m_fontCount(1) - { - for (int i = 0; i -1); } - byte * getTable(TableId id) const { Assert(id < ktiLast); return m_pTable[id]; } - const long & getTableSize(TableId id) const - { - Assert(id < ktiLast); - return m_tableSize[id]; - } - byte * allocateTable(TableId id, long size) - { - m_pTable[id] = new byte[size]; - m_tableSize[id] = size; - return m_pTable[id]; - } - -private: - int m_fontCount; - byte * m_pTable[ktiLast]; - long m_tableSize[ktiLast]; -}; - -} diff --git a/Build/source/libs/graphite/engine-2.3.1/src/font/Makefile.am b/Build/source/libs/graphite/engine-2.3.1/src/font/Makefile.am deleted file mode 100644 index 461af621b49..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/src/font/Makefile.am +++ /dev/null @@ -1,7 +0,0 @@ -fontdir = $(top_srcdir)/src/font - -libgraphite_la_SOURCES += $(fontdir)/Font.cpp -libgraphite_la_SOURCES += $(fontdir)/TtfUtil.cpp -libgraphite_la_SOURCES += $(fontdir)/FileFont.cpp - -EXTRA_DIST += $(fontdir)/*.h diff --git a/Build/source/libs/graphite/engine-2.3.1/src/font/TtfTypes.h b/Build/source/libs/graphite/engine-2.3.1/src/font/TtfTypes.h deleted file mode 100644 index da8d90f1f26..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/src/font/TtfTypes.h +++ /dev/null @@ -1,388 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 2007 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: TtfTypes.h -Responsibility: Tim Eves -Last reviewed: Not yet. - -Description: -Provides types required to represent the TTF basic types. --------------------------------------------------------------------------------*//*:End Ignore*/ - - -//********************************************************************************************** -// Include files -//********************************************************************************************** -#include "GrPlatform.h" - -namespace TtfUtil -{ -//********************************************************************************************** -// Forward declarations -//********************************************************************************************** - - -//********************************************************************************************** -// Type declarations -//********************************************************************************************** -typedef gr::data8 uint8; -typedef gr::sdata8 int8; -typedef gr::data16 uint16; -typedef gr::sdata16 int16; -typedef gr::data32 uint32; -typedef gr::sdata32 int32; - -typedef int16 short_frac; -typedef int32 fixed; -typedef int16 fword; -typedef uint16 ufword; -typedef int16 f2dot14; -typedef uint32 long_date_time[2]; - -//********************************************************************************************** -// Constants and enum types -//**********************************************************************************************/ -enum -{ - OneFix = 1<<16 -}; - -//********************************************************************************************** -// Table declarations -//********************************************************************************************** -namespace Sfnt -{ -#pragma pack(1) // We need this or the structure members aren't alligned - // correctly. Fortunately this form of pragma is supposed - // to be recongnised by VS C++ too (at least according to - // MSDN). - - struct OffsetSubTable - { - uint32 scaler_type; - uint16 num_tables, - search_range, - entry_selector, - range_shift; - struct Entry - { - uint32 tag, - checksum, - offset, - length; - } table_directory[1]; - - enum ScalerType - { - TrueTypeMac = 0x74727565U, - TrueTypeWin = 0x00010000U, - Type1 = 0x74797031U - }; - }; - - - - - struct CharacterCodeMap - { - uint16 version, - num_subtables; - struct - { - uint16 platform_id, - platform_specific_id; - uint32 offset; - } encoding[1]; - }; - - struct CmapSubTable - { - uint16 format, - length, - language; - }; - - struct CmapSubTableFormat4 : CmapSubTable - { - uint16 seg_count_x2, - search_range, - entry_selector, - range_shift, - end_code[1]; - // There are arrarys after this which need their - // start positions calculated since end_code is - // seg_count uint16s long. - }; - - struct CmapSubTableFormat12 - { - fixed format; - uint32 length, - language, - num_groups; - struct - { - uint32 start_char_code, - end_char_code, - start_glyph_id; - } group[1]; - }; - - - - struct FontHeader - { - fixed version, - font_revision; - uint32 check_sum_adjustment, - magic_number; - uint16 flags, - units_per_em; - long_date_time created, - modified; - fword x_min, - y_min, - x_max, - y_max; - uint16 mac_style, - lowest_rec_ppem; - int16 font_direction_hint, - index_to_loc_format, - glyph_data_format; - enum - { - MagicNumber = 0x5F0F3CF5, - GlypDataFormat = 0 - }; - enum {ShortIndexLocFormat, LongIndexLocFormat}; - }; - - - - - struct PostScriptGlyphName - { - fixed format, - italic_angle; - fword underline_position, - underline_thickness; - uint32 is_fixed_pitch, - min_mem_type42, - max_mem_type42, - min_mem_type1, - max_mem_type1; - enum - { - Format1 = 0x10000, - Format2 = 0x20000, - Format25 = 0x28000, - Format3 = 0x30000, - Format4 = 0x40000 - }; - }; - - struct PostScriptGlyphName2 : PostScriptGlyphName - { - uint16 number_of_glyphs, - glyph_name_index[1]; - }; - - struct PostScriptGlyphName25 : PostScriptGlyphName - { - uint16 number_of_glyphs; - int8 offset[1]; - }; - - struct PostScriptGlyphName3 : PostScriptGlyphName {}; - - struct PostScriptGlyphName4 : PostScriptGlyphName - { - uint16 glyph_to_char_map[1]; - }; - - - struct HorizontalHeader - { - fixed version; - fword ascent, - descent, - line_gap; - ufword advance_width_max; - fword min_left_side_bearing, - max_left_side_bearing, - x_max_element; - int16 caret_slope_rise, - caret_slope_run; - fword caret_offset; - int16 reserved[4], - metric_data_format; - uint16 num_long_hor_metrics; - }; - - struct MaximumProfile - { - fixed version; - uint16 num_glyphs, - max_points, - max_contours, - max_component_points, - max_component_contours, - max_zones, - max_twilight_points, - max_storage, - max_function_defs, - max_instruction_defs, - max_stack_elements, - max_size_of_instructions, - max_component_elements, - max_component_depth; - }; - - - typedef gr::byte Panose[10]; - - struct Compatibility0 - { - uint16 version; - int16 x_avg_char_width; - uint16 weight_class, - width_class; - int16 fs_type, - y_subscript_x_size, - y_subscript_y_size, - y_subscript_x_offset, - y_subscript_y_offset, - y_superscript_x_size, - y_superscript_y_size, - y_superscript_x_offset, - y_superscript_y_offset, - y_strikeout_size, - y_strikeout_position, - family_class; - Panose panose; - uint32 unicode_range[4]; - int8 ach_vend_id[4]; - uint16 fs_selection, - fs_first_char_index, - fs_last_char_index, // Acording to Apple's spec this is where v0 should end - typo_ascender, - typo_descender, - type_linegap, - win_ascent, - win_descent; - - enum - { - Italic =0x01, - Underscore=0x02, - Negative =0x04, - Outlined =0x08, - StrikeOut =0x10, - Bold =0x20 - }; - }; - - struct Compatibility1 : Compatibility0 - { - uint32 codepage_range[2]; - }; - - struct Compatibility2 : Compatibility1 - { - int16 x_height, - cap_height; - uint16 default_char, - break_char, - max_context; - }; - - struct Compatibility3 : Compatibility2 {}; - - typedef Compatibility3 Compatibility; - - - struct NameRecord - { - uint16 platform_id, - platform_specific_id, - language_id, - name_id, - length, - offset; - enum {Unicode, Mactintosh, Reserved, Microsoft}; - enum - { - Copyright, Family, Subfamily, UniqueSubfamily, - Fullname, Version, PostScript - }; - }; - - struct FontNames - { - uint16 format, - count, - string_offset; - NameRecord name_record[1]; - }; - - - struct HorizontalMetric - { - uint16 advance_width; - int16 left_side_bearing; - }; - - - struct Glyph - { - int16 number_of_contours; - fword x_min, - y_min, - x_max, - y_max; - }; - - struct SimpleGlyph : Glyph - { - uint16 end_pts_of_contours[1]; - enum - { - OnCurve = 0x01, - XShort = 0x02, - YShort = 0x04, - Repeat = 0x08, - XIsSame = 0x10, - XIsPos = 0x10, - YIsSame = 0x20, - YIsPos = 0x20 - }; - }; - - struct CompoundGlyph : Glyph - { - uint16 flags, - glyph_index; - enum - { - Arg1Arg2Words = 0x01, - ArgsAreXYValues = 0x02, - RoundXYToGrid = 0x04, - HaveScale = 0x08, - MoreComponents = 0x20, - HaveXAndYScale = 0x40, - HaveTwoByTwo = 0x80, - HaveInstructions = 0x100, - UseMyMetrics = 0x200, - OverlapCompund = 0x400, - ScaledOffset = 0x800, - UnscaledOffset = 0x1000 - }; - }; - -#pragma pack() -} // end of namespace Sfnt - -} // end of namespace TtfUtil diff --git a/Build/source/libs/graphite/engine-2.3.1/src/font/TtfUtil.cpp b/Build/source/libs/graphite/engine-2.3.1/src/font/TtfUtil.cpp deleted file mode 100644 index d2781ccac5f..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/src/font/TtfUtil.cpp +++ /dev/null @@ -1,1937 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 2000, 2001 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: TtfUtil.cpp -Responsibility: Alan Ward -Last reviewed: Not yet. - -Description: - Implements the methods for TtfUtil class. This file should remain portable to any C++ - environment by only using standard C++ and the TTF structurs defined in Tt.h. --------------------------------------------------------------------------------*//*:End Ignore*/ - - -/*********************************************************************************************** - Include files -***********************************************************************************************/ -// Language headers -#include -#include -#include -#include -#include -#include -// Platform headers -// Module headers -#include "TtfUtil.h" -#include "TtfTypes.h" - -/*********************************************************************************************** - Forward declarations -***********************************************************************************************/ - -/*********************************************************************************************** - Local Constants and static variables -***********************************************************************************************/ -namespace -{ - // max number of components allowed in composite glyphs - const int kMaxGlyphComponents = 8; - - // These are basic byte order swapping functions - template inline T rev16(const T d) { - T r = (d & 0xff) << 8; r |= (d & 0xff00) >> 8; - return r; - } - - template inline T rev32(const T d) { - T r = (d & 0xff) << 24; r |= (d & 0xff00) << 8; - r |= (d & 0xff0000) >> 8; r |= (d & 0xff000000) >> 24; - return r; - } - - // This is the generic read function which does the swapping - template inline T read(const T d) { - return d; - } - -#if !defined WORDS_BIGENDIAN || defined PC_OS - template<> inline TtfUtil::uint16 read(const TtfUtil::uint16 d) { - return rev16(d); - } - - template<> inline TtfUtil::int16 read(const TtfUtil::int16 d) { - return rev16(d); - } - - template<> inline TtfUtil::uint32 read(const TtfUtil::uint32 d) { - return rev32(d); - } - - template<> inline TtfUtil::int32 read(const TtfUtil::int32 d) { - return rev32(d); - } -#endif - - template - inline float fixed_to_float(const T f) { - return float(f)/float(2^R); - } - -#define MAKE_TAG(a,b,c,d) ((a << 24UL) + (b << 16UL) + (c << 8UL) + (d)) - const gr::fontTableId32 mapIdToTag[] = { - MAKE_TAG('c','m','a','p'), - MAKE_TAG('c','v','t',' '), - MAKE_TAG('c','r','y','p'), - MAKE_TAG('h','e','a','d'), - MAKE_TAG('f','p','g','m'), - MAKE_TAG('g','d','i','r'), - MAKE_TAG('g','l','y','f'), - MAKE_TAG('h','d','m','x'), - MAKE_TAG('h','h','e','a'), - MAKE_TAG('h','m','t','x'), - MAKE_TAG('l','o','c','a'), - MAKE_TAG('k','e','r','n'), - MAKE_TAG('L','T','S','H'), - MAKE_TAG('m','a','x','p'), - MAKE_TAG('n','a','m','e'), - MAKE_TAG('O','S','/','2'), - MAKE_TAG('p','o','s','t'), - MAKE_TAG('p','r','e','p'), - MAKE_TAG('F','e','a','t'), - MAKE_TAG('G','l','a','t'), - MAKE_TAG('G','l','o','c'), - MAKE_TAG('S','i','l','f'), - MAKE_TAG('S','i','l','e'), - MAKE_TAG('S','i','l','l') - }; - - -/*---------------------------------------------------------------------------------------------- - Table of standard Postscript glyph names. From Martin Hosken. Disagress with ttfdump.exe ----------------------------------------------------------------------------------------------*/ - const int kcPostNames = 258; - - const char * rgPostName[kcPostNames] = { - ".notdef", ".null", "nonmarkingreturn", "space", "exclam", "quotedbl", "numbersign", - "dollar", "percent", "ampersand", "quotesingle", "parenleft", - "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", - "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", - "nine", "colon", "semicolon", "less", "equal", "greater", "question", - "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", - "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", - "bracketleft", "backslash", "bracketright", "asciicircum", - "underscore", "grave", "a", "b", "c", "d", "e", "f", "g", "h", "i", - "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", - "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", - "Adieresis", "Aring", "Ccedilla", "Eacute", "Ntilde", "Odieresis", - "Udieresis", "aacute", "agrave", "acircumflex", "adieresis", "atilde", - "aring", "ccedilla", "eacute", "egrave", "ecircumflex", "edieresis", - "iacute", "igrave", "icircumflex", "idieresis", "ntilde", "oacute", - "ograve", "ocircumflex", "odieresis", "otilde", "uacute", "ugrave", - "ucircumflex", "udieresis", "dagger", "degree", "cent", "sterling", - "section", "bullet", "paragraph", "germandbls", "registered", - "copyright", "trademark", "acute", "dieresis", "notequal", "AE", - "Oslash", "infinity", "plusminus", "lessequal", "greaterequal", "yen", - "mu", "partialdiff", "summation", "product", "pi", "integral", - "ordfeminine", "ordmasculine", "Omega", "ae", "oslash", "questiondown", - "exclamdown", "logicalnot", "radical", "florin", "approxequal", - "Delta", "guillemotleft", "guillemotright", "ellipsis", "nonbreakingspace", - "Agrave", "Atilde", "Otilde", "OE", "oe", "endash", "emdash", - "quotedblleft", "quotedblright", "quoteleft", "quoteright", "divide", - "lozenge", "ydieresis", "Ydieresis", "fraction", "currency", - "guilsinglleft", "guilsinglright", "fi", "fl", "daggerdbl", "periodcentered", - "quotesinglbase", "quotedblbase", "perthousand", "Acircumflex", - "Ecircumflex", "Aacute", "Edieresis", "Egrave", "Iacute", - "Icircumflex", "Idieresis", "Igrave", "Oacute", "Ocircumflex", - "apple", "Ograve", "Uacute", "Ucircumflex", "Ugrave", "dotlessi", - "circumflex", "tilde", "macron", "breve", "dotaccent", "ring", - "cedilla", "hungarumlaut", "ogonek", "caron", "Lslash", "lslash", - "Scaron", "scaron", "Zcaron", "zcaron", "brokenbar", "Eth", "eth", - "Yacute", "yacute", "Thorn", "thorn", "minus", "multiply", - "onesuperior", "twosuperior", "threesuperior", "onehalf", "onequarter", - "threequarters", "franc", "Gbreve", "gbreve", "Idotaccent", "Scedilla", - "scedilla", "Cacute", "cacute", "Ccaron", "ccaron", - "dcroat" }; - -} // end of namespace - -/*********************************************************************************************** - Methods -***********************************************************************************************/ - -/* Note on error processing: The code guards against bad glyph ids being used to look up data -in open ended tables (loca, hmtx). If the glyph id comes from a cmap this shouldn't happen -but it seems prudent to check for user errors here. The code does assume that data obtained -from the TTF file is valid otherwise (though the CheckTable method seeks to check for -obvious problems that might accompany a change in table versions). For example an invalid -offset in the loca table which could exceed the size of the glyf table is NOT trapped. -Likewise if numberOf_LongHorMetrics in the hhea table is wrong, this will NOT be trapped, -which could cause a lookup in the hmtx table to exceed the table length. Of course, TTF tables -that are completely corrupt will cause unpredictable results. */ - -/* Note on composite glyphs: Glyphs that have components that are themselves composites -are not supported. IsDeepComposite can be used to test for this. False is returned from many -of the methods in this cases. It is unclear how to build composite glyphs in some cases, -so this code represents my best guess until test cases can be found. See notes on the high- -level GlyfPoints method. */ - -namespace TtfUtil -{ - - -/*---------------------------------------------------------------------------------------------- - Get offset and size of the offset table needed to find table directory - Return true if success, false otherwise - lSize excludes any table directory entries -----------------------------------------------------------------------------------------------*/ -bool GetHeaderInfo(size_t & lOffset, size_t & lSize) -{ - lOffset = 0; - lSize = offsetof(Sfnt::OffsetSubTable, table_directory); - assert(sizeof(uint32) + 4*sizeof (uint16) == lSize); - return true; -} - -/*---------------------------------------------------------------------------------------------- - Check the offset table for expected data - Return true if success, false otherwise -----------------------------------------------------------------------------------------------*/ -bool CheckHeader(const void * pHdr) -{ - const Sfnt::OffsetSubTable * pOffsetTable - = reinterpret_cast(pHdr); - - return read(pOffsetTable->scaler_type) == Sfnt::OffsetSubTable::TrueTypeWin; -} - -/*---------------------------------------------------------------------------------------------- - Get offset and size of the table directory - Return true if successful, false otherwise -----------------------------------------------------------------------------------------------*/ -bool GetTableDirInfo(const void * pHdr, size_t & lOffset, size_t & lSize) -{ - const Sfnt::OffsetSubTable * pOffsetTable - = reinterpret_cast(pHdr); - - lOffset = offsetof(Sfnt::OffsetSubTable, table_directory); - lSize = read(pOffsetTable->num_tables) - * sizeof(Sfnt::OffsetSubTable::Entry); - - return true; -} - - -/*---------------------------------------------------------------------------------------------- - Get offset and size of the specified table - Return true if successful, false otherwise. On false, offset and size will be 0 -----------------------------------------------------------------------------------------------*/ -bool GetTableInfo(TableId ktiTableId, const void * pHdr, const void * pTableDir, - size_t & lOffset, size_t & lSize) -{ - gr::fontTableId32 lTableTag = TableIdTag(ktiTableId); - if (!lTableTag) - { - lOffset = 0; - lSize = 0; - return false; - } - - const Sfnt::OffsetSubTable * pOffsetTable - = reinterpret_cast(pHdr); - const Sfnt::OffsetSubTable::Entry - * entry_itr = reinterpret_cast( - pTableDir), - * const dir_end = entry_itr + read(pOffsetTable->num_tables); - - assert(read(pOffsetTable->num_tables) < 40); - if (read(pOffsetTable->num_tables) > 40) - return false; - - for (;entry_itr != dir_end; ++entry_itr) // 40 - safe guard - { - if (read(entry_itr->tag) == lTableTag) - { - lOffset = read(entry_itr->offset); - lSize = read(entry_itr->length); - return true; - } - } - - return false; -} - -/*---------------------------------------------------------------------------------------------- - Check the specified table. Tests depend on the table type. - Return true if successful, false otherwise -----------------------------------------------------------------------------------------------*/ -bool CheckTable(TableId ktiTableId, const void * pTable, size_t lTableSize) -{ - using namespace Sfnt; - - switch(ktiTableId) - { - case ktiCmap: // cmap - { - const Sfnt::CharacterCodeMap * const pCmap - = reinterpret_cast(pTable); - assert(read(pCmap->version) == 0); - return read(pCmap->version) == 0; - } - - case ktiHead: // head - { - const Sfnt::FontHeader * const pHead - = reinterpret_cast(pTable); - bool r = read(pHead->version) == OneFix - && read(pHead->magic_number) == FontHeader::MagicNumber - && read(pHead->glyph_data_format) - == FontHeader::GlypDataFormat - && (read(pHead->index_to_loc_format) - == FontHeader::ShortIndexLocFormat - || read(pHead->index_to_loc_format) - == FontHeader::LongIndexLocFormat) - && sizeof(FontHeader) <= lTableSize; - assert(r); return r; - } - - case ktiPost: // post - { - const Sfnt::PostScriptGlyphName * const pPost - = reinterpret_cast(pTable); - const fixed format = read(pPost->format); - bool r = format == PostScriptGlyphName::Format1 - || format == PostScriptGlyphName::Format2 - || format == PostScriptGlyphName::Format3 - || format == PostScriptGlyphName::Format25; - assert(r); return r; - } - - case ktiHhea: // hhea - { - const Sfnt::HorizontalHeader * pHhea = - reinterpret_cast(pTable); - bool r = read(pHhea->version) == OneFix - && read(pHhea->metric_data_format) == 0 - && sizeof (Sfnt::HorizontalHeader) <= lTableSize; - assert(r); return r; - } - - case ktiMaxp: // maxp - { - const Sfnt::MaximumProfile * pMaxp = - reinterpret_cast(pTable); - bool r = read(pMaxp->version) == OneFix - && sizeof(Sfnt::MaximumProfile) <= lTableSize; - assert(r); return r; - } - - case ktiOs2: // OS/2 - { - const Sfnt::Compatibility * pOs2 - = reinterpret_cast(pTable); - if (read(pOs2->version) == 0) - { // OS/2 table version 1 size -// if (sizeof(Sfnt::Compatibility) -// - sizeof(uint32)*2 - sizeof(int16)*2 -// - sizeof(uint16)*3 <= lTableSize) - if (sizeof(Sfnt::Compatibility0) <= lTableSize) - return true; - } - else if (read(pOs2->version) == 1) - { // OS/2 table version 2 size -// if (sizeof(Sfnt::Compatibility) -// - sizeof(int16) *2 -// - sizeof(uint16)*3 <= lTableSize) - if (sizeof(Sfnt::Compatibility1) <= lTableSize) - return true; - } - else if (read(pOs2->version) == 2) - { // OS/2 table version 3 size - if (sizeof(Sfnt::Compatibility2) <= lTableSize) - return true; - } - else if (read(pOs2->version) == 3) - { // OS/2 table version 4 size - version 4 changed the meaning of some fields which we don't use - if (sizeof(Sfnt::Compatibility3) <= lTableSize) - return true; - } - else - return false; - } - - case ktiName: - { - const Sfnt::FontNames * pName - = reinterpret_cast(pTable); - assert(read(pName->format) == 0); - return read(pName->format) == 0; - } - - default: - break; - } - - return true; -} - -/*---------------------------------------------------------------------------------------------- - Return the number of glyphs in the font. Should never be less than zero. -----------------------------------------------------------------------------------------------*/ -size_t GlyphCount(const void * pMaxp) -{ - const Sfnt::MaximumProfile * pTable = - reinterpret_cast(pMaxp); - return read(pTable->num_glyphs); -} - -/*---------------------------------------------------------------------------------------------- - Return the maximum number of components for any composite glyph in the font -----------------------------------------------------------------------------------------------*/ -size_t MaxCompositeComponentCount(const void * pMaxp) -{ - const Sfnt::MaximumProfile * pTable = - reinterpret_cast(pMaxp); - return read(pTable->max_component_elements); -} - -/*---------------------------------------------------------------------------------------------- - Composite glyphs can be composed of glyphs that are themselves composites. - This method returns the maximum number of levels like this for any glyph in the font. - A non-composite glyph has a level of 1 -----------------------------------------------------------------------------------------------*/ -size_t MaxCompositeLevelCount(const void * pMaxp) -{ - const Sfnt::MaximumProfile * pTable = - reinterpret_cast(pMaxp); - return read(pTable->max_component_depth); -} - -/*---------------------------------------------------------------------------------------------- - Return the number of glyphs in the font according to a differt source. - Should never be less than zero. Return -1 on failure. -----------------------------------------------------------------------------------------------*/ -size_t LocaGlyphCount(size_t lLocaSize, const void * pHead) throw(std::domain_error) -{ - - const Sfnt::FontHeader * pTable - = reinterpret_cast(pHead); - - if (read(pTable->index_to_loc_format) - == Sfnt::FontHeader::ShortIndexLocFormat) - // loca entries are two bytes and have been divided by two - return (lLocaSize >> 1) - 1; - - if (read(pTable->index_to_loc_format) - == Sfnt::FontHeader::LongIndexLocFormat) - // loca entries are four bytes - return (lLocaSize >> 2) - 1; - - //return -1; - throw std::domain_error("head table in inconsistent state. The font may be corrupted"); -} - -/*---------------------------------------------------------------------------------------------- - Return the design units the font is designed with -----------------------------------------------------------------------------------------------*/ -int DesignUnits(const void * pHead) -{ - const Sfnt::FontHeader * pTable = - reinterpret_cast(pHead); - - return read(pTable->units_per_em); -} - -/*---------------------------------------------------------------------------------------------- - Return the checksum from the head table, which serves as a unique identifer for the font. -----------------------------------------------------------------------------------------------*/ -int HeadTableCheckSum(const void * pHead) -{ - const Sfnt::FontHeader * pTable = - reinterpret_cast(pHead); - - return read(pTable->check_sum_adjustment); -} - -/*---------------------------------------------------------------------------------------------- - Return the create time from the head table. This consists of a 64-bit integer, which - we return here as two 32-bit integers. -----------------------------------------------------------------------------------------------*/ -void HeadTableCreateTime(const void * pHead, - unsigned int * pnDateBC, unsigned int * pnDateAD) -{ - const Sfnt::FontHeader * pTable = - reinterpret_cast(pHead); - - *pnDateBC = read(pTable->created[0]); - *pnDateAD = read(pTable->created[1]); -} - -/*---------------------------------------------------------------------------------------------- - Return the modify time from the head table.This consists of a 64-bit integer, which - we return here as two 32-bit integers. -----------------------------------------------------------------------------------------------*/ -void HeadTableModifyTime(const void * pHead, - unsigned int * pnDateBC, unsigned int *pnDateAD) -{ - const Sfnt::FontHeader * pTable = - reinterpret_cast(pHead); - - *pnDateBC = read(pTable->modified[0]); - *pnDateAD = read(pTable->modified[1]); -} - -/*---------------------------------------------------------------------------------------------- - Return true if the font is italic. -----------------------------------------------------------------------------------------------*/ -bool IsItalic(const void * pHead) -{ - const Sfnt::FontHeader * pTable = - reinterpret_cast(pHead); - - return read(((pTable->mac_style) & 0x00000002) != 0); -} - -/*---------------------------------------------------------------------------------------------- - Return the ascent for the font -----------------------------------------------------------------------------------------------*/ -int FontAscent(const void * pOs2) -{ - const Sfnt::Compatibility * pTable = reinterpret_cast(pOs2); - - return read(pTable->win_ascent); -} - -/*---------------------------------------------------------------------------------------------- - Return the descent for the font -----------------------------------------------------------------------------------------------*/ -int FontDescent(const void * pOs2) -{ - const Sfnt::Compatibility * pTable = reinterpret_cast(pOs2); - - return read(pTable->win_descent); -} - -/*---------------------------------------------------------------------------------------------- - Get the bold and italic style bits. - Return true if successful. false otherwise. - In addition to checking the OS/2 table, one could also check - the head table's macStyle field (overridden by the OS/2 table on Win) - the sub-family name in the name table (though this can contain oblique, dark, etc too) -----------------------------------------------------------------------------------------------*/ -bool FontOs2Style(const void *pOs2, bool & fBold, bool & fItalic) -{ - const Sfnt::Compatibility * pTable = reinterpret_cast(pOs2); - - fBold = (read(pTable->fs_selection) & Sfnt::Compatibility::Bold) != 0; - fItalic = (read(pTable->fs_selection) & Sfnt::Compatibility::Italic) != 0; - - return true; -} - -/*---------------------------------------------------------------------------------------------- - Method for searching name table. -----------------------------------------------------------------------------------------------*/ -bool GetNameInfo(const void * pName, int nPlatformId, int nEncodingId, - int nLangId, int nNameId, size_t & lOffset, size_t & lSize) -{ - lOffset = 0; - lSize = 0; - - const Sfnt::FontNames * pTable = reinterpret_cast(pName); - uint16 cRecord = read(pTable->count); - uint16 nRecordOffset = read(pTable->string_offset); - const Sfnt::NameRecord * pRecord = reinterpret_cast(pTable + 1); - - for (int i = 0; i < cRecord; ++i) - { - if (read(pRecord->platform_id) == nPlatformId && - read(pRecord->platform_specific_id) == nEncodingId && - read(pRecord->language_id) == nLangId && - read(pRecord->name_id) == nNameId) - { - lOffset = read(pRecord->offset) + nRecordOffset; - lSize = read(pRecord->length); - return true; - } - pRecord++; - } - - return false; -} - -/*---------------------------------------------------------------------------------------------- - Return all the lang-IDs that have data for the given name-IDs. Assume that there is room - in the return array (langIdList) for 128 items. The purpose of this method is to return - a list of all possible lang-IDs. -----------------------------------------------------------------------------------------------*/ -int GetLangsForNames(const void * pName, int nPlatformId, int nEncodingId, - int * nameIdList, int cNameIds, short * langIdList) -{ - const Sfnt::FontNames * pTable = reinterpret_cast(pName); - uint16 cRecord = read(pTable->count); - //uint16 nRecordOffset = swapw(pTable->stringOffset); - const Sfnt::NameRecord * pRecord = reinterpret_cast(pTable + 1); - - int cLangIds = 0; - for (int i = 0; i < cRecord; ++i) - { - if (read(pRecord->platform_id) == nPlatformId && - read(pRecord->platform_specific_id) == nEncodingId) - { - bool fNameFound = false; - int nLangId = read(pRecord->language_id); - int nNameId = read(pRecord->name_id); - for (int j = 0; j < cNameIds; j++) - { - if (nNameId == nameIdList[j]) - { - fNameFound = true; - break; - } - } - if (fNameFound) - { - // Add it if it's not there. - int ilang; - for (ilang = 0; ilang < cLangIds; ilang++) - if (langIdList[ilang] == nLangId) - break; - if (ilang >= cLangIds) - { - langIdList[cLangIds] = short(nLangId); - cLangIds++; - } - if (cLangIds == 128) - return cLangIds; - } - } - pRecord++; - } - - return cLangIds; -} - -/*---------------------------------------------------------------------------------------------- - Get the offset and size of the font family name in English for the MS Platform with Unicode - writing system. The offset is within the pName data. The string is double byte with MSB first. -----------------------------------------------------------------------------------------------*/ -bool Get31EngFamilyInfo(const void * pName, size_t & lOffset, size_t & lSize) -{ - return GetNameInfo(pName, Sfnt::NameRecord::Microsoft, 1, 1033, - Sfnt::NameRecord::Family, lOffset, lSize); -} - -/*---------------------------------------------------------------------------------------------- - Get the offset and size of the full font name in English for the MS Platform with Unicode - writing system. The offset is within the pName data. The string is double byte with MSB first. -----------------------------------------------------------------------------------------------*/ -bool Get31EngFullFontInfo(const void * pName, size_t & lOffset, size_t & lSize) -{ - return GetNameInfo(pName, Sfnt::NameRecord::Microsoft, 1, 1033, - Sfnt::NameRecord::Fullname, lOffset, lSize); -} - -/*---------------------------------------------------------------------------------------------- - Get the offset and size of the font family name in English for the MS Platform with Symbol - writing system. The offset is within the pName data. The string is double byte with MSB first. -----------------------------------------------------------------------------------------------*/ -bool Get30EngFamilyInfo(const void * pName, size_t & lOffset, size_t & lSize) -{ - return GetNameInfo(pName, Sfnt::NameRecord::Microsoft, 0, 1033, - Sfnt::NameRecord::Family, lOffset, lSize); -} - -/*---------------------------------------------------------------------------------------------- - Get the offset and size of the full font name in English for the MS Platform with Symbol - writing system. The offset is within the pName data. The string is double byte with MSB first. -----------------------------------------------------------------------------------------------*/ -bool Get30EngFullFontInfo(const void * pName, size_t & lOffset, size_t & lSize) -{ - return GetNameInfo(pName, Sfnt::NameRecord::Microsoft, 0, 1033, - Sfnt::NameRecord::Fullname, lOffset, lSize); -} - -/*---------------------------------------------------------------------------------------------- - Return the Glyph ID for a given Postscript name. This method finds the first glyph which - matches the requested Postscript name. Ideally every glyph should have a unique Postscript - name (except for special names such as .notdef), but this is not always true. - On failure return value less than zero. - -1 - table search failed - -2 - format 3 table (no Postscript glyph info) - -3 - other failures -----------------------------------------------------------------------------------------------*/ -int PostLookup(const void * pPost, size_t lPostSize, const void * pMaxp, - const char * pPostName) -{ - using namespace Sfnt; - - const Sfnt::PostScriptGlyphName * pTable - = reinterpret_cast(pPost); - fixed format = read(pTable->format); - - if (format == PostScriptGlyphName::Format3) - { // format 3 - no Postscript glyph info in font - return -2; - } - - // search for given Postscript name among the standard names - int iPostName = -1; // index in standard names - for (int i = 0; i < kcPostNames; i++) - { - if (!strcmp(pPostName, rgPostName[i])) - { - iPostName = i; - break; - } - } - - if (format == PostScriptGlyphName::Format1) - { // format 1 - use standard Postscript names - return iPostName; - } - - if (format == PostScriptGlyphName::Format25) - { - if (iPostName == -1) - return -1; - - const PostScriptGlyphName25 * pTable25 - = static_cast(pTable); - int cnGlyphs = GlyphCount(pMaxp); - for (gr::gid16 nGlyphId = 0; nGlyphId < cnGlyphs && nGlyphId < kcPostNames; - nGlyphId++) - { // glyph_name_index25 contains bytes so no byte swapping needed - // search for first glyph id that uses the standard name - if (nGlyphId + pTable25->offset[nGlyphId] == iPostName) - return nGlyphId; - } - } - - if (format == PostScriptGlyphName::Format2) - { // format 2 - const PostScriptGlyphName2 * pTable2 - = static_cast(pTable); - - int cnGlyphs = read(pTable2->number_of_glyphs); - - if (iPostName != -1) - { // did match a standard name, look for first glyph id mapped to that name - for (gr::gid16 nGlyphId = 0; nGlyphId < cnGlyphs; nGlyphId++) - { - if (read(pTable2->glyph_name_index[nGlyphId]) == iPostName) - return nGlyphId; - } - return -1; // no glyph with this standard name - } - - else - { // did not match a standard name, search font specific names - size_t nStrSizeGoal = strlen(pPostName); - const char * pFirstGlyphName = reinterpret_cast( - &pTable2->glyph_name_index[0] + cnGlyphs); - const char * pGlyphName = pFirstGlyphName; - int iInNames = 0; // index in font specific names - bool fFound = false; - const char * const endOfTable - = reinterpret_cast(pTable2) + lPostSize; - while (pGlyphName < endOfTable && !fFound) - { // search Pascal strings for first matching name - size_t nStringSize = size_t(*pGlyphName); - if (nStrSizeGoal != nStringSize || - strncmp(pGlyphName + 1, pPostName, nStringSize)) - { // did not match - ++iInNames; - pGlyphName += nStringSize + 1; - } - else - { // did match - fFound = true; - } - } - if (!fFound) - return -1; // no font specific name matches request - - iInNames += kcPostNames; - for (gr::gid16 nGlyphId = 0; nGlyphId < cnGlyphs; nGlyphId++) - { // search for first glyph id that maps to the found string index - if (read(pTable2->glyph_name_index[nGlyphId]) == iInNames) - return nGlyphId; - } - return -1; // no glyph mapped to this index (very strange) - } - } - - return -3; -} - -/*---------------------------------------------------------------------------------------------- - Convert a Unicode character string from big endian (MSB first, Motorola) format to little - endian (LSB first, Intel) format. - nSize is the number of Unicode characters in the string. It should not include any - terminating null. If nSize is 0, it is assumed the string is null terminated. nSize - defaults to 0. - Return true if successful, false otherwise. -----------------------------------------------------------------------------------------------*/ -void SwapWString(void * pWStr, size_t nSize /* = 0 */) throw (std::invalid_argument) -{ - if (pWStr == 0) - throw std::invalid_argument("null pointer given"); - - uint16 * pStr = reinterpret_cast(pWStr); - uint16 * const pStrEnd = pStr + (nSize == 0 ? gr::utf16len(pStr) : nSize); - -#ifndef USE_STDLIB_WORKAROUNDS - std::transform(pStr, pStrEnd, pStr, read); -#else - for (int i = 0; i < nSize; i++) - { // swap the wide characters in the string - pStr[i] = gr::utf16(read(uint16(pStr[i]))); - } -#endif -} - -/*---------------------------------------------------------------------------------------------- - Get the left-side bearing and and advance width based on the given tables and Glyph ID - Return true if successful, false otherwise. On false, one or both value could be INT_MIN -----------------------------------------------------------------------------------------------*/ -bool HorMetrics(gr::gid16 nGlyphId, const void * pHmtx, size_t lHmtxSize, const void * pHhea, - int & nLsb, unsigned int & nAdvWid) -{ - const Sfnt::HorizontalMetric * phmtx = - reinterpret_cast(pHmtx); - - const Sfnt::HorizontalHeader * phhea = - reinterpret_cast(pHhea); - - size_t cLongHorMetrics = read(phhea->num_long_hor_metrics); - if (nGlyphId < cLongHorMetrics) - { // glyph id is acceptable - nAdvWid = read(phmtx[nGlyphId].advance_width); - nLsb = read(phmtx[nGlyphId].left_side_bearing); - } - else - { - nAdvWid = read(phmtx[cLongHorMetrics - 1].advance_width); - - // guard against bad glyph id - size_t lLsbOffset = sizeof(Sfnt::HorizontalMetric) * cLongHorMetrics + - sizeof(int16) * (nGlyphId - cLongHorMetrics); // offset in bytes - if (lLsbOffset + 1 >= lHmtxSize) // + 1 because entries are two bytes wide - { - nLsb = 0; - return false; - } - const int16 * pLsb = reinterpret_cast(phmtx) + - lLsbOffset / sizeof(int16); - nLsb = read(*pLsb); - } - - return true; -} - -/*---------------------------------------------------------------------------------------------- - Return a pointer to the requested cmap subtable. By default find the Microsoft Unicode - subtable. Pass nEncoding as -1 to find first table that matches only nPlatformId. - Return NULL if the subtable cannot be found. -----------------------------------------------------------------------------------------------*/ -void * FindCmapSubtable(const void * pCmap, - int nPlatformId, /* =3 */ - int nEncodingId) /* = 1 */ -{ - const Sfnt::CharacterCodeMap * pTable = - reinterpret_cast(pCmap); - - uint16 csuPlatforms = read(pTable->num_subtables); - for (int i = 0; i < csuPlatforms; i++) - { - if (read(pTable->encoding[i].platform_id) == nPlatformId && - (nEncodingId == -1 || read(pTable->encoding[i].platform_specific_id) == nEncodingId)) - { - const void * pRtn = reinterpret_cast(pCmap) + - read(pTable->encoding[i].offset); - return const_cast(pRtn); - } - } - - return 0; -} - -/*---------------------------------------------------------------------------------------------- - Check the Microsoft Unicode subtable for expected values -----------------------------------------------------------------------------------------------*/ -bool CheckCmap31Subtable(const void * pCmap31) -{ - const Sfnt::CmapSubTable * pTable = reinterpret_cast(pCmap31); - // Bob H says ome freeware TT fonts have version 1 (eg, CALIGULA.TTF) - // so don't check subtable version. 21 Mar 2002 spec changes version to language. - - return read(pTable->format) == 4; -} - -/*---------------------------------------------------------------------------------------------- - Return the Glyph ID for the given Unicode ID in the Microsoft Unicode subtable. - (Actually this code only depends on subtable being format 4.) - Return 0 if the Unicode ID is not in the subtable. -----------------------------------------------------------------------------------------------*/ -gr::gid16 Cmap31Lookup(const void * pCmap31, int nUnicodeId) -{ - const Sfnt::CmapSubTableFormat4 * pTable = reinterpret_cast(pCmap31); - - uint16 nSeg = read(pTable->seg_count_x2) >> 1; - - uint16 n; - const uint16 * pLeft, * pMid; - uint16 cMid, chStart, chEnd; - - // Binary search of the endCode[] array - pLeft = &(pTable->end_code[0]); - n = nSeg; - while (n > 0) - { - cMid = n >> 1; // Pick an element in the middle - pMid = pLeft + cMid; - chEnd = read(*pMid); - if (nUnicodeId <= chEnd) - { - if (cMid == 0 || nUnicodeId > read(pMid[-1])) - break; // Must be this seg or none! - n = cMid; // Continue on left side, omitting mid point - } - else - { - pLeft = pMid + 1; // Continue on right side, omitting mid point - n -= (cMid + 1); - } - } - - if (!n) - return 0; - - // Ok, we're down to one segment and pMid points to the endCode element - // Either this is it or none is. - - chStart = read(*(pMid += nSeg + 1)); - if (chEnd >= nUnicodeId && nUnicodeId >= chStart) - { - // Found correct segment. Find Glyph Id - int16 idDelta = read(*(pMid += nSeg)); - uint16 idRangeOffset = read(*(pMid += nSeg)); - - if (idRangeOffset == 0) - return (uint16)(idDelta + nUnicodeId); // must use modulus 2^16 - - // Look up value in glyphIdArray - gr::gid16 nGlyphId = read(*(pMid + (nUnicodeId - chStart) + (idRangeOffset >> 1))); - // If this value is 0, return 0. Else add the idDelta - return nGlyphId ? nGlyphId + idDelta : 0; - } - - return 0; -} - -/*---------------------------------------------------------------------------------------------- - Return the next Unicode value in the cmap. Pass 0 to obtain the first item. - Returns 0xFFFF as the last item. - pRangeKey is an optional key that is used to optimize the search; its value is the range - in which the character is found. -----------------------------------------------------------------------------------------------*/ -unsigned int Cmap31NextCodepoint(const void *pCmap31, unsigned int nUnicodeId, int * pRangeKey) -{ - const Sfnt::CmapSubTableFormat4 * pTable = reinterpret_cast(pCmap31); - - uint16 nRange = read(pTable->seg_count_x2) >> 1; - - uint32 nUnicodePrev = (uint32)nUnicodeId; - - const uint16 * pStartCode = &(pTable->end_code[0]) - + nRange // length of end code array - + 1; // reserved word - - if (nUnicodePrev == 0) - { - // return the first codepoint. - if (pRangeKey) - *pRangeKey = 0; - return read(pStartCode[0]); - } - else if (nUnicodePrev >= 0xFFFF) - { - if (pRangeKey) - *pRangeKey = nRange - 1; - return 0xFFFF; - } - - int iRange = (pRangeKey) ? *pRangeKey : 0; - // Just in case we have a bad key: - while (iRange > 0 && read(pStartCode[iRange]) > nUnicodePrev) - iRange--; - while (read(pTable->end_code[iRange]) < nUnicodePrev) - iRange++; - - // Now iRange is the range containing nUnicodePrev. - unsigned int nStartCode = read(pStartCode[iRange]); - unsigned int nEndCode = read(pTable->end_code[iRange]); - - if (nStartCode > nUnicodePrev) - // Oops, nUnicodePrev is not in the cmap! Adjust so we get a reasonable - // answer this time around. - nUnicodePrev = nStartCode - 1; - - if (nEndCode > nUnicodePrev) - { - // Next is in the same range; it is the next successive codepoint. - if (pRangeKey) - *pRangeKey = iRange; - return nUnicodePrev + 1; - } - - // Otherwise the next codepoint is the first one in the next range. - // There is guaranteed to be a next range because there must be one that - // ends with 0xFFFF. - if (pRangeKey) - *pRangeKey = iRange + 1; - return read(pStartCode[iRange + 1]); -} - -/*---------------------------------------------------------------------------------------------- - Check the Microsoft UCS-4 subtable for expected values -----------------------------------------------------------------------------------------------*/ -bool CheckCmap310Subtable(const void *pCmap310) -{ - const Sfnt::CmapSubTable * pTable = reinterpret_cast(pCmap310); - return read(pTable->format) == 12; -} - -/*---------------------------------------------------------------------------------------------- - Return the Glyph ID for the given Unicode ID in the Microsoft UCS-4 subtable. - (Actually this code only depends on subtable being format 12.) - Return 0 if the Unicode ID is not in the subtable. -----------------------------------------------------------------------------------------------*/ -gr::gid16 Cmap310Lookup(const void * pCmap310, unsigned int uUnicodeId) -{ - const Sfnt::CmapSubTableFormat12 * pTable = reinterpret_cast(pCmap310); - - //uint32 uLength = read(pTable->length); //could use to test for premature end of table - uint32 ucGroups = read(pTable->num_groups); - - for (unsigned int i = 0; i < ucGroups; i++) - { - uint32 uStartCode = read(pTable->group[i].start_char_code); - uint32 uEndCode = read(pTable->group[i].end_char_code); - if (uUnicodeId >= uStartCode && uUnicodeId <= uEndCode) - { - uint32 uDiff = uUnicodeId - uStartCode; - uint32 uStartGid = read(pTable->group[i].start_glyph_id); - return static_cast(uStartGid + uDiff); - } - } - - return 0; -} - -/*---------------------------------------------------------------------------------------------- - Return the next Unicode value in the cmap. Pass 0 to obtain the first item. - Returns 0x10FFFF as the last item. - pRangeKey is an optional key that is used to optimize the search; its value is the range - in which the character is found. -----------------------------------------------------------------------------------------------*/ -unsigned int Cmap310NextCodepoint(const void *pCmap310, unsigned int nUnicodeId, int * pRangeKey) -{ - const Sfnt::CmapSubTableFormat12 * pTable = reinterpret_cast(pCmap310); - - int nRange = read(pTable->num_groups); - - uint32 nUnicodePrev = (uint32)nUnicodeId; - - if (nUnicodePrev == 0) - { - // return the first codepoint. - if (pRangeKey) - *pRangeKey = 0; - return read(pTable->group[0].start_char_code); - } - else if (nUnicodePrev >= 0x10FFFF) - { - if (pRangeKey) - *pRangeKey = nRange; - return 0x10FFFF; - } - - int iRange = (pRangeKey) ? *pRangeKey : 0; - // Just in case we have a bad key: - while (iRange > 0 && read(pTable->group[iRange].start_char_code) > nUnicodePrev) - iRange--; - while (read(pTable->group[iRange].end_char_code) < nUnicodePrev) - iRange++; - - // Now iRange is the range containing nUnicodePrev. - - unsigned int nStartCode = read(pTable->group[iRange].start_char_code); - unsigned int nEndCode = read(pTable->group[iRange].end_char_code); - - if (nStartCode > nUnicodePrev) - // Oops, nUnicodePrev is not in the cmap! Adjust so we get a reasonable - // answer this time around. - nUnicodePrev = nStartCode - 1; - - if (nEndCode > nUnicodePrev) - { - // Next is in the same range; it is the next successive codepoint. - if (pRangeKey) - *pRangeKey = iRange; - return nUnicodePrev + 1; - } - - // Otherwise the next codepoint is the first one in the next range, or 10FFFF if we're done. - if (pRangeKey) - *pRangeKey = iRange + 1; - return (iRange + 1 >= nRange) ? 0x10FFFF : read(pTable->group[iRange + 1].start_char_code); -} - -/*---------------------------------------------------------------------------------------------- - Return the offset stored in the loca table for the given Glyph ID. - (This offset is into the glyf table.) - Return -1 if the lookup failed. - Technically this method should return an unsigned long but it is unlikely the offset will - exceed 2^31. -----------------------------------------------------------------------------------------------*/ -size_t LocaLookup(gr::gid16 nGlyphId, - const void * pLoca, size_t lLocaSize, - const void * pHead) throw (std::out_of_range) -{ - const Sfnt::FontHeader * pTable = reinterpret_cast(pHead); - - // CheckTable verifies the index_to_loc_format is valid - if (read(pTable->index_to_loc_format) == Sfnt::FontHeader::ShortIndexLocFormat) - { // loca entries are two bytes and have been divided by two - if (nGlyphId <= (lLocaSize >> 1) - 1) // allow sentinel value to be accessed - { - const uint16 * pTable = reinterpret_cast(pLoca); - return (read(pTable[nGlyphId]) << 1); - } - } - - if (read(pTable->index_to_loc_format) == Sfnt::FontHeader::LongIndexLocFormat) - { // loca entries are four bytes - if (nGlyphId <= (lLocaSize >> 2) - 1) - { - const uint32 * pTable = reinterpret_cast(pLoca); - return read(pTable[nGlyphId]); - } - } - - // only get here if glyph id was bad - //return -1; - throw std::out_of_range("glyph id out of range for font"); -} - -/*---------------------------------------------------------------------------------------------- - Return a pointer into the glyf table based on the given offset (from LocaLookup). - Return NULL on error. -----------------------------------------------------------------------------------------------*/ -void * GlyfLookup(const void * pGlyf, size_t nGlyfOffset) -{ - const uint8 * pByte = reinterpret_cast(pGlyf); - return const_cast(pByte + nGlyfOffset); -} - -/*---------------------------------------------------------------------------------------------- - Get the bounding box coordinates for a simple glyf entry (non-composite) - Return true if successful, false otherwise -----------------------------------------------------------------------------------------------*/ -bool GlyfBox(const void * pSimpleGlyf, int & xMin, int & yMin, - int & xMax, int & yMax) -{ - const Sfnt::Glyph * pGlyph = reinterpret_cast(pSimpleGlyf); - - xMin = read(pGlyph->x_min); - yMin = read(pGlyph->y_min); - xMax = read(pGlyph->x_max); - yMax = read(pGlyph->y_max); - - return true; -} - -/*---------------------------------------------------------------------------------------------- - Return the number of contours for a simple glyf entry (non-composite) - Returning -1 means this is a composite glyph -----------------------------------------------------------------------------------------------*/ -int GlyfContourCount(const void * pSimpleGlyf) -{ - const Sfnt::Glyph * pGlyph = reinterpret_cast(pSimpleGlyf); - return read(pGlyph->number_of_contours); // -1 means composite glyph -} - -/*---------------------------------------------------------------------------------------------- - Get the point numbers for the end points of the glyph contours for a simple - glyf entry (non-composite). - cnPointsTotal - count of contours from GlyfContourCount(); (same as number of end points) - prgnContourEndPoints - should point to a buffer large enough to hold cnPoints integers - cnPoints - count of points placed in above range - Return true if successful, false otherwise. - False could indicate a multi-level composite glyphs. -----------------------------------------------------------------------------------------------*/ -bool GlyfContourEndPoints(const void * pSimpleGlyf, int * prgnContourEndPoint, - int cnPointsTotal, int & cnPoints) -{ - const Sfnt::SimpleGlyph * pGlyph = reinterpret_cast(pSimpleGlyf); - - int cContours = read(pGlyph->number_of_contours); - if (cContours < 0) - return false; // this method isn't supposed handle composite glyphs - - for (int i = 0; i < cContours && i < cnPointsTotal; i++) - { - prgnContourEndPoint[i] = read(pGlyph->end_pts_of_contours[i]); - } - - cnPoints = cContours; - return true; -} - -/*---------------------------------------------------------------------------------------------- - Get the points for a simple glyf entry (non-composite) - cnPointsTotal - count of points from largest end point obtained from GlyfContourEndPoints - prgnX & prgnY - should point to buffers large enough to hold cnPointsTotal integers - The ranges are parallel so that coordinates for point(n) are found at offset n in both - ranges. This is raw point data with relative coordinates. - prgbFlag - should point to a buffer a large enough to hold cnPointsTotal bytes - This range is parallel to the prgnX & prgnY - cnPoints - count of points placed in above ranges - Return true if successful, false otherwise. - False could indicate a composite glyph - TODO: implement -----------------------------------------------------------------------------------------------*/ -bool GlyfPoints(const void * pSimpleGlyf, int * prgnX, int * prgnY, - char * prgbFlag, int cnPointsTotal, int & cnPoints) -{ - using namespace Sfnt; - - const Sfnt::SimpleGlyph * pGlyph = reinterpret_cast(pSimpleGlyf); - int cContours = read(pGlyph->number_of_contours); - // return false for composite glyph - if (cContours <= 0) - return false; - int cPts = read(pGlyph->end_pts_of_contours[cContours - 1]) + 1; - if (cPts > cnPointsTotal) - return false; - - // skip over bounding box data & point to byte count of instructions (hints) - const uint8 * pbGlyph = reinterpret_cast - (&pGlyph->end_pts_of_contours[cContours]); - - // skip over hints & point to first flag - int cbHints = read(*(const uint16 *)pbGlyph); - pbGlyph += sizeof(uint16); - pbGlyph += cbHints; - - // load flags & point to first x coordinate - int iFlag = 0; - while (iFlag < cPts) - { - if (!(*pbGlyph & SimpleGlyph::Repeat)) - { // flag isn't repeated - prgbFlag[iFlag] = (char)*pbGlyph; - pbGlyph++; - iFlag++; - } - else - { // flag is repeated; count specified by next byte - char chFlag = (char)*pbGlyph; - pbGlyph++; - int cFlags = (int)*pbGlyph; - pbGlyph++; - prgbFlag[iFlag] = chFlag; - iFlag++; - for (int i = 0; i < cFlags; i++) - { - prgbFlag[iFlag + i] = chFlag; - } - iFlag += cFlags; - } - } - if (iFlag != cPts) - return false; - - // load x coordinates - iFlag = 0; - while (iFlag < cPts) - { - if (prgbFlag[iFlag] & SimpleGlyph::XShort) - { - prgnX[iFlag] = *pbGlyph; - if (!(prgbFlag[iFlag] & SimpleGlyph::XIsPos)) - { - prgnX[iFlag] = -prgnX[iFlag]; - } - pbGlyph++; - } - else - { - if (prgbFlag[iFlag] & SimpleGlyph::XIsSame) - { - prgnX[iFlag] = 0; - // do NOT increment pbGlyph - } - else - { - prgnX[iFlag] = read(*(const int16 *)pbGlyph); - pbGlyph += sizeof(int16); - } - } - iFlag++; - } - - // load y coordinates - iFlag = 0; - while (iFlag < cPts) - { - if (prgbFlag[iFlag] & SimpleGlyph::YShort) - { - prgnY[iFlag] = *pbGlyph; - if (!(prgbFlag[iFlag] & SimpleGlyph::YIsPos)) - { - prgnY[iFlag] = -prgnY[iFlag]; - } - pbGlyph++; - } - else - { - if (prgbFlag[iFlag] & SimpleGlyph::YIsSame) - { - prgnY[iFlag] = 0; - // do NOT increment pbGlyph - } - else - { - prgnY[iFlag] = read(*(const int16 *)pbGlyph); - pbGlyph += sizeof(int16); - } - } - iFlag++; - } - - cnPoints = cPts; - return true; -} - -/*---------------------------------------------------------------------------------------------- - Fill prgnCompId with the component Glyph IDs from pSimpleGlyf. - Client must allocate space before calling. - pSimpleGlyf - assumed to point to a composite glyph - cCompIdTotal - the number of elements in prgnCompId - cCompId - the total number of Glyph IDs stored in prgnCompId - Return true if successful, false otherwise - False could indicate a non-composite glyph or the input array was not big enough -----------------------------------------------------------------------------------------------*/ -bool GetComponentGlyphIds(const void * pSimpleGlyf, int * prgnCompId, - size_t cnCompIdTotal, size_t & cnCompId) -{ - using namespace Sfnt; - - if (GlyfContourCount(pSimpleGlyf) >= 0) - return false; - - const Sfnt::SimpleGlyph * pGlyph = reinterpret_cast(pSimpleGlyf); - // for a composite glyph, the special data begins here - const uint8 * pbGlyph = reinterpret_cast(&pGlyph->end_pts_of_contours[0]); - - uint16 GlyphFlags; - size_t iCurrentComp = 0; - do - { - GlyphFlags = read(*((const uint16 *)pbGlyph)); - pbGlyph += sizeof(uint16); - prgnCompId[iCurrentComp++] = read(*((const uint16 *)pbGlyph)); - pbGlyph += sizeof(uint16); - if (iCurrentComp >= cnCompIdTotal) - return false; - int nOffset = 0; - nOffset += GlyphFlags & CompoundGlyph::Arg1Arg2Words ? 4 : 2; - nOffset += GlyphFlags & CompoundGlyph::HaveScale ? 2 : 0; - nOffset += GlyphFlags & CompoundGlyph::HaveXAndYScale ? 4 : 0; - nOffset += GlyphFlags & CompoundGlyph::HaveTwoByTwo ? 8 : 0; - pbGlyph += nOffset; - } while (GlyphFlags & CompoundGlyph::MoreComponents); - - cnCompId = iCurrentComp; - - return true; -} - -/*---------------------------------------------------------------------------------------------- - Return info on how a component glyph is to be placed - pSimpleGlyph - assumed to point to a composite glyph - nCompId - glyph id for component of interest - bOffset - if true, a & b are the x & y offsets for this component - if false, b is the point on this component that is attaching to point a on the - preceding glyph - Return true if successful, false otherwise - False could indicate a non-composite glyph or that component wasn't found -----------------------------------------------------------------------------------------------*/ -bool GetComponentPlacement(const void * pSimpleGlyf, int nCompId, - bool fOffset, int & a, int & b) -{ - using namespace Sfnt; - - if (GlyfContourCount(pSimpleGlyf) >= 0) - return false; - - const Sfnt::SimpleGlyph * pGlyph = reinterpret_cast(pSimpleGlyf); - // for a composite glyph, the special data begins here - const uint8 * pbGlyph = reinterpret_cast(&pGlyph->end_pts_of_contours[0]); - - uint16 GlyphFlags; - do - { - GlyphFlags = read(*((const uint16 *)pbGlyph)); - pbGlyph += sizeof(uint16); - if (read(*((const uint16 *)pbGlyph)) == nCompId) - { - pbGlyph += sizeof(uint16); // skip over glyph id of component - fOffset = (GlyphFlags & CompoundGlyph::ArgsAreXYValues) == CompoundGlyph::ArgsAreXYValues; - - if (GlyphFlags & CompoundGlyph::Arg1Arg2Words ) - { - a = read(*(const int16 *)pbGlyph); - pbGlyph += sizeof(int16); - b = read(*(const int16 *)pbGlyph); - pbGlyph += sizeof(int16); - } - else - { // args are signed bytes - a = *pbGlyph++; - b = *pbGlyph++; - } - return true; - } - pbGlyph += sizeof(uint16); // skip over glyph id of component - int nOffset = 0; - nOffset += GlyphFlags & CompoundGlyph::Arg1Arg2Words ? 4 : 2; - nOffset += GlyphFlags & CompoundGlyph::HaveScale ? 2 : 0; - nOffset += GlyphFlags & CompoundGlyph::HaveXAndYScale ? 4 : 0; - nOffset += GlyphFlags & CompoundGlyph::HaveTwoByTwo ? 8 : 0; - pbGlyph += nOffset; - } while (GlyphFlags & CompoundGlyph::MoreComponents); - - // didn't find requested component - fOffset = true; - a = 0; - b = 0; - return false; -} - -/*---------------------------------------------------------------------------------------------- - Return info on how a component glyph is to be transformed - pSimpleGlyph - assumed to point to a composite glyph - nCompId - glyph id for component of interest - flt11, flt11, flt11, flt11 - a 2x2 matrix giving the transform - bTransOffset - whether to transform the offset from above method - The spec is unclear about the meaning of this flag - Currently - initialize to true for MS rasterizer and false for Mac rasterizer, then - on return it will indicate whether transform should apply to offset (MSDN CD 10/99) - Return true if successful, false otherwise - False could indicate a non-composite glyph or that component wasn't found -----------------------------------------------------------------------------------------------*/ -bool GetComponentTransform(const void * pSimpleGlyf, int nCompId, - float & flt11, float & flt12, float & flt21, float & flt22, - bool & fTransOffset) -{ - using namespace Sfnt; - - if (GlyfContourCount(pSimpleGlyf) >= 0) - return false; - - const Sfnt::SimpleGlyph * pGlyph = reinterpret_cast(pSimpleGlyf); - // for a composite glyph, the special data begins here - const uint8 * pbGlyph = reinterpret_cast(&pGlyph->end_pts_of_contours[0]); - - uint16 GlyphFlags; - do - { - GlyphFlags = read(*((const uint16 *)pbGlyph)); - pbGlyph += sizeof(uint16); - if (read(*((const uint16 *)pbGlyph)) == nCompId) - { - pbGlyph += sizeof(uint16); // skip over glyph id of component - pbGlyph += GlyphFlags & CompoundGlyph::Arg1Arg2Words ? 4 : 2; // skip over placement data - - if (fTransOffset) // MS rasterizer - fTransOffset = !(GlyphFlags & CompoundGlyph::UnscaledOffset); - else // Apple rasterizer - fTransOffset = (GlyphFlags & CompoundGlyph::ScaledOffset) != 0; - - if (GlyphFlags & CompoundGlyph::HaveScale) - { - flt11 = fixed_to_float<14>(read(*(const uint16 *)pbGlyph)); - pbGlyph += sizeof(uint16); - flt12 = 0; - flt21 = 0; - flt22 = flt11; - } - else if (GlyphFlags & CompoundGlyph::HaveXAndYScale) - { - flt11 = fixed_to_float<14>(read(*(const uint16 *)pbGlyph)); - pbGlyph += sizeof(uint16); - flt12 = 0; - flt21 = 0; - flt22 = fixed_to_float<14>(read(*(const uint16 *)pbGlyph)); - pbGlyph += sizeof(uint16); - } - else if (GlyphFlags & CompoundGlyph::HaveTwoByTwo) - { - flt11 = fixed_to_float<14>(read(*(const uint16 *)pbGlyph)); - pbGlyph += sizeof(uint16); - flt12 = fixed_to_float<14>(read(*(const uint16 *)pbGlyph)); - pbGlyph += sizeof(uint16); - flt21 = fixed_to_float<14>(read(*(const uint16 *)pbGlyph)); - pbGlyph += sizeof(uint16); - flt22 = fixed_to_float<14>(read(*(const uint16 *)pbGlyph)); - pbGlyph += sizeof(uint16); - } - else - { // identity transform - flt11 = 1.0; - flt12 = 0.0; - flt21 = 0.0; - flt22 = 1.0; - } - return true; - } - pbGlyph += sizeof(uint16); // skip over glyph id of component - int nOffset = 0; - nOffset += GlyphFlags & CompoundGlyph::Arg1Arg2Words ? 4 : 2; - nOffset += GlyphFlags & CompoundGlyph::HaveScale ? 2 : 0; - nOffset += GlyphFlags & CompoundGlyph::HaveXAndYScale ? 4 : 0; - nOffset += GlyphFlags & CompoundGlyph::HaveTwoByTwo ? 8 : 0; - pbGlyph += nOffset; - } while (GlyphFlags & CompoundGlyph::MoreComponents); - - // didn't find requested component - fTransOffset = false; - flt11 = 1; - flt12 = 0; - flt21 = 0; - flt22 = 1; - return false; -} - -/*---------------------------------------------------------------------------------------------- - Return a pointer into the glyf table based on the given tables and Glyph ID - Since this method doesn't check for spaces, it is good to call IsSpace before using it. - Return NULL on error -----------------------------------------------------------------------------------------------*/ -void * GlyfLookup(gr::gid16 nGlyphId, const void * pGlyf, const void * pLoca, - size_t lLocaSize, const void * pHead) -{ - // test for valid glyph id - // CheckTable verifies the index_to_loc_format is valid - - const Sfnt::FontHeader * pTable - = reinterpret_cast(pHead); - - if (read(pTable->index_to_loc_format) == Sfnt::FontHeader::ShortIndexLocFormat) - { // loca entries are two bytes (and have been divided by two) - if (nGlyphId >= (lLocaSize >> 1) - 1) // don't allow nGlyphId to access sentinel - throw std::out_of_range("glyph id out of range for font"); - } - if (read(pTable->index_to_loc_format) == Sfnt::FontHeader::LongIndexLocFormat) - { // loca entries are four bytes - if (nGlyphId >= (lLocaSize >> 2) - 1) - throw std::out_of_range("glyph id out of range for font"); - } - - long lGlyfOffset = LocaLookup(nGlyphId, pLoca, lLocaSize, pHead); - void * pSimpleGlyf = GlyfLookup(pGlyf, lGlyfOffset); // invalid loca offset returns null - return pSimpleGlyf; -} - -/*---------------------------------------------------------------------------------------------- - Determine if a particular Glyph ID has any data in the glyf table. If it is white space, - there will be no glyf data, though there will be metric data in hmtx, etc. -----------------------------------------------------------------------------------------------*/ -bool IsSpace(gr::gid16 nGlyphId, const void * pLoca, size_t lLocaSize, const void * pHead) -{ - size_t lGlyfOffset = LocaLookup(nGlyphId, pLoca, lLocaSize, pHead); - - // the +1 should always work because there is a sentinel value at the end of the loca table - size_t lNextGlyfOffset = LocaLookup(nGlyphId + 1, pLoca, lLocaSize, pHead); - - return (lNextGlyfOffset - lGlyfOffset) == 0; -} - -/*---------------------------------------------------------------------------------------------- - Determine if a particular Glyph ID is a multi-level composite. -----------------------------------------------------------------------------------------------*/ -bool IsDeepComposite(gr::gid16 nGlyphId, const void * pGlyf, const void * pLoca, - long lLocaSize, const void * pHead) -{ - if (IsSpace(nGlyphId, pLoca, lLocaSize, pHead)) {return false;} - - void * pSimpleGlyf = GlyfLookup(nGlyphId, pGlyf, pLoca, lLocaSize, pHead); - if (pSimpleGlyf == NULL) - return false; // no way to really indicate an error occured here - - if (GlyfContourCount(pSimpleGlyf) >= 0) - return false; - - int rgnCompId[kMaxGlyphComponents]; // assumes only a limited number of glyph components - size_t cCompIdTotal = kMaxGlyphComponents; - size_t cCompId = 0; - - if (!GetComponentGlyphIds(pSimpleGlyf, rgnCompId, cCompIdTotal, cCompId)) - return false; - - for (size_t i = 0; i < cCompId; i++) - { - void * pSimpleGlyf = GlyfLookup(static_cast(rgnCompId[i]), - pGlyf, pLoca, lLocaSize, pHead); - if (pSimpleGlyf == NULL) {return false;} - - if (GlyfContourCount(pSimpleGlyf) < 0) - return true; - } - - return false; -} - -/*---------------------------------------------------------------------------------------------- - Get the bounding box coordinates based on the given tables and Glyph ID - Handles both simple and composite glyphs. - Return true if successful, false otherwise. On false, all point values will be INT_MIN - False may indicate a white space glyph -----------------------------------------------------------------------------------------------*/ -bool GlyfBox(gr::gid16 nGlyphId, const void * pGlyf, const void * pLoca, - size_t lLocaSize, const void * pHead, int & xMin, int & yMin, int & xMax, int & yMax) -{ - xMin = yMin = xMax = yMax = INT_MIN; - - if (IsSpace(nGlyphId, pLoca, lLocaSize, pHead)) {return false;} - - void * pSimpleGlyf = GlyfLookup(nGlyphId, pGlyf, pLoca, lLocaSize, pHead); - if (pSimpleGlyf == NULL) {return false;} - - return GlyfBox(pSimpleGlyf, xMin, yMin, xMax, yMax); -} - -/*---------------------------------------------------------------------------------------------- - Get the number of contours based on the given tables and Glyph ID - Handles both simple and composite glyphs. - Return true if successful, false otherwise. On false, cnContours will be INT_MIN - False may indicate a white space glyph or a multi-level composite glyph. -----------------------------------------------------------------------------------------------*/ -bool GlyfContourCount(gr::gid16 nGlyphId, const void * pGlyf, const void * pLoca, - size_t lLocaSize, const void * pHead, size_t & cnContours) -{ - cnContours = static_cast(INT_MIN); - - if (IsSpace(nGlyphId, pLoca, lLocaSize, pHead)) {return false;} - - void * pSimpleGlyf = GlyfLookup(nGlyphId, pGlyf, pLoca, lLocaSize, pHead); - if (pSimpleGlyf == NULL) {return false;} - - int cRtnContours = GlyfContourCount(pSimpleGlyf); - if (cRtnContours >= 0) - { - cnContours = size_t(cRtnContours); - return true; - } - - //handle composite glyphs - - int rgnCompId[kMaxGlyphComponents]; // assumes no glyph will be made of more than 8 components - size_t cCompIdTotal = kMaxGlyphComponents; - size_t cCompId = 0; - - if (!GetComponentGlyphIds(pSimpleGlyf, rgnCompId, cCompIdTotal, cCompId)) - return false; - - cRtnContours = 0; - int cTmp = 0; - for (size_t i = 0; i < cCompId; i++) - { - if (IsSpace(static_cast(rgnCompId[i]), pLoca, lLocaSize, pHead)) {return false;} - pSimpleGlyf = GlyfLookup(static_cast(rgnCompId[i]), - pGlyf, pLoca, lLocaSize, pHead); - if (pSimpleGlyf == 0) {return false;} - // return false on multi-level composite - if ((cTmp = GlyfContourCount(pSimpleGlyf)) < 0) - return false; - cRtnContours += cTmp; - } - - cnContours = size_t(cRtnContours); - return true; -} - -/*---------------------------------------------------------------------------------------------- - Get the point numbers for the end points of the glyph contours based on the given tables - and Glyph ID - Handles both simple and composite glyphs. - cnPoints - count of contours from GlyfContourCount (same as number of end points) - prgnContourEndPoints - should point to a buffer large enough to hold cnPoints integers - Return true if successful, false otherwise. On false, all end points are INT_MIN - False may indicate a white space glyph or a multi-level composite glyph. -----------------------------------------------------------------------------------------------*/ -bool GlyfContourEndPoints(gr::gid16 nGlyphId, const void * pGlyf, const void * pLoca, - size_t lLocaSize, const void * pHead, - int * prgnContourEndPoint, size_t cnPoints) -{ - std::fill_n(prgnContourEndPoint, cnPoints, INT_MIN); - - if (IsSpace(nGlyphId, pLoca, lLocaSize, pHead)) {return false;} - - void * pSimpleGlyf = GlyfLookup(nGlyphId, pGlyf, pLoca, lLocaSize, pHead); - if (pSimpleGlyf == NULL) {return false;} - - int cContours = GlyfContourCount(pSimpleGlyf); - int cActualPts = 0; - if (cContours > 0) - return GlyfContourEndPoints(pSimpleGlyf, prgnContourEndPoint, cnPoints, cActualPts); - - // handle composite glyphs - - int rgnCompId[kMaxGlyphComponents]; // assumes no glyph will be made of more than 8 components - size_t cCompIdTotal = kMaxGlyphComponents; - size_t cCompId = 0; - - if (!GetComponentGlyphIds(pSimpleGlyf, rgnCompId, cCompIdTotal, cCompId)) - return false; - - int * prgnCurrentEndPoint = prgnContourEndPoint; - int cCurrentPoints = cnPoints; - int nPrevPt = 0; - for (size_t i = 0; i < cCompId; i++) - { - if (IsSpace(static_cast(rgnCompId[i]), pLoca, lLocaSize, pHead)) {return false;} - pSimpleGlyf = GlyfLookup(static_cast(rgnCompId[i]), pGlyf, pLoca, lLocaSize, pHead); - if (pSimpleGlyf == NULL) {return false;} - // returns false on multi-level composite - if (!GlyfContourEndPoints(pSimpleGlyf, prgnCurrentEndPoint, cCurrentPoints, cActualPts)) - return false; - // points in composite are numbered sequentially as components are added - // must adjust end point numbers for new point numbers - for (int j = 0; j < cActualPts; j++) - prgnCurrentEndPoint[j] += nPrevPt; - nPrevPt = prgnCurrentEndPoint[cActualPts - 1] + 1; - - prgnCurrentEndPoint += cActualPts; - cCurrentPoints -= cActualPts; - } - - return true; -} - -/*---------------------------------------------------------------------------------------------- - Get the points for a glyph based on the given tables and Glyph ID - Handles both simple and composite glyphs. - cnPoints - count of points from largest end point obtained from GlyfContourEndPoints - prgnX & prgnY - should point to buffers large enough to hold cnPoints integers - The ranges are parallel so that coordinates for point(n) are found at offset n in - both ranges. These points are in absolute coordinates. - prgfOnCurve - should point to a buffer a large enough to hold cnPoints bytes (bool) - This range is parallel to the prgnX & prgnY - Return true if successful, false otherwise. On false, all points may be INT_MIN - False may indicate a white space glyph, a multi-level composite, or a corrupt font - // TODO: doesn't support composite glyphs whose components are themselves components - It's not clear from the TTF spec when the transforms should be applied. Should the - transform be done before or after attachment point calcs? (current code - before) - Should the transform be applied to other offsets? (currently - no; however commented - out code is in place so that if CompoundGlyph::UnscaledOffset on the MS rasterizer is - clear (typical) then yes, and if CompoundGlyph::ScaledOffset on the Apple rasterizer is - clear (typical?) then no). See GetComponentTransform. - It's also unclear where point numbering with attachment poinst starts - (currently - first point number is relative to whole glyph, second point number is - relative to current glyph). -----------------------------------------------------------------------------------------------*/ -bool GlyfPoints(gr::gid16 nGlyphId, const void * pGlyf, - const void * pLoca, size_t lLocaSize, const void * pHead, - const int * prgnContourEndPoint, size_t cnEndPoints, - int * prgnX, int * prgnY, bool * prgfOnCurve, size_t cnPoints) -{ - std::fill_n(prgnX, cnPoints, INT_MAX); - std::fill_n(prgnY, cnPoints, INT_MAX); - - if (IsSpace(nGlyphId, pLoca, lLocaSize, pHead)) - return false; - - void * pSimpleGlyf = GlyfLookup(nGlyphId, pGlyf, pLoca, lLocaSize, pHead); - if (pSimpleGlyf == NULL) - return false; - - int cContours = GlyfContourCount(pSimpleGlyf); - int cActualPts; - if (cContours > 0) - { - if (!GlyfPoints(pSimpleGlyf, prgnX, prgnY, (char *)prgfOnCurve, cnPoints, cActualPts)) - return false; - CalcAbsolutePoints(prgnX, prgnY, cnPoints); - SimplifyFlags((char *)prgfOnCurve, cnPoints); - return true; - } - - // handle composite glyphs - int rgnCompId[kMaxGlyphComponents]; // assumes no glyph will be made of more than 8 components - size_t cCompIdTotal = kMaxGlyphComponents; - size_t cCompId = 0; - - // this will fail if there are more components than there is room for - if (!GetComponentGlyphIds(pSimpleGlyf, rgnCompId, cCompIdTotal, cCompId)) - return false; - - int * prgnCurrentX = prgnX; - int * prgnCurrentY = prgnY; - char * prgbCurrentFlag = (char *)prgfOnCurve; // converting bool to char should be safe - int cCurrentPoints = cnPoints; - bool fOffset = true, fTransOff = true; - int a, b; - float flt11, flt12, flt21, flt22; - // int * prgnPrevX = prgnX; // in case first att pt number relative to preceding glyph - // int * prgnPrevY = prgnY; - for (size_t i = 0; i < cCompId; i++) - { - if (IsSpace(static_cast(rgnCompId[i]), pLoca, lLocaSize, pHead)) {return false;} - void * pCompGlyf = GlyfLookup(static_cast(rgnCompId[i]), pGlyf, pLoca, lLocaSize, pHead); - if (pCompGlyf == NULL) {return false;} - // returns false on multi-level composite - if (!GlyfPoints(pCompGlyf, prgnCurrentX, prgnCurrentY, prgbCurrentFlag, - cCurrentPoints, cActualPts)) - return false; - if (!GetComponentPlacement(pSimpleGlyf, rgnCompId[i], fOffset, a, b)) - return false; - if (!GetComponentTransform(pSimpleGlyf, rgnCompId[i], - flt11, flt12, flt21, flt22, fTransOff)) - return false; - bool fIdTrans = flt11 == 1.0 && flt12 == 0.0 && flt21 == 0.0 && flt22 == 1.0; - - // convert points to absolute coordinates - // do before transform and attachment point placement are applied - CalcAbsolutePoints(prgnCurrentX, prgnCurrentY, cActualPts); - - // apply transform - see main method note above - // do before attachment point calcs - if (!fIdTrans) - for (int j = 0; j < cActualPts; j++) - { - int x = prgnCurrentX[j]; // store before transform applied - int y = prgnCurrentY[j]; - prgnCurrentX[j] = (int)(x * flt11 + y * flt12); - prgnCurrentY[j] = (int)(x * flt21 + y * flt22); - } - - // apply placement - see main method note above - int nXOff, nYOff; - if (fOffset) // explicit x & y offsets - { - /* ignore fTransOff for now - if (fTransOff && !fIdTrans) - { // transform x & y offsets - nXOff = (int)(a * flt11 + b * flt12); - nYOff = (int)(a * flt21 + b * flt22); - } - else */ - { // don't transform offset - nXOff = a; - nYOff = b; - } - } - else // attachment points - { // in case first point is relative to preceding glyph and second relative to current - // nXOff = prgnPrevX[a] - prgnCurrentX[b]; - // nYOff = prgnPrevY[a] - prgnCurrentY[b]; - // first point number relative to whole composite, second relative to current glyph - nXOff = prgnX[a] - prgnCurrentX[b]; - nYOff = prgnY[a] - prgnCurrentY[b]; - } - for (int j = 0; j < cActualPts; j++) - { - prgnCurrentX[j] += nXOff; - prgnCurrentY[j] += nYOff; - } - - // prgnPrevX = prgnCurrentX; - // prgnPrevY = prgnCurrentY; - prgnCurrentX += cActualPts; - prgnCurrentY += cActualPts; - prgbCurrentFlag += cActualPts; - cCurrentPoints -= cActualPts; - } - - SimplifyFlags((char *)prgfOnCurve, cnPoints); - - return true; -} - -/*---------------------------------------------------------------------------------------------- - Simplify the meaning of flags to just indicate whether point is on-curve or off-curve ----------------------------------------------------------------------------------------------*/ -bool SimplifyFlags(char * prgbFlags, int cnPoints) -{ - for (int i = 0; i < cnPoints; i++) - prgbFlags[i] = static_cast(prgbFlags[i] & Sfnt::SimpleGlyph::OnCurve); - return true; -} - -/*---------------------------------------------------------------------------------------------- - Convert relative point coordinates to absolute coordinates - Points are stored in the font such that they are offsets from one another except for the - first point of a glyph. ----------------------------------------------------------------------------------------------*/ -bool CalcAbsolutePoints(int * prgnX, int * prgnY, int cnPoints) -{ - int nX = prgnX[0]; - int nY = prgnY[0]; - for (int i = 1; i < cnPoints; i++) - { - prgnX[i] += nX; - nX = prgnX[i]; - prgnY[i] += nY; - nY = prgnY[i]; - } - - return true; -} - -/*---------------------------------------------------------------------------------------------- - Convert a numerical table ID to a string containing the actual name of the table. - Returns native order unsigned long. ----------------------------------------------------------------------------------------------*/ -gr::fontTableId32 TableIdTag(const TableId tid) -{ - assert(sizeof(mapIdToTag) == sizeof(gr::fontTableId32) * ktiLast); - assert(tid < ktiLast); - - return mapIdToTag[tid]; -} - -/*---------------------------------------------------------------------------------------------- - Return the length of the 'name' table in bytes. - Currently used. ----------------------------------------------------------------------------------------------*/ -#if 0 -size_t NameTableLength(const gr::byte * pTable) -{ - gr::byte * pb = (const_cast(pTable)) + 2; // skip format - size_t cRecords = *pb++ << 8; cRecords += *pb++; - int dbStringOffset0 = (*pb++) << 8; dbStringOffset0 += *pb++; - int dbMaxStringOffset = 0; - for (size_t irec = 0; irec < cRecords; irec++) - { - int nPlatform = (*pb++) << 8; nPlatform += *pb++; - int nEncoding = (*pb++) << 8; nEncoding += *pb++; - int nLanguage = (*pb++) << 8; nLanguage += *pb++; - int nName = (*pb++) << 8; nName += *pb++; - int cbStringLen = (*pb++) << 8; cbStringLen += *pb++; - int dbStringOffset = (*pb++) << 8; dbStringOffset += *pb++; - if (dbMaxStringOffset < dbStringOffset + cbStringLen) - dbMaxStringOffset = dbStringOffset + cbStringLen; - } - return dbStringOffset0 + dbMaxStringOffset; -} -#endif - -} // end of namespace TtfUtil diff --git a/Build/source/libs/graphite/engine-2.3.1/src/font/TtfUtil.h b/Build/source/libs/graphite/engine-2.3.1/src/font/TtfUtil.h deleted file mode 100644 index bf437ff3475..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/src/font/TtfUtil.h +++ /dev/null @@ -1,147 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 2000, 2001 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: TtfUtil.h -Responsibility: Alan Ward -Last reviewed: Not yet. - -Description: - Utility class for handling TrueType font files. -----------------------------------------------------------------------------------------------*/ - -#ifdef _MSC_VER -#pragma once -#endif -#ifndef TTFUTIL_H -#define TTFUTIL_H - -#include -#include -#include "GrPlatform.h" - -// Enumeration used to specify a table in a TTF file -enum TableId -{ - ktiCmap, ktiCvt, ktiCryp, ktiHead, ktiFpgm, ktiGdir, ktiGlyf, - ktiHdmx, ktiHhea, ktiHmtx, ktiLoca, ktiKern, ktiLtsh, ktiMaxp, - ktiName, ktiOs2, ktiPost, ktiPrep, ktiFeat, ktiGlat, ktiGloc, - ktiSilf, ktiSile, ktiSill, - ktiLast /*This gives the enum length - it is not a real table*/ -}; - -/*---------------------------------------------------------------------------------------------- - Class providing utility methods to parse a TrueType font file (TTF). - Callling application handles all file input and memory allocation. - Assumes minimal knowledge of TTF file format. -----------------------------------------------------------------------------------------------*/ -namespace TtfUtil -{ - ////////////////////////////////// tools to find & check TTF tables - bool GetHeaderInfo(size_t & lOffset, size_t & lSize); - bool CheckHeader(const void * pHdr); - bool GetTableDirInfo(const void * pHdr, size_t & lOffset, size_t & lSize); - bool GetTableInfo(TableId ktiTableId, const void * pHdr, const void * pTableDir, - size_t & lOffset, size_t & lSize); - bool CheckTable(TableId ktiTableId, const void * pTable, size_t lTableSize); - - ////////////////////////////////// simple font wide info - size_t GlyphCount(const void * pMaxp); - size_t MaxCompositeComponentCount(const void * pMaxp); - size_t MaxCompositeLevelCount(const void * pMaxp); - size_t LocaGlyphCount(size_t lLocaSize, const void * pHead) throw (std::domain_error); - int DesignUnits(const void * pHead); - int HeadTableCheckSum(const void * pHead); - void HeadTableCreateTime(const void * pHead, unsigned int * pnDateBC, unsigned int * pnDateAD); - void HeadTableModifyTime(const void * pHead, unsigned int * pnDateBC, unsigned int * pnDateAD); - bool IsItalic(const void * pHead); - int FontAscent(const void * pOs2); - int FontDescent(const void * pOs2); - bool FontOs2Style(const void *pOs2, bool & fBold, bool & fItalic); - bool Get31EngFamilyInfo(const void * pName, size_t & lOffset, size_t & lSize); - bool Get31EngFullFontInfo(const void * pName, size_t & lOffset, size_t & lSize); - bool Get30EngFamilyInfo(const void * pName, size_t & lOffset, size_t & lSize); - bool Get30EngFullFontInfo(const void * pName, size_t & lOffset, size_t & lSize); - int PostLookup(const void * pPost, size_t lPostSize, const void * pMaxp, - const char * pPostName); - - ////////////////////////////////// utility methods helpful for name table - bool GetNameInfo(const void * pName, int nPlatformId, int nEncodingId, - int nLangId, int nNameId, size_t & lOffset, size_t & lSize); - //size_t NameTableLength(const gr::byte * pTable); - int GetLangsForNames(const void * pName, int nPlatformId, int nEncodingId, - int *nameIdList, int cNameIds, short *langIdList); - void SwapWString(void * pWStr, size_t nSize = 0) throw (std::invalid_argument); - - ////////////////////////////////// cmap lookup tools - void * FindCmapSubtable(const void * pCmap, int nPlatformId = 3, - int nEncodingId = 1); - bool CheckCmap31Subtable(const void * pCmap31); - gr::gid16 Cmap31Lookup(const void * pCmap31, int nUnicodeId); - unsigned int Cmap31NextCodepoint(const void *pCmap31, unsigned int nUnicodeId, - int * pRangeKey = 0); - bool CheckCmap310Subtable(const void *pCmap310); - gr::gid16 Cmap310Lookup(const void * pCmap310, unsigned int uUnicodeId); - unsigned int Cmap310NextCodepoint(const void *pCmap310, unsigned int nUnicodeId, - int * pRangeKey = 0); - - ///////////////////////////////// horizontal metric data for a glyph - bool HorMetrics(gr::gid16 nGlyphId, const void * pHmtx, size_t lHmtxSize, - const void * pHhea, int & nLsb, unsigned int & nAdvWid); - - ///////////////////////////////// convert our TableId enum to standard TTF tags - gr::fontTableId32 TableIdTag(const TableId); - - ////////////////////////////////// primitives for loca and glyf lookup - size_t LocaLookup(gr::gid16 nGlyphId, const void * pLoca, size_t lLocaSize, - const void * pHead) throw (std::out_of_range); - void * GlyfLookup(const void * pGlyf, size_t lGlyfOffset); - - ////////////////////////////////// primitves for simple glyph data - bool GlyfBox(const void * pSimpleGlyf, int & xMin, int & yMin, - int & xMax, int & yMax); - - int GlyfContourCount(const void * pSimpleGlyf); - bool GlyfContourEndPoints(const void * pSimpleGlyf, int * prgnContourEndPoint, - int cnPointsTotal, size_t & cnPoints); - bool GlyfPoints(const void * pSimpleGlyf, int * prgnX, int * prgnY, - char * prgbFlag, int cnPointsTotal, int & cnPoints); - - // primitive to find the glyph ids in a composite glyph - bool GetComponentGlyphIds(const void * pSimpleGlyf, int * prgnCompId, - size_t cnCompIdTotal, size_t & cnCompId); - // primitive to find the placement data for a component in a composite glyph - bool GetComponentPlacement(const void * pSimpleGlyf, int nCompId, - bool fOffset, int & a, int & b); - // primitive to find the transform data for a component in a composite glyph - bool GetComponentTransform(const void * pSimpleGlyf, int nCompId, - float & flt11, float & flt12, float & flt21, float & flt22, bool & fTransOffset); - - ////////////////////////////////// operate on composite or simple glyph (auto glyf lookup) - void * GlyfLookup(gr::gid16 nGlyphId, const void * pGlyf, const void * pLoca, - size_t lLocaSize, const void * pHead); // primitive used by below methods - - // below are primary user methods for handling glyf data - bool IsSpace(gr::gid16 nGlyphId, const void * pLoca, size_t lLocaSize, const void * pHead); - bool IsDeepComposite(gr::gid16 nGlyphId, const void * pGlyf, const void * pLoca, - size_t lLocaSize, const void * pHead); - - bool GlyfBox(gr::gid16 nGlyphId, const void * pGlyf, const void * pLoca, size_t lLocaSize, - const void * pHead, int & xMin, int & yMin, int & xMax, int & yMax); - bool GlyfContourCount(gr::gid16 nGlyphId, const void * pGlyf, const void * pLoca, - size_t lLocaSize, const void *pHead, size_t & cnContours); - bool GlyfContourEndPoints(gr::gid16 nGlyphId, const void * pGlyf, const void * pLoca, - size_t lLocaSize, const void * pHead, int * prgnContourEndPoint, size_t cnPoints); - bool GlyfPoints(gr::gid16 nGlyphId, const void * pGlyf, const void * pLoca, - size_t lLocaSize, const void * pHead, const int * prgnContourEndPoint, size_t cnEndPoints, - int * prgnX, int * prgnY, bool * prgfOnCurve, size_t cnPoints); - - // utitily method used by high-level GlyfPoints - bool SimplifyFlags(char * prgbFlags, int cnPoints); - bool CalcAbsolutePoints(int * prgnX, int * prgnY, int cnPoints); - -} // end of namespace TtfUtil - -#endif diff --git a/Build/source/libs/graphite/engine-2.3.1/src/generic/BinTree.h b/Build/source/libs/graphite/engine-2.3.1/src/generic/BinTree.h deleted file mode 100644 index a487df03770..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/src/generic/BinTree.h +++ /dev/null @@ -1,71 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 1999, 2001 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: BinTree.h -Responsibility: Darrell Zook -Last reviewed: 9/8/99 - -Description: - This file provides declarations of binary tree class(es). -----------------------------------------------------------------------------------------------*/ -#ifdef _MSC_VER -#pragma once -#endif -#ifndef BINTREE_H_INCLUDED -#define BINTREE_H_INCLUDED - -/*---------------------------------------------------------------------------------------------- - This template class implements a balanced tree, which is a binary tree where the height of - the two children of any node in the tree can only be different by +/- 1 or 0. - - The class of objects to be stored in the tree should be derived from BalTreeBase, because - the constructor of BalTreeBase adds an object to the tree in sorted order without - allocating any memory. - - Classes that derive from BalTreeBase must have a CompareKey member function that compares - a given key with this->key to determine which should be first when sorting the tree. - The declaration of CompareKey should be as follows: - int CompareKey(const Key & key); - and it should return: - <0 if key is less than the key in the current node (this->key) - 0 if key is equal to the key in the current node (this->key) - >0 if key is greater than the key in the current node (this->key) - - CAUTION: Classes that use this template should never be dynamically instantiated (by using - local variables or new/NewObj). This class is meant to be used only for global - instances of a class. The reason for this restriction is that the tree is never - destroyed, so using dynamic instantiations of objects would result in stale pointers - in the tree. - - Hungarian: btb -----------------------------------------------------------------------------------------------*/ - -template class BalTreeBase -{ -protected: - // Pointers to the left and right subtrees. - Obj * m_rgpobj[2]; - - // The difference between the height of the right sub tree and the height of the left - // sub tree. This should be -1, 0, or +1. Insert may temporarily set it to -2 or +2. - short m_dht; - - // Which way we went from this node when inserting the new node. - short m_ipobj; - - // Inserts this in the balanced tree. - BalTreeBase(Obj ** ppobjRoot, const Key & key); - - // Returns a node with the given key from the tree rooted at pobjRoot. - static Obj * Find(Obj * pobjRoot, const Key & key); - -private: - // Inserts a node in the tree rooted at *ppobjRoot, sorting it based on key. - void Insert(Obj ** ppobjRoot, const Key & key); -}; - -#endif // !BINTREE_H_INCLUDED - diff --git a/Build/source/libs/graphite/engine-2.3.1/src/generic/BinTree_i.cpp b/Build/source/libs/graphite/engine-2.3.1/src/generic/BinTree_i.cpp deleted file mode 100644 index 5929bf0bab1..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/src/generic/BinTree_i.cpp +++ /dev/null @@ -1,225 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 1999, 2001 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: BinTree_i.cpp -Responsibility: Darrell Zook -Last reviewed: 9/8/99 - -Description: - This file provides implementations of binary tree class(es). - It is used as an #include file in any file which derives from one of the classes. -----------------------------------------------------------------------------------------------*/ -#ifdef _MSC_VER -#pragma once -#endif -#ifndef BINTREE_I_CPP_INCLUDED -#define BINTREE_I_CPP_INCLUDED - -#include "BinTree.h" -////#include -////#include "GrPlatform.h" -#include "GrCommon.h" - - -//using namespace gr; - -/*********************************************************************************************** - BalTreeBase methods -***********************************************************************************************/ - -/*---------------------------------------------------------------------------------------------- - Constructor. - This calls Insert to add this node to the tree in the correct (sorted) position. - - Arguments: - [in] ppobjRoot -> The address of the pointer to the root node of the tree. - [in] key -> References the key of the node to insert. -----------------------------------------------------------------------------------------------*/ -template - BalTreeBase::BalTreeBase(Obj ** ppobjRoot, const Key & key) -{ - AssertPtr(ppobjRoot); - AssertPtrN(*ppobjRoot); - - m_rgpobj[0] = NULL; - m_rgpobj[1] = NULL; - m_dht = 0; - - Insert(ppobjRoot, key); -} - -/*---------------------------------------------------------------------------------------------- - This method finds a node with the given key within the tree. If the key is not found in - the tree, NULL is returned. - - Arguments: - [in] pobjRoot -> Points to the root node of the tree. - [in] key -> References the key of the node to search for. -----------------------------------------------------------------------------------------------*/ -template - Obj * BalTreeBase::Find(Obj * pobjRoot, const Key & key) -{ - AssertPtrN(pobjRoot); - - for (Obj * pobj = pobjRoot; pobj; ) - { - int nT = pobj->CompareKey(key); - if (0 == nT) - return pobj; - pobj = pobj->m_rgpobj[nT > 0]; - } - return NULL; -} - -/*---------------------------------------------------------------------------------------------- - This method inserts a node within the tree, sorting it based on key. It does not allocate - any memory. - - Arguments: - [in] ppobjRoot -> The address of the pointer to the root node of the tree. - [in] key -> References the key of the node to insert into the tree. - Note: "this" is the node that is being inserted into the tree. -----------------------------------------------------------------------------------------------*/ -template - void BalTreeBase::Insert(Obj ** ppobjRoot, const Key & key) -{ - AssertPtr(ppobjRoot); - AssertPtrN(*ppobjRoot); - - Assert(m_dht == 0); - Assert(!m_rgpobj[0]); - Assert(!m_rgpobj[1]); - - Obj * pobjThis = static_cast(this); - - // If the tree is empty, set the root of the tree to this and return. - if (!*ppobjRoot) - { - *ppobjRoot = pobjThis; - return; - } - - Obj ** ppobjRebal = ppobjRoot; - Obj * pobjCur; - - // Place this in the tree. Mark each node indicating which branch we took. - // Remember the lowest node with non-zero m_dht in ppobjRebal. If we have to do - // rebalancing, this is where we'll do it. - for (pobjCur = *ppobjRoot; ; ) - { - AssertPtr(pobjCur); - - int nT = pobjCur->CompareKey(key); - Assert(nT != 0); - - // if nT is positive go right, otherwise go left. - pobjCur->m_ipobj = nT > 0; - - Obj ** ppobjNext = &pobjCur->m_rgpobj[pobjCur->m_ipobj]; - if (!*ppobjNext) - { - // Place the node and break. - *ppobjNext = pobjThis; - break; - } - - // Remember this location if m_dht is non-zero. - if ((*ppobjNext)->m_dht != 0) - ppobjRebal = ppobjNext; - - // Move on down. - pobjCur = *ppobjNext; - } - - // Adjust m_dht from *ppobjRebal to pobjThis. - for (pobjCur = *ppobjRebal; pobjCur != pobjThis; ) - { - AssertPtr(pobjCur); - Assert((unsigned int)pobjCur->m_ipobj < (unsigned int)2); - - // Recall that ppobjRebal is the lowest node on the path which has non-zero m_dht. - Assert(pobjCur->m_dht == 0 || pobjCur == *ppobjRebal); - - // If we went left (m_ipobj == 0) we need to subtract one. If we went right - // (m_ipobj == 1) we need to add one. - pobjCur->m_dht = (short)(pobjCur->m_dht + (pobjCur->m_ipobj << 1) - 1); - pobjCur = pobjCur->m_rgpobj[pobjCur->m_ipobj]; - } - - if ((unsigned int)((*ppobjRebal)->m_dht + 1) <= (unsigned int)2) - { - // No need to rebalance since the new m_dht for *ppobjRebal is within -1 to 1. - return; - } - - // We need to rebalance. - Obj * pobjRebal = *ppobjRebal; - Assert(pobjRebal->m_dht == -2 || pobjRebal->m_dht == 2); - - // Get the direction from pobjRebal and the next lower node. - int ipobj = pobjRebal->m_ipobj; - Obj * pobjChd = pobjRebal->m_rgpobj[ipobj]; - - if (pobjChd->m_ipobj == ipobj) - { - // We branched the same way at pobjRebal and pobjChd. - // Do a single rotation: make pobjChd the parent of pobjRebal. - Assert(pobjChd->m_dht << 1 == pobjRebal->m_dht); - pobjRebal->m_rgpobj[ipobj] = pobjChd->m_rgpobj[1 - ipobj]; - pobjChd->m_rgpobj[1 - ipobj] = pobjRebal; - *ppobjRebal = pobjChd; - - // Fix the m_dht values. - pobjChd->m_dht = 0; - pobjRebal->m_dht = 0; - return; - } - - // We branched opposite ways at pobjRebal and pobjChd. - // Do a double rotation. - Assert(pobjChd->m_ipobj == 1 - ipobj); - pobjCur = pobjChd->m_rgpobj[1 - ipobj]; - AssertPtr(pobjCur); - - // Let (A own[ipobj] B) mean that A->m_rgpobj[ipobj] == B. - // Currently, (pobjRebal own[ipobj] pobjChd) and (pobjChd own[1 - ipobj] pobjCur). - // Make (pobjCur own[ipobj] pobjChd) and (pobjCur own[1 - ipobj] pobjRebal). - - // Rotate pobjChd and pobjCur. - Assert(pobjCur == pobjChd->m_rgpobj[1 - ipobj]); - pobjChd->m_rgpobj[1 - ipobj] = pobjCur->m_rgpobj[ipobj]; - pobjCur->m_rgpobj[ipobj] = pobjChd; - - // Rotate pobjRebal and pobjCur. - Assert(pobjRebal->m_rgpobj[ipobj] == pobjChd); - pobjRebal->m_rgpobj[ipobj] = pobjCur->m_rgpobj[1 - ipobj]; - pobjCur->m_rgpobj[1 - ipobj] = pobjRebal; - - // Fix *ppobjRebal. - *ppobjRebal = pobjCur; - - // Fix the m_dht values. Note that we don't compare with pobjRebal->m_dht since it - // currently has absolute value 2. - Assert(pobjChd->m_dht); - if (pobjCur->m_dht == pobjChd->m_dht) - { - pobjRebal->m_dht = 0; - pobjChd->m_dht = (short)-pobjChd->m_dht; - } - else if (pobjCur->m_dht == -pobjChd->m_dht) - { - pobjRebal->m_dht = pobjChd->m_dht; - pobjChd->m_dht = 0; - } - else - { - pobjRebal->m_dht = 0; - pobjChd->m_dht = 0; - } - pobjCur->m_dht = 0; -} - -#endif // !BINTREE_I_CPP_INCLUDED diff --git a/Build/source/libs/graphite/engine-2.3.1/src/generic/Debug.cpp b/Build/source/libs/graphite/engine-2.3.1/src/generic/Debug.cpp deleted file mode 100644 index d1f2a67e364..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/src/generic/Debug.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 1999, 2001 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: Debug.cpp -Responsibility: Darrell Zook -Last reviewed: Not yet. - -Description: - This file provides the standard debug error functions. -----------------------------------------------------------------------------------------------*/ - -#ifdef _WIN32 -#include -#endif -//#include "common.h" -//#include "Main.h" -#include "GrDebug.h" -#ifdef _MSC_VER -#pragma hdrstop -#endif -#undef THIS_FILE -DEFINE_THIS_FILE - -//#include "ModuleEntry.h" -#include -#ifdef _MSC_VER -#include -#endif - - -#if 0 -//#ifdef DEBUG - -extern HMODULE Win32DllGetModuleHandle(); - -void WINAPI AssertProcLocal(const char * pszExp, const char * pszFile, int nLine, - bool fCritical) -{ - AssertProc(pszExp, pszFile, nLine, fCritical, Win32DllGetModuleHandle()); -} - -void WINAPI WarnProcLocal(const char * pszExp, const char * pszFile, int nLine, - bool fCritical) -{ - WarnProc(pszExp, pszFile, nLine, fCritical, Win32DllGetModuleHandle()); -} - -void WINAPI WarnHrProc(HRESULT hr, const char * pszFile, int nLine, bool fCritical) -{ - char szBuffer[MAX_PATH + 25]; - sprintf(szBuffer, "HRESULT[0x%08x]--", hr); - int cch = lstrlen(szBuffer); - FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, hr, 0, szBuffer + cch, - sizeof(szBuffer) - cch, NULL); - szBuffer[max(lstrlen(szBuffer) - 2, 0)] = 0; - WarnProcLocal(szBuffer, pszFile, nLine, fCritical); -} - - -OLECHAR * DebugWatch::WatchNV() -{ - // JT: we need this, otherwise if dealing with a deleted object or null pointer - // we may try to call a virtual function where there is no valid VTABLE pointer. - // In the debugger we can't be sure of not dereferencing a bad pointer. - if (!::_CrtIsValidPointer(this, isizeof(this), TRUE )) - return L"A very bad object pointer"; - // We could also be referencing memory that is trashed (e.g., the object has - // been deleted, or deleted and replaced by something else). - if (!dynamic_cast(this)) - return L"A bad object pointer"; - return Watch(); -} - -void DebugWatch::Output (char *fmt, ...) // LIMITED to 10 pointer-sized arguments -{ - struct args { void * pv[10]; }; - _CrtDbgReport (_CRT_WARN, NULL, NULL, __FILE__, fmt, *(args*)(&fmt+1)); -} - -#endif // DEBUG diff --git a/Build/source/libs/graphite/engine-2.3.1/src/generic/GenericResource.h b/Build/source/libs/graphite/engine-2.3.1/src/generic/GenericResource.h deleted file mode 100644 index 119c6317bcd..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/src/generic/GenericResource.h +++ /dev/null @@ -1,86 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 1999, 2001 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: GenericResource.h -Responsibility: John Thomson -Last reviewed: - - Resources needed by certain generic components (but must be created in app's or AppCore's - resource file). -----------------------------------------------------------------------------------------------*/ -#ifdef _MSC_VER -#pragma once -#endif -#ifndef GenericResource_H -#define GenericResource_H 1 -// Create suitable resources for these if your app uses StackDumper. -// For example -// STRINGTABLE DISCARDABLE -// BEGIN -// "A programming error (%s) has been detected in module %s.\n Please report this to the developers", kstidInternalError -// "Out of memory. To attempt Save, close other apps and click OK. To quit without saving click Cancel", kstidOutOfMemory -// END - - -// Date qualifier string IDs: -#define kstidDateQualBefore 24200 -#define kstidDateQualOn 24201 -#define kstidDateQualAbout 24202 -#define kstidDateQualAfter 24203 -#define kstidDateQualAbt 24204 -#define kstidDateQualBC 24205 -#define kstidDateQualAD 24206 -#define kstidDateBlank 24207 -#define kstidDateBlankM 24208 -#define kstidDateBlankD 24209 - - -#define kstidInternalError 25900 -#define khcidHelpOutOfMemory 25901 -#define khcidNoHelpAvailable 25902 // default help module when there is no specific one. -#define kstidOutOfMemory 25903 -#define kstidUndoFrame 25904 -#define kstidRedoFrame 25905 - -#define kstidFileErrUnknown 25920 -#define kstidFileErrNotFound 25921 -#define kstidFileErrPathNotFound 25922 -#define kstidFileErrTooManyFiles 25923 -#define kstidFileErrAccDenied 25924 -#define kstidFileErrBadHandle 25925 -#define kstidFileErrBadDrive 25926 -#define kstidFileErrWriteProtect 25927 -#define kstidFileErrBadUnit 25928 -#define kstidFileErrNotReady 25929 -#define kstidFileErrSeek 25930 -#define kstidFileErrNotDosDisk 25931 -#define kstidFileErrBadSector 25932 -#define kstidFileErrWriteFault 25933 -#define kstidFileErrReadFault 25934 -#define kstidFileErrGeneral 25935 -#define kstidFileErrSharing 25936 -#define kstidFileErrLock 25937 -#define kstidFileErrEof 25938 -#define kstidFileErrHandleDiskFull 25939 -#define kstidFileErrBadNetPath 25940 -#define kstidFileErrNetworkBusy 25941 -#define kstidFileErrNoDevice 25942 -#define kstidFileErrNoNetAccess 25943 -#define kstidFileErrBadDevice 25944 -#define kstidFileErrBadNetName 25945 -#define kstidFileErrExists 25946 -#define kstidFileErrCantMake 25947 -#define kstidFileErrBadPassword 25948 -#define kstidFileErrNetWriteFault 25949 -#define kstidFileErrDriveLocked 25950 -#define kstidFileErrOpenFailed 25951 -#define kstidFileErrBufOverflow 25952 -#define kstidFileErrDiskFull 25953 -#define kstidFileErrBadName 25954 -#define kstidFileErrNoVolLabel 25955 -#define kstidFileErrAlreadyExists 25956 - -#endif // !GenericResource_H diff --git a/Build/source/libs/graphite/engine-2.3.1/src/generic/HashMap.h b/Build/source/libs/graphite/engine-2.3.1/src/generic/HashMap.h deleted file mode 100644 index dc2de9d0af7..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/src/generic/HashMap.h +++ /dev/null @@ -1,328 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 2001 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: HashMap.h -Responsibility: Steve McConnel -Last reviewed: Not yet. - -Description: - This provides a set of template collection classes to replace std::map. Their primary - reason to exist is to allow explicit checking for internal memory allocation failures. -----------------------------------------------------------------------------------------------*/ -#pragma once -#ifndef HASHMAP_H_INCLUDED -#define HASHMAP_H_INCLUDED -//:End Ignore - -/*---------------------------------------------------------------------------------------------- - Functor class for computing a hash value from an arbitrary object. - - Hungarian: hsho -----------------------------------------------------------------------------------------------*/ -class HashObj -{ -public: - int operator () (void * pKey, int cbKey); -}; - -/*---------------------------------------------------------------------------------------------- - Functor class for comparing two arbitrary objects (of the same class) for equality. - - Hungarian: eqlo -----------------------------------------------------------------------------------------------*/ -class EqlObj -{ -public: - bool operator () (void * pKey1, void * pKey2, int cbKey); -}; - -/*---------------------------------------------------------------------------------------------- - Hash map template collection class whose keys are objects of an arbitrary class. - - Hungarian: hm[K][T] -----------------------------------------------------------------------------------------------*/ -template class HashMap -{ -public: - //:> Member classes - - /*------------------------------------------------------------------------------------------ - This is the basic data structure for storing one key-value pair in a hash map. In - order to handle hash collisions, this structure is a member of a linked list. - Hungarian: hsnd - ------------------------------------------------------------------------------------------*/ - class HashNode - { - public: - //:> Constructors/destructors/etc. - - HashNode(void) - : m_key(K()), m_value(T()), m_nHash(0), m_ihsndNext(0) - { - } - HashNode(K & key, T & value, int nHash, int ihsndNext = -1) - : m_key(key), m_value(value), m_nHash(nHash), m_ihsndNext(ihsndNext) - { - } - ~HashNode() - { - } - - //:> Member variable access - - void PutKey(K & key) - { - m_key = key; - } - K & GetKey() - { - return m_key; - } - void PutValue(T & value) - { - m_value = value; - } - T & GetValue() - { - return m_value; - } - void PutHash(int nHash) - { - m_nHash = nHash; - } - int GetHash() - { - return m_nHash; - } - void PutNext(int ihsndNext) - { - m_ihsndNext = ihsndNext; - } - int GetNext() - { - return m_ihsndNext; - } - - /*-------------------------------------------------------------------------------------- - Check whether the given HashNode is being used. - --------------------------------------------------------------------------------------*/ - bool InUse() - { - return m_ihsndNext >= -1; - } - - protected: - //:> Member variables - - K m_key; - T m_value; - int m_nHash; - int m_ihsndNext; // -1 means end of list, -(ihsnd + 3) for free list members - }; - - /*------------------------------------------------------------------------------------------ - This provides an iterator for stepping through all HashNodes stored in the hash map. - This is useful primarily for saving the contents of a hash map to a file. - - Hungarian: ithm[K][T] - ------------------------------------------------------------------------------------------*/ - class iterator - { - public: - // Constructors/destructors/etc. - - iterator() : m_phmParent(NULL), m_ihsnd(0) - { - } - iterator(HashMap * phm, int ihsnd) : m_phmParent(phm), m_ihsnd(ihsnd) - { - } - iterator(const iterator & v) : m_phmParent(v.m_phmParent), m_ihsnd(v.m_ihsnd) - { - } - ~iterator() - { - } - - // Other public methods - - iterator & operator = (const iterator & ithm) - { - m_phmParent = ithm.m_phmParent; - m_ihsnd = ithm.m_ihsnd; - return *this; - } - T & operator * (void) - { - Assert(m_phmParent); - Assert(m_phmParent->m_prghsnd); - Assert(m_ihsnd < m_phmParent->m_ihsndLim); - return m_phmParent->m_prghsnd[m_ihsnd].GetValue(); - } - HashNode * operator -> (void) - { - Assert(m_phmParent); - Assert(m_phmParent->m_prghsnd); - Assert(m_ihsnd < m_phmParent->m_ihsndLim); - return &m_phmParent->m_prghsnd[m_ihsnd]; - } - iterator & operator ++ (void) - { - Assert(m_phmParent); - ++m_ihsnd; - // make sure that this new HashNode is actually in use - while (m_ihsnd < m_phmParent->m_ihsndLim) - { - if (m_phmParent->m_prghsnd[m_ihsnd].InUse()) - return *this; - // skip to the next one and check it - ++m_ihsnd; - } - if (m_ihsnd > m_phmParent->m_ihsndLim) - m_ihsnd = m_phmParent->m_ihsndLim; - return *this; - } - bool operator == (const iterator & ithm) - { - return (m_phmParent == ithm.m_phmParent) && (m_ihsnd == ithm.m_ihsnd); - } - bool operator != (const iterator & ithm) - { - return (m_phmParent != ithm.m_phmParent) || (m_ihsnd != ithm.m_ihsnd); - } - T & GetValue(void) - { - Assert(m_phmParent); - Assert(m_phmParent->m_prghsnd); - Assert(m_ihsnd < m_phmParent->m_ihsndLim); - Assert(m_phmParent->m_prghsnd[m_ihsnd].InUse()); - return m_phmParent->m_prghsnd[m_ihsnd].GetValue(); - } - K & GetKey(void) - { - Assert(m_phmParent); - Assert(m_phmParent->m_prghsnd); - Assert(m_ihsnd < m_phmParent->m_ihsndLim); - Assert(m_phmParent->m_prghsnd[m_ihsnd].InUse()); - return m_phmParent->m_prghsnd[m_ihsnd].GetKey(); - } - int GetHash() - { - Assert(m_phmParent); - Assert(m_phmParent->m_prghsnd); - Assert(m_ihsnd < m_phmParent->m_ihsndLim); - Assert(m_phmParent->m_prghsnd[m_ihsnd].InUse()); - return m_phmParent->m_prghsnd[m_ihsnd].GetHash(); - } - int GetIndex() - { - Assert(m_phmParent); - Assert(m_phmParent->m_prghsnd); - Assert(m_ihsnd < m_phmParent->m_ihsndLim); - Assert(m_phmParent->m_prghsnd[m_ihsnd].InUse()); - return m_ihsnd; - } - - protected: - //:> Member variables - - HashMap * m_phmParent; - int m_ihsnd; - }; - friend class iterator; - - //:> Constructors/destructors/etc. - - HashMap(); - ~HashMap(); - HashMap(HashMap & hm); - - //:> Other public methods - - iterator Begin(); - iterator End(); - void Insert(K & key, T & value, bool fOverwrite = false, int * pihsndOut = NULL); - bool Retrieve(K & key, T * pvalueRet); - bool Delete(K & key); - void Clear(); - void CopyTo(HashMap & hmKT); - void CopyTo(HashMap * phmKT); - - bool GetIndex(K & key, int * pihsndRet); - bool IndexKey(int ihsnd, K * pkeyRet); - bool IndexValue(int ihsnd, T * pvalueRet); - - int Size(); - - /*------------------------------------------------------------------------------------------ - The assignment operator allows an entire hashmap to be assigned as the value of another - hashmap. It throws an error if it runs out of memory. - - @return a reference to this hashmap. (That is how the assignment operator is defined!) - - @param hm is a reference to the other hashmap. - ------------------------------------------------------------------------------------------*/ - HashMap & operator = (HashMap & hm) - { - hm.CopyTo(this); - return *this; - } - - //:Ignore -#ifdef DEBUG - int _BucketCount(); - int _EmptyBuckets(); - int _BucketsUsed(); - int _FullestBucket(); - bool AssertValid() - { - AssertPtrN(m_prgihsndBuckets); - Assert(m_prgihsndBuckets || !m_cBuckets); - Assert(!m_prgihsndBuckets || m_cBuckets); - AssertArray(m_prgihsndBuckets, m_cBuckets); - AssertPtrN(m_prghsnd); - Assert(m_prghsnd || !m_ihsndMax); - Assert(!m_prghsnd || m_ihsndMax); - AssertArray(m_prghsnd, m_ihsndMax); - Assert(0 <= m_ihsndLim && m_ihsndLim <= m_ihsndMax); - Assert(-1 <= FreeListIdx(m_ihsndFirstFree)); - Assert(FreeListIdx(m_ihsndFirstFree) < m_ihsndLim); - return true; - } -#endif - //:End Ignore - -protected: - //:> Member variables - - int * m_prgihsndBuckets; - int m_cBuckets; - HashNode * m_prghsnd; - int m_ihsndLim; - int m_ihsndMax; - int m_ihsndFirstFree; // stores -(ihsnd + 3) - - //:> Protected methods - //:Ignore - - /*------------------------------------------------------------------------------------------ - Map between real index and "free list" index. Note that this mapping is bidirectional. - ------------------------------------------------------------------------------------------*/ - int FreeListIdx(int ihsnd) - { - return -(ihsnd + 3); - } - //:End Ignore -}; - - -// Local Variables: -// mode:C++ -// c-file-style:"cellar" -// tab-width:4 -// End: - -#endif /*HASHMAP_H_INCLUDED*/ diff --git a/Build/source/libs/graphite/engine-2.3.1/src/generic/HashMap_i.cpp b/Build/source/libs/graphite/engine-2.3.1/src/generic/HashMap_i.cpp deleted file mode 100644 index baebe427a4e..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/src/generic/HashMap_i.cpp +++ /dev/null @@ -1,561 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 2001 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: HashMap_i.cpp -Responsibility: Steve McConnel -Last reviewed: Not yet. - -Description: - This file provides the implementations of methods for the HashMap template collection - classes. It is used as an #include file in any file which explicitly instantiates any - particular type of HashMap, HashMapStrUni, or HashMapChars. -----------------------------------------------------------------------------------------------*/ -#pragma once -#ifndef HASHMAP_I_C_INCLUDED -#define HASHMAP_I_C_INCLUDED - -#include "HashMap.h" -////#include -////#include "GrPlatform.h" -#include "GrCommon.h" - -/*********************************************************************************************** - Methods -***********************************************************************************************/ -//:End Ignore - -/*---------------------------------------------------------------------------------------------- - Constructor. -----------------------------------------------------------------------------------------------*/ -template - HashMap::HashMap() -{ - m_prgihsndBuckets = NULL; - m_cBuckets = 0; - m_prghsnd = NULL; - m_ihsndLim = 0; - m_ihsndMax = 0; - m_ihsndFirstFree = FreeListIdx(-1); -} - -/*---------------------------------------------------------------------------------------------- - Copy constructor. It throws an error if it runs out of memory. -----------------------------------------------------------------------------------------------*/ -template - HashMap::HashMap(HashMap & hm) -{ - m_prgihsndBuckets = NULL; - m_cBuckets= 0; - m_prghsnd = NULL; - m_ihsndLim = 0; - m_ihsndMax = 0; - m_ihsndFirstFree = FreeListIdx(-1); - hm.CopyTo(this); -} - -/*---------------------------------------------------------------------------------------------- - Destructor. -----------------------------------------------------------------------------------------------*/ -template - HashMap::~HashMap() -{ - Clear(); -} - -/*---------------------------------------------------------------------------------------------- - Return an iterator that references the first key and value stored in the HashMap. - If the hash map is empty, Begin returns the same value as End. -----------------------------------------------------------------------------------------------*/ -template - typename HashMap::iterator HashMap::Begin() -{ - AssertObj(this); - int ihsnd; - for (ihsnd = 0; ihsnd < m_ihsndLim; ++ihsnd) - { - if (m_prghsnd[ihsnd].InUse()) - { - iterator ithm(this, ihsnd); - return ithm; - } - } - return End(); -} - -/*---------------------------------------------------------------------------------------------- - Return an iterator that marks the end of the set of keys and values stored in the HashMap. - If the HashMap is empty, End returns the same value as Begin. -----------------------------------------------------------------------------------------------*/ -template - typename HashMap::iterator HashMap::End() -{ - AssertObj(this); - iterator ithm(this, m_ihsndLim); - return ithm; -} - -/*---------------------------------------------------------------------------------------------- - Add one key and value to the HashMap. Insert potentially invalidates existing iterators - for this HashMap. An exception is thrown if there are any errors. - - @param key Reference to the key object. An internal copy is made of this object. - @param value Reference to the object associated with the key. An internal copy is - made of this object. - @param fOverwrite Optional flag (defaults to false) to allow a value already associated - with this key to be replaced by this value. - @param pihsndOut Optional pointer to an integer for returning the internal index where the - key-value pair is stored. - - @exception E_INVALIDARG if fOverwrite is not true and the key already is stored with a value - in this HashMap. -----------------------------------------------------------------------------------------------*/ -template - void HashMap::Insert(K & key, T & value, bool fOverwrite, int * pihsndOut) -{ - AssertObj(this); - // Check for initial allocation of memory. - if (!m_cBuckets) - { - int cBuckets = GetPrimeNear(10); - m_prgihsndBuckets = (int *)malloc(cBuckets * isizeof(int)); - if (!m_prgihsndBuckets) - ThrowHr(WarnHr(E_OUTOFMEMORY)); - std::fill_n(m_prgihsndBuckets, cBuckets, -1); - m_cBuckets = cBuckets; - } - if (!m_ihsndMax) - { - int iMax = 32; - m_prghsnd = (HashNode *)malloc(iMax * isizeof(HashNode)); - if (!m_prghsnd) - ThrowHr(WarnHr(E_OUTOFMEMORY)); - std::fill_n(m_prghsnd, iMax, 0); - m_ihsndLim = 0; - m_ihsndMax = iMax; - m_ihsndFirstFree = FreeListIdx(-1); - } - // Check whether this key is already used. - // If it is, store the value if overwriting is allowed, otherwise return an error value. - H hasher; - Eq equal; - int ihsnd; - int nHash = hasher(&key, isizeof(K)); - int ie = (unsigned)nHash % m_cBuckets; - for (ihsnd = m_prgihsndBuckets[ie]; ihsnd != -1; ihsnd = m_prghsnd[ihsnd].GetNext()) - { - if ((nHash == m_prghsnd[ihsnd].GetHash()) && - equal(&key, &m_prghsnd[ihsnd].GetKey(), isizeof(K))) - { - if (fOverwrite) - { - m_prghsnd[ihsnd].PutValue(value); - if (pihsndOut) - *pihsndOut = ihsnd; - AssertObj(this); - return; - } - else - { - ThrowHr(WarnHr(E_INVALIDARG)); - } - } - } - // Check whether to increase the number of buckets to redistribute the wealth. - // Calculate the average depth of hash collection chains. - // If greater than or equal to two, increase the number of buckets. - int chsndFree = 0; - int i; - for (i = m_ihsndFirstFree; i != FreeListIdx(-1); i = m_prghsnd[FreeListIdx(i)].GetNext()) - ++chsndFree; - int chsndAvgDepth = (m_ihsndLim - chsndFree) / m_cBuckets; - if (chsndAvgDepth > 2) - { - int cNewBuckets = GetPrimeNear(4 * m_cBuckets); - if (cNewBuckets && cNewBuckets > m_cBuckets) - { - int * pNewBuckets = (int *)realloc(m_prgihsndBuckets, cNewBuckets * isizeof(int)); - if (pNewBuckets) - { - std::fill_n(pNewBuckets, cNewBuckets, -1); - m_cBuckets = cNewBuckets; - m_prgihsndBuckets = pNewBuckets; - for (ihsnd = 0; ihsnd < m_ihsndLim; ++ihsnd) - { - if (m_prghsnd[ihsnd].InUse()) - { - ie = (unsigned)m_prghsnd[ihsnd].GetHash() % m_cBuckets; - m_prghsnd[ihsnd].PutNext(m_prgihsndBuckets[ie]); - m_prgihsndBuckets[ie] = ihsnd; - } - } - // Recompute the new entry's slot so that it can be stored properly. - ie = (unsigned)nHash % m_cBuckets; - } - } - } - if (m_ihsndLim < m_ihsndMax) - { - ihsnd = m_ihsndLim; - ++m_ihsndLim; - } - else if (m_ihsndFirstFree != FreeListIdx(-1)) - { - ihsnd = FreeListIdx(m_ihsndFirstFree); - m_ihsndFirstFree = m_prghsnd[ihsnd].GetNext(); - } - else - { - int iNewMax = (!m_ihsndMax) ? 32 : 2 * m_ihsndMax; - HashNode * pNewNodes = (HashNode *)realloc(m_prghsnd, iNewMax * isizeof(HashNode)); - if (!pNewNodes && iNewMax > 32) - { - iNewMax = m_ihsndMax + (m_ihsndMax / 2); - pNewNodes = (HashNode *)realloc(m_prghsnd, iNewMax * isizeof(HashNode)); - if (!pNewNodes) - ThrowHr(WarnHr(E_OUTOFMEMORY)); - } - m_prghsnd = pNewNodes; - m_ihsndMax = iNewMax; - Assert(m_ihsndLim < m_ihsndMax); - ihsnd = m_ihsndLim; - ++m_ihsndLim; - } - // Call constructor on previously allocated memory. - new((void *)&m_prghsnd[ihsnd]) HashNode(key, value, nHash, m_prgihsndBuckets[ie]); - m_prgihsndBuckets[ie] = ihsnd; - if (pihsndOut) - *pihsndOut = ihsnd; - AssertObj(this); -} - -/*---------------------------------------------------------------------------------------------- - Search the HashMap for the given key, and return true if the key is found or false if the - key is not found. If the key is found and the given pointer is not NULL, copy the - associated value to that memory location. - - @param key Reference to a key object. - @param pvalueRet Pointer to an empty object for storing a copy of the value associated with - the key, if one exists. -----------------------------------------------------------------------------------------------*/ -template - bool HashMap::Retrieve(K & key, T * pvalueRet) -{ - AssertObj(this); - if (!m_prgihsndBuckets) - return false; - H hasher; - Eq equal; - int nHash = hasher(&key, isizeof(K)); - int ie = (unsigned)nHash % m_cBuckets; - int ihsnd; - for (ihsnd = m_prgihsndBuckets[ie]; ihsnd != -1; ihsnd = m_prghsnd[ihsnd].GetNext()) - { - if ((nHash == m_prghsnd[ihsnd].GetHash()) && - equal(&key, &m_prghsnd[ihsnd].GetKey(), isizeof(K))) - { - if (pvalueRet) - *pvalueRet = m_prghsnd[ihsnd].GetValue(); - return true; - } - } - return false; -} - -/*---------------------------------------------------------------------------------------------- - Remove the element with the given key from the stored HashMap. This potentially - invalidates existing iterators for this HashMap. If the key is not found in the - HashMap, then nothing is deleted. - - @param key Reference to a key object. - - @return True if the key is found, and something is actually deleted; otherwise, false. -----------------------------------------------------------------------------------------------*/ -template - bool HashMap::Delete(K & key) -{ - AssertObj(this); - if (!m_prgihsndBuckets) - return false; - H hasher; - Eq equal; - int nHash = hasher(&key, isizeof(K)); - int ie = (unsigned)nHash % m_cBuckets; - int ihsnd; - int ihsndPrev = -1; - for (ihsnd = m_prgihsndBuckets[ie]; ihsnd != -1; ihsnd = m_prghsnd[ihsnd].GetNext()) - { - if ((nHash == m_prghsnd[ihsnd].GetHash()) && - equal(&key, &m_prghsnd[ihsnd].GetKey(), isizeof(K))) - { - if (ihsndPrev == -1) - m_prgihsndBuckets[ie] = m_prghsnd[ihsnd].GetNext(); - else - m_prghsnd[ihsndPrev].PutNext(m_prghsnd[ihsnd].GetNext()); - m_prghsnd[ihsnd].~HashNode(); // Ensure member destructors are called. - memset(&m_prghsnd[ihsnd], 0, isizeof(HashNode)); - m_prghsnd[ihsnd].PutNext(m_ihsndFirstFree); - m_ihsndFirstFree = FreeListIdx(ihsnd); - AssertObj(this); - return true; - } - ihsndPrev = ihsnd; - } - return false; -} - -/*---------------------------------------------------------------------------------------------- - Free all the memory used by the HashMap. When done, only the minimum amount of - bookkeeping memory is still taking up space, and any internal pointers all been set - to NULL. The appropriate destructor is called for all key and value objects stored - in the HashMap before the memory space is freed. -----------------------------------------------------------------------------------------------*/ -template - void HashMap::Clear() -{ - AssertObj(this); - if (!m_prgihsndBuckets) - return; - int ihsnd; - for (ihsnd = 0; ihsnd < m_ihsndLim; ++ihsnd) - { - if (m_prghsnd[ihsnd].InUse()) - m_prghsnd[ihsnd].~HashNode(); // Ensure member destructors are called. - } - free(m_prgihsndBuckets); - free(m_prghsnd); - m_prgihsndBuckets = NULL; - m_cBuckets = 0; - m_prghsnd = NULL; - m_ihsndLim = 0; - m_ihsndMax = 0; - m_ihsndFirstFree = FreeListIdx(-1); - AssertObj(this); -} - -/*---------------------------------------------------------------------------------------------- - Copy the content of one HashMap to another. An exception is thrown if there are any errors. - - @param hmKT Reference to the other HashMap. -----------------------------------------------------------------------------------------------*/ -template - void HashMap::CopyTo(HashMap & hmKT) -{ - AssertObj(this); - AssertObj(&hmKT); - hmKT.Clear(); - iterator itmm; - for (itmm = Begin(); itmm != End(); ++itmm) - hmKT.Insert(itmm->GetKey(), itmm->GetValue()); -} - -/*---------------------------------------------------------------------------------------------- - Copy the content of one HashMap to another. An exception is thrown if there are any errors. - - @param phmKT Pointer to the other HashMap. - - @exception E_POINTER if phmKT is NULL. -----------------------------------------------------------------------------------------------*/ -template - void HashMap::CopyTo(HashMap * phmKT) -{ - if (!phmKT) - ThrowHr(WarnHr(E_POINTER)); - CopyTo(*phmKT); -} - -/*---------------------------------------------------------------------------------------------- - If the given key is found in the HashMap, return true, and if the provided index pointer - is not NULL, also store the internal index value in the indicated memory location. - If the given key is NOT found in the HashMap, return false and ignore the provided index - pointer. - - @param key Reference to a key object. - @param pihsndRet Pointer to an integer for returning the internal index where the - key-value pair is stored. -----------------------------------------------------------------------------------------------*/ -template - bool HashMap::GetIndex(K & key, int * pihsndRet) -{ - AssertObj(this); - if (!m_prgihsndBuckets) - return false; - H hasher; - Eq equal; - int nHash = hasher(&key, isizeof(K)); - int ie = (unsigned)nHash % m_cBuckets; - int ihsnd; - for (ihsnd = m_prgihsndBuckets[ie]; ihsnd != -1; ihsnd = m_prghsnd[ihsnd].GetNext()) - { - if ((nHash == m_prghsnd[ihsnd].GetHash()) && - equal(&key, &m_prghsnd[ihsnd].GetKey(), isizeof(K))) - { - if (pihsndRet) - *pihsndRet = ihsnd; - return true; - } - } - return false; -} - -/*---------------------------------------------------------------------------------------------- - If the given internal HashMap index is valid, return true, and if the provided pointer to a - key object is not NULL, also copy the indexed key to the indicated memory location. - If the given internal index is NOT valid, return false, and ignore the provided key - object pointer. - - @param ihsnd Internal index value returned earlier by GetIndex or Insert. - @param pkeyRet Pointer to an empty key object for storing a copy of the key found at the - indexed location. -----------------------------------------------------------------------------------------------*/ -template - bool HashMap::IndexKey(int ihsnd, K * pkeyRet) -{ - AssertObj(this); - if ((ihsnd < 0) || (ihsnd >= m_ihsndLim)) - return false; - if (m_prghsnd[ihsnd].InUse()) - { - if (pkeyRet) - *pkeyRet = m_prghsnd[ihsnd].GetKey(); - return true; - } - else - { - return false; - } -} - -/*---------------------------------------------------------------------------------------------- - If the given internal HashMap index is valid, return true, and if the provided pointer to an - object is not NULL, also copy the indexed value to the indicated memory location. - If the given internal index is NOT valid, return false, and ignore the provided - object pointer. - - @param ihsnd Internal index value returned earlier by GetIndex or Insert. - @param pvalueRet Pointer to an empty object for storing a copy of the value found at the - indexed location. -----------------------------------------------------------------------------------------------*/ -template - bool HashMap::IndexValue(int ihsnd, T * pvalueRet) -{ - AssertObj(this); - if (ihsnd < 0 || ihsnd >= m_ihsndLim) - return false; - if (m_prghsnd[ihsnd].InUse()) - { - if (pvalueRet) - *pvalueRet = m_prghsnd[ihsnd].GetValue(); - return true; - } - else - { - return false; - } -} - -/*---------------------------------------------------------------------------------------------- - Return the number of items (key-value pairs) stored in the HashMap. -----------------------------------------------------------------------------------------------*/ -template - int HashMap::Size() -{ - AssertObj(this); - if (!m_prgihsndBuckets) - return 0; - int chsndFree = 0; - int ihsnd; - for (ihsnd = m_ihsndFirstFree; - ihsnd != FreeListIdx(-1); - ihsnd = m_prghsnd[FreeListIdx(ihsnd)].GetNext()) - { - ++chsndFree; - } - return m_ihsndLim - chsndFree; -} - -//:Ignore -#ifdef DEBUG -/*---------------------------------------------------------------------------------------------- - Return the number of buckets (hash slots) currently allocated for the hash map. This is - useful only for debugging the hash map mechanism itself. -----------------------------------------------------------------------------------------------*/ -template - int HashMap::_BucketCount() -{ - AssertObj(this); - return m_cBuckets; -} - -/*---------------------------------------------------------------------------------------------- - Return the number of buckets (hash slots) that do not point to a list of HashNode objects. - This is useful only for debugging the hash map mechanism itself. -----------------------------------------------------------------------------------------------*/ -template - int HashMap::_EmptyBuckets() -{ - AssertObj(this); - int ceUnused = 0; - int ie; - for (ie = 0; ie < m_cBuckets; ++ie) - { - if (m_prgihsndBuckets[ie] == -1) - ++ceUnused; - } - return ceUnused; -} - -/*---------------------------------------------------------------------------------------------- - Return the number of buckets (hash slots) that currently point to a list of HashNode - objects in the hash map. This is useful only for debugging the hash map mechanism itself. -----------------------------------------------------------------------------------------------*/ -template - int HashMap::_BucketsUsed() -{ - AssertObj(this); - int ceUsed = 0; - int ie; - for (ie = 0; ie < m_cBuckets; ++ie) - { - if (m_prgihsndBuckets[ie] != -1) - ++ceUsed; - } - return ceUsed; -} - -/*---------------------------------------------------------------------------------------------- - Return the length of the longest list of HashNode objects stored in any bucket (hash slot) - of the hash map. This is useful only for debugging the hash map mechanism itself. -----------------------------------------------------------------------------------------------*/ -template - int HashMap::_FullestBucket() -{ - AssertObj(this); - int chsndMax = 0; - int chsnd; - int ie; - int ihsnd; - for (ie = 0; ie < m_cBuckets; ++ie) - { - chsnd = 0; - for (ihsnd = m_prgihsndBuckets[ie]; ihsnd != -1; ihsnd = m_prghsnd[ihsnd].GetNext()) - ++chsnd; - if (chsndMax < chsnd) - chsndMax = chsnd; - } - return chsndMax; -} -#endif -//:End Ignore - - - -// Local Variables: -// mode:C++ -// c-file-style:"cellar" -// tab-width:4 -// End: - -#endif /*HASHMAP_I_C_INCLUDED*/ diff --git a/Build/source/libs/graphite/engine-2.3.1/src/generic/Makefile.am b/Build/source/libs/graphite/engine-2.3.1/src/generic/Makefile.am deleted file mode 100644 index ec60b09be3a..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/src/generic/Makefile.am +++ /dev/null @@ -1,8 +0,0 @@ -genericdir = $(top_srcdir)/src/generic - -libgraphite_la_SOURCES += $(genericdir)/Debug.cpp -libgraphite_la_SOURCES += $(genericdir)/Util.cpp - -EXTRA_DIST += $(genericdir)/*.h -EXTRA_DIST += $(genericdir)/BinTree_i.cpp -EXTRA_DIST += $(genericdir)/HashMap_i.cpp diff --git a/Build/source/libs/graphite/engine-2.3.1/src/generic/Util.cpp b/Build/source/libs/graphite/engine-2.3.1/src/generic/Util.cpp deleted file mode 100644 index aabd6563d3e..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/src/generic/Util.cpp +++ /dev/null @@ -1,261 +0,0 @@ - -#include "GrCommon.h" -#include "GrDebug.h" - - -namespace gr -{ - -/*---------------------------------------------------------------------------------------------- - Swap two blocks of size cb starting at pv1 and pv2. Doesn't handle overlapping blocks. -----------------------------------------------------------------------------------------------*/ -void SwapBytes(void * pv1, void * pv2, int cb) -{ - Assert((byte *)pv1 + cb <= (byte *)pv2 || (byte *)pv2 + cb <= (byte *)pv1); - AssertPtrSize(pv1, cb); - AssertPtrSize(pv2, cb); - -#ifdef NO_ASM - - byte *pb1 = (byte *)pv1; - byte *pb2 = (byte *)pv2; - byte b; - - while (--cb >= 0) - { - b = *pb1; - *pb1++ = *pb2; - *pb2++ = b; - } - -#else // !NO_ASM - - __asm - { - // edi -> memory to swap, first pointer - // esi -> memory to swap, second pointer - - mov edi,pv1 - mov esi,pv2 - - mov ecx,cb - shr ecx,2 - jz LBytes - -LIntLoop: - mov eax,[edi] - mov ebx,[esi] - mov [edi],ebx - mov [esi],eax - - add edi,4 - add esi,4 - dec ecx - jnz LIntLoop; - -LBytes: - mov ecx,cb - and ecx,3 - jz LDone - -LByteLoop: - mov al,[edi] - mov bl,[esi] - mov [edi],bl - mov [esi],al - inc edi - inc esi - dec ecx - jnz LByteLoop - -LDone: - } - -#endif //!NO_ASM -} - -/*---------------------------------------------------------------------------------------------- - Fills a block of memory with the given short value. -----------------------------------------------------------------------------------------------*/ -void FillShorts(void * pv, short sn, int csn) -{ - AssertPtrSize(pv, csn * isizeof(short)); - -#ifdef NO_ASM - - short * psn = (short *)pv; - short * psnLim = psn + csn; - - while (psn < psnLim) - *psn++ = sn; - -#else // !NO_ASM - - __asm - { - // Setup the registers for using REP STOS instruction to set memory. - // NOTE: Alignment does not effect the speed of STOS. - // - // edi -> memory to set - // eax = value to store in destination - // direction flag is clear for auto-increment - - mov edi,pv - mov ax,sn - mov ecx,csn - - mov edx,ecx - and edx,1 - jz LInts - - // set 1 short - stosw - -LInts: - shr ecx,1 - jz LDone - - mov ebx,eax - shl eax,16 - mov ax,bx - - rep stosd -LDone: - } - -#endif //!NO_ASM -} - -/*********************************************************************************************** - Integer utilities. -***********************************************************************************************/ - -/* - * table of powers of 2, and largest prime smaller than each power of 2 - * n 2**n prime diff - * --- ---------- ---------- ---- - * 2: 4 3 ( -1) - * 3: 8 7 ( -1) - * 4: 16 13 ( -3) - * 5: 32 31 ( -1) - * 6: 64 61 ( -3) - * 7: 128 127 ( -1) - * 8: 256 251 ( -5) - * 9: 512 509 ( -3) - * 10: 1024 1021 ( -3) - * 11: 2048 2039 ( -9) - * 12: 4096 4093 ( -3) - * 13: 8192 8191 ( -1) - * 14: 16384 16381 ( -3) - * 15: 32768 32749 (-19) - * 16: 65536 65521 (-15) - * 17: 131072 131071 ( -1) - * 18: 262144 262139 ( -5) - * 19: 524288 524287 ( -1) - * 20: 1048576 1048573 ( -3) - * 21: 2097152 2097143 ( -9) - * 22: 4194304 4194301 ( -3) - * 23: 8388608 8388593 (-15) - * 24: 16777216 16777213 ( -3) - * 25: 33554432 33554393 (-39) - * 26: 67108864 67108859 ( -5) - * 27: 134217728 134217689 (-39) - * 28: 268435456 268435399 (-57) - * 29: 536870912 536870909 ( -3) - * 30: 1073741824 1073741789 (-35) - * 31: 2147483648 2147483647 ( -1) - * 32: 4294967296 4294967291 ( -5) - */ -const static unsigned int g_rguPrimes[] = { - 3, 7, 13, 31, 61, 127, 251, 509, 1021, 2039, 4093, 8191, 16381, 32749, 65521, 131071, - 262139, 524287, 1048573, 2097143, 4194301, 8388593, 16777213, 33554393, 67108859, - 134217689, 268435399, 536870909, 1073741789, 2147483647, 4294967291U -}; - - -/*---------------------------------------------------------------------------------------------- - Returns the prime in g_rguPrimes that is closest to u. -----------------------------------------------------------------------------------------------*/ -unsigned int GetPrimeNear(unsigned int u) -{ - int cu = isizeof(g_rguPrimes) / isizeof(unsigned int); - int iuMin; - int iuLim; - int iu; - - for (iuMin = 0, iuLim = cu; iuMin < iuLim; ) - { - iu = (iuMin + iuLim) / 2; - if (u > g_rguPrimes[iu]) - iuMin = iu + 1; - else - iuLim = iu; - } - Assert(iuMin == cu || iuMin < cu && u <= g_rguPrimes[iuMin]); - Assert(iuMin == 0 || iuMin > 0 && u > g_rguPrimes[iuMin - 1]); - - if (!iuMin) - return g_rguPrimes[0]; - if (iuMin == cu) - return g_rguPrimes[cu - 1]; - if (g_rguPrimes[iuMin] - u < u - g_rguPrimes[iuMin - 1]) - return g_rguPrimes[iuMin]; - return g_rguPrimes[iuMin - 1]; -} - - -/*---------------------------------------------------------------------------------------------- - Returns the prime in g_rguPrimes that is larger than u or is the largest in the list. -----------------------------------------------------------------------------------------------*/ -unsigned int GetLargerPrime(unsigned int u) -{ - int cu = isizeof(g_rguPrimes) / isizeof(unsigned int); - int iuMin; - int iuLim; - int iu; - - for (iuMin = 0, iuLim = cu; iuMin < iuLim; ) - { - iu = (iuMin + iuLim) / 2; - if (u >= g_rguPrimes[iu]) - iuMin = iu + 1; - else - iuLim = iu; - } - Assert(iuMin == cu || iuMin < cu && u < g_rguPrimes[iuMin]); - Assert(iuMin == 0 || iuMin > 0 && u >= g_rguPrimes[iuMin - 1]); - - if (iuMin == cu) - return g_rguPrimes[cu - 1]; - return g_rguPrimes[iuMin]; -} - - -/*---------------------------------------------------------------------------------------------- - Returns the prime in g_rguPrimes that is smaller than u or is the smallest in the list. -----------------------------------------------------------------------------------------------*/ -unsigned int GetSmallerPrime(unsigned int u) -{ - int cu = isizeof(g_rguPrimes) / isizeof(unsigned int); - int iuMin; - int iuLim; - int iu; - - for (iuMin = 0, iuLim = cu; iuMin < iuLim; ) - { - iu = (iuMin + iuLim) / 2; - if (u > g_rguPrimes[iu]) - iuMin = iu + 1; - else - iuLim = iu; - } - Assert(iuMin == cu || iuMin < cu && u <= g_rguPrimes[iuMin]); - Assert(iuMin == 0 || iuMin > 0 && u > g_rguPrimes[iuMin - 1]); - - if (!iuMin) - return g_rguPrimes[0]; - return g_rguPrimes[iuMin - 1]; -} - -} - diff --git a/Build/source/libs/graphite/engine-2.3.1/src/painter/Makefile.am b/Build/source/libs/graphite/engine-2.3.1/src/painter/Makefile.am deleted file mode 100644 index 497d31bd018..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/src/painter/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -painterdir = $(top_srcdir)/src/painter - -libgraphite_la_SOURCES += $(painterdir)/SegmentPainter.cpp - -#EXTRA_DIST += $(painterdir)/*.h diff --git a/Build/source/libs/graphite/engine-2.3.1/src/painter/SegmentPainter.cpp b/Build/source/libs/graphite/engine-2.3.1/src/painter/SegmentPainter.cpp deleted file mode 100644 index 149366eb4b3..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/src/painter/SegmentPainter.cpp +++ /dev/null @@ -1,3004 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 1999, 2001 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: SegmentPainter.cpp -Responsibility: Sharon Correll -Last reviewed: Not yet. - -Description: - Implements the object that handles drawing, mouse clicks, and other UI-related behavior - for a Graphite segment. --------------------------------------------------------------------------------*//*:End Ignore*/ - -//:>******************************************************************************************** -//:> Include files -//:>******************************************************************************************** -#include "Main.h" -#ifdef _MSC_VER -#pragma hdrstop -#endif -// any other headers (not precompiled) -#include -#ifndef _WIN32 -#include -#endif - -#undef THIS_FILE -DEFINE_THIS_FILE - -//:>******************************************************************************************** -//:> Forward declarations -//:>******************************************************************************************** - -//:>******************************************************************************************** -//:> Local Constants and static variables -//:>******************************************************************************************** -namespace -{ - -static bool g_fDrawing; - -} // namespace - - -namespace gr -{ - -//:>******************************************************************************************** -//:> Methods -//:>******************************************************************************************** - -/*---------------------------------------------------------------------------------------------- - Constructors. -----------------------------------------------------------------------------------------------*/ -//SegmentPainter::SegmentPainter(Segment * pseg) -//{ -// m_pseg = pseg; -// -// m_xsOrigin = 0; -// m_ysOrigin = 0; -// m_xdPosition = 0; -// m_ydPosition = 0; -// m_xFactor = 1.0; -// m_yFactor = 1.0; -//} - -SegmentPainter::SegmentPainter(Segment * pseg, float xsOrigin, float ysOrigin) -{ - m_pseg = pseg; - - m_xsOrigin = xsOrigin; - m_ysOrigin = ysOrigin; - m_xdPosition = m_xsOrigin; - m_ydPosition = m_ysOrigin; - m_xFactor = 1.0; - m_yFactor = 1.0; - - //m_xsOriginInt = GrEngine::RoundFloat(xsOrigin); - //m_xdPositionInt = m_xsOriginInt; - //m_xFactor64 = 64; -} - -/*---------------------------------------------------------------------------------------------- - Destructor. -----------------------------------------------------------------------------------------------*/ -SegmentPainter::~SegmentPainter() -{ -} - -/*---------------------------------------------------------------------------------------------- - Initialization. - - The correspondence with the old rectangle approach is: - m_xsOrigin = sourceRect.left; - m_ysOrigin = sourceRect.top; - m_xdPosition = destRect.left; - m_ydPosition = destRect.top; - - m_xFactor = (destRect.right - destRect.left) / (sourceRect.right - sourceRect.left); - m_yFactor = (destRect.top - destRect.bottom) / (sourceRect.top - sourceRect.bottom); - -----------------------------------------------------------------------------------------------*/ -void SegmentPainter::setOrigin(float xsOrigin, float ysOrigin) -{ - m_xsOrigin = xsOrigin; - m_ysOrigin = ysOrigin; - - //m_xsOriginInt = GrEngine::RoundFloat(xsOrigin); -} - -void SegmentPainter::setPosition(float xdPosition, float ydPosition) -{ - m_xdPosition = xdPosition; - m_ydPosition = ydPosition; - - //m_xdPositionInt = GrEngine::RoundFloat(xdPosition); -} - -void SegmentPainter::setScalingFactors(float xFactor, float yFactor) -{ - m_xFactor = xFactor; - m_yFactor = yFactor; - - //int temp = GrEngine::RoundFloat(xFactor); - //m_xFactor64 = GrEngine::RoundFloat(xFactor * 64); -} - - -//:>******************************************************************************************** -//:> SegmentPainter interface methods -//:>******************************************************************************************** - -/*---------------------------------------------------------------------------------------------- - Draw the text of the segment at the specified point in the graphics context. - This method must be implemented by a concrete subclass for painters that really need - to paint. -----------------------------------------------------------------------------------------------*/ -//void SegmentPainter::paint() -//{ -// Assert(false); -//} - -/*---------------------------------------------------------------------------------------------- - Indicate if the character position is a valid place for an insertion point. - - @oaram ich - position to test - @param pipvr - answer: kipvrOK = IP here is valid; - kipvrBad = IP here no good; - kipvrUnknown = this seg can't decide, ask the next -----------------------------------------------------------------------------------------------*/ -LgIpValidResult SegmentPainter::isValidInsertionPoint(int ichw) -{ - Assert(m_pseg->m_dxsWidth >= 0); - Assert(m_pseg->m_dysAscent >= 0); - - int ichwSegOffset = ichw - m_pseg->m_ichwMin; - if (ichwSegOffset < m_pseg->m_ichwAssocsMin || ichwSegOffset >= m_pseg->m_ichwAssocsLim) - { - // If we're pointing at a hard line break character (Unicode 2028), then we know - // that it's a good insertion point in spite of missing the other conditions. - utf16 ch; - m_pseg->m_pgts->fetch(ichw, 1, &ch); - if (ch != knLineSep) - return kipvrUnknown; // Definitely in a different segment of the paragraph. - return kipvrOK; - } - - int isloutLig = m_pseg->m_prgisloutLigature[ichwSegOffset - m_pseg->m_ichwAssocsMin]; - if (isloutLig != kNegInfinity) - { - // Ligature. - int isloutLigAfter = m_pseg->m_prgisloutLigature[ichwSegOffset - 1 - m_pseg->m_ichwAssocsMin]; - if (isloutLig == isloutLigAfter) - { - int icompBefore = m_pseg->m_prgiComponent[ichwSegOffset - m_pseg->m_ichwAssocsMin]; - int icompAfter = m_pseg->m_prgiComponent[ichwSegOffset - 1 - m_pseg->m_ichwAssocsMin]; - if (icompBefore == icompAfter) - // If inserting before this character yields the same visible component - // as inserting after the previous, then this character is invisible, or has - // been merged with the previous, and it doesn't make sense to put an insertion - // point here. - return kipvrBad; - } - return kipvrOK; - } - - // TODO: do we need to test ALL the associated glyphs? Here we just test the first. - - LgIpValidResult ipvrRet; - - int isloutBefore = m_pseg->UnderlyingToLogicalSurface(ichw, true); // leading edge - int isloutAfter = m_pseg->UnderlyingToLogicalSurface(ichw - 1, false); // trailing edge of previous - int isloutTest = m_pseg->UnderlyingToLogicalInThisSeg(ichw); - if (isloutBefore == isloutAfter) - // If inserting before this character yields the same visible glyph as - // inserting after the previous, then this character is invisible, or has - // been merged with the previous, and it doesn't make sense to put an insertion - // point here. - ipvrRet = kipvrBad; - else if (isloutTest == kNegInfinity || isloutTest == kPosInfinity) - ipvrRet = kipvrBad; // can't figure it out - else if (!m_pseg->OutputSlot(isloutTest)->InsertBefore()) - ipvrRet = kipvrBad; - else if (m_pseg->SameSurfaceGlyphs(ichw - 1, ichw)) - // The insertion point would be between two characters that map to the same - // set of glyphs. Not a good place. - ipvrRet = kipvrBad; - else - ipvrRet = kipvrOK; - - return ipvrRet; -} - -/*---------------------------------------------------------------------------------------------- - Answer whether the logical and physical boundaries of the string coincide. - This method is called by the application to handle writing system boundaries, and by - other segments in a writing-system chain to handle line-breaks. - - @param fBoundaryEnd - asking about the logical end boundary? - @param fBoundaryRight - asking about the physical right boundary? - @param pfResult - return value -----------------------------------------------------------------------------------------------*/ -bool SegmentPainter::doBoundariesCoincide(bool fBoundaryEnd, bool fBoundaryRight) -{ - float xsBefore, ysBeforeTop, ysBeforeBottom; - float xsAfter, ysAfterTop, ysAfterBottom; - bool fRtlBefore, fRtlAfter; - - if (m_pseg->m_cginf == 0) - { - // Empty segment. - return true; - } - - //SetUpGraphics(ichwBase, pgg, true); - - Assert(m_pseg->m_dxsWidth >= 0); - Assert(m_pseg->m_dysAscent >= 0); - - if (fBoundaryEnd) - { - CalcIP(m_pseg->m_ichwMin + m_pseg->m_dichwLim, true, - &xsBefore, &ysBeforeTop, &ysBeforeBottom, &fRtlBefore); - CalcIP(m_pseg->m_ichwMin + m_pseg->m_dichwLim, false, - &xsAfter, &ysAfterTop, &ysAfterBottom, &fRtlAfter); - } - else - { - CalcIP(m_pseg->m_ichwMin, true, - &xsBefore, &ysBeforeTop, &ysBeforeBottom, &fRtlBefore); - CalcIP(m_pseg->m_ichwMin, false, - &xsAfter, &ysAfterTop, &ysAfterBottom, &fRtlAfter); - } - - // We allow for rounding errors which might cause differences between the expected - // and the actual values, hence the test for a difference of <= 1. - bool fRet; - if (fBoundaryRight) - { - // right edge - if (fBoundaryEnd) // logical end - fRet = (!fRtlAfter && fabsf(xsAfter - (m_pseg->m_dxsTotalWidth + m_pseg->m_dxsStretch)) <= 1); - else // logical start - fRet = (fRtlBefore && fabsf(xsBefore - (m_pseg->m_dxsTotalWidth + m_pseg->m_dxsStretch)) <= 1); - } - else - { - // left edge - if (fBoundaryEnd) // logical end - fRet = (fRtlAfter && fabsf(xsAfter) <= 1); - else // logical start - fRet = (!fRtlBefore && fabsf(xsBefore) <= 1); - } - - return fRet; -} - -/*---------------------------------------------------------------------------------------------- - Draw an insertion point at an appropriate position. - - @param twx, twy - same origin used to Draw segment - @param ich - character position; must be valid - @param fAssocPrev - associated with previous character? - @param bOn - turning on or off? Caller should alternate, first turning on - (ignored in this implementation) - @param dm - draw mode: - kdmNormal = draw complete insertion pt (I-beam or split cursor); - kdmPrimary = only draw primary half of split cursor; - kdmSecondary = only draw secondary half of split cursor -----------------------------------------------------------------------------------------------*/ -void SegmentPainter::drawInsertionPoint(int ichwIP, bool fAssocPrev, - bool bOn, bool fForceSplit) // LgIPDrawMode dm) -{ - if (g_fDrawing) - return; - - g_fDrawing = true; - - //SetUpGraphics(ichwBase, pgg, true); - - Assert(m_pseg->m_dxsWidth >= 0); - Assert(m_pseg->m_dysAscent >= 0); - - CalcOrDrawInsertionPoint(ichwIP, - fAssocPrev, bOn, fForceSplit, - NULL, NULL); // passing NULLs here means we want to draw - - //RestoreFont(pgg); - - g_fDrawing = false; -} - -/*---------------------------------------------------------------------------------------------- - Fill in bounding rectangles for the (possibly 2-part) IP, in destination device coordinates. - Return flags indicating which of the 2 parts where rendered here. - - @param rs,rd - source/destination coordinates, for scaling - @param ichwIP - insertion point - @param fAssocPrev - is the IP "leaning" backward? - @param dm - draw mode: - kdmNormal = draw complete insertion pt (I-beam or split cursor); - kdmPrimary = only draw primary half of split cursor; - kdmSecondary = only draw secondary half of split cursor - @param prdPrimary - return location of primary selection, in dest coords - @param prdSecondary - return location of secondary selection, in dest coords -----------------------------------------------------------------------------------------------*/ -void SegmentPainter::positionsOfIP( - int ichwIP, bool fAssocPrev, bool fForceSplit, - Rect * prdPrimary, Rect * prdSecondary) -{ - ChkGrArgPtr(prdPrimary); - ChkGrArgPtr(prdSecondary); - - //SetUpGraphics(ichwBase, pgg, true); - - Assert(m_pseg->m_dxsWidth >= 0); - Assert(m_pseg->m_dysAscent >= 0); - - CalcOrDrawInsertionPoint(ichwIP, fAssocPrev, true, fForceSplit, - prdPrimary, prdSecondary); - - //RestoreFont(pgg); -} - -/*---------------------------------------------------------------------------------------------- - Highlight a range of text. - - @param ichwAnchor/End - selected range - @param ydLineTop/Bottom - top/bottom of area to highlight if whole line height; - includes half of inter-line spacing. - @param bOn - true if we are turning on (ignored in this implementation) -----------------------------------------------------------------------------------------------*/ -bool SegmentPainter::drawSelectionRange(int ichwAnchor, int ichwEnd, - float ydLineTop, float ydLineBottom, bool bOn) -{ - if (g_fDrawing) - return true; - - g_fDrawing = true; - - //SetUpGraphics(ichwBase, pgg, true); - - Assert(m_pseg->m_dxsWidth >= 0); - Assert(m_pseg->m_dysAscent >= 0); - - float xsSegLeft = 0; - float ysSegTop = 0; - - float xdSegRight = ScaleXToDest(m_pseg->m_dxsTotalWidth); - - int ichwMinSel = min(ichwAnchor, ichwEnd); - int ichwLimSel = max(ichwAnchor, ichwEnd); - - int ichwMinSeg = max(ichwMinSel, m_pseg->m_ichwMin + m_pseg->m_ichwAssocsMin); - int ichwLimSeg = min(ichwLimSel, m_pseg->m_ichwMin + m_pseg->m_ichwAssocsLim); - - std::vector vrs; - std::vector vfEntireHt; - - bool * prgfAllCompsSelected = new bool[m_pseg->m_dichwLim]; - std::fill_n(prgfAllCompsSelected, m_pseg->m_dichwLim, false); - CalcPartialLigatures(prgfAllCompsSelected, ichwMinSeg, ichwLimSeg, - ichwMinSel, ichwLimSel); - - // Array to keep track of which glyphs were highlighted. - int cginf = m_pseg->m_cginf; - bool * prgfHighlighted = new bool[cginf]; - std::fill_n(prgfHighlighted, cginf, false); - - for (int ichwLp = ichwMinSeg; ichwLp < ichwLimSeg; ichwLp++) - { - CalcHighlightRect(ichwLp, vrs, vfEntireHt, - !prgfAllCompsSelected[ichwLp - m_pseg->m_ichwMin], prgfHighlighted, false); - } - - // If all the glyphs of a given cluster were highlighted, highlight the whole cluster - // as a unit. - for (int islout = 0; islout < m_pseg->m_cslout; islout++) - { - CalcCompleteCluster(islout, vrs, vfEntireHt, prgfHighlighted); - } - - // Convert to destination coordinates; also extend full-line rectangles to the top - // and bottom of the line height. - std::vector vrd; - for (size_t irs = 0; irs < vrs.size(); irs++) - { - Rect rsTmp = vrs[irs]; - Rect rdTmp; - if (vfEntireHt[irs]) - { - rdTmp.top = ydLineTop; - rdTmp.bottom = ydLineBottom; - } - else - { - float ydTmp = ScaleYToDest(rsTmp.top + ysSegTop); - rdTmp.top = min(ydLineBottom, max(ydLineTop, ydTmp)); - ydTmp = ScaleYToDest(rsTmp.bottom + ysSegTop); - rdTmp.bottom = max(ydLineTop, min(ydLineBottom, ydTmp)); - } - float xdTmp = ScaleXToDest(rsTmp.left + xsSegLeft); - rdTmp.left = min(xdSegRight, max(float(0), xdTmp)); - xdTmp = ScaleXToDest(rsTmp.right + xsSegLeft); - rdTmp.right = max(float(0), min(xdSegRight, xdTmp)); - if (rdTmp.left > rdTmp.right) - { - // I think this can happen due to rounding errors. - float tmp = rdTmp.left; - rdTmp.left = rdTmp.right; - rdTmp.right = tmp; - } - vrd.push_back(rdTmp); - } - - // Create a list of rectangles with no overlaps, so the selection draws cleanly. - std::vector vrdNoOverlaps; - size_t irect; - for (irect = 0; irect < vrd.size(); irect++) - AddRectWithoutOverlaps(vrdNoOverlaps, vrd[irect]); - - AssertNoOverlaps(vrdNoOverlaps); - - // Draw the highlight. - for (irect = 0; irect < vrdNoOverlaps.size(); irect++) - { - Rect rdTmp = vrdNoOverlaps[irect]; - InvertRect(rdTmp.left, rdTmp.top, rdTmp.right, rdTmp.bottom); - } - - delete[] prgfAllCompsSelected; - delete[] prgfHighlighted; - - //RestoreFont(pgg); - - g_fDrawing = false; - - return (vrdNoOverlaps.size() > 0); -} - -/*---------------------------------------------------------------------------------------------- - Get a bounding rectangle that will contain the area highlighted by this segment - when drawing the specified range. - - @param ichwAnchor/End - selected range - @param ydLineTop/Bottom - top/bottom of area to highlight if whole line height; - includes half of inter-line spacing. - @param prdBounds - return location of range - @return - true if the return rectange has a meaningful value -----------------------------------------------------------------------------------------------*/ -bool SegmentPainter::positionsOfRange(int ichwAnchor, int ichwEnd, - float ydLineTop, float ydLineBottom, Rect * prdBounds) -{ - ChkGrArgPtr(prdBounds); - - std::vector vrs; - std::vector vfEntireHt; - - //SetUpGraphics(ichwBase, pgg, true); - - Assert(m_pseg->m_dxsWidth >= 0); - Assert(m_pseg->m_dysAscent >= 0); - - int ichwMin = min(ichwAnchor, ichwEnd); - int ichwLim = max(ichwAnchor, ichwEnd); - - for (int ichwLp = ichwMin; ichwLp < ichwLim; ichwLp++) - { - CalcHighlightRect(ichwLp, vrs, vfEntireHt, true, NULL, false); - } - - if (vrs.size() == 0) - { - return false; - } - - Rect * prsBounds = &(vrs[0]); - for (size_t irect = 1; irect < vrs.size(); irect++) - { - Rect * prs = &(vrs[irect]); - prsBounds->left = min(prsBounds->left, prs->left); - prsBounds->right = max(prsBounds->right, prs->right); - } - - prdBounds->top = ydLineTop; - prdBounds->bottom = ydLineBottom; - prdBounds->left = ScaleXToDest(prsBounds->left); - prdBounds->right = ScaleXToDest(prsBounds->right); - - return true; -} - -/*---------------------------------------------------------------------------------------------- - Convert a click position to a character position. - - @param zptdClickPosition - relative to the segment draw origin - @param pichw - return character clicked before - @param pfAssocPrev - return true if they clicked on the trailing half of - the previous char, false if click was on the - leading half of the following -----------------------------------------------------------------------------------------------*/ -void SegmentPainter::pointToChar(Point zptdClickPosition, int * pichw, bool * pfAssocPrev) -{ - ChkGrOutPtr(pichw); - ChkGrOutPtr(pfAssocPrev); - - //SetUpGraphics(ichwBase, pgg, true); - - bool fRtl = m_pseg->rightToLeft(); - - if (m_pseg->m_dysAscent < 0 || m_pseg->m_dxsWidth < 0) - m_pseg->ComputeDimensions(); - - if (m_pseg->m_dichwLim == 0 || m_pseg->m_cginf == 0) - { - *pichw = m_pseg->m_ichwMin; - *pfAssocPrev = false; - //RestoreFont(pgg); - return; - } - - float xsClick = ScaleXToSource(zptdClickPosition.x); - float ysClick = ScaleYToSource(zptdClickPosition.y); - ysClick = m_pseg->m_dysAscent - ysClick; // make relative to common base line - - float xsTry = xsClick; - float ysTry = ysClick; - - float xysInc = 1.0; - //res = pgg->LogUnitsFromXPixels(1, &xysInc); - //if (ResultFailed(res)) xysInc = 20; - int cTries = 1; - int nAdjustDir = 0; - - while (true) - { - float xsGlyphOffset; - float xsGlyphWidth; - int iginfLoc = PointToCharAux(xsTry, ysTry, &xsGlyphOffset, &xsGlyphWidth); - - bool fClickedAfter; - int ichwCharClicked; - if (xsTry < m_pseg->m_prgginf[m_pseg->LeftMostGlyph()].bb().left) - { - fClickedAfter = fRtl; - ichwCharClicked = (fClickedAfter) ? - m_pseg->m_ichwMin + m_pseg->m_ichwAssocsLim - 1 : - m_pseg->m_ichwMin + m_pseg->m_ichwAssocsMin; - } - else if (xsTry > m_pseg->m_prgginf[m_pseg->RightMostGlyph()].bb().right) - { - fClickedAfter = !fRtl; - ichwCharClicked = (fClickedAfter) ? - m_pseg->m_ichwMin + m_pseg->m_ichwAssocsLim - 1 : - m_pseg->m_ichwMin + m_pseg->m_ichwAssocsMin; - } - else - { - ichwCharClicked = m_pseg->PhysicalSurfaceToUnderlying(iginfLoc, - xsTry - xsGlyphOffset, m_pseg->m_dysAscent - ysClick, - xsGlyphWidth, m_pseg->m_dysHeight, &fClickedAfter); // handles ligature components - } - - if (fClickedAfter) - { - *pichw = ichwCharClicked + 1; - while (!GrCharStream::AtUnicodeCharBoundary(m_pseg->GetString(), *pichw)) - *pichw = *pichw + 1; - *pfAssocPrev = true; - } - else - { - *pichw = ichwCharClicked; - *pfAssocPrev = false; - } - - if (*pichw < m_pseg->m_ichwMin + m_pseg->m_ichwAssocsMin) - { - //RestoreFont(pgg); - return; - } - else if (*pichw >= m_pseg->m_ichwMin + m_pseg->m_ichwAssocsLim) - { - //RestoreFont(pgg); - return; - } - - //int islout = UnderlyingToLogicalInThisSeg(ichwBase, ichwCharClicked); - int isloutBefore = m_pseg->UnderlyingToLogicalInThisSeg(*pichw); - if (isloutBefore == kNegInfinity || isloutBefore == kPosInfinity) - { } - else - { - Assert(0 <= isloutBefore && isloutBefore < m_pseg->m_cslout); - if (m_pseg->OutputSlot(isloutBefore)->InsertBefore()) - { - // Legal insertion point - //RestoreFont(pgg); - return; - } - } - - // Gradually adjust the click position in various directions and try again - // until we find a legal insertion point. - switch (nAdjustDir) - { - case 0: // Adjust to the left - case 4: - xsTry = xsClick - (xysInc * cTries); - ysTry = ysClick; - nAdjustDir = 0; - break; - case 1: // Adjust to the right - xsTry = xsClick + (xysInc * cTries); - ysTry = ysClick; - break; - case 2: // Adjust up - xsTry = xsClick; - ysTry = ysClick - (xysInc * cTries); - break; - case 3: // Adjust down - xsTry = xsClick; - ysTry = ysClick + (xysInc * cTries); - cTries++; - break; - default: - Assert(false); - nAdjustDir = 0; - cTries++; - } - nAdjustDir++; - - if (cTries > 50) - { // Safety net - *pichw = 0; - *pfAssocPrev = false; - THROW(kresFail); - } - else if (cTries > 20) - xysInc = xysInc * 2; - } - - //RestoreFont(pgg); -} - -/*---------------------------------------------------------------------------------------------- - Convert a click position to a glyph bounding-box position. -----------------------------------------------------------------------------------------------*/ -int SegmentPainter::PointToCharAux(float xsTry, float ysTry, - float * pxsGlyphOffset, float * pxsGlyphWidth) -{ - int iginfLoc = m_pseg->GlyphHit(xsTry, ysTry); - - GlyphInfo * pginf = m_pseg->m_prgginf + iginfLoc; - *pxsGlyphOffset = pginf->bb().left; - *pxsGlyphWidth = pginf->bb().right - *pxsGlyphOffset; - - return iginfLoc; -} - -// Review: may need a way to do this and subsequent methods with one result per method? -/*---------------------------------------------------------------------------------------------- - Returns a value what logical position an arrow key should move the IP to. - - @param ichwIP - initial position - @param pfAssocPrev - is the IP "leaning" backwards? input and output - @param fRight - direction of desired movement (physical or logical?) - @param pfInThisSeg - initially true if ichwIP is in the current segment; - return value is true if there is a legitimate output -----------------------------------------------------------------------------------------------*/ -int SegmentPainter::arrowKeyPosition(int ichwIP, bool * pfAssocPrev, - bool fRight, bool * pfInThisSeg) -//GrResult SegmentPainter::arrowKeyPosition( -// int * pichwIP, bool * pfAssocPrev, -// bool fRight, bool fMovingIn, -// bool * pfResult) -{ - ChkGrArgPtr(pfAssocPrev); - //ChkGrOutPtr(pfInThisSeg); - - bool fMovingIn = !*pfInThisSeg; - int ichwTmp = ichwIP; - bool fResult; - ArrowKeyPositionAux(&ichwTmp, pfAssocPrev, fRight, fMovingIn, false, false, &fResult); - *pfInThisSeg = fResult; - return ichwTmp; - - //return ArrowKeyPositionAux(pichwIP, pfAssocPrev, - // fRight, fMovingIn, false, false, pfResult); -} - -/*---------------------------------------------------------------------------------------------- - Indicate what logical position a shift-arrow-key combination should move the - end of the selection to. - - @param pichw - initial endpoint and also adjusted result - @param fAssocPrevMatch - true if we need a certain orientation for the result; - should be false when *pichw = 0 and we are moving within the - same segment - @param fAssocPrevNeeded - association of the end-point, ie, true if it follows the anchor - @param ichAnchor - -1 if anchor is in a different segment - @param fRight - direction of desired movement - @param fMovingIn - true if we are moving in to this segment; - if so, initial pichw meaningless - @param pfRet - if false try next seg or string -----------------------------------------------------------------------------------------------*/ -int SegmentPainter::extendSelectionPosition(int ichwEnd, bool fAssocPrevMatch, bool fAssocPrevNeeded, - int ichwAnchor, bool fRight, bool * pfInThisSeg) -//GrResult SegmentPainter::extendSelectionPosition( -// int * pichw, bool fAssocPrevMatch, bool fAssocPrevNeeded, int ichwAnchor, -// bool fRight, bool fMovingIn, -// bool* pfRet) -{ - //ChkGrArgPtr(pichw); - //ChkGrOutPtr(pfRet); - - // Make the same adjustment as for an insertion point. - bool fAssocPrevCopy = fAssocPrevMatch; - bool fMovingIn = !*pfInThisSeg; - int ichwOld = ichwEnd; - int ichwNew = ichwEnd; - bool fResult; - ArrowKeyPositionAux(&ichwNew, &fAssocPrevCopy, - fRight, fMovingIn, fAssocPrevMatch, fAssocPrevNeeded, &fResult); - *pfInThisSeg = fResult; - - //int ichwNew = *pichw; - //bool fAssocPrevCopy = fAssocPrevMatch; - //// TODO: adjust fAssocPrevCopy based on assoc-prev value of IP - //*pfRet = false; - //int ichwOld = *pichw; - //GrResult res = ArrowKeyPositionAux(&ichwNew, &fAssocPrevCopy, - // fRight, fMovingIn, - // fAssocPrevMatch, fAssocPrevNeeded, - // pfRet); - -// if (*pfRet && ichwNew == *pichw) -// { -// // The selection wasn't actually moved, just switched the direction it leans. -// // Try one more time. -// res = ArrowKeyPositionAux(&ichwNew, &fAssocPrevCopy, -// fRight, fMovingIn, -// (ichwAnchor != *pichw && fAssocPrevNeeded), fAssocPrevNeeded, -// pfRet); -// } - if (ichwAnchor != -1 && fResult && - ((ichwNew < ichwAnchor && ichwAnchor < ichwOld) || - (ichwOld < ichwAnchor && ichwAnchor < ichwNew))) - { - // Don't switch directions in one operation--force to an insertion point. - ichwNew = ichwAnchor; - } - return ichwNew; - //*pichw = ichwNew; - //ReturnResult(res); -} - -/*---------------------------------------------------------------------------------------------- - Handle arrow key movement for both plain and shifted arrows. - - @param pichw - initial endpoint and also adjusted result - @param pfAssocPrev - association of the end-point, ie, true if it follows the anchor - @param fRight - direction of desired movement - @param fMovingIn - true if we are moving in to this segment; - if so, initial pichw meaningless - @param fAssocPrevMatch - true if the direction of the result should - match the requested orientation, to avoid flipping around and - infinite loops - @param fAssocPrevNeeded - what is needed for the result, if fAssocPrevMatch == true - @param pfRet - if false try next segment or string -----------------------------------------------------------------------------------------------*/ -GrResult SegmentPainter::ArrowKeyPositionAux( - int * pichwIP, bool * pfAssocPrev, - bool fRight, bool fMovingIn, - bool fAssocPrevMatch, bool fAssocPrevNeeded, - bool * pfResult) -{ - ChkGrArgPtr(pfResult); - - //bool fAssocPrevTmp = *pfAssocPrev; - - Assert(m_pseg->m_dxsWidth >= 0); - Assert(m_pseg->m_dysAscent >= 0); - - int nNextOrPrevSeg; - if (!fMovingIn) - { - *pfResult = ArrowKeyPositionInternal(pichwIP, pfAssocPrev, fRight, - fAssocPrevMatch, fAssocPrevNeeded, &nNextOrPrevSeg); - ReturnResult(kresOk); - } - else - { - int ichw; - bool fAssocPrevNew; - if (fRight) - { - // Moving right: make selection at left edge. - int iginf = m_pseg->LeftMostGlyph(); - bool fBefore = !m_pseg->rightToLeft(); - ichw = m_pseg->PhysicalSurfaceToUnderlying(iginf, fBefore) + - ((fBefore) ? 0 : 1); - fAssocPrevNew = !fBefore; // Review: should it be based on the char dir? - } - else - { - // Moving left: make selection at right edge; - int iginf = m_pseg->RightMostGlyph(); - bool fBefore = m_pseg->rightToLeft(); - ichw = m_pseg->PhysicalSurfaceToUnderlying(iginf, fBefore) + - ((fBefore) ? 0 : 1); - fAssocPrevNew = !fBefore; // Review: should it be based on the char dir? - } - - // Okay, now we have a selection at the edge of the segment. Try moving inside by - // one glyph. - *pfResult = ArrowKeyPositionInternal(&ichw, &fAssocPrevNew, fRight, - fAssocPrevMatch, fAssocPrevNeeded, &nNextOrPrevSeg); - if (*pfResult) - { - *pichwIP = ichw; - *pfAssocPrev = fAssocPrevNew; - } - - } - - ReturnResult(kresOk); -} - -/*---------------------------------------------------------------------------------------------- - Used to find out where underlines should be drawn. - - @param ichwMin/Lim - range of text of interest - @param rs, rd - source/destination coordinates, for scaling - @param fSkipSpace - true if white space should not be underlined; some renderers may - ignore this - @param cxdMax - number of ranges allowed - @param prgxdLefts/Rights/UnderTops - - arrays of corresponding values indicating where an underline - should be drawn, in logical order - - TODO: fix the bug where if you have trailing spaces in different segments (eg, - at different sizes), the spaces all but the last segment will be erroneously included - in the underline result. -----------------------------------------------------------------------------------------------*/ -size_t SegmentPainter::getUnderlinePlacement(int ichwMin, int ichwLim, - bool fSkipSpace, size_t cxdMax, - float * prgxdLefts, float * prgxdRights, float * prgydUnderTops) -{ - ChkGrArrayArg(prgxdLefts, cxdMax); - ChkGrArrayArg(prgxdRights, cxdMax); - //ChkGrArrayArg(prgydUnderTops, cxdMax); - - GrResult res = kresOk; - - //SetUpGraphics(ichwBase, pgg, true); - - Assert(m_pseg->m_dxsWidth >= 0); - Assert(m_pseg->m_dysAscent >= 0); - - float xsSegLeft = m_pseg->m_dxsTotalWidth; - for (int iginf = 0; iginf < m_pseg->m_cginf; iginf++) - { - xsSegLeft = min(xsSegLeft, m_pseg->GlyphLeftEdge(iginf)); - } - - float xdSegLeft = this->ScaleXToDest(xsSegLeft); - float xdSegRight = xdSegLeft + m_pseg->m_dxsTotalWidth; - - int ichwMinSel = min(ichwMin, ichwLim); - int ichwLimSel = max(ichwMin, ichwLim); - - int ichwMinSeg = max(ichwMinSel, m_pseg->m_ichwMin + m_pseg->m_ichwAssocsMin); - int ichwLimSeg = min(ichwLimSel, m_pseg->m_ichwMin + m_pseg->m_ichwAssocsLim); - - std::vector vrs; - std::vector vfEntireHt; - - bool * prgfAllCompsSelected = new bool[m_pseg->m_dichwLim]; - std::fill_n(prgfAllCompsSelected, m_pseg->m_dichwLim, false); - CalcPartialLigatures(prgfAllCompsSelected, ichwMinSeg, ichwLimSeg, - ichwMinSel, ichwLimSel); - - // Array to keep track of which glyphs were highlighted: - int cginf = m_pseg->m_cginf; - bool * prgfHighlighted = new bool[cginf]; - std::fill_n(prgfHighlighted, cginf, false); - - for (int ichwLp = ichwMinSeg; ichwLp < ichwLimSeg; ichwLp++) - { - CalcHighlightRect(ichwLp, vrs, vfEntireHt, - !prgfAllCompsSelected[ichwLp - m_pseg->m_ichwMin], prgfHighlighted, - (m_pseg->m_fEndLine && fSkipSpace)); - } - - // If all the glyphs of a given cluster were highlighted, highlight the whole cluster - // as a unit. - for (int islout = 0; islout < m_pseg->m_cslout; islout++) - { - CalcCompleteCluster(islout, vrs, vfEntireHt, prgfHighlighted); - } - - // Convert rectangles in source coordinates to line segments in destination - // coordinates. - std::vector vlsd; - for (size_t irs = 0; irs < vrs.size(); irs++) - { - Rect rsTmp = vrs[irs]; - LineSeg lsdTmp; - lsdTmp.left = min(xdSegRight, max(xdSegLeft, ScaleXToDest(rsTmp.left))); - lsdTmp.right = max(xdSegLeft, min(xdSegRight, ScaleXToDest(rsTmp.right))); - vlsd.push_back(lsdTmp); - } - - // Create a list of line segments with no overlaps. - std::vector vlsdNoOverlaps; - size_t ils; - for (ils = 0; ils < vlsd.size(); ils++) - AddLineSegWithoutOverlaps(vlsdNoOverlaps, vlsd[ils]); - - AssertNoOverlaps(vlsdNoOverlaps); - - // The gap between the baseline and underlining is one pixel, on a normal screen - // at standard magnification, and as near as we can get to the equivalent in any - // special case. - //float dydGap = rdHeight / 96; - //float dydSubscript = max(float(0), (-1 * GrEngine::GrFloatMulDiv(m_pseg->m_dysOffset, rsHeight, rdHeight))); - float dydGap = 1; - float dydSubscript = max(float(0), (-1 * (m_pseg->m_dysOffset * m_yFactor))); - float ydBottom = ScaleYToDest(m_pseg->m_dysAscent) + dydGap + dydSubscript; - - // Put the results in the output buffers. - size_t cxdRet = vlsdNoOverlaps.size(); - for (ils = 0; ils < min(cxdRet, size_t(cxdMax)); ils++) - { - prgxdLefts[ils] = vlsdNoOverlaps[ils].left; - prgxdRights[ils] = vlsdNoOverlaps[ils].right; - if (prgydUnderTops) - prgydUnderTops[ils] = ydBottom; - } - delete[] prgfAllCompsSelected; - delete[] prgfHighlighted; - - //RestoreFont(pgg); - - if (vlsdNoOverlaps.size() > cxdMax) - res = kresFail; - - return cxdRet; -} - - -//:>******************************************************************************************** -//:> Other methods -//:>******************************************************************************************** - -/*---------------------------------------------------------------------------------------------- - Handle either drawing an insertion point or returning the position at which it - would be drawn. - - @param ichwIP - character position - @param fAssocPrev - true if selection is associated with previous character - @param bOn - turning on or off? (ignored in this implementation) - @param fForceSplit - force a split insertion point - @param prdPrimary - if NULL, do drawing; otherwise, return location of primary IP - in destination device coordinates - @param prdSecondary - return location of secondary IP in dest device coordinates - @param pfPrimaryHere - true if primary selection is rendered in this segment - @param pfSecHere - true if (distinct) secondary selection is rendered in this segment; - false if it is in a different segment, or we are rendering - an I-beam (std selection) -----------------------------------------------------------------------------------------------*/ -void SegmentPainter::CalcOrDrawInsertionPoint( - int ichwIP, bool fAssocPrev, bool bOn, bool fForceSplit, - Rect * prdPrimary, Rect * prdSecondary) -{ - GrResult res = kresOk; - - float xsSegLeft = 0; - float ysSegTop = 0; - - if (prdPrimary) - { - prdPrimary->top = 0; - prdPrimary->bottom = 0; - prdPrimary->left = 0; - prdPrimary->right = 0; - } - if (prdSecondary) - { - prdSecondary->top = 0; - prdSecondary->bottom = 0; - prdSecondary->left = 0; - prdSecondary->right = 0; - } - - int ichwLim = m_pseg->m_ichwMin + m_pseg->m_dichwLim; - bool fRtl = m_pseg->rightToLeft(); - - if (m_pseg->m_dxsWidth < 0) - m_pseg->ComputeDimensions(); - - // Get the locations for the before and after selections. - - float xsBefore, ysBeforeTop, ysBeforeBottom; - float xsAfter, ysAfterTop, ysAfterBottom; - bool fRtlBefore, fRtlAfter; - CalcIP(ichwIP, true, &xsBefore, &ysBeforeTop, &ysBeforeBottom, &fRtlBefore); - CalcIP(ichwIP, false, &xsAfter, &ysAfterTop, &ysAfterBottom, &fRtlAfter); - - if (m_pseg->m_cginf == 0 && ichwIP == ichwLim) - { - Assert(kPosInfFloat == xsBefore && kPosInfFloat == xsAfter); - xsBefore = 0; - xsAfter = 0; - } - else if ((kPosInfFloat == xsBefore || kNegInfFloat == xsBefore) && - (kPosInfFloat == xsAfter || kNegInfFloat == xsAfter)) - { - return; // quick exit for nothing-to-draw case - } - - bool fPrimary = true; - if (fForceSplit) - { - // Supposedly we can't find both halves of the IP in this segment. - Assert(xsBefore == kPosInfFloat || xsBefore == kNegInfFloat - || xsAfter == kPosInfFloat || xsAfter == kNegInfFloat); - if (xsBefore == kPosInfFloat || xsBefore == kNegInfFloat) - { - // Can't find the char the IP is before. - fPrimary = fAssocPrev; - } - else // if (xsAfter == kPosInfinity || xsAfter == kNegInfinity) - { - // Can't find the char the IP is after. - fPrimary = !fAssocPrev; - } - ////Assert((dm == kdmSplitPrimary) == fPrimary); - } - - if (xsBefore == kPosInfinity || xsBefore == kNegInfinity) - { - ysBeforeTop = ysSegTop; - ysBeforeBottom = ysSegTop + m_pseg->m_dysHeight; - } - else - { - xsBefore += xsSegLeft; - ysBeforeTop += ysSegTop; - ysBeforeBottom += ysSegTop; - } - if (xsAfter == kNegInfinity || xsAfter == kPosInfinity) - { - ysAfterTop = ysSegTop; - ysAfterBottom = ysSegTop + m_pseg->m_dysHeight; - } - else - { - xsAfter += xsSegLeft; - ysAfterTop += ysSegTop; - ysAfterBottom += ysSegTop; - } - - float xsLeft = xsSegLeft - + ((fRtl && m_pseg->m_fEndLine) ? (m_pseg->m_dxsVisibleWidth - m_pseg->m_dxsTotalWidth) :0); - float xsRight = xsSegLeft - + ((fRtl && m_pseg->m_fEndLine) ? m_pseg->m_dxsVisibleWidth : m_pseg->m_dxsTotalWidth) - + m_pseg->m_dxsStretch; - float dysMinSplitHeight = m_pseg->m_dysHeight / 4; - - if (!fForceSplit) // kdmNormal == dm) - { - // Standard I-beam, or both halves of split IP. - - bool fIBeam = false; - - if (xsBefore == xsAfter) - // Positions coincide within this segment: make an I-beam. - fIBeam = true; - - else if (fabsf(xsBefore - xsLeft) <= 1 && ichwIP == m_pseg->m_ichwMin) - { - // Logical start is at a left edge: allow I-beam if previous segment has one - // at the end (or there is no previous segment). - //Assert(!fRtlBefore); - //if (m_pseg->m_psegPrev) - //{ - // SegmentPainter segpPrev(m_pseg->m_psegPrev); - // fIBeam = segpPrev.doBoundariesCoincide(true, true); - //} - //else - - fIBeam = true; - } - else if (fabsf(xsBefore - xsRight) <= 1 && ichwIP == m_pseg->m_ichwMin) - { - // Logical start is at a right edge: allow I-beam if previous segment has one - // at the end (or there is no previous segment). - //Assert(fRtlBefore); - //if (m_pseg->m_psegPrev) - //{ - // SegmentPainter segpPrev(m_pseg->m_psegPrev); - // fIBeam = segpPrev.doBoundariesCoincide(true, false); - //} - //else - - fIBeam = true; - } - else if (fabsf(xsAfter - xsLeft) <= 1 && ichwIP == ichwLim) - { - // Logical end is at a left edge: allow I-beam if next segment has one - // at the beginning (or there is no next segment). - //Assert(fRtlAfter); - //if (m_pseg->m_psegNext == NULL) - //{ - // SegmentPainter segpPrev(m_pseg->m_psegPrev); - // fIBeam = segpPrev.doBoundariesCoincide(false, true); - //} - //else - - fIBeam = true; - } - else if (fabsf(xsAfter - xsRight) <= 1 && ichwIP == ichwLim) - { - // Logical end is at a right edge: allow I-beam if next segment has one - // at the beginning (or there is no next segment). - //Assert(!fRtlAfter); - //if (m_pseg->m_psegNext == NULL) - //{ - // SegmentPainter segpPrev(m_pseg->m_psegPrev); - // fIBeam = segpPrev.doBoundariesCoincide(false, false); - //} - //else - - fIBeam = true; - } - else - { - // If the horizontal positions of the two halves are sufficiently close, - // make an I-beam. - fIBeam = CloseIPPositions( - &xsBefore, ysBeforeTop, ysBeforeBottom, - &xsAfter, ysAfterTop, ysAfterBottom); - } - if (ResultFailed(res)) - THROW(WARN(res)); - - if (fIBeam && - ((ichwIP == m_pseg->m_ichwMin && fAssocPrev) || (ichwIP == ichwLim && !fAssocPrev))) - { - // Adjacent segment will show the I-beam, so don't show it here. - if (m_pseg->m_cginf == 0) - { - // Empty segment--assume no adjacent segment. - } - else - return; - } - - if (fIBeam) - { // I-beam caret - - float ysTop = min(ysBeforeTop, ysAfterTop); - float ysBottom = max(ysBeforeBottom, ysAfterBottom); - float xsMid = (xsBefore == kPosInfFloat) ? xsAfter : xsBefore; - InvertIBeam(xsMid, ysTop, ysBottom, fAssocPrev, prdPrimary); - } - else - { // split caret - if (fAssocPrev) - { // xsAfter is primary, xsBefore is secondary - if (xsAfter != kNegInfinity) - { - InvertSplitIP(xsAfter, ysAfterTop, ysAfterBottom, - true, fRtlAfter, false, dysMinSplitHeight, prdPrimary); - } - if (xsBefore != kPosInfFloat) - { - InvertSplitIP(xsBefore, ysBeforeTop, ysBeforeBottom, - false, !fRtlBefore, true, dysMinSplitHeight, prdSecondary); - } - } - else - { // xsBefore is primary, xsAfter is secondary - if (xsBefore != kPosInfinity) - { - InvertSplitIP(xsBefore, ysBeforeTop, ysBeforeBottom, - false, !fRtlBefore, false, dysMinSplitHeight, prdPrimary); - } - if (xsAfter != kNegInfinity) - { - InvertSplitIP(xsAfter, ysAfterTop, ysAfterBottom, - true, fRtlAfter, true, dysMinSplitHeight, prdSecondary); - } - } - //*pfSecHere = true; - } - //*pfPrimaryHere = true; - } - else if (fForceSplit && fPrimary) // kdmSplitPrimary == dm) - { - // Draw just the primary caret. - if (fAssocPrev) - { // xsAfter is primary - if (xsAfter == kNegInfinity) - {} // no primary - else - InvertSplitIP(xsAfter, ysAfterTop, ysAfterBottom, - true, fRtlAfter, false, dysMinSplitHeight, prdPrimary); - } - else - { // xsBefore is primary - if (xsBefore == kPosInfinity) - {} // no primary - else - InvertSplitIP(xsBefore, ysBeforeTop, ysBeforeBottom, - false, !fRtlBefore, false, dysMinSplitHeight, prdPrimary); - } - } - else // fForceSplit && !fPrimary - { - // Draw just the secondary caret. - //Assert(kdmSplitSecondary == dm); - if (fAssocPrev) - { // xsBefore is secondary - if (xsBefore == kPosInfinity) - {} // no secondary - else - InvertSplitIP(xsBefore, ysBeforeTop, ysBeforeBottom, - false, !fRtlBefore, true, dysMinSplitHeight, prdSecondary); - } - else - { // xsAfter is secondary - if (xsAfter == kNegInfinity) - {} // no secondary - else - InvertSplitIP(xsAfter, ysAfterTop, ysAfterBottom, - true, fRtlAfter, true, dysMinSplitHeight, prdSecondary); - } - } -} - -/*---------------------------------------------------------------------------------------------- - Draw an I-beam cursor, or return the location at which it would be drawn. - - Note that currently we do not draw a true I-beam, but rather just a vertical line. - - @param xs - horizontal center of IP - @param ysTop - top of glyph (or ligature component) box - @param ysBottom - bottom of glyph (or ligature component) box - @param fAssocRight - true if the IP is associated with the text to the right - @param rs, rd - source/destination device coordinates - @param prdRet - return location to be drawn in dest device coords; - if NULL, do the drawing -----------------------------------------------------------------------------------------------*/ -void SegmentPainter::InvertIBeam(float xs, float ysTop, float ysBottom, - bool fAssocPrev, Rect * prdRet) -{ - float xd = ScaleXToDest(xs); - float ydTop = ScaleYToDest(ysTop); - float ydBottom = ScaleYToDest(ysBottom); - - // For now, assume that destination coordinates are in terms of pixels. - float dxdTwoXPixels = 2; - - float dxdLeftAdjust = dxdTwoXPixels / 2; - float dxdRightAdjust = dxdTwoXPixels - dxdLeftAdjust; - -// int dysFontAscent; -// pgg->GetFontAscentSourceUnits(pgg, &dysFontAscent); -// dysFontAscent += m_dysXAscent; -// if (dysFontAscent < 20) -// { -// dxdRightAdjust--; -// dxdRightHook = 1; -// } - - if (prdRet) - { - prdRet->left = xd - dxdLeftAdjust; - prdRet->right = xd + dxdRightAdjust; - prdRet->top = ydTop; - prdRet->bottom = ydBottom; - } - else - { - InvertRect(xd-dxdLeftAdjust, ydTop, - xd+dxdRightAdjust, ydBottom); - - // To make a true I-beam: -// InvertRect(xd-dxdTwoXPixels, ydTop-dydOneYPixel, -// xd+dxdRightHook, ydTop); -// InvertRect(xd-dxdTwoXPixels, ydBottom, -// xd+dxdRightHook, ydBottom+dydOneYPixel); - } -} - -/*---------------------------------------------------------------------------------------------- - Draw a split insertion point, or return the location at which it would be drawn. - - @param xs - horizontal center of IP - @param ysTop - top of glyph (or ligature component) box - @param ysBottom - bottom of glyph (or ligature component) box - @param fTop - true if the IP is to be drawn at the top of the line of text - @param fAssocRight - true if the IP is associated with the text to the right - @param fSecondary - true if the IP is secondary, false if it is primary - @param dysMinSplitHeight - - minimum split cursor height - @param rs, rd - source/destination device coordinates - @param prdRet - return location to be drawn in dest device coords; - if NULL, do the drawing -----------------------------------------------------------------------------------------------*/ -void SegmentPainter::InvertSplitIP(float xs, float ysTop, float ysBottom, - bool fTop, bool fAssocRight, bool fSecondary, float dysMinSplitHeight, - Rect * prdRet) -{ - if (prdRet == NULL && ysTop == ysBottom) - return; // invisible IP - - float xd = ScaleXToDest(xs); - float ydTop = ScaleYToDest(ysTop); - float ydBottom = ScaleYToDest(ysBottom); - float dydMinSplitHeight = dysMinSplitHeight * m_yFactor; - - float ydMid = (ydTop + ydBottom) / 2; - - // For now, assume that destination coordinates are in terms of pixels. - float dxdOneXPixel = 1; - float dydOneYPixel = 1; - float dxdTwoXPixels = 2; - - float xdLeft, xdRight, dxdHookLen; - if (fSecondary) - { - xdLeft = xd - (dxdOneXPixel / 2); - xdRight = xdLeft + 1; - dxdHookLen = 2; - } - else - { - xdLeft = xd - (dxdTwoXPixels / 2); - xdRight = xdLeft + 2; - dxdHookLen = 3; - } - - float yd1, yd2; - if (fTop) - { - yd1 = ydTop; - if (ydMid - ydTop < dydMinSplitHeight) - ydMid = ydTop + dydMinSplitHeight; - yd2 = (fSecondary) ? ydMid : ydMid + 3; - } - else - { - yd2 = ydBottom; - if (ydBottom - ydMid < dydMinSplitHeight) - ydMid = ydBottom - dydMinSplitHeight; - yd1 = (fSecondary) ? ydMid : ydMid - 3; - } - - if (prdRet) - { - prdRet->left = xdLeft; - prdRet->right = xdRight; - // The most common reason for returning the positions of the IP is to scroll it into - // view, in which case we want to return the entire line height, not just the - // height of the IP itself. - prdRet->top = ydTop; // yd1; - prdRet->bottom = ydBottom; // yd2; - } - else - { - InvertRect(xdLeft, yd1, xdRight, yd2); - } - - if (fAssocRight) - { - if (prdRet) - prdRet->right = xdRight + dxdHookLen; - else - { - if (fTop) - InvertRect(xdRight, ydTop, - xdRight + dxdHookLen, ydTop + dydOneYPixel); - else - InvertRect(xdRight, ydBottom-dydOneYPixel, - xdRight + dxdHookLen, ydBottom); - } - } - else - { - if (prdRet) - prdRet->left = xdLeft - dxdHookLen; - else - { - if (fTop) - InvertRect(xdLeft - dxdHookLen, ydTop, - xdLeft, ydTop + dydOneYPixel); - else - InvertRect(xdLeft - dxdHookLen, ydBottom - dydOneYPixel, - xdLeft, ydBottom); - } - } -} - -/*---------------------------------------------------------------------------------------------- - Given a character position (relative to the beginning of the string), return the - position for the insertion point, relative to the top-left of the segment. - Notice that these are before/after positions, not left/right positions. - Return an infinity value to indicate no appropriate IP. - - @param ichwSel - selection position, relative to beginning of string - @param fBefore - true if we are interested in the character the IP is before. - @param pxs, pysTop, pysBottom - - return locations for drawing the IP (top and bottom are not - adjusted for half-selections) - @param pfRtl - return true if the character is right-to-left - - Review: it might be useful to figure out if the two surface glyphs are physically adjacent - in such a way that their IPs can be combined into one I-beam. For now we use a simple - rule that assumes that any glyph or ligature component is at least 10% as wide as the - height of the font (see CloseIPPositions). -----------------------------------------------------------------------------------------------*/ -void SegmentPainter::CalcIP(int ichwSel, bool fBefore, - float * pxs, float * pysTop, float * pysBottom, bool * pfRtl) -{ - Font & font = this->m_pseg->getFont(); - - int ichw = (fBefore) ? ichwSel : ichwSel - 1; - - int iginfOutput; - - *pfRtl = m_pseg->CharIsRightToLeft(ichw, fBefore); - - GrEngine * pgreng = m_pseg->EngineImpl(); - GrGlyphTable * pgtbl = (pgreng) ? pgreng->GlyphTable() : NULL; - - float dysFontAscent = m_pseg->m_dysFontAscent; - ////GrResult res = GetFontAscentSourceUnits(pgg, &dysFontAscent); - ////if (ResultFailed(res)) - //// THROW(WARN(res)); - dysFontAscent += m_pseg->m_dysXAscent; - - *pysTop = 0; - *pysBottom = m_pseg->m_dysHeight; - - int ichwSegOffset = ichw - m_pseg->m_ichwMin; - int isloutLig; - if (ichwSegOffset < m_pseg->m_ichwAssocsMin || ichwSegOffset >= m_pseg->m_ichwAssocsLim) - isloutLig = kNegInfinity; - else - isloutLig = m_pseg->m_prgisloutLigature[ichwSegOffset - m_pseg->m_ichwAssocsMin]; - bool fOkLig = (isloutLig != kNegInfinity); - if (pgtbl && fOkLig) - { - // Ligature component; place the IP at the boundary - // of the component box. - - GrSlotOutput * pslout = m_pseg->OutputSlot(isloutLig); - int icomp = m_pseg->m_prgiComponent[ichwSegOffset - m_pseg->m_ichwAssocsMin]; - - iginfOutput = m_pseg->LogicalToPhysicalSurface(isloutLig); - - float xsGlyphOffset = m_pseg->GlyphLeftEdge(iginfOutput); - - float xsLeft, xsRight, ysTop, ysBottom; - - // TODO: Rework ComponentIndexForGlyph to take slati rather than iForGlyph. - int slati = pslout->ComponentId(icomp); - int iForGlyph = pgtbl->ComponentIndexForGlyph(pslout->GlyphID(), slati); - fOkLig = pgtbl->ComponentBoxLogUnits(m_pseg->m_xysEmSquare, pslout->GlyphID(), iForGlyph, - m_pseg->m_mFontEmUnits, m_pseg->m_dysAscent, - &xsLeft, &ysTop, &xsRight, &ysBottom); - if (fOkLig) - { - if (fBefore == *pfRtl) - // Position of interest is to the right. - *pxs = xsGlyphOffset + xsRight; - else - // Position of interest is to the left. - *pxs = xsGlyphOffset + xsLeft; - - GlyphInfo * pginf = m_pseg->m_prgginf + iginfOutput; - float ysGlyph = pginf->yOffset(); - - *pysTop = ysTop + (m_pseg->m_dysAscent - dysFontAscent) - ysGlyph; - *pysBottom = ysBottom + (m_pseg->m_dysAscent - dysFontAscent) - ysGlyph; - } - } - - if (!fOkLig) - { - // Not a ligature component. - - int islout = m_pseg->UnderlyingToLogicalSurface(ichw, fBefore); - GrSlotOutput * psloutTmp = m_pseg->OutputSlot(islout); - iginfOutput = m_pseg->LogicalToPhysicalSurface(islout); - - if (kPosInfinity == iginfOutput || kNegInfinity == iginfOutput) - *pxs = kPosInfFloat; - - else - { - bool fCluster = (psloutTmp->IsPartOfCluster()); - bool fHighlightBB = fCluster; - // Test below should match the one in CalcHighlightRect: - if ((psloutTmp->ClusterAdvance() == 0 - || psloutTmp->GlyphMetricLogUnits(&font, kgmetAdvWidth) == 0) - && !psloutTmp->IsSpace()) - { - fHighlightBB = true; // use bounding box for zero-advance glyph - } - if (fHighlightBB) - { - // Cluster member or zero-width glyph. - - if (fCluster && AtEdgeOfCluster(psloutTmp, islout, fBefore) && - !CanInsertIntoCluster(psloutTmp, islout)) - { - // Place the IP at the edge of the whole cluster. - - int isloutBase = psloutTmp->ClusterBase(); - GrSlotOutput * psloutBase = m_pseg->OutputSlot(isloutBase); - //int igbbBase = psloutBase->GlyphBbIndex(); - int iginfBase = m_pseg->LogicalToPhysicalSurface(isloutBase); - - float xsBase = m_pseg->GlyphLeftEdge(iginfBase); - - float xsLeft = xsBase + psloutBase->ClusterXOffset(); - float xsRight = xsBase + psloutBase->ClusterAdvance(); - - if (fBefore == *pfRtl) - // Position of interest is to the right - *pxs = xsRight; - else - // Position of interest is to the left. - *pxs = xsLeft; - } - else - { - // Place the IP on the perimeter of the bounding box of the cluster member. - - float xsGlyphStart = m_pseg->GlyphLeftEdge(iginfOutput); - -// float dysFontAscent; -// res = GetFontAscentSourceUnits(pgg, &dysFontAscent); -// if (ResultFailed(res)) THROW(WARN(res)); -// dysFontAscent += m_dysXAscent; - - float ysBbTop = psloutTmp->GlyphMetricLogUnits(&font, kgmetBbTop); - float ysBbBottom = psloutTmp->GlyphMetricLogUnits(&font, kgmetBbBottom); - float xsBbLeft = psloutTmp->GlyphMetricLogUnits(&font, kgmetBbLeft); - float xsBbRight = psloutTmp->GlyphMetricLogUnits(&font, kgmetBbRight); - - int twoPixels = 2; // assume dest coords are in pixels - - if (fBefore == *pfRtl) - // Position of interest is to the right - *pxs = xsGlyphStart + xsBbRight + twoPixels; - else - // Position of interest is to the left. - *pxs = xsGlyphStart + xsBbLeft - twoPixels; - - GlyphInfo * pginf = m_pseg->m_prgginf + iginfOutput; - float ysGlyph = pginf->yOffset(); - float ysGlyphBaseline = m_pseg->m_dysAscent - ysGlyph; // relative to top - - *pysTop = ysGlyphBaseline - ysBbTop - twoPixels; - *pysBottom = ysGlyphBaseline - ysBbBottom + twoPixels; - } - } - else - { - // Insertion point goes at origin or advance width of glyph. - - *pxs = m_pseg->GlyphLeftEdge(iginfOutput); - if (fBefore == *pfRtl) - { - // Position of interest is to the right - //*pxs += psloutTmp->GlyphMetricLogUnits(&font, kgmetAdvWidth); - *pxs += psloutTmp->ClusterAdvance(); - } - // else position of interest is to the left - } - } - } -} - -/*---------------------------------------------------------------------------------------------- - If the two positions for the insertion point are close enough, merge them into - one insertion point, and return true to indicate that we want an I-beam. - - @param pxsBefore, pxsAfter - for comparing, and also adjusted results - @param ysBeforeTop/Bottom, ysAfterTop/Bottom - for comparing -----------------------------------------------------------------------------------------------*/ -bool SegmentPainter::CloseIPPositions(float * pxsBefore, float ysBeforeTop, float ysBeforeBottom, - float * pxsAfter, float ysAfterTop, float ysAfterBottom) -{ - // No adjustment if vertical positions are disjoint. - if (ysBeforeBottom <= ysAfterTop) - return false; - if (ysAfterBottom <= ysBeforeTop) - return false; - - float dysHt = max(ysBeforeBottom, ysAfterBottom) - min(ysBeforeTop, ysAfterTop); - float dxsDiff = fabsf(*pxsBefore - *pxsAfter); - - // If the difference in the x positions is less than 10% of the height, - // we want an I-beam--use the average. - if (dxsDiff * 10 < dysHt) - { - *pxsBefore = (*pxsBefore + *pxsAfter) / 2; - *pxsAfter = *pxsBefore; - return true; - } - - return false; -} - -/*---------------------------------------------------------------------------------------------- - Return true if the slot in question is the first or last slot of its cluster, - or if it is not part of a cluster at all. Return false if the specified side - of the slot is interior to a cluster. - - @param fBefore - if true, we are examining the slot the insertion point is before, - so we are interested in whether this slot is at the - leading edge of the cluster. -----------------------------------------------------------------------------------------------*/ -bool SegmentPainter::AtEdgeOfCluster(GrSlotOutput * pslout, int islout, bool fBefore) -{ - if (!pslout->IsPartOfCluster()) - return true; - - if (fBefore && (islout == 0)) - return true; - if (!fBefore && (m_pseg->m_cslout == islout + 1)) - return true; - - // If the adjacent slot in whatever direction we're interested in has the same - // cluster base, this slot is not on the edge of the cluster. - // -- NO, because you could have an intervening glyph that is not part of the - // cluster. - //int isloutAdjacentBase = (fBefore) ? - // m_pseg->OutputSlot(islout - 1)->ClusterBase() : - // m_pseg->OutputSlot(islout + 1)->ClusterBase(); - //return (isloutAdjacentBase != m_pseg->OutputSlot(islout)->ClusterBase()); - - // Ask the cluster base. - return AtEdgeOfCluster(m_pseg->OutputSlot(pslout->ClusterBase()), pslout->ClusterBase(), - pslout, islout, fBefore); -} - -bool SegmentPainter::AtEdgeOfCluster(GrSlotOutput * psloutBase, int isloutBase, - GrSlotOutput * pslout, int islout, bool fBefore) -{ - // Compare pslout to all the members of the cluster. If it is the minimum or maximum, it - // is at an edge. - if (fBefore && isloutBase < islout) - return false; - if (!fBefore && isloutBase > islout) - return false; - - std::vector visloutCluster; - m_pseg->ClusterMembersForGlyph(isloutBase, psloutBase->ClusterRange(), visloutCluster); - - for (size_t iislout = 0; iislout < visloutCluster.size(); iislout++) - { - int isloutMember = visloutCluster[iislout]; - if (fBefore && isloutMember < islout) - return false; - if (!fBefore && isloutMember > islout) - return false; - } - return true; -} - -/*---------------------------------------------------------------------------------------------- - Return true if it is permitted to put an insertion point somewhere in the middle of - the given slot's cluster. -----------------------------------------------------------------------------------------------*/ -bool SegmentPainter::CanInsertIntoCluster(GrSlotOutput * pslout, int islout) -{ - if (!pslout->IsPartOfCluster()) - return false; - - int isloutBase = pslout->ClusterBase(); - if (islout != isloutBase) - { - // Ask the cluster base. - Assert(pslout->ClusterRange() == 0); - return CanInsertIntoCluster(m_pseg->OutputSlot(isloutBase), isloutBase); - } - - if (!AtEdgeOfCluster(pslout, islout, true) && pslout->InsertBefore()) - return true; - - std::vector visloutCluster; - m_pseg->ClusterMembersForGlyph(isloutBase, pslout->ClusterRange(), visloutCluster); - - for (size_t iislout = 0; iislout < visloutCluster.size(); iislout++) - { - int isloutMember = visloutCluster[iislout]; - if (AtEdgeOfCluster(m_pseg->OutputSlot(isloutMember), isloutMember, true)) - // Inserting before the first member of the cluster doesn't count. - continue; - - if (m_pseg->OutputSlot(isloutMember)->InsertBefore()) - return true; - } - - return false; -} - -/*---------------------------------------------------------------------------------------------- - Determine which characters in the selected range are part of ligatures that are fully - selected vs. those that are only partially selected. Those that are only partially selected - must have their components highlighted individually, but those that are fully selected - should be highlighted fully, to avoid blank spots in the case that the components do not - fully cover the surface of the glyph. - - @param prgfAllSelected - array of flags to fill in with results - @param ichwMin/LimSeg - range of characters to examine - @param ichwMin/LimSel - range of characters that are selected -----------------------------------------------------------------------------------------------*/ -void SegmentPainter::CalcPartialLigatures(bool * prgfAllSelected, - int ichwMinSeg, int ichwLimSeg, - int ichwMinSel, int ichwLimSel) -{ - GrEngine * pgreng = m_pseg->EngineImpl(); - GrGlyphTable * pgtbl = (pgreng) ? pgreng->GlyphTable() : NULL; - - for (int ichw = ichwMinSeg; ichw < ichwLimSeg; ichw++) - { - int ichwSegOffset = ichw - m_pseg->m_ichwMin; - int isloutLig; - if (ichwSegOffset < m_pseg->m_ichwAssocsMin || ichwSegOffset >= m_pseg->m_ichwAssocsLim) - isloutLig = kNegInfinity; - else - isloutLig = m_pseg->m_prgisloutLigature[ichwSegOffset - m_pseg->m_ichwAssocsMin]; - bool fLigComp = (pgtbl && isloutLig != kNegInfinity); - if (fLigComp && !prgfAllSelected[ichwSegOffset]) - { - GrSlotOutput * pslout = m_pseg->OutputSlot(isloutLig); - bool fAll = true; - int icomp; - for (icomp = 0; icomp < pslout->NumberOfComponents(); icomp++) - { - int ichwUnderlying = pslout->FirstUnderlyingComponent(icomp); // is it possible to select one char of a component and not another? - if (ichwUnderlying < ichwMinSel - m_pseg->m_ichwMin || - ichwUnderlying >= ichwLimSel - m_pseg->m_ichwMin) - { - fAll = false; // found a component that is not selected - } - } - for (icomp = 0; icomp < pslout->NumberOfComponents(); icomp++) - { - for (int ichw = pslout->FirstUnderlyingComponent(icomp) ; - ichw <= pslout->LastUnderlyingComponent(icomp) ; - ichw++) - { - if (m_pseg->m_prgiComponent[ichw - m_pseg->m_ichwAssocsMin] == icomp) - prgfAllSelected[ichw] = fAll; - } - } - } - } -} - -/*---------------------------------------------------------------------------------------------- - The given character is part of the selected range. Add to the vector a rectangle (or - eventually, several) indicating the corresponding screen area(s) of the character. - The rectangle is relative to the top left of the segment. - - @param ichw - selected char, relative to beginning of string - @param vrs - list of rectangles to highlight, in source coords, relative to - segment draw position (top-left) - @param vfEntireHt - for each of the above rectangles, true if the rect should be - extended to include the entire line - @param fJustComponent - true if we want to highlight just the single ligature component - this character maps to; false if the entire ligature is selected - @param rgfHighlighted - for each glyph in this segment, whether it is being highlighted - by this operation - @param fSkipTrSpace - should we skip trailing white space? -----------------------------------------------------------------------------------------------*/ -void SegmentPainter::CalcHighlightRect(int ichw, - std::vector & vrs, std::vector & vfEntireHt, - bool fJustComponent, bool * rgfHighlighted, bool fSkipTrSpace) -{ - GrResult res; - - GrEngine * pgreng = m_pseg->EngineImpl(); - GrGlyphTable * pgtbl = (pgreng) ? pgreng->GlyphTable() : NULL; - //bool fRtl = m_pseg->rightToLeft(); - - Font & font = m_pseg->getFont(); - - if (!GrCharStream::AtUnicodeCharBoundary(m_pseg->GetString(), ichw)) - // Second half of a surrogate pair, or UTF-8: ignore. - return; - - // Calculate the location for the glyph that this IP is before. - - int ichwSegOffset = ichw - m_pseg->m_ichwMin; - int isloutLig; - if (ichwSegOffset < m_pseg->m_ichwAssocsMin || ichwSegOffset >= m_pseg->m_ichwAssocsLim) - isloutLig = kNegInfinity; - else - isloutLig = m_pseg->m_prgisloutLigature[ichwSegOffset - m_pseg->m_ichwAssocsMin]; - bool fLigComp = (pgtbl && isloutLig != kNegInfinity); - if (fLigComp && fJustComponent) - { - // Character is a ligature component. - - GrSlotOutput * pslout = m_pseg->OutputSlot(isloutLig); - int icomp = m_pseg->m_prgiComponent[ichwSegOffset - m_pseg->m_ichwAssocsMin]; - int iginfOutput = m_pseg->LogicalToPhysicalSurface(isloutLig); - - float xsGlyphStart = m_pseg->GlyphLeftEdge(iginfOutput); - - float xsLeft, xsRight, ysTop, ysBottom; - - // TODO: Rework ComponentIndexForGlyph to take slati rather than iForGlyph. - int slati = pslout->ComponentId(icomp); - int iForGlyph = pgtbl->ComponentIndexForGlyph(pslout->GlyphID(), slati); - pgtbl->ComponentBoxLogUnits(m_pseg->m_xysEmSquare, pslout->GlyphID(), iForGlyph, - m_pseg->m_mFontEmUnits, m_pseg->m_dysAscent, - &xsLeft, &ysTop, &xsRight, &ysBottom); - - float dysFontAscent = m_pseg->m_dysFontAscent; - ////GetFontAscentSourceUnits(pgg, &dysFontAscent); - dysFontAscent += m_pseg->m_dysXAscent; - GlyphInfo * pginf = m_pseg->m_prgginf + iginfOutput; - float ysForGlyph = pginf->yOffset(); - float dysGlyphTop = (m_pseg->m_dysAscent - dysFontAscent) - ysForGlyph; // rel. to common baseline - - Rect rsNew; - rsNew.top = ysTop + dysGlyphTop; - rsNew.bottom = ysBottom + dysGlyphTop; - rsNew.left = xsGlyphStart + xsLeft; - rsNew.right = xsGlyphStart + xsRight; - vrs.push_back(rsNew); - - vfEntireHt.push_back(false); - } - else - { - std::vector vislout = m_pseg->UnderlyingToLogicalAssocs(ichw); - if (vislout.size() == 0) - return; - - float xsGlyphLeft, xsGlyphRight; - - res = kresOk; - - for (size_t iislout = 0; iislout < vislout.size(); iislout++) - { - int islout = vislout[iislout]; - if (islout == kNegInfinity || islout == kPosInfinity) - continue; - int iginfTmp = m_pseg->LogicalToPhysicalSurface(islout); - Assert(iginfTmp != kNegInfinity); - Assert(iginfTmp != kPosInfinity); - - if (fSkipTrSpace && islout >= m_pseg->m_isloutVisLim) - continue; - - Rect rsNew; - GrSlotOutput * psloutTmp = m_pseg->OutputSlot(islout); - bool fHighlightBB = psloutTmp->IsPartOfCluster(); - // Test below should match the one in CalcIP-- - // If the glyph has no advance width but does have a real bounding box, - // highlight the bounding box. Review: do we want this??? - if ((psloutTmp->ClusterAdvance() == 0 - || psloutTmp->GlyphMetricLogUnits(&font, kgmetAdvWidth) == 0) - && !psloutTmp->IsSpace()) - { - fHighlightBB = true; - } - xsGlyphLeft = m_pseg->GlyphLeftEdge(iginfTmp); - if (fHighlightBB) - { - // For now, highlight just the bounding box of this glyph. After we finish - // highlighting all glyphs individually, we'll go back and highlight - // as one unit any clusters that are completely selected. - -// int dysFontAscent; -// res = GetFontAscentSourceUnits(pgg, &dysFontAscent); // if we restore this code, add in ExtraAscent -// if (ResultFailed(res)) THROW(WARN(res)); -// dysFontAscent += m_dysXAscent; - - GlyphInfo * pginf = m_pseg->m_prgginf + iginfTmp; - float ysForGlyph = pginf->yOffset(); - float ysGlyphBaseline = m_pseg->m_dysAscent - ysForGlyph; // relative to top - - float ysBbTop = psloutTmp->GlyphMetricLogUnits(&font, kgmetBbTop); - float ysBbBottom = psloutTmp->GlyphMetricLogUnits(&font, kgmetBbBottom); - float xsBbLeft = psloutTmp->GlyphMetricLogUnits(&font, kgmetBbLeft); - float xsBbRight = psloutTmp->GlyphMetricLogUnits(&font, kgmetBbRight); - - rsNew.top = ysGlyphBaseline - ysBbTop - 2; - rsNew.bottom = ysGlyphBaseline - ysBbBottom + 2; - rsNew.left = xsGlyphLeft + xsBbLeft - 2; - rsNew.right = xsGlyphLeft + xsBbRight + 2; - - vfEntireHt.push_back(false); - } - else - { - // Highlight entire width of the glyph from the top of the line to the bottom. - // Horizontally, highlight from the origin of the glyph to the advance width. - - //xsGlyphRight = xsGlyphLeft + psloutTmp->GlyphMetricLogUnits(&font, kgmetAdvWidth); - xsGlyphRight = xsGlyphLeft + psloutTmp->ClusterAdvance(); - - if (xsGlyphLeft > xsGlyphRight) - std::swap(xsGlyphLeft, xsGlyphRight); - - rsNew.top = 0; - rsNew.bottom = m_pseg->m_dysHeight; - rsNew.left = xsGlyphLeft; - rsNew.right = xsGlyphRight; - - vfEntireHt.push_back(true); - } - vrs.push_back(rsNew); - - if (rgfHighlighted) - rgfHighlighted[iginfTmp] = true; - } - } -} - -/*---------------------------------------------------------------------------------------------- - If the output slot is a cluster base and all the members of the cluster are highlighted, - simply highlight the cluster as a single rectangle, to avoid unslightly gaps - between glyphs. (Note that this does not remove the rectangles that were already included - to handle the individual members.) - The rectangles are relative to the top left of the segment. - - @param islout - output slot index - @param vrect - list of rectangles to highlight; add result here - @param prgfHighlighted - flags indicating which glyphs have been highlighted, indexed by - physical surface position -----------------------------------------------------------------------------------------------*/ -void SegmentPainter::CalcCompleteCluster(int islout, - std::vector & vrs, std::vector & vfEntireHt, bool * prgfHighlighted) -{ - //GrEngine * pgreng = m_pseg->EngineImpl(); - - GrSlotOutput * pslout = m_pseg->OutputSlot(islout); - if (pslout->ClusterRange() == 0) - return; - - int iginfDraw = m_pseg->LogicalToPhysicalSurface(islout); - if (!prgfHighlighted[iginfDraw]) - return; - - bool fAllHighlighted = true; - - std::vector visloutCluster; - m_pseg->ClusterMembersForGlyph(islout, pslout->ClusterRange(), visloutCluster); - for (size_t i = 0; i < visloutCluster.size(); i++) - { - int iginfMemberDraw = m_pseg->LogicalToPhysicalSurface(visloutCluster[i]); - if (!prgfHighlighted[iginfMemberDraw]) - { - fAllHighlighted = false; - break; - } - } - - if (!fAllHighlighted) - return; - - // All the members of this cluster are highlighted. - - float xsGlyphStart = m_pseg->GlyphLeftEdge(iginfDraw); - - Rect rsNew; - rsNew.top = 0; - rsNew.bottom = m_pseg->m_dysHeight; - rsNew.left = xsGlyphStart + pslout->ClusterXOffset(); - rsNew.right = xsGlyphStart + pslout->ClusterAdvance(); - vrs.push_back(rsNew); - - vfEntireHt.push_back(true); -} - -/*---------------------------------------------------------------------------------------------- - Add the given rectangle to the vector, eliminating any overlapping areas. - - Note this method can be recursive: if we have to break the current rectangle into - two, we'll call the method again the for new -----------------------------------------------------------------------------------------------*/ -void SegmentPainter::AddRectWithoutOverlaps(std::vector & vrect, Rect rectToAdd) -{ - std::vector vrectMoreToAdd; - - bool fAnythingToAdd = AnyArea(&rectToAdd); - - size_t irect; - for (irect = 0; irect < vrect.size(); irect++) - { - bool f = AdjustRectsToNotOverlap(vrect, irect, &rectToAdd, vrectMoreToAdd); - if (!AnyArea(&vrect[irect])) - { - vrect.erase(vrect.begin() + irect); - irect--; - } - if (!f) - { - fAnythingToAdd = false; - break; - } - } - - // Now rectToAdd is in a state that it does not intersect with any other rectangles - // in the list. - - if (fAnythingToAdd) - vrect.push_back(rectToAdd); - - // Add in any extra rectangles that are needed to handle overlaps. - - for (irect = 0; irect < vrectMoreToAdd.size(); irect++) - AddRectWithoutOverlaps(vrect, vrectMoreToAdd[irect]); -} - -/*---------------------------------------------------------------------------------------------- - Return true if the rectangle has an area greater than 0. -----------------------------------------------------------------------------------------------*/ -bool SegmentPainter::AnyArea(Rect * prect) -{ - Assert(prect->left <= prect->right); - Assert(prect->top <= prect->bottom); - - return (prect->left < prect->right && prect->top < prect->bottom); -} - -/*---------------------------------------------------------------------------------------------- - Adjust the rectangle prect2 to avoid overlaps with the given one in the vector. - Return false if the rectangle does not need to be added after all. - - If we have to split this rectangle into two, add the second one to vrectMoreToAdd, so - we can do the same process on it. - - If we can merge the two rectangles, add the result to vrectMoreToAdd (so it can be properly - checked for further overlaps), and adjust the rectangle in the vector so it will be - deleted. - - @param vrect - current list of valid rectangles - @param irect - item in vrect we're comparing with prect2 - @param prect2 - rectangle to add - @param vrectMoreToAdd - list of accumulated rectangles that need to be added - (caused by splitting one into two) - - @return True if we want to add prect2 (possibly adjusted) to the list; - false it it is completely subsumed by vrect[irect], or has been merged with it, - or has no area. -----------------------------------------------------------------------------------------------*/ -bool SegmentPainter::AdjustRectsToNotOverlap(std::vector & vrect, int irect, Rect * prect2, - std::vector & vrectMoreToAdd) -{ - Rect * prect1 = &(vrect[irect]); - - float xLeft1 = prect1->left; - float xRight1 = prect1->right; - float yTop1 = prect1->top; - float yBottom1 = prect1->bottom; - Assert(xLeft1 < xRight1); - Assert(yTop1 < yBottom1); - - float xLeft2 = prect2->left; - float xRight2 = prect2->right; - float yTop2 = prect2->top; - float yBottom2 = prect2->bottom; - Assert(xLeft2 <= xRight2); - Assert(yTop2 <= yBottom2); - - if (!AnyArea(prect2)) - return false; - - // No overlap: keep both as they are. - if (yBottom2 < yTop1 || yBottom1 < yTop2) - return true; - if (xRight2 < xLeft1 || xRight1 < xLeft2) - return true; - - // Present rect subsumes new: ignore new - if (xLeft1 <= xLeft2 && xRight2 <= xRight1 && yTop1 <= yTop2 && yBottom2 <= yBottom1) - return false; - - // New rect subsumes present: replace. - if (xLeft2 <= xLeft1 && xRight1 <= xRight2 && yTop2 <= yTop1 && yBottom1 <= yBottom2) - { - prect1->bottom = prect1->top; // delete - return true; // keep this one - } - - // Abutting rectangles of same height or width: merge. - if (yTop1 == yTop2 && yBottom1 == yBottom2) - { - if (xRight1 == xLeft2) - { - // prect2 is to the right - prect2->left = prect1->left; - vrectMoreToAdd.push_back(*prect2); - prect1->bottom = prect1->top; // delete previous - return false; - } - else if (xRight2 == xLeft1) - { - // prect2 is to the left - prect2->right = prect1->right; - vrectMoreToAdd.push_back(*prect2); - prect1->bottom = prect1->top; // delete - return false; - } - } - if (xLeft1 == xLeft2 && xRight1 == xRight2) - { - if (yBottom1 == yTop2) - { - // prect2 is below - prect2->top = prect1->top; - vrectMoreToAdd.push_back(*prect2); - prect1->bottom = prect1->top; // delete - return false; - } - else if (yBottom2 == yTop1) - { - // prect2 is above - prect2->bottom = prect1->bottom; - vrectMoreToAdd.push_back(*prect2); - prect1->bottom = prect1->top; // delete - return false; - } - } - - // Abutting rectangles of different heights or widths: leave as they are. - if (xRight1 == xLeft2 || xRight2 == xLeft1) - return true; - if (yBottom1 == yTop2 || yBottom2 == yTop1) - return true; - - // Overlapping on one axis: adjust smaller rectangle - if (yTop1 <= yTop2 && yBottom2 <= yBottom1) - { - if (xLeft1 <= xLeft2 && xLeft2 < xRight1) - { - Assert(xRight1 < xRight2); // otherwise rect2 is subsumed - prect2->left = prect1->right; - return true; - } - else if (xLeft1 < xRight2 && xRight2 <= xRight1) - { - Assert(xLeft2 < xLeft1); // otherwise rect2 is subsumed - prect2->right = prect1->left; - return true; - } - } - else if (yTop2 <= yTop1 && yBottom1 <= yBottom2) - { - if (xLeft2 <= xLeft1 && xLeft1 < xRight2) - { - Assert(xRight2 < xRight1); // otherwise rect1 is subsumed - prect1->left = prect2->right; - return true; - } - else if (xLeft2 < xRight1 && xRight1 <= xRight2) - { - Assert(xLeft1 < xLeft2); // otherwise rect1 is subsumed - prect1->right = prect2->left; - return true; - } - } - - if (xLeft1 <= xLeft2 && xRight2 <= xRight1) - { - if (yTop1 <= yTop2 && yTop2 < yBottom1) - { - Assert(yBottom1 < yBottom2); // otherwise rect2 is subsumed - prect2->top = prect1->bottom; - return true; - } - else if (yTop1 < yBottom2 && yBottom2 <= yBottom1) - { - Assert(yTop2 < yTop1); // otherwise rect2 is subsumed - prect2->bottom = prect1->top; - return true; - } - } - else if (xLeft2 <= xLeft1 && xRight1 <= xRight2) - { - if (yTop2 <= yTop1 && yTop1 < yBottom2) - { - Assert(yBottom2 < yBottom1); // otherwise rect1 is subsumed - prect1->top = prect2->bottom; - return true; - } - else if (yTop2 < yBottom1 && yBottom1 <= yBottom2) - { - Assert(yTop1 < yTop2); // otherwise rect1 is subsumed - prect1->bottom = prect2->top; - return true; - } - } - - // Centers overlap: break prect2 into two disjoint rectangles. - if (xLeft1 < xLeft2 && xRight2 < xRight1 && yTop2 < yTop1 && yBottom1 < yBottom2) - { - // create a new rectangle for the bottom of prect2 that is below prect1 - Rect rectNew = *prect2; - rectNew.top = prect1->bottom; - prect2->bottom = prect1->top; - vrectMoreToAdd.push_back(rectNew); - return true; - } - else if (xLeft2 < xLeft1 && xRight1 < xRight2 && yTop1 < yTop2 && yBottom2 < yBottom1) - { - // create a new rectangle for the right of prect2 that is to the right of prect1 - Rect rectNew = *prect2; - rectNew.left = prect1->right; - prect2->right = prect1->left; - vrectMoreToAdd.push_back(rectNew); - return true; - } - - // Corners overlap: break prect2 into two adjacent rectangles. - if (xLeft1 < xLeft2 && xRight1 < xRight2) - { - // prect2 is partially to the right - if (yTop1 < yTop2 && yBottom1 < yBottom2) - { - // prect2 is partially below - Rect rectNew = *prect2; - rectNew.left = prect1->right; - prect2->top = prect1->bottom; - vrectMoreToAdd.push_back(rectNew); - return true; - } - else if (yTop2 < yTop1 && yBottom2 < yBottom1) - { - // prect2 is partially above - Rect rectNew = *prect2; - rectNew.left = prect1->right; - prect2->bottom = prect1->top; - vrectMoreToAdd.push_back(rectNew); - return true; - } - } - else if (xLeft2 < xLeft1 && xRight2 < xRight1) - { - // prect2 is partially to the left - if (yTop1 < yTop2 && yBottom1 < yBottom2) - { - // prect2 is partially below - Rect rectNew = *prect2; - rectNew.right = prect1->left; - prect2->top = prect1->bottom; - vrectMoreToAdd.push_back(rectNew); - return true; - } - else if (yTop2 < yTop1 && yBottom2 < yBottom1) - { - // prect2 is partially above - Rect rectNew = *prect2; - rectNew.right = prect1->left; - prect2->bottom = prect1->top; - vrectMoreToAdd.push_back(rectNew); - return true; - } - } - - // No overlap. - return true; -} - -/*---------------------------------------------------------------------------------------------- - Assert that there are no overlaps among all the rectangles in the array, which should - be the case if AdjustRectsToNotOverlap is working properly. -----------------------------------------------------------------------------------------------*/ -void SegmentPainter::AssertNoOverlaps(std::vector & vrect) -{ -#ifdef _DEBUG - for (int irect1 = 0; irect1 < signed(vrect.size() - 1); irect1++) - { - for (int irect2 = irect1 + 1; irect2 < signed(vrect.size()); irect2++) - { - float xLeft1 = vrect[irect1].left; - float xRight1 = vrect[irect1].right; - float yTop1 = vrect[irect1].top; - float yBottom1 = vrect[irect1].bottom; - Assert(xLeft1 < xRight1); - Assert(yTop1 < yBottom1); - - float xLeft2 = vrect[irect2].left; - float xRight2 = vrect[irect2].right; - float yTop2 = vrect[irect2].top; - float yBottom2 = vrect[irect2].bottom; - Assert(xLeft2 <= xRight2); - Assert(yTop2 <= yBottom2); - - Assert(xRight1 <= xLeft2 || xRight2 <= xLeft1 || - yBottom1 <= yTop2 || yBottom2 <= yTop1); - } - } -#endif -} - -/*---------------------------------------------------------------------------------------------- - Add the given line segment to the vector, eliminating any overlapping areas. -----------------------------------------------------------------------------------------------*/ -void SegmentPainter::AddLineSegWithoutOverlaps(std::vector & vls, LineSeg lsToAdd) -{ - std::vector vlsMoreToAdd; - - bool fAnythingToAdd = AnyLength(&lsToAdd); - - size_t ils; - for (ils = 0; ils < vls.size(); ils++) - { - bool f = AdjustLineSegsToNotOverlap(vls, ils, &lsToAdd, vlsMoreToAdd); - if (!AnyLength(&vls[ils])) - { - vls.erase(vls.begin() + ils); - ils--; - } - if (!f) - { - fAnythingToAdd = false; - break; - } - } - - // Now lsToAdd is in a state that it does not overlap with any other line segments - // in the list. - - if (fAnythingToAdd) - vls.push_back(lsToAdd); - - // Add in any extra line segments that are needed to handle overlaps. - - for (ils = 0; ils < vlsMoreToAdd.size(); ils++) - AddLineSegWithoutOverlaps(vls, vlsMoreToAdd[ils]); -} - -/*---------------------------------------------------------------------------------------------- - Return true if the rectangle has an area greater than 0. -----------------------------------------------------------------------------------------------*/ -bool SegmentPainter::AnyLength(LineSeg * pls) -{ - Assert(pls->left <= pls->right); - return (pls->left < pls->right); -} - -/*---------------------------------------------------------------------------------------------- - Adjust the line segment pls2 to avoid overlaps with the given one in the vector. - Return false if the line segment does not need to be added after all. - - If we can merge the two line segments, add the result to vrectMoreToAdd (so it can be properly - checked for further overlaps), and adjust the rectangle in the vector so it will be - deleted. - - @param vls - current list of valid line segments - @param ils - item in vrect we're comparing with pls2 - @param pls2 - line segment to add - @param vlsMoreToAdd - list of accumulated line segments that need to be added - (caused by splitting one into two) - - @return True if we want to add pls2 (possibly adjusted) to the list; - false it it is completely subsumed by vls[ils], or has been merged with it, - or has no length. -----------------------------------------------------------------------------------------------*/ -bool SegmentPainter::AdjustLineSegsToNotOverlap(std::vector & vls, int ils, LineSeg * pls2, - std::vector & vlsMoreToAdd) -{ - LineSeg * pls1 = &(vls[ils]); - - float xLeft1 = pls1->left; - float xRight1 = pls1->right; - Assert(xLeft1 < xRight1); - - float xLeft2 = pls2->left; - float xRight2 = pls2->right; - Assert(xLeft2 <= xRight2); - - if (!AnyLength(pls2)) - return false; - - // No overlap: keep both as they are. - if (xRight2 < xLeft1 || xRight1 < xLeft2) - return true; - - // Present line segment subsumes new: ignore new - if (xLeft1 <= xLeft2 && xRight2 <= xRight1) - return false; - - // New line segment subsumes present: replace. - if (xLeft2 <= xLeft1 && xRight1 <= xRight2) - { - pls1->left = pls1->right; // delete previous - return true; // keep this one - } - - // Adjacent or partially overlapping line segments: merge. - if (xLeft1 <= xLeft2 && xLeft2 <= xRight1 && xRight1 <= xRight2) - { - pls2->left = xLeft1; - vlsMoreToAdd.push_back(*pls2); - pls1->left = pls1->right; // delete previous - return false; - } - else if (xLeft2 <= xLeft1 && xLeft1 <= xRight2 && xRight2 <= xRight1) - { - pls2->right = xRight1; - vlsMoreToAdd.push_back(*pls2); - pls1->left = pls1->right; // delete previous - return false; - } - else - Assert(false); - - return true; -} - -/*---------------------------------------------------------------------------------------------- - Assert that there are no overlaps among all the rectangles in the array, which should - be the case if AdjustRectsToNotOverlap is working properly. -----------------------------------------------------------------------------------------------*/ -void SegmentPainter::AssertNoOverlaps(std::vector & vls) -{ -#ifdef _DEBUG - for (int ils1 = 0; ils1 < (int)vls.size() - 1; ils1++) - { - for (int ils2 = ils1 + 1; ils2 < (int)vls.size(); ils2++) - { - float xLeft1 = vls[ils1].left; - float xRight1 = vls[ils1].right; - Assert(xLeft1 < xRight1); - - float xLeft2 = vls[ils2].left; - float xRight2 = vls[ils2].right; - Assert(xLeft2 <= xRight2); - - Assert(xRight1 <= xLeft2 || xRight2 <= xLeft1); - } - } -#endif -} - -/*---------------------------------------------------------------------------------------------- - Find the next physical location for the IP. Return true if we found one. - - @param pichw - current insertion point, and adjusted result to return - @param pfAssocPrev - is the IP "leaning" backwards? adjust to return - @param fRight - true if we are moving right - @param fAssocPrevMatch - the assoc-prev of the result must match the original selection. - This is used when extending range selections; the orientation - of the resulting end-point must be the same as previously. - This helps avoids circular loops when dealing with reordering. - @param fAssocPrevNeeded - value needed for result; ignored if fAssocPrevMatch == false - @param pnNextOrPrevSeg - return 1 if we need to try the following segment, -1 if we - need to try the previous - CURRENTLY NOT USED for anything - practical -----------------------------------------------------------------------------------------------*/ -bool SegmentPainter::ArrowKeyPositionInternal( - int * pichw, bool * pfAssocPrev, - bool fRight, bool fAssocPrevMatch, bool fAssocPrevNeeded, int * pnNextOrPrevSeg) -{ - int kBefore = true; - int kAfter = false; - - bool fResult = false; - - // Handle ligatures. - - fResult = AdjacentLigComponent(pichw, pfAssocPrev, fRight, true); - if (fResult) - return true; - - // Not within a ligature, or on the outside edge of one. - - int iginfStart; - bool fCharRtl; - if (*pfAssocPrev) - { - iginfStart = m_pseg->UnderlyingToPhysicalSurface(*pichw - 1, kAfter); - fCharRtl = m_pseg->CharIsRightToLeft(*pichw - 1, kAfter); - } - else - { - iginfStart = m_pseg->UnderlyingToPhysicalSurface(*pichw, kBefore); - fCharRtl = m_pseg->CharIsRightToLeft(*pichw, kBefore); - } - if (kNegInfinity == iginfStart || kPosInfinity == iginfStart) - { - *pnNextOrPrevSeg = 0; - return false; - } - - //if (*pfAssocPrev) - // fCharRtl ? iginfStart : iginfStart++; - //else - // fCharRtl ? iginfStart++ : iginfStart; - - if (*pfAssocPrev) - iginfStart++; - - // At this point iginfStart indicates the index of the glyph we are before. - - int ichwNewIndex; - bool fAPNew; - - bool fRtl = m_pseg->rightToLeft(); - bool fForward = (fRtl) ? !fRight : fRight; - int dir = (fForward) ? 1 : -1; - int diginf = 0; - - // When moving forward, we first move to the opposite side of the current glyph, - // so initially diginf should be zero. - if (fForward) - diginf = -1; - - while (true) - { - diginf++; - int iginfTry = iginfStart + (dir * diginf); - - if (iginfTry < 0) - { - *pnNextOrPrevSeg = -1; - return false; - } - if (iginfTry > m_pseg->m_cginf) - { - *pnNextOrPrevSeg = 1; - return false; - } - if (iginfTry == m_pseg->m_cginf && fForward) - { - *pnNextOrPrevSeg = 1; - return false; - } - - bool fAfter; - int ichwTryChar; - if (iginfTry == m_pseg->m_cginf) - { - ichwTryChar = m_pseg->PhysicalSurfaceToUnderlying(iginfTry - 1, - kPosInfFloat, kPosInfFloat, 0, 0, &fAfter); - } - else - { - ichwTryChar = m_pseg->PhysicalSurfaceToUnderlying(iginfTry, - (fRight) ? kPosInfFloat : kNegInfFloat, - (fRight) ? kPosInfFloat : kNegInfFloat, - 0, 0, &fAfter); - } - - if (fAfter) - { - ichwNewIndex = ichwTryChar + 1; - fAPNew = true; - } - else - { - ichwNewIndex = ichwTryChar; - fAPNew = false; - } - - if (ichwNewIndex == *pichw) - continue; // didn't make any progress - - LgIpValidResult ipvr = isValidInsertionPoint(ichwNewIndex); - if (ipvr == kipvrBad) - continue; // bad insertion point - - if (fAssocPrevMatch && (fAssocPrevNeeded != fAPNew)) - { - // Try switching fAPNew and see if that gives the right result - bool fAPAlt = !fAPNew; - int iginfAlt = m_pseg->UnderlyingToPhysicalSurface( - fAPAlt ? ichwTryChar - 1 : ichwTryChar + 1, - fAPAlt ? kAfter : kBefore); - fCharRtl = m_pseg->CharIsRightToLeft( - fAPAlt ? ichwTryChar - 1 : ichwTryChar + 1, - fAPAlt ? kAfter : kBefore); - - if (fAPAlt) - fCharRtl ? iginfAlt : iginfAlt++; - else - fCharRtl ? iginfAlt++ : iginfAlt; - - if ((fForward && iginfAlt <= iginfStart) - || (!fForward && iginfAlt >= iginfStart)) - { - // Switching fAPNew would cause us to move in the opposite direction, so - // that's not a good solution. Keep going. - if ((iginfStart == 0 && !fForward) || (iginfStart == m_pseg->m_cginf && fForward)) - { - // Can't go any further, so go with this even though AP is wrong. - } - else - continue; - } - fAPNew = fAPAlt; - } - break; - } - - // If we have a selection within a ligature, adjust to either the right-most or the - // left-most. - AdjacentLigComponent(&ichwNewIndex, &fAPNew, fRight, false); - - *pichw = ichwNewIndex; - *pfAssocPrev = fAPNew; - return true; -} - -/****** OLD VERSION -bool Segment::ArrowKeyPositionInternal( - int * pichw, bool * pfAssocPrev, - bool fRight, bool fAssocPrevMatch, bool fAssocPrevNeeded, int * pnNextOrPrevSeg) -{ - int kBefore = true; - int kAfter = false; - - bool fResult = false; - - // Handle ligatures. - - fResult = AdjacentLigComponent(pichw, pfAssocPrev, fRight, true); - if (fResult) - return true; - - // Not within a ligature, or on the outside edge of one. - - int igbbOutput; - bool fCharRtl; - if (*pfAssocPrev) - { - igbbOutput = UnderlyingToPhysicalSurface(*pichw - 1, kAfter); - fCharRtl = CharIsRightToLeft(*pichw - 1, kAfter); - } - else - { - igbbOutput = UnderlyingToPhysicalSurface(*pichw, kBefore); - fCharRtl = CharIsRightToLeft(*pichw, kBefore); - } - if (kNegInfinity == igbbOutput || kPosInfinity == igbbOutput) - { - *pnNextOrPrevSeg = 0; - return false; - } - - if (*pfAssocPrev) - fCharRtl ? igbbOutput : igbbOutput++; - else - fCharRtl ? igbbOutput++ : igbbOutput; - - bool fBackward = (fRight == m_fWsRtl); - - // Try to find an underlying position that would produce an IP in the expected place. - // First look in the same direction in the underlying text, then, if necessary, try the - // opposite direction (which may be necessary when reordering occurred). - - int igbbNeed = (fRight) ? igbbOutput + 1 : igbbOutput - 1; - int ichwNew; - bool fAssocPrevNew; - - while (0 <= igbbNeed && igbbNeed <= NumGbb()) // include end-points--we may need to - // be before or after them. - { - int dichwInc = fBackward ? -1 : 1; - int dichwLim = m_ichwMin + (fBackward ? 0 : m_dichwLim); - - int nDirectionsTried = 0; -// while (nDirectionsTried < 2) -- Nope, for now we are being very strict above moving - while (nDirectionsTried < 1) // only in the desired direction - { - for (int ichwTry = *pichw; - ((dichwInc == 1 && ichwTry <= dichwLim) || - (dichwInc == -1 && ichwTry >= dichwLim)); - ichwTry += dichwInc) - { - int igbbTry = UnderlyingToPhysicalSurface(ichwTry, kBefore); - fCharRtl = CharIsRightToLeft(ichwTry, kBefore); - igbbTry = fCharRtl ? igbbTry + 1 : igbbTry; - if (igbbTry == igbbNeed && - (ichwTry != *pichw || *pfAssocPrev) && - (!fAssocPrevMatch || !fAssocPrevNeeded)) - { - ichwNew = ichwTry; - fAssocPrevNew = false; - goto LFixLigatures; - } - - igbbTry = UnderlyingToPhysicalSurface(ichwTry - 1, kAfter); - fCharRtl = CharIsRightToLeft(ichwTry - 1, kAfter); - igbbTry = fCharRtl ? igbbTry : igbbTry + 1; - if (igbbTry == igbbNeed && - (ichwTry != *pichw || !*pfAssocPrev) && - (!fAssocPrevMatch || fAssocPrevNeeded)) - { - ichwNew = ichwTry; - fAssocPrevNew = true; - goto LFixLigatures; - } - } - - nDirectionsTried++; - - // Didn't find an answer going the expected way; try the opposite direction. - dichwInc = (fRight) ? -1 : 1; - dichwLim = m_ichwMin + ((fRight) ? 0 : m_dichwLim); - } - - // Didn't find an underlying position that would produce an IP in the next glyph; - // try the glyph after that. - - igbbNeed = (fRight) ? igbbNeed + 1 : igbbNeed - 1; - } - - if (igbbNeed >= NumGbb()) - *pnNextOrPrevSeg = 1; // try next segment - else if (igbbNeed < 0) - *pnNextOrPrevSeg = -1; // try previous segment - else - { - Assert(false); - *pnNextOrPrevSeg = 0; - } - - return false; - -LFixLigatures: - - // If we have a selection within a ligature, adjust to either the right-most or the - // left-most. - AdjacentLigComponent(&ichwNew, &fAssocPrevNew, fRight, false); - - *pichw = ichwNew; - *pfAssocPrev = fAssocPrevNew; - return true; -} -******************/ - -/*---------------------------------------------------------------------------------------------- - Return position for the physically next or previous ligature component, or the right-most - or left-most. Return true if this routine handled it. - - @param pichw - starting underlying position - @param pfAssocPrev - is selection leaning backwards? - @param fMovingRight - true if right arrow key was pressed, false if left - @param fMove - if true, we want to find the next one over from *pichw; - if false, we want to find either the right-most - (fMovingRight = false) - or the left-most (fMovingRight = true) -----------------------------------------------------------------------------------------------*/ -bool SegmentPainter::AdjacentLigComponent(int * pichw, bool * pfAssocPrev, - bool fMovingRight, bool fMove) -{ - int kBefore = true; - int kAfter = false; - - GrEngine * pgreng = m_pseg->EngineImpl(); - GrGlyphTable * pgtbl = (pgreng) ? pgreng->GlyphTable() : NULL; - - if (!pgtbl) - { - return false; - } - - // Find the slot containing the ligature glyph. - - int ichwSegOffset = *pichw - m_pseg->m_ichwMin; - int isloutLig = kNegInfinity; - if (*pfAssocPrev) - { - if (ichwSegOffset - 1 >= m_pseg->m_ichwAssocsMin && ichwSegOffset - 1 < m_pseg->m_ichwAssocsLim) - isloutLig = m_pseg->m_prgisloutLigature[ichwSegOffset - 1 - m_pseg->m_ichwAssocsMin]; - } - else - { - if (ichwSegOffset >= m_pseg->m_ichwAssocsMin && ichwSegOffset < m_pseg->m_ichwAssocsLim) - isloutLig = m_pseg->m_prgisloutLigature[ichwSegOffset - m_pseg->m_ichwAssocsMin]; - } - - if (isloutLig == kNegInfinity) - { - return false; - } - - if (*pfAssocPrev) - ichwSegOffset--; - - bool fGlyphRtl = (*pfAssocPrev) ? - m_pseg->CharIsRightToLeft(*pichw - 1, kAfter) : - m_pseg->CharIsRightToLeft(*pichw, kBefore); - - // Comparing right-sides. - bool fIPOnRight = (fGlyphRtl != *pfAssocPrev); - - // When two ligatures are horizontally equal, take vertical position into account. - // In left-to-right writing systems, moving right means moving down. - bool fMovingDown = (fMovingRight != m_pseg->m_fWsRtl); - - // Get the coordinates for all the ligatures. - - std::vector vysTops; - std::vector vysBottoms; - std::vector vxsLefts; - std::vector vxsRights; - - float ysTopCurr, ysBottomCurr, xsLeftCurr, xsRightCurr; - int icompCurr = -1; - if (fMovingRight) - ysTopCurr = ysBottomCurr = xsLeftCurr = xsRightCurr = kNegInfFloat; - else - ysTopCurr = ysBottomCurr = xsLeftCurr = xsRightCurr = kPosInfFloat; - - GrSlotOutput * pslout = m_pseg->OutputSlot(isloutLig); - //int iginfOutput = m_pseg->LogicalToPhysicalSurface(isloutLig); - - int icomp; - for (icomp = 0; icomp < pslout->NumberOfComponents(); icomp++) - { - float xsLeft, ysTop, xsRight, ysBottom; - - // TODO: Rework ComponentIndexForGlyph to take slati rather than iForGlyph. - int slati = pslout->ComponentId(icomp); - int iForGlyph = pgtbl->ComponentIndexForGlyph(pslout->GlyphID(), slati); - pgtbl->ComponentBoxLogUnits(m_pseg->m_xysEmSquare, pslout->GlyphID(), iForGlyph, - m_pseg->m_mFontEmUnits, m_pseg->m_dysAscent, - &xsLeft, &ysTop, &xsRight, &ysBottom); - - vysTops.push_back(ysTop); - vysBottoms.push_back(ysBottom); - vxsLefts.push_back(xsLeft); - vxsRights.push_back(xsRight); - - // If we're moving, record this component as the one we're moving relative to. - if (fMove && icomp == m_pseg->m_prgiComponent[ichwSegOffset - m_pseg->m_ichwAssocsMin]) - { - icompCurr = icomp; - ysTopCurr = ysTop; - ysBottomCurr = ysBottom; - xsLeftCurr = xsLeft; - xsRightCurr = xsRight; - } - } - - float xsHorizCurr = (fIPOnRight) ? xsRightCurr : xsLeftCurr; - float xsHorizNext; - - // Find the first ligature that is in the proper direction. - int icompNext; - for (icompNext = 0; icompNext < pslout->NumberOfComponents(); icompNext++) - { - if (icompNext != icompCurr) - { - float xsHorizNext = (fIPOnRight) ? vxsRights[icompNext] : vxsLefts[icompNext]; - if (fMovingRight && xsHorizNext > xsHorizCurr) - break; - else if (!fMovingRight && xsHorizNext < xsHorizCurr) - break; - } - } - if (icompNext == pslout->NumberOfComponents()) - { - bool fResult; - // No component in the proper direction. Can we switch to the opposite edge of the - // current component? - if (fMovingRight && !fIPOnRight) - { - if (fGlyphRtl) - --(*pichw); - else - ++(*pichw); - *pfAssocPrev = !*pfAssocPrev; - fResult = true; - } - else if (!fMovingRight && fIPOnRight) - { - if (fGlyphRtl) - ++(*pichw); - else - --(*pichw); - - *pfAssocPrev = !*pfAssocPrev; - fResult = true; - } - else - fResult = false; - return fResult; - } - - xsHorizNext = (fIPOnRight) ? vxsRights[icompNext] : vxsLefts[icompNext]; - - // Now find the closest one in the proper direction. - for (icomp = icompNext + 1; icomp < pslout->NumberOfComponents(); icomp++) - { - if (icomp != icompCurr) - { - float xsHorizTry = (fIPOnRight) ? vxsRights[icomp] : vxsLefts[icomp]; - - if (fMovingRight && xsHorizTry > xsHorizCurr && - (xsHorizTry < xsHorizNext || - (xsHorizTry == xsHorizNext && - (vysTops[icomp] > vysTops[icompNext]) == fMovingDown))) - { - icompNext = icomp; - xsHorizNext = xsHorizTry; - } - else if (!fMovingRight && xsHorizTry < xsHorizCurr && - (xsHorizTry > xsHorizNext || - (xsHorizTry == xsHorizNext && - (vysTops[icomp] > vysTops[icompNext]) == fMovingDown))) - { - icompNext = icomp; - xsHorizNext = xsHorizTry; - } - } - } - - *pichw = pslout->FirstUnderlyingComponent(icompNext) + m_pseg->m_ichwMin; // TODO: handle multiple components per ligature - if (*pfAssocPrev) - ++(*pichw); - - return true; -} - -/*---------------------------------------------------------------------------------------------- - Scale the x-coordinate by the scaling factors for this painter. -----------------------------------------------------------------------------------------------*/ -float SegmentPainter::ScaleX(float xs, Rect rs, Rect rd) -{ - //return rs.MapXTo(xs, rd); - - float dxs = rs.right - rs.left; - float dxd = rd.right - rd.left; - Assert(dxs > 0); - if (dxs == dxd) - return xs + rd.left - rs.left; - - float xd = rd.left + GrEngine::GrFloatMulDiv((xs - rs.left), dxd, dxs); - return xd; -} - -/*---------------------------------------------------------------------------------------------- - Scale the y-coordinate by the scaling factors for this painter. -----------------------------------------------------------------------------------------------*/ -float SegmentPainter::ScaleY(float ys, Rect rs, Rect rd) -{ - //return rs.MapYTo(ys, rd); - - float dys = rs.bottom - rs.top; - float dyd = rd.bottom - rd.top; - Assert(dys > 0); - if (dys == dyd) - return ys + rd.top - rs.top; - float yd = rd.top + GrEngine::GrFloatMulDiv((ys - rs.top), dyd, dys); - return yd; -} - - -//:>******************************************************************************************** -//:> Low-level platform-specific drawing methods -//:>******************************************************************************************** - -/*---------------------------------------------------------------------------------------------- - Make sure the font is set to use the character properties required by this segment. -----------------------------------------------------------------------------------------------*/ -void SegmentPainter::SetFontProps(unsigned long clrFore, unsigned long clrBack) -{ - return; -} - -} // namespace gr diff --git a/Build/source/libs/graphite/engine-2.3.1/src/segment/FileInput.cpp b/Build/source/libs/graphite/engine-2.3.1/src/segment/FileInput.cpp deleted file mode 100644 index 69be6b408c3..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/src/segment/FileInput.cpp +++ /dev/null @@ -1,266 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 1999, 2001 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: FileInput.cpp -Responsibility: Sharon Correll -Last reviewed: Not yet. - -Description: - Contains the functions for reading from a TT file. (These are functions, not methods - associated with a class.) -----------------------------------------------------------------------------------------------*/ - -//:>******************************************************************************************** -//:> Include files -//:>******************************************************************************************** - -#include "GrCommon.h" -#include "GrData.h" -#ifndef _WIN32 -#include "GrMstypes.h" -#endif -#include "GrDebug.h" -#include -#include -#include -#include "FileInput.h" -#include "GrResult.h" - -//#ifndef _MSC_VER -//#include "config.h" -//#endif - -#ifdef _MSC_VER -#pragma hdrstop -#endif -#undef THIS_FILE -DEFINE_THIS_FILE - -//:End Ignore - -//:>******************************************************************************************** -//:> Forward declarations -//:>******************************************************************************************** - -//:>******************************************************************************************** -//:> Local Constants and static variables -//:>******************************************************************************************** - -namespace gr -{ - -//:>******************************************************************************************** -//:> Methods of GrBufferIStream -//:>******************************************************************************************** - -/*---------------------------------------------------------------------------------------------- - Constructor. -----------------------------------------------------------------------------------------------*/ -GrBufferIStream::GrBufferIStream() -{ - m_pbStart = NULL; - m_pbNext = NULL; - m_pbLim = NULL; -} - -/*---------------------------------------------------------------------------------------------- - Destructor. -----------------------------------------------------------------------------------------------*/ -GrBufferIStream::~GrBufferIStream() -{ - Close(); -} - -/*---------------------------------------------------------------------------------------------- - Initialize the stream. -----------------------------------------------------------------------------------------------*/ -#ifdef GR_FW -bool GrBufferIStream::Open(std::wstring stuFileName, int kMode) -#else -bool GrBufferIStream::Open(const char * pcFileName, std::ios::openmode kMode) -#endif -{ - Assert(false); // use OpenBuffer - return false; -} - -/*---------------------------------------------------------------------------------------------- - Initialize the stream to a buffer. -----------------------------------------------------------------------------------------------*/ -bool GrBufferIStream::OpenBuffer(const byte * pbBuffer, int cb) -{ - Assert(m_pbStart == NULL); - Assert(m_pbNext == NULL); - Assert(m_pbLim == NULL); - - m_pbStart = pbBuffer; - m_pbNext = pbBuffer; - if (cb > 0) - m_pbLim = m_pbStart + cb; - // otherwise we don't know the length - - return true; -} - -/*---------------------------------------------------------------------------------------------- - Close the stream. -----------------------------------------------------------------------------------------------*/ -void GrBufferIStream::Close() -{ - m_pbStart = NULL; - m_pbNext = NULL; - m_pbLim = NULL; -} - -/*---------------------------------------------------------------------------------------------- - Read a byte from the stream. -----------------------------------------------------------------------------------------------*/ -byte GrBufferIStream::ReadByteFromFont() -{ - byte bInput = *m_pbNext; - m_pbNext += isizeof(byte); - if (m_pbLim && m_pbNext > m_pbLim) - THROW(kresReadFault); - return bInput; -} - -/*---------------------------------------------------------------------------------------------- - Read a short (signed 16-bit) word from the stream. Switch the bytes from big-endian - to little-endian format. -----------------------------------------------------------------------------------------------*/ -short GrBufferIStream::ReadShortFromFont() -{ - short snInput = *(const short *)m_pbNext; - m_pbNext += isizeof(short); - if (m_pbLim && m_pbNext > m_pbLim) - THROW(kresReadFault); - snInput = lsbf(snInput); - return snInput; -} - -/*---------------------------------------------------------------------------------------------- - Read a wide character (unsigned 16-bit word) from the stream. - Switch the bytes from big-endian to little-endian format. -----------------------------------------------------------------------------------------------*/ -utf16 GrBufferIStream::ReadUShortFromFont() -{ - utf16 chwInput = *(const utf16 *)m_pbNext; - m_pbNext += isizeof(utf16); - if (m_pbLim && m_pbNext > m_pbLim) - THROW(kresReadFault); - chwInput = lsbf(chwInput); - return chwInput; -} - -/*---------------------------------------------------------------------------------------------- - Read a standard (32-bit) word from the stream. Switch the bytes from big-endian - to little-endian format. -----------------------------------------------------------------------------------------------*/ -int GrBufferIStream::ReadIntFromFont() -{ - int nInput = *(const int *)m_pbNext; - m_pbNext += isizeof(int); - if (m_pbLim && m_pbNext > m_pbLim) - THROW(kresReadFault); - nInput = lsbf(nInput); - return nInput; -} - -/*---------------------------------------------------------------------------------------------- - Read a block of data from the stream. DON'T switch the bytes from big-endian - to little-endian format. -----------------------------------------------------------------------------------------------*/ -void GrBufferIStream::ReadBlockFromFont(void * pvInput, int cb) -{ - std::copy(m_pbNext, m_pbNext + cb, reinterpret_cast(pvInput)); - m_pbNext += cb; - if (m_pbLim && m_pbNext > m_pbLim) - THROW(kresReadFault); -} - -/*---------------------------------------------------------------------------------------------- - Get the absolute position of the font-file stream (relative to the beginning of - the file). For buffers, we just return the byte position in the buffer. -----------------------------------------------------------------------------------------------*/ -void GrBufferIStream::GetPositionInFont(long * plPos) -{ - *plPos = (m_pbNext - m_pbStart); -} - -/*---------------------------------------------------------------------------------------------- - Set the position of the font-file stream to the given absolute position (relative - to the beginning of the file). For buffers, assume the position is relative to the - beginning of the buffer. -----------------------------------------------------------------------------------------------*/ -void GrBufferIStream::SetPositionInFont(long lPos) -{ - m_pbNext = m_pbStart + lPos; - if (m_pbLim && m_pbNext > m_pbLim) - THROW(kresReadFault); -} - - -//:>******************************************************************************************** -//:> Swap byte order. -//:>******************************************************************************************** -int swapb(int nArg) -{ -#if WORDS_BIGENDIAN -return nArg; -#else - int b1, b2, b3, b4; - b1 = ((nArg & 0xFF000000) >> 24) & 0x000000FF; // remove sign extension - b2 = ((nArg & 0x00FF0000) >> 8); // & 0x0000FF00; - b3 = ((nArg & 0x0000FF00) << 8); // & 0x00FF0000; - b4 = ((nArg & 0x000000FF) << 24); // & 0xFF000000; - int nRet = b1 | b2 | b3 | b4; - return nRet; -#endif -} - -unsigned int swapb(unsigned int nArg) -{ -#if WORDS_BIGENDIAN -return nArg; -#else - int b1, b2, b3, b4; - b1 = ((nArg & 0xFF000000) >> 24) & 0x000000FF; // remove sign extension - b2 = ((nArg & 0x00FF0000) >> 8); // & 0x0000FF00; - b3 = ((nArg & 0x0000FF00) << 8); // & 0x00FF0000; - b4 = ((nArg & 0x000000FF) << 24); // & 0xFF000000; - int nRet = b1 | b2 | b3 | b4; - return nRet; -#endif -} - -utf16 swapb(utf16 chwArg) -{ -#if WORDS_BIGENDIAN -return chwArg; -#else - utf16 b1, b2; - b1 = ((chwArg & 0xFF00) >> 8) & 0x00FF; // remove sign extension - b2 = ((chwArg & 0x00FF) << 8); // & 0xFF00; - utf16 chwRet = b1 | b2; - return chwRet; -#endif -} - -short swapb(short snArg) -{ -#if WORDS_BIGENDIAN -return snArg; -#else - short b1, b2; - b1 = ((snArg & 0xFF00) >> 8) & 0x00FF; // remove sign extension - b2 = ((snArg & 0x00FF) << 8); // & 0xFF00; - short snRet = b1 | b2; - return snRet; -#endif -} - -} //namespace gr - diff --git a/Build/source/libs/graphite/engine-2.3.1/src/segment/FileInput.h b/Build/source/libs/graphite/engine-2.3.1/src/segment/FileInput.h deleted file mode 100644 index 022206b06a4..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/src/segment/FileInput.h +++ /dev/null @@ -1,104 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 1999, 2001 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: FileInput.h -Responsibility: Sharon Correll -Last reviewed: not yet - -Description: - Defines utility functions for reading from a font file. -----------------------------------------------------------------------------------------------*/ - -#ifdef _MSC_VER -#pragma once -#endif -#ifndef FILEINPUT_INCLUDED -#define FILEINPUT_INCLUDED - -//:End Ignore - -namespace gr -{ - -int swapb(int nArg); -unsigned int swapb(unsigned int nArg); -utf16 swapb(utf16 chwArg); -short swapb(short snArg); - -// Most significant byte first (converting from least-sig-first): -inline int msbf(int nArg) { return swapb(nArg); } -inline unsigned int msbf(unsigned int nArg) { return swapb(nArg); } -inline utf16 msbf(utf16 chwArg) { return swapb(chwArg); } -inline short msbf(short chwArg) { return swapb(chwArg); } - -// Least significant byte first (converting from most-sig first): -inline int lsbf(int nArg) { return swapb(nArg); } -inline unsigned int lsbf(unsigned int nArg) { return swapb(nArg); }; -inline utf16 lsbf(utf16 chwArg) { return swapb(chwArg); } -inline short lsbf(short chwArg) { return swapb(chwArg); } - -class GrIStream -{ -public: - virtual void Close() = 0; - - virtual byte ReadByteFromFont() = 0; - virtual short ReadShortFromFont() = 0; - virtual utf16 ReadUShortFromFont() = 0; - virtual int ReadIntFromFont() = 0; - virtual void ReadBlockFromFont(void * pvInput, int cb) = 0; - - virtual void GetPositionInFont(long * plPos) = 0; - virtual void SetPositionInFont(long lPos) = 0; - - virtual bool OpenBuffer(const byte * pbBuffer, int cb) = 0; - virtual void CloseBuffer() = 0; - -protected: - virtual ~GrIStream() {} -}; - - -/*---------------------------------------------------------------------------------------------- - A stream that reads from a buffer rather than a file. -----------------------------------------------------------------------------------------------*/ -class GrBufferIStream : public GrIStream -{ -public: - GrBufferIStream(); - ~GrBufferIStream(); - - #ifdef GR_FW - virtual bool Open(std::wstring stuFileName, std::ios::openmode kMode); - #else - virtual bool Open(const char * pcFileName, std::ios::openmode kMode); - #endif - virtual void Close(); - - virtual byte ReadByteFromFont(); - virtual short ReadShortFromFont(); - virtual utf16 ReadUShortFromFont(); - virtual int ReadIntFromFont(); - virtual void ReadBlockFromFont(void * pvInput, int cb); - - virtual void GetPositionInFont(long * plPos); - virtual void SetPositionInFont(long lPos); - - virtual bool OpenBuffer(const byte * pbBuffer, int cb); - virtual void CloseBuffer() - { - Close(); - } - -protected: - const byte * m_pbStart; - const byte * m_pbNext; - const byte * m_pbLim; -}; - -} // namespace gr - -#endif // !FILEINPUT_INCLUDED diff --git a/Build/source/libs/graphite/engine-2.3.1/src/segment/FontCache.cpp b/Build/source/libs/graphite/engine-2.3.1/src/segment/FontCache.cpp deleted file mode 100644 index f0540463e3b..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/src/segment/FontCache.cpp +++ /dev/null @@ -1,308 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 1999, 2001 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: FontCache.cpp -Responsibility: Sharon Correll -Last reviewed: Not yet. - -Description: - A cache of all the font-face objects. -----------------------------------------------------------------------------------------------*/ - -//:>******************************************************************************************** -//:> Include files -//:>******************************************************************************************** -#include "Main.h" -#ifdef _MSC_VER -#pragma hdrstop -#endif -// any other headers (not precompiled) - -#undef THIS_FILE -DEFINE_THIS_FILE - -//:End Ignore - -//:>******************************************************************************************** -//:> Forward declarations -//:>******************************************************************************************** - -//:>******************************************************************************************** -//:> Local Constants and static variables -//:>******************************************************************************************** - -//:>******************************************************************************************** -//:> Methods -//:>******************************************************************************************** - -namespace gr -{ - -/*---------------------------------------------------------------------------------------------- - Store the given font-face in the cache. Overwrite whatever was there before. - Return NULL if there is nothing appropriate there. -----------------------------------------------------------------------------------------------*/ -void FontCache::GetFontFace(std::wstring strFaceName, bool fBold, bool fItalic, - FontFace ** ppfface) -{ - int ifci = FindCacheItem(strFaceName); - if (ifci < 0) // no fonts of that family present - { - *ppfface = NULL; - return; - } - - CacheItem * pfci = m_prgfci + ifci; - if (fBold) - { - if (fItalic) - *ppfface = pfci->pffaceBI; - else - *ppfface = pfci->pffaceBold; - } - else - { - if (fItalic) - *ppfface = pfci->pffaceItalic; - else - *ppfface = pfci->pffaceRegular; - } -} - -/*---------------------------------------------------------------------------------------------- - Store the given font-face in the cache. Overwrite whatever was there before. -----------------------------------------------------------------------------------------------*/ -void FontCache::CacheFontFace(std::wstring strFaceName, bool fBold, bool fItalic, - FontFace * pfface) -{ - if (m_prgfci == NULL) - Initialize(); - - int ifciIns = FindCacheItem(strFaceName); - int ifci = ifciIns; - if (ifciIns < 0) - { - ifci = (ifciIns + 1) * -1; - InsertCacheItem(ifci); - std::copy(strFaceName.c_str(), strFaceName.c_str() + - (strFaceName.size() + 1), m_prgfci[ifci].szFaceName); - } - - CacheItem * pfci = m_prgfci + ifci; - - bool fPrevNull; - if (fBold) - { - if (fItalic) - { - fPrevNull = (pfci->pffaceBI == NULL); - pfci->pffaceBI = pfface; - } - else - { - fPrevNull = (pfci->pffaceBold == NULL); - pfci->pffaceBold = pfface; - } - } - else - { - if (fItalic) - { - fPrevNull = (pfci->pffaceItalic == NULL); - pfci->pffaceItalic = pfface; - } - else - { - fPrevNull = (pfci->pffaceRegular == NULL); - pfci->pffaceRegular = pfface; - } - } - - if (fPrevNull && (pfface != NULL)) - m_cfface++; -} - -/*---------------------------------------------------------------------------------------------- - Remove the given font-face from the cache. Return false if it couldn't be found. -----------------------------------------------------------------------------------------------*/ -bool FontCache::RemoveFontFace(std::wstring strFaceName, bool fBold, bool fItalic, - bool fZapCache) -{ - int ifci = FindCacheItem(strFaceName); - if (ifci < 0) - { - return false; - } - - bool fPrevVal; - CacheItem * pfci = m_prgfci + ifci; - if (fBold) - { - if (fItalic) - { - fPrevVal = (pfci->pffaceBI != NULL); - pfci->pffaceBI = NULL; - } - else - { - fPrevVal = (pfci->pffaceBold != NULL); - pfci->pffaceBold = NULL; - } - } - else - { - if (fItalic) - { - fPrevVal = (pfci->pffaceItalic != NULL); - pfci->pffaceItalic = NULL; - } - else - { - fPrevVal = (pfci->pffaceRegular != NULL); - pfci->pffaceRegular = NULL; - } - } - - if (fPrevVal) - m_cfface--; - - Assert(m_cfface >= 0); - - if (m_flush == kflushAuto && fZapCache) - { - DeleteIfEmpty(); - } - - return fPrevVal; -} - -/*---------------------------------------------------------------------------------------------- - Search for the font-family in the cache and return its index. - If not present, return a negative number indicating where it was expected. -----------------------------------------------------------------------------------------------*/ -int FontCache::FindCacheItem(std::wstring strFaceName) -{ - if (m_cfci == 0) - return -1; - - Assert(m_prgfci); - - // Use a binary-chop search. - - int ifciLow = 0; - int ifciHigh = m_cfci; - while (true) - { - int ifciMid = (ifciHigh + ifciLow) >> 1; // divide by 2 - CacheItem * pfci = m_prgfci + ifciMid; - int tst = wcscmp(strFaceName.c_str(), (const wchar_t *)pfci->szFaceName); - if (tst == 0) - return ifciMid; // found it - if (ifciLow + 1 == ifciHigh) - { - // not there; return where expected: 0 -> -1, 1 -> -2 - Assert(ifciMid == ifciLow); - if (tst < 0) - return (ifciLow * -1) - 1; - else - return (ifciHigh * -1) - 1; - } - - // Keep looking. - if (tst < 0) - ifciHigh = ifciMid; - else - ifciLow = ifciMid; - } -} - -/*---------------------------------------------------------------------------------------------- - Insert space in the cache at location ifci. -----------------------------------------------------------------------------------------------*/ -void FontCache::InsertCacheItem(int ifci) -{ - if (m_cfci == m_cfciMax) - { - // Cache is full; double the space. - CacheItem * m_prgfciOld = m_prgfci; - m_prgfci = new CacheItem[m_cfciMax * 2]; - std::copy(m_prgfciOld, m_prgfciOld + m_cfciMax, m_prgfci); - delete[] m_prgfciOld; - m_cfciMax *= 2; - } - - // This copy involves overlapping ranges, so we need copy_backward not copy - // to satisfy the preconditions - std::copy_backward(m_prgfci + ifci, m_prgfci + m_cfci, m_prgfci + m_cfci + 1); - m_cfci++; - - // Initialize inserted item. - CacheItem * pfci = m_prgfci + ifci; - pfci->pffaceRegular = NULL; - pfci->pffaceBold = NULL; - pfci->pffaceItalic = NULL; - pfci->pffaceBI = NULL; -} - -/*---------------------------------------------------------------------------------------------- - Delete the cache if it is empty. -----------------------------------------------------------------------------------------------*/ -void FontCache::DeleteIfEmpty() -{ - if (m_cfface <= 0) - // All items are NULL; delete this cache. Probably this is because - // the program is exiting. - FontFace::ZapFontCache(); -} - -/*---------------------------------------------------------------------------------------------- - Check that the cache is indeed empty. -----------------------------------------------------------------------------------------------*/ -void FontCache::AssertEmpty() -{ -#ifdef _DEBUG - for (int ifci = 0; ifci < m_cfci; ifci++) - { - CacheItem * pfci = m_prgfci + ifci; - Assert(pfci->pffaceRegular == NULL); - Assert(pfci->pffaceBold == NULL); - Assert(pfci->pffaceItalic == NULL); - Assert(pfci->pffaceBI == NULL); - } -#endif // _DEBUG -} - -/*---------------------------------------------------------------------------------------------- - Set the flush mode on the cache to indicate whether or not it should be deleted when - it becomes empty. -----------------------------------------------------------------------------------------------*/ -void FontCache::SetFlushMode(int flush) -{ - m_flush = flush; - - if (m_flush == kflushAuto) - { - // Delete any font faces that have no remaining corresponding fonts. - // Work backwards so as we remove items the loop still works. - for (int ifci = m_cfci; --ifci >= 0; ) - { - CacheItem * pfci = m_prgfci + ifci; - if (pfci->pffaceRegular && pfci->pffaceRegular->NoFonts()) - RemoveFontFace(pfci->szFaceName, false, false, false); - if (pfci->pffaceBold && pfci->pffaceBold->NoFonts()) - RemoveFontFace(pfci->szFaceName, true, false, false); - if (pfci->pffaceItalic && pfci->pffaceItalic->NoFonts()) - RemoveFontFace(pfci->szFaceName, false, true, false); - if (pfci->pffaceBI && pfci->pffaceBI->NoFonts()) - RemoveFontFace(pfci->szFaceName, true, true, false); - } - - if (m_cfface <= 0) - FontFace::ZapFontCache(); - } -} - -} // namespace gr diff --git a/Build/source/libs/graphite/engine-2.3.1/src/segment/FontCache.h b/Build/source/libs/graphite/engine-2.3.1/src/segment/FontCache.h deleted file mode 100644 index 56da5ab26b8..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/src/segment/FontCache.h +++ /dev/null @@ -1,105 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 1999, 2001 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: FontCache.h -Responsibility: Sharon Correll -Last reviewed: Not yet. - -Description: - A cache of all the font-face objects known to mankind. There is exactly one instance - of a FontCache. -----------------------------------------------------------------------------------------------*/ -#ifdef _MSC_VER -#pragma once -#endif -#ifndef FONTCACHE_INCLUDED -#define FONTCACHE_INCLUDED - -//:End Ignore - -namespace gr -{ - -class FontFace; -class FontMemoryUsage; - -/*---------------------------------------------------------------------------------------------- - TODO: change from a sorted list to a hash table, if performance so requires. -----------------------------------------------------------------------------------------------*/ -class FontCache { - friend class FontMemoryUsage; - -public: - FontCache() - { - m_cfci = 0; - m_prgfci = NULL; - m_cfciMax = 0; - m_cfface = 0; - m_flush = kflushAuto; - } - - ~FontCache() - { - delete[] m_prgfci; - m_prgfci = NULL; - m_cfci = 0; - m_cfciMax = 0; - m_cfface = 0; - } - - void Initialize() - { - m_cfci = 0; - m_prgfci = new CacheItem[12]; - m_cfciMax = 12; - m_cfface = 0; - } - - struct CacheItem - { - wchar_t szFaceName[32]; // type should match std::wstring - FontFace * pffaceRegular; - FontFace * pffaceBold; - FontFace * pffaceItalic; - FontFace * pffaceBI; - }; - - void GetFontFace(std::wstring strFaceName, bool fBold, bool fItalic, FontFace ** ppfface); - void CacheFontFace(std::wstring strFaceName, bool fBold, bool fItalic, FontFace * pfface); - bool RemoveFontFace(std::wstring strFaceName, bool fBold, bool fItalic, bool fZapCache = true); - void DeleteIfEmpty(); - void AssertEmpty(); - - int GetFlushMode() - { - return m_flush; - } - void SetFlushMode(int); - - // Debugging: - //bool DbgCheckFontCache(); - - void calculateMemoryUsage(FontMemoryUsage & fmu); - -protected: - int FindCacheItem(std::wstring strFaceName); - void InsertCacheItem(int ifci); - -protected: - // member variables; - int m_cfci; // number of items (font-families) - int m_cfciMax; // amount of space available - int m_cfface; // number of font-faces - CacheItem * m_prgfci; - - int m_flush; -}; - -} // namespace gr - - -#endif // !FONTCACHE_INCLUDED diff --git a/Build/source/libs/graphite/engine-2.3.1/src/segment/FontFace.cpp b/Build/source/libs/graphite/engine-2.3.1/src/segment/FontFace.cpp deleted file mode 100644 index 8750f20c9b4..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/src/segment/FontFace.cpp +++ /dev/null @@ -1,598 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 1999, 2001 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: GrEngine.cpp -Responsibility: Sharon Correll -Last reviewed: Not yet. - -Description: Contains the implementation of the FontFace class. -----------------------------------------------------------------------------------------------*/ - -//:>******************************************************************************************** -//:> Include files -//:>******************************************************************************************** -#include "Main.h" -#include -#ifdef _MSC_VER -#pragma hdrstop -#endif -// any other headers (not precompiled) - -#undef THIS_FILE -DEFINE_THIS_FILE - -//:End Ignore - -namespace gr -{ - -//:>******************************************************************************************** -//:> Forward declarations -//:>******************************************************************************************** - -//:>******************************************************************************************** -//:> Local Constants and static variables -//:>******************************************************************************************** - -FontCache * FontFace::s_pFontCache = 0; - -//:>******************************************************************************************** -//:> New interface -//:>******************************************************************************************** -/*---------------------------------------------------------------------------------------------- - Return the appropriate FontFace, initialized with Graphite tables. - Called from the font constructor. -----------------------------------------------------------------------------------------------*/ -FontFace * FontFace::GetFontFace(Font * pfont, - std::wstring strFaceName, bool fBold, bool fItalic, - bool fDumbFallback) -{ - if (s_pFontCache == NULL) - s_pFontCache = new FontCache; - - FontFace * pfface; - s_pFontCache->GetFontFace(strFaceName, fBold, fItalic, &pfface); - if (pfface) - return pfface; - - // Create a new font face. - pfface = new FontFace(); - pfface->InitFontFace(pfont, strFaceName, fBold, fItalic, fDumbFallback); - return pfface; -} - -/*---------------------------------------------------------------------------------------------- - Initialize the engine using the given Graphite font. -----------------------------------------------------------------------------------------------*/ -GrResult FontFace::InitFontFace(Font * pfont, - std::wstring stuFaceName, bool fBold, bool fItalic, - bool fDumbFallback) -{ - AssertPtrN(pfont); - - m_pgreng = new GrEngine; - m_pgreng->m_pfface = this; - - m_pgreng->m_nScriptTag = 0; // not currently used, but set it to something - - std::wstring stuFeatures; - - //stuFeatures = stuFeaturesArg; - - if (wcscmp(stuFaceName.c_str(), m_pgreng->m_stuFaceName.c_str()) != 0) - { - s_pFontCache->RemoveFontFace(m_pgreng->FaceName(), m_pgreng->Bold(), m_pgreng->Italic()); - - m_pgreng->DestroyEverything(); // nothing we've cached is safe or useful. - m_pgreng->m_stuFaceName = stuFaceName; // if this is buggy, using assign might fix it - } - - //GrResult res = kresFail; -//#ifdef GR_FW -// // Read from the control file indicated by the registry, if any. -// std::wstring stuFaceNameTmp; -// stuFaceNameTmp.assign(rgchFaceName, wcslen(rgchFaceName)); -// res = InitFromControlFile(pfont, stuFaceName.c_str(), fBold, fItalic); -//#endif // GR_FW - - // Read directly from the font. - m_pgreng->DestroyContents(); - GrResult res = kresUnexpected; - try { - res = m_pgreng->ReadFontTables(pfont, fItalic); - } - catch (...) - { - if (fDumbFallback && m_pgreng->DumbFallback() && !m_pgreng->BadFont()) - { - // If we have a basically good font but can't do Graphite, - // just go with empty tables, which should be set up. - res = m_pgreng->m_resFontRead; - } - else - { - if (m_cfonts == 0) - { - //s_pFontCache->DeleteIfEmpty(); - //Assert(s_pFontCache == 0); - delete this; // will also delete GrEngine - } - else - { - delete m_pgreng; - } - m_pgreng = NULL; - throw; // throw original exception - } - } - - m_pgreng->m_resFontValid = res; - - m_pgreng->m_fBold = fBold; - m_pgreng->m_fItalic = fItalic; - - s_pFontCache->CacheFontFace(m_pgreng->FaceName(), fBold, fItalic, this); - - return m_pgreng->m_resFontValid; -} - -/*---------------------------------------------------------------------------------------------- - Read the cmap and Graphite tables from the font that is selected into the graphics - device. - - @return A GrResult indicating whether we were successful in loading the Graphite font: - - kresOk means success - - kresFail means the Graphite font could not be found or the basic font tables - (head, name, cmap) could not be loaded - - kresUnexpected means the Graphite tables could not be loaded - - kresFalse means it is not a Graphite font at all (has no Silf table). -----------------------------------------------------------------------------------------------*/ -GrResult GrEngine::ReadFontTables(Font * pfont, bool fItalic) -{ - GrResult res = kresOk; - m_ferr = kferrOkay; - GrBufferIStream grstrm; - - FontException fexptn; - fexptn.version = -1; - fexptn.subVersion = -1; - - bool fOk = false; - - const void * pHeadTbl; const void * pSileTbl; const void * pSilfTbl; - const void * pFeatTbl; const void * pGlatTbl; const void * pGlocTbl; const void * pSillTbl; - //const void * pCmapTbl; const void * pNameTbl; - size_t cbHeadSz, cbSilfSz, cbFeatSz, cbGlatSz, cbGlocSz, cbSillSz; - //size_t cbCmapSz, cbSileSz, cbNameSz; - - m_fFakeItalic = false; - - bool fBasicTables = false; - bool fSilf = false; // does the font have some sort of Silf table? - int nCheckSum = 0; - - bool fBadBase = false, - fMismatchedBase = false, - fFontIsItalic = false; - - // First read the head table. This gives us the checksum that we are using as a - // unique identifer. If it is the same as the one stored, and things appear set up, - // don't reload the tables. - res = (pHeadTbl = pfont->getTable(TtfUtil::TableIdTag(ktiHead), &cbHeadSz)) ? kresOk : kresFail; - fOk = pHeadTbl && (cbHeadSz == 0 || TtfUtil::CheckTable(ktiHead, pHeadTbl, cbHeadSz)); - if (res == kresFail) - { - m_stuInitError = L"could not locate head table for Graphite rendering"; - m_ferr = kferrFindHeadTable; - goto LUnexpected; - } - if (!fOk) - { - m_stuInitError = L"could not read design units for Graphite rendering"; - m_ferr = kferrReadDesignUnits; - goto LUnexpected; - } - m_mFontEmUnits = TtfUtil::DesignUnits(pHeadTbl); - nCheckSum = TtfUtil::HeadTableCheckSum(pHeadTbl); - fFontIsItalic = TtfUtil::IsItalic(pHeadTbl); - - if (m_nFontCheckSum == nCheckSum && m_ptman) - return m_resFontRead; // already initialized in some form - - DestroyContents(); - - Assert(!m_ptman); - Assert(!m_pctbl); - Assert(!m_pgtbl); - Assert(!m_prgpsd); - m_prgpsd = NULL; - m_cpsd = 0; - - m_ptman = new GrTableManager(this); - - m_fFakeItalic = (fItalic && !fFontIsItalic); - - // Look for an Sile table. If there is one, this is an extension font containing only - // the Graphite tables. Read the base font name out of the Sile table, and use it to - // read the cmap. Then replace the original font name to read the Graphite tables. - - m_fUseSepBase = false; - m_stuBaseFaceName.erase(); - - // TODO: rework the handling of the Sile table. - pSileTbl = NULL; - //pSileTbl = pfont->getTable(TtfUtil::TableIdTag(ktiSile)); - //if (pSileTbl) - //{ - // pgg->get_FontCharProperties(&chrpOriginal); - // grstrm.OpenBuffer(pSileTbl, sile_tbl.size()); - // m_fUseSepBase = ReadSileTable(pgg, grstrm, 0, &m_mFontEmUnits, &fMismatchedBase); - // grstrm.Close(); - - // if (!m_fUseSepBase) - // { - // SwitchGraphicsFont(pgg, false); // back to Graphite table font - // m_stuBaseFaceName.erase(); - // fBadBase = true; - // m_fUseSepBase = false; - // } - // // Otherwise leave the GrGraphics in a state to read from the base font. - //} - - // We don't need the offset table, and there's no way to get it anyway - // without a font file. - - // cmap and name - Assert(!m_fCmapTblCopy); - Assert(!m_fNameTblCopy); - fOk = SetCmapAndNameTables(pfont); - if (!fOk) - { - goto LUnexpected; - } - - fBasicTables = true; - - // If we have a bad base file, don't do Graphite stuff. - if (fBadBase || fMismatchedBase) - goto LUnexpected; - - /**** - Obtain font name from InitNew() now instead of reading from font file. InitNew should - should have a correct font name passed to it since it should come from a font registered - by GrFontInst.exe. This commented code could be use to verify name in font file matches. - NOTE: if we ever use this code again, make sure we're using the base font name table, - not the Graphite wrapper font name table. - // find the font family name - if (!TtfUtil::Get31EngFamilyInfo(vbName.Begin(), lnNameOff, lnNameSz)) - { // use Name table which is Symbol encode instead - // this could cause problems if a real Symbol writing system is used in the name table - // however normally real Unicode values are used instead a Symbol writing system - if (!TtfUtil::Get30EngFamilyInfo(vbName.Begin(), lnNameOff, lnNameSz)) - { - ReturnResult(kresFail); - } - // test for Symbol writing system. first byte of Unicode id should be 0xF0 - if (vbName[lnNameOff + 1] == (unsigned char)0xF0) // 1 - Unicode id is big endian - ReturnResult(kresFail); - } - if (!TtfUtil::SwapWString(vbName.Begin() + lnNameOff, lnNameSz / isizeof(utf16))) - ReturnResult(kresFail); - - m_stuFaceName = std::wstring((utf16 *)(vbName.begin() + lnNameOff), lnNameSz / isizeof(utf16)); - ****/ - - // Silf - res = (pSilfTbl = pfont->getTable(TtfUtil::TableIdTag(ktiSilf), &cbSilfSz)) ? kresOk : kresFail; - fOk = pSilfTbl && (cbSilfSz == 0 || TtfUtil::CheckTable(ktiSilf, pSilfTbl, cbSilfSz)); - if (!fOk) - { - m_stuInitError = L"could not load Silf table for Graphite rendering"; - m_ferr = kferrLoadSilfTable; - goto LUnexpected; - } - - // Feat - res = (pFeatTbl = pfont->getTable(TtfUtil::TableIdTag(ktiFeat), &cbFeatSz)) ? kresOk : kresFail; - fOk = pFeatTbl && (cbFeatSz == 0 || TtfUtil::CheckTable(ktiFeat, pFeatTbl, cbFeatSz)); - if (!fOk) - { - // TODO: just create an empty set of features, since this is not disastrous. - m_stuInitError = L"could not load Feat table for Graphite rendering"; - m_ferr = kferrLoadFeatTable; - goto LUnexpected; - } - - // Glat - res = (pGlatTbl = pfont->getTable(TtfUtil::TableIdTag(ktiGlat), &cbGlatSz)) ? kresOk : kresFail; - fOk = pGlatTbl && (cbGlatSz == 0 || TtfUtil::CheckTable(ktiGlat, pGlatTbl, cbGlatSz)); - if (!fOk) - { - m_stuInitError = L"could not load Glat table for Graphite rendering"; - m_ferr = kferrLoadGlatTable; - goto LUnexpected; - } - - // Gloc - res = (pGlocTbl = pfont->getTable(TtfUtil::TableIdTag(ktiGloc), &cbGlocSz)) ? kresOk : kresFail; - fOk = pGlocTbl && (cbGlocSz == 0 || TtfUtil::CheckTable(ktiGloc, pGlocTbl, cbGlocSz)); - if (!fOk) - { - m_stuInitError = L"could not load Gloc table for Graphite rendering"; - m_ferr = kferrLoadGlocTable; - goto LUnexpected; - } - - // Sill - try { - res = (pSillTbl = pfont->getTable(TtfUtil::TableIdTag(ktiSill), &cbSillSz)) ? kresOk : kresFail; - fOk = pSillTbl && (cbSillSz == 0 || TtfUtil::CheckTable(ktiSill, pSillTbl, cbSillSz)); - } - catch (...) - { - fOk = true; - pSillTbl = NULL; - } - // if table couldn't be loaded, this is not disastrous. - -// ibGlocStart = cbGlatTbl; - fOk = CheckTableVersions(&grstrm, - (const byte *)pSilfTbl, 0, - (const byte *)pGlocTbl, 0, - (const byte *)pFeatTbl, 0, - &m_fxdBadVersion); - if (!fOk) - { -// wchar_t rgch1[50]; -// wchar_t rgch2[50]; -//#if defined(_WIN32) -// // This version does not work in Windows, in spite of being documented: -// // swprintf(rgch, 50, L"%d", (m_fxdBadVersion >> 16)); -// // Removing the size argument make it work. -// swprintf(rgch1, L"%d", (m_fxdBadVersion >> 16)); -// swprintf(rgch2, L"%d", (m_fxdBadVersion & 0x0000FFFF)); -//#else -// swprintf(rgch1, 50, L"%d", (m_fxdBadVersion >> 16)); -// swprintf(rgch2, 50, L"%d", (m_fxdBadVersion & 0x0000FFFF)); -//#endif - char rgch[50]; // more than enough space to print two 16-bit ints - char *pch = &rgch[0]; - sprintf(rgch, "%d.%d", (m_fxdBadVersion >> 16), (m_fxdBadVersion & 0x0000FFFF)); - std::wstring stu = L"unsupported version ("; - //stu.append(rgch1); - //stu.append(L"."); - //stu.append(rgch2); - while (*pch != 0) - stu.push_back((wchar_t)*pch++); - stu.append(L") of Graphite tables"); - m_stuInitError.assign(stu.c_str()); - m_ferr = kferrBadVersion; - goto LUnexpected; - } - - try - { - // Parse the "Silf" table. - grstrm.OpenBuffer((const byte*)pSilfTbl, cbSilfSz); - int chwGlyphIDMax, fxdVersion; - bool f = ReadSilfTable(grstrm, 0, 0, &chwGlyphIDMax, &fxdVersion); - grstrm.Close(); - if (!f) - { - m_ferr = kferrReadSilfTable; - fexptn.errorCode = m_ferr; - throw fexptn; - } - - // Parse the "Gloc" and "Glat" tables. - { - GrBufferIStream grstrmGlat; - - grstrm.OpenBuffer((const byte *)pGlocTbl, cbGlocSz); - grstrmGlat.OpenBuffer((const byte *)pGlatTbl, cbGlatSz); - f = ReadGlocAndGlatTables(grstrm, 0, grstrmGlat, 0, chwGlyphIDMax, fxdVersion); - grstrm.Close(); - grstrmGlat.Close(); - if (!f) - { - m_ferr = kferrReadGlocGlatTable; - fexptn.errorCode = m_ferr; - throw fexptn; - } - } - - // Parse the "Feat" table. - grstrm.OpenBuffer((const byte *)pFeatTbl, cbFeatSz); - f = ReadFeatTable(grstrm, 0); - grstrm.Close(); - if (!f) - { - m_ferr = kferrReadFeatTable; - fexptn.errorCode = m_ferr; - throw fexptn; - } - - // Parse the "Sill" table. - if (pSillTbl) - { - grstrm.OpenBuffer((const byte *)pSillTbl, cbFeatSz); - f = ReadSillTable(grstrm, 0); - grstrm.Close(); - if (!f) - { - m_ferr = kferrReadSillTable; - fexptn.errorCode = m_ferr; - throw fexptn; - } - } - else - m_langtbl.CreateEmpty(); - } - catch (...) - { - fSilf = false; - m_resFontRead = kresUnexpected; - try { - DestroyContents(false); - } - catch (...) - {} - goto LUnexpected; - } - - m_stuErrCtrlFile.erase(); - m_nFontCheckSum = nCheckSum; - m_resFontRead = kresOk; - m_ferr = kferrOkay; - ReturnResult(kresOk); - -LUnexpected: - // Don't do this, because it is possible to use a base font with an empty Graphite - // engine: - //if (m_fUseSepBase || m_stuBaseFaceName.Length() > 0) - //{ - // SwitchGraphicsFont(pgg, false); // back to Graphite table font - // m_stuBaseFaceName.erase(); - // m_fUseSepBase = false; - //} - - CreateEmpty(); - m_nFontCheckSum = nCheckSum; - if (!fBasicTables) - m_resFontRead = kresFail; // bad font - else if (!fSilf) - m_resFontRead = kresFalse; // no Silf table--not a Graphite font - else - m_resFontRead = kresUnexpected; // couldn't read the Graphite tables - - fexptn.errorCode = m_ferr; - fexptn.version = m_fxdBadVersion >> 16; - fexptn.subVersion = m_fxdBadVersion & 0x0000FFFF; - throw fexptn; - - ReturnResult(m_resFontRead); -} - -/*---------------------------------------------------------------------------------------------- - Read the cmap and name tables. - - This is called from two places. One is when we first initialize the engine. Also, if the - font tables have not been actually copied from the font, they may have been deleted - when the font was deleted. So when reusing the engine, set them to something valid based - on the current font. -----------------------------------------------------------------------------------------------*/ -bool GrEngine::SetCmapAndNameTables(Font * pfont) -{ - GrResult res = kresOk; - bool fOk; - const void * pCmapTbl; - const void * pNameTbl; - size_t cbCmapSz, cbNameSz; - - // cmap - if (!m_fCmapTblCopy) - { - res = (pCmapTbl = pfont->getTable(TtfUtil::TableIdTag(ktiCmap), &cbCmapSz)) ? kresOk : kresFail; - fOk = pCmapTbl && (cbCmapSz == 0 || TtfUtil::CheckTable(ktiCmap, pCmapTbl, cbCmapSz)); - if (!fOk) - { - m_stuInitError = L"could not locate cmap table"; - m_ferr = kferrFindCmapTable; - return false; - } - - if (pCmapTbl && cbCmapSz > 0) - { - // Make a private copy of the cmap for the engine's use. - m_pCmapTbl = new byte[cbCmapSz]; - std::copy(reinterpret_cast(pCmapTbl), - reinterpret_cast(pCmapTbl) + cbCmapSz, m_pCmapTbl); - m_fCmapTblCopy = true; - m_cbCmapTbl = cbCmapSz; - } - else - { - m_pCmapTbl = const_cast(reinterpret_cast(pCmapTbl)); - m_fCmapTblCopy = false; - } - - // MS Unicode cmap - m_pCmap_3_1 = TtfUtil::FindCmapSubtable(m_pCmapTbl, 3, 1); - m_pCmap_3_10 = TtfUtil::FindCmapSubtable(m_pCmapTbl, 3, 10); - if (!m_pCmap_3_1) - m_pCmap_3_1 = TtfUtil::FindCmapSubtable(m_pCmapTbl, 3, 0); - if (!m_pCmap_3_1) - { - m_stuInitError = L"failure to load cmap subtable"; - m_ferr = kferrLoadCmapSubtable; - return false; - } - if (!TtfUtil::CheckCmap31Subtable(m_pCmap_3_1)) - { - m_stuInitError = L"checking cmap subtable failed"; - m_ferr = kferrCheckCmapSubtable; - return false; - } - } - else - { - Assert(m_pCmapTbl); - } - - // name table - eventually need feature label strings - - // Currently the only stuff we're getting from the name table are our feature names, - // so use the version from the Graphite font (not the base font if any). - //////if (m_fUseSepBase) - ////// pgg->SetupGraphics(&chrpOriginal); - - if (!m_fNameTblCopy) - { - res = (pNameTbl = (const byte *)pfont->getTable(TtfUtil::TableIdTag(ktiName), &cbNameSz)) ? kresOk : kresFail; - fOk = pNameTbl && (cbNameSz == 0 || TtfUtil::CheckTable(ktiName, pNameTbl, cbNameSz)); - if (!fOk) - { - m_stuInitError = L"could not locate name table"; - m_ferr = kferrFindNameTable; - return false; - } - - if (pNameTbl && cbNameSz > 0) - { - // Make a private copy of the name table for the engine's use. - m_pNameTbl = new byte[cbNameSz]; - std::copy(reinterpret_cast(pNameTbl), - reinterpret_cast(pNameTbl) + cbNameSz, m_pNameTbl); - m_fNameTblCopy = true; - m_cbNameTbl = cbNameSz; - } - else - { - m_pNameTbl = const_cast(reinterpret_cast(pNameTbl)); - m_fNameTblCopy = false; - } - } - else - { - Assert(m_pNameTbl); - } - - return true; -} - - -//void FontFace::DbgCheckFontFace() -//{ -// Assert(m_cfonts < 5000); -// Assert(m_cfonts >= 0); -// wchar_t chw0 = m_pgreng->m_stuFaceName[0]; -// Assert(chw0 >= 0x0040); // A -// Assert(chw0 <= 0x007A); // z -//} - -} // namespace gr - -//:End Ignore diff --git a/Build/source/libs/graphite/engine-2.3.1/src/segment/FontFace.h b/Build/source/libs/graphite/engine-2.3.1/src/segment/FontFace.h deleted file mode 100644 index 7f2684a5908..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/src/segment/FontFace.h +++ /dev/null @@ -1,246 +0,0 @@ -/*-------------------------------------------------------------------- -Copyright (C) 1999, 2001 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: FontFace.h -Responsibility: Sharon Correll -Last reviewed: Not yet. - -Description: - Contains the definition of the FontFace class. - TODO: Merge with GrEngine. -----------------------------------------------------------------------------------------------*/ -#ifdef _MSC_VER -#pragma once -#endif -#ifndef FONTFACE_INCLUDED -#define FONTFACE_INCLUDED -#include - -#ifdef _MSC_VER -#include -#endif - -namespace gr -{ - -class IGrJustifier; -class Segment; - - -/*---------------------------------------------------------------------------------------------- - The GrEngine serves as the top level object that knows how to run Graphite tables - and generate Graphite segments. - - Primarily, this class implements IRenderEngine, which allows it to serve as a FW - rendering engine. It also implements ISimpleInit, a general interface for initializing - using a string. Finally, it implements ITraceControl, a very simple interface which - allows a client to flip a flag indicating whether or not we want to output a log of - the Graphite transduction process. - - Hungarian: greng -----------------------------------------------------------------------------------------------*/ -class FontFace -{ - friend class gr::FontMemoryUsage; - -public: - FontFace() - { - m_cfonts = 0; - } - - ~FontFace() - { - if (s_pFontCache) - s_pFontCache->RemoveFontFace(m_pgreng->FaceName(), m_pgreng->Bold(), m_pgreng->Italic()); - delete m_pgreng; - } - - void IncFontCount() - { - m_cfonts++; - } - void DecFontCount() - { - m_cfonts--; - if (m_cfonts <= 0 && (s_pFontCache == NULL || s_pFontCache->GetFlushMode() == kflushAuto)) - delete this; - } - - bool NoFonts() - { - return (m_cfonts <= 0); - } - - static FontFace * GetFontFace(Font * pfont, - std::wstring strFaceName, bool fBold, bool fItalic, - bool fDumbFallback = false); - - GrResult InitFontFace(Font * pfont, - std::wstring stuFaceName, bool fBold, bool fItalic, - bool fDumbLayout); - - FontErrorCode IsValidForGraphite(int * pnVersion, int * pnSubVersion) - { - return m_pgreng->IsValidForGraphite(pnVersion, pnSubVersion); - } - - static void ZapFontCache() - { - if (s_pFontCache) - { - s_pFontCache->AssertEmpty(); - delete s_pFontCache; - } - s_pFontCache = NULL; - } - - static void SetFlushMode(int flush) - { - if (s_pFontCache == NULL) - s_pFontCache = new FontCache; - s_pFontCache->SetFlushMode(flush); - } - static int GetFlushMode() - { - if (s_pFontCache == NULL) - s_pFontCache = new FontCache; - return s_pFontCache->GetFlushMode(); - } - - // Temporary, until interface gets thoroughly reworked: - GrEngine * GraphiteEngine() - { - return m_pgreng; - } - - // Feature access: - size_t NumberOfFeatures() - { - return m_pgreng->NumberOfFeatures_ff(); - } - featid FeatureID(size_t ifeat) - { - return m_pgreng->FeatureID_ff(ifeat); - } - size_t FeatureWithID(featid id) - { - return m_pgreng->FeatureWithID_ff(id); - } - bool GetFeatureLabel(size_t ifeat, lgid language, utf16 * label) - { - return m_pgreng->GetFeatureLabel_ff(ifeat, language, label); - } - int GetFeatureDefault(size_t ifeat) // index of default setting - { - return m_pgreng->GetFeatureDefault_ff(ifeat); - } - size_t NumberOfSettings(size_t ifeat) - { - return m_pgreng->NumberOfSettings_ff(ifeat); - } - int GetFeatureSettingValue(size_t ifeat, size_t ifset) - { - return m_pgreng->GetFeatureSettingValue_ff(ifeat, ifset); - } - bool GetFeatureSettingLabel(size_t ifeat, size_t ifset, lgid language, utf16 * label) - { - return m_pgreng->GetFeatureSettingLabel_ff(ifeat, ifset, language, label); - } - // Feature-label language access: - size_t NumberOfFeatLangs() - { - return m_pgreng->NumberOfFeatLangs_ff(); - } - short FeatLabelLang(int ilang) - { - return m_pgreng->GetFeatLabelLang_ff(ilang); - } - // Language access: - size_t NumberOfLanguages() - { - return m_pgreng->NumberOfLanguages_ff(); - } - isocode LanguageCode(size_t ilang) - { - return m_pgreng->GetLanguageCode_ff(ilang); - } - - // Script Direction access: - ScriptDirCode ScriptDirection() const throw() - { - unsigned int script_dirs = 0; - OLECHAR err_dummy = 0; - m_pgreng->get_ScriptDirection(&script_dirs, &err_dummy, 1); - return ScriptDirCode(script_dirs); - } - - bool BadFont(FontErrorCode * pferr = NULL) - { - return m_pgreng->BadFont(pferr); - } - bool DumbFallback(FontErrorCode * pferr = NULL) - { - return m_pgreng->DumbFallback(pferr); - } - -public: - // For use in segment creation: - void RenderLineFillSegment(Segment * pseg, Font * pfont, ITextSource * pts, - LayoutEnvironment & layout, - toffset ichStart, toffset ichStop, float xsMaxWidth, bool fBacktracking) - { - m_pgreng->MakeSegment(pseg, pfont, pts, NULL, layout, - ichStart, ichStop, xsMaxWidth, fBacktracking, false, 0, kestMoreLines); - } - void RenderRangeSegment(Segment * pseg, Font * pfont, - ITextSource * pts, LayoutEnvironment & layout, - toffset ichStart, toffset ichStop) - { - m_pgreng->MakeSegment(pseg, pfont, pts, NULL, layout, - ichStart, ichStop, kPosInfFloat, false, false, 0, kestMoreLines); - } - void RenderJustifiedSegment(Segment * pseg, Font * pfont, - ITextSource * pts, LayoutEnvironment & layout, - toffset ichStart, toffset ichStop, float xsCurrentWidth, float xsDesiredWidth) - { - m_pgreng->MakeSegment(pseg, pfont, pts, NULL, layout, - ichStart, ichStop, xsCurrentWidth, false, true, xsDesiredWidth, kestMoreLines); - } - - // Debugging. - //static bool DbgCheckFontCache() - //{ - // if (s_pFontCache) - // return s_pFontCache->DbgCheckFontCache(); - // else - // return true; - //} - //void DbgCheckFontFace(); - - static void calculateAllMemoryUsage(FontMemoryUsage & fmu); - void calculateMemoryUsage(FontMemoryUsage & fmu); - -protected: - // Number of fonts in existence that use this face; when it goes to zero, delete. - int m_cfonts; - - // Static variable: - static FontCache * s_pFontCache; - - // Member variables: - GrEngine * m_pgreng; -}; - -} // namespace gr - - -#if defined(GR_NO_NAMESPACE) -using namespace gr; -#endif - - -#endif // !FONTFACE_INCLUDED diff --git a/Build/source/libs/graphite/engine-2.3.1/src/segment/GrCharStream.cpp b/Build/source/libs/graphite/engine-2.3.1/src/segment/GrCharStream.cpp deleted file mode 100644 index 20b5a46ab76..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/src/segment/GrCharStream.cpp +++ /dev/null @@ -1,652 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 1999, 2001 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: GrCharStream.cpp -Responsibility: Sharon Correll -Last reviewed: Not yet. - -Description: - Implements the GrCharStream class. -----------------------------------------------------------------------------------------------*/ - -//:>******************************************************************************************** -//:> Include files -//:>******************************************************************************************** -#include "Main.h" - -#ifdef _MSC_VER -#pragma hdrstop -#endif -#undef THIS_FILE -DEFINE_THIS_FILE - -//:End Ignore - -//:>******************************************************************************************** -//:> Forward declarations -//:>******************************************************************************************** - -//:>******************************************************************************************** -//:> Local Constants and static variables -//:>******************************************************************************************** - -namespace gr -{ - -//:>******************************************************************************************** -//:> Methods -//:>******************************************************************************************** - -/*---------------------------------------------------------------------------------------------- - Constructor. -----------------------------------------------------------------------------------------------*/ -GrCharStream::GrCharStream(ITextSource * pgts, int ichrMin, int ichrLim, - bool fStartLine, bool fEndLine) - : m_pgts(pgts), - m_ichrMin(ichrMin), - m_ichrLim(ichrLim), - m_ichrPos(ichrMin), - m_fStartLine(fStartLine), - m_fEndLine(fEndLine), - m_cchrBackedUp(0), - m_ichrRunMin(0), - m_ichrRunLim(0), - m_ichlRunOffset(kPosInfinity), - m_ichrRunOffset(kPosInfinity) -{ - #if 0 // ??? surely m_cnRunMax and m_prgnRunText are undefined at this point - if (m_cchlRunMax > -1) - delete[] m_prgchlRunText; - #endif - m_cchlRunMax = -1; - m_prgchlRunText = NULL; - - m_vislotNextChunkMap.clear(); - - m_utf = m_pgts->utfEncodingForm(); -} - -/*---------------------------------------------------------------------------------------------- - Restart the stream when an error has a occurred and we need to fall back to dumb rendering. -----------------------------------------------------------------------------------------------*/ -void GrCharStream::Restart() -{ - if (m_cchlRunMax > -1) - delete[] m_prgchlRunText; - - m_ichrPos = m_ichrMin; - m_cchrBackedUp = 0; - m_ichrRunMin = 0; - m_ichrRunLim = 0; - m_ichlRunOffset = kPosInfinity; - m_ichrRunOffset = kPosInfinity; - - m_cchlRunMax = -1; - m_prgchlRunText = NULL; - - m_vislotNextChunkMap.clear(); -} - -/*---------------------------------------------------------------------------------------------- - Get the next character from the stream. - - @param pichwSegOffset - index of this character from the beginning of the segment - @param pcchRaw - number of raw (UTF-16 or UTF-8) chars consumed to get one complete - Unicode codepoint. -----------------------------------------------------------------------------------------------*/ -int GrCharStream::NextGet(GrTableManager * ptman, - GrFeatureValues * pfval, int * pichrSegOffset, int * pcchr) -{ - if (AtEnd()) - { - Assert(m_ichrPos == m_ichrLim); - return 0; - } - - int m_ichrMinBackedUp = m_ichrMin - m_cchrBackedUp; - - if ((m_ichrRunOffset + m_ichrRunMin) >= m_ichrRunLim) - { - // Get the next run of characters - - std::pair pairRange = m_pgts->propertyRange(m_ichrPos); - m_ichrRunMin = pairRange.first; - m_ichrRunLim = pairRange.second; - - // The only time the run extends before what we want is on the first run. - Assert((m_ichrRunMin == m_ichrPos) // m_ichwPos is beginning of run - || (m_ichrPos == m_ichrMinBackedUp)); // first run - // Pretend like the run starts where we need it: - m_ichrRunMin = max(m_ichrRunMin, m_ichrMinBackedUp); - Assert(m_ichrRunMin == m_ichrPos); - - if (m_cchlRunMax != -1 && m_cchlRunMax < m_ichrRunLim - m_ichrRunMin) - { - // Text buffer is too small: delete it and create a new one. - delete[] m_prgchlRunText; - m_cchlRunMax = -1; - } - - if (m_cchlRunMax == -1) - { - // Note that combining surrogates or UTF-8 will always result in the same or fewer - // number of characters needed in m_prgchlRunText, so the following is safe: - m_cchlRunMax = m_ichrRunLim - m_ichrRunMin; - m_prgchlRunText = new int[m_cchlRunMax]; - } - - utf32 * prgchlRunText32 = NULL; - utf16 * prgchwRunText16 = NULL; - utf8 * prgchsRunText8 = NULL; - - int cchGot; - switch (m_utf) - { - case kutf8: - prgchsRunText8 = new utf8[m_ichrRunLim - m_ichrRunMin]; - cchGot = m_pgts->fetch(m_ichrRunMin, m_ichrRunLim - m_ichrRunMin, prgchsRunText8); - break; - case kutf16: - prgchwRunText16 = new utf16[m_ichrRunLim - m_ichrRunMin]; - cchGot = m_pgts->fetch(m_ichrRunMin, m_ichrRunLim - m_ichrRunMin, prgchwRunText16); - break; - default: - Assert(false); - // Assume UTF-32: fall through - case kutf32: - prgchlRunText32 = new utf32[m_ichrRunLim - m_ichrRunMin]; - cchGot = m_pgts->fetch(m_ichrRunMin, m_ichrRunLim - m_ichrRunMin, prgchlRunText32); - break; - } - - int ichlUtf32 = 0; - for (int ichr = 0; ichr < m_ichrRunLim - m_ichrRunMin; ichr++) - { - if (ichr == m_ichrPos - m_ichrRunMin) - { - m_ichrRunOffset = ichr; - m_ichlRunOffset = ichlUtf32; - } - Assert(m_ichrRunOffset != kPosInfinity || ichr < m_ichrPos - m_ichrRunMin); - - int cchrUsed; - switch (m_utf) - { - case kutf8: - m_prgchlRunText[ichlUtf32] = Utf8ToUtf32(prgchsRunText8 + ichr, - m_ichrRunLim - m_ichrRunMin - ichr, &cchrUsed); - break; - case kutf16: - m_prgchlRunText[ichlUtf32] = Utf16ToUtf32(prgchwRunText16 + ichr, - m_ichrRunLim - m_ichrRunMin - ichr, &cchrUsed); - break; - default: - Assert(false); - // Assume UTF-32: fall through - case kutf32: - m_prgchlRunText[ichlUtf32] = prgchlRunText32[ichlUtf32]; - cchrUsed = 1; - break; - } - - m_vislotNextChunkMap.push_back(ichlUtf32); - for (int i = 1; i < cchrUsed; i++) - m_vislotNextChunkMap.push_back(-1); - ichr += cchrUsed - 1; - ichlUtf32++; - } - delete[] prgchlRunText32; - delete[] prgchwRunText16; - delete[] prgchsRunText8; - - while (m_ichrLim - m_ichrRunMin < signed(m_vislotNextChunkMap.size()) - && m_vislotNextChunkMap[m_ichrLim - m_ichrRunMin] == -1) - { - // Invalid surrogate boundary; this is really a bug in the application program, - // but adjust here to avoid a crash! - m_ichrLim--; - } - - SetUpFeatureValues(ptman, m_ichrPos); - - Assert(m_ichrRunOffset >= 0); - Assert(m_ichrRunOffset < m_ichrRunLim - m_ichrRunMin); - Assert(m_vislotNextChunkMap.size() == (unsigned) m_ichrRunLim - m_ichrMinBackedUp); - } - - int chlRet = m_prgchlRunText[m_ichlRunOffset]; - *pfval = m_fvalRunFeats; - *pichrSegOffset = m_ichrPos - m_ichrMin; // offset from the official start of the segment - // of the first 16-bit char - int ichrPosPrev = m_ichrPos; - ++m_ichlRunOffset; - do { - ++m_ichrPos; - ++m_ichrRunOffset; - } while (m_ichrPos - m_ichrMinBackedUp < signed(m_vislotNextChunkMap.size()) - && m_vislotNextChunkMap[m_ichrPos - m_ichrMinBackedUp] == -1); - - *pcchr = m_ichrPos - ichrPosPrev; // number of raw chars consumed - Assert(m_utf != kutf8 || *pcchr <= 6); - Assert(m_utf != kutf16 || *pcchr <= 2); - - Assert(m_ichrPos == (m_ichrRunMin + m_ichrRunOffset)); - Assert(m_ichrPos <= m_ichrLim); - - /* KLUDGE for debugging - if (m_ichrPos == 1) - nRet = 0x1018; - else if (m_ichrPos == 2) - nRet = 0x1039; - else if (m_ichrPos == 3) - nRet = 0x101b; - else if (m_ichrPos == 4) - nRet = 0x1032; - else if (m_ichrPos == 5) - nRet = 0x1037; - else if (m_ichrPos == 6) - nRet = 0x1037; - */ - - return chlRet; -} - -/*---------------------------------------------------------------------------------------------- - Convert UTF-8 to UTF-32--a single character's worth. Also pass back the number of 8-bit - items consumed. -----------------------------------------------------------------------------------------------*/ -utf32 GrCharStream::Utf8ToUtf32(utf8 * prgchs, int cchs, int * pcchsUsed) -{ - if (cchs <= 0) - { - *pcchsUsed = 0; - return 0; - } - - long chlRet = DecodeUtf8(prgchs, cchs, pcchsUsed); - Assert(chlRet > 0); - if (chlRet == -1) - { - // Some error occurred. Just treat the UTF-8 as UTF-32. - *pcchsUsed = 1; - return (utf32)prgchs[0]; - } - else - return chlRet; -} - -/*---------------------------------------------------------------------------------------------- - Convert UTF-16 to UTF-32--a single character's worth. Also pass back the number of 16-bit - items consumed. -----------------------------------------------------------------------------------------------*/ -utf32 GrCharStream::Utf16ToUtf32(utf16 * prgchw, int cchw, int * pcchwUsed) -{ - if (cchw <= 0) - { - *pcchwUsed = 0; - return 0; - } - - unsigned int nUtf32; - bool fSurrogate = FromSurrogatePair(prgchw[0], ((cchw < 2) ? 0 : prgchw[1]), &nUtf32); - *pcchwUsed = (fSurrogate) ? 2 : 1; - return (int)nUtf32; - -/* - // For testing: - int nCharRet; - if (cchw >= 2 && prgchw[0] == '^' && prgchw[1] == 'a') - { - nCharRet = 'A'; - *pcchwUsed = 2; - } - else if (cchw >= 3 && prgchw[0] == '#' && prgchw[1] == '#' && - prgchw[2] == 'B') - { - nCharRet = 'b'; - *pcchwUsed = 3; - } - else if (cchw >= 1) - { - nCharRet = prgchw[0]; - *pcchwUsed = 1; - } - else - { - nCharRet = 0; - *pcchwUsed = 0; - } - return nCharRet; -*/ -} - -/*---------------------------------------------------------------------------------------------- - Return true if the given position is at the boundary of a Unicode character; return false - if it is between two parts of pair of surrogates. -----------------------------------------------------------------------------------------------*/ -bool GrCharStream::AtUnicodeCharBoundary(ITextSource * pgts, int ichr) -{ - int cchr = pgts->getLength(); - if (ichr <= 0 || ichr >= cchr) - return true; - - UtfType utf = pgts->utfEncodingForm(); - - // Note that we never need more than a handful of characters. - int ichrMinGet = max(0, ichr - 1); - int ichrLimGet = ichr + 1; - utf16 rgchwText16[3]; - utf8 rgchsText8[3]; - bool fRet; - switch (utf) - { - case kutf8: - pgts->fetch(ichrMinGet, ichrLimGet - ichrMinGet, rgchsText8); - fRet = AtUnicodeCharBoundary(rgchsText8, ichrLimGet - ichrMinGet, - ichr - ichrMinGet, utf); - break; - case kutf16: - pgts->fetch(ichrMinGet, ichrLimGet - ichrMinGet, rgchwText16); - fRet = AtUnicodeCharBoundary(rgchwText16, ichrLimGet - ichrMinGet, - ichr - ichrMinGet, utf); - break; - default: - Assert(false); - case kutf32: - fRet = true; - break; - } - - return fRet; -} - -/*---------------------------------------------------------------------------------------------- - Return true if the given position is at the boundary of a Unicode character; return false - if it is between two parts of pair of surrogates. -----------------------------------------------------------------------------------------------*/ -bool GrCharStream::AtUnicodeCharBoundary(utf16 * prgchw, int cchw, int ichr, UtfType utf) -{ - Assert(ichr >= 0); - Assert(ichr <= cchw); - - if (ichr == 0) - return true; - if (ichr >= cchw) - return true; - - switch (utf) - { - case kutf16: - { - unsigned int nUtf32; - bool fMiddleOfPair = FromSurrogatePair(prgchw[ichr - 1], prgchw[ichr], &nUtf32); - return !fMiddleOfPair; - } - case kutf8: - { - // 16-bit buffer being treated like UTF-8. - utf8 rgchs[2]; - rgchs[1] = (utf8)prgchw[ichr]; - return AtUnicodeCharBoundary(rgchs, 2, 1, kutf8); - } - case kutf32: - default: - return true; - } - -/* - // temp stuff for debugging: - if (ichr > 0 && cchw >= 1 && prgchw[ichr-1] == '^' && prgchw[ichr] == 'a') - { - return false; - } - if (ichr > 0 && cchw >= 2 && prgchw[ichr-1] == '#' && prgchw[ichr] == '#' && - prgchw[ichr+1] == 'B') - { - return false; - } - if (ichr > 1 && cchw >= 1 && prgchw[ichr-2] == '#' && prgchw[ichr-1] == '#' && - prgchw[ichr] == 'B') - { - return false; - } - - return true; -*/ -} - -bool GrCharStream::AtUnicodeCharBoundary(utf8 * prgchs, int cchs, int ichs, UtfType utf) -{ - Assert(ichs >= 0); - Assert(ichs <= cchs); - - Assert(utf == kutf8); - - if (ichs == 0) - return true; - if (ichs >= cchs) - return true; - - if (cchs == 0) - return true; - - // A bit pattern of 10xxxxxx indicates a continuation of a sequence - // (11xxxxxx means the first byte of a sequence, 0xxxxxxx means a single character). - - utf8 chsTest = prgchs[ichs] & 0xC0; - return (chsTest != 0x80); -} - -/*---------------------------------------------------------------------------------------------- - Convert the given pair of characters into a single 32-bit Unicode character. Return - true if they are a legitimate surrogate pair. If not, just return the first of the - two 16-bit characters. -----------------------------------------------------------------------------------------------*/ -bool GrCharStream::FromSurrogatePair(utf16 chwIn1, utf16 chwIn2, unsigned int * pchlOut) -{ - if ((chwIn1 < kzUtf16HighFirst) || (chwIn1 > kzUtf16HighLast) - || (chwIn2 < kzUtf16LowFirst) || (chwIn2 > kzUtf16LowLast)) - { - // Not a surrogate - *pchlOut = (unsigned int)chwIn1; - return false; - } - else - { - *pchlOut = ((chwIn1 - kzUtf16HighFirst) << kzUtf16Shift) + chwIn2 + kzUtf16Inc; - return true; - } -} - -/*---------------------------------------------------------------------------------------------- - Decode 1-6 bytes in the character string from UTF-8 format to Unicode (UCS-4). - As a side-effect, cbOut is set to the number of UTF-8 bytes consumed. - - @param rgchUtf8 Pointer to a a character array containing UTF-8 data. - @param cchUtf8 Number of characters in the array. - @param cbOut Reference to an integer for holding the number of input (8-bit) characters - consumed to produce the single output Unicode character. - - @return A single Unicode (UCS-4) character. If an error occurs, return -1. -----------------------------------------------------------------------------------------------*/ -long GrCharStream::DecodeUtf8(const utf8 * rgchUtf8, int cchUtf8, int * pcbOut) -{ - // check for valid input - AssertArray(rgchUtf8, cchUtf8); - if ((cchUtf8 == 0) || (rgchUtf8[0] == '\0')) - { - *pcbOut = (cchUtf8) ? 1 : 0; - return 0; - } - // - // decode the first byte of the UTF-8 sequence - // - long lnUnicode; - int cbExtra; - int chsUtf8 = *rgchUtf8++ & 0xFF; - if (chsUtf8 >= kzUtf8Flag6) // 0xFC - { - lnUnicode = chsUtf8 & kzUtf8Mask6; - cbExtra = 5; - } - else if (chsUtf8 >= kzUtf8Flag5) // 0xF8 - { - lnUnicode = chsUtf8 & kzUtf8Mask5; - cbExtra = 4; - } - else if (chsUtf8 >= kzUtf8Flag4) // 0xF0 - { - lnUnicode = chsUtf8 & kzUtf8Mask4; - cbExtra = 3; - } - else if (chsUtf8 >= kzUtf8Flag3) // 0xE0 - { - lnUnicode = chsUtf8 & kzUtf8Mask3; - cbExtra = 2; - } - else if (chsUtf8 >= kzUtf8Flag2) // 0xC0 - { - lnUnicode = chsUtf8 & kzUtf8Mask2; - cbExtra = 1; - } - else // 0x00 - { - lnUnicode = chsUtf8; - cbExtra = 0; - } - if (cbExtra >= cchUtf8) - { - return -1; - } - - switch (cbExtra) - { - case 5: - lnUnicode <<= kzUtf8ByteShift; - chsUtf8 = *rgchUtf8++ & 0xFF; - if ((chsUtf8 & ~kzByteMask) != 0x80) - return -1; - lnUnicode += chsUtf8 & kzByteMask; - // fall through - case 4: - lnUnicode <<= kzUtf8ByteShift; - chsUtf8 = *rgchUtf8++ & 0xFF; - if ((chsUtf8 & ~kzByteMask) != 0x80) - return -1; - lnUnicode += chsUtf8 & kzByteMask; - // fall through - case 3: - lnUnicode <<= kzUtf8ByteShift; - chsUtf8 = *rgchUtf8++ & 0xFF; - if ((chsUtf8 & ~kzByteMask) != 0x80) - return -1; - lnUnicode += chsUtf8 & kzByteMask; - // fall through - case 2: - lnUnicode <<= kzUtf8ByteShift; - chsUtf8 = *rgchUtf8++ & 0xFF; - if ((chsUtf8 & ~kzByteMask) != 0x80) - return -1; - lnUnicode += chsUtf8 & kzByteMask; - // fall through - case 1: - lnUnicode <<= kzUtf8ByteShift; - chsUtf8 = *rgchUtf8++ & 0xFF; - if ((chsUtf8 & ~kzByteMask) != 0x80) - return -1; - lnUnicode += chsUtf8 & kzByteMask; - break; - case 0: - // already handled - break; - default: - Assert(false); - } - if ((unsigned long)lnUnicode > kzUnicodeMax) - { - return -1; - } - *pcbOut = cbExtra + 1; - return lnUnicode; -} - -/*---------------------------------------------------------------------------------------------- - Get the current feature values and character properties from the stream. -----------------------------------------------------------------------------------------------*/ -void GrCharStream::CurrentFeatures(GrTableManager * ptman, GrFeatureValues * pfval) -{ - if (m_ichrRunOffset == kPosInfinity) - { - // Not yet set up. - if (AtEnd()) - { - // Empty stream; no valid values. - Assert(false); - return; - } - - // Get the settings from the first character. - int ichrSegOffset; - int ichrPosSave = m_ichrPos; - int ichrRunOffsetSave = m_ichrRunOffset; - int ichlRunOffsetSave = m_ichlRunOffset; - int cMapSize = m_vislotNextChunkMap.size(); - int cchrConsumed; - NextGet(ptman, pfval, &ichrSegOffset, &cchrConsumed); - // Put the character back. - m_ichrPos = ichrPosSave; - m_ichrRunOffset = ichrRunOffsetSave; - m_ichlRunOffset = ichlRunOffsetSave; - while (signed(m_vislotNextChunkMap.size()) > cMapSize) - m_vislotNextChunkMap.pop_back(); - } - else - { - *pfval = m_fvalRunFeats; - //*ppchrp = &m_chrpRun; - } -} - -/*---------------------------------------------------------------------------------------------- - Read the feature settings from the text properties. - - Eventually, handle style index here? -----------------------------------------------------------------------------------------------*/ -void GrCharStream::SetUpFeatureValues(GrTableManager * ptman, int ichr) -{ - // Set all the features to their default values. - for (int i = 0; i < kMaxFeatures; ++i) - { - m_fvalRunFeats.m_rgnFValues[i] = ptman->DefaultForFeatureAt(i); - } - m_fvalRunFeats.m_nStyleIndex = 0; - - // Add in the defaults for the language of the text. - std::vector vnFeats; - std::vector vnValues; - isocode lgcode = m_pgts->getLanguage(ichr); - ptman->DefaultsForLanguage(lgcode, vnFeats, vnValues); - size_t ifeatLp; - int ifeat; - for (ifeatLp = 0; ifeatLp < vnFeats.size(); ifeatLp++) - { - ptman->FeatureWithID(vnFeats[ifeatLp], &ifeat); - m_fvalRunFeats.m_rgnFValues[ifeat] = vnValues[ifeatLp]; - } - - // Add in the explicit feature settings. - FeatureSetting rgfset[kMaxFeatures]; - int cfeat = m_pgts->getFontFeatures(ichr, rgfset); - - for (ifeatLp = 0; ifeatLp < (size_t)cfeat; ifeatLp++) - { - ptman->FeatureWithID(rgfset[ifeatLp].id, &ifeat); - if (ifeat >= 0) - m_fvalRunFeats.m_rgnFValues[ifeat] = rgfset[ifeatLp].value; - } -} - -} // namespace gr diff --git a/Build/source/libs/graphite/engine-2.3.1/src/segment/GrCharStream.h b/Build/source/libs/graphite/engine-2.3.1/src/segment/GrCharStream.h deleted file mode 100644 index bb91cf54eba..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/src/segment/GrCharStream.h +++ /dev/null @@ -1,183 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 1999, 2001 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: GrCharStream.h -Responsibility: Sharon Correll -Last reviewed: Not yet. - -Description: - - -----------------------------------------------------------------------------------------------*/ -#ifdef _MSC_VER -#pragma once -#endif -#ifndef GR_CHARSTREAM_INCLUDED -#define GR_CHARSTREAM_INCLUDED - -//:End Ignore - -namespace gr -{ - -/*---------------------------------------------------------------------------------------------- - Makes a stream out of a text string that is serving as input to the process. - - Hungarian: chstrm -----------------------------------------------------------------------------------------------*/ -class GrCharStream -{ -public: - // Constructor and destructor: - GrCharStream(ITextSource * pgts, int ichrMin, int ichrLim, - bool fStartLine, bool fEndLine); - - ~GrCharStream() - { - if (m_cchlRunMax >= 0) - delete[] m_prgchlRunText; - } - - // Getters: - ITextSource * TextSrc() { return m_pgts; } - int Min() { return m_ichrMin; } - int Pos() { return m_ichrPos; } - int Lim() { return m_ichrLim; } - bool StartLine() { return m_fStartLine; } - bool EndLine() { return m_fEndLine; } - - // offset from the beginning of the segment - int SegOffset() { return m_ichrPos - m_ichrMin; } - int SegOffset(int ichr) { return ichr - m_ichrMin; } - - bool AtEnd() - { - return (m_ichrPos >= m_ichrLim); - } - - // The input string is empty. - bool IsEmpty() - { - return (m_ichrLim - m_ichrMin == 0); - } - - // When we are restarting in order to create a segment other than the first, - // back up the position in the stream slightly in order to reprocess a few characters - // before the line-break. - void Backup(int cchrToReprocess) - { - Assert(m_ichrPos >= cchrToReprocess); - m_ichrPos -= cchrToReprocess; - m_ichrRunOffset = kPosInfinity; - m_cchrBackedUp = cchrToReprocess; - } - - // When we found a hard-break in the input stream, we need to put it back, and since - // we're done, we set the end of the stream to that position. - void HitHardBreak() - { - m_ichrPos -= 1; - m_ichrRunOffset -= 1; - m_ichrLim = m_ichrPos; - } - - void Restart(); - - int NextGet(GrTableManager *, GrFeatureValues * pfval, int * ichrSegOffset, int * pcchr); - - void CurrentFeatures(GrTableManager * ptman, GrFeatureValues * pfval); - - // For transduction logging: - int GetLogData(GrTableManager * ptman, int * rgnChars, bool * rgfNewRun, - GrFeatureValues * rgfval, int cchwBackup, - int * pcchwMaxRaw); - void GetLogDataRaw(GrTableManager * ptman, int cchw, int cchwBackup, - int cchwMax16bit, int * prgnChars, - utf16 * prgchw2, utf16 * prgchw3, utf16 * prgchw4, utf16 * prgchw5, utf16 * prgchw6, - int * prgichwRaw); - -protected: - void SetUpFeatureValues(GrTableManager * ptman, int ichr); -public: - static utf32 Utf8ToUtf32(utf8 * prgchs8bit, int cchs, int * pcchsUsed); - static utf32 Utf16ToUtf32(utf16 * prgchw16bit, int cchw, int * pcchwUsed); - bool AtUnicodeCharBoundary(int cchr) - { - return AtUnicodeCharBoundary(m_pgts, cchr); - } - static bool AtUnicodeCharBoundary(ITextSource * pgts, int ichr); - static bool AtUnicodeCharBoundary(utf8 * prgchs, int cchs, int ichs, UtfType utf); - static bool AtUnicodeCharBoundary(utf16 * prgchw, int cchw, int ichr, UtfType utf); - static bool FromSurrogatePair(utf16 chwIn1, utf16 chwIn2, unsigned int * pch32Out); - static long DecodeUtf8(const utf8 * rgchUtf8, int cchUtf8, int * pcbOut); - -protected: - // Instance variables: - // Hungarian note: chr = raw characters, chl = long characters (UTF-32) - // chs = short characters (UTF-8), chw = wide characters (UTF-16) - ITextSource * m_pgts; // string to render - UtfType m_utf; // what encoding form the text-source uses - int m_ichrMin; // official start of segment relative to beginning of string - int m_ichrLim; // end of stream (potential end of seg) relative to beginning of string - int m_ichrPos; // stream position (0 = start of string) - bool m_fStartLine; // true if a line-break character should be prepended - bool m_fEndLine; // true if a line-break character should be appended - int m_cchrBackedUp; // number of characters backed up before beginning of segment - - // We read a run's worth of data at a time and cache it in the following variables: - int m_cchlRunMax; // size of buffer allocated - int * m_prgchlRunText; // buffer containing current run - int m_ichrRunMin; // start of run relative to beginning of string - int m_ichrRunLim; // end of run relative to beginning of string - int m_ichlRunOffset; // index into m_prgchlRunText; kPosInfinity if nothing set up - int m_ichrRunOffset; // corresponding index into text source - GrFeatureValues m_fvalRunFeats; - - std::vector m_vislotNextChunkMap; // maps from 16-bit chars to 32-bit chars & glyphs - - enum - { - kzUtf8Mask1 = 0x7F, - kzUtf8Mask2 = 0x1F, - kzUtf8Mask3 = 0x0F, - kzUtf8Mask4 = 0x07, - kzUtf8Mask5 = 0x03, - kzUtf8Mask6 = 0x01 - }; - - enum - { - kzUtf8Flag1 = 0x00, - kzUtf8Flag2 = 0xC0, - kzUtf8Flag3 = 0xE0, - kzUtf8Flag4 = 0xF0, - kzUtf8Flag5 = 0xF8, - kzUtf8Flag6 = 0xFC - }; - - enum - { - kzByteMask = 0x3F, - kzByteMark = 0x80, - kzUtf8ByteShift = 6, - kzUnicodeMax = 0x7FFFFFFF - }; - - enum - { - kzUtf16Shift = 10, - kzUtf16Inc = 0x2400, - kzUtf16HighFirst = 0xD800, - kzUtf16HighLast = 0xDBFF, - kzUtf16LowFirst = 0xDC00, - kzUtf16LowLast = 0xDFFF - }; -}; - -} // namespace gr - -#endif // !GR_CHARSTREAM_INCLUDED - diff --git a/Build/source/libs/graphite/engine-2.3.1/src/segment/GrClassTable.cpp b/Build/source/libs/graphite/engine-2.3.1/src/segment/GrClassTable.cpp deleted file mode 100644 index 43316fdc04a..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/src/segment/GrClassTable.cpp +++ /dev/null @@ -1,382 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 1999, 2001 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: GrClassTable.cpp -Responsibility: Sharon Correll -Last reviewed: Not yet. - -Description: - Implements the GrClassTable class and related classes. -----------------------------------------------------------------------------------------------*/ - -//:>******************************************************************************************** -//:> Include files -//:>******************************************************************************************** -#include "Main.h" - -#ifdef _MSC_VER -#pragma hdrstop -#endif -#undef THIS_FILE -DEFINE_THIS_FILE - -//:End Ignore - -//:>******************************************************************************************** -//:> Forward declarations -//:>******************************************************************************************** - -//:>******************************************************************************************** -//:> Local Constants and static variables -//:>******************************************************************************************** - -namespace gr -{ - -//:>******************************************************************************************** -//:> Methods -//:>******************************************************************************************** - -/*---------------------------------------------------------------------------------------------- - Fill in by reading from the file stream. -----------------------------------------------------------------------------------------------*/ -bool GrClassTable::ReadFromFont(GrIStream & grstrm, int fxdVersion) -{ - long lClassMapStart; - grstrm.GetPositionInFont(&lClassMapStart); - - // number of classes - m_ccls = grstrm.ReadUShortFromFont(); - if (m_ccls >= kMaxReplcmtClasses) - return false; // bad table - if (fxdVersion < 0x00030000 && m_ccls > kMaxReplcmtClassesV1_2) - return false; // bad table - - // number of linear classes - m_cclsLinear = grstrm.ReadUShortFromFont(); - if (m_cclsLinear > m_ccls) - return false; // bad table - - // class offsets - m_prgichwOffsets = new data16[m_ccls + 1]; - gAssert(m_prgichwOffsets); - if (!m_prgichwOffsets) - return false; // bad table - - data16 * pchw = m_prgichwOffsets; - int icls; - for (icls = 0; icls <= m_ccls; icls++, pchw++) - { - *pchw = grstrm.ReadUShortFromFont(); - } - - // Offsets are relative to the start class map; make them relative to the class list - // itself, and in terms of utf16s, not bytes. - long lClassesPos; - grstrm.GetPositionInFont(&lClassesPos); - int cbDiff = lClassesPos - lClassMapStart; - for (icls = 0; icls <= m_ccls; icls++) - { - m_prgichwOffsets[icls] = data16(int(m_prgichwOffsets[icls]) - cbDiff); - gAssert((m_prgichwOffsets[icls] & 0x00000001) == 0); - if ((m_prgichwOffsets[icls] & 0x00000001) != 0) - return false; // bad table - m_prgichwOffsets[icls] >>= 1; // divide by 2 - } - - // classes - slurp entire block (data remains in big-endian format) - m_prgchwBIGGlyphList = new data16[m_prgichwOffsets[m_ccls]]; - gAssert(m_prgchwBIGGlyphList); - if (!m_prgchwBIGGlyphList) - return false; // bad table - grstrm.ReadBlockFromFont(m_prgchwBIGGlyphList, - m_prgichwOffsets[m_ccls] * isizeof(data16)); - - return true; -} - -/*---------------------------------------------------------------------------------------------- - Set up an empty class table. -----------------------------------------------------------------------------------------------*/ -void GrClassTable::CreateEmpty() -{ - // number of classes - m_ccls = 0; - // number of linear classes - m_cclsLinear = 0; -} - -/*---------------------------------------------------------------------------------------------- - Search for the glyph ID using a fast binary search, and return the matching index. -----------------------------------------------------------------------------------------------*/ -int GrInputClass::FindIndex(gid16 gid) -{ - int digixInit = InitialSearchRange(); - int igixStart = StartSearch(); -#ifdef _DEBUG - int cgix = NumberOfGlyphs(); - int nPowerOf2 = 1; - while (nPowerOf2 <= cgix) - nPowerOf2 <<= 1; - nPowerOf2 >>= 1; - // Now nPowerOf2 is the max power of 2 <= cgix - gAssert((1 << LoopCount()) == nPowerOf2); // LoopCount() == log2(nPowerOf2) - gAssert(digixInit == nPowerOf2); - gAssert(igixStart == cgix - digixInit); -#endif // _DEBUG - - int digixCurr = digixInit; - - GrGlyphIndexPair * pgixCurr = m_pgixFirst + igixStart; - while (digixCurr > 0) - { - int nTest; - if (pgixCurr < m_pgixFirst) - nTest = -1; - else - nTest = pgixCurr->GlyphID() - gid; - - if (nTest == 0) - return pgixCurr->Index(); - - digixCurr >>= 1; // divide by 2 - if (nTest < 0) - pgixCurr += digixCurr; - else // (nTest > 0) - pgixCurr -= digixCurr; - } - - return -1; -} - -/*---------------------------------------------------------------------------------------------- - Return the selector index for the given glyph ID. -----------------------------------------------------------------------------------------------*/ -int GrClassTable::FindIndex(int icls, gid16 chwGlyphID) -{ - if (icls >= m_ccls) - { - gAssert(false); // bad compiler problem - return 0; - } - - if (icls < m_cclsLinear) - { - // The class is an output class--uses linear format--and is being used as an - // input class. Shouldn't happen if the compiler is working right. - gAssert(false); // comment out for test procedures - - // Do a slow linear search to find the glyph ID. - int ichwMin = m_prgichwOffsets[icls]; - int ichwLim = m_prgichwOffsets[icls+1]; - int cchw = ichwLim - ichwMin; - - for (int ichw = 0; ichw < cchw; ichw++) - { - if (GlyphAt(ichwMin + ichw) == chwGlyphID) - return ichw; - } - return -1; - } - - // Slurp the class into an instance so we can see what's there. - GrInputClass clsin; - int ichwMin = m_prgichwOffsets[icls]; - int ichwLim = m_prgichwOffsets[icls+1]; - clsin.CopyFrom(GlyphListLoc(ichwMin), (ichwLim - ichwMin)); - - // Do a fast binary search to find our glyph. - int iRet = clsin.FindIndex(chwGlyphID); - return iRet; -} - -/*---------------------------------------------------------------------------------------------- - Return the glyph ID at the selector index. -----------------------------------------------------------------------------------------------*/ -gid16 GrClassTable::GetGlyphID(int icls, int ichw) -{ - if (ichw < 0) - { - gAssert(false); - return 0; - } - - if (icls >= m_cclsLinear) - { - // The class is an input class--sorted by glyph ID--and is being used as an - // output class. Shouldn't happen if the compiler is working right. - gAssert(false); // comment out for test procedures - - if (icls >= m_ccls) // bad compiler problem - return 0; - - // Do a slow linear search to find the index and answer the matching glyph. - // Slurp the class into an instance so we can see what's there. - GrInputClass clsin; - int ichwMin = m_prgichwOffsets[icls]; - int ichwLim = m_prgichwOffsets[icls+1]; - clsin.CopyFrom(GlyphListLoc(ichwMin), (ichwLim - ichwMin)); - - int cgix = clsin.NumberOfGlyphs(); - for (int igix = 0; igix < cgix; igix++) - { - GrGlyphIndexPair * m_pgix = clsin.m_pgixFirst + igix; - if (m_pgix->Index() == ichw) - return m_pgix->GlyphID(); - } - return 0; - } - - int ichwMin = m_prgichwOffsets[icls]; - int ichwLim = m_prgichwOffsets[icls+1]; - - if (ichw >= ichwLim - ichwMin) - return 0; - else - return GlyphAt(ichwMin + ichw); -} - -/*---------------------------------------------------------------------------------------------- - Return the number of glyphs in the class. -----------------------------------------------------------------------------------------------*/ -int GrClassTable::NumberOfGlyphsInClass(int icls) -{ - int ichwMin = m_prgichwOffsets[icls]; - int ichwLim = m_prgichwOffsets[icls+1]; - - if (icls >= m_cclsLinear) - { - if (icls >= m_ccls) // bad compiler problem - return 0; - - GrInputClass clsin; - clsin.CopyFrom(GlyphListLoc(ichwMin), (ichwLim - ichwMin)); - - int cgix = clsin.NumberOfGlyphs(); - return cgix; - } - else - { - gAssert(false); // this method should not be used for output classes. - return ichwLim - ichwMin; - } -} - -//:>******************************************************************************************** -//:> For test procedures -//:>******************************************************************************************** - -//:Ignore - -#ifdef OLD_TEST_STUFF -/*---------------------------------------------------------------------------------------------- - General test of class table. -----------------------------------------------------------------------------------------------*/ -void GrClassTable::SetUpTestData() -{ - m_ccls = 7; // number of classes - m_cclsLinear = 4; // number of classes in linear format - - m_prgchwBIGGlyphList = new gid16[100]; - - m_prgichwOffsets = new data16[7+1]; - - gid16 * pchw = m_prgchwBIGGlyphList; - - // Output class 0: uppercase consonants B - H - m_prgichwOffsets[0] = 0; - *pchw++ = msbf(gid16(66)); *pchw++ = msbf(utf16(67)); *pchw++ = msbf(utf16(68)); - *pchw++ = msbf(gid16(70)); *pchw++ = msbf(utf16(71)); *pchw++ = msbf(utf16(72)); - - // Output class 1: grave vowels - m_prgichwOffsets[1] = 6; - *pchw++ = msbf(gid16(192)); // A - *pchw++ = msbf(gid16(224)); // a - *pchw++ = msbf(gid16(200)); // E - *pchw++ = msbf(gid16(232)); // e - *pchw++ = msbf(gid16(204)); // I - *pchw++ = msbf(gid16(236)); // i - *pchw++ = msbf(gid16(210)); // O - *pchw++ = msbf(gid16(243)); // o - *pchw++ = msbf(gid16(217)); // U - *pchw++ = msbf(gid16(249)); // u - - // Output class 2: circumflex vowels - m_prgichwOffsets[2] = 6 + 10; - *pchw++ = msbf(gid16(194)); // A - *pchw++ = msbf(gid16(226)); // a - *pchw++ = msbf(gid16(202)); // E - *pchw++ = msbf(gid16(234)); // e - *pchw++ = msbf(gid16(206)); // I - *pchw++ = msbf(gid16(238)); // i - *pchw++ = msbf(gid16(212)); // O - *pchw++ = msbf(gid16(244)); // o - *pchw++ = msbf(gid16(219)); // U - *pchw++ = msbf(gid16(251)); // u - - // Output class 3: diaeresis vowels, uppercase - m_prgichwOffsets[3] = 16 + 10; - *pchw++ = msbf(gid16(196)); // A - *pchw++ = msbf(gid16(196)); // A - *pchw++ = msbf(gid16(203)); // E - *pchw++ = msbf(gid16(203)); // E - *pchw++ = msbf(gid16(207)); // I - *pchw++ = msbf(gid16(207)); // I - *pchw++ = msbf(gid16(214)); // O - *pchw++ = msbf(gid16(214)); // O - *pchw++ = msbf(gid16(220)); // U - *pchw++ = msbf(gid16(220)); // U - - // Input class 4: lowercase consonants b - h - m_prgichwOffsets[4] = 26 + 10; // = 36 - *pchw++ = msbf(gid16(6)); - *pchw++ = msbf(gid16(4)); *pchw++ = msbf(gid16(2)); *pchw++ = msbf(gid16(6-4)); - *pchw++ = msbf(gid16(98)); *pchw++ = msbf(gid16(0)); - *pchw++ = msbf(gid16(99)); *pchw++ = msbf(gid16(1)); - *pchw++ = msbf(gid16(100)); *pchw++ = msbf(gid16(2)); - *pchw++ = msbf(gid16(102)); *pchw++ = msbf(gid16(3)); - *pchw++ = msbf(gid16(103)); *pchw++ = msbf(gid16(4)); - *pchw++ = msbf(gid16(104)); *pchw++ = msbf(gid16(5)); - - // Input class 5: vowels - m_prgichwOffsets[5] = 36 + 4 + 6*2; // = 52 - *pchw++ = msbf(gid16(10)); - *pchw++ = msbf(gid16(8)); *pchw++ = msbf(utf16(3)); *pchw++ = msbf(utf16(10-8)); - *pchw++ = msbf(gid16(65)); *pchw++ = msbf(gid16(0)); // A - *pchw++ = msbf(gid16(69)); *pchw++ = msbf(gid16(2)); // E - *pchw++ = msbf(gid16(73)); *pchw++ = msbf(gid16(4)); // I - *pchw++ = msbf(gid16(79)); *pchw++ = msbf(gid16(6)); // O - *pchw++ = msbf(gid16(85)); *pchw++ = msbf(gid16(8)); // U - *pchw++ = msbf(gid16(97)); *pchw++ = msbf(gid16(1)); // a - *pchw++ = msbf(gid16(101)); *pchw++ = msbf(gid16(3)); // e - *pchw++ = msbf(gid16(105)); *pchw++ = msbf(gid16(5)); // i - *pchw++ = msbf(gid16(111)); *pchw++ = msbf(gid16(7)); // o - *pchw++ = msbf(gid16(117)); *pchw++ = msbf(gid16(9)); // u - - // Input class 6: acute vowels - m_prgichwOffsets[6] = 52 + 4 + 10*2; // = 76 - *pchw++ = msbf(gid16(10)); - *pchw++ = msbf(gid16(8)); *pchw++ = msbf(gid16(3)); *pchw++ = msbf(gid16(10-8)); - *pchw++ = msbf(gid16(193)); *pchw++ = msbf(gid16(0)); // A - *pchw++ = msbf(gid16(201)); *pchw++ = msbf(gid16(2)); // E - *pchw++ = msbf(gid16(205)); *pchw++ = msbf(gid16(4)); // I - *pchw++ = msbf(gid16(211)); *pchw++ = msbf(gid16(6)); // O - *pchw++ = msbf(gid16(218)); *pchw++ = msbf(gid16(8)); // U - *pchw++ = msbf(gid16(225)); *pchw++ = msbf(gid16(1)); // a - *pchw++ = msbf(gid16(233)); *pchw++ = msbf(gid16(3)); // e - *pchw++ = msbf(gid16(237)); *pchw++ = msbf(gid16(5)); // i - *pchw++ = msbf(gid16(243)); *pchw++ = msbf(gid16(7)); // o - *pchw++ = msbf(gid16(250)); *pchw++ = msbf(gid16(9)); // u - - m_prgichwOffsets[7] = 76 + 4 + 10*2; // = 100 -}; - -#endif // OLD_TEST_STUFF - -} // namespace gr - -//:End Ignore - diff --git a/Build/source/libs/graphite/engine-2.3.1/src/segment/GrClassTable.h b/Build/source/libs/graphite/engine-2.3.1/src/segment/GrClassTable.h deleted file mode 100644 index 67d6940862c..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/src/segment/GrClassTable.h +++ /dev/null @@ -1,188 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 1999, 2001 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: GrClassTable.h -Responsibility: Sharon Correll -Last reviewed: Not yet. - -Description: - The GrClassTable and related classes that store the classes that are used in substitutions. -----------------------------------------------------------------------------------------------*/ -#ifdef _MSC_VER -#pragma once -#endif -#ifndef GR_CTABLE_INCLUDED -#define GR_CTABLE_INCLUDED - -//:End Ignore - -namespace gr -{ - -/*---------------------------------------------------------------------------------------------- - A glyph ID / index pair, a member of the GrInputClass where the items are sorted - by glyph ID. - - Hungarian: gix -----------------------------------------------------------------------------------------------*/ -class GrGlyphIndexPair -{ - friend class GrInputClass; - friend class GrClassTable; - - gid16 GlyphID() { return lsbf(m_gidBIG); } - data16 Index() { return lsbf(m_nBIGIndex); } - - gid16 m_gidBIG; - data16 m_nBIGIndex; -}; - -/*---------------------------------------------------------------------------------------------- - A class consisting of a mapping from glyph ID to index, used for classes that - function as input classes (eg, occurrng in the left-hand side of a rule). - - Hungarian: clsin -----------------------------------------------------------------------------------------------*/ -class GrInputClass -{ - friend class GrClassTable; - -protected: - /*------------------------------------------------------------------------------------------ - Copy the raw memory into the instance. - ------------------------------------------------------------------------------------------*/ - void CopyFrom(data16 * pchwStart, int cchw) - { - m_cgixBIG = pchwStart[0]; - m_digixBIGInit = pchwStart[1]; - m_cBIGLoop = pchwStart[2]; - m_igixBIGStart = pchwStart[3]; - - int cgix = NumberOfGlyphs(); - m_pgixFirst = m_prggixBuffer; - if (cgix > 64) - { - m_vgix.resize(cgix); - m_pgixFirst = &m_vgix[0]; - } - gAssert((4 + (cgix * 2)) == cchw); - #ifdef _DEBUG - memset(m_pgixFirst, 0, cgix * isizeof(GrGlyphIndexPair)); - #endif - Assert(sizeof(GrGlyphIndexPair) == sizeof(gid16) + sizeof(data16)); - GrGlyphIndexPair * pgixStart = reinterpret_cast(pchwStart + 4); - std::copy(pgixStart, pgixStart + cgix, m_pgixFirst); - } - - int NumberOfGlyphs() { return lsbf(m_cgixBIG); } - int LoopCount() { return lsbf(m_cBIGLoop); } - int InitialSearchRange() { return lsbf(m_digixBIGInit); } - int StartSearch() { return lsbf(m_igixBIGStart); } - - int FindIndex(gid16 gid); - -protected: - // Instance variables: - data16 m_cgixBIG; // number of glyphs in the class - - // constants for fast binary search - data16 m_digixBIGInit; // (max power of 2 <= m_cgix); - // size of initial range to consider - data16 m_cBIGLoop; // log2(max power of 2 <= m_cgix); - // indicates how many iterations are necessary - data16 m_igixBIGStart; // m_cgix - m_digixInit; - // where to start search - - GrGlyphIndexPair m_prggixBuffer[64]; - std::vector m_vgix; - GrGlyphIndexPair * m_pgixFirst; -}; - - -/*---------------------------------------------------------------------------------------------- - Contains all the classes used for substitution rules. - - Hungarian: ctbl -----------------------------------------------------------------------------------------------*/ - -class GrClassTable -{ - friend class FontMemoryUsage; - -public: - // Constructor & destructor: - GrClassTable() - : m_prgichwOffsets(NULL), - m_prgchwBIGGlyphList(NULL) - { - } - - ~GrClassTable() - { - delete[] m_prgichwOffsets; - delete[] m_prgchwBIGGlyphList; - } - - int NumberOfClasses() { return m_ccls; } - int NumberOfInputClasses() { return m_ccls - m_cclsLinear; } - int NumberOfOutputClasses() { return m_cclsLinear; } - - bool ReadFromFont(GrIStream & grstrm, int fxdVersion); - void CreateEmpty(); - - int FindIndex(int icls, gid16 chwGlyphID); - gid16 GetGlyphID(int icls, int ichw); - int NumberOfGlyphsInClass(int icls); - - gid16 GlyphAt(int ichw) - { - return lsbf(m_prgchwBIGGlyphList[ichw]); - } - data16 * GlyphListLoc(int ichw) - { - return m_prgchwBIGGlyphList + ichw; - } - -protected: - // Instance variables: - int m_ccls; // number of classes - int m_cclsLinear; // number of classes in linear format - - data16 * m_prgichwOffsets; - - // Two formats are included in the following array: the first section consists of - // flat ordered lists of glyphs, used for the "output" classes that use linear format. - // This provides an index-to-glyph mapping. - // The second section contains data in the format of GrInputClasses, used for "input" - // classes that need a binary-search format. This provides a glyph-to-index mapping. - // We don't create instances of GrInputClasses, because that would make reading - // from the ECF file slow. Instead we just set up a single instance at the time - // we're interested in it. - // NOTE that all this data has been slurped directly from the ECF file and therefore - // uses BIG-ENDIAN format. - gid16 * m_prgchwBIGGlyphList; - -//:Ignore -#ifdef OLD_TEST_STUFF -public: - // For test procedures: - void SetUpTestData(); - void SetUpRuleActionTest(); - void SetUpRuleAction2Test(); - void SetUpAssocTest(); - void SetUpAssoc2Test(); - void SetUpDefaultAssocTest(); - void SetUpFeatureTest(); - void SetUpLigatureTest(); - void SetUpLigature2Test(); -#endif // OLD_TEST_STUFF -//:End Ignore -}; - -} // namespace gr - -#endif // !GR_CTABLE_INCLUDED - diff --git a/Build/source/libs/graphite/engine-2.3.1/src/segment/GrEngine.cpp b/Build/source/libs/graphite/engine-2.3.1/src/segment/GrEngine.cpp deleted file mode 100644 index 91db0dfb80a..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/src/segment/GrEngine.cpp +++ /dev/null @@ -1,2031 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 1999, 2001 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: GrEngine.cpp -Responsibility: Sharon Correll -Last reviewed: Not yet. - -Description: Contains the implementation of the GrEngine class. -----------------------------------------------------------------------------------------------*/ - -//:>******************************************************************************************** -//:> Include files -//:>******************************************************************************************** -#include "Main.h" -#include -#include -#ifdef _MSC_VER -#pragma hdrstop -#endif -// any other headers (not precompiled) - -#undef THIS_FILE -DEFINE_THIS_FILE - -//:End Ignore - -namespace gr -{ - -//:>******************************************************************************************** -//:> Forward declarations -//:>******************************************************************************************** - -//:>******************************************************************************************** -//:> Local Constants and static variables -//:>******************************************************************************************** - - -//:>******************************************************************************************** -//:> General functions -//:>******************************************************************************************** - -bool compareCmap(const byte *lhs, const byte *rhs) -{ - using namespace gr; - - typedef const struct index {data16 version; data16 numberSubtables;} *const IndexPtr; - typedef const struct enc {data16 platID; data16 platSpecID; data32 offset;} *const EncPtr; - - // Calculate the size of the cmap. - - IndexPtr rhsIndex = IndexPtr(rhs); - size_t numSubTbl = lsbf(rhsIndex->numberSubtables); - size_t cbCmapSz = sizeof(index) + sizeof(enc) * numSubTbl; - EncPtr encTbl = EncPtr(rhs + sizeof(index)); - - for (size_t iSubTbl = 0; iSubTbl < numSubTbl; iSubTbl++) - //for (int iSubTbl = numSubTbl - 1; iSubTbl >= 0; --iSubTbl) - { - const data16 *const mapTbl = reinterpret_cast(rhs + lsbf((int)encTbl[iSubTbl].offset)); - int format = lsbf(*mapTbl); - switch (format) - { - // 16-bit lengths - case 0: - case 2: - case 4: - case 6: - cbCmapSz += lsbf((data16)unsigned(mapTbl[1])); - break; - // 32-bit lengths - case 8: - case 10: - case 12: - cbCmapSz += lsbf((int)unsigned(reinterpret_cast(mapTbl)[1])); - break; - default: - Assert(false); - } - } - - // Do the comparison. - return (memcmp(lhs, rhs, cbCmapSz) ? false : true); -} - - -//:>******************************************************************************************** -//:> GrEngine class. -//:>******************************************************************************************** - -GrEngine::GrEngine() -{ - /////////////_CrtSetDbgFlag(_CRTDBG_CHECK_ALWAYS_DF); //////////////// - - - m_cref = 1; - BasicInit(); -} - -void GrEngine::BasicInit() -{ - m_pfface = NULL; - - m_ptman = NULL; - m_pctbl = NULL; - m_pgtbl = NULL; - m_prgpsd = NULL; - m_cpsd = 0; - m_cfeat = 0; - m_mFontEmUnits = -1; - m_dysOffset = 0; - - ////m_tbufCmap.reset(); - m_pCmap_3_1 = NULL; - m_pCmap_3_10 = NULL; - ////m_tbufNameTbl.reset(); - // new interface stuff: - m_pCmapTbl = NULL; - m_pNameTbl = NULL; - m_fCmapTblCopy = false; - m_fNameTblCopy = false; - - m_fLogXductn = false; - - m_resFontValid = kresInvalidArg; // not yet initialized - m_ferr = kferrUninitialized; - m_fxdBadVersion = 0; - - m_fSmartReg = false; - m_fSmartBold = false; - m_fSmartItalic = false; - m_fSmartBI = false; - m_fFakeItalicCache = false; - m_fFakeBICache = false; - m_strCtrlFileReg.erase(); - m_strCtrlFileBold.erase(); - m_strCtrlFileItalic.erase(); - m_strCtrlFileBI.erase(); - m_fFakeItalic = false; - m_stuCtrlFile.erase(); - m_stuInitError.erase(); - m_stuErrCtrlFile.erase(); - m_stuFaceName.erase(); - m_stuBaseFaceName.erase(); - m_fUseSepBase = false; - m_stuFeatures.erase(); - - m_nFontCheckSum = 0; - - m_fInErrorState = false; - - m_rglcidFeatLabelLangs = NULL; // initialize lazily, when needed - m_clcidFeatLabelLangs = 0; -} - -GrEngine::~GrEngine() -{ - DestroyEverything(); - #ifdef _MSC_VER - if (!_CrtCheckMemory()) - { - OutputDebugString(L"bad memory"); - } - #endif -} - -/*---------------------------------------------------------------------------------------------- - Clean everything out (destructor or reinitializing with a different face name). -----------------------------------------------------------------------------------------------*/ -void GrEngine::DestroyEverything() -{ - DestroyContents(); - #ifdef _MSC_VER - if (!_CrtCheckMemory()) - { - OutputDebugString(L"bad memory"); - } - #endif - - m_strCtrlFileReg.erase(); - m_strCtrlFileBold.erase(); - m_strCtrlFileItalic.erase(); - m_strCtrlFileBI.erase(); - m_fSmartReg = false; - m_fSmartBold = false; - m_fSmartItalic = false; - m_fSmartBI = false; - m_fFakeItalicCache = false; - m_fFakeBICache = false; - m_stuBaseFaceName.erase(); - - //m_stuFaceName.erase(); - //m_stuFaceName = L"this is not a usable or valid string"; - m_fUseSepBase = false; - m_stuFeatures.erase(); -} - -void GrEngine::DestroyContents(bool fDestroyCmap) -{ - if (fDestroyCmap) - { - ////m_tbufCmap.reset(); - m_pCmap_3_1 = NULL; - m_pCmap_3_10 = NULL; - - if (m_fCmapTblCopy) - delete[] m_pCmapTbl; - if (m_fNameTblCopy) - delete[] m_pNameTbl; - m_pCmapTbl = NULL; - m_pNameTbl = NULL; - m_fCmapTblCopy = false; - m_fNameTblCopy = false; - } - - delete m_ptman; - delete m_pctbl; - delete m_pgtbl; - delete[] m_prgpsd; - m_ptman = NULL; - m_pctbl = NULL; - m_pgtbl = NULL; - m_prgpsd = NULL; - - ////m_tbufNameTbl.reset(); - - m_stuCtrlFile.erase(); - m_stuInitError.erase(); - - m_resFontValid = kresInvalidArg; - m_ferr = kferrUninitialized; -} - -/*---------------------------------------------------------------------------------------------- - For FontFace: return the number of features. -----------------------------------------------------------------------------------------------*/ -size_t GrEngine::NumberOfFeatures_ff() -{ - return (size_t)m_cfeat; -} - -/*---------------------------------------------------------------------------------------------- - For FontFace: return the feature ID for the ifeat-th feature. -----------------------------------------------------------------------------------------------*/ -featid GrEngine::FeatureID_ff(size_t ifeat) -{ - return (featid)m_rgfeat[ifeat].ID(); -} - -/*---------------------------------------------------------------------------------------------- - For FontFace: return the index of the feature with the given ID. -----------------------------------------------------------------------------------------------*/ -size_t GrEngine::FeatureWithID_ff(featid fid) -{ - int ifeatRet; - /* GrFeature * pfeat = */ - FeatureWithID(fid, &ifeatRet); - return (size_t)ifeatRet; -} - -/*---------------------------------------------------------------------------------------------- - For FontFace: return the label for the ifeat-th feature. -----------------------------------------------------------------------------------------------*/ -bool GrEngine::GetFeatureLabel_ff(size_t ifeat, lgid nLanguage, utf16 * rgchwLabel) -{ - std::wstring stu = m_rgfeat[ifeat].Label(this, nLanguage); - - int cch = stu.size(); - cch = min(cch, 127); // 1 char for zero-termination - std::copy(stu.data(), stu.data() + cch, rgchwLabel); - rgchwLabel[cch] = 0; - - return (cch > 0); -} - -/*---------------------------------------------------------------------------------------------- - For FontFace: return the index of the default setting. Return -1 if it cannot be found. -----------------------------------------------------------------------------------------------*/ -int GrEngine::GetFeatureDefault_ff(size_t ifeat) -{ - GrFeature * pfeat = m_rgfeat + ifeat; - int defaultValue = pfeat->DefaultValue(); - int cfset = pfeat->NumberOfSettings(); - int rgnSettings[100]; - pfeat->Settings(100, rgnSettings); - Assert(cfset < 100); // TODO: improve this - for (int ifset = 0; ifset < cfset; ifset++) - { - if (rgnSettings[ifset] == defaultValue) - return ifset; - } - return -1; -} - -/*---------------------------------------------------------------------------------------------- - For FontFace: return the number of settings for the ifeat-th feature. -----------------------------------------------------------------------------------------------*/ -size_t GrEngine::NumberOfSettings_ff(size_t ifeat) -{ - return m_rgfeat[ifeat].NumberOfSettings(); -} - -/*---------------------------------------------------------------------------------------------- - For FontFace: return the value of the ifset-th setting for the ifeat-th feature. -----------------------------------------------------------------------------------------------*/ -int GrEngine::GetFeatureSettingValue_ff(size_t ifeat, size_t ifset) -{ - return m_rgfeat[ifeat].NthSetting(ifset); -} - -/*---------------------------------------------------------------------------------------------- - For FontFace: return the UI label for the given feature setting. -----------------------------------------------------------------------------------------------*/ -bool GrEngine::GetFeatureSettingLabel_ff(size_t ifeat, size_t ifset, lgid language, - utf16 * rgchwLabel) -{ - std::wstring stu = m_rgfeat[ifeat].NthSettingLabel(this, ifset, language); - - int cch = stu.size(); - cch = min(cch, 127); // 1 char for zero-termination - // Note: the wchar_t label was originally assigned from utf16 data, so although wchar_t is - // utf32 on some platforms the conversion back to utf16 should still give correct results. - std::copy(stu.data(), stu.data() + cch, rgchwLabel); - rgchwLabel[cch] = 0; - - return (cch > 0); -} - -/*---------------------------------------------------------------------------------------------- - For FontFace: return the number of languages that are possible among the feature labels. -----------------------------------------------------------------------------------------------*/ -size_t GrEngine::NumberOfFeatLangs_ff() -{ - SetUpFeatLangList(); - return m_clcidFeatLabelLangs; -} - -/*---------------------------------------------------------------------------------------------- - For FontFace: return the language LCID for the feature-label language with the given index. -----------------------------------------------------------------------------------------------*/ -short GrEngine::GetFeatLabelLang_ff(size_t ilang) -{ - SetUpFeatLangList(); - return m_rglcidFeatLabelLangs[ilang]; -} - -/*---------------------------------------------------------------------------------------------- - For FontFace: return the number of supported languages. -----------------------------------------------------------------------------------------------*/ -size_t GrEngine::NumberOfLanguages_ff() -{ - return (size_t)m_langtbl.NumberOfLanguages(); -} - -/*---------------------------------------------------------------------------------------------- - For FontFace: return the language code for the language with the given index. -----------------------------------------------------------------------------------------------*/ -isocode GrEngine::GetLanguageCode_ff(size_t ilang) -{ - return m_langtbl.LanguageCode(ilang); -} - -/*---------------------------------------------------------------------------------------------- - Set up the list of all the languages that are present in the feature labels. -----------------------------------------------------------------------------------------------*/ -void GrEngine::SetUpFeatLangList() -{ - if (m_rglcidFeatLabelLangs) - return; - - int rgnNameIDs[kMaxFeatures]; - for (int ifeat = 0; ifeat < m_cfeat; ifeat++) - rgnNameIDs[ifeat] = m_rgfeat[ifeat].NameId(); - short rglcid[128]; // 128 is the number expected by TtfUtil::GetLangsForNames - m_clcidFeatLabelLangs = TtfUtil::GetLangsForNames(m_pNameTbl, 3, 1, rgnNameIDs, m_cfeat, rglcid); - m_rglcidFeatLabelLangs = new short[m_clcidFeatLabelLangs]; - memcpy(m_rglcidFeatLabelLangs, rglcid, sizeof(short) * m_clcidFeatLabelLangs); -} - -/*---------------------------------------------------------------------------------------------- - Return the maximum size needed for the block of data to pass between segments, that is, - to reinitialize the engine based on the results of the previously generated segment. - This value must match what is in GrTableManager::InitializeStreams() and - InitializeForNextSeg(). 256 is an absolute maximum imposed by the interface. - - In Graphite, what this block of data will contain is information about cross-line - contextualization and some directionality information. - - Assumes InitNew() has already been called to set the font name. -----------------------------------------------------------------------------------------------*/ -GrResult GrEngine::get_SegDatMaxLength(int * pcb) -{ - ChkGrOutPtr(pcb); - - if (m_resFontValid == kresInvalidArg) - ReturnResult(kresUnexpected); // engine not initialized - - GrResult res = m_resFontValid; - if (m_resFontValid == kresFail || m_resFontValid == kresUnexpected || m_resFontValid == kresFalse) - res = kresOk; // invalid font - if (ResultFailed(res)) - ReturnResult(res); - - Assert(m_ptman); - if (!m_ptman) - *pcb = 256; - else - *pcb = m_ptman->NumberOfPasses() + 4; - - ReturnResult(res); -} - -/*---------------------------------------------------------------------------------------------- - @return The supported script direction(s). If more than one, the application is - responsible for choosing the most appropriate. -----------------------------------------------------------------------------------------------*/ -GrResult GrEngine::get_ScriptDirection(unsigned int * pgrfsdc, OLECHAR * prgchwErrMsg, int cchMaxErrMsg) -{ - ChkGrOutPtr(pgrfsdc); - ChkGrArrayArg(prgchwErrMsg, cchMaxErrMsg); - - if (m_resFontValid == kresInvalidArg) - ReturnResult(kresUnexpected); // engine not initialized - - GrResult res = m_resFontValid; - - *pgrfsdc = m_grfsdc; - -// ClearFontError(prgchwErrMsg, cchMaxErrMsg); -// try -// { -// if (m_resFontValid == kresFail || m_resFontValid == kresUnexpected || m_resFontValid == kresFalse) -// { -// RecordFontLoadError(prgchwErrMsg, cchMaxErrMsg); -// res = kresOk; -// } -// *pgrfsdc = m_grfsdc; -// } -// catch (Throwable & thr) -// { -// res = (GrResult)thr.Error(); -// *pgrfsdc = kfsdcHorizLtr; -// } -// catch (...) -// { -// res = WARN(kresFail); -// *pgrfsdc = kfsdcHorizLtr; -// } - - ReturnResult(res); -} - -/*---------------------------------------------------------------------------------------------- - Get an glyph attribute from the engine that will help the GrJustifier in its work. -----------------------------------------------------------------------------------------------*/ -GrResult GrEngine::getGlyphAttribute(int iGlyph, int jgat, int nLevel, float * pValueRet) -{ - return m_ptman->State()->GetGlyphAttrForJustification(iGlyph, jgat, nLevel, pValueRet); -} - -GrResult GrEngine::getGlyphAttribute(int iGlyph, int jgat, int nLevel, int * pValueRet) -{ - return m_ptman->State()->GetGlyphAttrForJustification(iGlyph, jgat, nLevel, pValueRet); -} - -/*---------------------------------------------------------------------------------------------- - Set an glyph attribute in the engine as a result of the decisions made by the - GrJustifier. -----------------------------------------------------------------------------------------------*/ -GrResult GrEngine::setGlyphAttribute(int iGlyph, int jgat, int nLevel, float value) -{ - return m_ptman->State()->SetGlyphAttrForJustification(iGlyph, jgat, nLevel, value); -} - -GrResult GrEngine::setGlyphAttribute(int iGlyph, int jgat, int nLevel, int value) -{ - return m_ptman->State()->SetGlyphAttrForJustification(iGlyph, jgat, nLevel, value); -} - -//:>******************************************************************************************** -//:> Non-FieldWorks interface methods -//:>******************************************************************************************** - -/*---------------------------------------------------------------------------------------------- - Make a complete segment that can be used to measure and do line-breaking. - - OBSOLETE - delete -----------------------------------------------------------------------------------------------*/ -/* -GrResult GrEngine::MakeMeasuredSegment( - Font * pfont, ITextSource * pgts, - int ichMin, int ichLim, - bool fParaRtl, - Segment ** ppsegRet, SegEnd * pest, - std::ostream * pstrmLog, - OLECHAR * prgchwErrMsg, int cchMaxErrMsg) -{ - int dichContext, dichLimSeg; - float dxWidth; - return MakeSegment(ksegmodeMsfr, - pfont, pgts, NULL, ichMin, ichLim, false, false, - 100000, klbClipBreak, ktwshAll, // not used - fParaRtl, - ppsegRet, &dxWidth, - 0, NULL, 0, NULL, NULL, &dichContext, // not used - pstrmLog, - prgchwErrMsg, cchMaxErrMsg, - -1, false, false, klbClipBreak, // not used - &dichLimSeg, pest, - false, 100000, kestMoreLines); // not used -} -*/ - -/*---------------------------------------------------------------------------------------------- - Make a segment from the given range, regardless of the kind of line-break that results. - - OBSOLETE - delete -----------------------------------------------------------------------------------------------*/ -/* -GrResult GrEngine::MakeSegmentFromRange( - Font * pfont, ITextSource * pgts, IGrJustifier * pgj, - int ichMin, int ichLim, - bool fStartLine, bool fEndLine, - TrWsHandling twsh, bool fParaRtl, - Segment ** ppsegRet, float * pdxWidth, SegEnd * pest, - int cbPrev, byte * pbPrevSegDat, int cbNextMax, byte * pbNextSegDat, int * pcbNextSegDat, - int * pdichwContext, - std::ostream * pstrmLog, - OLECHAR * prgchwErrMsg, int cchwMaxErrMsg) -{ - int dichLimSegBogus; - return MakeSegment(ksegmodeMsfr, pfont, pgts, pgj, - ichMin, ichLim, - fStartLine, fEndLine, - 10000, klbWordBreak, // not used - twsh, fParaRtl, - ppsegRet, pdxWidth, - //cbPrev, pbPrevSegDat, cbNextMax, pbNextSegDat, pcbNextSegDat, pdichwContext, - 0, NULL, 0, NULL, NULL, NULL, - pstrmLog, - prgchwErrMsg, cchwMaxErrMsg, - ichLim, false, false, klbClipBreak, // not used - &dichLimSegBogus, pest, - 10000, kestMoreLines); // not used -} -*/ - - -//:>******************************************************************************************** -//:> Other methods -//:>******************************************************************************************** - -/*---------------------------------------------------------------------------------------------- - Create a segment. -----------------------------------------------------------------------------------------------*/ -void GrEngine::MakeSegment( - // Common parameters - Segment * psegNew, - Font * pfont, ITextSource * pgts, IGrJustifier * pjus, - LayoutEnvironment & layout, - int ichMin, int ichLim, - // for finding a break point - float dxMaxWidth, - bool fBacktracking, - // for justification - bool fJust, float dxJustifiedWidthJ, SegEnd estJ) -{ - ChkGrArgPtr(pgts); - ChkGrArgPtrN(pjus); - ChkGrOutPtr(psegNew); - Assert(layout.bestBreak() <= layout.worstBreak()); - - if (pjus == NULL) - pjus = layout.justifier(); - - if (m_resFontValid == kresInvalidArg) - // Uninitialized. - return; // ReturnResult(kresUnexpected); - - SetCmapAndNameTables(pfont); - - int segmode = ksegmodeRange; // segment from range - if (fJust) - segmode = ksegmodeJust; // justified segment - else if (dxMaxWidth < kPosInfFloat) - segmode = ksegmodeBreak; // find break point - - // Temporary: - if (!this->m_ptman) - { - Warn("No Graphite tables"); - m_ptman = new GrTableManager(this); - CreateEmpty(); - } - - // GrResult hr = kresOk; - m_fInErrorState = false; - - bool fBold, fItalic; - GetStyles(pfont, ichMin, &fBold, &fItalic); - - GetWritingSystemDirection(pgts, ichMin); - - // Find the end of the range to render with the current font. - int nDirDepth = 0; - int ichFontLim = FindFontLim(pgts, ichMin, &nDirDepth); - int ichStrmLim = 0; - int ichSegLim = 0; - switch (segmode) - { - case ksegmodeBreak: // find break point - // Here ichLim should be the end of the text-source, unless we're backtracking. - ichStrmLim = min(ichFontLim, ichLim); - ichSegLim = -1; // unknown - break; - case ksegmodeJust: // stretching an existing segment to achieve justification - ichStrmLim = ichFontLim; - ichSegLim = ichLim; - break; - //case ksegmodeMms: // MakeMeasuredSegment - // ichLim = ichFontLim; - // ichStrmLim = ichFontLim; - // ichSegLim = -1; // process to the end of the stream - // break; - case ksegmodeRange: // segment from range - ichLim = min(ichLim, ichFontLim); - ichStrmLim = ichFontLim; - ichSegLim = (ichLim == kPosInfinity) ? -1 : ichLim; - break; - default: - Assert(false); - } - - // Initialize the graphics object with the font and character properties. - // SILE - ////if (m_fUseSepBase) - ////{ - //// Assert(m_stuBaseFaceName.size() > 0); - //// SetUpGraphics(pgg, pgts, ichMin, m_stuBaseFaceName); - ////} - ////else - //// SetUpGraphics(pgg, pgts, ichMin, m_stuFaceName); - - GrResult res = kresOk; - - Assert(m_ptman); - m_ptman->State()->SetFont(pfont); - - // Create a character stream on the text source. - GrCharStream * pchstrm = new GrCharStream(pgts, ichMin, ichStrmLim, - layout.startOfLine(), layout.endOfLine()); - - // TODO: change vertical offset to work on a character-by-character basis - m_dysOffset = (pgts->getVerticalOffset(ichMin) * pfont->getDPIy()) / 72; - - // Run the tables and get back a segment. - - bool fMoreText = false; - int ichCallerBtLim = -1; - bool fInfiniteWidth = false; - switch (segmode) - { - //case ksegmodeMms: - case ksegmodeBreak: - case ksegmodeRange: - if (segmode == ksegmodeBreak) - { - fMoreText = ((ichFontLim < ichLim) || fBacktracking); - ichCallerBtLim = (fBacktracking) ? ichLim : -1; - fInfiniteWidth = false; - } - //else if (segmode == ksegmodeMms) - //{ - // fMoreText = false; - // ichCallerBtLim = -1; - // fInfiniteWidth = true; - // Assert(twsh == ktwshAll); - //} - else if (segmode == ksegmodeRange) - { - int ichTextLim; - ichTextLim = pgts->getLength(); - fMoreText = (ichLim < ichTextLim); - ichCallerBtLim = -1; - fInfiniteWidth = true; - } - try { - m_ptman->Run(psegNew, pfont, pchstrm, pjus, - ((pjus) ? kjmodiCanShrink : kjmodiNormal), - layout, - ichSegLim, dxMaxWidth, 0, - fBacktracking, fMoreText, ichFontLim, fInfiniteWidth, false, - ichCallerBtLim, - nDirDepth, estJ); - } - catch (...) - { - // Disastrous problem in rendering. - if (!layout.dumbFallback()) - throw; // throws original exception - - // Try dumb rendering. - if (m_fUseSepBase) - SwitchGraphicsFont(true); // use the base font, which has real glyphs - - m_fInErrorState = true; - res = RunUsingEmpty(psegNew, pfont, pchstrm, layout, - ichSegLim, - dxMaxWidth, - fBacktracking, fMoreText, fInfiniteWidth, - ichCallerBtLim, - nDirDepth, estJ); - } - break; - - case ksegmodeJust: // justified segment - { - m_ptman->Run(psegNew, pfont, pchstrm, pjus, kjmodiJustify, layout, - ichSegLim, - dxJustifiedWidthJ, dxMaxWidth, - false, false, // not used - ichFontLim, - true, // infinite width - false, // kludge - -1, - nDirDepth, estJ); - //&dxWidth, &est); - Assert((ichLim - ichMin) == (psegNew->stopCharacter() - psegNew->startCharacter())); - break; - } - - default: - Assert(false); - } - - delete pchstrm; - - if (m_fUseSepBase) - SwitchGraphicsFont(false); -} - -/*---------------------------------------------------------------------------------------------- - Return an indication of whether an error happened in trying to load Graphite tables. -----------------------------------------------------------------------------------------------*/ -FontErrorCode GrEngine::IsValidForGraphite(int * pnVersion, int * pnSubVersion) -{ - if (pnVersion) - *pnVersion = m_fxdBadVersion >> 16; - if (pnSubVersion) - *pnSubVersion = m_fxdBadVersion & 0x0000FFFF; - - return m_ferr; -} - -/*---------------------------------------------------------------------------------------------- - Record a system error indicating that the font could not be loaded properly. - OBSOLETE -----------------------------------------------------------------------------------------------*/ -void GrEngine::RecordFontLoadError(OLECHAR * prgchwErrMsg, int cchMax) -{ - if (prgchwErrMsg == NULL || cchMax == 0) - return; - - std::wstring stuMessage = L"Error in initializing Graphite font \""; - stuMessage.append(m_stuFaceName); - if (m_stuErrCtrlFile.size()) - { - stuMessage.append(L"\" ("); - stuMessage.append(m_stuErrCtrlFile); - stuMessage.append(L")"); - } - else - stuMessage.append(L"\""); - if (m_stuInitError.size()) - { - stuMessage.append(L"--\n"); - stuMessage.append(m_stuInitError); - } - - std::fill_n(prgchwErrMsg, cchMax, 0); - std::copy(stuMessage.data(), stuMessage.data() + min(cchMax - 1, signed(stuMessage.size())), - prgchwErrMsg); -} - -/*---------------------------------------------------------------------------------------------- - Record a system error indicating a bad error in rendering using a supposedly valid font. - OBSOLETE -----------------------------------------------------------------------------------------------*/ -void GrEngine::RecordFontRunError(OLECHAR * prgchwErrMsg, int cchMax, GrResult res) -{ - if (prgchwErrMsg == NULL || cchMax == 0) - return; - - std::wstring stuMessage = L"Error in rendering using Graphite font \""; - stuMessage.append(m_stuFaceName); - if (m_stuErrCtrlFile.size()) - { - stuMessage.append(L"\" ("); - stuMessage.append(m_stuErrCtrlFile); - stuMessage.append(L")"); - } - else - stuMessage.append(L"\""); - - std::fill_n(prgchwErrMsg, cchMax, 0); - std::copy(stuMessage.data(), stuMessage.data() + min(cchMax - 1, signed(stuMessage.size())), - prgchwErrMsg); -} - -/*---------------------------------------------------------------------------------------------- - Initialize the font error message buffer to zero. This way we can be sure to recognize - an error condition by the fact that the buffer is non-zero. - OBSOLETE -----------------------------------------------------------------------------------------------*/ -void GrEngine::ClearFontError(OLECHAR * prgchwErrMsg, int cchMaxErrMsg) -{ - std::fill_n(prgchwErrMsg, cchMaxErrMsg, 0); -} - -/*---------------------------------------------------------------------------------------------- - Set the overall direction of the writing system based on the text properties. -----------------------------------------------------------------------------------------------*/ -void GrEngine::GetWritingSystemDirection(ITextSource * pgts, int ichwMin) -{ -#ifdef OLD_TEST_STUFF - // for test procedures: - if (m_stuInitialize == "RightToLeftLayout") - { - m_fRightToLeft = true; - return; - } -#endif // OLD_TEST_STUFF - - m_fRightToLeft = pgts->getRightToLeft(ichwMin); -} - -/*---------------------------------------------------------------------------------------------- - Find the end of the range that uses the current font. - - @param pgts - contains text to render - @param ichwMinFont - beginning of range to render with this font - @param pnDirDepth - return direction depth: 0=LTR, 1=RTL - - @return The lim of the range that could be rendered by this font. Also the direction depth. -----------------------------------------------------------------------------------------------*/ -int GrEngine::FindFontLim(ITextSource * pgts, int ichwMinFont, int * pnDirDepth) -{ - int ichwTextLen = (int)pgts->getLength(); - - int ichwLimRange; // range that can be rendered without breaking contextualization. - int ichwMinNext = ichwMinFont; - - while (true) - { - std::pair pairRange = pgts->propertyRange(ichwMinNext); - // int ichwMinRun = pairRange.first; - int ichwLimRun = pairRange.second; - *pnDirDepth = pgts->getDirectionDepth(ichwMinNext); - - //if (ichwLim > -1 && ichwLim < ichwLimRun) - //{ - // // Stopping in the middle of a run - // return ichwLim; - //} - - // We can at least go to the end of this run. - ichwLimRange = ichwLimRun; - if (ichwLimRun >= ichwTextLen) - { - // Hit the end of the text-source - return ichwLimRange; - } - else - { - // If the following run is the same as this run except for color and underlining, - // we don't have to break here. - if (!pgts->sameSegment(ichwMinNext, ichwLimRun)) - return ichwLimRange; - } - ichwMinNext = ichwLimRun; - } - - return ichwLimRange; -} - -/*---------------------------------------------------------------------------------------------- - Read the version number from the tables, and return false if any are a version this - implementation of the engine can't handle. -----------------------------------------------------------------------------------------------*/ -bool GrEngine::CheckTableVersions(GrIStream * pgrstrm, - const byte *pSilfTbl, int lSilfStart, - const byte *pGlobTbl, int lGlocStart, - const byte *pFeatTbl, int lFeatStart, - int * pfxdBadVersion) -{ - pgrstrm->OpenBuffer(pSilfTbl, isizeof(int)); - pgrstrm->SetPositionInFont(lSilfStart); - *pfxdBadVersion = ReadVersion(*pgrstrm); - pgrstrm->CloseBuffer(); - if (*pfxdBadVersion > kSilfVersion) - return false; - - pgrstrm->OpenBuffer(pGlobTbl, lGlocStart + isizeof(int)); - pgrstrm->SetPositionInFont(lGlocStart); - *pfxdBadVersion = ReadVersion(*pgrstrm); - pgrstrm->CloseBuffer(); - if (*pfxdBadVersion > kGlocVersion) - return false; - - pgrstrm->OpenBuffer(pFeatTbl, isizeof(int)); - pgrstrm->SetPositionInFont(lFeatStart); - *pfxdBadVersion = ReadVersion(*pgrstrm); - pgrstrm->CloseBuffer(); - if (*pfxdBadVersion > kFeatVersion) - return false; - - *pfxdBadVersion = 0; - return true; -} - -/*---------------------------------------------------------------------------------------------- - Reinterpret the version number from a font table. -----------------------------------------------------------------------------------------------*/ -int GrEngine::ReadVersion(GrIStream & grstrm) -{ - int fxdVersion = grstrm.ReadIntFromFont(); - - if (fxdVersion < 0x00010000) - fxdVersion = 0x00010000; // kludge for bug with which some fonts were generated - - return fxdVersion; -} - -/*---------------------------------------------------------------------------------------------- - Initialize the engine from the test file. Used for test procedures. -----------------------------------------------------------------------------------------------*/ -//:Ignore -#ifdef OLD_TEST_STUFF -void GrEngine::InitFromControlFileTest() -{ - IStreamPtr qstrm; - FileStream::Create(m_stuCtrlFile, STGM_READ, &qstrm); - - int nSilfOffset, nGlocOffset, nGlatOffset, nFeatOffset; - - nSilfOffset = ReadIntFromFont(qstrm); - nGlocOffset = ReadIntFromFont(qstrm); - nGlatOffset = ReadIntFromFont(qstrm); - nFeatOffset = ReadIntFromFont(qstrm); - nSill - - // Read the "Silf" table. - int chwMaxGlyphID; - int fxdVersion; - ReadSilfTable(qstrm, nSilOffset, 0, &chwMaxGlyphID, &fxdVersion); - - // Read the "Gloc" and "Glat" tables. - ReadGlocAndGlatTables(qstrm, nGlocOffset, qstrm, nGlatOffset, chwMaxGlyphID, fxdVersion); - - // Read the "Feat" table. - ReadFeatTable(qstrm, nFeatOffset); -} -#endif // OLD_TEST_STUFF -//:End Ignore - - -/*---------------------------------------------------------------------------------------------- - Return whether the text is asking for bold and/or italic text. -----------------------------------------------------------------------------------------------*/ -void GrEngine::GetStyles(Font * pfont, int ichwMin, bool * pfBold, bool * pfItalic) -{ - *pfBold = pfont->bold(); - *pfItalic = pfont->italic(); -} - -/*---------------------------------------------------------------------------------------------- - Switch the Graphics object between the Graphite table file and the base font. - Should only be called when we know we are using a base font, or when we are reading - the base font to see if it is valid. -----------------------------------------------------------------------------------------------*/ -void GrEngine::SwitchGraphicsFont(bool fBase) -{ - Assert(!fBase || m_stuBaseFaceName.size() > 0); - - //LgCharRenderProps chrp; - //pgg->get_FontCharProperties(&chrp); - //if (fBase) - //{ - // wcsncpy(chrp.szFaceName, m_stuBaseFaceName.data(), m_stuBaseFaceName.size() + 1); - // chrp.szFaceName[31] = 0; - //} - //else - //{ - // wcsncpy(chrp.szFaceName, m_stuFaceName.data(), m_stuFaceName.size() + 1); - // chrp.szFaceName[31] = 0; - //} - //pgg->SetupGraphics(&chrp); -} - -/*---------------------------------------------------------------------------------------------- - Read the contents of the "Silf" table from the stream, which is on an extended - TrueType font file. Specifically, read the iSubTable-th sub-table (for now there is - only one). - - WARNING: any changes to this method must be accompanied by equivalent changes to - CreateEmpty(). -----------------------------------------------------------------------------------------------*/ -bool GrEngine::ReadSilfTable(GrIStream & grstrm, long lTableStart, int iSubTable, - int * pchwMaxGlyphID, int * pfxdSilfVersion) -{ - grstrm.SetPositionInFont(lTableStart); - - // version - *pfxdSilfVersion = ReadVersion(grstrm); - if (*pfxdSilfVersion > kSilfVersion) - // Version we don't know how to handle. - return false; - - if (*pfxdSilfVersion >= 0x00030000) - // compiler version - grstrm.ReadIntFromFont(); - - // number of tables - unsigned short cSubTables = grstrm.ReadUShortFromFont(); - Assert(cSubTables == 1); // for now - Assert(cSubTables <= kMaxSubTablesInFont); - if (cSubTables != 1 || cSubTables > kMaxSubTablesInFont) - return false; - - if (*pfxdSilfVersion >= 0x00020000) - // reserved - grstrm.ReadShortFromFont(); - - // subtable offsets - int nSubTableOffsets[kMaxSubTablesInFont]; - int i; - for (i = 0; i < cSubTables; i++) - { - nSubTableOffsets[i] = grstrm.ReadIntFromFont(); - } - - grstrm.SetPositionInFont(lTableStart + nSubTableOffsets[iSubTable]); - - // Now we are at the beginning of the desired sub-table. - - // Get the position of the start of the table. - long lSubTableStart; - grstrm.GetPositionInFont(&lSubTableStart); - - // rule version - int fxdRuleVersion = (*pfxdSilfVersion >= 0x00030000) ? - ReadVersion(grstrm) : - *pfxdSilfVersion; - - long lPassBlockPos = -1; - long lPseudosPos = -1; - if (*pfxdSilfVersion >= 0x00030000) - { - lPassBlockPos = grstrm.ReadUShortFromFont() + lSubTableStart; - lPseudosPos = grstrm.ReadUShortFromFont() + lSubTableStart; - } - - // maximum glyph ID - data16 chwTmp; - *pchwMaxGlyphID = grstrm.ReadUShortFromFont(); - - // extra ascent and descent - m_mXAscent = grstrm.ReadShortFromFont(); - m_mXDescent = grstrm.ReadShortFromFont(); - - // TODO: decide whether we want these: - m_mXAscent = 0; - m_mXDescent = 0; - - // number of passes - byte cPasses = grstrm.ReadByteFromFont(); - // index of first substitution pass - byte ipassSub1 = grstrm.ReadByteFromFont(); - // index of first positioning pass - byte ipassPos1 = grstrm.ReadByteFromFont(); - // index of first justification pass - byte ipassJust1 = grstrm.ReadByteFromFont(); - // index of first reordered pass, or 0xFF if no reordering - byte ipassReordered1 = grstrm.ReadByteFromFont(); - if (*pfxdSilfVersion < 0x00020000) - { - Assert(ipassJust1 == cPasses || ipassJust1 == ipassPos1); - ipassJust1 = ipassPos1; - } - - // Sanity checks. - if (cPasses > kMaxPasses || ipassSub1 > cPasses || ipassPos1 > cPasses) - return false; // bad table - - // line-break flag - int nLineBreak = grstrm.ReadByteFromFont(); - if (nLineBreak != 0 && nLineBreak != 1) - return false; // bad table - m_fLineBreak = (bool)nLineBreak; - - // range of possible cross-line-boundary contextualization - m_cchwPreXlbContext = grstrm.ReadByteFromFont(); - m_cchwPostXlbContext = grstrm.ReadByteFromFont(); - - // actual glyph ID for pseudo-glyph (ID of bogus attribute) - byte bTmp; // unsigned - bTmp = grstrm.ReadByteFromFont(); - m_chwPseudoAttr = bTmp; - // breakweight - bTmp = grstrm.ReadByteFromFont(); - m_chwBWAttr = bTmp; - // directionality - bTmp = grstrm.ReadByteFromFont(); - m_chwDirAttr = bTmp; - - // Sanity checks--don't bother with these, I don't seem to be able to know what are reasonable values. - //if (m_chwPseudoAttr > 200 || m_chwBWAttr > 200 || m_chwDirAttr > 200) - // return false; // bad table - - if (*pfxdSilfVersion >= 0x00020000) - { - // reserved - grstrm.ReadByteFromFont(); - grstrm.ReadByteFromFont(); - - // justification levels - m_cJLevels = grstrm.ReadByteFromFont(); - if (m_cJLevels > kMaxJLevels) - return false; // bad table - m_fBasicJust = (m_cJLevels == 0); - m_chwJStretch0 = 0xffff; // if no justification - m_chwJShrink0 = 0xffff; - m_chwJStep0 = 0xffff; - m_chwJWeight0 = 0xffff; - for (int i = 0; i < m_cJLevels; i++) - { - // justification glyph attribute IDs - bTmp = grstrm.ReadByteFromFont(); - if (i == 0) - m_chwJStretch0 = bTmp; - bTmp = grstrm.ReadByteFromFont(); - if (i == 0) - m_chwJShrink0 = bTmp; - bTmp = grstrm.ReadByteFromFont(); - if (i == 0) - m_chwJStep0 = bTmp; - bTmp = grstrm.ReadByteFromFont(); - if (i == 0) - m_chwJWeight0 = bTmp; - bTmp = grstrm.ReadByteFromFont(); // runto - // reserved - grstrm.ReadByteFromFont(); - grstrm.ReadByteFromFont(); - grstrm.ReadByteFromFont(); - } - } - else - { - m_cJLevels = 0; - m_fBasicJust = true; - m_chwJStretch0 = 0xffff; - m_chwJShrink0 = 0xffff; - m_chwJStep0 = 0xffff; - m_chwJWeight0 = 0xffff; - } - - // number of component attributes - chwTmp = grstrm.ReadUShortFromFont(); - m_cComponents = chwTmp; - - // number of user-defined slot attributes - m_cnUserDefn = grstrm.ReadByteFromFont(); - if (m_cnUserDefn > kMaxUserDefinableSlotAttrs) - return false; // bad table - - // max number of ligature components per glyph - m_cnCompPerLig = grstrm.ReadByteFromFont(); - if (m_cnCompPerLig > 16) - return false; // bad table - - // directions supported - bTmp = grstrm.ReadByteFromFont(); - m_grfsdc = bTmp; - if (m_grfsdc > kfsdcHorizLtr + kfsdcHorizRtl + kfsdcVertFromLeft + kfsdcVertFromRight) - return false; // bad table - - // reserved - bTmp = grstrm.ReadByteFromFont(); - bTmp = grstrm.ReadByteFromFont(); - bTmp = grstrm.ReadByteFromFont(); - - // critical features - int cCriticalFeatures; - if (*pfxdSilfVersion >= 0x00020000) - { - // reserved - bTmp = grstrm.ReadByteFromFont(); - - cCriticalFeatures = grstrm.ReadByteFromFont(); - Assert(cCriticalFeatures == 0); - if (cCriticalFeatures != 0) - return false; // bad table - - // reserved - bTmp = grstrm.ReadByteFromFont(); - } - - // rendering behaviors--ignore for now - byte cBehaviors = grstrm.ReadByteFromFont(); - unsigned int nBehaviors[kMaxRenderingBehavior]; - for (i = 0; i < cBehaviors; i++) - { - nBehaviors[i] = unsigned(grstrm.ReadIntFromFont()); - } - - // linebreak glyph ID - m_chwLBGlyphID = grstrm.ReadUShortFromFont(); - - // Jump to the beginning of the pass offset block, if we have this information. - if (*pfxdSilfVersion >= 0x00030000) - grstrm.SetPositionInFont(lPassBlockPos); - else - // Otherwise assume that's where we are! - Assert(lPassBlockPos == -1); - - // offsets to passes, relative to the start of this subtable; - // note that we read (cPasses + 1) of these - int nPassOffsets[kMaxPasses]; - for (i = 0; i <= cPasses; i++) - { - nPassOffsets[i] = grstrm.ReadIntFromFont(); - } - - // Jump to the beginning of the pseudo-glyph info block, if we have this information. - if (*pfxdSilfVersion >= 0x00030000) - grstrm.SetPositionInFont(lPseudosPos); - else - // Otherwise assume that's where we are! - Assert(lPseudosPos == -1); - - // number of pseudo-glyphs and search constants - short snTmp; - snTmp = grstrm.ReadShortFromFont(); - m_cpsd = snTmp; - snTmp = grstrm.ReadShortFromFont(); - m_dipsdInit = snTmp; - snTmp = grstrm.ReadShortFromFont(); - m_cPsdLoop = snTmp; - snTmp = grstrm.ReadShortFromFont(); - m_ipsdStart = snTmp; - - // unicode-to-pseudo map - m_prgpsd = new GrPseudoMap[m_cpsd]; - for (i = 0; i < m_cpsd; i++) - { - if (*pfxdSilfVersion <= 0x00010000) - { - utf16 chwUnicode = grstrm.ReadUShortFromFont(); - m_prgpsd[i].SetUnicode(chwUnicode); - } - else - { - int nUnicode = grstrm.ReadIntFromFont(); - m_prgpsd[i].SetUnicode(nUnicode); - } - gid16 chwPseudo = grstrm.ReadUShortFromFont(); - m_prgpsd[i].SetPseudoGlyph(chwPseudo); - } - - // class table - m_pctbl = new GrClassTable(); - if (!m_pctbl->ReadFromFont(grstrm, *pfxdSilfVersion)) - return false; - - // passes - return m_ptman->CreateAndReadPasses(grstrm, *pfxdSilfVersion, fxdRuleVersion, - cPasses, lSubTableStart, nPassOffsets, - ipassSub1, ipassPos1, ipassJust1, ipassReordered1); -} - -/*---------------------------------------------------------------------------------------------- - Set up the engine with no Graphite smarts at all, just dummy tables. -----------------------------------------------------------------------------------------------*/ -void GrEngine::CreateEmpty() -{ - // Silf table - - m_mXAscent = 0; - m_mXDescent = 0; - - m_fLineBreak = false; - - // range of possible cross-line-boundary contextualization - m_cchwPreXlbContext = 0; - m_cchwPostXlbContext = 0; - - // Bogus attribute IDs: - m_chwPseudoAttr = 1; // actual glyph ID for pseudo-glyph (ID of bogus attribute) - m_chwBWAttr = 2; // breakweight - m_chwDirAttr = 3; // directionality - - m_cComponents = 0; // number of component attributes - - m_cnUserDefn = 0; // number of user-defined slot attributes - m_cnCompPerLig = 0; // max number of ligature components - - m_grfsdc = kfsdcHorizLtr; // supported script direction - - // linebreak glyph ID - m_chwLBGlyphID = 0xFFFE; - - // number of pseudo-glyphs and search constants - m_cpsd = 0; - m_dipsdInit = 0; - m_cPsdLoop = 0; - m_ipsdStart = 0; - - // class table - m_pctbl = new GrClassTable(); - m_pctbl->CreateEmpty(); - - // passes - if (m_ptman != 0) - m_ptman->CreateEmpty(); - - // Gloc and Glat tables - m_pgtbl = new GrGlyphTable(); - m_pgtbl->SetNumberOfGlyphs(0); - m_pgtbl->SetNumberOfComponents(0); - m_pgtbl->SetNumberOfStyles(1); // for now - - m_pgtbl->CreateEmpty(); - - // Feat table - m_cfeat = 0; - m_rglcidFeatLabelLangs = NULL; - m_clcidFeatLabelLangs = 0; - - // Language table - m_langtbl.CreateEmpty(); -} - -/*---------------------------------------------------------------------------------------------- - Create the glyph table and fill it in from the font stream. -----------------------------------------------------------------------------------------------*/ -bool GrEngine::ReadGlocAndGlatTables(GrIStream & grstrmGloc, long lGlocStart, - GrIStream & grstrmGlat, long lGlatStart, - int chwGlyphIDMax, int fxdSilfVersion) -{ - // Determine the highest used glyph ID number. -// int chwGlyphIDMax = m_chwLBGlyphID; -// for (int ipsd = 0; ipsd < m_cpsd; ipsd++) -// { -// if (m_prgpsd[ipsd].PseudoGlyph() > chwGlyphIDMax) -// chwGlyphIDMax = m_prgpsd[ipsd].PseudoGlyph(); -// } - - // Create the glyph table. - m_pgtbl = new GrGlyphTable(); - m_pgtbl->SetNumberOfGlyphs(chwGlyphIDMax + 1); - m_pgtbl->SetNumberOfComponents(m_cComponents); - m_pgtbl->SetNumberOfStyles(1); // for now - - return m_pgtbl->ReadFromFont(grstrmGloc, lGlocStart, grstrmGlat, lGlatStart, - m_chwBWAttr, m_chwJStretch0, m_cJLevels, m_cnCompPerLig, fxdSilfVersion); -} - -/*---------------------------------------------------------------------------------------------- - Read the contents of the "Feat" table from the stream, which is on an extended - TrueType font file. -----------------------------------------------------------------------------------------------*/ -bool GrEngine::ReadFeatTable(GrIStream & grstrm, long lTableStart) -{ - short snTmp; - data16 chwTmp; - int nTmp; - - grstrm.SetPositionInFont(lTableStart); - - // version - int fxdVersion = ReadVersion(grstrm); - if (fxdVersion > kFeatVersion) - return false; - - // number of features - int cfeat; - cfeat = grstrm.ReadUShortFromFont(); - if (cfeat > kMaxFeatures) - return false; // bad table; - - // reserved - chwTmp = grstrm.ReadUShortFromFont(); - nTmp = grstrm.ReadIntFromFont(); - - std::vector vnIDs; // unsigned ints - std::vector vnOffsets; - std::vector vcfset; - - m_cfeat = 0; - int ifeat; - for (ifeat = 0; ifeat < cfeat; ifeat++) - { - // ID - featid nID; - if (fxdVersion >= 0x00020000) - nID = (unsigned int)grstrm.ReadIntFromFont(); - else - nID = grstrm.ReadUShortFromFont(); - vnIDs.push_back(nID); - // number of settings - data16 cfset = grstrm.ReadUShortFromFont(); - vcfset.push_back(cfset); - if (fxdVersion >= 0x00020000) - grstrm.ReadShortFromFont(); // pad bytes - // offset to settings list - nTmp = grstrm.ReadIntFromFont(); - vnOffsets.push_back(nTmp); - // flags - chwTmp = grstrm.ReadUShortFromFont(); - Assert(chwTmp == 0x8000); // mutually exclusive - // index into name table of UI label - int nNameId = grstrm.ReadShortFromFont(); - - if (fxdVersion <= 0x00020000 && nID == GrFeature::knLangFeatV2) - { - // Ignore the obsolete "lang" feature which has ID = 1 - vnIDs.pop_back(); - vcfset.pop_back(); - vnOffsets.pop_back(); - continue; - } - AddFeature(nID, nNameId, cfset); - } - - // default feature setting value and name strings; - for (ifeat = 0; ifeat < m_cfeat; ifeat++) - { - GrFeature * pfeat = m_rgfeat + ifeat; - Assert(pfeat->ID() == vnIDs[ifeat]); - - grstrm.SetPositionInFont(lTableStart + vnOffsets[ifeat]); - - // Each feature has been initialized with blank spots for the number of settings - // it has. - int cfset = vcfset[ifeat]; - Assert(pfeat->NumberOfSettings() == cfset); - for (int ifset = 0; ifset < cfset; ifset++) - { - snTmp = grstrm.ReadShortFromFont(); // yes, signed (TT feat table spec says unsigned) - short snTmp2 = grstrm.ReadShortFromFont(); - pfeat->AddSetting(snTmp, snTmp2); - - if (ifset == 0) - { - // default setting value--first in list - pfeat->SetDefault(snTmp); - } - } - } - - return true; -} - -/*---------------------------------------------------------------------------------------------- - Read the contents of the "Sill" table from the stream, which is on an extended - TrueType font file. -----------------------------------------------------------------------------------------------*/ -bool GrEngine::ReadSillTable(GrIStream & grstrm, long lTableStart) -{ - grstrm.SetPositionInFont(lTableStart); - - // version - int fxdVersion = ReadVersion(grstrm); - if (fxdVersion > kSillVersion) - return false; - - return m_langtbl.ReadFromFont(&grstrm, fxdVersion); -} - -/*---------------------------------------------------------------------------------------------- - An error happened in running the tables. Set up temporary dummy tables, and try running - with dumb rendering. - Return kresUnexpected if even running the empty tables crashed, kresFail otherwise. -----------------------------------------------------------------------------------------------*/ -GrResult GrEngine::RunUsingEmpty(Segment * psegNew, Font * pfont, - GrCharStream * pchstrm, LayoutEnvironment & layout, - int ichStop, - float dxMaxWidth, - bool fNeedFinalBreak, bool fMoreText, bool fInfiniteWidth, - int ichwCallerBtLim, - int nDirDepth, SegEnd estJ) -{ - // Save the current state of the engine. - int mXAscentSave = m_mXAscent; - int mXDescentSave = m_mXDescent; - bool fLineBreakSave = m_fLineBreak; - int cchwPreXlbContextSave = m_cchwPreXlbContext; - int cchwPostXlbContextSave = m_cchwPostXlbContext; - data16 chwPseudoAttrSave = m_chwPseudoAttr; - data16 chwBWAttrSave = m_chwBWAttr; - data16 chwDirAttrSave = m_chwDirAttr; - int cComponentsSave = m_cComponents; - int cnUserDefnSave = m_cnUserDefn; - int cnCompPerLigSave = m_cnCompPerLig; - unsigned int grfsdcSave = m_grfsdc; - gid16 chwLBGlyphIDSave = m_chwLBGlyphID; - int cpsdSave = m_cpsd; - int dipsdInitSave = m_dipsdInit; - int cPsdLoopSave = m_cPsdLoop; - int ipsdStartSave = m_ipsdStart; - GrTableManager * ptmanSave = m_ptman; - GrClassTable * pctblSave = m_pctbl; - GrGlyphTable * pgtblSave = m_pgtbl; - int cfeatSave = m_cfeat; - GrResult resFontReadSave = m_resFontRead; - - GrResult res = kresFail; - - pchstrm->Restart(); - - // Create dummy versions of the tables and run them. - m_pctbl = NULL; - m_pgtbl = NULL; - m_ptman = new GrTableManager(this); - m_ptman->State()->SetFont(pfont); - CreateEmpty(); - - try - { - m_ptman->Run(psegNew, pfont, pchstrm, NULL, kjmodiNormal, layout, - ichStop, dxMaxWidth, 0, - fNeedFinalBreak, fMoreText, -1, fInfiniteWidth, false, - ichwCallerBtLim, - nDirDepth, estJ); - } - catch(...) - { - // Still didn't work. Oh, well, not much we can do. - res = kresUnexpected; - } - - psegNew->SetErroneous(true); - - if (m_ptman) - delete m_ptman; - if (m_pctbl) - delete m_pctbl; - if (m_pgtbl) - delete m_pgtbl; - - // Put everything back the way it was. - m_mXAscent = mXAscentSave; - m_mXDescent = mXDescentSave; - m_fLineBreak = fLineBreakSave; - m_cchwPreXlbContext = cchwPreXlbContextSave; - m_cchwPostXlbContext = cchwPostXlbContextSave; - m_chwPseudoAttr = chwPseudoAttrSave; - m_chwBWAttr = chwBWAttrSave; - m_chwDirAttr = chwDirAttrSave; - m_cComponents = cComponentsSave; - m_cnUserDefn = cnUserDefnSave; - m_cnCompPerLig = cnCompPerLigSave; - m_grfsdc = grfsdcSave; - m_chwLBGlyphID = chwLBGlyphIDSave; - m_cpsd = cpsdSave; - m_dipsdInit = dipsdInitSave; - m_cPsdLoop = cPsdLoopSave; - m_ipsdStart = ipsdStartSave; - m_ptman = ptmanSave; - m_pctbl = pctblSave; - m_pgtbl = pgtblSave; - m_cfeat = cfeatSave; - m_resFontRead = resFontReadSave; - - return res; -} - -/*---------------------------------------------------------------------------------------------- - Return the glyph ID for the given Unicode value. -----------------------------------------------------------------------------------------------*/ -gid16 GrEngine::GetGlyphIDFromUnicode(int nUnicode) -{ - gid16 chwGlyphID = MapToPseudo(nUnicode); - if (chwGlyphID != 0) - return chwGlyphID; // return a pseudo-glyph - -#ifdef OLD_TEST_STUFF - if (!m_pCmap31) - // test procedures - return chwUnicode; -#endif // OLD_TEST_STUFF - - // Otherwise, get the glyph ID from the font's cmap. - - if (m_pCmap_3_10) - return gid16(TtfUtil::Cmap310Lookup(m_pCmap_3_10, nUnicode)); - else if (m_pCmap_3_1) - return gid16(TtfUtil::Cmap31Lookup(m_pCmap_3_1, nUnicode)); - else - return 0; -} - -/*---------------------------------------------------------------------------------------------- - Return the pseudo-glyph corresponding to the given Unicode input, or 0 if none. -----------------------------------------------------------------------------------------------*/ -gid16 GrEngine::MapToPseudo(int nUnicode) -{ - if (m_cpsd == 0) - return 0; - -#ifdef _DEBUG - int nPowerOf2 = 1; - while (nPowerOf2 <= m_cpsd) - nPowerOf2 <<= 1; - nPowerOf2 >>= 1; - // Now nPowerOf2 is the max power of 2 <= m_cpds - Assert((1 << m_cPsdLoop) == nPowerOf2); // m_cPsdLoop == log2(nPowerOf2) - Assert(m_dipsdInit == nPowerOf2); - Assert(m_ipsdStart == m_cpsd - m_dipsdInit); -#endif // _DEBUG - - int dipsdCurr = m_dipsdInit; - - GrPseudoMap * ppsdCurr = m_prgpsd + m_ipsdStart; - while (dipsdCurr > 0) - { - int nTest; - if (ppsdCurr < m_prgpsd) - nTest = -1; - else - nTest = ppsdCurr->Unicode() - nUnicode; - - if (nTest == 0) - return ppsdCurr->PseudoGlyph(); - - dipsdCurr >>= 1; // divide by 2 - if (nTest < 0) - ppsdCurr += dipsdCurr; - else // (nTest > 0) - ppsdCurr -= dipsdCurr; - } - - return 0; -} - -/*---------------------------------------------------------------------------------------------- - Return the actual glyph ID to use for glyph metrics and output. For most glyphs, this - is just the glyph ID we're already working with, but for pseudo-glyphs it will something - different. -----------------------------------------------------------------------------------------------*/ -gid16 GrEngine::ActualGlyphForOutput(gid16 chwGlyphID) -{ - gid16 chwActual = gid16(GlyphAttrValue(chwGlyphID, m_chwPseudoAttr)); - if (chwActual == 0) - return chwGlyphID; // not a pseudo, we're already working with the actual glyph ID - else - return chwActual; -} - -/*---------------------------------------------------------------------------------------------- - Look up name based on lang id and name id in name table. - Currently used to look up feature names. -----------------------------------------------------------------------------------------------*/ -std::wstring GrEngine::StringFromNameTable(int nLangID, int nNameID) -{ - std::wstring stuName; - stuName.erase(); - size_t lOffset = 0; - size_t lSize = 0; - - // The Graphite compiler stores our names in either - // the MS (platform id = 3) Unicode (writing system id = 1) table - // or the MS Symbol (writing system id = 0) table. Try MS Unicode first. - // lOffset & lSize are in bytes. - // new interface: - if (!TtfUtil::GetNameInfo(m_pNameTbl, 3, 1, nLangID, nNameID, lOffset, lSize)) - { - if (!TtfUtil::GetNameInfo(m_pNameTbl, 3, 0, nLangID, nNameID, lOffset, lSize)) - { - return stuName; - } - } - - size_t cchw = (unsigned(lSize) / sizeof(utf16)); - utf16 * pchwName = new utf16[cchw+1]; // lSize - byte count for Uni str - const utf16 *pchwSrcName = reinterpret_cast(m_pNameTbl + lOffset); - std::transform(pchwSrcName, pchwSrcName + cchw, pchwName, std::ptr_fun(lsbf)); - pchwName[cchw] = 0; // zero terminate - #ifdef _WIN32 - stuName.assign((const wchar_t*)pchwName, cchw); - #else - wchar_t * pchwName32 = new wchar_t[cchw+1]; // lSize - byte count for Uni str - for (int i = 0; i <= signed(cchw); i++) { - pchwName32[i] = pchwName[i]; - } - stuName.assign(pchwName32, cchw); - delete [] pchwName32; - #endif - - delete [] pchwName; - return stuName; -} - -/*---------------------------------------------------------------------------------------------- - Add a feature (eg, when loading from the font). -----------------------------------------------------------------------------------------------*/ -void GrEngine::AddFeature(featid nID, int nNameId, int cfset, int nDefault) -{ - if (m_cfeat >= kMaxFeatures) - return; - - int ifeat = m_cfeat; - m_rgfeat[ifeat].Initialize(nID, nNameId, cfset, nDefault); -// m_hmnifeat.Insert(nID, ifeat); - m_cfeat++; -} - -/*---------------------------------------------------------------------------------------------- - Return the feature with the given ID, or NULL if none. -----------------------------------------------------------------------------------------------*/ -GrFeature * GrEngine::FeatureWithID(featid nID, int * pifeat) -{ - for (int ifeat = 0; ifeat < m_cfeat; ifeat++) - { - if (m_rgfeat[ifeat].ID() == nID) - { - *pifeat = ifeat; - return m_rgfeat + ifeat; - } - } - *pifeat = -1; - return NULL; - - - // Alternate implementation if we end up with so many features that we need to use - // a hash map: -// int ifeat; -// if (m_hmnifeat.Retrieve(nID, &ifeat)) -// { -// Assert(ifeat < kMaxFeatures); -// return m_rgfeat + ifeat; // may be NULL -// } -// else -// return NULL; -} - -/*---------------------------------------------------------------------------------------------- - Return the default for the feature at the given index in the array. -----------------------------------------------------------------------------------------------*/ -int GrEngine::DefaultForFeatureAt(int ifeat) -{ - Assert(ifeat < kMaxFeatures); - if (ifeat >= m_cfeat || ifeat < 0) - return 0; // undefined feature - - return m_rgfeat[ifeat].DefaultValue(); -} - -/*---------------------------------------------------------------------------------------------- - Set the default for the feature at the given index in the array. -----------------------------------------------------------------------------------------------*/ -void GrEngine::SetDefaultForFeatureAt(int ifeat, int nValue) -{ - Assert(ifeat < kMaxFeatures); - Assert(ifeat < m_cfeat); - if (ifeat >= 0) - m_rgfeat[ifeat].SetDefault(nValue); -} - -/*---------------------------------------------------------------------------------------------- - Return the default feature settings for the given language. -----------------------------------------------------------------------------------------------*/ -void GrEngine::DefaultsForLanguage(isocode lgcode, - std::vector & vnFeats, std::vector & vnValues) -{ - m_langtbl.LanguageFeatureSettings(lgcode, vnFeats, vnValues); -} - -/*---------------------------------------------------------------------------------------------- - Initialize the directionality and breakweight attributes of a new slot based on its - glyph ID. - REVIEW: we could optimize by not initializing from the glyph table right away, - but waiting until we need the value. -----------------------------------------------------------------------------------------------*/ -void GrEngine::InitSlot(GrSlotState * pslot, int nUnicode) -{ - gid16 chwGlyphID = pslot->GlyphID(); - - if (m_ptman->InternalJustificationMode() != kjmodiNormal) - { - if (m_cJLevels > 0) - { - Assert(m_cJLevels == 1); // for now - // TODO: do this at level 0. - pslot->SetJStretch(m_pgtbl->GlyphAttrValue(chwGlyphID, m_chwJStretch0)); - pslot->SetJShrink( m_pgtbl->GlyphAttrValue(chwGlyphID, m_chwJShrink0)); - pslot->SetJStep( m_pgtbl->GlyphAttrValue(chwGlyphID, m_chwJStep0)); - pslot->SetJWeight( m_pgtbl->GlyphAttrValue(chwGlyphID, m_chwJWeight0)); - } - else if (nUnicode == knSpace) - { - // Basic stretch/shrink for whitespace. - // TODO: do this at level 0. - Assert(m_fBasicJust); - int mAdv = pslot->AdvanceX(m_ptman); - pslot->SetJStretch(mAdv * 100); // stretch up to 100 times natural width - pslot->SetJShrink(mAdv / 4); // shrink to 75% - pslot->SetJWeight(1); - } - } - - if (m_pgtbl && !m_pgtbl->IsEmpty()) - { - // Initialize from glyph table. - pslot->SetBreakWeight(m_pgtbl->GlyphAttrValue(chwGlyphID, m_chwBWAttr)); - - DirCode dirc = DirCode(m_pgtbl->GlyphAttrValue(chwGlyphID, m_chwDirAttr)); - if (BidiCode(nUnicode) && (chwGlyphID == 0 || dirc == kdircNeutral)) - // A built-in character for the bidi algorithm that is not defined in the font but - // must be given a special directionality: - goto LDefaults; - - pslot->SetDirectionality(dirc); - - return; - } - -LDefaults: - // Otherwise, in fill defaults for some basic values. - if (pslot->BreakWeight() == GrSlotState::kNotYetSet8) - { - switch (nUnicode) - { - case knSpace: - pslot->SetBreakWeight(klbWordBreak); - break; - case knHyphen: - pslot->SetBreakWeight(klbHyphenBreak); - break; - default: - pslot->SetBreakWeight(klbLetterBreak); - } - } - - if ((int)pslot->Directionality() == GrSlotState::kNotYetSet8) - { - switch (nUnicode) - { - case knSpace: - pslot->SetDirectionality(kdircWhiteSpace); - break; - case knLRM: - pslot->SetDirectionality(kdircL); - break; - case knRLM: - pslot->SetDirectionality(kdircR); - break; - case knLRO: - pslot->SetDirectionality(kdircLRO); - break; - case knRLO: - pslot->SetDirectionality(kdircRLO); - break; - case knLRE: - pslot->SetDirectionality(kdircLRE); - break; - case knRLE: - pslot->SetDirectionality(kdircRLE); - break; - case knPDF: - pslot->SetDirectionality(kdircPDF); - break; - default: - if (chwGlyphID == LBGlyphID()) - pslot->SetDirectionality(kdircNeutral); - else - pslot->SetDirectionality(kdircL); - } - } - else - Assert(false); // currently no way to set directionality ahead of time -} - -/*---------------------------------------------------------------------------------------------- - We have just changed this slot's glyph ID. Change the directionality and breakweight - attributes of a new slot based on its glyph ID. -----------------------------------------------------------------------------------------------*/ -void GrEngine::SetSlotAttrsFromGlyphAttrs(GrSlotState * pslot) -{ - InitSlot(pslot); -} - -/*---------------------------------------------------------------------------------------------- - Create a new segment. -----------------------------------------------------------------------------------------------*/ -void GrEngine::NewSegment(Segment ** ppseg) -{ - *ppseg = new Segment; -} - -/*---------------------------------------------------------------------------------------------- - Methods to pass on to the tables. -----------------------------------------------------------------------------------------------*/ -gid16 GrEngine::GetClassGlyphIDAt(int nClass, int nIndex) -{ - if (nIndex < 0) - return 0; - if (nClass < 0) - return 0; - - try { - return m_pctbl->GetGlyphID(nClass, nIndex); - } - catch (...) - { - return 0; - } -} - -int GrEngine::GetIndexInGlyphClass(int nClass, gid16 chwGlyphID) -{ - try { - return m_pctbl->FindIndex(nClass, chwGlyphID); - } - catch (...) - { - return -1; - } -} - -size_t GrEngine::NumberOfGlyphsInClass(int nClass) -{ - try { - return m_pctbl->NumberOfGlyphsInClass(nClass); - } - catch (...) - { - return 0; - } -} - -int GrEngine::GlyphAttrValue(gid16 chwGlyphID, int nAttrID) -{ -#ifdef OLD_TEST_STUFF - if (!m_pgtbl) // test procedures - return 0; -#endif // OLD_TEST_STUFF - - return m_pgtbl->GlyphAttrValue(chwGlyphID, nAttrID); -} - -int GrEngine::ComponentIndexForGlyph(gid16 chwGlyphID, int nCompID) -{ -#ifdef OLD_TEST_STUFF - if (!m_pgtbl) // test procedures - return -1; -#endif // OLD_TEST_STUFF - - return m_pgtbl->ComponentIndexForGlyph(chwGlyphID, nCompID); -} - - -//:>******************************************************************************************** -//:> For test procedures -//:>******************************************************************************************** - -//:Ignore - -#ifdef OLD_TEST_STUFF - -void GrEngine::SetUpPseudoGlyphTest() -{ - m_cpsd = 5; - - m_prgpsd = new GrPseudoMap[m_cpsd]; - - m_prgpsd[0].SetUnicode(65); - m_prgpsd[0].SetPseudoGlyph(1065); - - m_prgpsd[1].SetUnicode(66); - m_prgpsd[1].SetPseudoGlyph(1066); - - m_prgpsd[2].SetUnicode(67); - m_prgpsd[2].SetPseudoGlyph(1067); - - m_prgpsd[3].SetUnicode(68); - m_prgpsd[3].SetPseudoGlyph(1068); - - m_prgpsd[4].SetUnicode(69); - m_prgpsd[4].SetPseudoGlyph(1069); - - m_dipsdInit = 4; - m_cPsdLoop = 2; - m_ipsdStart = 1; -} - -#endif // OLD_TEST_STUFF - - -//:>******************************************************************************************** -//:> New interface -//:>******************************************************************************************** -/*---------------------------------------------------------------------------------------------- - Store the default features values as specified by the client. -----------------------------------------------------------------------------------------------*/ -void GrEngine::AssignDefaultFeatures(int cfeat, FeatureSetting * prgfset) -{ - for (int ifeatIn = 0; ifeatIn < cfeat; ifeatIn++) - { - int ifeat; - FeatureWithID(prgfset[ifeatIn].id, &ifeat); - if (ifeat >= 0 ) - SetDefaultForFeatureAt(ifeat, prgfset[ifeatIn].value); - } -} - -bool GrEngine::LoggingTransduction() -{ - Assert(false); - //return m_pfface->getLogging(); - //return m_fLogXductn; - return true; -} - -} // namespace gr - -//:End Ignore - diff --git a/Build/source/libs/graphite/engine-2.3.1/src/segment/GrEngine.h b/Build/source/libs/graphite/engine-2.3.1/src/segment/GrEngine.h deleted file mode 100644 index 6dc270a38af..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/src/segment/GrEngine.h +++ /dev/null @@ -1,622 +0,0 @@ -/*-------------------------------------------------------------------- -Copyright (C) 1999, 2001 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: GrEngine.h -Responsibility: Sharon Correll -Last reviewed: Not yet. - -Description: - Contains the definition of the GrEngine class. -----------------------------------------------------------------------------------------------*/ -#ifdef _MSC_VER -#pragma once -#endif -#ifndef GR_ENGINE_INCLUDED -#define GR_ENGINE_INCLUDED -#include - -#ifdef _MSC_VER -#include -#endif - -namespace gr -{ -class IGrJustifier; -class Segment; - - -/*---------------------------------------------------------------------------------------------- - The GrEngine serves as the top level object that knows how to run Graphite tables - and generate Graphite segments. - - Primarily, this class implements IRenderEngine, which allows it to serve as a FW - rendering engine. It also implements ISimpleInit, a general interface for initializing - using a string. Finally, it implements ITraceControl, a very simple interface which - allows a client to flip a flag indicating whether or not we want to output a log of - the Graphite transduction process. - - Hungarian: greng -----------------------------------------------------------------------------------------------*/ -class GrEngine : public GraphiteProcess -{ - friend class FontFace; - friend class FontMemoryUsage; - -public: - // Constructors & destructors: - GrEngine(); - void BasicInit(); - virtual ~GrEngine(); - void DestroyContents(bool fDestroyCmap = true); - - // ISimpleInit methods: - ////GrResult InitNew(const byte * prgb, int cb); -- obsolete - ////GrResult get_InitializationData(int cchMax, OLECHAR * rgchw, int * pcch); -- obsolete - - // ITraceControl methods: - //GrResult SetTracing(int n); - //GrResult GetTracing(int * pnOptions); - - // IRenderingFeatures methods: - //GrResult GetFeatureIDs(int cMax, int * prgFids, int * pcfid); - //GrResult GetFeatureLabel(int fid, int nLanguage, int cchMax, OLECHAR * rgchw, int * pcch); - //GrResult GetFeatureValues(int fid, int cfvalMax, - // int * prgfval, int * pcfval, int * pfvalDefault); - //GrResult GetFeatureValueLabel(int fid, int fval, int nLanguage, - // int cchMax, OLECHAR * rgchw, int * pcch); - - // IRenderEngine methods: - ////GrResult InitRenderer(IGrGraphics * pgg, OLECHAR * prgchData, int cchData); -- obsolete - ////GrResult FontIsValid(OLECHAR * prgchwErrMsg, int cchMaxErrMsg); - - GrResult get_SegDatMaxLength(int * pcb); - - //GrResult FindBreakPoint(Font * pfont, ITextSource * pgts, DELETE - // int ichMin, int ichLim, int ichLimBacktrack, - // bool fNeedFinalBreak, - // bool fStartLine, - // float dxMaxWidth, - // LineBrk lbPref, LineBrk lbMax, - // TrWsHandling twsh, bool fParaRtoL, - // Segment ** ppsegRet, - // int * pdichwLimSeg, float * pdxWidth, SegEnd * pest, - // int cbPrev, byte * pbPrevSegDat, - // int cbNextMax, byte * pbNextSegDat, int * pcbNextSegDat, - // int * pdichwContext, - // std::ostream * pstrmLog, - // OLECHAR * prgchwErrMsg, int cchMaxErrMsg); - - //GrResult FindBreakPointWJust(Font * pfont, ITextSource * pgts, IGrJustifier * pgjus, - // int ichMin, int ichLim, int ichLimBacktrack, DELETE - // bool fNeedFinalBreak, - // bool fStartLine, - // float dxMaxWidth, - // LineBrk lbPref, LineBrk lbMax, - // TrWsHandling twsh, bool fParaRtoL, - // Segment ** ppsegRet, - // int * pdichwLimSeg, float * pdxWidth, SegEnd * pest, - // int cbPrev, byte * pbPrevSegDat, - // int cbNextMax, byte * pbNextSegDat, int * pcbNextSegDat, - // int * pdichwContext, - // std::ostream * pstrmLog, - // OLECHAR * prgchwErrMsg, int cchMaxErrMsg); - - GrResult get_ScriptDirection(unsigned int * pgrfsdc, OLECHAR * prgchwErrMsg, int cchMaxErrMsg); - - // DELETE - //GrResult MakeJustifiedSegment(Font * pfont, ITextSource * pgts, IGrJustifier * pgj, - // int ichMin, int ichLim, - // bool fStartLine, bool fEndLine, - // float dxUnjustifiedWidth, float dxJustifiedWidth, - // TrWsHandling twsh, SegEnd est, LineBrk lb, - // bool fParaRtl, - // Segment ** ppsegRet, float * pdxWidth, - // //int cbPrev, byte * pbPrevSegDat, int cbNextMax, byte * pbNextSegDat, int * pcbNextSegDat, int * pdichwContext, - // std::ostream * pstrmLog, - // OLECHAR * prgchwErrMsg, int cchwMaxErrMsg); - - // IJustifyingRenderer methods: - // These methods return kresInvalidArg if the attribute ID is invalid or inappropriate; - // kresFail if the engine is not in an appropriate state to return the information. - virtual GrResult getGlyphAttribute(int iGlyph, int jgat, int nLevel, float * pValueRet); - virtual GrResult getGlyphAttribute(int iGlyph, int jgat, int nLevel, int * pValueRet); - virtual GrResult setGlyphAttribute(int iGlyph, int jgat, int nLevel, float value); - virtual GrResult setGlyphAttribute(int iGlyph, int jgat, int nLevel, int value); - - // Interface methods not used by FW: - - ////GrResult IsGraphiteFont(IGrGraphics * pgg); -- obsolete - - ////GrResult FontAscentAndDescent(IGrGraphics * pgg, int * pysAscent, int * pysDescent); -- obsolete - - //GrResult MakeMeasuredSegment( - // Font * pfont, ITextSource * pgts, - // int ichMin, int ichLim, - // bool fParaRtl, - // Segment ** ppsegRet, SegEnd * pest, - // std::ostream * pstrmLog, - // OLECHAR * prgchwErrMsg, int cchMaxErrMsg); - - //GrResult MakeSegmentFromRange(Font * pfont, ITextSource * pgts, IGrJustifier * pgj, - // int ichMin, int ichLim, - // bool fStartLine, bool fEndLine, - // TrWsHandling twsh, bool fParaRtl, - // Segment ** ppsegRet, float * pdxWidth, SegEnd * pest, - // int cbPrev, byte * pbPrevSegDat, int cbNextMax, byte * pbNextSegDat, int * pcbNextSegDat, - // int * pdichwContext, - // std::ostream * pstrmLog, - // OLECHAR * prgchwErrMsg, int cchwMaxErrMsg); - - // NEW interface - - GrResult ReadFontTables(Font * pfont, bool fItalic); - - FontErrorCode IsValidForGraphite(int * pnVersion, int * pnSubVersion); - - // Other public methods - - GrResult FindBreakPointAux(Font * pfont, ITextSource * pgts, IGrJustifier * pgjus, - int ichwMin, int ichwLim, int ichwLimBacktrack, - bool fNeedFinalBreakArg, bool fStartLine, bool fEndLine, - float dxMaxWidth, bool fWidthIsCharCount, - LineBrk lbPref, LineBrk lbMax, TrWsHandling twsh, bool fParaRtl, - Segment ** ppsegRet, - int * pdichwLimSeg, - float * pdxWidth, SegEnd * pest, - int cbPrev, byte * pbPrevSegDat, - int cbNextMax, byte * pbNextSegDat, int * pcbNextSegDat, - int * pdichwContext, - std::ostream * pstrmLog, - OLECHAR * prgchwErrMsg, int cchMaxErrMsg); - - gid16 GetGlyphIDFromUnicode(int nUnicode); - gid16 ActualGlyphForOutput(utf16 chwGlyphID); - - int GetFontEmUnits() - { - return m_mFontEmUnits; - } - - gid16 LBGlyphID() - { - return m_chwLBGlyphID; - } - - gid16 GetClassGlyphIDAt(int nClass, int nIndex); - int GetIndexInGlyphClass(int nClass, gid16 chwGlyphID); - size_t NumberOfGlyphsInClass(int nClass); - int GlyphAttrValue(gid16 chwGlyphID, int nAttrID); - int ComponentIndexForGlyph(gid16 chwGlyphID, int nCompID); - - ////void InitFontName(std::wstring stuInitialize, std::wstring & stuFaceName, std::wstring & stuFeatures); -- obsolete - void RecordFontLoadError(OLECHAR * prgchwErrMsg, int cchMaxErrMsg); - void RecordFontRunError(OLECHAR * prgchwErrMsg, int cchMaxErrMsg, GrResult res); - void ClearFontError(OLECHAR * prgchwErrMsg, int cchMaxErrMsg); - void GetWritingSystemDirection(ITextSource * pgts, int ichwMin); - ////GrResult SetUp(IGrGraphics * pgg, std::wstring stuFeatures); -- obsolete - ////GrResult SetUp(IGrGraphics * pgg, std::wstring stuFeaturesArg, bool fBold, bool fItalic); -- obsolete - - GrResult RunUsingEmpty(Segment * psegNew, Font * pfont, - GrCharStream * pchstrm, LayoutEnvironment & layout, - int ichStop, - float dxMaxWidth, - bool fNeedFinalBreak, bool fMoreText, bool fInfiniteWidth, - int ichwCallerBtLim, - int nDirDepth, SegEnd estJ); - bool InErrorState() - { - return m_fInErrorState; - } - - std::wstring FaceName() - { - return m_stuFaceName; - } - std::wstring BaseFaceName() - { - Assert(m_stuBaseFaceName.size() == 0 || m_fUseSepBase); - return m_stuBaseFaceName; // empty if not using separate base font - } - bool Bold() - { - return m_fBold; - } - bool Italic() - { - return m_fItalic; - } - - void GetStyles(Font * pfont, int ichwMin, bool * pfBold, bool * pfItalic); - void SwitchGraphicsFont(bool fBase); - - void AddFeature(featid nID, int nNameId, int cfset, int nDefault = 0); - GrFeature * FeatureWithID(featid nID, int * pifeat); - int DefaultForFeatureAt(int ifeat); - void SetDefaultForFeatureAt(int ifeat, int nValue); - GrFeature * Feature(int ifeat) - { - if (ifeat >= kMaxFeatures) - return NULL; - return m_rgfeat + ifeat; - } - void DefaultsForLanguage(isocode lgcode, - std::vector & vnFeats, std::vector & vnValues); - std::wstring StringFromNameTable(int nNameId, int nLang); - - void InitSlot(GrSlotState *, int nUnicode = -1); - void SetSlotAttrsFromGlyphAttrs(GrSlotState *); - - bool RightToLeft() - { - return m_fRightToLeft; - } - int TopDirectionLevel() - { - return (m_fRightToLeft) ? 1 : 0; - } - - GrGlyphTable * GlyphTable() - { - return m_pgtbl; - } - - GrClassTable * ClassTable() - { - return m_pctbl; - } - - int NumFeat() - { - return m_cfeat; - } - - bool LineBreakFlag() - { - return m_fLineBreak; - } - - int PreXlbContext() - { - return m_cchwPreXlbContext; - } - - int PostXlbContext() - { - return m_cchwPostXlbContext; - } - - int ExtraAscent() - { - return m_mXAscent; - } - - int ExtraDescent() - { - return m_mXDescent; - } - - float VerticalOffset() - { - return m_dysOffset; - } - - int NumUserDefn() - { - return m_cnUserDefn; - } - - int NumCompPerLig() - { - return m_cnCompPerLig; - } - - bool BasicJustification() - { - return m_fBasicJust; - } - - bool LoggingTransduction(); - //{ - // return m_pfface->getLogging(); - // //return m_fLogXductn; - //} - - bool FakeItalic() - { - return m_fFakeItalic; - } - - void NewSegment(Segment ** ppseg); - - static int ReadVersion(GrIStream & grstrm); - - /*---------------------------------------------------------------------------------------------- - Function to convert between coordinate systems. - This is identical to the built-in MulDiv function except that it rounds with better - precision. - - TODO: move these out of GrEngine to someplace more general. - ----------------------------------------------------------------------------------------------*/ - inline static int GrIntMulDiv(const int v, const int n, const int d) - { - return int(n < 0 ? - (double(v * n)/double(d)) - 0.5 : - (double(v * n)/double(d)) + 0.5); - } - inline static float GrFloatMulDiv(const float v, const float n, const float d) - { - return v * n / d; - } - inline static float GrIFIMulDiv(const int v, const float n, const int d) - { - return float(double(v) * n / double(d)); - } - inline static int GrFIFMulDiv(const float v, const int n, const float d) - { - return int(n < 0 ? - (v * double(n) / double(d)) - 0.5 : - (v * double(n) / double(d)) + 0.5); - } - inline static int RoundFloat(const float n) - { - return int(n < 0 ? n - 0.5 : n + 0.5); - } - -protected: - // Member variables: - - long m_cref; - - //////////// Font information //////////// - - bool m_fBold; - bool m_fItalic; - - // do we have the capacity to perform smart rendering for the various styles? - bool m_fSmartReg; - bool m_fSmartBold; - bool m_fSmartItalic; - bool m_fSmartBI; - // are the italics faked using a slant? - bool m_fFakeItalicCache; - bool m_fFakeBICache; - // control files for styled text; empty means not yet determined - std::wstring m_strCtrlFileReg; // regular - std::wstring m_strCtrlFileBold; // bold - std::wstring m_strCtrlFileItalic; // italic - std::wstring m_strCtrlFileBI; // bold-italic - - bool m_fFakeItalic; // true if we are simulating an italic slant in positioning - - std::wstring m_stuCtrlFile; // control file (.ttf file) from which we got - // currently loaded files - - std::wstring m_stuInitError; // description of any error that happened while initializing - // the engine - std::wstring m_stuErrCtrlFile; // file for which the error occurred - - std::wstring m_stuFaceName; // eg, "Times New Roman" - std::wstring m_stuFeatures; - - bool m_fUseSepBase; - std::wstring m_stuBaseFaceName; // from Sile table; empty if we are not using a separate - // control file - - GrResult m_resFontRead; // kresOk if the Graphite font was loaded successfully; - // kresFail if the font could not be found or basic tables couldn't be read; - // kresFalse if the Silf table is not present; - // kresUnexpected if the Graphite tables could not be loaded - - GrResult m_resFontValid; // kresInvalidArg if the engine is not yet initialized - // Originally: - // kresOk if Graphite font & dc font match cmaps - // kresUnexpected/kresFalse if dumb rendering - // kresFail if dumb rendering with no cmap - // But now it is apparently just = to m_resFontRead otherwise. - FontErrorCode m_ferr; - int m_fxdBadVersion; - - int m_nFontCheckSum; // when loading a font using the GrGraphics, remember the - // check sum as a unique identifer - - int m_nScriptTag; // from the pertinent writing system; currently not used - unsigned int m_grfsdc; // supported script directions - - bool m_fRightToLeft; // overall writing-system direction - - int m_mXAscent; // extra ascent, in font's em-units - int m_mXDescent; // extra descent, in font's em_units - - float m_dysOffset; // vertical offset, in logical units (eg, for super/subscript) - - bool m_fBasicJust; // true if there are no complex justification tables/rules in the - // font, so we use basic whitespace justification - int m_cJLevels; // number of justification levels - - GrTableManager * m_ptman; - GrClassTable * m_pctbl; - GrGlyphTable * m_pgtbl; - - FontFace * m_pfface; - - GrFeature m_rgfeat[kMaxFeatures]; -// HashMap m_hmnifeat; // maps from feature IDs to indices in the array -// // Review: do we need this, or is a linear search adequate? - int m_cfeat; // number of features present - - short * m_rglcidFeatLabelLangs; // LCIDs (language IDs) for all the labels in the feature table - size_t m_clcidFeatLabelLangs; - - GrLangTable m_langtbl; - - // are line-breaks relevant at all? - bool m_fLineBreak; - // ranges for possible cross-line-boundary contextualization - int m_cchwPreXlbContext; - int m_cchwPostXlbContext; - - // magic glyph attribute numbers - data16 m_chwPseudoAttr; // actual-for-pseudo fake glyph attribute - data16 m_chwBWAttr; // break-weight - data16 m_chwDirAttr; // directionality - data16 m_chwJStretch0; // justify.0.stretch - data16 m_chwJShrink0; // justify.0.shrink - data16 m_chwJStep0; // justify.0.step - data16 m_chwJWeight0; // justify.0.weight - - gid16 m_chwLBGlyphID; // magic line-break glyph ID - - int m_cComponents; // number of glyph attributes at the beginning of the glyph table - // that actually represent ligature components - - int m_cnUserDefn; // number of user-defined slot attributes - int m_cnCompPerLig; // max number of components needed per ligature - - int m_mFontEmUnits; // number of design units in the Em square for the font - - // for pseudo-glyph mappings - int m_cpsd; // number of psuedo-glyphs - GrPseudoMap * m_prgpsd; - int m_dipsdInit; // (max power of 2 <= m_cpsd); - // size of initial range to consider - int m_cPsdLoop; // log2(max power of 2 <= m_cpsd); - // indicates how many iterations are necessary - int m_ipsdStart; // m_cpsd - m_dipsdInit; - // where to start search - - // for Unicode to glyph ID mapping - ////TableBuffer m_tbufCmap; // hold the full cmap table - void * m_pCmap_3_1; // point to the MS Unicode cmap subtable - // uses platform 3 writing system 1 or 0, preferably 1 - // use for Unicode to Glyph ID conversion - void * m_pCmap_3_10; - byte * m_pCmapTbl; - bool m_fCmapTblCopy; - int m_cbCmapTbl; // needed only for memory instrumentation - - // for feature names and maybe other strings from font later - ////TableBuffer m_tbufNameTbl; // hold full name table; use Name() method to access - byte * m_pNameTbl; - bool m_fNameTblCopy; - int m_cbNameTbl; // needed only for memory instrumentation - - bool m_fLogXductn; // true if we want to log the transduction process - - bool m_fInErrorState; // true if we are handling a rendering error - - // Other protected methods: - - enum { - ksegmodeBreak = 0, // FindBreakPoint - ksegmodeJust, // MakeJustifiedSegment - //ksegmodeMms, // MakeMeasuredSegment - ksegmodeRange // MakeSegmentFromRange - }; - - void MakeSegment( - // Common parameters - Segment * psegRet, - Font * pfont, ITextSource * pgts, IGrJustifier * pjus, - LayoutEnvironment & layout, - int ichMin, int ichLim, - // for finding a line break - float dxMaxWidth, - bool fBacktracking, - // for making a justified segment - bool fJust, float dxJustifiedWidthJ, SegEnd estJ); - - int FindFontLim(ITextSource * pgts, int ichFontMin, int * pnDirDepth); - -#ifdef GR_FW - ////GrResult InitFromControlFile(IGrGraphics * pgg, std::wstring stuFaceName, - //// bool fBold, bool fItalic); -- obsolete - ////GrResult ReadFromControlFile(std::wstring stuFontFile); -- obsolete -// GrResult GetFallBackFont(std::wstring * pstu); -#endif - - ////GrResult ReadFromGraphicsFont(IGrGraphics * pgg, bool fItalic); -- obsolete - void DestroyEverything(); - - bool CheckTableVersions(GrIStream * pgrstrm, - const byte *silf_tbl, int lSilfStart, - const byte *gloc_tbl, int lGlocStart, - const byte *feat_tbl, int lFeatStart, - int * pfxdBadVersion); - //bool ReadSileTable(GrIStream & grstrm, long lTableSTart, - // int * pmFontEmUnits, bool * pfMismatchedBase); - bool ReadSilfTable(GrIStream & grstrm, long lTableStart, int iSubTable, - int * pchwMaxGlyphID, int * pfxdVersion); - bool ReadGlocAndGlatTables(GrIStream & grstrm, long lGlocStart, GrIStream & glat_strm, long lGlatStart, - int chwMaxGlyphID, int fxdSilfVersion); - bool ReadFeatTable(GrIStream & grstrm, long lTableStart); - bool ReadSillTable(GrIStream & grstrm, long lTableStart); - bool SetCmapAndNameTables(Font * pfont); - - void CreateEmpty(); - - bool BadFont(FontErrorCode * pferr = NULL) - { - if (pferr) - *pferr = m_ferr; - return (m_resFontValid == kresFail || m_resFontRead == kresFail); - } - bool DumbFallback(FontErrorCode * pferr = NULL) - { - if (pferr) - *pferr = m_ferr; - return (m_resFontValid != kresOk || m_resFontRead != kresOk); - } - - gid16 MapToPseudo(int nUnicode); - - // NEW interface - void AssignDefaultFeatures(int cfeat, FeatureSetting * prgfset); - - // Feature access for FontFace: - size_t NumberOfFeatures_ff(); - featid FeatureID_ff(size_t ifeat); - size_t FeatureWithID_ff(featid id); - bool GetFeatureLabel_ff(size_t ifeat, lgid language, utf16 * label); - int GetFeatureDefault_ff(size_t ifeat); - size_t NumberOfSettings_ff(size_t ifeat); - int GetFeatureSettingValue_ff(size_t ifeat, size_t ifset); - bool GetFeatureSettingLabel_ff(size_t ifeat, size_t ifset, lgid language, utf16 * label); - // Feature-label languages: - size_t NumberOfFeatLangs_ff(); - short GetFeatLabelLang_ff(size_t ilang); - // Language access for FontFace: - size_t NumberOfLanguages_ff(); - isocode GetLanguageCode_ff(size_t ilang); - - void SetUpFeatLangList(); - -//:Ignore -#ifdef OLD_TEST_STUFF - // For test procedures: - void SetUpCrossLineContextTest(); - void SetUpPseudoGlyphTest(); - void SetUpRuleActionTest(); - void SetUpRuleAction2Test(); - void SetUpAssocTest(); - void SetUpAssoc2Test(); - void SetUpDefaultAssocTest(); - void SetUpFeatureTest(); - void SetUpLigatureTest(); - void SetUpLigature2Test(); - - void InitFromControlFileTest(); -#endif // OLD_TEST_STUFF -//:End Ignore -}; - -} // namespace gr - -#if defined(GR_NO_NAMESPACE) -using namespace gr; -#endif - - -#endif // !GR_ENGINE_INCLUDED diff --git a/Build/source/libs/graphite/engine-2.3.1/src/segment/GrFSM.cpp b/Build/source/libs/graphite/engine-2.3.1/src/segment/GrFSM.cpp deleted file mode 100644 index 53182edab0d..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/src/segment/GrFSM.cpp +++ /dev/null @@ -1,526 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 1999, 2001 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: GrFSM.cpp -Responsibility: Sharon Correll -Last reviewed: Not yet. - -Description: - Implements the finite state machine. -----------------------------------------------------------------------------------------------*/ - -//:>******************************************************************************************** -//:> Include files -//:>******************************************************************************************** -#include "Main.h" -#include -#ifdef _MSC_VER -#pragma hdrstop -#endif -// any other headers (not precompiled) - -#undef THIS_FILE -DEFINE_THIS_FILE - -//:End Ignore - -//:>******************************************************************************************** -//:> Forward declarations -//:>******************************************************************************************** - -//:>******************************************************************************************** -//:> Local Constants and static variables -//:>******************************************************************************************** - -namespace gr -{ - -//:>******************************************************************************************** -//:> Methods -//:>******************************************************************************************** - -/*---------------------------------------------------------------------------------------------- - Fill in the FSM by reading from the font stream. - Assumes the stream is in the correct position. -----------------------------------------------------------------------------------------------*/ -bool GrFSM::ReadFromFont(GrIStream & grstrm, int fxdVersion) -{ - short snTmp; - - // number of FSM states - snTmp = grstrm.ReadShortFromFont(); - m_crow = snTmp; - // number of transitional states - snTmp = grstrm.ReadShortFromFont(); - int crowTransitional = snTmp; - // number of success states - snTmp = grstrm.ReadShortFromFont(); - int crowSuccess = snTmp; - m_crowFinal = m_crow - crowTransitional; - m_crowNonAcpt = m_crow - crowSuccess; - m_rowFinalMin = crowTransitional; - // number of columns - snTmp = grstrm.ReadShortFromFont(); - m_ccol = snTmp; - - // Sanity checks. - if (crowTransitional > m_crow || crowSuccess > m_crow) - return false; // bad table - // TODO: add a sanity check for m_ccol. - - // number of FSM glyph ranges and search constants - snTmp = grstrm.ReadShortFromFont(); - m_cmcr = snTmp; - snTmp = grstrm.ReadShortFromFont(); - m_dimcrInit = snTmp; - snTmp = grstrm.ReadShortFromFont(); - m_cLoop = snTmp; - snTmp = grstrm.ReadShortFromFont(); - m_imcrStart = snTmp; - - m_prgmcr = new GrFSMClassRange[m_cmcr]; - for (int imcr = 0; imcr < m_cmcr; imcr++) - { - m_prgmcr[imcr].m_chwFirst = grstrm.ReadUShortFromFont(); - m_prgmcr[imcr].m_chwLast = grstrm.ReadUShortFromFont(); - m_prgmcr[imcr].m_col = grstrm.ReadUShortFromFont(); - } - - // rule map and offsets (extra item at end gives final offset, ie, total) - m_prgirulnMin = new data16[crowSuccess + 1]; - data16 * pchw = m_prgirulnMin; - int i; - for (i = 0; i < (crowSuccess + 1); i++, pchw++) - { - *pchw = grstrm.ReadUShortFromFont(); - } - - // Last offset functions as the total length of the rule list. - // Note that the number of rules in the map is not necessarily equal to the number of - // rules in the pass; some rules may be listed multiply, if they are matched by more - // than one state. - int crulInMap = m_prgirulnMin[crowSuccess]; - m_prgrulnMatched = new data16[crulInMap]; - m_crulnMatched = crulInMap; - pchw = m_prgrulnMatched; - for (i = 0; i < crulInMap; i++, pchw++) - { - *pchw = grstrm.ReadUShortFromFont(); - } - - // min rule pre-context number of items - byte bTmp = grstrm.ReadByteFromFont(); - m_critMinRulePreContext = bTmp; - // max rule pre-context number of items - bTmp = grstrm.ReadByteFromFont(); - m_critMaxRulePreContext = bTmp; - - if (m_critMinRulePreContext > kMaxSlotsPerRule || m_critMaxRulePreContext > kMaxSlotsPerRule) - return false; // bad table - - int cStartStates = m_critMaxRulePreContext - m_critMinRulePreContext + 1; - - // start states - m_prgrowStartStates = new short[cStartStates]; - short * psn = m_prgrowStartStates; - for (int ic = 0; ic < cStartStates; ic++, psn++) - { - *psn = grstrm.ReadShortFromFont(); - } - - return true; -} - -/*---------------------------------------------------------------------------------------------- - Fill in the FSM's state table by reading from the font stream. - Assumes the stream is in the correct position. -----------------------------------------------------------------------------------------------*/ -bool GrFSM::ReadStateTableFromFont(GrIStream & grstrm, int fxdVersion) -{ - int cCells = ((m_crow - m_crowFinal) * m_ccol); - m_prgrowTransitions = new short[cCells]; - short * psn = m_prgrowTransitions; - for (int iCell = 0; iCell < cCells; iCell++, psn++) - { - *psn = grstrm.ReadShortFromFont(); - } - - return true; -} - -/*---------------------------------------------------------------------------------------------- - Use the transition table to find a rule or rules that match; then run the contraint - code to see if the rule is active. Return the rule number of the rule to be applied. - - @param ppass - pass, which knows how to run constraint code - @param psstrmIn - input stream - @param psstrmOut - output stream (from which to get recently output slots) -----------------------------------------------------------------------------------------------*/ -int GrFSM::GetRuleToApply(GrTableManager * ptman, GrPass * ppass, - GrSlotStream * psstrmIn, GrSlotStream * psstrmOut) -{ - // List of accepting states and corresponding count of slots that were - // matched by each. - int prgrowAccepting[kMaxSlotsPerRule]; - int prgcslotMatched[kMaxSlotsPerRule]; - - // Run the transition table until it jams. - int crowAccepting = RunTransitionTable(ppass, psstrmIn, psstrmOut, - prgrowAccepting, prgcslotMatched); - - // Nothing matched; fail quickly. - if (crowAccepting == 0) - return -1; - - int * prow = prgrowAccepting + crowAccepting - 1; - int * pcslot = prgcslotMatched + crowAccepting - 1; // # of slots matched AFTER the curr pos - - // Quick test for common case of exactly one rule matched. - if (crowAccepting == 1 && - (m_prgirulnMin[*prow - m_crowNonAcpt + 1] - m_prgirulnMin[*prow - m_crowNonAcpt]) == 1) - { - int iruln = m_prgirulnMin[*prow - m_crowNonAcpt]; - int ruln = m_prgrulnMatched[iruln]; - if (RunConstraintAndRecordLog(ptman, ppass, ruln, psstrmIn, psstrmOut, - ppass->PreModContextForRule(ruln), *pcslot)) - { - return ruln; - } - else - return -1; - } - - // Several rules were matched. We need to sort them and then run the constraints - // for each rule, accepting the first one whose constraints succeed. - - // Count up the number of rules that matched and allocate a buffer of the right size. - int crulMatched = 0; - while (prow >= prgrowAccepting) - { - crulMatched += - m_prgirulnMin[*prow - m_crowNonAcpt + 1] - m_prgirulnMin[*prow - m_crowNonAcpt]; - --prow; - } - MatchedRule * prgmr = new MatchedRule[crulMatched]; - - prow = prgrowAccepting + crowAccepting - 1; - - // Do a dumb insertion sort, ordering primarily by sort key (largest first) - // and secondarily by the order in the original file (rule number). - // Review: is this kind of sort fast enough? We assuming that we usually only - // have a handful of matched rules. - int cmr = 0; - while (prow >= prgrowAccepting) - { - int iruln = m_prgirulnMin[*prow - m_crowNonAcpt]; - // Get all the rules matches by a single state. - while (iruln < m_prgirulnMin[*prow - m_crowNonAcpt + 1]) - { - int ruln = m_prgrulnMatched[iruln]; - int nSortKey = ppass->SortKeyForRule(ruln); - int cslot = *pcslot; - int imr; - for (imr = 0; imr < cmr; imr++) - { - if (nSortKey > prgmr[imr].nSortKey || - (nSortKey == prgmr[imr].nSortKey && ruln < prgmr[imr].ruln)) - { - // Insert here. - memmove(prgmr+imr+1, prgmr+imr, (isizeof(MatchedRule) * (cmr - imr))); - prgmr[imr].ruln = ruln; - prgmr[imr].nSortKey = nSortKey; - prgmr[imr].cslot = cslot; - break; - } - } - if (imr >= cmr) - { - prgmr[cmr].ruln = ruln; - prgmr[cmr].nSortKey = nSortKey; - prgmr[cmr].cslot = cslot; - } - cmr++; - - iruln++; - } - --prow; - --pcslot; - } - - - for (int imr = 0; imr < cmr; imr++) - { - int ruln = prgmr[imr].ruln; - if (RunConstraintAndRecordLog(ptman, ppass, ruln, psstrmIn, psstrmOut, - ppass->PreModContextForRule(ruln), prgmr[imr].cslot)) - { - // Success! - delete[] prgmr; - return ruln; - } - } - - // No rule matched or the constraints failed. - delete[] prgmr; - return -1; -} - -/*---------------------------------------------------------------------------------------------- - Run the transition table, generating a list of rows corresponding to accepting states. - - @param psstrmIn - input stream - @param prgrowAccepting - array to fill in with accepting rows - @param prgcslotMatched - corresponding array with number of slots matched -----------------------------------------------------------------------------------------------*/ -int GrFSM::RunTransitionTable(GrPass * ppass, GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, - int * prgrowAccepting, int * prgcslotMatched) -{ - int ipass = ppass->PassNumber(); - - // Remember we're reading the pre-context items from the output stream, not the input. - int cslotPreContextAvail = psstrmOut->WritePos(); - - if (cslotPreContextAvail < m_critMinRulePreContext) - return 0; // not enough input to match any rule - - // Look backwards by the number of pre-context items for this pass, but not earlier - // than the beginning of the stream. - int cslot = -1 * min(cslotPreContextAvail, m_critMaxRulePreContext); - - // Normally the start state is state 0. But if we are near the beginning of the stream, - // we may need to adjust due to the fact that we don't have enough input yet to - // match the pre-context items in all the rules. So in effect we skip some states - // corresponding to the earlier items that aren't present. - int row = m_prgrowStartStates[max(0, m_critMaxRulePreContext - cslotPreContextAvail)]; - - int * prowTop = prgrowAccepting; - int * pcslotTop = prgcslotMatched; - while (true) - { - if (row >= m_rowFinalMin) - // final state--jammed - return (prowTop - prgrowAccepting); - - if (psstrmIn->SlotsPendingInContext() <= cslot) - // no more input - return (prowTop - prgrowAccepting); - - // Figure out what column the input glyph belong in. - // Since this is a time-critical routine, we cache the results for the current pass. - GrSlotState * pslot = (cslot < 0) ? - psstrmOut->PeekBack(cslot) : - psstrmIn->Peek(cslot); - int col; - if (pslot->PassNumberForColumn() == ipass) - { - col = pslot->FsmColumn(); - } - else - { - gid16 chwGlyphID = (cslot < 0) ? - psstrmOut->PeekBack(cslot)->GlyphID() : - psstrmIn->Peek(cslot)->GlyphID(); - col = FindColumn(chwGlyphID); - pslot->CacheFsmColumn(ipass, col); - } - int rowNext; - if (col < 0) - rowNext = 0; - else - rowNext = m_prgrowTransitions[(row * m_ccol) + col]; - - if (rowNext == 0) // jammed - return (prowTop - prgrowAccepting); - - cslot++; - if (rowNext >= m_crowNonAcpt) // or (rowNext < 0) - { - // Accepting state--push it on the stack. - //rowNext *= -1; - gAssert((prowTop - prgrowAccepting) < kMaxSlotsPerRule); - *prowTop++ = rowNext; - *pcslotTop++ = cslot; - } - row = rowNext; - - gAssert((prowTop - prgrowAccepting) == (pcslotTop - prgcslotMatched)); - } -} - -/*---------------------------------------------------------------------------------------------- - Run the transition table, generating a list of rows corresponding to accepting states. - Optimized to avoid matrix arithmetic for non-accepting states. - - Review: do we need to use this version? - - @param psstrmIn - input stream - @param prgrowAccepting - array to fill in with accepting rows - @param prgcslotMatched - corresponding array with number of slots matched -----------------------------------------------------------------------------------------------*/ -#if 0 - -int GrFSM::RunTransitionTableOptimized(GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, - int * prgrowAccepting, int * prgcslotMatched) -{ - int cslot = 0; - int ichwRowOffset = 0; - int ichwRowOffsetLim = m_crowFinal * m_ccol; // number of cells - int * prowTop = prgrowAccepting; - int * pcslotTop = prgcslotMatched; - while (true) - { - if (ichwRowOffset >= ichwRowOffsetLim) - // final state--jammed - return (prowTop - prgrowAccepting); - - if (psstrmIn->SlotsPendingInContext() < cslot) - // no more input - return (prowTop - prgrowAccepting); - - gid16 chwGlyphID = psstrmIn->Peek(cslot)->GlyphID(); - int col = FindColumn(chwGlyphID); - short cellValue = *(m_prgprgrowXitions + ichwRowOffset + col); - - if (cellValue == 0) // jammed - return (prowTop - prgrowAccepting); - - cslot++; - if (cellValue < 0) - { - // Accepting state--push it on the stack. - int rowNext = cellValue * -1; - gAssert((prowTop - prgrowAccepting) < kMaxSlotsPerRule); - *prowTop++ = rowNext; - *pcslotTop++ = cslot; - ichwRowOffset = rowNext * m_ccol; - } - else - ichwRowOffset = cellValue; - - gAssert((prowTop - prgrowAccepting) == (pcslotTop - prgcslotMatched)); - } -} - -#endif // 0 - - -/*---------------------------------------------------------------------------------------------- - Run all the constraints for the rules matched by the state that we have reached. - The rules are ordered as they were in the GDL file. When we hit a constraint that - matches, return the corresponding rule number. Return -1 if no rule passed. - - @param ppass - pass, which knows how to actually run the constraints - @param psstrmIn - input stream - @param cslotMatched - number of slots matched; constraints must be run for each of these -----------------------------------------------------------------------------------------------*/ -//:Ignore -int GrFSM::RunConstraints_Obsolete(GrTableManager * ptman, GrPass * ppass, int row, - GrSlotStream * psstrmIn, int cslotMatched) -{ - int iruln = m_prgirulnMin[row - m_crowNonAcpt]; - while (iruln < m_prgirulnMin[row - m_crowNonAcpt + 1]) - { - int ruln = m_prgrulnMatched[iruln]; - bool fSuccess = ppass->RunConstraint(ptman, ruln, psstrmIn, NULL, 0, cslotMatched); - if (fSuccess) - { - if (ptman->LoggingTransduction()) - ppass->RecordRuleFired(psstrmIn->ReadPosForNextGet(), ruln); - return ruln; - } - else - { - if (ptman->LoggingTransduction()) - ppass->RecordRuleFailed(psstrmIn->ReadPosForNextGet(), ruln); - } - - iruln++; - } - return -1; // no rule succeeded -} -//:End Ignore - -/*---------------------------------------------------------------------------------------------- - Run the constraints for the given rule, and record whether it failed or succeeded in the - transduction log. - - @param ppass - pass, which knows how to actually run the constraints - @param psstrmIn - input stream - @param cslotPreModContext - number of slots before the current position that must be tested - @param islotLimMatched - number of slots matched AFTER the current position - - @return True if the constraints succeeded. -----------------------------------------------------------------------------------------------*/ -bool GrFSM::RunConstraintAndRecordLog(GrTableManager * ptman, GrPass * ppass, int ruln, - GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, - int cslotPreModContext, int islotLimMatched) -{ - bool fSuccess = ppass->RunConstraint(ptman, ruln, psstrmIn, psstrmOut, - cslotPreModContext, islotLimMatched); - - if (ptman->LoggingTransduction()) - { - if (fSuccess) - ppass->RecordRuleFired(psstrmIn->ReadPosForNextGet(), ruln); - else - ppass->RecordRuleFailed(psstrmIn->ReadPosForNextGet(), ruln); - } - - return fSuccess; -} - -/*---------------------------------------------------------------------------------------------- - Search for the class range containing the glyph ID, and return the matching FSM column. - Does a fast binary search that uses only shifts, no division. -----------------------------------------------------------------------------------------------*/ -int GrFSM::FindColumn(gid16 chwGlyphID) -{ - #ifdef _DEBUG - // Check that the pre-calculated constants are correct. - int nPowerOf2 = 1; - while (nPowerOf2 <= m_cmcr) - nPowerOf2 <<= 1; - nPowerOf2 >>= 1; - // Now nPowerOf2 is the max power of 2 <= m_cclsrg. - // m_cLoop is not needed for our purposes, but it is included because it is part of - // the TrueType standard. - gAssert(1 << m_cLoop == nPowerOf2); // m_cloop == log2(nPowerOf2) - gAssert(m_dimcrInit == nPowerOf2); - gAssert(m_imcrStart == m_cmcr - m_dimcrInit); - #endif - - int dimcrCurr = m_dimcrInit; - - GrFSMClassRange * pmcrCurr = m_prgmcr + m_imcrStart; - while (dimcrCurr > 0) - { - int nTest; - if (pmcrCurr < m_prgmcr) - nTest = -1; - else - { - nTest = pmcrCurr->m_chwFirst - chwGlyphID; - if (nTest < 0 && chwGlyphID <= pmcrCurr->m_chwLast) - //nTest = 0; - // This is a tiny bit more efficient: - return pmcrCurr->m_col; - } - - if (nTest == 0) - // found it - return pmcrCurr->m_col; - - dimcrCurr >>= 1; // divide by 2 - if (nTest < 0) - pmcrCurr += dimcrCurr; - else // (nTest > 0) - pmcrCurr -= dimcrCurr; - } - - return -1; -} - -} // namespace gr diff --git a/Build/source/libs/graphite/engine-2.3.1/src/segment/GrFSM.h b/Build/source/libs/graphite/engine-2.3.1/src/segment/GrFSM.h deleted file mode 100644 index b1909553daa..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/src/segment/GrFSM.h +++ /dev/null @@ -1,245 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 1999, 2001 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: GrFSM.h -Responsibility: Sharon Correll -Last reviewed: Not yet. - -Description: - The GrFSM class, which is the mechanism that examines input in a glyph stream and - determines which rule matches and should be run. -----------------------------------------------------------------------------------------------*/ -#ifdef _MSC_VER -#pragma once -#endif -#ifndef FSM_INCLUDED -#define FSM_INCLUDED - -//:End Ignore - -namespace gr -{ - -class GrPass; - -/*---------------------------------------------------------------------------------------------- - A machine class range consists of a range of contiguous glyph IDs that map to - a single column in the FSM (a machine class). (Note that there might be more than one - range mapping to a given column.) - - Keep in mind that these "classes" are completely different from the classes that - are used for substitution. These are used only for matching by the FSM. - - Hungarian: mcr -----------------------------------------------------------------------------------------------*/ -class GrFSMClassRange -{ - friend class GrFSM; - -protected: - gid16 m_chwFirst; // first glyph ID in range - gid16 m_chwLast; // last glyph ID in range - data16 m_col; // column (machine class) to which this range maps -}; - -/*---------------------------------------------------------------------------------------------- - The finite state machine that is used to match sequences of glyphs and - determine which rule to apply. There is one FSM per pass. - - The states in the FSM are grouped and ordered in the following way: - - non-accepting states (no rule completely matched) - - accepting non-final states (a rule matched, but a longer rule is possible) - - final states (a rule matched and no longer rule is possible) - In other words, we have: - - transition, non-accepting - - transition, accepting - - non-transition, accepting - The transition states have information about the next state to transition to; - the accepting states have information about the rule(s) that matched. - - There are three main data structures that are part of the finite state machine: - - (1) the transition matrix: m_prgprgrowXitions. It contains a row for each transition - state (non-accepting states plus accepting non-final states), and a column for each - machine class. The cell values indicate the next state to transition to for the - matched input. A positive number indicates that the next state is a non-accepting state; - a negative value indicates an accepting state. Zero means there is no next state; - no more matches are possible; machine has "jammed." - - (2) the matched-rule list: m_prgrulnMatched. This is a list of rule numbers, - which are indices into the pass's action- and constraint-code arrays. - It contains the numbers of the rules matched by the first accepting state, - followed by those matched by the second accepting state, etc. For each state, - the rules must be ordered using the same order of the rules in the RDL file. - - (3) the matched-rule-offsets list: m_prgirulnMin. This gives the starting index into - the matched-rule list for each accepting state. (Non-accepting states are not included, - so the first item is for state m_crowNonAcpt.) - - In addition, the FSM interacts with the action- and constraint-code lists in the pass - itself. These lists are indexed by rule number (the values of m_prgrulnMatched). - When some input matches the rule, the constraint-code is run; if it succeeds, - the rule number is returned to the caller and that rule is applied (ie, the action-code - is run). - - Hungarian: fsm - - Other hungarian: - row - row (state) - col - column (machine class) - ruln - rule number - - REVIEW: This is quite a time-critical class, and there are two potential optimizations - that have been proposed for the value of a cell: - - (1) use a negative cell number to indicate an accepting state and a positive number - to indicate a non-accepting state. So this gives a comparison with zero rather than - some arbitrary number - - (2) have the positive numbers--the most common case--be the actual byte offset into the - table rather than the row number. This saves matrix multiplication at each step, - ie, "m_prgsnTransitions[(row * m_ccol) + col]". - - The two versions are implemented in RunTransitionTable and RunTransitionTableOptimized. - Do these seem to be worth the inconvenience of added complexity in understanding - and debugging? -----------------------------------------------------------------------------------------------*/ -class GrFSM -{ - friend class FontMemoryUsage; - -public: - GrFSM() : - m_prgirulnMin(NULL), - m_prgrulnMatched(NULL), - m_prgrowTransitions(NULL), - m_prgibStateDebug(NULL), - m_prgmcr(NULL), - m_prgrowStartStates(NULL) - { - } - - ~GrFSM() - { - delete[] m_prgirulnMin; - delete[] m_prgrulnMatched; - - delete[] m_prgrowTransitions; - - delete[] m_prgibStateDebug; - - delete[] m_prgmcr; - - delete[] m_prgrowStartStates; - } - - bool ReadFromFont(GrIStream & grstrm, int fxdVersion); - bool ReadStateTableFromFont(GrIStream & grstrm, int fxdVersion); - - int GetRuleToApply(GrTableManager *, GrPass * ppass, - GrSlotStream * psstrmIn, GrSlotStream * psstrmOut); - - int RunTransitionTable(GrPass * ppass, GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, - int * prgrowAccepting, int * prgcslotMatched); - int RunTransitionTableOptimized(GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, - int * prgrowAccepting, int * prgcslotMatched); - bool RunConstraintAndRecordLog(GrTableManager *, GrPass * ppass, int ruln, - GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, - int cslotPreModContext, int cslotMatched); - - int RunConstraints_Obsolete(GrTableManager *, GrPass * ppass, int row, GrSlotStream * psstrmIn, - int cslotMatched); - - // For sorting matched rules - struct MatchedRule // mr - { - int ruln; - int nSortKey; - int cslot; // number of slots matched AFTER the current stream position - }; - - int MaxRulePreContext() - { - return m_critMaxRulePreContext; - } - -protected: - int FindColumn(gid16 chwGlyphID); -protected: - // Instance variables: - int m_crow; // number of rows (states) - int m_crowFinal; // number of final states; no transitions for these - int m_rowFinalMin; // index of first final row - int m_crowNonAcpt; // number of non-accepting states; no rule indices for these - - int m_ccol; // number of columns (machine classes) - - data16 * m_prgirulnMin; // m_crow-m_crowNonAcpt+1 of these; - // index within m_prgrulnMatched, start of matched - // rules for each accepting state - - data16 * m_prgrulnMatched; // long ordered list of rule indices matched by - // subsequent states; total length is sum of number - // of rules matched for each accepting state - int m_crulnMatched; // needed only for memory instrumentation - - // Transition matrix--for optimized version: -// short ** m_prgprgrowXitions; // ((m_crow-m_crowFinal) * m_ccol) of these; - // positive number indicates - // next state is non-accepting; negative number is - // negative of accepting state. - - // Transition matrix--for current version: - short * m_prgrowTransitions; // ((m_crow-m_crowFinal) * m_ccol) of these - - // debugger string offsets - data16 * m_prgibStateDebug; // for transition states; (m_crow-m_crul+1) of these - - // constants for fast binary search; these are generated by the compiler so that the - // engine doesn't have to take time to do it - data16 m_dimcrInit; // (max power of 2 <= m_cmcr); - // size of initial range to consider - data16 m_cLoop; // log2(max power of 2 <= m_cmcr); - // indicates how many iterations are necessary - data16 m_imcrStart; // m_cmcr - m_dimcrInit; - // where to start search - - int m_cmcr; // number of machine-class-ranges - GrFSMClassRange * m_prgmcr; // array of class ranges; we search these to find the - // mapping to the machine-class-column - - // minimum and maximum number of items in the rule contexts before the first modified - // item. - int m_critMinRulePreContext; - int m_critMaxRulePreContext; - - // start states--row in the FSM to start on depending on how many bogus slots we - // are skipping; (max rule-precontext - min rule-precontext + 1) of these; - // first always = zero - short * m_prgrowStartStates; - -//:Ignore -#if OLD_TEST_STUFF -public: - // For test procedures: - void SetUpSimpleFSMTest(); - void SetUpRuleActionTest(); - void SetUpRuleAction2Test(int); - void SetUpAssocTest(int); - void SetUpAssoc2Test(int); - void SetUpDefaultAssocTest(); - void SetUpFeatureTest(); - void SetUpLigatureTest(int); - void SetUpLigature2Test(int); -#endif // OLD_TEST_STUFF -//:End Ignore - -}; - -} // namespace gr - - -#endif // !FSM_INCLUDED diff --git a/Build/source/libs/graphite/engine-2.3.1/src/segment/GrFeature.cpp b/Build/source/libs/graphite/engine-2.3.1/src/segment/GrFeature.cpp deleted file mode 100644 index 61970d56949..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/src/segment/GrFeature.cpp +++ /dev/null @@ -1,321 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 1999, 2001 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: GrFeature.cpp -Responsibility: Sharon Correll -Last reviewed: Not yet. - -Description: - Implements the GrFeature class. --------------------------------------------------------------------------------*//*:End Ignore*/ - -//:>******************************************************************************************** -//:> Include files -//:>******************************************************************************************** -#include "Main.h" -#include - -#ifdef _MSC_VER -#pragma hdrstop -#endif -#undef THIS_FILE -DEFINE_THIS_FILE - -//:>******************************************************************************************** -//:> Forward declarations -//:>******************************************************************************************** - -//:>******************************************************************************************** -//:> Local Constants and static variables -//:>******************************************************************************************** - -namespace gr -{ - -//:>******************************************************************************************** -//:> GrFeature Methods -//:>******************************************************************************************** - -/*---------------------------------------------------------------------------------------------- - Initialize the feature. -----------------------------------------------------------------------------------------------*/ -void GrFeature::Initialize(featid nID, int nNameId, int cfset, int nDefault) -{ - m_nID = nID; - m_nNameId = nNameId; - m_nDefault = nDefault; - - m_vnVal.resize(cfset); - for (unsigned int ifset = 0; ifset < m_vnVal.size(); ifset++) - m_vnVal[ifset] = INT_MAX; - m_vnNameId.resize(cfset); -} - -/*---------------------------------------------------------------------------------------------- - Return the feature settings. -----------------------------------------------------------------------------------------------*/ -int GrFeature::Settings(int cMax, int * prgnVal) -{ - int cRet = min(cMax, signed(m_vnVal.size())); - for (int ifset = 0; ifset < cRet; ifset++) - prgnVal[ifset] = m_vnVal[ifset]; - return cRet; -} - -/*---------------------------------------------------------------------------------------------- - Add a feature setting. -----------------------------------------------------------------------------------------------*/ -void GrFeature::AddSetting(int nVal, int nNameId) -{ - Assert(nVal != INT_MAX); - unsigned int ifset; - for (ifset = 0; ifset < m_vnVal.size(); ifset++) - { - if (m_vnVal[ifset] == nVal) - return; // already there - } - for (ifset = 0; ifset < m_vnVal.size(); ifset++) - { - if (m_vnVal[ifset] == INT_MAX) - { - m_vnVal[ifset] = nVal; - m_vnNameId[ifset] = nNameId; - return; - } - } - m_vnVal.push_back(nVal); - m_vnNameId.push_back(nNameId); -} - -/*---------------------------------------------------------------------------------------------- - Return true if the given setting is valid according to the font's feature table. -----------------------------------------------------------------------------------------------*/ -bool GrFeature::IsValidSetting(int nVal) -{ - for (unsigned int ifset = 0; ifset < m_vnVal.size(); ifset++) - { - if (m_vnVal[ifset] == nVal) - return true; - } - return false; -} - -/*---------------------------------------------------------------------------------------------- - Read the feature label from the name table. -----------------------------------------------------------------------------------------------*/ -std::wstring GrFeature::Label(GrEngine * pgreng, int nLang) -{ - std::wstring stu = pgreng->StringFromNameTable(nLang, m_nNameId); - if (stu == L"NoName") - stu.erase(); - return stu; -} - -/*---------------------------------------------------------------------------------------------- - Read the feature value label from the name table. -----------------------------------------------------------------------------------------------*/ -std::wstring GrFeature::SettingLabel(GrEngine * pgreng, int nVal, int nLang) -{ - for (unsigned int ifset = 0; ifset < m_vnVal.size(); ifset++) - { - if (m_vnVal[ifset] == nVal) - { - std::wstring stu = pgreng->StringFromNameTable(nLang, m_vnNameId[ifset]); - if (stu == L"NoName") - stu.erase(); - return stu; - } - } - Assert(false); // setting is not valid - return L""; -} - -/*---------------------------------------------------------------------------------------------- - Return the given setting value. -----------------------------------------------------------------------------------------------*/ -int GrFeature::NthSetting(int ifset) -{ - if (ifset >= (int)m_vnVal.size()) - return -1; - else - return m_vnVal[ifset]; -} - -/*---------------------------------------------------------------------------------------------- - Read the feature value label for the given index. -----------------------------------------------------------------------------------------------*/ -std::wstring GrFeature::NthSettingLabel(GrEngine * pgreng, int ifset, int nLang) -{ - std::wstring stu; - - if (ifset >= (int)m_vnVal.size()) - stu.erase(); - else - { - stu = pgreng->StringFromNameTable(nLang, m_vnNameId[ifset]); - if (stu == L"NoName") - stu.erase(); - } - return stu; -} - -/*---------------------------------------------------------------------------------------------- - Return the feature setting label. -----------------------------------------------------------------------------------------------*/ -// void GrFeature::SetSettingLabel(int nVal, std::wstring stuLabel, int nLang) -// { -// for (int ifset = 0; ifset < m_vfset.size(); ifset++) -// { -// if (m_vfset[ifset].m_nVal == nVal) -// { -// m_vfset[ifset].m_hmnstuLabels.Insert(nLang, stuLabel, true); -// return; -// } -// } -// Assert(false); // setting is not valid -// } - - -//:>******************************************************************************************** -//:> GrLangTable Methods -//:>******************************************************************************************** - -/*---------------------------------------------------------------------------------------------- - Read the languages from the font. -----------------------------------------------------------------------------------------------*/ -bool GrLangTable::ReadFromFont(GrIStream * pgrstrm, int fxdVersion) -{ - GrIStream & grstrm = *pgrstrm; - - // number of languages - m_clang = (size_t)grstrm.ReadUShortFromFont(); - - // search constants - m_dilangInit = grstrm.ReadUShortFromFont(); - m_cLoop = grstrm.ReadUShortFromFont(); - m_ilangStart = grstrm.ReadUShortFromFont(); - - // Slurp the data into the buffers. The "+1" represents a bogus ending entry that quickly - // gives us the size of the feature list. Note that the resulting data is all big-endian. - int cb = (m_clang + 1) * sizeof(LangEntry); - m_prglang = new LangEntry[m_clang + 1]; - grstrm.ReadBlockFromFont(m_prglang, cb); - - m_cbOffset0 = (lsbf)(m_prglang[0].cbOffsetBIG); - - Assert((lsbf)(m_prglang[m_clang].cFeaturesBIG) == 0); // bogus entry has no settings - cb = (lsbf)(m_prglang[m_clang].cbOffsetBIG) - m_cbOffset0; - Assert(cb % sizeof(FeatSet) == 0); // # of bytes fits nicely into FeatSet class - int cfset = cb / sizeof(FeatSet); - m_prgfset = new FeatSet[cfset]; - m_cfset = cfset; - grstrm.ReadBlockFromFont(m_prgfset, cb); - - return true; -} - -/*---------------------------------------------------------------------------------------------- - Create an empty language table to use for dumb rendering, or when there is no valid - Sill table. -----------------------------------------------------------------------------------------------*/ -void GrLangTable::CreateEmpty() -{ - m_prglang = NULL; - m_prgfset = NULL; - m_clang = 0; - m_dilangInit = 0; - m_cLoop = 0; - m_ilangStart = 0; -} - -/*---------------------------------------------------------------------------------------------- - Return information about the language with the given ID by filling in the given vectors - with the feature ids and values. Will wipe out any data in the vectors already. -----------------------------------------------------------------------------------------------*/ -void GrLangTable::LanguageFeatureSettings(isocode lgcode, - std::vector & vnFeatId, std::vector & vnValues) -{ - vnFeatId.clear(); - vnValues.clear(); - - int ilang = FindIndex(lgcode); - if (ilang == -1) - return; // no such language: leave vectors empty - - LangEntry * plang = m_prglang + ilang; - int cbOffset = lsbf(plang->cbOffsetBIG) - m_cbOffset0; - Assert(cbOffset % sizeof(FeatSet) == 0); - byte * pbFeatSet = reinterpret_cast(m_prgfset) + cbOffset; - FeatSet * pfset = reinterpret_cast(pbFeatSet); - for (int ifset = 0; ifset < lsbf(plang->cFeaturesBIG); ifset++) - { - vnFeatId.push_back(lsbf(pfset[ifset].featidBIG)); - vnValues.push_back(lsbf(pfset[ifset].valueBIG)); - } -} - -/*---------------------------------------------------------------------------------------------- - Return the code for the language at the given index. -----------------------------------------------------------------------------------------------*/ -isocode GrLangTable::LanguageCode(size_t ilang) -{ - isocode lgcodeRet; - if (ilang > m_clang) - { - std::fill_n(lgcodeRet.rgch, 4, '\0'); - return lgcodeRet; - } - LangEntry * plang = m_prglang + ilang; - std::copy(plang->rgchCode, plang->rgchCode + 4, lgcodeRet.rgch); - return lgcodeRet; -} - -/*---------------------------------------------------------------------------------------------- - Return the index of the language in the list. -----------------------------------------------------------------------------------------------*/ -int GrLangTable::FindIndex(isocode lgcode) -{ - if (m_clang == 0) - return -1; -#ifdef _DEBUG - int nPowerOf2 = 1; - while (nPowerOf2 <= signed(m_clang)) - nPowerOf2 <<= 1; - nPowerOf2 >>= 1; - // Now nPowerOf2 is the max power of 2 <= m_clang - gAssert((1 << m_cLoop) == nPowerOf2); // m_cLoop == log2(nPowerOf2) - gAssert(m_dilangInit == nPowerOf2); - gAssert(m_ilangStart == m_clang - m_dilangInit); -#endif // _DEBUG - - int dilangCurr = m_dilangInit; - - int ilangCurr = m_ilangStart; // may become < 0 - while (dilangCurr > 0) - { - int nTest; - if (ilangCurr < 0) - nTest = -1; - else - { - LangEntry * plangCurr = m_prglang + ilangCurr; - nTest = strcmp(plangCurr->rgchCode, lgcode.rgch); - } - - if (nTest == 0) - return ilangCurr; - - dilangCurr >>= 1; // divide by 2 - if (nTest < 0) - ilangCurr += dilangCurr; - else // (nTest > 0) - ilangCurr -= dilangCurr; - } - - return -1; -} - -} // namespace gr diff --git a/Build/source/libs/graphite/engine-2.3.1/src/segment/GrFeatureValues.h b/Build/source/libs/graphite/engine-2.3.1/src/segment/GrFeatureValues.h deleted file mode 100644 index 97e6a1fe33c..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/src/segment/GrFeatureValues.h +++ /dev/null @@ -1,66 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 1999, 2001 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: GrFeatureValues.h -Responsibility: Sharon Correll -Last reviewed: Not yet. - -Description: - - -----------------------------------------------------------------------------------------------*/ -#ifdef _MSC_VER -#pragma once -#endif -#ifndef GR_FEATVAL_INCLUDED -#define GR_FEATVAL_INCLUDED - -//:End Ignore - -namespace gr -{ - -/*---------------------------------------------------------------------------------------------- - A convenient way to group together style and feature information that interacts - with the rules. - - Hungarian: fval -----------------------------------------------------------------------------------------------*/ -class GrFeatureValues -{ - friend class GrCharStream; - friend class GrSlotAbstract; - friend class GrSlotState; - -public: - // Standard constructor: - GrFeatureValues() - { - m_nStyleIndex = 0; - std::fill(m_rgnFValues, m_rgnFValues + kMaxFeatures, 0); - } - - // Copy constructor: - GrFeatureValues(const GrFeatureValues & fval) - { - m_nStyleIndex = fval.m_nStyleIndex; - std::copy(fval.m_rgnFValues, fval.m_rgnFValues + kMaxFeatures, m_rgnFValues); - } - - // For transduction logging: -#ifdef TRACING - void WriteXductnLog(GrTableManager * ptman, std::ostream &); -#endif // TRACING - -protected: - int m_nStyleIndex; - int m_rgnFValues[kMaxFeatures]; -}; - -} // namespace gr - - -#endif // !GR_FEATVAL_INCLUDED diff --git a/Build/source/libs/graphite/engine-2.3.1/src/segment/GrGlyphTable.cpp b/Build/source/libs/graphite/engine-2.3.1/src/segment/GrGlyphTable.cpp deleted file mode 100644 index 8643eae8cb8..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/src/segment/GrGlyphTable.cpp +++ /dev/null @@ -1,650 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 1999, 2001 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: GrGlyphTable.cpp -Responsibility: Sharon Correll -Last reviewed: 10Aug99, JT, quick look over - -Description: - Implements the GrGlyphTable class and related classes. -----------------------------------------------------------------------------------------------*/ - -//:>******************************************************************************************** -//:> Include files -//:>******************************************************************************************** -#include "Main.h" - -#ifdef _MSC_VER -#pragma hdrstop -#endif -#undef THIS_FILE -DEFINE_THIS_FILE - -//:End Ignore - -//:>******************************************************************************************** -//:> Forward declarations -//:>******************************************************************************************** - -//:>******************************************************************************************** -//:> Local Constants and static variables -//:>******************************************************************************************** - -namespace gr -{ - -//:>******************************************************************************************** -//:> Methods -//:>******************************************************************************************** - -/*---------------------------------------------------------------------------------------------- - Fill in the glyph table from the font stream. -----------------------------------------------------------------------------------------------*/ -bool GrGlyphTable::ReadFromFont(GrIStream & grstrmGloc, long lGlocStart, - GrIStream & grstrmGlat, long lGlatStart, - data16 chwBWAttr, data16 chwJStrAttr, int cJLevels, int cnCompPerLig, - int fxdSilfVersion) -{ - // Create the glyph sub-table for the single style. - GrGlyphSubTable * pgstbl = new GrGlyphSubTable(); - - // Gloc table--offsets into Glat table - grstrmGloc.SetPositionInFont(lGlocStart); - - // version - int fxdGlocVersion = GrEngine::ReadVersion(grstrmGloc); - if (fxdGlocVersion > kGlocVersion) - return false; - - // flags - short snFlags = grstrmGloc.ReadShortFromFont(); - - // number of attributes - unsigned short cAttrs = grstrmGloc.ReadUShortFromFont(); - - // Create a single sub-table for the single style. - pgstbl->Initialize(fxdSilfVersion, snFlags, chwBWAttr, chwJStrAttr, data16(chwJStrAttr + cJLevels), - m_cglf, cAttrs, cnCompPerLig); - - SetSubTable(0, pgstbl); - - return pgstbl->ReadFromFont(grstrmGloc, m_cglf, grstrmGlat, lGlatStart); -} - -bool GrGlyphSubTable::ReadFromFont(GrIStream & grstrmGloc, int cGlyphs, - GrIStream & grstrmGlat, long lGlatStart) -{ - // attribute value offsets--slurp - if (m_fGlocShort) - { - grstrmGloc.ReadBlockFromFont(m_prgibBIGAttrValues, ((cGlyphs + 1) * sizeof(data16))); - } - else - { - grstrmGloc.ReadBlockFromFont(m_prgibBIGAttrValues, ((cGlyphs + 1) * sizeof(data32))); - } - - // length of buffer needed for glyph attribute values: - int cbBufLen = GlocLookup(data16(cGlyphs)); - - // TODO: slurp debugger offsets: 'm_prgibBIGGlyphAttrDebug' - - m_pgatbl = new GrGlyphAttrTable(); - m_pgatbl->Initialize(m_fxdSilfVersion, cbBufLen); - - // Glat table - grstrmGlat.SetPositionInFont(lGlatStart); - - // version - int fxdGlatVersion = grstrmGlat.ReadIntFromFont(); - if (fxdGlatVersion > kGlatVersion) - return false; - - // Back up over the version number and include it right in the attribute value entry - // buffer, since the offsets take it into account. - grstrmGlat.SetPositionInFont(lGlatStart); - - // Slurp the entire block of entries. - grstrmGlat.ReadBlockFromFont(m_pgatbl->m_prgbBIGEntries, cbBufLen); - - return true; -} - -/*---------------------------------------------------------------------------------------------- - Create an empty glyph table with no glyph attributes. -----------------------------------------------------------------------------------------------*/ -void GrGlyphTable::CreateEmpty() -{ - // Create the glyph sub-table for the single style. - GrGlyphSubTable * pgstbl = new GrGlyphSubTable(); - - // Create a single sub-table for the single style. - pgstbl->Initialize(0, 0, 0, 0, 0, m_cglf, 0, 0); - - SetSubTable(0, pgstbl); - - pgstbl->CreateEmpty(); -} - -void GrGlyphSubTable::CreateEmpty() -{ - m_pgatbl = new GrGlyphAttrTable(); - m_pgatbl->Initialize(0, 0); -} - -/*---------------------------------------------------------------------------------------------- - Initialization. -----------------------------------------------------------------------------------------------*/ -void GrGlyphSubTable::Initialize(int fxdSilfVersion, utf16 chwFlags, - data16 chwBWAttr, data16 chwJStrAttr, data16 chwJStrHWAttr, - int cGlyphs, int cAttrs, int cnCompPerLig) -{ - m_fxdSilfVersion = fxdSilfVersion; - m_fHasDebugStrings = HasAttrNames(chwFlags); - m_nAttrIDLim = cAttrs; - m_chwBWAttr = chwBWAttr; - m_chwJStrAttr = chwJStrAttr; - m_chwJStrHWAttr = chwJStrHWAttr; - m_fGlocShort = !LongFormat(chwFlags); - - if (m_fGlocShort) - { // item # cGlyphs holds length, which is convenient for dealing with last item - m_prgibBIGAttrValues = new byte[(cGlyphs + 1) * sizeof(data16)]; - } - else - { - m_prgibBIGAttrValues = new byte[(cGlyphs + 1) * sizeof(data32)]; - } - - - if (m_fHasDebugStrings) - { - m_prgibBIGGlyphAttrDebug = new data16[cAttrs + 1]; - } - - // Make a cache to hold a list of defined components for each glyph. This is - // calculated lazily, as needed, so we also include (as the first item) a flag to - // indicate whether or not it has been calculated; hence the "+1". - m_cnCompPerLig = cnCompPerLig; - m_prgnDefinedComponents = new int[(m_cnCompPerLig + 1) * cGlyphs]; - std::fill_n(m_prgnDefinedComponents, (m_cnCompPerLig + 1) * cGlyphs, 0); - - // Now the instance is ready to have the locations and the debug strings - // read from the file. -} - -/*---------------------------------------------------------------------------------------------- - Return the attribute value for the given glyph. -----------------------------------------------------------------------------------------------*/ -int GrGlyphSubTable::GlyphAttrValue(gid16 chwGlyphID, int nAttrID) -{ - if (m_nAttrIDLim == 0) - { - // No attributes defined (eg, invalid font) - return 0; - } - if (nAttrID >= m_nAttrIDLim || nAttrID >= 0xFF) - { - gAssert(false); - return 0; - } - int ibMin = GlocLookup(chwGlyphID); // where this glyph's attrs start - int ibLim = GlocLookup(chwGlyphID + 1); // where next glyph starts - - int nRet = m_pgatbl->GlyphAttr16BitValue(ibMin, ibLim, byte(nAttrID)); - if ((data16)nAttrID == m_chwJStrAttr) - { - // For justify.stretch, which can be a 32-bit value, add on the high word. - unsigned int nRetHW = m_pgatbl->GlyphAttr16BitValue(ibMin, ibLim, byte(m_chwJStrHWAttr)); - nRet = (nRetHW << 16) | nRet; - } - return ConvertValueForVersion(nRet, nAttrID); -} - -/*---------------------------------------------------------------------------------------------- - Convert the glyph attribute value from the version of the font table to what is - expected by the engine. -----------------------------------------------------------------------------------------------*/ -int GrGlyphSubTable::ConvertValueForVersion(int nValue, int nAttrID) -{ - return ConvertValueForVersion(nValue, nAttrID, (int)m_chwBWAttr, m_fxdSilfVersion); -} - -int GrGlyphSubTable::ConvertValueForVersion(int nValue, int nAttrID, int nBWAttr, int fxdVersion) -{ - if ((nBWAttr >= 0 && nAttrID == (int)nBWAttr) || - (nBWAttr == -1 && nAttrID == (int)kslatBreak)) - { - if (fxdVersion < 0x00020000) - { - //switch (nValue) - //{ - //case klbv1WordBreak: return klbWordBreak; - //case klbv1HyphenBreak: return klbHyphenBreak; - //case klbv1LetterBreak: return klbLetterBreak; - //case klbv1ClipBreak: return klbClipBreak; - //default: - // break; - //} - //switch (nValue * -1) - //{ - //case klbv1WordBreak: return (klbWordBreak * -1); - //case klbv1HyphenBreak: return (klbHyphenBreak * -1); - //case klbv1LetterBreak: return (klbLetterBreak * -1); - //case klbv1ClipBreak: return (klbClipBreak * -1); - //default: - // break; - //} - - // Breakweight values in version 2 are 10 times what they were in version 1. - if (abs(nValue) <= 7) - return nValue * 10; - } - } - return nValue; -} - -/*---------------------------------------------------------------------------------------------- - Return the attribute value a glyph. Loop through the attribute runs, looking - for the one containing the given attribute. Assume the value is 0 if not found. - - @param ibMin - byte offset of first run for the glyph of interest - @param ibLim - byte offset of first run for the following glyph - @param bAttrID - attribute to find -----------------------------------------------------------------------------------------------*/ -int GrGlyphAttrTable::GlyphAttr16BitValue(int ibMin, int ibLim, byte bAttrID) -{ - GrGlyphAttrRun gatrun; - byte * pbBIGEnt = m_prgbBIGEntries + ibMin; - - while (pbBIGEnt < m_prgbBIGEntries + ibLim) - { - // Suck the run of attribute values into the instance, so we can see - // what's there. - gatrun.CopyFrom(pbBIGEnt); - - if (bAttrID < gatrun.m_bMinAttrID) - // Attribute not found--assume value is 0. - return 0; - else if (gatrun.m_bMinAttrID + gatrun.m_cAttrs > bAttrID) - { - // Found the value in this run. - data16 chw = lsbf(gatrun.m_rgchwBIGValues[bAttrID - gatrun.m_bMinAttrID]); - if ((chw & 0x8000) == 0) - return (int)chw; - else - return 0xFFFF0000 | chw; // sign extension - } - else - // Go to next run. - pbBIGEnt += gatrun.ByteCount(); - } - - // Attribute not found--assume value is 0; - return 0; -} - -/*---------------------------------------------------------------------------------------------- - Given a point on the glyph, determine which component (if any) the point is in, and return - its index relative to the components that are defined for this glyph; ie, the index within - the compRef array. - Return -1 if the click with not inside any component, or if there are no components - defined for this glyph. - CURRENTLY NOT USED - if ever used, need to incorporate floating point -----------------------------------------------------------------------------------------------*/ -int GrGlyphSubTable::ComponentContainingPoint(gid16 chwGlyphID, int x, int y) -{ - int i = CalculateDefinedComponents(chwGlyphID); - for (int inComp = 0; inComp < m_cnCompPerLig; inComp++) - { - // The m_pnComponents list holds a list of the component attributes that are defined - // for this glyph, padded with -1's. - int nCompID = m_prgnDefinedComponents[i + inComp]; - if (nCompID == -1) - break; // hit the end of the list - - // The value of the component attribute is actually the attribute ID for the - // first of the component box fields--the top. There should a contiguous group of - // four fields: top, bottom, left, right. - int nFieldIDMin = GlyphAttrValue(chwGlyphID, nCompID); - gAssert(nFieldIDMin != 0); - int nTop = GlyphAttrValue(chwGlyphID, nFieldIDMin); - int nBottom = GlyphAttrValue(chwGlyphID, nFieldIDMin + 1); - int nLeft = GlyphAttrValue(chwGlyphID, nFieldIDMin + 2); - int nRight = GlyphAttrValue(chwGlyphID, nFieldIDMin + 3); - - if (nLeft <= x && x < nRight && - nBottom <= y && y < nTop) - { - return inComp; - } - } - return -1; -} - -/*---------------------------------------------------------------------------------------------- - Fill in the box with the source-device coordinates corresponding to the given component. - The rectangle is relative to the top-left of the glyph. - Return false if the component is not defined. - - @param xysEmSquare - of the font, in logical units - @param chwGlyphID - the glyph of interest - @param icomp - the component of interest (eg, for the "oe" ligature, - the index for component.o would be 0, - and the index for component.e would be 1); - these is as defined by the glyph, not as used in the rules - @param mFontEmUnits - the number of em-units in the font, for scaling - @param dysFontAscent - ascent of the font, for adjusting coordinate systems - @param pxsLeft, pxsRight, pysTop, pysBottom - - return values, in source device coordinates - @param fTopOrigin - convert values to a coordinate system where the origin is the - top of the line, not the baseline -----------------------------------------------------------------------------------------------*/ -bool GrGlyphSubTable::ComponentBoxLogUnits(float xysEmSquare, - gid16 chwGlyphID, int icomp, int mFontEmUnits, float dysFontAscent, - float * pxsLeft, float * pysTop, float * pxsRight, float * pysBottom, - bool fTopOrigin) -{ - int i = CalculateDefinedComponents(chwGlyphID); - - // The m_pnComponents list holds a list of the component attributes that are defined - // for this glyph, padded with -1's. - int nCompID = m_prgnDefinedComponents[i + icomp]; - if (nCompID == -1) - { - // Ooops, the component is undefined for this glyph. - *pxsLeft = 0; - *pxsRight = 0; - *pysTop = 0; - *pysBottom = 0; - return false; - } - - // The value of the component attribute is actually the attribute ID for the - // first of the component box fields--the top. There should a contiguous group of - // four fields: top, bottom, left, right. - int nFieldIDMin = GlyphAttrValue(chwGlyphID, nCompID); - if (nFieldIDMin == 0) - { - // Component inadequately defined. This can happen when we defined components - // for a glyph and then substituted another glyph for it. - *pxsLeft = 0; - *pxsRight = 0; - *pysTop = 0; - *pysBottom = 0; - return false; - } - int mTop = GlyphAttrValue(chwGlyphID, nFieldIDMin); - int mBottom = GlyphAttrValue(chwGlyphID, nFieldIDMin + 1); - int mLeft = GlyphAttrValue(chwGlyphID, nFieldIDMin + 2); - int mRight = GlyphAttrValue(chwGlyphID, nFieldIDMin + 3); - - ////int xysFontEmUnits; - ////// ysHeight should correspond to the pixels in the font's em square - ////GrResult res = pgg->GetFontEmSquare(&xysFontEmUnits); - ////if (ResultFailed(res)) - //// return false; - - *pxsLeft = GrEngine::GrIFIMulDiv(mLeft, xysEmSquare, mFontEmUnits); - *pxsRight = GrEngine::GrIFIMulDiv(mRight, xysEmSquare, mFontEmUnits); - *pysTop = GrEngine::GrIFIMulDiv(mTop, xysEmSquare, mFontEmUnits); - *pysBottom = GrEngine::GrIFIMulDiv(mBottom, xysEmSquare, mFontEmUnits); - - if (*pxsLeft > *pxsRight) - { - float xsTmp = *pxsLeft; - *pxsLeft = *pxsRight; - *pxsRight = xsTmp; - } - if (*pysTop < *pysBottom) - { - float ysTmp = *pysTop; - *pysTop = *pysBottom; - *pysBottom = ysTmp; - } - - if (fTopOrigin) - { - // Currently top and bottom coordinates are such that 0 is the baseline and positive is - // upwards, while for the box we want to return, 0 is the top of the glyph and positive - // is downwards. So switch systems. - *pysTop = (dysFontAscent - *pysTop); - *pysBottom = (dysFontAscent - *pysBottom); - } - - return true; -} - -/*---------------------------------------------------------------------------------------------- - Calculate the list of defined components for the given glyph, if any. - Return the index to the first relevant item in the array. - Private. - TODO: With the current implementation that stores the glyph ids in each slot, this - mechanism is redundant and obsolete, and should be removed. -----------------------------------------------------------------------------------------------*/ -int GrGlyphSubTable::CalculateDefinedComponents(gid16 chwGlyphID) -{ - // The first item is a flag indicating whether the list has been calculated. - int iFlag = chwGlyphID * (m_cnCompPerLig + 1); // index of has-been-calculated flag - int iMin = iFlag + 1; // first actual value; +1 in order to skip the flag - if (m_prgnDefinedComponents[iFlag] == 0) - { - int iTmp = iMin; - for (int nCompID = 0; nCompID < m_cComponents; nCompID++) - { - if (ComponentIsDefined(chwGlyphID, nCompID)) - m_prgnDefinedComponents[iTmp++] = nCompID; - if (iTmp - iMin >= m_cnCompPerLig) - break; // ignore any components beyond the maximum allowed - } - // Fill in the rest of the list with -1. - for( ; iTmp < iMin + m_cnCompPerLig; iTmp++) - m_prgnDefinedComponents[iTmp] = -1; - - m_prgnDefinedComponents[iFlag] = 1; // has been calculated - } - return iMin; -} - -/*---------------------------------------------------------------------------------------------- - Return true if the given attr ID, which is a component definition attribute, indicates - that that component is defined for the given glyph. - - @param chwGlyphID - the glyph of interest - @param nAttrID - the attribute of interest, assumed to be a component glyph - attribute (eg. component.e.top) -----------------------------------------------------------------------------------------------*/ -bool GrGlyphSubTable::ComponentIsDefined(gid16 chwGlyphID, int nAttrID) -{ - gAssert(nAttrID < m_cComponents); - if (nAttrID >= m_cComponents) - return false; - - return (GlyphAttrValue(chwGlyphID, nAttrID) != 0); -} - -/*---------------------------------------------------------------------------------------------- - Return the index of the given component as defined for the given glyph ID. that is, - convert the global ID for the component to the one within this glyph. Return -1 - if the component is not defined for the given glyph. - For instance, given the glyph ID "oe" (the oe ligature) and the attr ID for component.o, - the result would be 0; for component.e the result would be 1. -----------------------------------------------------------------------------------------------*/ -int GrGlyphSubTable::ComponentIndexForGlyph(gid16 chwGlyphID, int nCompID) -{ - int i = CalculateDefinedComponents(chwGlyphID); - - for (int iLp = 0; iLp < m_cnCompPerLig; iLp++) - { - if (m_prgnDefinedComponents[i + iLp] == nCompID) - return iLp; - } - return -1; -} - -/*---------------------------------------------------------------------------------------------- - Return the ID of the nth defined component attribute for the given glyph. -----------------------------------------------------------------------------------------------*/ -//int GrGlyphSubTable::NthComponentID(gid16 chwGlyphID, int n) -//{ -// int i = CalculateDefinedComponents(chwGlyphID); -// return m_pnComponents[i + 1 + n]; -//} - - -//:>******************************************************************************************** -//:> For test procedures -//:>******************************************************************************************** - -//:Ignore -#ifdef OLD_TEST_STUFF - -void GrGlyphTable::SetUpTestData() -{ - SetNumberOfGlyphs(5); - SetNumberOfStyles(1); - - GrGlyphSubTable * pgstbl = new GrGlyphSubTable(); - gAssert(pgstbl); - - pgstbl->Initialize(1, 0, 5, 10, 4); - SetSubTable(0, pgstbl); - - pgstbl->SetUpTestData(); -} - -/*********************************************************************************************** - TODO: This method is BROKEN because m_prgibBIGAttrValues has been changed. It is no - longer a utf16 *. The Gloc table can contain 16-bit or 32-bit entries and must be - accessed accordingly. -***********************************************************************************************/ -void GrGlyphSubTable::SetUpTestData() -{ - m_pgatbl = new GrGlyphAttrTable(); - m_pgatbl->Initialize(0, 48); - - m_prgibBIGAttrValues[0] = byte(msbf(data16(0))); - m_prgibBIGAttrValues[1] = byte(msbf(data16(6)))); - m_prgibBIGAttrValues[2] = byte(msbf(data16(20))); - m_prgibBIGAttrValues[3] = byte(msbf(data16(20))); - m_prgibBIGAttrValues[4] = byte(msbf(data16(40))); - m_prgibBIGAttrValues[5] = byte(msbf(data16(48))); - - m_pgatbl->SetUpTestData(); -} - -void GrGlyphAttrTable::SetUpTestData() -{ - // Glyph 0 (1 run; offset = 0): - // 1 = 11 = 0x0B - // 2 = 22 = 0x16 - // 0102 000B 0016 - // - // Glyph 1 (2 runs; offset = 3*2 = 6): - // 0 = 5 - // 1 = 6 - // 2 = 7 - // 8 = 8 - // 9 = 9 - // 0003 0005 0006 0007 - // 0802 0008 0009 - // - // Glyph 2 (0 runs; offset = 6 + 7*2 = 20): - // all values = 0 - // - // Glyph 3 (5 runs; offset = 20): - // 1 = 111 = 0x006F - // 3 = 333 = 0x00DE - // 5 = 555 = 0x022B - // 7 = 777 = 0x0309 - // 9 = 999 = 0x03E7 - // 0101 006F - // 0301 00DE - // 0501 022B - // 0701 0309 - // 0901 03E7 - // - // Glyph 4 (1 run; offset = 20 + 10*2 = 40): - // 5 = 4 - // 6 = 4 - // 7 = 4 - // 0503 0004 0004 0004 - // - // Glyph 5 (offset = 40 + 4*2 = 48) - - byte * pbBIG = m_prgbBIGEntries; - - GrGlyphAttrRun gatrun; - - // Glyph 0 - gatrun.m_bMinAttrID = 1; - gatrun.m_cAttrs = 2; - gatrun.m_rgchwBIGValues[0] = msbf(data16(11)); - gatrun.m_rgchwBIGValues[1] = msbf(data16(22)); - memcpy(pbBIG, &gatrun, 6); - pbBIG += 6; - - // Glyph 1 - gatrun.m_bMinAttrID = 0; - gatrun.m_cAttrs = 3; - gatrun.m_rgchwBIGValues[0] = msbf(data16(5)); - gatrun.m_rgchwBIGValues[1] = msbf(data16(6)); - gatrun.m_rgchwBIGValues[2] = msbf(data16(7)); - memcpy(pbBIG, &gatrun, 8); - pbBIG += 8; - gatrun.m_bMinAttrID = 8; - gatrun.m_cAttrs = 2; - gatrun.m_rgchwBIGValues[0] = msbf(data16(8)); - gatrun.m_rgchwBIGValues[1] = msbf(data16(9)); - memcpy(pbBIG, &gatrun, 6); - pbBIG += 6; - - // Glyph 2: no data - - // Glyph 3 - gatrun.m_bMinAttrID = 1; - gatrun.m_cAttrs = 1; - gatrun.m_rgchwBIGValues[0] = msbf(data16(111)); - memcpy(pbBIG, &gatrun, 4); - pbBIG += 4; - gatrun.m_bMinAttrID = 3; - gatrun.m_cAttrs = 1; - gatrun.m_rgchwBIGValues[0] = msbf(data16(333)); - memcpy(pbBIG, &gatrun, 4); - pbBIG += 4; - gatrun.m_bMinAttrID = 5; - gatrun.m_cAttrs = 1; - gatrun.m_rgchwBIGValues[0] = msbf(data16(555)); - memcpy(pbBIG, &gatrun, 4); - pbBIG += 4; - gatrun.m_bMinAttrID = 7; - gatrun.m_cAttrs = 1; - gatrun.m_rgchwBIGValues[0] = msbf(data16(777)); - memcpy(pbBIG, &gatrun, 4); - pbBIG += 4; - gatrun.m_bMinAttrID = 9; - gatrun.m_cAttrs = 1; - gatrun.m_rgchwBIGValues[0] = msbf(data16(999)); - memcpy(pbBIG, &gatrun, 4); - pbBIG += 4; - - // Glyph 4 - gatrun.m_bMinAttrID = 5; - gatrun.m_cAttrs = 3; - gatrun.m_rgchwBIGValues[0] = msbf(data16(4)); - gatrun.m_rgchwBIGValues[1] = msbf(data16(4)); - gatrun.m_rgchwBIGValues[2] = msbf(data16(4)); - memcpy(pbBIG, &gatrun, 8); - pbBIG += 8; - - gAssert(pbBIG == m_prgbBIGEntries + 48); -} - -#endif // OLD_TEST_STUFF - -} // namespace gr - -//:End Ignore diff --git a/Build/source/libs/graphite/engine-2.3.1/src/segment/GrGlyphTable.h b/Build/source/libs/graphite/engine-2.3.1/src/segment/GrGlyphTable.h deleted file mode 100644 index bec0e518dee..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/src/segment/GrGlyphTable.h +++ /dev/null @@ -1,429 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 1999, 2001 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: GrGlyphTable.h -Responsibility: Sharon Correll -Last reviewed: 10Aug99, JT, quick look over - -Description: - The GrGlyphTable and related classes that store the values of glyph attributes. - - For each glyph in a TrueType font, Graphite has a list of glyph attributes (which - are defined in the GDL script file). Since most of the values will be zero, we save space - by only storing the non-zero values. - - Eventually it may be possible to have more than one TrueType font compiled into a single - glyph table, hence the need for multiple sub-tables. For now we assume that there is only - one font file and only one sub-table. - - Note that BIG in a variable name means that the data is in big-endian format, or is a range - of bytes that must be interpreted as a run of wide chars or ints in big-endian format. --------------------------------------------------------------------------------*//*:End Ignore*/ - -//:Ignore -#ifdef _MSC_VER -#pragma once -#endif -#ifndef GR_GTABLE_INCLUDED -#define GR_GTABLE_INCLUDED -//:End Ignore - -namespace gr -{ - -class Font; - -/*---------------------------------------------------------------------------------------------- - A run of non-zero attribute values for a single glyph, where the attribute IDs - are contiguous. - - NOTE: it is assumed that the format of this class matches the byte order of the data as it - is read directly from the TTF/ECF file--that is, it is big-endian. - - Hungarian: gatrun -----------------------------------------------------------------------------------------------*/ - -class GrGlyphAttrRun -{ - friend class GrGlyphTable; - friend class GrGlyphSubTable; - friend class GrGlyphAttrTable; - - enum { - kMaxAttrsPerRun = 255 - }; - - /*------------------------------------------------------------------------------------------ - Copy the raw memory (starting at the given byte) into the instance. This method must - reflect the format of the "Glat_entry" as it is stored in the file and slurped into - memory. - ------------------------------------------------------------------------------------------*/ - void CopyFrom(byte * pbBIGEnt) - { - m_bMinAttrID = *pbBIGEnt; - m_cAttrs = *(pbBIGEnt + 1); - if (m_cAttrs >= kMaxAttrsPerRun) - { - gAssert(false); - m_cAttrs = kMaxAttrsPerRun; - } - #ifdef _DEBUG - // Probably not strictly necessary to zero the array, but convenient for debugging. - // Removed from release build for optimization - std::fill(m_rgchwBIGValues, m_rgchwBIGValues + kMaxAttrsPerRun, 0); - #endif - // this is mixing types of data16 and byte pointers! - const data16 * prgchw = reinterpret_cast(pbBIGEnt + 2); - std::copy(prgchw, prgchw + m_cAttrs, m_rgchwBIGValues); - } - - int ByteCount() - { - return (2 + (m_cAttrs * isizeof(data16))); - } - -protected: - byte m_bMinAttrID; // ID of first attribute in the run - byte m_cAttrs; // number of attributes in the run - data16 m_rgchwBIGValues[kMaxAttrsPerRun]; -}; - -/*---------------------------------------------------------------------------------------------- - Contains runs of attribute values for all the glyphs in the font; corresponds to - the "Glat" table in the font. - - Hungarian: gatbl -----------------------------------------------------------------------------------------------*/ - -class GrGlyphAttrTable -{ - friend class GrGlyphTable; - friend class GrGlyphSubTable; - friend class FontMemoryUsage; - -protected: - // Constructor: - GrGlyphAttrTable() - { - m_prgbBIGEntries = NULL; - } - - // Destructor: - ~GrGlyphAttrTable() - { - delete[] m_prgbBIGEntries; - } - - // Initialization: - void Initialize(int fxdSilfVersion, int cbBufLen) - { - m_fxdSilfVersion = fxdSilfVersion; - m_cbEntryBufLen = cbBufLen; - m_prgbBIGEntries = new byte[cbBufLen]; - // Now the instance is ready to have all the glyph attr entries slurped into - // the byte array from the file. - } - - int GlyphAttr16BitValue(int ibMin, int ibLim, byte bAttrID); - -protected: - int m_fxdSilfVersion; // version number of the Silf table, which is used - // to interpret the attribute values - - // Block of variable-length glyph attribute runs, matching the format of - // GrGlyphAttrRun. We don't store instances of that class here because they - // are variable length, and it would be too slow to read them individually from the - // font. Instead, we set up a single instance in the method that accesses the values; - // having this instance will help debugging. Eventually we may want to do without it, - // if it would help efficiency. - int m_cbEntryBufLen; // needed only for memory instrumentation - byte * m_prgbBIGEntries; - -//:Ignore -#ifdef OLD_TEST_STUFF -public: - // For test procedures: - void SetUpTestData(); - void SetUpLigatureTest(); - void SetUpLigature2Test(); -#endif // OLD_TEST_STUFF - -//:End Ignore - -}; - -/*---------------------------------------------------------------------------------------------- - One glyph table per font (style) file; corresponds to the "Gloc" table in the font. - Currently there is only considered to be one style per file, so there is only one of - these. It holds the (non-zero) glyph attribute values for every glyph in the font. - - Hungarian: gstbl - - Review: Eventually we may need to make a subclass that uses 32-bit values for the offsets, - or just use a separate array pointer in this class. Which would be preferable? -----------------------------------------------------------------------------------------------*/ - -class GrGlyphSubTable -{ - friend class GrGlyphTable; - friend class FontMemoryUsage; - -public: - // Constructor: - GrGlyphSubTable() : - m_pgatbl(NULL), - m_prgibBIGAttrValues(NULL), - m_prgibBIGGlyphAttrDebug(NULL), - m_prgnDefinedComponents(NULL) - { - } - // Destructor: - ~GrGlyphSubTable() - { - delete m_pgatbl; - delete[] m_prgibBIGAttrValues; - if (m_fHasDebugStrings) - delete[] m_prgibBIGGlyphAttrDebug; - delete[] m_prgnDefinedComponents; - } - - // Initialization: - bool ReadFromFont(GrIStream & gloc_strm, int cGlyphs, - GrIStream & glat_strm, long lGlatStart); - void Initialize(int fxdSilfVersion, data16 chwFlags, - data16 chwBWAttr, data16 chwJStrAttr, data16 chwJStrHWAttr, - int cGlyphs, int cAttrs, int cnCompPerLig); - - void CreateEmpty(); - - void SetNumberOfComponents(int c) - { - m_cComponents = c; - } - - // General: - int NumberOfGlyphAttrs() { return m_nAttrIDLim; } // 0..(m_nAttrIDLim-1) - - int GlyphAttrValue(gid16 chwGlyphID, int nAttrID); - - // Ligatures: - int ComponentContainingPoint(gid16 chwGlyphID, int x, int y); - bool ComponentBoxLogUnits(float xysEmSquare, gid16 chwGlyphID, int icomp, - int mFontEmUnits, float dysAscent, - float * pxsLeft, float * pysTop, float * pxsRight, float * pysBottom, - bool fTopOrigin = true); -protected: - int CalculateDefinedComponents(gid16 chwGlyphID); - bool ComponentIsDefined(gid16 chwGlyphID, int nAttrID); - int ComponentIndexForGlyph(gid16 chwGlyphID, int nCompID); -// int NthComponentID(gid16 chwGlyphID, int n); - int ConvertValueForVersion(int nRet, int nAttrID); - -public: - static int ConvertValueForVersion(int nRet, int nAttrID, int nBWAttr, int fxdVersion); - - // Flags: - bool LongFormat(data16 chwFlags) // 32-bit values? - { - return ((chwFlags & 0x01) == 0x01); // bit 0 - } - bool HasAttrNames(data16 chwFlags) - { - return ((chwFlags & 0x02) == 0x02); // bit 1 - } - int GlocLookup(data16 chwGlyphId) - { - if (m_fGlocShort) - { - unsigned short su = ((unsigned short *)m_prgibBIGAttrValues)[chwGlyphId]; - return lsbf(su); - } - else - { unsigned int u = ((unsigned int *)m_prgibBIGAttrValues)[chwGlyphId]; - return lsbf((int)u); - } - } - -protected: - int m_fxdSilfVersion; // version number of the Silf table, which is used - // to interpret the attribute values - bool m_fHasDebugStrings; // are debugging strings loaded into memory? - - int m_nAttrIDLim; // number of glyph attributes - int m_cComponents; // number of initial glyph attributes that - // represent ligature components - int m_cnCompPerLig; - - GrGlyphAttrTable * m_pgatbl; - byte * m_prgibBIGAttrValues; // byte offsets for glyph attr values - BIG endian - bool m_fGlocShort; // flag for Gloc table format - data16 * m_prgibBIGGlyphAttrDebug; // byte offsets for glyph attr debug strings - BIG endian - - data16 m_chwBWAttr; // breakweight attr ID; needed for converting - // between versions - - // Attr IDs for justify.0.stretch and justify.0.stretchHW; these must always be looked - // up in tandem. - data16 m_chwJStrAttr; - data16 m_chwJStrHWAttr; - - int * m_prgnDefinedComponents; // for each glyph, cache list of component attributes that - // are defined - -//:Ignore -#ifdef OLD_TEST_STUFF -public: - // For test procedures: - void SetUpTestData(); - void SetUpLigatureTest(); - void SetUpLigature2Test(); -#endif // OLD_TEST_STUFF - -//:End Ignore -}; - -/*---------------------------------------------------------------------------------------------- - Holds all the information about glyph attributes. - - Hungarian: gtbl -----------------------------------------------------------------------------------------------*/ - -class GrGlyphTable -{ - friend class GrGlyphSubTable; - friend class FontMemoryUsage; - -public: - // Constructor: - GrGlyphTable() - { - m_cglf = 0; - m_cComponents = 0; - m_cgstbl = 0; - m_vpgstbl.clear(); - } - - // Destructor: - ~GrGlyphTable() - { - for (int i = 0; i < m_cgstbl; ++i) - delete m_vpgstbl[i]; - } - - bool ReadFromFont(GrIStream & gloc_strm, long lGlocStart, - GrIStream & glat_strm, long lGlatStart, - data16 chwBWAttr, data16 chwJStrAttr, int cJLevels, int cnCompPerLig, - int fxdSilfVersion); - - void CreateEmpty(); - - // Setters: - void SetNumberOfGlyphs(int c) - { - m_cglf = c; - } - void SetNumberOfStyles(int c) - { - m_cgstbl = c; - m_vpgstbl.resize(c); - } - void SetNumberOfComponents(int c) - { - m_cComponents = c; - for (unsigned int ipgstbl = 0; ipgstbl < m_vpgstbl.size(); ipgstbl++) - m_vpgstbl[ipgstbl]->SetNumberOfComponents(c); - } - void SetSubTable(int i, GrGlyphSubTable * pgstbl) - { - if (signed(m_vpgstbl.size()) <= i) - { - gAssert(false); - m_vpgstbl.resize(i+1); - } - m_vpgstbl[i] = pgstbl; - m_vpgstbl[i]->SetNumberOfComponents(m_cComponents); - } - - // Getters: - int NumberOfGlyphs() { return m_cglf; } - int NumberOfStyles() { return m_cgstbl; } - - int NumberOfGlyphAttrs() - { - // All of the sub-tables should have the same number of glyph attributes, - // so just ask the first. - return m_vpgstbl[0]->NumberOfGlyphAttrs(); - } - - int GlyphAttrValue(gid16 chwGlyphID, int nAttrID) - { - gAssert(m_cgstbl == 1); - return m_vpgstbl[0]->GlyphAttrValue(chwGlyphID, nAttrID); - } - // Eventually: - //int GlyphAttrValue(gid16 chwGlyphID, int nAttrID, int nStyleIndex) - //{ - // return m_vpgstbl[nStyleIndex]->GlyphAttrValue(chwGlyphID, nAttrID); - //} - - int ComponentContainingPoint(gid16 chwGlyphID, int x, int y) - { - gAssert(m_cgstbl == 1); - return m_vpgstbl[0]->ComponentContainingPoint(chwGlyphID, x, y); - } - // Eventually: - //int ComponentContainingPoint(gid16 chwGlyphID, int nStyleIndex, int x, int y) - //{ - // gAssert(m_cgstbl == 1); - // return m_vpgstbl[nStyleIndex]->ComponentContainingPoint(chwGlyphID, nAttrID); - //} - - bool ComponentBoxLogUnits(float xysEmSquare, gid16 chwGlyphID, int icomp, - int mFontEmUnits, float dysAscent, - float * pxsLeft, float * pysTop, float * pxsRight, float * pysBottom, - bool fTopOrigin = true) - { - gAssert(m_cgstbl == 1); - return m_vpgstbl[0]->ComponentBoxLogUnits(xysEmSquare, - chwGlyphID, icomp, mFontEmUnits, dysAscent, - pxsLeft, pysTop, pxsRight, pysBottom, - fTopOrigin); - } - - int ComponentIndexForGlyph(gid16 chwGlyphID, int nCompID) - { - gAssert(m_cgstbl == 1); - return m_vpgstbl[0]->ComponentIndexForGlyph(chwGlyphID, nCompID); - } - - bool IsEmpty() - { - return (m_cglf == 0); - } - -protected: - int m_cglf; // number of glyphs - int m_cComponents; // number of defined components - int m_cgstbl; // number of sub-tables, corresponding to font files; - // for now there is only one - - std::vector m_vpgstbl; - -//:Ignore -#ifdef OLD_TEST_STUFF -public: - // For test procedures: - void SetUpTestData(); - void SetUpLigatureTest(); - void SetUpLigature2Test(); -#endif // OLD_TEST_STUFF -//:End Ignore - -}; - -} // namespace gr - -#endif // !GR_GTABLE_INCLUDED diff --git a/Build/source/libs/graphite/engine-2.3.1/src/segment/GrPass.cpp b/Build/source/libs/graphite/engine-2.3.1/src/segment/GrPass.cpp deleted file mode 100644 index ce8094744eb..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/src/segment/GrPass.cpp +++ /dev/null @@ -1,2030 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 1999, 2001 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: GrPass.cpp -Responsibility: Sharon Correll -Last reviewed: Not yet. - -Description: - Implements the GrPass class and subclasses. -----------------------------------------------------------------------------------------------*/ - -//:>******************************************************************************************** -//:> Include files -//:>******************************************************************************************** -#include "Main.h" - -#ifdef _MSC_VER -#pragma hdrstop -#endif -#undef THIS_FILE -DEFINE_THIS_FILE - -//:End Ignore - -//:>******************************************************************************************** -//:> Forward declarations -//:>******************************************************************************************** - -//:>******************************************************************************************** -//:> Local Constants and static variables -//:>******************************************************************************************** - -namespace gr -{ - -//:>******************************************************************************************** -//:> Methods -//:>******************************************************************************************** -/*---------------------------------------------------------------------------------------------- - Constructors and initializers -----------------------------------------------------------------------------------------------*/ -GrPass::GrPass(int i) - : m_ipass(i), - m_fxdVersion(0), - m_nMaxRuleContext(0), - m_pfsm(NULL), - m_nMaxRuleLoop(0), - m_nMaxBackup(0), - m_crul(0), - m_prgchwRuleSortKeys(NULL), - m_prgcritRulePreModContext(NULL), - m_cbPassConstraint(0), - m_prgibConstraintStart(NULL), - m_prgibActionStart(NULL), - m_prgbPConstraintBlock(NULL), - m_prgbConstraintBlock(NULL), - m_prgbActionBlock(NULL), - m_cbConstraints(0), - m_cbActions(0), - m_prgibConstraintDebug(NULL), - m_prgibRuleDebug(NULL), - m_fCheckRules(false), - m_prgfRuleOkay(NULL), - m_vnStack(128), - m_pzpst(NULL) -{ -} - -void PassState::InitForNewSegment(int ipass, int nMaxChunk) -{ - m_ipass = ipass; - m_nRulesSinceAdvance = 0; - m_nMaxChunk = nMaxChunk; - m_cslotSkipToResync = 0; - m_fDidResyncSkip = false; - InitializeLogInfo(); -} - -void PassState::InitializeLogInfo() -{ - m_crulrec = 0; - std::fill_n(m_rgcslotDeletions, 128, 0); - std::fill_n(m_rgfInsertion, 128, false); -} - -/*---------------------------------------------------------------------------------------------- - Destructors -----------------------------------------------------------------------------------------------*/ -GrPass::~GrPass() -{ - delete m_pfsm; - - delete[] m_prgchwRuleSortKeys; - - delete[] m_prgcritRulePreModContext; - - delete[] m_prgibConstraintStart; - delete[] m_prgibActionStart; - - delete[] m_prgbPConstraintBlock; - delete[] m_prgbConstraintBlock; - delete[] m_prgbActionBlock; - - delete[] m_prgfRuleOkay; - - delete[] m_prgibConstraintDebug; - delete[] m_prgibRuleDebug; -} - -/*---------------------------------------------------------------------------------------------- - Fill in the pass by reading from the font stream. -----------------------------------------------------------------------------------------------*/ -bool GrPass::ReadFromFont(GrIStream & grstrm, int fxdSilfVersion, int fxdRuleVersion, - int nOffset) -{ - long lPassInfoStart; - grstrm.GetPositionInFont(&lPassInfoStart); - - m_fxdVersion = fxdSilfVersion; - - m_fCheckRules = (fxdRuleVersion > kRuleVersion); - -// Assert(nOffset == lPassInfoStart); - if (lPassInfoStart != nOffset) - { - grstrm.SetPositionInFont(nOffset); - } - - // flags - ignore for now - //byte bTmp = grstrm.ReadByteFromFont(); - grstrm.ReadByteFromFont(); - - // MaxRuleLoop - m_nMaxRuleLoop = grstrm.ReadByteFromFont(); - - // max rule context - m_nMaxRuleContext = grstrm.ReadByteFromFont(); - - // MaxBackup - m_nMaxBackup = grstrm.ReadByteFromFont(); - - // number of rules - m_crul = grstrm.ReadShortFromFont(); - // TODO: add a sanity check for the number of rules. - - // offset to pass constraint code, relative to start of subtable - int nPConstraintOffset = 0; - long lFsmPos = -1; - if (fxdSilfVersion >= 0x00020000) - { - if (fxdSilfVersion >= 0x00030000) - lFsmPos = grstrm.ReadUShortFromFont() + nOffset; // offset to row info - else - grstrm.ReadShortFromFont(); // pad bytes - nPConstraintOffset = grstrm.ReadIntFromFont(); - } - // offset to rule constraint code, relative to start of subtable - //int nConstraintOffset = grstrm.ReadIntFromFont(); - grstrm.ReadIntFromFont(); - // offset to action code, relative to start of subtable - //int nActionOffset = grstrm.ReadIntFromFont(); - grstrm.ReadIntFromFont(); - // offset to debug strings; 0 if stripped - //int nDebugOffset = grstrm.ReadIntFromFont(); - grstrm.ReadIntFromFont(); - - // Jump to beginning of FSM, if we have this information. - if (fxdSilfVersion >= 0x00030000) - grstrm.SetPositionInFont(lFsmPos); - else - // Otherwise assume that's where we are! - Assert(lFsmPos == -1); - - m_pfsm = new GrFSM(); - - m_pfsm->ReadFromFont(grstrm, fxdSilfVersion); - - // rule sort keys - m_prgchwRuleSortKeys = new data16[m_crul]; - data16 * pchw = m_prgchwRuleSortKeys; - int irul; - for (irul = 0; irul < m_crul; irul++, pchw++) - { - *pchw = grstrm.ReadUShortFromFont(); - } - - // rule pre-mod-context item counts - m_prgcritRulePreModContext = new byte[m_crul]; - byte * pb = m_prgcritRulePreModContext; - for (irul = 0; irul < m_crul; irul++, pb++) - { - *pb = grstrm.ReadByteFromFont(); - } - - // constraint offset for pass-level constraints - if (fxdSilfVersion >= 0x00020000) - { - // reserved - pad byte - grstrm.ReadByteFromFont(); - // Note: pass constraints have not been fully implemented. - m_cbPassConstraint = grstrm.ReadUShortFromFont(); - } - else - m_cbPassConstraint = 0; - - // constraint and action offsets for rules - m_prgibConstraintStart = new data16[m_crul + 1]; - pchw = m_prgibConstraintStart; - for (irul = 0; irul <= m_crul; irul++, pchw++) - { - *pchw = grstrm.ReadUShortFromFont(); - } - - m_prgibActionStart = new data16[m_crul + 1]; - pchw = m_prgibActionStart; - for (irul = 0; irul <= m_crul; irul++, pchw++) - { - *pchw = grstrm.ReadUShortFromFont(); - } - - // FSM state table - m_pfsm->ReadStateTableFromFont(grstrm, fxdSilfVersion); - - if (fxdSilfVersion >= 0x00020000) - // reserved - pad byte - grstrm.ReadByteFromFont(); - - // Constraint and action blocks - int cb = m_cbPassConstraint; - m_prgbPConstraintBlock = new byte[cb]; - grstrm.ReadBlockFromFont(m_prgbPConstraintBlock, cb); - m_cbConstraints = cb; - - cb = m_prgibConstraintStart[m_crul]; - m_prgbConstraintBlock = new byte[cb]; - grstrm.ReadBlockFromFont(m_prgbConstraintBlock, cb); - m_cbConstraints += cb; - - cb = m_prgibActionStart[m_crul]; - m_prgbActionBlock = new byte[cb]; - grstrm.ReadBlockFromFont(m_prgbActionBlock, cb); - m_cbActions = cb; - - // Rule-validity flags - m_prgfRuleOkay = new bool[m_crul]; - for (irul = 0; irul < m_crul; irul++) - m_prgfRuleOkay[irul] = !m_fCheckRules; - - // TODO SharonC/AlanW: debuggers - - return true; -} - -/*---------------------------------------------------------------------------------------------- - Initialize a bogus pass with no rules. Currently this is used to make a single positioning - pass if there was none in the font. -----------------------------------------------------------------------------------------------*/ -void GrPass::InitializeWithNoRules() -{ - m_crul = 0; - m_nMaxRuleContext = 1; - m_nMaxRuleLoop = 1; - m_nMaxBackup = 0; - m_pfsm = NULL; - m_prgchwRuleSortKeys = NULL; - m_prgcritRulePreModContext = NULL; -} - -/*---------------------------------------------------------------------------------------------- - Extend the output stream by the given number of characters. - (Overridden by GrBidiPass.) - - @param ptman - table manager - @param psstrmIn/Out - streams being processed - @param cslotNeededByNext - the number of slots being requested by the following pass - @param twsh - how we are handling trailing white-space - @param pnRet - return value - @param pcslotGot - return the number of slots gotten - @param pislotFinalBreak - return the index of the final slot, when we are removing - the trailing white-space and so the end of the segment - will be before the any actual line-break slot - - @return kNextPass if we were able to generated the number requested, or processing is - complete; otherwise return the number of slots needed from the previous pass. -----------------------------------------------------------------------------------------------*/ -void GrPass::ExtendOutput(GrTableManager * ptman, - GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, - int cslotNeededByNext, TrWsHandling twsh, - int * pnRet, int * pcslotGot, int * pislotFinalBreak) -{ - // Kludge to generate an error in rendering: - //int z = 50; - //int t = ((5 * 10) / z) - 1; - //if (this->m_ipass == 4) - //{ - // int x; x = z / t; - //} - - int islotInitReadPos = psstrmIn->ReadPos(); - int islotInitWritePos = psstrmOut->WritePos(); - - int cslotToGet = max(cslotNeededByNext, - m_pzpst->NeededToResync() - psstrmOut->WritePos()); - int cslotGot = 0; - - gid16 chwLB = ptman->LBGlyphID(); - - // While we haven't got the number of slot we've been asked for, and there is enough - // available in the input, run rules, filling up the output. - - while ((cslotToGet > 0 && cslotGot < cslotToGet) - // Don't leave this pass until we've got the index offset. This is especially - // needed for input to the positioning pass, but it doesn't hurt to make it a - // general rule. - || !psstrmOut->GotIndexOffset() - // Don't leave this pass until all the slots to reprocess have been - // completely handled. - || (psstrmIn->SlotsToReprocess() > 0) - // Don't leave this pass until there is a complete cluster in the output - || (islotInitWritePos == psstrmOut->WritePos()) - || (psstrmOut->MaxClusterSlot(islotInitWritePos, psstrmOut->WritePos()) > 0)) - { - int cslotAvailable = psstrmIn->TotalSlotsPending(); - int cslotNeedMore = MaxRuleContext() - cslotAvailable + ptman->PrevPassMaxBackup(m_ipass); - - // This test should not be necessary, but just in case. - if (psstrmIn->PastEndOfPositioning(false)) - cslotNeedMore = 0; // the input stream is done - - if (// Not enough available in the input: - (cslotNeedMore > 0 && !psstrmIn->FullyWritten()) - - // && psstrmIn->SegLimIfKnown() == -1) && -- no, because substitution passes may need - // to consider slots beyond the seg limit - - // Positioning passes need to know where they are in relation to the initial - // line-break. - || (IsPosPass() && !psstrmIn->GotIndexOffset()) - - // The following can happen on backtracking, when we undo stuff before the - // beginning of the segment: - || !ptman->Pass(m_ipass - 1)->DidResyncSkip()) - { - // Ask previous pass for more input. - *pnRet = max(cslotNeedMore, 1); - *pnRet = max(*pnRet, cslotNeededByNext - cslotGot); - *pcslotGot = cslotGot; - return; - } - - Assert(ptman->Pass(m_ipass - 1)->DidResyncSkip()); - - bool fDoneThisPass = (cslotAvailable == 0); - if (psstrmIn->SlotsToReprocess() == 0) - { - fDoneThisPass = fDoneThisPass || - psstrmIn->PastEndOfPositioning(false) || - psstrmOut->PastEndOfPositioning(true); - } - - if (fDoneThisPass) - { - // No more input to process--this pass is done. - Assert(psstrmIn->SlotsToReprocess() == 0); - psstrmIn->ClearReprocBuffer(); - - if (twsh == ktwshNoWs && m_ipass == ptman->NumberOfLbPasses()) - { - *pnRet = RemoveTrailingWhiteSpace(ptman, psstrmOut, twsh, pislotFinalBreak); - if (*pnRet == kBacktrack) // entire segment was white-space: - return; // backtrack, which will fail - } - DoResyncSkip(psstrmOut); - DoCleanUpSegMin(ptman, psstrmIn, islotInitReadPos, psstrmOut); - DoCleanUpSegLim(ptman, psstrmOut, twsh); - psstrmOut->MarkFullyWritten(); - *pnRet = kNextPass; - *pcslotGot = cslotGot; - return; - } - - if (twsh == ktwshOnlyWs && m_ipass == ptman->NumberOfLbPasses() + 1) - { - // Note that this is the first pass after the linebreak pass, so psstrmInput - // is the output of the linebreak pass. - GrSlotState * pslotNext = psstrmIn->Peek(); - if (!pslotNext->IsLineBreak(chwLB) && - pslotNext->Directionality() != kdircWhiteSpace && - psstrmIn->SegMin() > -1 && psstrmIn->SegMin() <= psstrmIn->ReadPos()) - { - // We are only allowing white-space in this segment and we hit - // something else. Don't process any further. - if (psstrmIn->SegLimIfKnown() > -1 && - psstrmIn->SegLimIfKnown() <= psstrmIn->ReadPos()) - { - // Already inserted a line-break; we're done. - DoResyncSkip(psstrmOut); - psstrmOut->MarkFullyWritten(); - *pnRet = kNextPass; - *pcslotGot = cslotGot; - return; - } - while (psstrmIn->SlotsToReprocess() > 0) - { - psstrmOut->CopyOneSlotFrom(psstrmIn); - psstrmOut->SetPosForNextRule(0, psstrmIn, IsPosPass()); - } - psstrmIn->ClearReprocBuffer(); - *pnRet = kBacktrack; - return; - } - } - - // Otherwise, we have enough input to run a rule. - - psstrmIn->SetRuleStartReadPos(); - psstrmOut->SetRuleStartWritePos(); - - int ruln = -1; - if (m_pfsm) - ruln = m_pfsm->GetRuleToApply(ptman, this, psstrmIn, psstrmOut); - ruln = CheckRuleValidity(ruln); - RunRule(ptman, ruln, psstrmIn, psstrmOut); - - cslotGot = psstrmOut->WritePos() - islotInitWritePos; - psstrmOut->CalcIndexOffset(ptman); - } - - DoResyncSkip(psstrmOut); - DoCleanUpSegMin(ptman, psstrmIn, islotInitReadPos, psstrmOut); - - // We're past the point where we care about anything in the reprocessing buffer. - Assert(psstrmIn->NoReproc()); - psstrmIn->ClearReprocBuffer(); - - if (psstrmOut->PastEndOfPositioning(true)) - { - DoCleanUpSegLim(ptman, psstrmOut, twsh); - psstrmOut->MarkFullyWritten(); - } - - *pnRet = kNextPass; - *pcslotGot = cslotGot; -} - -/*---------------------------------------------------------------------------------------------- - Extend the output stream by the given number of characters. - For a GrBidiPass, if we are at a direction change, get the entire - range of upstream glyphs, reverse them, and treat them as one chunk. - Otherwise just pass one slot through. - - @param ptman - table manager - @param psstrmInput/Output - streams being processed - @param cslotNeededByNext - the number of slots being requested by the following pass - @param twsh - how we are handling trailing white-space - @param pnRet - return value - @param pcslotGot - return the number of slots gotten - @param pislotFinalBreak - not used in this version - - @return 1 if we need more glyphs from the previous pass -----------------------------------------------------------------------------------------------*/ -void GrBidiPass::ExtendOutput(GrTableManager * ptman, - GrSlotStream* psstrmIn, GrSlotStream* psstrmOut, - int cslotNeededByNext, TrWsHandling twsh, - int * pnRet, int * pcslotGot, int * pislotFinalBreak) -{ - Assert(psstrmIn->SlotsToReprocess() == 0); - - int islotInitReadPos = psstrmIn->ReadPos(); - int islotInitWritePos = psstrmOut->WritePos(); - - Assert(m_pzpst->NeededToResync() == 0); - - int cslotToGet = max(cslotNeededByNext, - m_pzpst->NeededToResync() - psstrmOut->WritePos()); - int cslotGot = 0; - int nTopDir; - if (twsh == ktwshOnlyWs) - nTopDir = (ptman->State()->ParaRightToLeft()) ? 1 : 0; - else - nTopDir = ptman->TopDirectionLevel(); - - while (cslotToGet > 0 && cslotGot < cslotToGet) - { - int islotChunkO = psstrmOut->WritePos(); - int islotChunkI = psstrmIn->ReadPos(); - - // Need at least one character to test. - if (psstrmIn->SlotsPending() < 1 || !ptman->Pass(m_ipass-1)->DidResyncSkip()) - { - if (!psstrmIn->FullyWritten()) - { - // Ask previous pass for more input. - *pnRet = max(cslotToGet - psstrmIn->SlotsPending(), 1); - *pnRet = max(*pnRet, cslotNeededByNext - cslotGot); - *pcslotGot = cslotGot; - return; - } - else - { - Assert(ptman->Pass(m_ipass-1)->DidResyncSkip()); - Assert(psstrmIn->SlotsToReprocess() == 0); - psstrmIn->ClearReprocBuffer(); - DoResyncSkip(psstrmOut); - DoCleanUpSegMin(ptman, psstrmIn, islotInitReadPos, psstrmOut); - DoCleanUpSegLim(ptman, psstrmOut, twsh); - psstrmOut->MarkFullyWritten(); - *pnRet = kNextPass; - *pcslotGot = cslotGot; - return; - } - } - - std::vector vislotStarts; - std::vector vislotStops; - int islotReverseLim = psstrmIn->DirLevelRange(ptman->State(), - psstrmIn->ReadPos(), nTopDir, - vislotStarts, vislotStops); - //int islotReverseLim = psstrmIn->OldDirLevelRange(pengst, psstrmIn->ReadPos(), nTopDir); - if (islotReverseLim == -1) - { - // We haven't got the full range of reversed text yet-- - // ask for more input. - *pnRet = max(1, cslotNeededByNext - cslotGot); - *pcslotGot = cslotGot; - return; - } - - // Okay, we have enough input to do the reversal, if any. - - int cslotToReverse = islotReverseLim - psstrmIn->ReadPos(); - - // Never reverse the final linebreak; leave it at the end. - if (cslotToReverse > 0 && islotReverseLim > 0) - { - GrSlotState * pslotLast = psstrmIn->SlotAt(islotReverseLim - 1); - if (pslotLast->IsFinalLineBreak(ptman->LBGlyphID())) - { - for (size_t i = 0; i < vislotStops.size(); i++) - if (vislotStops.back() == islotReverseLim - 1) - vislotStops.back() = islotReverseLim - 2; - islotReverseLim--; - cslotToReverse--; - } - } - - psstrmIn->SetRuleStartReadPos(); - psstrmOut->SetRuleStartWritePos(); - - if (cslotToReverse == 0) - { - psstrmOut->CopyOneSlotFrom(psstrmIn); - } - else - { - int islotNextWritePos = psstrmOut->WritePos() + cslotToReverse; - int islotNextReadPos = psstrmIn->ReadPos() + cslotToReverse; - if (vislotStarts.size() == 0) - { - Assert(false); // this should have been done by DirLevelRange - vislotStarts.push_back(psstrmIn->ReadPos()); - vislotStops.push_back(islotNextReadPos - 1); - } - Assert(vislotStarts.back() == psstrmIn->ReadPos()); - Assert(vislotStops.back() == islotNextReadPos - 1); - int cslotNotCopied = Reverse(ptman, psstrmIn, psstrmOut, vislotStarts, vislotStops); - //Reverse(nTopDir + 1, - // psstrmIn, psstrmIn->ReadPos(), islotReverseLim, - // psstrmOut, psstrmOut->WritePos() + cslotToReverse - 1, psstrmOut->WritePos()-1); - - islotNextWritePos -= cslotNotCopied; // bidi markers that are not passed through - - psstrmIn->SetReadPos(islotNextReadPos); - psstrmOut->SetWritePos(islotNextWritePos); - - // It's quite strange to have the segment start or end in the middle of stuff to - // reverse (because the LB forms a natural terminator), but at any rate, - // if that happens, record the segment lim at the corresponding place in the - // output stream. - int islotSegMinIn = psstrmIn->SegMin(); - if (islotSegMinIn > -1 && - psstrmIn->ReadPos() - cslotToReverse <= islotSegMinIn && - islotSegMinIn < psstrmIn->ReadPos()) - { - Assert(islotSegMinIn == psstrmIn->ReadPos() - cslotToReverse); // normal situation - psstrmOut->SetSegMin( - psstrmOut->WritePos() - (psstrmIn->ReadPos() - islotSegMinIn)); - } - int islotSegLimIn = psstrmIn->SegLimIfKnown(); - if (islotSegLimIn > -1 && - psstrmIn->ReadPos() - cslotToReverse <= islotSegLimIn && - islotSegLimIn < psstrmIn->ReadPos()) - { - Assert(islotSegLimIn == psstrmIn->ReadPos() - cslotToReverse); // normal situation - psstrmOut->SetSegLim( - psstrmOut->WritePos() - (psstrmIn->ReadPos() - islotSegLimIn)); - } - } - - psstrmOut->SetPosForNextRule(0, psstrmIn, false); - - // Record the chunk mappings: - MapChunks(psstrmIn, psstrmOut, islotChunkI, islotChunkO, 0); - - cslotGot = psstrmOut->WritePos() - islotInitWritePos; - psstrmOut->CalcIndexOffset(ptman); - } - - DoResyncSkip(psstrmOut); - DoCleanUpSegMin(ptman, psstrmIn, islotInitReadPos, psstrmOut); - - // We're past the point where we care about anything in the reprocessing buffer. - Assert(psstrmIn->NoReproc()); - psstrmIn->ClearReprocBuffer(); - - Assert(psstrmIn->SlotsToReprocess() == 0); - - if (psstrmOut->PastEndOfPositioning(true)) - { - DoCleanUpSegLim(ptman, psstrmOut, twsh); - psstrmOut->MarkFullyWritten(); - } - - *pnRet = kNextPass; - *pcslotGot = cslotGot; -} - -/*---------------------------------------------------------------------------------------------- - Generate slots containing glyph IDs for the underlying character data, - incrementing the input pointer as we go. - - @param ptman - table manager - @param pchstrm - input character stream - @param psstrmOutput - output slot stream - @param ichSegLim - known end of segment, index into the text; or -1; - the lim of the of char-stream itself represents - the end of the text-source; this lim is the - known desired end of the segment - @param cchwPostXlbContext - number of characters that may be needed from the following line; - valid when ichSegLim > -1 - @param lb - breakweight to use for inserted LB - @param cslotToGet - the number of slots being requested by the following pass - @param fNeedFinalBreak - true if the end of the segment needs to be a valid break point - @param pislotFinalBreak - the end of this segment -----------------------------------------------------------------------------------------------*/ -int GrPass::ExtendGlyphIDOutput(GrTableManager * ptman, - GrCharStream * pchstrm, GrSlotStream * psstrmOut, int ichSegLim, int cchwPostXlbContext, - LineBrk lb, int cslotToGet, bool fNeedFinalBreak, TrWsHandling twsh, - int * pislotFinalBreak) -{ - EngineState * pengst = ptman->State(); - - // This pass should be the glyph-generation pass. - Assert(dynamic_cast(this)); - Assert(m_pzpst->m_cslotSkipToResync == 0); - m_pzpst->m_fDidResyncSkip = true; - - for (int islot = 0; islot < cslotToGet; ++islot) - { - int islotChunkO = psstrmOut->WritePos(); - int islotChunkI = pchstrm->SegOffset(); - - if (pchstrm->AtEnd() - || (ichSegLim > -1 && pchstrm->Pos() == ichSegLim)) - { - if (psstrmOut->SegLimIfKnown() > -1 && - psstrmOut->SegLimIfKnown() <= psstrmOut->WritePos()) - { - // Already found the end of this stream. - } - else - { - if (pchstrm->EndLine() && !fNeedFinalBreak) - // (if we need a good final break, don't just append an LB; - // make it backtrack and find a valid break point) - { - // Only need to get a good break when we're backtracking; otherwise we - // already know it. - Assert(ichSegLim == -1 || !fNeedFinalBreak); - // Notice that we're cheating here: we're putting the LB in the zeroth - // stream instead of in the output of the linebreak table. - psstrmOut->AppendLineBreak(ptman, pchstrm, - (pchstrm->AtEnd() ? klbWordBreak : lb), - ((ptman->RightToLeft()) ? kdircRlb : kdircLlb), -1, false, - pchstrm->SegOffset()); - if (pchstrm->AtEnd()) - pengst->SetFinalLB(); - else - pengst->SetInsertedLB(true); - } - else - { - // Don't actually insert a line-break glyph. - psstrmOut->SetSegLimToWritePos(); - } - *pislotFinalBreak = psstrmOut->WritePos() - 1; - if (ptman->NumberOfLbPasses() > 0 && pengst->HasInitialLB()) - { - // Because we cheated above: the output stream of the linekbreak table - // has an initial LB, which this stream doesn't have. Adjust the position - // of the final break to match what it will be in the output of the - // lb table. - *pislotFinalBreak += 1; - } - } - - if (twsh == ktwshNoWs && m_ipass == ptman->NumberOfLbPasses()) - { - int nRet = RemoveTrailingWhiteSpace(ptman, psstrmOut, twsh, pislotFinalBreak); - if (nRet == kBacktrack) // entire segment was white-space: - return kBacktrack; // backtrack, which will fail - } - if (pchstrm->AtEnd()) - { - psstrmOut->MarkFullyWritten(); - return kNextPass; - } - // otherwise we may need a few more characters for line-boundary contextualization. - } - - int ichwSegOffset; // offset from the official start of the segment - int cchw; // number of 16-bit chars consumed - GrFeatureValues fval; - int nUnicode = pchstrm->NextGet(ptman, &fval, &ichwSegOffset, &cchw); - gid16 chwGlyphID = ptman->GetGlyphIDFromUnicode(nUnicode); - - if (nUnicode == knCR || nUnicode == knLF || nUnicode == knLineSep || nUnicode == knParaSep || - nUnicode == knORC) - { - // Hard line-break: we're done. - // Note that we don't include the hard-break character in this segment. - pchstrm->HitHardBreak(); - pengst->SetHitHardBreak(); - psstrmOut->MarkFullyWritten(); - return kNextPass; - } - - GrSlotState * pslotNew; - ptman->State()->NewSlot(chwGlyphID, fval, 0, ichwSegOffset, nUnicode, &pslotNew); - - psstrmOut->NextPut(pslotNew); - psstrmOut->MapInputChunk(islotChunkI, islotChunkO, pchstrm->SegOffset(), false, false); - // Mapping the output chunks of the char stream has already been handled by the - // char stream. - - } - - psstrmOut->CalcIndexOffset(ptman); - - if (psstrmOut->PastEndOfPositioning(true) - || (ichSegLim > -1 && pchstrm->Pos() > ichSegLim + cchwPostXlbContext)) - { - // We have enough for this segment. - psstrmOut->MarkFullyWritten(); - } - - return kNextPass; -} - -/*---------------------------------------------------------------------------------------------- - Extend the output stream until it is using up the allotted amount of - physical space. Return kNextPass when all data has been processed successfully. - Return kBacktrack when space overflows, indicating that we need to backtrack - and find a break point. Otherwise, return the number of slots we - need from the previous pass. - - @param fWidthIsCharCount - kludge for test procedures - @param fInfiniteWidth - don't test for more space - @param fMustBacktrack - true if we need a good final break and haven't found one yet - @param lbMax - max allowed for the final slot - @param twsh - how we are handling trailing white-space -----------------------------------------------------------------------------------------------*/ -int GrPass::ExtendFinalOutput(GrTableManager * ptman, - GrSlotStream * psstrmInput, GrSlotStream * psstrmOutput, - float xsSpaceAllotted, bool fWidthIsCharCount, bool fInfiniteWidth, - bool fHaveLineBreak, bool fMustBacktrack, LineBrk lbMax, TrWsHandling twsh, - int * pislotLB, float * pxsWidth) -{ - EngineState * pengst = ptman->State(); - - // This pass should be the final positioning pass. - Assert(dynamic_cast(this)); - - // It would be very strange to be positioning based on something that happened in - // previous line. -- not true any more, since this will include the max-precontext-length. -// Assert(m_cslotSkipToResync == 0); - - int islotOutputLB = -1; - //int islotInitWritePos = psstrmOutput->WritePos(); - int islotNoLbUpTo = psstrmOutput->WritePos();; - - while (true) - { - // Do this right up front, so we are only measuring actual output. - if (m_pzpst->CanResyncSkip(psstrmOutput)) - m_pzpst->DoResyncSkip(psstrmOutput); - - bool fMoreSpace; - if (!m_pzpst->DidResyncSkip()) - fMoreSpace = true; - else if (fInfiniteWidth) - fMoreSpace = true; - else - fMoreSpace = psstrmOutput->MoreSpace(ptman, - xsSpaceAllotted, fWidthIsCharCount, - true, // always ignore trailing white space when we are first making the segment - twsh, - pxsWidth); - if (!fMoreSpace) - { - // Overflowed available space; backtrack and find a line break. - while (psstrmInput->SlotsToReprocess() > 0) - { - psstrmOutput->CopyOneSlotFrom(psstrmInput); - psstrmOutput->SetPosForNextRule(0, psstrmInput, IsPosPass()); - } - psstrmInput->ClearReprocBuffer(); - - *pislotLB = -1; - pengst->SetExceededSpace(); - pengst->SetHitHardBreak(false); - return kBacktrack; - } - - if (islotOutputLB != -1 && psstrmInput->SlotsToReprocess() == 0) - { - // Hit the inserted line break--we're done. - psstrmInput->ClearReprocBuffer(); - *pislotLB = islotOutputLB; - return kNextPass; - } - - int nslotAvailable = psstrmInput->SlotsPending(); - if ((nslotAvailable - ptman->PrevPassMaxBackup(m_ipass) - < MaxRuleContext() && !psstrmInput->FullyWritten()) - || !ptman->Pass(m_ipass-1)->DidResyncSkip()) - { - // Not enough available in the input--ask previous pass for more input. - // Ten is an arbitrary value--we ask for more that we really need to cut down - // on the number of times we loop between passes. - return max(MaxRuleContext() - (nslotAvailable - 10), 1); - } - - Assert(ptman->Pass(m_ipass - 1)->DidResyncSkip()); - - if (nslotAvailable == 0) - { - // No more input to process. If we have a valid line-break, or we don't care, - // we're done. Otherwise backtrack to find a valid break point. - Assert(psstrmInput->SlotsToReprocess() == 0); - psstrmInput->ClearReprocBuffer(); - if (fMustBacktrack) - { - *pislotLB = -1; - return kBacktrack; - } - else - { - psstrmOutput->MarkFullyWritten(); - return kNextPass; - } - } - - // Otherwise, we have enough input to run a rule. - - psstrmInput->SetRuleStartReadPos(); - psstrmOutput->SetRuleStartWritePos(); - - int ruln = -1; - if (m_pfsm) - ruln = m_pfsm->GetRuleToApply(ptman, this, psstrmInput, psstrmOutput); - ruln = CheckRuleValidity(ruln); - RunRule(ptman, ruln, psstrmInput, psstrmOutput); - - if (fHaveLineBreak) - { - islotOutputLB = - psstrmOutput->FindFinalLineBreak(ptman->LBGlyphID(), - islotNoLbUpTo, psstrmOutput->WritePos()); - islotNoLbUpTo = psstrmOutput->WritePos(); - } - - psstrmOutput->CalcIndexOffset(ptman); - } - - Assert(false); - - psstrmInput->ClearReprocBuffer(); - *pislotLB = -1; - return kNextPass; -} - -/*---------------------------------------------------------------------------------------------- - Remove undesirable trailing white-space. -----------------------------------------------------------------------------------------------*/ -int GrPass::RemoveTrailingWhiteSpace(GrTableManager * ptman, GrSlotStream * psstrmOut, - TrWsHandling twsh, int * pislotFinalBreak) -{ - EngineState * pengst = ptman->State(); - - Assert(twsh == ktwshNoWs); - Assert(m_ipass == ptman->NumberOfLbPasses()); // output of (final) lb pass - - int islotTmp = psstrmOut->FinalSegLim(); - if (islotTmp <= 0) - return kNextPass; - - GrSlotState * pslotLast = psstrmOut->SlotAt(islotTmp-1); - if (islotTmp > 0 && pslotLast->IsFinalLineBreak(ptman->LBGlyphID())) - { - islotTmp--; - pslotLast = (islotTmp > 0) ? psstrmOut->SlotAt(islotTmp-1) : NULL; - } - bool fRemovedWs = false; - while (islotTmp > 0 && pslotLast->Directionality() == kdircWhiteSpace) - { - islotTmp--; - pslotLast = (islotTmp > 0) ? psstrmOut->SlotAt(islotTmp-1) : NULL; - fRemovedWs = true; - } - if (fRemovedWs) - { - if (islotTmp <= 0) - { - // Entire segment was white-space: backtrack, which will fail. - return kBacktrack; - } - psstrmOut->SetSegLim(islotTmp); - *pislotFinalBreak = islotTmp - 1; - pengst->SetFinalLB(false); - pengst->SetRemovedTrWhiteSpace(); - ptman->UnwindAndReinit(islotTmp - 1); - } - - return kNextPass; -} - -/*---------------------------------------------------------------------------------------------- - Keep track of whether we're advancing through the input satisfactorily; - if not, forcibly advance. This is a safety net to avoid infinite loops; it - should never be necessary if they've set up their tables right. -----------------------------------------------------------------------------------------------*/ -void GrPass::CheckInputProgress(GrSlotStream * psstrmInput, GrSlotStream * psstrmOutput, - int islotOrigInput) -{ - int islotInput = psstrmInput->ReadPosForNextGet(); -// Assert(islotInput >= islotOrigInput); -- no longer true now that we can back up - - if (islotInput <= psstrmInput->ReadPosMax()) - { - // Didn't advance. - if (m_pzpst->m_nRulesSinceAdvance >= m_nMaxRuleLoop) - { - bool fAdvanced = false; - // Forcibly advance. First try to advance to where we backed up from. - while (!psstrmInput->AtEnd() && - psstrmInput->ReadPosForNextGet() < psstrmInput->ReadPosMax()) - { - RecordHitMaxRuleLoop(psstrmInput->ReadPosForNextGet()); - psstrmOutput->CopyOneSlotFrom(psstrmInput); - fAdvanced = true; - } - // If that didn't do anything productive, just advance one slot. - if (!fAdvanced && !psstrmInput->AtEndOfContext()) - { - RecordHitMaxRuleLoop(psstrmInput->ReadPosForNextGet()); - psstrmOutput->CopyOneSlotFrom(psstrmInput); - } - - m_pzpst->m_nRulesSinceAdvance = 0; - } - else m_pzpst->m_nRulesSinceAdvance++; - } - else m_pzpst->m_nRulesSinceAdvance = 0; - - psstrmInput->SetReadPosMax(islotInput); -} - -/*---------------------------------------------------------------------------------------------- - Record the chunks in the streams' chunk maps. - - psstrmIn/Out - streams being processed - islotChunkIn/Out - start of chunks - cslotReprocessed - number of slots to reprocess before the rule was run -----------------------------------------------------------------------------------------------*/ -void GrPass::MapChunks(GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, - int islotChunkIn, int islotChunkOut, int cslotReprocessed) -{ - if (islotChunkOut > psstrmOut->WritePos()) - { - // backing up - int islotReadPosTmp = psstrmIn->ReadPosForNextGet(); -/// Assert((islotChunkIn - islotReadPosTmp) == (islotChunkOut - psstrmOut->WritePos())); -// psstrmIn->MapOutputChunk(psstrmOut->WritePos() - 1, islotReadPosTmp - 1, -// islotChunkOut, true, 0, true); -// psstrmOut->MapInputChunk(islotReadPosTmp - 1, psstrmOut->WritePos() - 1, -// islotChunkIn, true, true); - - // Resync. - if (psstrmOut->WritePos() == 0) - { - // Clear all the chunks. - psstrmIn->MapOutputChunk(-1, -1, 0, true, 0, true); - psstrmOut->MapInputChunk(-1, -1, islotReadPosTmp, true, true); - psstrmIn->AssertChunkMapsValid(psstrmOut); - return; - } - else if (islotReadPosTmp == 0) - { - // Clear all the chunks. - psstrmIn->MapOutputChunk(-1, -1, psstrmOut->WritePos(), true, 0, true); - psstrmOut->MapInputChunk(-1, -1, 0, true, true); - psstrmIn->AssertChunkMapsValid(psstrmOut); - return; - } - // Find the beginning of the current chunk. - int islotChunkOutAdj = min(islotChunkOut, psstrmOut->WritePos() - 1); - int islotChunkInAdj = psstrmOut->ChunkInPrev(islotChunkOutAdj); - while (islotChunkInAdj == -1 && islotChunkOutAdj > 0) - islotChunkInAdj = psstrmOut->ChunkInPrev(--islotChunkOutAdj); - - if (islotChunkInAdj == -1) - { - // Couldn't find the beginning of any chunk; zap them all. - psstrmIn->MapOutputChunk(-1, -1, psstrmOut->WritePos(), true, 0, true); - psstrmOut->MapInputChunk(-1, -1, psstrmOut->ReadPos(), true, true); - psstrmIn->AssertChunkMapsValid(psstrmOut); - return; - } - - if (psstrmIn->ChunkInNext(islotChunkInAdj) != islotChunkOutAdj) - { - islotChunkOutAdj = psstrmIn->ChunkInNext(islotChunkInAdj); - while (islotChunkOutAdj == -1 && islotChunkInAdj > 0) - islotChunkOutAdj = psstrmIn->ChunkInNext(--islotChunkInAdj); - } - - psstrmIn->MapOutputChunk(islotChunkOutAdj, islotChunkInAdj, - psstrmOut->WritePos(), false, 0, true); - psstrmOut->MapInputChunk(islotChunkInAdj, islotChunkOutAdj, - psstrmIn->ReadPos(), false, true); - } - else if (islotChunkOut == psstrmOut->WritePos()) - // no output generated--continue the previous chunk - ; - else if (islotChunkIn == psstrmIn->ReadPos()) - // no input consumed - ; - else - { - psstrmIn->MapOutputChunk(islotChunkOut, islotChunkIn, psstrmOut->WritePos(), - (cslotReprocessed > 0), cslotReprocessed, false); - psstrmOut->MapInputChunk(islotChunkIn, islotChunkOut, psstrmIn->ReadPos(), - (cslotReprocessed > 0), false); - } - - psstrmIn->AssertChunkMapsValid(psstrmOut); - - m_pzpst->m_nMaxChunk = max(m_pzpst->m_nMaxChunk, psstrmIn->LastNextChunkLength()); -} - -/*---------------------------------------------------------------------------------------------- - This method is something of a kludge. During the course of running the rules we try to - keep track of the seg-min location, but sometimes that gets confused due to insertions - and deletions at the segment boundaries. -----------------------------------------------------------------------------------------------*/ -void GrSubPass::DoCleanUpSegMin(GrTableManager * ptman, - GrSlotStream * psstrmIn, int islotInitReadPos, GrSlotStream * psstrmOut) -{ - int islotSegMinIn = psstrmIn->SegMin(); - if (islotSegMinIn == -1) - return; // input doesn't even know it - if (islotInitReadPos > islotSegMinIn) - return; // should already have figured it out - - // Otherwise this batch of processing likely set the seg-min on the output stream, - // so check it out. - - // First, if the seg-min of the input stream is zero, it should be zero on the output. - if (islotSegMinIn == 0) - { - psstrmOut->SetSegMin(0, true); - return; - } - - // If there is an initial line-break, the seg-min should be just before it. - int islot; - if (ptman->State()->HasInitialLB()) - { - gid16 chwLB = ptman->LBGlyphID(); - - // Unfortunately, the seg-min from the previous segment can get off, too. :-( - // Fix it, while we're at it. - if (!psstrmIn->SlotAt(islotSegMinIn)->IsInitialLineBreak(chwLB)) - { - for (islot = 0; islot < psstrmIn->ReadPos(); islot++) - if (psstrmIn->SlotAt(islot)->IsInitialLineBreak(chwLB)) - { - psstrmIn->SetSegMin(islot, true); - break; - } - } - if (psstrmOut->SegMin() > -1 - && psstrmOut->SlotAt(psstrmOut->SegMin())->IsInitialLineBreak(chwLB)) - { - return; // already okay - } - for (islot = 0; islot < psstrmOut->WritePos(); islot++) - if (psstrmOut->SlotAt(islot)->IsInitialLineBreak(chwLB)) - { - psstrmOut->SetSegMin(islot, true); - return; - } - Assert(false); // couldn't find it - } - - // Otherwise, figure it out using the associations. First observe that the seg-min - // will be in the corresponding chunk to the seg-min of the previous pass. - int islotChunkMinIn = psstrmIn->ChunkInNextMin(islotSegMinIn); - int islotChunkLimIn = psstrmIn->ChunkInNextLim(islotSegMinIn); - if (islotChunkMinIn == -1) islotChunkMinIn = 0; - if (islotChunkLimIn == -1) islotChunkLimIn = 1; - - int islotChunkMinOut = psstrmIn->ChunkInNext(islotChunkMinIn); - int islotChunkLimOut = psstrmIn->ChunkInNext(islotChunkLimIn); - if (islotChunkMinOut == -1) islotChunkMinOut = 0; - if (islotChunkLimOut == -1) islotChunkLimOut = 1; - - int islotSegMinOut = psstrmOut->SegMin(); - if (islotSegMinOut == -1) - { - // No reasonable guess; try to figure it out. - for (islot = islotChunkMinOut; islot < islotChunkLimOut; islot++) - { -// GrSlotState * pslotOut = psstrmOut->SlotAt(islot); - if (psstrmOut->SlotAt(islot)->BeforeAssoc() == 0) - { - islotSegMinOut = islot; - break; - } - } - if (islotSegMinOut == -1) - { - // Ick, couldn't figure it out. Let's hope we set it to something reasonable earlier. - Assert(psstrmOut->SegMin() > -1); - return; - } - } - // else we have a reasonable guess - - // islotSegMinOut is the best or at leastfirst slot in the chunk that maps into the segment. - // But if there is an adjacent slot inserted before it and it is in the chunk, - // we want to include that also. - while (islotSegMinOut > islotChunkMinOut - && psstrmOut->SlotAt(islotSegMinOut-1)->BeforeAssoc() >= 0) - { - islotSegMinOut--; - } - psstrmOut->SetSegMin(islotSegMinOut, true); -} - -/*---------------------------------------------------------------------------------------------- - This method is something of a kludge. We try to put inserted glyphs after the final - line-break, but if we don't have line break, they should go inside the segment. - This method is only called after the pass is fully written. -----------------------------------------------------------------------------------------------*/ -void GrSubPass::DoCleanUpSegLim(GrTableManager * ptman, GrSlotStream * psstrmOut, - TrWsHandling twsh) -{ - int islotSegLimOut = psstrmOut->SegLimIfKnown(); - if (islotSegLimOut == -1) - return; // output hasn't set it; nothing to fix - - if (twsh == ktwshNoWs) - return; // we just stripped off the whitespace; don't put it back! - - //gid16 chwLB = ptman->LBGlyphID(); - // If there is a LB glyph, it should be at islotSegLimOut-- - // unless we backtracked an inserted one earlier. - if (ptman->State()->HasInsertedLB()) // && psstrmOut->SlotAt(islotSegLimOut)->IsFinalLineBreak(chwLB)) - return; - - // Okay, no LB; make sure all output glyphs are included in this segment. - psstrmOut->SetSegLimToWritePos(true); -} - -/*---------------------------------------------------------------------------------------------- - If we are in a state where we are supposed to skip some of the initial output, - do so. The purpose of this is to resync when restarting for a segment other than the - first. Caller should ensure that there are enough slots to skip. -----------------------------------------------------------------------------------------------*/ -int PassState::DoResyncSkip(GrSlotStream * psstrmOutput) -{ - if (m_fDidResyncSkip) - return 0; - - if (m_cslotSkipToResync == 0) - { - m_fDidResyncSkip = true; - return 0; - } - - if (!CanResyncSkip(psstrmOutput)) - { - Assert(false); // caller makes sure this doesn't happen - return (m_cslotSkipToResync - psstrmOutput->WritePos()); - } - - psstrmOutput->ResyncSkip(m_cslotSkipToResync); - m_fDidResyncSkip = true; - - return 0; -} - -/*---------------------------------------------------------------------------------------------- - Run a constraint for a single rule. - - @param ruln - rule to test - @param psstrmIn - input stream - @param psstrmOut - for accessing items in the pre-context - @param cslotPreModContext - the number of items that need to be tested prior to the - current stream position - @param cslotMatched - the number of items matched after the current stream position -----------------------------------------------------------------------------------------------*/ -bool GrPass::RunConstraint(GrTableManager * ptman, int ruln, - GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, - int cslotPreModContext, int cslotMatched) -{ - int nRet = 0; - - if (m_prgibConstraintStart == NULL) - return true; - - int biStart = int(m_prgibConstraintStart[ruln]); - if (biStart == 0) - return true; // no constraints - - for (int islot = -cslotPreModContext; islot < cslotMatched; islot++) - { - nRet = RunCommandCode(ptman, m_prgbConstraintBlock + biStart, true, - psstrmIn, psstrmOut, islot); - - if (nRet == 0) // one slot failed - return false; - } - - return (nRet != 0); -} - -/*---------------------------------------------------------------------------------------------- - Check that we can interpret all the commands in the rule. If not, return -1 indicating - that we don't want to run a rule after all. This can happen when the version of the compiler - that generated the font is later than this engine. -----------------------------------------------------------------------------------------------*/ -int GrPass::CheckRuleValidity(int ruln) -{ - if (ruln == -1) - return -1; - - if (m_prgfRuleOkay[ruln]) - return ruln; - - int biStart = m_prgibActionStart[ruln]; - byte * pbNext = m_prgbActionBlock + biStart; - - // General purpose variables: -// int arg1, arg2, arg3, arg4; - int nSlotRef; - int nInputClass; - int nOutputClass; - int c; - int islotArg; - int nIndex; - int nGlyphAttr; - int nAttLevel; - int nFeat; - int nPState; -// SlotAttrName slat; - - int i; - -// int nRet = 0; - - while (true) // exit by encountering PopRet or RetTrue or RetZero - { - ActionCommand op = ActionCommand(*pbNext++); - - switch (op) - { - case kopNop: - break; - - case kopPushByte: - pbNext++; - break; - case kopPushByteU: - pbNext++; - break; - case kopPushShort: - pbNext++; - pbNext++; - break; - case kopPushShortU: - pbNext++; - pbNext++; - break; - case kopPushLong: - pbNext++; - pbNext++; - pbNext++; - pbNext++; - break; - - case kopNeg: - case kopTrunc8: case kopTrunc16: - case kopNot: - break; - - case kopAdd: case kopSub: - case kopMul: case kopDiv: - case kopMin: case kopMax: - case kopAnd: case kopOr: - case kopEqual: case kopNotEq: - case kopLess: case kopGtr: - case kopLessEq: case kopGtrEq: - break; - - case kopCond: - break; - - case kopNext: - break; - case kopNextN: - c = *pbNext; pbNext++; // count - break; - case kopPutGlyph8bitObs: - nOutputClass = *pbNext++; - break; - case kopPutGlyph: - pbNext += 2; - break; - case kopPutCopy: - nSlotRef = *pbNext++; - break; - case kopPutSubs8bitObs: - nSlotRef = *pbNext++; - nInputClass = *pbNext++; - nOutputClass = *pbNext++; - break; - case kopPutSubs: - nSlotRef = *pbNext++; - pbNext += 4; // 2 bytes each for classes - break; - case kopCopyNext: - break; - case kopInsert: - break; - case kopDelete: - break; - case kopAssoc: - c = *pbNext; pbNext++; - for (i = 0; i < c; i++) - pbNext++; - break; - case kopCntxtItem: - islotArg = *pbNext++; - c = *pbNext++; - break; - - case kopAttrSet: - case kopAttrAdd: - case kopAttrSub: - case kopAttrSetSlot: - pbNext++; // slot attribute ID - break; - case kopIAttrSet: - case kopIAttrAdd: - case kopIAttrSub: - case kopIAttrSetSlot: - pbNext++; // slot attribute ID - nIndex = *pbNext++; // index; eg, global ID for component - break; - - case kopPushSlotAttr: - pbNext++; - nSlotRef = *pbNext++; - break; - case kopPushISlotAttr: - pbNext++; - nSlotRef = *pbNext++; - nIndex = *pbNext++; - break; - - case kopPushGlyphAttrObs: - case kopPushAttToGAttrObs: - nGlyphAttr = *pbNext++; - nSlotRef = *pbNext++; - break; - case kopPushGlyphAttr: - case kopPushAttToGlyphAttr: - *pbNext += 3; - break; - case kopPushGlyphMetric: - case kopPushAttToGlyphMetric: - nGlyphAttr = *pbNext++; - nSlotRef = *pbNext++; - nAttLevel = *pbNext++; - break; - case kopPushFeat: - nFeat = *pbNext++; - nSlotRef = *pbNext++; - break; - - case kopPushProcState: - nPState = *pbNext++; - break; - case kopPushVersion: - break; - - case kopPopRet: - case kopRetZero: - case kopRetTrue: - m_prgfRuleOkay[ruln] = true; - return ruln; - - default: - // Uninterpretable command: - return -1; - } - } - - return ruln; // to keep compiler from griping -} - -/*---------------------------------------------------------------------------------------------- - Runs the rule, if any, otherwise just passes one character through. - The rule does nothing but set the line-break weights for the slots. - - @param ptman - the table manager that allocates slots - @param ruln - number of rule to run; -1 if none applies - @param psstrmIn/Out - input/output stream -----------------------------------------------------------------------------------------------*/ -void GrLineBreakPass::RunRule(GrTableManager * ptman, int ruln, - GrSlotStream * psstrmIn, GrSlotStream * psstrmOut) -{ - // Remember the beginnings of the new chunk: - int islotIn = psstrmIn->ReadPos(); - int islotOut = psstrmOut->WritePos(); - int cslotReprocessed = psstrmIn->SlotsToReprocess(); - - if (ruln == -1) - { -#ifdef OLD_TEST_STUFF - if (RunTestRules(ptman, ruln, psstrmIn, psstrmOut)) -#else - if (false) -#endif // OLD_TEST_STUFF - {} - else - // Just pass one glyph through. - { - psstrmOut->CopyOneSlotFrom(psstrmIn); - psstrmOut->SetPosForNextRule(0, psstrmIn, false); - } - } - else - { - // Run the rule. -#ifdef OLD_TEST_STUFF - if (RunTestRules(ptman, ruln, psstrmIn, psstrmOut)) -#else - if (false) -#endif // OLD_TEST_STUFF - {} - else - { - int biStart = m_prgibActionStart[ruln]; - int iResult = RunCommandCode(ptman, m_prgbActionBlock + biStart, false, - psstrmIn, psstrmOut, 0); - psstrmOut->SetPosForNextRule(iResult, psstrmIn, false); - } - } - - CheckInputProgress(psstrmIn, psstrmOut, islotIn); - - MapChunks(psstrmIn, psstrmOut, islotIn, islotOut, cslotReprocessed); -} - -/*---------------------------------------------------------------------------------------------- - Runs the rule, if any, otherwise just passes one character through. - Keeps track of the association information in the slots and chunk - mappings for backtracking. - - @param ptman - the table manager that allocates slots - @param ruln - number of rule to run; -1 if none applies - @param psstrmIn/Out - input / output streams -----------------------------------------------------------------------------------------------*/ -void GrSubPass::RunRule(GrTableManager * ptman, int ruln, - GrSlotStream * psstrmIn, GrSlotStream * psstrmOut) -{ - // Remember the beginnings of the new chunk: - int islotIn = psstrmIn->ReadPosForNextGet(); - int islotOut = psstrmOut->WritePos(); - int cslotReprocessed = psstrmIn->SlotsToReprocess(); - - if (ruln == -1) - { -#ifdef OLD_TEST_STUFF - if (RunTestRules(ptman, ruln, psstrmIn, psstrmOut)) -#else - if (false) -#endif // OLD_TEST_STUFF - {} - else - // Just pass one glyph through. - { - psstrmOut->CopyOneSlotFrom(psstrmIn); - psstrmOut->SetPosForNextRule(0, psstrmIn, false); - } - } - else - { - // Run the rule. -#ifdef OLD_TEST_STUFF - if (RunTestRules(ptman, ruln, psstrmIn, psstrmOut)) -#else - if (false) -#endif // OLD_TEST_STUFF - {} - else - /****************************/ - { - int biStart = m_prgibActionStart[ruln]; - int iResult = RunCommandCode(ptman, m_prgbActionBlock + biStart, false, - psstrmIn, psstrmOut, 0); - psstrmOut->SetPosForNextRule(iResult, psstrmIn, false); - - // Restore if we need line-boundary contextualization based on physical locations - ////psstrmOut->SetLBContextFlag(ptman, islotOut); - } - } - - CheckInputProgress(psstrmIn, psstrmOut, islotIn); - - MapChunks(psstrmIn, psstrmOut, islotIn, islotOut, cslotReprocessed); -} - -/*---------------------------------------------------------------------------------------------- - Runs the rule, if any, otherwise just positions one character in the standard way. - Keeps track of (among other things) the overall physical size of the output - and chunk mappings. - - @param ptman - the table manager that allocates slots - @param ruln - number of rule to run; -1 if none applies - @param psstrmIn / Out - input / output streams -----------------------------------------------------------------------------------------------*/ -void GrPosPass::RunRule(GrTableManager * ptman, int ruln, - GrSlotStream * psstrmIn, GrSlotStream * psstrmOut) -{ - // Remember the beginnings of the new chunk: - int islotIn = psstrmIn->ReadPosForNextGet(); - int islotOut = psstrmOut->WritePos(); - int cslotReprocessed = psstrmIn->SlotsToReprocess(); - - int iResult = 0; - - Assert(psstrmIn->GotIndexOffset()); - // Don't do any positioning in anything being processed from the previous line. - if (psstrmIn->ReadPosForNextGet() < psstrmIn->IndexOffset()) - ruln = -1; - - if (ruln == -1) - { - // Just position one glyph in the standard way. - psstrmOut->CopyOneSlotFrom(psstrmIn); - iResult = 0; - } - else - { - // Run the rule. -#ifdef OLD_TEST_STUFF - if (RunTestRules(ptman, ruln, psstrmIn, psstrmOut)) -#else - if (false) -#endif // OLD_TEST_STUFF - {} - else - { - int biStart = m_prgibActionStart[ruln]; - iResult = RunCommandCode(ptman, m_prgbActionBlock + biStart, false, - psstrmIn, psstrmOut, 0); - } - } - - // Make sure an entire cluster is present in the output stream. Actually there might be - // interleaved clusters, which is the purpose for the loop. - int dislotClusterMax = 0; - do { - dislotClusterMax = psstrmIn->MaxClusterSlot(islotIn, psstrmIn->ReadPos()); - Assert(dislotClusterMax >= 0); - for (int islot = 0; islot < dislotClusterMax; islot++) - psstrmOut->CopyOneSlotFrom(psstrmIn); - iResult -= dislotClusterMax; - } while (dislotClusterMax > 0); - - psstrmOut->SetPosForNextRule(iResult, psstrmIn, true); - - // Restore if we need line-boundary contextualization based on physical locations - ////psstrmOut->SetLBContextFlag(ptman, islotOut); - - if (ruln > -1) - { - psstrmOut->CalcIndexOffset(ptman); - // Update the attachment trees and cluster metrics for slots modified by this rule. - // Note that this loop assumes that the reprocess buffer points to the identical - // slot objects as the output stream (not copies of the slots). - for (int islot = islotIn - psstrmIn->SlotsSkippedToResync(); - islot < psstrmOut->WritePos() + psstrmIn->SlotsToReprocess(); - islot++) - { - psstrmOut->SlotAt(islot)->HandleModifiedPosition(ptman, psstrmIn, psstrmOut, islot); - } - } - - CheckInputProgress(psstrmIn, psstrmOut, islotIn); - - MapChunks(psstrmIn, psstrmOut, islotIn, islotOut, cslotReprocessed); - - psstrmOut->AssertStreamIndicesValid(psstrmIn); -} - -/*---------------------------------------------------------------------------------------------- - Perform the reversal for internal bidirectionality. - Caller is responsible for updating the read- and write-positions. - Private. - - OBSOLETE - - @param nCurrDirection - direction level of range of reverse - @param psstrmIn, psstrmOut - streams - @param islotInMin, islotInLim - range to reverse - @param islotOutMin,islotOutLim - corresponding output positions; note that islotOutMin - will be greater than islotOutLim if we are reversing - reversing the slots (direction is odd) -----------------------------------------------------------------------------------------------*/ -#if 0 -void GrBidiPass::OldReverse(int nCurrDirection, - GrSlotStream * psstrmIn, int islotInMin, int islotInLim, - GrSlotStream * psstrmOut, int islotOutMin, int islotOutLim) -{ - int oInc = (islotOutLim > islotOutMin)? 1: -1; // which direction output is moving in - // buffer (if dir is even, oInc == 1; - // if odd, oInc == -1) - - int islotITmp = islotInMin; - int islotOTmp = islotOutMin; - - while (islotITmp != islotInLim) { - // Find end of sub-range at current level to reverse. - int islotSubLim = psstrmIn->OldDirLevelRange(NULL, islotITmp, nCurrDirection); - Assert(islotSubLim >= 0); - - if (islotSubLim == islotITmp) { - // Current slot is at this level--just copy it. - psstrmOut->SimpleCopyFrom(psstrmIn, islotITmp, islotOTmp); - islotOTmp += oInc; - islotITmp++; - } - else { - // There is a sub-range that needs to be reversed. - int islotONext = islotOTmp + ((islotSubLim-islotITmp) * oInc); - OldReverse(nCurrDirection+1, - psstrmIn, islotITmp, islotSubLim, - psstrmOut, islotONext - oInc, islotOTmp - oInc); - islotOTmp = islotONext; - islotITmp = islotSubLim; - } - } -} -#endif - -/*---------------------------------------------------------------------------------------------- - Perform the reversal for internal bidirectionality. - Caller is responsible for updating the read- and write-positions. - Return the number of slots NOT copied because they were markers. - Private. - - @param psstrmIn, psstrmOut - streams - @param vislotStarts, vislotStops - indices of ranges to reverse, from inner to outer -----------------------------------------------------------------------------------------------*/ -int GrBidiPass::Reverse(GrTableManager * ptman, - GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, - std::vector & vislotStarts, std::vector & vislotStops) -{ - Assert(vislotStarts.size() == vislotStops.size()); - - std::vector vislotMap; // list of slot indices in the order they should be copied - // into the output - - int islotOuterStart = vislotStarts.back(); - int islotOuterStop = vislotStops.back(); - - // Initialize map as if nothing is reversed; eg for [2, 9]: (2 3 4 5 6 7 8 9) - int islot; - for (islot = 0; islot <= (islotOuterStop - islotOuterStart); islot++) - vislotMap.push_back(islot + islotOuterStart); - - // Do the inner reversals first, followed by the outer reversals. - size_t iislot; - for (iislot = 0; iislot < vislotStarts.size(); iislot++) - { - // Reverse the run. - int islotStart = vislotStarts[iislot] - islotOuterStart; - int islotStop = vislotStops[iislot] - islotOuterStart; - int islot1, islot2; - for (islot1 = islotStart, islot2 = islotStop; islot1 < islot2; islot1++, islot2--) - { - int islotTmp = vislotMap[islot1]; - vislotMap[islot1] = vislotMap[islot2]; - vislotMap[islot2] = islotTmp; - } - } - - // With vislotStarts = [7, 5, 2] and vislotStops = [8, 8, 9], we get - // first: (2 3 4 5 6 8 7 9) - // then: (2 3 4 7 8 5 6 9) - // and finally: (9 6 5 8 7 4 3 2) - - // Now copy the slots. - - int islotOutStart = psstrmOut->WritePos(); - int cslotNotCopied = 0; - for (iislot = 0; iislot < vislotMap.size(); iislot++) - { - GrSlotState * pslot = psstrmIn->SlotAt(vislotMap[iislot]); - // Don't copy bidi markers unless they have been set to use a specific glyph. - if (pslot->IsBidiMarker() && pslot->ActualGlyphForOutput(ptman) == 0) - cslotNotCopied++; - else - psstrmOut->SimpleCopyFrom(psstrmIn, vislotMap[iislot], - iislot + islotOutStart - cslotNotCopied); - } - return cslotNotCopied; -} - -/*---------------------------------------------------------------------------------------------- - Unwind the output for this pass, given that a change was assumed to have occurred - in the input at the given position. Return the position to which we unwound. -----------------------------------------------------------------------------------------------*/ -int GrPass::Unwind(GrTableManager * ptman, - int islotChanged, GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, - bool fFirst) -{ - // Back up the number of slots required for the longest rule context, - // but if we land in the middle of a chunk, go forward to its boundary. - int islotIn = max(islotChanged - m_pzpst->MaxChunk(), 0); - if (!psstrmIn->NoReproc()) - islotIn = min(islotIn, psstrmIn->ReprocMin()); - psstrmIn->ClearReprocBuffer(); - int islotOut = 0; - if (islotIn < psstrmIn->SlotsSkippedToResync() || - islotIn == 0 || - psstrmIn->ReadPos() == 0) - { - // The next-chunk-map is invalid. The beginning of the chunk is 0. - islotIn = 0; - islotOut = 0; - } - else if (islotIn >= psstrmIn->ReadPos()) - { - // No need to unwind. - Assert(psstrmIn->NoReproc()); - return psstrmOut->WritePos(); - } - else - { - Assert(islotIn < psstrmIn->ReadPos()); - islotIn = min(islotIn, psstrmIn->ReadPos() - 1); - while (islotIn < psstrmIn->ReadPos() && - (islotOut = psstrmIn->ChunkInNext(islotIn)) == -1) - { - ++islotIn; - } - if (islotIn == psstrmIn->ReadPos()) - islotOut = psstrmOut->WritePos(); - } - - Assert(islotOut != -2); // because the chunk size must be <= than the max-chunk, - // so we should never hit the end of the output stream - - // Now we've found a chunk boundary. - -// if (fFirst) -// Unattach(psstrmIn, islotIn, psstrmOut, islotOut, islotChanged); -// else -// Unattach(psstrmIn, islotIn, psstrmOut, islotOut, -1); - - psstrmIn->UnwindInput(islotIn, PreBidiPass()); - psstrmOut->UnwindOutput(islotOut, IsPosPass()); - - if (psstrmIn->ReadPos() < psstrmIn->SlotsSkippedToResync()) - { - ptman->Pass(m_ipass - 1)->UndoResyncSkip(); - psstrmIn->ClearSlotsSkippedToResync(); - } - if (psstrmOut->WritePos() < psstrmOut->SlotsSkippedToResync()) - { - Assert(psstrmOut->SlotsSkippedToResync() == m_pzpst->m_cslotSkipToResync); - UndoResyncSkip(); - psstrmOut->ClearSlotsSkippedToResync(); - } - - if (ptman->LoggingTransduction()) - m_pzpst->UnwindLogInfo(islotIn, islotOut); - - return islotOut; -} - -/*---------------------------------------------------------------------------------------------- - For a GrBidiPass, just unwind to the beginning of the reordered chunk. -----------------------------------------------------------------------------------------------*/ -int GrBidiPass::Unwind(GrTableManager * ptman, - int islotChanged, GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, - bool fFirst) -{ - int islotIn; - int islotOut; - - if (islotChanged == 0) - { - islotIn = 0; - islotOut = 0; - } - else { - islotIn = min(islotChanged, psstrmIn->ReadPos()); - islotIn = max(islotIn - 1, 0); - while (islotIn > 0 && !StrongDir(psstrmIn->SlotAt(islotIn)->Directionality())) - { - // Slightly redundant with ZapCalculatedDirLevels, but possibly needed for slots - // that have been modified by the substitution passes. - psstrmIn->SlotAt(islotIn)->ZapDirLevel(); - islotIn--; - } - Assert(islotIn == 0 || psstrmIn->SlotAt(islotIn)->DirHasBeenProcessed()); - islotOut = 0; - while (islotIn > 0 && (islotOut = psstrmIn->ChunkInNext(islotIn)) == -1) - --islotIn; - } - - if (islotOut == -1 || islotOut == -2) - islotOut = 0; - - // Now we've found a chunk boundary; islotI and islotO are the positions in the - // input and output streams, respectively. - - psstrmIn->UnwindInput(islotIn, false); - psstrmOut->UnwindOutput(islotOut, false); - - if (psstrmOut->WritePos() < m_pzpst->m_cslotSkipToResync) - { - Assert(false); // shouldn't be any of this mess for the Bidi pass - m_pzpst->m_fDidResyncSkip = false; - } - - if (ptman->LoggingTransduction()) - m_pzpst->UnwindLogInfo(islotIn, islotOut); - - return islotOut; -} - -/*---------------------------------------------------------------------------------------------- - Reinitialize part of the transduction logging information when we unwind the pass. -----------------------------------------------------------------------------------------------*/ -void PassState::UnwindLogInfo(int islotIn, int islotOut) -{ - while (m_crulrec > 0 && m_rgrulrec[m_crulrec-1].m_islot >= islotIn) - { - m_crulrec--; - m_rgrulrec[m_crulrec].m_islot = 0; - m_rgrulrec[m_crulrec].m_irul = 0; - m_rgrulrec[m_crulrec].m_fFired = false; - } - - for (int islot = islotOut; islot < 128; islot++) - { - m_rgcslotDeletions[islot] = 0; - m_rgfInsertion[islot] = false; - } -} - -/*---------------------------------------------------------------------------------------------- - Undo the side effects of attachments, ie, fix up the attachment trees as we unwind. - - @param islotLB the index of the line-break that was just inserted, or -1 if this is - not the first pass to include line-breaks; we want to skip this slot - in the processing in this method - - OBSOLETE -----------------------------------------------------------------------------------------------*/ -//:Ignore -void GrPosPass::Unattach(GrSlotStream * psstrmIn, int islotIn, - GrSlotStream * psstrmOut, int islotOut, int islotLB) -{ - // Because this is a positioning pass, there is a one-to-one correspondence between - // the slots in the input and the slots in the output. Thus we can make simplifying - // assumptions. Specifically, the chunk sizes are equal, except for the possiblity - // of a LB slot that we just inserted in the input stream. -#if 0 - -#ifdef _DEBUG - int islotDiff = (psstrmIn->ReadPos() - islotIn) - (psstrmOut->WritePos() - islotOut); - if (islotLB == -1) - Assert(islotDiff == 0); - else - Assert(islotDiff == 1); -#endif // _DEBUG - - int islotInLp = psstrmIn->ReadPos(); - int islotOutLp = psstrmOut->WritePos(); - for ( ; islotInLp-- > islotIn && islotOutLp-- > islotOut; ) - { - if (islotLB == islotInLp) - { - GrSlotState * pslotTmp = psstrmIn->SlotAt(islotInLp); - islotInLp--; - } - - GrSlotState * pslotIn = psstrmIn->SlotAt(islotInLp); - GrSlotState * pslotOut = psstrmOut->SlotAt(islotOutLp); - - if (pslotIn != pslotOut) - { - GrSlotState * pslotInRoot = pslotIn->AttachRoot(); - GrSlotState * pslotOutRoot = pslotOut->AttachRoot(); - - if (pslotOutRoot) - pslotOutRoot->RemoveLeaf(pslotOut); - if (pslotInRoot) - pslotInRoot->AddLeaf(pslotIn); - } - } -#endif // 0 -} -//:End Ignore - - -/*---------------------------------------------------------------------------------------------- - Record the fact that the given rule's constraint failed, for the purpose of logging - the transduction process. -----------------------------------------------------------------------------------------------*/ -void GrPass::RecordRuleFailed(int islot, int irul) -{ - m_pzpst->RecordRule(islot, irul, false); -} - - -/*---------------------------------------------------------------------------------------------- - Record the fact that the given rule fired, for the purpose of logging - the transduction process. -----------------------------------------------------------------------------------------------*/ -void GrPass::RecordRuleFired(int islot, int irul) -{ - m_pzpst->RecordRule(islot, irul, true); -} - - -/*---------------------------------------------------------------------------------------------- - Record the fact that we forcibly advanced due to the max-rule-loop. -----------------------------------------------------------------------------------------------*/ -void GrPass::RecordHitMaxRuleLoop(int islot) -{ - m_pzpst->RecordRule(islot, PassState::kHitMaxRuleLoop); -} - - -/*---------------------------------------------------------------------------------------------- - Record the fact that we forcibly advanced due to the max-backup. - - In theory it should be possible to call this, but in reality, it is pretty hard to be - able to say that there is a rule that would have fired except it was prevent by - MaxBackup. So currently this method is not called. -----------------------------------------------------------------------------------------------*/ -void GrPass::RecordHitMaxBackup(int islot) -{ - m_pzpst->RecordRule(islot, PassState::kHitMaxBackup); -} - - -/*---------------------------------------------------------------------------------------------- - Record some rule-related activity on a slot. -----------------------------------------------------------------------------------------------*/ -void PassState::RecordRule(int islot, int irul, bool fFired) -{ - if (m_crulrec >= 128) - return; - - m_rgrulrec[m_crulrec].m_irul = irul; - m_rgrulrec[m_crulrec].m_islot = islot; - m_rgrulrec[m_crulrec].m_fFired = true; - m_rgrulrec[m_crulrec].m_fFired = fFired; - m_crulrec++; -} - - -/*---------------------------------------------------------------------------------------------- - Record the fact that a slot was deleted before the given slot (in the output). -----------------------------------------------------------------------------------------------*/ -void PassState::RecordDeletionBefore(int islot) -{ - if (islot >= 128) - return; - - (m_rgcslotDeletions[islot])++; -} - -/*---------------------------------------------------------------------------------------------- - Record the fact that the given slot was inserted into the output. -----------------------------------------------------------------------------------------------*/ -void PassState::RecordInsertionAt(int islot) -{ - if (islot >= 128) - return; - - m_rgfInsertion[islot] = true; -} - -} // namespace gr diff --git a/Build/source/libs/graphite/engine-2.3.1/src/segment/GrPass.h b/Build/source/libs/graphite/engine-2.3.1/src/segment/GrPass.h deleted file mode 100644 index 446bfa1fb83..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/src/segment/GrPass.h +++ /dev/null @@ -1,747 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 1999, 2001 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: GrPass.h -Responsibility: Sharon Correll -Last reviewed: Not yet. - -Description: - The GrPass class and subclasses. -----------------------------------------------------------------------------------------------*/ -#ifdef _MSC_VER -#pragma once -#endif -#ifndef PASS_INCLUDED -#define PASS_INCLUDED - -//:End Ignore - -namespace gr -{ - -/*---------------------------------------------------------------------------------------------- - This class stores the state of processing in a single pass. - - Hungarian: zpst -----------------------------------------------------------------------------------------------*/ - -class PassState { - friend class GrPass; - friend class GrGlyphGenPass; - friend class GrLineBreakPass; - friend class GrSubPass; - friend class GrBidiPass; - friend class GrPosPass; - friend class FontMemoryUsage; - -public: - PassState() - { - } - - void InitForNewSegment(int ipass, int nMaxChunk); - void InitializeLogInfo(); - - int MaxChunk() - { - return m_nMaxChunk; - } - - void SetResyncSkip(int c) - { - m_cslotSkipToResync = c; - m_fDidResyncSkip = false; - } - int NeededToResync() - { - if (m_fDidResyncSkip) - return 0; - return m_cslotSkipToResync; - } - bool DidResyncSkip() - { - return m_fDidResyncSkip; - } - bool CanResyncSkip(GrSlotStream * psstrmOutput) - { - if (m_fDidResyncSkip) - return true; // already did it - // Are we in the position to do the resync-skip? - return m_cslotSkipToResync <= psstrmOutput->WritePos(); - } - int DoResyncSkip(GrSlotStream * psstrmOutput); - void UndoResyncSkip() - { - m_fDidResyncSkip = false; - } - - void UnwindLogInfo(int islotIn, int islotOut); - void RecordRule(int islot, int irul, bool fFired = false); - void RecordDeletionBefore(int islot); - void RecordInsertionAt(int islot); -#ifdef TRACING - void LogRulesFiredAndFailed(std::ostream & strmOut, GrSlotStream * psstrmIn); - void LogInsertionsAndDeletions(std::ostream & strmOut, GrSlotStream * psstrmOut); -#endif // TRACING - -protected: - int m_ipass; - - // Used to avoid infinite loops. If m_nRulesSinceAdvance > m_nMaxRuleLoop, - // and we have not passed the stream's ReadPosMax, forcibly advance. - int m_nRulesSinceAdvance; - - // Maximum length of chunk, used when unwinding the streams during backtracking. This - // must be initialized to m_nMaxRuleContext, but that is not always adequate, because - // when there is reprocessing going on the chunks may be longer. - int m_nMaxChunk; - - // Indicates how much of the pass's initial output should be automatically - // skipped over in order to resync with a chunk boundary. This handles the situation - // where we are reprocessing a little of the previous segment in order to handle - // cross-line-boundary contextuals. The goal is to skip over the output until we hit - // what we know (from processing the previous segment) is a chunk boundary. - // - // In most cases (and always when this is the first segment of the - // writing system) this number is 0. - int m_cslotSkipToResync; - bool m_fDidResyncSkip; - - enum { - kHitMaxBackup = -1, - kHitMaxRuleLoop = -2 - }; - - // For logging transduction process: record of one rule matched or fired - struct RuleRecord - { - int m_irul; // rule index, or kHitMaxBackup or kHitMaxRuleLoop - int m_islot; // slot index of input stream - bool m_fFired; - }; - RuleRecord m_rgrulrec[128]; - int m_crulrec; - - int m_rgcslotDeletions[128]; // number of deletions before slot i in output - bool m_rgfInsertion[128]; // true if slot i in output was inserted -}; - -/*---------------------------------------------------------------------------------------------- - This class handles finding and applying rules from the pass and storing - the results in the appropriate stream. - - Hungarian: pass -----------------------------------------------------------------------------------------------*/ -class GrPass { - friend class FontMemoryUsage; - -protected: - // Action command codes; these MUST match the corresponding definitions in the compiler: - enum ActionCommand { - kopNop = 0, - - kopPushByte, kopPushByteU, kopPushShort, kopPushShortU, kopPushLong, - - kopAdd, kopSub, kopMul, kopDiv, - kopMin, kopMax, - kopNeg, - kopTrunc8, kopTrunc16, - - kopCond, - - kopAnd, kopOr, kopNot, - kopEqual, kopNotEq, - kopLess, kopGtr, kopLessEq, kopGtrEq, - - kopNext, kopNextN, kopCopyNext, - kopPutGlyph8bitObs, kopPutSubs8bitObs, kopPutCopy, - kopInsert, kopDelete, - kopAssoc, - kopCntxtItem, - - kopAttrSet, kopAttrAdd, kopAttrSub, - kopAttrSetSlot, - kopIAttrSetSlot, - kopPushSlotAttr, kopPushGlyphAttrObs,kopPushGlyphMetric, kopPushFeat, - kopPushAttToGAttrObs, kopPushAttToGlyphMetric, - kopPushISlotAttr, - - kopPushIGlyphAttr, // not implemented - - kopPopRet, kopRetZero, kopRetTrue, - kopIAttrSet, kopIAttrAdd, kopIAttrSub, - kopPushProcState, kopPushVersion, - kopPutSubs, kopPutSubs2, kopPutSubs3, - kopPutGlyph, kopPushGlyphAttr, kopPushAttToGlyphAttr - - }; - - enum StackMachineFlag { - ksmfDone = 0, - ksmfContinue, - ksmfUnderflow, - ksmfStackNotEmptied - }; - -public: - // Constructor: - GrPass(int i); - // Destructor: - virtual ~GrPass(); - - int PassNumber() { return m_ipass; } - - bool ReadFromFont(GrIStream & grstrm, int fxdSilfVersion, int fxdRuleVersion, int nOffset); - void InitializeWithNoRules(); - - virtual void SetTopDirLevel(int n) - { // only GrBidiPass does anything interesting - } - - void SetPassState(PassState * pzpst) - { - m_pzpst = pzpst; - } - - virtual void ExtendOutput(GrTableManager *, - GrSlotStream * psstrmInput, GrSlotStream * psstrmOutput, int nslotToGet, - TrWsHandling twsh, - int * pnRet, int * pcslotGot, int * pislotFinalBreak); - - int ExtendGlyphIDOutput(GrTableManager *, GrCharStream *, - GrSlotStream *, int ichSegLim, int cchwPostXlbContext, - LineBrk lb, int cslotToGet, bool fNeedFinalBreak, - TrWsHandling twsh, int * pislotFinalBreak); - - int ExtendFinalOutput(GrTableManager *, GrSlotStream * psstrmInput, - GrSlotStream * psstrmOutput, - float xsSpaceAllotted, bool fWidthIsCharCount, bool fInfiniteWidth, - bool fHaveLineBreak, bool fMustBacktrack, - LineBrk lbMax, TrWsHandling twsh, - int * pislotLB, float * pxsWidth); - - int RemoveTrailingWhiteSpace(GrTableManager * ptman, GrSlotStream * psstrmOut, - TrWsHandling twsh, int * pislotFinalBreak); - - virtual int Unwind(GrTableManager * ptman, - int islotChanged, GrSlotStream *psstrmInput, GrSlotStream * psstrmOutput, - bool fFirst); - - int MaxBackup() - { - return m_nMaxBackup; - } - - bool DidResyncSkip() - { - return m_pzpst->DidResyncSkip(); - } - int DoResyncSkip(GrSlotStream * psstrmOutput) - { - return m_pzpst->DoResyncSkip(psstrmOutput); - } - - void UndoResyncSkip() - { - m_pzpst->UndoResyncSkip(); - } - void SetResyncSkip(int n) - { - m_pzpst->SetResyncSkip(n); - } - - virtual void DoCleanUpSegMin(GrTableManager * ptman, - GrSlotStream * psstrmIn, int islotInitReadPos, GrSlotStream * psstrmOut) - { - } - - virtual void DoCleanUpSegLim(GrTableManager * ptman, GrSlotStream * psstrmOut, - TrWsHandling twsh) - { - } - - virtual bool IsPosPass() - { - return false; - } - - virtual bool PreBidiPass() = 0; - - bool RunConstraint(GrTableManager *, int ruln, - GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, - int cslotPreModContext, int cslotMatched); - - int RunCommandCode(GrTableManager * ptman, - byte * pbStart, bool fConstraints, - GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, int islot); - -protected: - int RunOneCommand(GrTableManager * ptman, bool fConstraints, - ActionCommand op, byte ** ppbArg, bool * pfMustGet, bool * pfInserting, - GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, int islot, - std::vector & vnStack, StackMachineFlag * psmf); - void DoStackArithmetic2Args(ActionCommand op, std::vector & vnStack, - StackMachineFlag * psmf); - void DoStackArithmetic1Arg(ActionCommand op, std::vector & vnStack, - StackMachineFlag * psmf); - void DoConditional(std::vector & vnStack, StackMachineFlag * psmf); - StackMachineFlag CheckStack(std::vector & vnStack, int cn); - void DoNext(GrTableManager * ptman, - int cslot, GrSlotStream * psstrmIn, GrSlotStream * psstrmOut); - void DoPutGlyph(GrTableManager * ptman, bool fInserting, int nReplacementClass, - GrSlotStream * psstrmIn, GrSlotStream * psstrmOut); - void DoPutCopy(GrTableManager * ptman, bool fInserting, int cslotCopyFrom, - GrSlotStream * psstrmIn, GrSlotStream * psstrmOut); - void DoPutSubs(GrTableManager * ptman, bool fInserting, - int cslotSel, int nSelClass, int nReplacementClass, - GrSlotStream * psstrmIn, GrSlotStream * psstrmOut); - void DoPutSubs2(GrTableManager * ptman, bool fInserting, - int cslotSel1, int nSelClass1, int cslotSel2, int nSelClass2, int nReplacementClass, - GrSlotStream * psstrmIn, GrSlotStream * psstrmOut); - void DoPutSubs3(GrTableManager * ptman, bool fInserting, - int cslotSel1, int nSelClass1, int cslotSel2, int nSelClass2, int cslotSel3, int nSelClass3, - int nReplacementClass, GrSlotStream * psstrmIn, GrSlotStream * psstrmOut); - void DoPutSubsInit(GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, bool fInserting, - GrSlotState ** ppslotNextPut, bool * pfAtSegMin, bool * pfAtSegLim); - void DoPutSubsAux(GrTableManager * ptman, bool fInserting, gid16 nGlyphReplacement, - GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, GrSlotState * pslotNextInput, - bool fAtSegMin, bool fAtSegLim); - void SetNeutralAssocs(GrSlotState * pslotNew, GrSlotStream * psstrmIn); - void DoDelete(GrTableManager * ptman, - GrSlotStream * psstrmIn, GrSlotStream * psstrmOut); - void DoAssoc(int cnAssocs, std::vector & vnAssocs, bool fInserting, - GrSlotStream * psstrmIn, GrSlotStream * psstrmOut); - void DoSetAttr(GrTableManager * ptman, - ActionCommand op, bool fInserrting, - SlotAttrName slat, int slati, std::vector & vnStack, - GrSlotStream * psstrmIn, GrSlotStream * psstrmOut); - void DoPushSlotAttr(GrTableManager * ptman, - int nSlotRef, bool fInserting, - SlotAttrName slat, int slati, std::vector & vnStack, - GrSlotStream * psstrmIn, GrSlotStream * psstrmOut); - void DoPushGlyphAttr(GrTableManager * ptman, int nSlotRef, bool fInserting, - int nGlyphAttr, std::vector & vnStack, - GrSlotStream * psstrmIn, GrSlotStream * psstrmOut); - void DoPushAttToGlyphAttr(GrTableManager * ptman, int nSlotRef, bool fInserting, - int nGlyphAttr, std::vector & vnStack, - GrSlotStream * psstrmIn, GrSlotStream * psstrmOut); - void DoPushGlyphMetric(GrTableManager * ptman, int nSlotRef, bool fInserting, - int nGlyphAttr, int nAttLevel, std::vector & vnStack, - GrSlotStream * psstrmIn, GrSlotStream * psstrmOut); - void DoPushAttToGlyphMetric(GrTableManager * ptman, int nSlotRef, bool fInserting, - int nGlyphAttr, int nAttLevel, std::vector & vnStack, - GrSlotStream * psstrmIn, GrSlotStream * psstrmOut); - void DoPushFeatValue(GrTableManager * ptman, int islot, bool fInsering, - int nFeat, std::vector & vnStack, - GrSlotStream * psstrmIn, GrSlotStream * psstrmOut); - void DoPushProcState(GrTableManager * ptman, int nPState, std::vector & vnStack); -protected: - void DoPushGlyphMetricAux(GrTableManager * ptman, - GrSlotState * pslot, int nGlyphAttr, int nAttLevel, - std::vector & vnStack, GrSlotStream * psstrmIn); -public: - int SortKeyForRule(int ruln) - { - Assert(ruln < m_crul); - return m_prgchwRuleSortKeys[ruln]; - } - int PreModContextForRule(int ruln) - { - Assert(ruln < m_crul); - return m_prgcritRulePreModContext[ruln]; - } - - int MaxRulePreContext() - { - if (m_pfsm) - return m_pfsm->MaxRulePreContext(); - else - return 0; - } - - void RecordRuleFailed(int islot, int irul); - void RecordRuleFired(int islot, int irul); - void RecordHitMaxRuleLoop(int islot); - void RecordHitMaxBackup(int islot); -#ifdef TRACING - void LogRulesFiredAndFailed(std::ostream & strmOut, GrSlotStream * psstrmIn); - void LogInsertionsAndDeletions(std::ostream & strmOut, GrSlotStream * psstrmOut); -#endif // TRACING - -protected: - int CheckRuleValidity(int ruln); - - virtual void RunRule(GrTableManager *, int ruln, - GrSlotStream * psstrmInput, GrSlotStream * psstrmOutput) = 0; - - void CheckInputProgress(GrSlotStream* input, GrSlotStream* psstrmOutput, - int islotOrigInput); - - void MapChunks(GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, - int islotChunkI, int islotChunkO, int cslotReprocessed); - - virtual void Unattach(GrSlotStream * psstrmIn, int islotIn, // GrPosPass overrides - GrSlotStream * psstrmOut, int islotOut, int islotLB) - { - } - - friend class EngineState; // let it call the method below - virtual int MaxRuleContext() // GrBidiPass overrides - { - return m_nMaxRuleContext; - } - -protected: - // Instance variables: - - int m_ipass; // index of pass - - int m_fxdVersion; - - // number of items required from previous pass; don't access directly, use the getter - // method, because GrBidiPass overrides to always use 1. - int m_nMaxRuleContext; - - GrFSM * m_pfsm; // Finite State Machine to give next rule - - int m_nMaxRuleLoop; // maximum number of rules to process before forcibly - // advancing input position - - int m_nMaxBackup; - - int m_crul; // number of rules - - // rule sort keys, indicating precedence of rules; m_crul of these - data16 * m_prgchwRuleSortKeys; - - // for each rule, the number of items in the context before the first modified item - // that the constraints need to be tested on - byte * m_prgcritRulePreModContext; - - // offset for pass-level constraints; just 1 of these - data16 m_cbPassConstraint; - // offsets for constraint and action code; m_crul+1 of each of these (the last - // indicates the total byte count) - data16 * m_prgibConstraintStart; - data16 * m_prgibActionStart; - - // blocks of constraint and action code - byte * m_prgbPConstraintBlock; // pass-level constraints - byte * m_prgbConstraintBlock; // rule constraints - byte * m_prgbActionBlock; - - int m_cbConstraints; // needed for memory instrumentation only - int m_cbActions; // needed for memory instrumentation only - - bool m_fHasDebugStrings; - data16 * m_prgibConstraintDebug; // m_crul+1 of these - data16 * m_prgibRuleDebug; // m_crul+1 of these - - bool m_fCheckRules; - bool * m_prgfRuleOkay; - - std::vector m_vnStack; // for stack machine processing (more efficient than creating the - // vector each time) - - // state of process for this pass - PassState * m_pzpst; - -public: -#ifdef OLD_TEST_STUFF - // For test procedures: - StrAnsi m_staBehavior; - - virtual void SetUpTestData(); - - // overridden on appropriate subclasses: - virtual void SetUpReverseNumbersTest() { Assert(false); } - virtual void SetUpBidiNumbersTest() { Assert(false); } - - virtual void SetUpCrossLineContextTest() { Assert(false); } - virtual void SetUpReprocessTest() { Assert(false); } - virtual void SetUpLineEdgeContextTest(int ipass) { Assert(false); } - virtual void SetUpBidiAlgorithmTest() { Assert(false); } - virtual void SetUpPseudoGlyphsTest() { Assert(false); } - virtual void SetUpSimpleFSMTest() { Assert(false); } - virtual void SetUpRuleActionTest() { Assert(false); } - virtual void SetUpRuleAction2Test() { Assert(false); } - virtual void SetUpAssocTest() { Assert(false); } - virtual void SetUpAssoc2Test() { Assert(false); } - virtual void SetUpDefaultAssocTest() { Assert(false); } - virtual void SetUpFeatureTest() { Assert(false); } - virtual void SetUpLigatureTest() { Assert(false); } - virtual void SetUpLigature2Test() { Assert(false); } -#endif // OLD_TEST_STUFF - -}; // end of class GrPass - - -/*---------------------------------------------------------------------------------------------- - The initial pass that generates glyph IDs from Unicode input. - - Hungarian: pass -----------------------------------------------------------------------------------------------*/ -class GrGlyphGenPass : public GrPass -{ - friend class FontMemoryUsage; - -public: - GrGlyphGenPass(int ipass) : GrPass(ipass) - { - } - - virtual bool PreBidiPass() - { - return true; - } - -protected: - // Irrelevant when generating glyphs. - virtual void RunRule(GrTableManager *, int ruln, - GrSlotStream * psstrmInput, GrSlotStream * psstrmOutput) - { - Assert(false); - } - -}; // end of class GrGlyphGenPass - - -/*---------------------------------------------------------------------------------------------- - A pass containing rules that set the break weight values. - - Hungarian: pass -----------------------------------------------------------------------------------------------*/ -class GrLineBreakPass : public GrPass -{ - friend class FontMemoryUsage; - -public: - GrLineBreakPass(int ipass) : GrPass(ipass) - { - } - - virtual bool PreBidiPass() - { - return true; - } - -protected: - virtual void RunRule(GrTableManager *, int ruln, - GrSlotStream * psstrmInput, GrSlotStream * psstrmOutput); - -public: -#ifdef OLD_TEST_STUFF - // For test procedures: - bool RunTestRules(GrTableManager *, GrSlotStream * psstrmIn, GrSlotStream * psstrmOut); - bool RunTestRules(GrTableManager *, int ruln, GrSlotStream * psstrmIn, - GrSlotStream * psstrmOut); - - virtual void SetUpCrossLineContextTest(); - bool RunCrossLineContextTest(GrTableManager*, GrSlotStream* psstrmIn, - GrSlotStream* psstrmOut); - - virtual void SetUpReprocessTest(); - bool RunReprocessTest(GrTableManager *, GrSlotStream * psstrmIn, GrSlotStream * psstrmOut); - - virtual void SetUpAssocTest(); - virtual void SetUpLigatureTest(); -#endif // OLD_TEST_STUFF - -}; // end of class GrLineBreakPass - - -/*---------------------------------------------------------------------------------------------- - A pass containing substitution rules. - - Hungarian: pass -----------------------------------------------------------------------------------------------*/ -class GrSubPass : public GrPass -{ - friend class FontMemoryUsage; - -public: - GrSubPass(int ipass) : GrPass(ipass) - { - } - - virtual bool PreBidiPass() - { - return true; - } - -protected: - virtual void RunRule(GrTableManager *, int ruln, - GrSlotStream * psstrmInput, GrSlotStream * psstrmOutput); - - virtual void DoCleanUpSegMin(GrTableManager * ptman, - GrSlotStream * psstrmIn, int islotInitReadPos, GrSlotStream * psstrmOut); - virtual void DoCleanUpSegLim(GrTableManager * ptman, GrSlotStream * psstrmOut, - TrWsHandling twsh); - -public: -#ifdef OLD_TEST_STUFF - // For test procedures: - bool RunTestRules(GrTableManager *, GrSlotStream * psstrmIn, - GrSlotStream * psstrmOut); - bool RunTestRules(GrTableManager *, int ruln, GrSlotStream * psstrmIn, - GrSlotStream * psstrmOut); - - virtual void SetUpReverseNumbersTest(); - bool RunReverseNumbersTest(GrTableManager*, GrSlotStream* psstrmIn, - GrSlotStream* psstrmOut); - - virtual void SetUpBidiNumbersTest(); - bool RunBidiNumbersTest(GrTableManager*, GrSlotStream* psstrmIn, - GrSlotStream* psstrmOut); - - virtual void SetUpCrossLineContextTest(); - bool RunCrossLineContextTest(GrTableManager*, GrSlotStream* psstrmIn, - GrSlotStream* psstrmOut); - - virtual void SetUpReprocessTest(); - bool RunReprocessTest(GrTableManager *, GrSlotStream * psstrmIn, - GrSlotStream * psstrmOut); - - virtual void SetUpLineEdgeContextTest(int ipass); - bool RunLineEdgeContextTest(GrTableManager *, GrSlotStream * psstrmIn, - GrSlotStream * psstrmOut); - - virtual void SetUpBidiAlgorithmTest(); - bool RunBidiAlgorithmTest(GrTableManager *, GrSlotStream * psstrmIn, - GrSlotStream * psstrmOut); - - virtual void SetUpPseudoGlyphsTest(); - bool RunPseudoGlyphsTest(GrTableManager *, GrSlotStream * psstrmIn, - GrSlotStream * psstrmOut); - - virtual void SetUpSimpleFSMTest(); - bool RunSimpleFSMTest(GrTableManager *, int ruln, GrSlotStream * psstrmIn, - GrSlotStream * psstrmOut); - virtual void SetUpRuleActionTest(); - virtual void SetUpRuleAction2Test(); - virtual void SetUpAssocTest(); - virtual void SetUpAssoc2Test(); - virtual void SetUpDefaultAssocTest(); - virtual void SetUpFeatureTest(); - virtual void SetUpLigatureTest(); - virtual void SetUpLigature2Test(); -#endif // OLD_TEST_STUFF - -}; // end of class GrSubPass - - -/*---------------------------------------------------------------------------------------------- - This class is the one the knows how to handle bidi reordering, including backtracking. - - Hungarian: pass -----------------------------------------------------------------------------------------------*/ -class GrBidiPass : public GrSubPass -{ - friend class FontMemoryUsage; - -public: - // Constructor: - GrBidiPass(int ipass) - : GrSubPass(ipass), - m_nTopDirection(0) - { - } - - virtual void SetTopDirLevel(int n) - { - m_nTopDirection = n; - } - - virtual bool PreBidiPass() - { - return false; - } - - virtual void ExtendOutput(GrTableManager *, - GrSlotStream * psstrmI, GrSlotStream * psstrmO, int nslotToGet, - TrWsHandling twsh, - int * pnRet, int * pcslotGot, int * pislotFinalBreak); - - virtual int Unwind(GrTableManager * ptman, - int islotChanged, GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, - bool fFirst); -protected: - virtual int MaxRuleContext() - { - return 1; - } - -private: - //void OldReverse(int nCurrDirection, - // GrSlotStream * psstrmI, int islotI1, int islotI2, - // GrSlotStream * psstrmO, int islotO1, int islotO2); - - int Reverse(GrTableManager * ptman, - GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, - std::vector & vislotStarts, std::vector & vislotStops); - -protected: - // Instance variables: - int m_nTopDirection; // 0 for LTR, 1 for RTL -- CURRENTLY NOT USED; need to - // initialize it when we set the writing system direction - -#ifdef OLD_TEST_STUFF -public: - // For test procedures: - ////virtual void SetUpTestData(); - virtual void SetUpBidiNumbersTest(); - virtual void SetUpBidiAlgorithmTest(); -#endif // OLD_TEST_STUFF - -}; // end of class GrBidiPass - - -/*---------------------------------------------------------------------------------------------- - A pass containing positioning rules. - - Hungarian: pass -----------------------------------------------------------------------------------------------*/ -class GrPosPass : public GrPass -{ - friend class FontMemoryUsage; - -public: - GrPosPass(int ipass) : GrPass(ipass) - { - } - - virtual bool IsPosPass() - { - return true; - } - - virtual bool PreBidiPass() - { - return false; - } - -protected: - virtual void RunRule(GrTableManager *, int ruln, - GrSlotStream * psstrmInput, GrSlotStream * psstrmOutput); - - virtual void Unattach(GrSlotStream * psstrmIn, int islotIn, - GrSlotStream * psstrmOut, int islotOut, int islotLB); - -public: -#ifdef OLD_TEST_STUFF - // For test procedures: - bool RunTestRules(GrTableManager *, GrSlotStream * psstrmIn, - GrSlotStream * psstrmOut); - bool RunTestRules(GrTableManager *, int ruln, GrSlotStream * psstrmIn, - GrSlotStream * psstrmOut); -#endif // OLD_TEST_STUFF - -}; // end of class GrPosPass - -} // namespace gr - - -#endif // PASS_INCLUDED diff --git a/Build/source/libs/graphite/engine-2.3.1/src/segment/GrPassActionCode.cpp b/Build/source/libs/graphite/engine-2.3.1/src/segment/GrPassActionCode.cpp deleted file mode 100644 index 38868e52477..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/src/segment/GrPassActionCode.cpp +++ /dev/null @@ -1,1490 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 1999, 2001 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: GrPassActionCode.cpp -Responsibility: Sharon Correll -Last reviewed: Not yet. - -Description: - A continution of the GrPass file, including functions to run the action commands. -----------------------------------------------------------------------------------------------*/ - -//:>******************************************************************************************** -//:> Include files -//:>******************************************************************************************** -#include "Main.h" - -#ifdef _MSC_VER -#pragma hdrstop -#endif -#undef THIS_FILE -DEFINE_THIS_FILE - -//:End Ignore - -//:>******************************************************************************************** -//:> Forward declarations -//:>******************************************************************************************** - -//:>******************************************************************************************** -//:> Local type definitions -//:>******************************************************************************************** - -typedef signed char Int8; // signed value -typedef unsigned char Uint8; // unsigned value - - -namespace gr -{ - -//:>******************************************************************************************** -//:> Methods -//:>******************************************************************************************** - -/*---------------------------------------------------------------------------------------------- - The main function to run a block of action or constraint code and return a result. - - @param ptman - table manager, for generating new slots; NULL when - running constraints - @param pbStart - address of the first command - @param fConstraints - true if we are running constraint tests; - false if we are running rule actions - @param psstrmIn - input stream - @param psstrmOut - output stream; when running constraints, used to access items - in the precontext - @param islot - slot being processed relative to the start of the rule; - used only for constraints; must be 0 for rule actions -----------------------------------------------------------------------------------------------*/ -int GrPass::RunCommandCode(GrTableManager * ptman, - byte * pbStart, bool fConstraints, - GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, int islot) -{ - byte * pbNext = pbStart; - -// std::vector vnStack; -// vnStack.EnsureSpace(128); // make it nice and big - m_vnStack.clear(); - - gAssert(fConstraints || islot == 0); - - // There are two states: fMustGet = true means we need to get a slot to work on from - // the input; fMustGet = false means we have a slot and we need to do a Next before - // we can get the next one. - bool fMustGet = !fConstraints; - - bool fInserting = false; // set to true by an Insert command - - int nRet = 0; - - while (true) - { - ActionCommand op = ActionCommand(*pbNext++); - StackMachineFlag smf; - nRet = RunOneCommand(ptman, fConstraints, op, - &pbNext, &fMustGet, &fInserting, - psstrmIn, psstrmOut, islot, - m_vnStack, &smf); - - if (smf == ksmfDone) - return nRet; - - if (smf == ksmfUnderflow) - { - Warn("Underflow in Graphite stack machine"); - gAssert(false); - FontException fexptn; - fexptn.version = -1; - fexptn.subVersion = -1; - fexptn.errorCode = kferrUnknown; - throw fexptn; // disastrous error in rendering; fall back to dumb rendering - } - } - return nRet; // not needed, but to avoid compiler warning -} - -/*---------------------------------------------------------------------------------------------- - Perform a single command. Specifically, read the arguments from the byte buffer and the - run the appropriate functions. - - @param ptman - table manager, for generating new slots; or NULL - @param fConstraints - true if we are running constraints; false if we are running - rule actions - @param op - command operator - @param ppbArg - pointer to first argument - @param pfMustGet - state: getting input or processing it; when running constraints, - always false - @param pfInserting - true if current item is to be inserted, or was inserted - @param psstrmIn - input stream - @param psstrmOut - output stream - @param islot - the slot being processed relative to the beginning of the rule; - only relevant for constraint testing, must be 0 for rule actions - @param vnStack - the stack of values being manipulated - @param psmf - error code, done flag, or continue flag -----------------------------------------------------------------------------------------------*/ -int GrPass::RunOneCommand(GrTableManager * ptman, bool fConstraints, - ActionCommand op, byte ** ppbArg, bool * pfMustGet, bool * pfInserting, - GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, int islot, - std::vector & vnStack, StackMachineFlag * psmf) -{ - *psmf = ksmfContinue; - - // General purpose variables: - int arg1, arg2, arg3, arg4; - int nSlotRef; - int nInputClass; - int nOutputClass; - int c; - int islotArg; - int nIndex; - int nGlyphAttr; - int nAttLevel; - int nFeat; - int nPState; - SlotAttrName slat; - - int i; - std::vector vnTmp; - - byte * pbNext = *ppbArg; - - int nRet = 0; - - switch (op) - { - case kopNop: - break; - - case kopPushByte: - arg1 = Int8(*pbNext++); - vnStack.push_back(arg1); - break; - case kopPushByteU: - arg1 = Uint8(*pbNext++); - vnStack.push_back(arg1); - break; - case kopPushShort: - arg1 = Int8(*pbNext++); - arg2 = Uint8(*pbNext++); - vnStack.push_back((arg1 << 8) + arg2); - break; - case kopPushShortU: - arg1 = Uint8(*pbNext++); - arg2 = Uint8(*pbNext++); - vnStack.push_back((arg1 << 8) + arg2); - break; - case kopPushLong: - arg1 = Int8(*pbNext++); - arg2 = Uint8(*pbNext++); - arg3 = Uint8(*pbNext++); - arg4 = Uint8(*pbNext++); - vnStack.push_back((arg1 << 24) + (arg2 << 16) + (arg3 << 8) + arg4); - break; - - case kopNeg: - case kopTrunc8: case kopTrunc16: - case kopNot: - DoStackArithmetic1Arg(op, vnStack, psmf); - if (*psmf != ksmfContinue) - return 0; - break; - - case kopAdd: case kopSub: - case kopMul: case kopDiv: - case kopMin: case kopMax: - case kopAnd: case kopOr: - case kopEqual: case kopNotEq: - case kopLess: case kopGtr: - case kopLessEq: case kopGtrEq: - DoStackArithmetic2Args(op, vnStack, psmf); - if (*psmf != ksmfContinue) - return 0; - break; - - case kopCond: - DoConditional(vnStack, psmf); - if (*psmf != ksmfContinue) - return 0; - break; - - case kopNext: - if (fConstraints) - { - gAssert(false); - } - else - { - gAssert(!*pfMustGet); - DoNext(ptman, 1, psstrmIn, psstrmOut); - *pfMustGet = true; - *pfInserting = false; - } - break; - case kopNextN: - c = Int8(*pbNext++); - if (fConstraints) - { - gAssert(false); - } - else - { - gAssert(false); // for now we don't allow anything other than moving one slot - gAssert(!*pfMustGet); // forward at a time - DoNext(ptman, c, psstrmIn, psstrmOut); - *pfMustGet = true; - } - break; - case kopPutGlyph8bitObs: - case kopPutGlyph: - if (op == kopPutGlyph8bitObs) - nOutputClass = Uint8(*pbNext++); - else - { - nOutputClass = (Uint8(*pbNext++) << 8); - nOutputClass += Uint8(*pbNext++); - } - if (fConstraints) - { - gAssert(false); - } - else - { - gAssert(*pfMustGet); - DoPutGlyph(ptman, *pfInserting, nOutputClass, psstrmIn, psstrmOut); - *pfMustGet = false; - } - break; - case kopPutCopy: - nSlotRef = Int8(*pbNext++); - if (fConstraints) - { - gAssert(false); - } - else - { - gAssert(*pfMustGet); - DoPutCopy(ptman, *pfInserting, nSlotRef, psstrmIn, psstrmOut); - *pfMustGet = false; - } - break; - case kopPutSubs8bitObs: - case kopPutSubs: - nSlotRef = Int8(*pbNext++); - if (op == kopPutSubs8bitObs) - { - nInputClass = Uint8(*pbNext++); - nOutputClass = Uint8(*pbNext++); - } - else - { - nInputClass = (Uint8(*pbNext++) << 8); - nInputClass += Uint8(*pbNext++); - nOutputClass = (Uint8(*pbNext++) << 8); - nOutputClass += Uint8(*pbNext++); - } - if (fConstraints) - { - gAssert(false); - } - else - { - gAssert(*pfMustGet); - DoPutSubs(ptman, *pfInserting, nSlotRef, nInputClass, nOutputClass, - psstrmIn, psstrmOut); - *pfMustGet = false; - } - break; - case kopCopyNext: - if (fConstraints) - { - gAssert(false); - } - else - { - gAssert(*pfMustGet); - gAssert(!*pfInserting); // 0 means copy this slot - DoPutCopy(ptman, *pfInserting, 0, psstrmIn, psstrmOut); - DoNext(ptman, 1, psstrmIn, psstrmOut); - // *pfMustGet still = true - } - break; - case kopInsert: - if (fConstraints) - { - gAssert(false); - } - else - { - gAssert(*pfMustGet); - *pfInserting = true; - // *pfMustGet still = true - - if (ptman->LoggingTransduction()) - m_pzpst->RecordInsertionAt(psstrmOut->WritePos()); - } - break; - case kopDelete: - if (fConstraints) - { - gAssert(false); - } - else - { - gAssert(*pfMustGet); - DoDelete(ptman, psstrmIn, psstrmOut); - *pfMustGet = false; - } - break; - case kopAssoc: - c = Uint8(*pbNext++); - // std::vector vnTmp; - for (i = 0; i < c; i++) - vnTmp.push_back(Int8(*pbNext++)); - if (fConstraints) - { - gAssert(false); - } - else - { - gAssert(!*pfMustGet); - DoAssoc(c, vnTmp, *pfInserting, psstrmIn, psstrmOut); - } - break; - case kopCntxtItem: - islotArg = Int8(*pbNext++); - c = Uint8(*pbNext++); - if (fConstraints) - { - // Old approach: - // If this is NOT the relevant item, push TRUE, which causes the subsequent tests - // (which are eventually ORed with it) to become irrelevant. - //vnStack.Push((int)(islotArg != islot)); - - // If this is not the relevant item, skip the specified number of bytes. - if (islotArg != islot) - { - pbNext += c; - vnStack.push_back(1); - } - } - else - { - gAssert(false); - } - break; - - case kopAttrSet: - case kopAttrAdd: - case kopAttrSub: - case kopAttrSetSlot: - slat = SlotAttrName(Uint8(*pbNext++)); // slot attribute ID - if (fConstraints) - { - gAssert(false); - } - else - { - gAssert(!*pfMustGet); - DoSetAttr(ptman, op, *pfInserting, slat, -1, vnStack, psstrmIn, psstrmOut); - if (*psmf != ksmfContinue) - return 0; - } - break; - case kopIAttrSet: - case kopIAttrAdd: - case kopIAttrSub: - case kopIAttrSetSlot: - slat = SlotAttrName(Uint8(*pbNext++)); // slot attribute ID - nIndex = Uint8(*pbNext++); // index; eg, global ID for component - if (fConstraints) - { - gAssert(false); - } - else - { - gAssert(!*pfMustGet); - DoSetAttr(ptman, op, *pfInserting, slat, nIndex, vnStack, - psstrmIn, psstrmOut); - if (*psmf != ksmfContinue) - return 0; - } - break; - - case kopPushSlotAttr: - slat = SlotAttrName(Uint8(*pbNext++)); - nSlotRef = Int8(*pbNext++); - if (fConstraints) - nSlotRef += islot + 1; // +1 to peek ahead to a slot we haven't "got" yet - DoPushSlotAttr(ptman, nSlotRef, *pfInserting, slat, -1, vnStack, psstrmIn, psstrmOut); - if (*psmf != ksmfContinue) - return 0; - break; - case kopPushISlotAttr: - slat = SlotAttrName(Uint8(*pbNext++)); - nSlotRef = Int8(*pbNext++); - nIndex = Uint8(*pbNext++); - if (fConstraints) - nSlotRef += islot + 1; // +1 to peek ahead to a slot we haven't "got" yet - DoPushSlotAttr(ptman, nSlotRef, *pfInserting, slat, nIndex, vnStack, psstrmIn, psstrmOut); - if (*psmf != ksmfContinue) - return 0; - break; - - case kopPushGlyphAttrObs: - case kopPushAttToGAttrObs: - case kopPushGlyphAttr: - case kopPushAttToGlyphAttr: - if (op == kopPushGlyphAttrObs || op == kopPushAttToGAttrObs) - nGlyphAttr = Uint8(*pbNext++); - else { - nGlyphAttr = (Uint8(*pbNext++) << 8); - nGlyphAttr += Uint8(*pbNext++); - } - nSlotRef = Int8(*pbNext++); - if (fConstraints) - nSlotRef += islot + 1; // +1 to peek ahead to a slot we haven't "got" yet - if (op == kopPushAttToGlyphAttr || op == kopPushAttToGAttrObs) - DoPushAttToGlyphAttr(ptman, nSlotRef, *pfInserting, nGlyphAttr, - vnStack, psstrmIn, psstrmOut); - else - DoPushGlyphAttr(ptman, nSlotRef, *pfInserting, nGlyphAttr, vnStack, - psstrmIn, psstrmOut); - if (*psmf != ksmfContinue) - return 0; - break; - case kopPushGlyphMetric: - case kopPushAttToGlyphMetric: - nGlyphAttr = Uint8(*pbNext++); - nSlotRef = Int8(*pbNext++); - nAttLevel = Int8(*pbNext++); - if (fConstraints) - nSlotRef += islot + 1; // +1 to peek ahead to a slot we haven't "got" yet - if (op == kopPushAttToGlyphMetric) - DoPushAttToGlyphMetric(ptman, nSlotRef, *pfInserting, nGlyphAttr, nAttLevel, - vnStack, psstrmIn, psstrmOut); - else - DoPushGlyphMetric(ptman, nSlotRef, *pfInserting, nGlyphAttr, nAttLevel, - vnStack, psstrmIn, psstrmOut); - if (*psmf != ksmfContinue) - return 0; - break; - case kopPushFeat: - nFeat = Uint8(*pbNext++); - nSlotRef = Int8(*pbNext++); - if (fConstraints) - nSlotRef += islot + 1; // +1 to peek ahead to a slot we haven't "got" yet -// else -// nSlotRef = 0; - DoPushFeatValue(ptman, nSlotRef, *pfInserting, nFeat, vnStack, psstrmIn, psstrmOut); - if (*psmf != ksmfContinue) - return 0; - break; - case kopPushProcState: - nPState = Uint8(*pbNext++); - gAssert(fConstraints); - DoPushProcState(ptman, nPState, vnStack); - break; - case kopPushVersion: - vnStack.push_back(kRuleVersion); - break; - case kopPopRet: - if ((*psmf = CheckStack(vnStack, 1)) != ksmfContinue) - return 0; - nRet = vnStack.back(); - vnStack.pop_back(); - if (vnStack.size() != 0) - { - gAssert(false); - *psmf = ksmfStackNotEmptied; - } - else - *psmf = ksmfDone; - break; - case kopRetZero: - nRet = 0; - if (vnStack.size() != 0) - { - gAssert(false); - *psmf = ksmfStackNotEmptied; - } - else - *psmf = ksmfDone; - break; - case kopRetTrue: - nRet = 1; - if (vnStack.size() != 0) - { - gAssert(false); - *psmf = ksmfStackNotEmptied; - } - else - *psmf = ksmfDone; - break; - - default: - gAssert(false); - } - - *ppbArg = pbNext; - return nRet; -} - -/*---------------------------------------------------------------------------------------------- - Perform arithmetic functions that take two arguments. -----------------------------------------------------------------------------------------------*/ -void GrPass::DoStackArithmetic2Args(ActionCommand op, std::vector & vnStack, - StackMachineFlag * psmf) -{ - if ((*psmf = CheckStack(vnStack, 2)) != ksmfContinue) - return; - - int nArg2 = vnStack.back(); - vnStack.pop_back(); - int nArg1 = vnStack.back(); - vnStack.pop_back(); - - int nResult; - - switch (op) - { - case kopAdd: nResult = nArg1 + nArg2; break; - case kopSub: nResult = nArg1 - nArg2; break; - case kopMul: nResult = nArg1 * nArg2; break; - case kopDiv: nResult = nArg1 / nArg2; break; - case kopMin: nResult = min(nArg1, nArg2); break; - case kopMax: nResult = max(nArg1, nArg2); break; - case kopAnd: nResult = (nArg1 != 0 && nArg2 != 0)? 1: 0; break; - case kopOr: nResult = (nArg1 != 0 || nArg2 != 0)? 1: 0; break; - case kopEqual: nResult = (nArg1 == nArg2)? 1: 0; break; - case kopNotEq: nResult = (nArg1 != nArg2)? 1: 0; break; - case kopLess: nResult = (nArg1 < nArg2)? 1: 0; break; - case kopLessEq: nResult = (nArg1 <= nArg2)? 1: 0; break; - case kopGtr: nResult = (nArg1 > nArg2)? 1: 0; break; - case kopGtrEq: nResult = (nArg1 >= nArg2)? 1: 0; break; - default: - Assert(false); - } - - vnStack.push_back(nResult); -} - -/*---------------------------------------------------------------------------------------------- - Perform arithmetic functions that take one argument. -----------------------------------------------------------------------------------------------*/ -void GrPass::DoStackArithmetic1Arg(ActionCommand op, std::vector & vnStack, - StackMachineFlag * psmf) -{ - if ((*psmf = CheckStack(vnStack, 1)) != ksmfContinue) - return; - - int nArg = vnStack.back(); - vnStack.pop_back(); - int nResult; - - switch (op) - { - case kopNeg: nResult = nArg * -1; break; - case kopTrunc8: nResult = nArg & 0xFF; break; - case kopTrunc16: nResult = nArg & 0xFFFF; break; - case kopNot: nResult = (nArg == 0)? 1: 0; break; - default: - Assert(false); - } - - vnStack.push_back(nResult); -} - -/*---------------------------------------------------------------------------------------------- - Perform the conditional statement. -----------------------------------------------------------------------------------------------*/ -void GrPass::DoConditional(std::vector & vnStack, StackMachineFlag * psmf) -{ - if ((*psmf = CheckStack(vnStack, 3)) != ksmfContinue) - return; - - int nArg3 = vnStack.back(); - vnStack.pop_back(); - int nArg2 = vnStack.back(); - vnStack.pop_back(); - int nArg1 = vnStack.back(); - vnStack.pop_back(); - - if (nArg1 == 0) - vnStack.push_back(nArg3); - else - vnStack.push_back(nArg2); -} - -/*---------------------------------------------------------------------------------------------- - Check to make sure the stack has the appropriate number of items on it; if not, - return a stack error flag. -----------------------------------------------------------------------------------------------*/ -GrPass::StackMachineFlag GrPass::CheckStack(std::vector & vnStack, int cn) -{ - if (signed(vnStack.size()) < cn) - return ksmfUnderflow; - else - return ksmfContinue; -} - -/*---------------------------------------------------------------------------------------------- - We are finished processing a slot; go on to the next slot, or possibly go backwards. -----------------------------------------------------------------------------------------------*/ -void GrPass::DoNext(GrTableManager * ptman, - int cslot, GrSlotStream * psstrmIn, GrSlotStream * psstrmOut) -{ - gAssert(cslot == 1); // for now anyway -} - -/*---------------------------------------------------------------------------------------------- - Set the next glyph to be the given class. There should only be one member of the class, - but if there happens to be more than one, just use the first member. - All the slot attributes remain unchanged from the current input slot; associations are - neutralized. - - @param ptman - table manager, for generating new slots - @param fInserting - true if this slot is being inserted, not copied - @param nReplacementClass - class from which to take replacement glyph (corresponding to - selector slot's glyph's index in selector class) - @param psstrmIn / Out - input/output streams -----------------------------------------------------------------------------------------------*/ -void GrPass::DoPutGlyph(GrTableManager * ptman, bool fInserting, int nReplacementClass, - GrSlotStream * psstrmIn, GrSlotStream * psstrmOut) -{ - EngineState * pengst = ptman->State(); - - // If we are exactly at the segment boundary, pass the information on to the output stream. - // Note that inserted items always go outside the segment, if they are at the boundary - // (you DON'T want them between the segment boundary and the LB slot!). - bool fSetSegMin = psstrmIn->AtSegMin() && !fInserting; - bool fSetSegLim = psstrmIn->AtSegLim(); - - // Slot to copy features and text properties from: - GrSlotState * pslotNextInput; - if (psstrmIn->AtEndOfContext()) - { - gAssert(fInserting); - pslotNextInput = psstrmIn->RuleInputSlot(0, psstrmOut); - } - else - pslotNextInput = (fInserting)? psstrmIn->Peek(): psstrmIn->NextGet(); - - gid16 nGlyphReplacement = ptman->GetClassGlyphIDAt(nReplacementClass, 0); - - GrSlotState * pslotNew; - if (fInserting) - { - pengst->NewSlot(nGlyphReplacement, pslotNextInput, m_ipass, &pslotNew); - // leave associations empty; eventually they will be "neutralized" - } - else - { - pengst->NewSlotCopy(pslotNextInput, m_ipass, &pslotNew); - pslotNew->SetGlyphID(nGlyphReplacement); - ptman->SetSlotAttrsFromGlyphAttrs(pslotNew); - } - - if (fSetSegMin) - psstrmOut->SetSegMinToWritePos(false); - if (fSetSegLim) - psstrmOut->SetSegLimToWritePos(false); - psstrmOut->NextPut(pslotNew); -} - -/*---------------------------------------------------------------------------------------------- - Copy a glyph from the given slot in the input to the output. All the associations and slot - attributes are copied from the specified slot as well. Consume a slot from the input - (which may or may not be the slot we're copying). - - @param ptman - table manager, for generating new slots - @param fInserting - true if this slot is being inserted, not copied - @param cslotCopyFrom - slot to copy from - @param psstrmIn / Out - input/output streams -----------------------------------------------------------------------------------------------*/ -void GrPass::DoPutCopy(GrTableManager * ptman, bool fInserting, int cslotCopyFrom, - GrSlotStream * psstrmIn, GrSlotStream * psstrmOut) -{ - EngineState * pengst = ptman->State(); - - // If we are exactly at the segment boundary, pass the information on to the output stream. - // Note that inserted items always go outside the segment, if they are at the boundary. - bool fSetSegMin = psstrmIn->AtSegMin() && !fInserting; - bool fSetSegLim = psstrmIn->AtSegLim(); - - if (!fInserting) - { - gAssert(!psstrmIn->AtEndOfContext()); - // Absorb next slot - psstrmIn->NextGet(); - } - - GrSlotState * pslotCopyFrom = psstrmIn->RuleInputSlot(cslotCopyFrom, psstrmOut); - - GrSlotState * pslotNew; - pengst->NewSlotCopy(pslotCopyFrom, m_ipass, &pslotNew); - - if (fSetSegMin) - psstrmOut->SetSegMinToWritePos(false); - if (fSetSegLim) - psstrmOut->SetSegLimToWritePos(false); - psstrmOut->NextPut(pslotNew); -} - -/*---------------------------------------------------------------------------------------------- - Copy the current slot from the input to the output, substituting the corresponding glyph - in the output class. All the associations and slot attributes remain unchanged from the - current input slot. - - @param ptman - table manager, for generating new slots - @param fInserting - true if this slot is being inserted, not copied - @param cslotSel - selector slot, relative to current slot - @param nSelectorClass - class of selector slot - @param nReplacementClass - class from which to take replacement glyph (corresponding to - selector slot's glyph's index in selector class) - @param psstrmIn / Out - input/output streams -----------------------------------------------------------------------------------------------*/ -void GrPass::DoPutSubs(GrTableManager * ptman, bool fInserting, - int cslotSel, int nSelClass, int nReplacementClass, - GrSlotStream * psstrmIn, GrSlotStream * psstrmOut) -{ - bool fAtSegMin, fAtSegLim; - GrSlotState * pslotNextInput; - DoPutSubsInit(psstrmIn, psstrmOut, fInserting, &pslotNextInput, &fAtSegMin, &fAtSegLim); - - GrSlotState * pslotInSelector = psstrmIn->RuleInputSlot(cslotSel, psstrmOut); - - gid16 gidSelector = pslotInSelector->GlyphID(); - int nSelIndex = ptman->GetIndexInGlyphClass(nSelClass, gidSelector); - gAssert(nSelIndex != -1); - gid16 gidReplacement = (nSelIndex == -1)? - gidSelector: - ptman->GetClassGlyphIDAt(nReplacementClass, nSelIndex); - - DoPutSubsAux(ptman, fInserting, gidReplacement, psstrmIn, psstrmOut, pslotNextInput, - fAtSegMin, fAtSegLim); -} - -/*---------------------------------------------------------------------------------------------- - Copy the current slot from the input to the output, substituting the corresponding glyph - in the output class based on 2 input classes. All the associations and slot attributes - remain unchanged from the current input slot. - - @param ptman - table manager, for generating new slots - @param fInserting - true if this slot is being inserted, not copied - @param cslotSel - selector slot, relative to current slot - @param nSelectorClass - class of selector slot - @param nReplacementClass - class from which to take replacement glyph (corresponding to - selector slot's glyph's index in selector class) - @param psstrmIn / Out - input/output streams -----------------------------------------------------------------------------------------------*/ -void GrPass::DoPutSubs2(GrTableManager * ptman, bool fInserting, - int cslotSel1, int nSelClass1, int cslotSel2, int nSelClass2, int nReplacementClass, - GrSlotStream * psstrmIn, GrSlotStream * psstrmOut) -{ - bool fAtSegMin, fAtSegLim; - GrSlotState * pslotNextInput; - DoPutSubsInit(psstrmIn, psstrmOut, fInserting, &pslotNextInput, &fAtSegMin, &fAtSegLim); - - GrSlotState * pslotInSelector1 = psstrmIn->RuleInputSlot(cslotSel1, psstrmOut); - gid16 gidSelector1 = pslotInSelector1->GlyphID(); - int nSelIndex1 = ptman->GetIndexInGlyphClass(nSelClass1, gidSelector1); - gAssert(nSelIndex1 != -1); - //size_t cClassLen1 = ptman->NumberOfGlyphsInClass(nSelClass1); - - GrSlotState * pslotInSelector2 = psstrmIn->RuleInputSlot(cslotSel2, psstrmOut); - gid16 gidSelector2 = pslotInSelector2->GlyphID(); - int nSelIndex2 = ptman->GetIndexInGlyphClass(nSelClass2, gidSelector2); - gAssert(nSelIndex2 != -1); - size_t cClassLen2 = ptman->NumberOfGlyphsInClass(nSelClass2); - - int nSelIndex = (nSelIndex1 == -1 || nSelIndex2 == -1) ? - -1 : - (nSelIndex1 * static_cast(cClassLen2)) + nSelIndex2; - - gid16 gidReplacement = (nSelIndex == -1)? - gidSelector1: - ptman->GetClassGlyphIDAt(nReplacementClass, nSelIndex); - - DoPutSubsAux(ptman, fInserting, gidReplacement, psstrmIn, psstrmOut, pslotNextInput, - fAtSegMin, fAtSegLim); -} - -/*---------------------------------------------------------------------------------------------- - Copy the current slot from the input to the output, substituting the corresponding glyph - in the output class based on 2 input classes. All the associations and slot attributes - remain unchanged from the current input slot. - - @param ptman - table manager, for generating new slots - @param fInserting - true if this slot is being inserted, not copied - @param cslotSel - selector slot, relative to current slot - @param nSelectorClass - class of selector slot - @param nReplacementClass - class from which to take replacement glyph (corresponding to - selector slot's glyph's index in selector class) - @param psstrmIn / Out - input/output streams -----------------------------------------------------------------------------------------------*/ -void GrPass::DoPutSubs3(GrTableManager * ptman, bool fInserting, - int cslotSel1, int nSelClass1, int cslotSel2, int nSelClass2, int cslotSel3, int nSelClass3, - int nReplacementClass, - GrSlotStream * psstrmIn, GrSlotStream * psstrmOut) -{ - bool fAtSegMin, fAtSegLim; - GrSlotState * pslotNextInput; - DoPutSubsInit(psstrmIn, psstrmOut, fInserting, &pslotNextInput, &fAtSegMin, &fAtSegLim); - - GrSlotState * pslotInSelector1 = psstrmIn->RuleInputSlot(cslotSel1, psstrmOut); - gid16 gidSelector1 = pslotInSelector1->GlyphID(); - int nSelIndex1 = ptman->GetIndexInGlyphClass(nSelClass1, gidSelector1); - gAssert(nSelIndex1 != -1); - //size_t cClassLen1 = ptman->NumberOfGlyphsInClass(nSelClass1); - - GrSlotState * pslotInSelector2 = psstrmIn->RuleInputSlot(cslotSel2, psstrmOut); - gid16 gidSelector2 = pslotInSelector2->GlyphID(); - int nSelIndex2 = ptman->GetIndexInGlyphClass(nSelClass2, gidSelector2); - gAssert(nSelIndex2 != -1); - size_t cClassLen2 = ptman->NumberOfGlyphsInClass(nSelClass2); - -// GrSlotState * pslotInSelector3 = psstrmIn->RuleInputSlot(cslotSel3, psstrmOut); -// gid16 gidSelector3 = pslotInSelector3->GlyphID(); - int nSelIndex3 = ptman->GetIndexInGlyphClass(nSelClass3, gidSelector2); - gAssert(nSelIndex3 != -1); - size_t cClassLen3 = ptman->NumberOfGlyphsInClass(nSelClass3); - - int nSelIndex = (nSelIndex1 == -1 || nSelIndex2 == -1 || nSelIndex3 == -1) ? - -1 : - (((nSelIndex1 * static_cast(cClassLen2)) + nSelIndex2) * static_cast(cClassLen3)) + nSelIndex3; - - gid16 gidReplacement = (nSelIndex == -1)? - gidSelector1: - ptman->GetClassGlyphIDAt(nReplacementClass, nSelIndex); - - DoPutSubsAux(ptman, fInserting, gidReplacement, psstrmIn, psstrmOut, pslotNextInput, - fAtSegMin, fAtSegLim); -} - - -/*---------------------------------------------------------------------------------------------- - Initial common part of all the DoPutSubs... methods. -----------------------------------------------------------------------------------------------*/ -void GrPass::DoPutSubsInit(GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, bool fInserting, - GrSlotState ** ppslotNextInput, bool * pfAtSegMin, bool * pfAtSegLim) -{ - // Do this before reading from stream. - *pfAtSegMin = psstrmIn->AtSegMin(); - *pfAtSegLim = psstrmIn->AtSegLim(); - - // Slot to copy features and text properties from: - if (psstrmIn->AtEndOfContext()) - { - gAssert(fInserting); - *ppslotNextInput = psstrmIn->RuleInputSlot(0, psstrmOut); - } - else - *ppslotNextInput = (fInserting)? psstrmIn->Peek(): psstrmIn->NextGet(); -} - -/*---------------------------------------------------------------------------------------------- - Common part of all the DoPutSubs... methods. -----------------------------------------------------------------------------------------------*/ -void GrPass::DoPutSubsAux(GrTableManager * ptman, bool fInserting, gid16 nGlyphReplacement, - GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, GrSlotState * pslotNextInput, - bool fAtSegMin, bool fAtSegLim) -{ - EngineState * pengst = ptman->State(); - - // If we are exactly at the segment boundary, pass the information on to the output stream. - // Note that inserted items always go outside the segment, if they are at the boundary. - bool fSetSegMin = fAtSegMin && !fInserting; - bool fSetSegLim = fAtSegLim; - - GrSlotState * pslotNew; - if (fInserting) - { - pengst->NewSlot(nGlyphReplacement, pslotNextInput, m_ipass, &pslotNew); - // leave associations empty; eventually they will be "neutralized" - } - else - { - pengst->NewSlotCopy(pslotNextInput, m_ipass, &pslotNew); - pslotNew->SetGlyphID(nGlyphReplacement); - ptman->SetSlotAttrsFromGlyphAttrs(pslotNew); - } - - if (fSetSegMin) - psstrmOut->SetSegMinToWritePos(false); - if (fSetSegLim) - psstrmOut->SetSegLimToWritePos(false); - psstrmOut->NextPut(pslotNew); -} - -/*---------------------------------------------------------------------------------------------- - A slot has just been inserted. Clear all the associations; eventually (unless we go on - to set the associations explicitly) we will set its before-assoc to the slot after it - and its after-assoc to the slot before it. This makes it basically unselectable. - OBSOLETE - handled by slot initialization code -----------------------------------------------------------------------------------------------*/ -void GrPass::SetNeutralAssocs(GrSlotState * pslotNew, GrSlotStream * psstrmIn) -{ - pslotNew->ClearAssocs(); -} - -/*---------------------------------------------------------------------------------------------- - Delete the next slot in the input. - - @param psstrmIn - input stream - @param psstrmOut - output stream -----------------------------------------------------------------------------------------------*/ -void GrPass::DoDelete(GrTableManager * ptman, GrSlotStream * psstrmIn, GrSlotStream * psstrmOut) -{ - if (psstrmIn->AtSegMin()) - psstrmOut->SetSegMinToWritePos(); - if (psstrmIn->AtSegLim()) - psstrmOut->SetSegLimToWritePos(); - - GrSlotState * pslot = psstrmIn->NextGet(); - pslot->MarkDeleted(); - - if (ptman->LoggingTransduction()) - m_pzpst->RecordDeletionBefore(psstrmOut->WritePos()); -} - -/*---------------------------------------------------------------------------------------------- - Set the associations for the current slot. Any previous associations will be overwritten. - - @param cn - number of associations - @param vnAssoc - list of associations - @param fInserting - whether current slot was inserted - @param psstrmIn / Out - input/output streams -----------------------------------------------------------------------------------------------*/ -void GrPass::DoAssoc(int cnAssocs, std::vector & vnAssocs, bool fInserting, - GrSlotStream * psstrmIn, GrSlotStream * psstrmOut) -{ - gAssert((unsigned)cnAssocs == vnAssocs.size()); - - // Sort the list of associations. It's okay to use a simple bubble sort - // since we expect the list to be very short. Ideally we should remove duplicates - // too but I don't think duplicates actually hurt anything. - for (int i1 = 0; i1 < cnAssocs - 1; i1++) - { - for (int i2 = i1 + 1; i2 < cnAssocs; i2++) - { - if (vnAssocs[i2] < vnAssocs[i1]) - { - int nTmp = vnAssocs[i2]; - vnAssocs[i2] = vnAssocs[i1]; - vnAssocs[i1] = nTmp; - } - } - } - - std::vector vpslotAssocs; - vpslotAssocs.resize(cnAssocs); - for (int i = 0; i < cnAssocs; i++) - vpslotAssocs[i] = psstrmIn->RuleInputSlot(vnAssocs[i], psstrmOut); - - GrSlotState * pslot = psstrmOut->RuleOutputSlot(); - pslot->Associate(vpslotAssocs); -} - -/*---------------------------------------------------------------------------------------------- - Set a slot attribute for the current slot; the value is on the stack. - - @param op - command - @param fInserting - whether current slot was inserted - @param slat - slot attribute to set - @param slati - slot attribute index, or -1 for non-indexed attribute - @param vnStack - stack to read value from - @param psstrmIn / Out - input/output streams -----------------------------------------------------------------------------------------------*/ -void GrPass::DoSetAttr(GrTableManager * ptman, ActionCommand op, bool fInserting, - SlotAttrName slat, int slati, std::vector & vnStack, - GrSlotStream * psstrmIn, GrSlotStream * psstrmOut) -{ - int nVal = vnStack.back(); - vnStack.pop_back(); - - if (slat == kslatUserDefnV1) - slat = kslatUserDefn; - - if (slati != -1 && slat != kslatCompRef && slat != kslatUserDefn) - { - // Invalid slot attribute index. - gAssert(false); - slati = -1; - } - - if (slati == -1 && (slat == kslatCompRef || slat == kslatUserDefn)) - { - // Missing slot attribute index. - gAssert(false); - slati = 0; - } - - if (slat == kslatPosX || slat == kslatPosY) - { - // Doesn't make sense to set the pos attribute. - gAssert(false); - return; - } - - GrSlotState * pslotIn = psstrmIn->RuleInputSlot(0, psstrmOut); - - GrSlotState * pslotComp; - - int nOldVal; - - if (op == kopAttrAdd || op == kopAttrSub || op == kopIAttrAdd || op == kopIAttrSub) - { - // Incrementing or decrementing. - - gAssert(!fInserting); - - switch (slat) - { - case kslatAdvX: nOldVal = pslotIn->AdvanceX(ptman); break; - case kslatAdvY: nOldVal = pslotIn->AdvanceY(ptman); break; - case kslatShiftX: nOldVal = pslotIn->ShiftX(); break; - case kslatShiftY: nOldVal = pslotIn->ShiftY(); break; - - case kslatAttAtX: nOldVal = pslotIn->AttachAtX(ptman, psstrmIn); break; - case kslatAttAtY: nOldVal = pslotIn->AttachAtY(); break; - case kslatAttAtXoff: nOldVal = pslotIn->AttachAtXOffset(); break; - case kslatAttAtYoff: nOldVal = pslotIn->AttachAtYOffset(); break; - - case kslatAttWithX: nOldVal = pslotIn->AttachWithX(ptman, psstrmIn); break; - case kslatAttWithY: nOldVal = pslotIn->AttachWithY(); break; - case kslatAttWithXoff: nOldVal = pslotIn->AttachWithXOffset(); break; - case kslatAttWithYoff: nOldVal = pslotIn->AttachWithYOffset(); break; - - case kslatUserDefn: nOldVal = pslotIn->UserDefn(slati); break; - - case kslatMeasureSol: nOldVal = pslotIn->MeasureSol(); break; - case kslatMeasureEol: nOldVal = pslotIn->MeasureEol(); break; - - case kslatJStretch: nOldVal = pslotIn->JStretch(); break; - case kslatJShrink: nOldVal = pslotIn->JShrink(); break; - case kslatJStep: nOldVal = pslotIn->JStep(); break; - case kslatJWeight: nOldVal = pslotIn->JWeight(); break; - case kslatJWidth: nOldVal = pslotIn->JWidth(); break; - - // These are kind of odd, but maybe. - case kslatAttLevel: nOldVal = pslotIn->AttachLevel(); break; - case kslatBreak: nOldVal = pslotIn->BreakWeight(); break; - case kslatDir: nOldVal = pslotIn->Directionality(); break; - - default: - // Kind of attribute that it makes no sense to increment. - gAssert(false); - return; - } - - if (op == kopAttrAdd || op == kopIAttrAdd) - nVal = nOldVal + nVal; - else - { - gAssert(op == kopAttrSub || op == kopIAttrSub); - nVal = nOldVal - nVal; - } - } - - GrSlotState * pslotOut = psstrmOut->RuleOutputSlot(); - - if (pslotOut->IsLineBreak(ptman->LBGlyphID())) - { - switch (slat) - { - case kslatAdvX: - case kslatAdvY: - case kslatShiftX: - case kslatShiftY: - - case kslatAttTo: - case kslatAttLevel: - case kslatAttAtX: - case kslatAttAtY: - case kslatAttAtGpt: - case kslatAttAtXoff: - case kslatAttAtYoff: - case kslatAttWithX: - case kslatAttWithY: - case kslatAttWithGpt: - case kslatAttWithXoff: - case kslatAttWithYoff: - - case kslatMeasureSol: - case kslatMeasureEol: - - case kslatJStretch: - case kslatJShrink: - case kslatJStep: - case kslatJWeight: - case kslatJWidth: - slat = kslatNoEffect; - break; - default: - ; // okay, do nothing - } - } - - nVal = GrGlyphSubTable::ConvertValueForVersion(nVal, slat, -1, m_fxdVersion); - - switch (slat) - { - case kslatAdvX: pslotOut->SetAdvanceX(nVal); break; - case kslatAdvY: pslotOut->SetAdvanceY(nVal); break; - case kslatShiftX: pslotOut->SetShiftX(nVal); break; - case kslatShiftY: pslotOut->SetShiftY(nVal); break; - - case kslatAttTo: pslotOut->SetAttachTo(nVal); break; - case kslatAttLevel: pslotOut->SetAttachLevel(nVal); break; - case kslatAttAtX: pslotOut->SetAttachAtX(nVal); break; - case kslatAttAtY: pslotOut->SetAttachAtY(nVal); break; - case kslatAttAtGpt: pslotOut->SetAttachAtGpoint(nVal); break; - case kslatAttAtXoff: pslotOut->SetAttachAtXOffset(nVal); break; - case kslatAttAtYoff: pslotOut->SetAttachAtYOffset(nVal); break; - case kslatAttWithX: pslotOut->SetAttachWithX(nVal); break; - case kslatAttWithY: pslotOut->SetAttachWithY(nVal); break; - case kslatAttWithGpt: pslotOut->SetAttachWithGpoint(nVal); break; - case kslatAttWithXoff: pslotOut->SetAttachWithXOffset(nVal); break; - case kslatAttWithYoff: pslotOut->SetAttachWithYOffset(nVal); break; - - case kslatUserDefn: pslotOut->SetUserDefn(slati, nVal); break; - - case kslatCompRef: - gAssert(nVal - 1 >= psstrmIn->RuleStartReadPos() - psstrmIn->ReadPosForNextGet()); - pslotComp = psstrmIn->RuleInputSlot(nVal, psstrmOut); - pslotOut->SetCompRefSlot(ptman, slati, pslotComp); - break; - - case kslatMeasureSol: pslotOut->SetMeasureSol(nVal); break; - case kslatMeasureEol: pslotOut->SetMeasureEol(nVal); break; - - case kslatJStretch: pslotOut->SetJStretch(nVal); break; - case kslatJShrink: pslotOut->SetJShrink(nVal); break; - case kslatJStep: pslotOut->SetJStep(nVal); break; - case kslatJWeight: pslotOut->SetJWeight(nVal); break; - case kslatJWidth: pslotOut->SetJWidth(nVal); break; - - case kslatBreak: pslotOut->SetBreakWeight(nVal); break; - case kslatDir: pslotOut->SetDirectionality(DirCode(nVal)); break; - case kslatInsert: pslotOut->SetInsertBefore(bool(nVal)); break; - - case kslatNoEffect: - // Do nothing. - break; - - default: - // Kind of attribute that it makes no sense to set. - gAssert(false); - return; - } -} - -/*---------------------------------------------------------------------------------------------- - Push value of a slot attribute onto the stack. - - @param nSlotRef - slot whose attribute we are interested in - @param fInserting - whether current slot was inserted - @param slat - slot attribute to get - @param slati - slot attribute index, or -1 for non-indexed attribute - @param vnStack - stack to push onto - @param psstrmIn - input stream -----------------------------------------------------------------------------------------------*/ -void GrPass::DoPushSlotAttr(GrTableManager * ptman, - int nSlotRef, bool fInserting, - SlotAttrName slat, int slati, std::vector & vnStack, - GrSlotStream * psstrmIn, GrSlotStream * psstrmOut) -{ - GrSlotState * pslot = psstrmIn->RuleInputSlot(nSlotRef, psstrmOut, true); - if (pslot == NULL) - { - // Non-existent pre-context item. - vnStack.push_back(0); - return; - } - - int nVal; - int xyBogus; - - if (slat == kslatUserDefnV1) - slat = kslatUserDefn; - - if (slati != -1 && slat != kslatCompRef && slat != kslatUserDefn) - { - // Invalid slot attribute index. - gAssert(false); - slati = -1; - } - - if (slati == -1 && (slat == kslatCompRef || slat == kslatUserDefn)) - { - // Missing slot attribute index. - gAssert(false); - slati = 0; - } - - switch (slat) - { - case kslatAdvX: nVal = pslot->AdvanceX(ptman); break; - case kslatAdvY: nVal = pslot->AdvanceY(ptman); break; - case kslatShiftX: nVal = pslot->ShiftX(); break; - case kslatShiftY: nVal = pslot->ShiftY(); break; - - case kslatPosX: pslot->Position(ptman, psstrmIn, &nVal, &xyBogus); break; - case kslatPosY: pslot->Position(ptman, psstrmIn, &xyBogus, &nVal); break; - - case kslatAttTo: nVal = pslot->AttachTo(); break; - case kslatAttLevel: nVal = pslot->AttachLevel(); break; - case kslatAttAtX: nVal = pslot->AttachAtX(ptman, psstrmIn); break; - case kslatAttAtY: nVal = pslot->AttachAtY(); break; - case kslatAttAtGpt: nVal = pslot->AttachAtGpoint(); break; - case kslatAttAtXoff: nVal = pslot->AttachAtXOffset(); break; - case kslatAttAtYoff: nVal = pslot->AttachAtYOffset(); break; - case kslatAttWithX: nVal = pslot->AttachWithX(ptman, psstrmIn); break; - case kslatAttWithY: nVal = pslot->AttachWithY(); break; - case kslatAttWithGpt: nVal = pslot->AttachWithGpoint(); break; - case kslatAttWithXoff: nVal = pslot->AttachWithXOffset(); break; - case kslatAttWithYoff: nVal = pslot->AttachWithYOffset(); break; - - case kslatMeasureSol: nVal = pslot->MeasureSol(); break; - case kslatMeasureEol: nVal = pslot->MeasureEol(); break; - - case kslatJStretch: nVal = pslot->JStretch(); break; - case kslatJShrink: nVal = pslot->JShrink(); break; - case kslatJStep: nVal = pslot->JStep(); break; - case kslatJWeight: nVal = pslot->JWeight(); break; - case kslatJWidth: nVal = pslot->JWidth(); break; - - case kslatBreak: nVal = pslot->BreakWeight(); break; - case kslatDir: nVal = pslot->Directionality(); break; - case kslatInsert: nVal = pslot->InsertBefore(); break; - - case kslatUserDefn: nVal = pslot->UserDefn(slati); break; - - // Currently no way to look up component.X.ref. - - default: - // Invalid attribute. - gAssert(false); - nVal = 0; - } - - vnStack.push_back(nVal); -} - -/*---------------------------------------------------------------------------------------------- - Push value of a glyph attribute onto the stack. - - @param nSlotRef - slot whose attribute we are interested in - @param fInserting - whether current slot was inserted - @param nGlyphAttr - glyph attribute to get - @param vnStack - stack to push onto - @param psstrmIn - input stream -----------------------------------------------------------------------------------------------*/ -void GrPass::DoPushGlyphAttr(GrTableManager * ptman, int nSlotRef, bool fInserting, - int nGlyphAttr, - std::vector & vnStack, GrSlotStream * psstrmIn, GrSlotStream * psstrmOut) -{ - GrSlotState * pslot = psstrmIn->RuleInputSlot(nSlotRef, psstrmOut, true); - if (pslot == NULL) - { - // Non-existent pre-context item. - vnStack.push_back(0); - return; - } - int nVal = pslot->GlyphAttrValueEmUnits(ptman, nGlyphAttr); - vnStack.push_back(nVal); -} - -/*---------------------------------------------------------------------------------------------- - Push value of a glyph attribute onto the stack. The slot of interest is the slot to - which the current slot is attached. - - @param nSlotRef - leaf slot - @param fInserting - whether current slot was inserted - @param nGlyphAttr - glyph attribute to get - @param vnStack - stack to push onto - @param psstrmIn - input stream -----------------------------------------------------------------------------------------------*/ -void GrPass::DoPushAttToGlyphAttr(GrTableManager * ptman, int nSlotRef, bool fInserting, - int nGlyphAttr, std::vector & vnStack, - GrSlotStream * psstrmIn, GrSlotStream * psstrmOut) -{ - // Note that it is the slot in the output stream that has - // the relevant attach.to attribute set. - GrSlotState * pslotLeaf = psstrmOut->RuleOutputSlot(0); - int srAttTo = pslotLeaf->AttachTo(); - if (srAttTo == 0) - { - gAssert(false); - vnStack.push_back(0); - return; - } - - GrSlotState * pslotRoot = psstrmIn->RuleInputSlot(nSlotRef + srAttTo, psstrmOut); - int nVal = pslotRoot->GlyphAttrValueEmUnits(ptman, nGlyphAttr); - vnStack.push_back(nVal); -} - -/*---------------------------------------------------------------------------------------------- - Push value of a glyph metric onto the stack. - - @param nSlotRef - slot whose attribute we are interested in - @param fInserting - whether current slot was inserted - @param nGlyphAttr - glyph attribute to get - @param nAttLevel - for accessing composite metrics - @param vnStack - stack to push onto - @param psstrmIn - input stream -----------------------------------------------------------------------------------------------*/ -void GrPass::DoPushGlyphMetric(GrTableManager * ptman, int nSlotRef, bool fInserting, - int nGlyphAttr, int nAttLevel, - std::vector & vnStack, GrSlotStream * psstrmIn, GrSlotStream * psstrmOut) -{ - GrSlotState * pslot = psstrmIn->RuleInputSlot(nSlotRef, psstrmOut, true); - if (pslot == NULL) - { - // Non-existent pre-context item. - vnStack.push_back(0); - return; - } - - DoPushGlyphMetricAux(ptman, pslot, nGlyphAttr, nAttLevel, vnStack, psstrmIn); -} - -/*---------------------------------------------------------------------------------------------- - Push value of a glyph metric onto the stack. The slot of interest is the slot to - which the current slot is attached. - - @param nSlotRef - slot whose attribute we are interested in - @param fInserting - whether current slot was inserted - @param nGlyphAttr - glyph attribute to get - @param nAttLevel - for accessing composite metrics - @param vnStack - stack to push onto - @param psstrmIn - input stream - @param psstrmOut - output stream -----------------------------------------------------------------------------------------------*/ -void GrPass::DoPushAttToGlyphMetric(GrTableManager * ptman, int nSlotRef, bool fInserting, - int nGlyphAttr, int nAttLevel, - std::vector & vnStack, - GrSlotStream * psstrmIn, GrSlotStream * psstrmOut) -{ - // Note that it is the slot in the output stream that has - // the relevant attach.to attribute set. - GrSlotState * pslotLeaf = psstrmOut->RuleOutputSlot(0); - int srAttTo = pslotLeaf->AttachTo(); - if (srAttTo == 0) - { - gAssert(false); - vnStack.push_back(0); - return; - } - - GrSlotState * pslot = psstrmIn->RuleInputSlot(nSlotRef + srAttTo, psstrmOut); - - DoPushGlyphMetricAux(ptman, pslot, nGlyphAttr, nAttLevel, vnStack, psstrmIn); -} - -/*--------------------------------------------------------------------------------------------*/ - -void GrPass::DoPushGlyphMetricAux(GrTableManager * ptman, - GrSlotState * pslot, int nGlyphAttr, int nAttLevel, - std::vector & vnStack, GrSlotStream * psstrmIn) -{ - int mVal; - GlyphMetric gmet = GlyphMetric(nGlyphAttr); - if (nAttLevel == 0 || gmet == kgmetAscent || gmet == kgmetDescent) - { - mVal = pslot->GlyphMetricEmUnits(ptman, nGlyphAttr); - } - else - { - pslot->CalcCompositeMetrics(ptman, psstrmIn, nAttLevel, true); - - float xy; - switch (gmet) - { - case kgmetLsb: xy = pslot->ClusterLsb(psstrmIn); break; - case kgmetRsb: xy = pslot->ClusterRsb(psstrmIn); break; - case kgmetBbTop: xy = pslot->ClusterBbTop(psstrmIn); break; - case kgmetBbBottom: xy = pslot->ClusterBbBottom(psstrmIn); break; - case kgmetBbLeft: xy = pslot->ClusterBbLeft(psstrmIn); break; - case kgmetBbRight: xy = pslot->ClusterBbRight(psstrmIn); break; - case kgmetBbHeight: xy = pslot->ClusterBbHeight(psstrmIn); break; - case kgmetBbWidth: xy = pslot->ClusterBbWidth(psstrmIn); break; -// case kgmetAdvHeight: xy = pslot->ClusterAdvHeight(psstrmIn); break; - case kgmetAdvWidth: xy = pslot->ClusterAdvWidth(psstrmIn); break; - default: - gAssert(false); - xy = 0; - } - mVal = ptman->LogToEmUnits(xy); - } - - vnStack.push_back(mVal); -} - -/*---------------------------------------------------------------------------------------------- - Push a feature value onto the stack. For rule actions, the slot of interest is the - current slot. - - @param nSlotRef - slot being examined - @param fInserting - whether current slot was inserted - @param nFeat - feature of interest - @param vnStack - stack to push onto - @param psstrmIn - input stream - @param psstrmOut - output stream -----------------------------------------------------------------------------------------------*/ -void GrPass::DoPushFeatValue(GrTableManager * ptman, int nSlotRef, bool fInserting, - int nFeat, std::vector & vnStack, GrSlotStream * psstrmIn, GrSlotStream * psstrmOut) -{ - gAssert(!fInserting); - - GrSlotState * pslot = psstrmIn->RuleInputSlot(nSlotRef, psstrmOut, true); - if (pslot == NULL) - { - // Non-existent pre-context item. - vnStack.push_back(0); - return; - } - - int nVal = pslot->FeatureValue(nFeat); - vnStack.push_back(nVal); -} - -/*---------------------------------------------------------------------------------------------- - Push a processing-state value onto the stack. - - @param nFeat - feature of interest - @param vnStack - stack to push onto -----------------------------------------------------------------------------------------------*/ -void GrPass::DoPushProcState(GrTableManager * ptman, int nPState, std::vector & vnStack) -{ - int nValue; - if (nPState == kpstatJustifyMode) - { - // Convert from internal modes to user modes. - int jmodi = ptman->InternalJustificationMode(); - switch (jmodi) - { - case kjmodiNormal: - case kjmodiCanShrink: - nValue = kjmoduNormal; - break; - case kjmodiMeasure: - nValue = kjmoduMeasure; - break; - case kjmodiJustify: - nValue = kjmoduJustify; - break; - default: - gAssert(false); - nValue = kjmoduNormal; - } - } - else if (nPState == kpstatJustifyLevel) - nValue = 1; // TODO: get justify level from ptman - vnStack.push_back(nValue); -} - -} // namespace gr diff --git a/Build/source/libs/graphite/engine-2.3.1/src/segment/GrPseudoMap.h b/Build/source/libs/graphite/engine-2.3.1/src/segment/GrPseudoMap.h deleted file mode 100644 index c6fec210808..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/src/segment/GrPseudoMap.h +++ /dev/null @@ -1,48 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 1999, 2001 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: GrPseudoMap.h -Responsibility: Sharon Correll -Last reviewed: Not yet. - -Description: - The GrPseudoMap class. -----------------------------------------------------------------------------------------------*/ -#ifdef _MSC_VER -#pragma once -#endif -#ifndef GR_PSEUDOMAP_INCLUDED -#define GR_PSEUDOMAP_INCLUDED - -//:End Ignore - -namespace gr -{ - -/*---------------------------------------------------------------------------------------------- - A mapping between a Unicode value and a pseudo-glyph. - - Hungarian: psd -----------------------------------------------------------------------------------------------*/ - -class GrPseudoMap -{ -public: - unsigned int Unicode() { return m_nUnicode; } - gid16 PseudoGlyph() { return m_chwPseudo; } - - void SetUnicode(int n) { m_nUnicode = n; } - void SetPseudoGlyph(gid16 chw) { m_chwPseudo = chw; } - -protected: - // Instance variables: - unsigned int m_nUnicode; - gid16 m_chwPseudo; -}; - -} // namespace gr - -#endif // !GR_PSEUDOMAP_INCLUDED diff --git a/Build/source/libs/graphite/engine-2.3.1/src/segment/GrSlotState.cpp b/Build/source/libs/graphite/engine-2.3.1/src/segment/GrSlotState.cpp deleted file mode 100644 index 9879bc0516f..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/src/segment/GrSlotState.cpp +++ /dev/null @@ -1,1540 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 1999, 2001 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: GrSlotState.cpp -Responsibility: Sharon Correll -Last reviewed: Not yet. - -Description: - GrSlotState class implementation. --------------------------------------------------------------------------------*//*:End Ignore*/ - -//:>******************************************************************************************** -//:> Include files -//:>******************************************************************************************** -#include "Main.h" - -#ifdef _MSC_VER -#pragma hdrstop -#endif -#undef THIS_FILE -DEFINE_THIS_FILE - -//:>******************************************************************************************** -//:> Forward declarations -//:>******************************************************************************************** - -//:>******************************************************************************************** -//:> Local Constants and static variables -//:>******************************************************************************************** - -namespace gr -{ - -//:>******************************************************************************************** -//:> Methods -//:>******************************************************************************************** - -/*---------------------------------------------------------------------------------------------- - Initialize slots. -----------------------------------------------------------------------------------------------*/ -// standard for pass 0 slots -void GrSlotState::Initialize(gid16 chw, GrEngine * pgreng, - GrFeatureValues fval, int ipass, int ichwSegOffset, int nUnicode) -{ - Assert(ipass == 0); - m_chwGlyphID = chw; - m_chwActual = kInvalidGlyph; - m_xysGlyphWidth = kNegInfFloat; - m_bStyleIndex = byte(fval.m_nStyleIndex); - u_intslot nullSlot; - nullSlot.pslot = NULL; - std::fill_n(PUserDefnBuf(), m_cnUserDefn, nullSlot); - std::fill_n(PCompRefBuf(), m_cnCompPerLig, nullSlot); - std::fill_n(PSlatiBuf(), m_cnCompPerLig, nullSlot); - u_intslot * pFeatBuf = PFeatureBuf(); - for (size_t i = 0; i < m_cnFeat; i++) - pFeatBuf[i].nValue = fval.m_rgnFValues[i]; - m_ipassFsmCol = -1; - m_colFsm = -1; - - m_ipassModified = ipass; - m_ichwSegOffset = ichwSegOffset; - m_nUnicode = nUnicode; - m_vpslotAssoc.clear(); - pgreng->InitSlot(this, nUnicode); - - switch (nUnicode) - { - case knLRM: m_spsl = kspslLRM; break; - case knRLM: m_spsl = kspslRLM; break; - case knLRO: m_spsl = kspslLRO; break; - case knRLO: m_spsl = kspslRLO; break; - case knLRE: m_spsl = kspslLRE; break; - case knRLE: m_spsl = kspslRLE; break; - case knPDF: m_spsl = kspslPDF; break; - default: - Assert(m_spsl == kspslNone); - m_spsl = kspslNone; - break; - } -} - -// line-break slots -void GrSlotState::Initialize(gid16 chw, GrEngine * pgreng, - GrSlotState * pslotFeat, int ipass, int ichwSegOffset) -{ - m_chwGlyphID = chw; - m_chwActual = kInvalidGlyph; - m_xysGlyphWidth = kNegInfFloat; - u_intslot nullSlot; - nullSlot.pslot = NULL; - std::fill_n(PUserDefnBuf(), m_cnUserDefn, nullSlot); - std::fill_n(PCompRefBuf(), m_cnCompPerLig, nullSlot); - std::fill_n(PSlatiBuf(), m_cnCompPerLig, nullSlot); - CopyFeaturesFrom(pslotFeat); - m_ipassModified = ipass; - m_ichwSegOffset = ichwSegOffset; - m_nUnicode = -1; - m_vpslotAssoc.clear(); - pgreng->InitSlot(this); - // Caller is responsible for setting m_spsl. - m_ipassFsmCol = -1; - m_colFsm = -1; -} - -// for inserting new slots after pass 0 (under-pos and unicode are irrelevant) -void GrSlotState::Initialize(gid16 chw, GrEngine * pgreng, - GrSlotState * pslotFeat, int ipass) -{ - m_chwGlyphID = chw; - m_chwActual = kInvalidGlyph; - m_xysGlyphWidth = kNegInfFloat; - u_intslot nullSlot; - nullSlot.pslot = NULL; - std::fill_n(PUserDefnBuf(), m_cnUserDefn, nullSlot); - std::fill_n(PCompRefBuf(), m_cnCompPerLig, nullSlot); - std::fill_n(PSlatiBuf(), m_cnCompPerLig, nullSlot); - CopyFeaturesFrom(pslotFeat); - m_ipassModified = ipass; - m_ichwSegOffset = kInvalid; - m_nUnicode = kInvalid; - m_vpslotAssoc.clear(); - pgreng->InitSlot(this); - m_spsl = kspslNone; - m_ipassFsmCol = -1; - m_colFsm = -1; -} - -/*---------------------------------------------------------------------------------------------- - The slot has been modified by the given pass and therefore is in a new state; - make a new SlotState initialized from the old one. -----------------------------------------------------------------------------------------------*/ -void GrSlotState::InitializeFrom(GrSlotState * pslotOld, int ipass) -{ - CopyFrom(pslotOld, false); - - m_ipassModified = ipass; - m_pslotPrevState = pslotOld; - m_ichwSegOffset = kInvalid; - m_vpslotAssoc.clear(); - m_vpslotAssoc.push_back(pslotOld); - - m_dircProc = pslotOld->m_dircProc; - m_fDirProcessed = pslotOld->m_fDirProcessed; - - // Since we're going on to a new pass, no point in copying these: - m_ipassFsmCol = -1; - m_colFsm = -1; - - ////FixAttachmentTree(pslotOld); -} - -/*---------------------------------------------------------------------------------------------- - Copy the features and style information from the given slot. -----------------------------------------------------------------------------------------------*/ -void GrSlotState::CopyFeaturesFrom(GrSlotState * pslotSrc) -{ - m_bStyleIndex = pslotSrc->m_bStyleIndex; - Assert(m_cnFeat == pslotSrc->m_cnFeat); - std::copy(pslotSrc->PFeatureBuf(), pslotSrc->PFeatureBuf() + m_cnFeat, PFeatureBuf()); -} - -/*---------------------------------------------------------------------------------------------- - Copy the basic information. - Warning: the functions below will break if GrSlotState and subclasses are given virtual - methods. In that case, we will need to copy from the address of the first variable in - GrSlotAbstract. -----------------------------------------------------------------------------------------------*/ -void GrSlotState::CopyFrom(GrSlotState * pslot, bool fCopyEverything) -{ - GrSlotAbstract::CopyAbstractFrom(pslot); - std::copy(pslot->m_prgnVarLenBuf, pslot->m_prgnVarLenBuf + CExtraSpace(), m_prgnVarLenBuf); - - if (fCopyEverything) - { - Assert(false); - m_ipassModified = pslot->m_ipassModified; - m_pslotPrevState = pslot->m_pslotPrevState; - m_ichwSegOffset = pslot->m_ichwSegOffset; - m_colFsm = pslot->m_colFsm; - m_ipassFsmCol = pslot->m_ipassFsmCol; - // TODO: copy m_vpslotAssocs. - m_fNeutralAssocs = pslot->m_fNeutralAssocs; - } - - m_dislotRootFixed = pslot->m_dislotRootFixed; - - m_vdislotAttLeaves.resize(pslot->m_vdislotAttLeaves.size()); - for (size_t i = 0; i < pslot->m_vdislotAttLeaves.size(); i++) - m_vdislotAttLeaves[i] = pslot->m_vdislotAttLeaves[i]; - - m_islotPosPass = pslot->m_islotPosPass; - m_nUnicode = pslot->m_nUnicode; - m_dircProc = pslot->m_dircProc; - m_fDirProcessed = pslot->m_fDirProcessed; - m_cnUserDefn = pslot->m_cnUserDefn; - m_cnFeat = pslot->m_cnFeat; - m_bStyleIndex = pslot->m_bStyleIndex; - m_mAdvanceX = pslot->m_mAdvanceX; - m_mAdvanceY = pslot->m_mAdvanceY; - m_mShiftX = pslot->m_mShiftX; - m_mShiftY = pslot->m_mShiftY; - m_srAttachTo = pslot->m_srAttachTo; - m_nAttachLevel = pslot->m_nAttachLevel; - m_mAttachAtX = pslot->m_mAttachAtX; - m_mAttachAtY = pslot->m_mAttachAtY; - m_mAttachAtXOffset = pslot->m_mAttachAtXOffset; - m_mAttachAtYOffset = pslot->m_mAttachAtYOffset; - m_mAttachWithX = pslot->m_mAttachWithX; - m_mAttachWithY = pslot->m_mAttachWithY; - m_mAttachWithXOffset = pslot->m_mAttachWithXOffset; - m_mAttachWithYOffset = pslot->m_mAttachWithYOffset; - m_nAttachAtGpoint = pslot->m_nAttachAtGpoint; - m_nAttachWithGpoint = pslot->m_nAttachWithGpoint; - m_fAttachMod = pslot->m_fAttachMod; - m_fShiftMod = pslot->m_fShiftMod; - m_fIgnoreAdvance = pslot->m_fIgnoreAdvance; - - m_nCompositeLevel = kNegInfinity; // uncalculated, so don't need to copy the positions?? -} - -void GrSlotAbstract::CopyAbstractFrom(GrSlotState * pslot) -{ - u_intslot * pnBufSave = m_prgnVarLenBuf; - *this = *pslot; - m_prgnVarLenBuf = pnBufSave; - Assert(m_prgnVarLenBuf); -} - -/*---------------------------------------------------------------------------------------------- - Initialize the output slot from the one use within the passes, with the basic information. - Warning: this function will break if GrSlotState and subclasses are given virtual - methods. In that case, we will need to copy from the address of the first variable in - GrSlotAbstract. -----------------------------------------------------------------------------------------------*/ -void GrSlotOutput::InitializeOutputFrom(GrSlotState * pslot) -{ - CopyAbstractFrom(pslot); - - // Copy just the component information, which is of length (m_cnCompPerLig * 2) - //std::copy(pslot->PCompRefBuf(), - // pslot->PCompRefBuf() + (m_cnCompPerLig * 2), - // this->PCompRefBufSlout()); -} - -/*---------------------------------------------------------------------------------------------- - Return the ID of the actual glyph that will be used for output and metrics. This is the - same for most glyphs, but will be different for pseudo-glyphs. -----------------------------------------------------------------------------------------------*/ -gid16 GrSlotAbstract::ActualGlyphForOutput(GrTableManager * ptman) -{ - if (m_chwActual == kInvalidGlyph) - m_chwActual = ptman->ActualGlyphForOutput(m_chwGlyphID); - return m_chwActual; -} -/*---------------------------------------------------------------------------------------------- - We are replacing the old slot with the recipient. Replace the pointers in any attachment - root or attached leaf slots. - OBSOLETE -----------------------------------------------------------------------------------------------*/ -void GrSlotState::FixAttachmentTree(GrSlotState * pslotOld) -{ -#if 0 - pslotOld->m_vpslotAttLeaves.CopyTo(m_vpslotAttLeaves); - for (int islot = 0; islot < m_vpslotAttLeaves.Size(); islot++) - { - Assert(m_vpslotAttLeaves[islot]->m_pslotAttRoot == pslotOld); - m_vpslotAttLeaves[islot]->m_pslotAttRoot = this; - } - - m_pslotAttRoot = pslotOld->m_pslotAttRoot; - if (m_pslotAttRoot) - { - for (int islot = 0; islot < m_pslotAttRoot->m_vpslotAttLeaves.Size(); islot++) - { - if (m_pslotAttRoot->m_vpslotAttLeaves[islot] == pslotOld) - { - m_pslotAttRoot->m_vpslotAttLeaves.Delete(islot); - m_pslotAttRoot->m_vpslotAttLeaves.Push(this); - return; - } - } - Assert(false); // didn't find old slot in the list - } -#endif // 0 -} - -/*---------------------------------------------------------------------------------------------- - Make sure all the values are cached that are needed to be copied to the output slots -----------------------------------------------------------------------------------------------*/ -void GrSlotState::EnsureCacheForOutput(GrTableManager * ptman) -{ - // Make sure the actual glyph ID is set. - gid16 gidActual = ActualGlyphForOutput(ptman); - - // Make sure the glyph metrics are stored. - Font * pfont = ptman->State()->GetFont(); - if (IsLineBreak(ptman->LBGlyphID())) - { - GetGlyphMetric(pfont, kgmetAscent, 0); - GetGlyphMetric(pfont, kgmetDescent, 0); - m_xysGlyphX = 0; - m_xysGlyphY = 0; - m_xysGlyphHeight = 0; - m_xysGlyphWidth = 0; - m_xysAdvX = 0; - m_xysAdvY = 0; - m_bIsSpace = true; - } - else - { - //IsSpace(ptman); // cache this flag--doing bb-top below will do it - - GetGlyphMetric(pfont, kgmetAscent, gidActual); - GetGlyphMetric(pfont, kgmetDescent, gidActual); - GetGlyphMetric(pfont, kgmetBbTop, gidActual); - // call above will also cache all the values below - //GetGlyphMetric(pfont, kgmetBbBottom, gidActual); - //GetGlyphMetric(pfont, kgmetBbLeft, gidActual); - //GetGlyphMetric(pfont, kgmetBbRight, gidActual); - //GetGlyphMetric(pfont, kgmetAdvWidth, gidActual); - //GetGlyphMetric(pfont, kgmetAdvHeight, gidActual); - } -} - -/*---------------------------------------------------------------------------------------------- - Set the associations for the slot. -----------------------------------------------------------------------------------------------*/ -void GrSlotState::Associate(GrSlotState * pslot) -{ - m_vpslotAssoc.clear(); - m_vpslotAssoc.push_back(pslot); -} - -void GrSlotState::Associate(GrSlotState * pslotBefore, GrSlotState * pslotAfter) -{ - m_vpslotAssoc.clear(); - m_vpslotAssoc.push_back(pslotBefore); - m_vpslotAssoc.push_back(pslotAfter); -} - -void GrSlotState::Associate(std::vector & vpslot) -{ - m_vpslotAssoc.clear(); - ///vpslot.CopyTo(m_vpslotAssoc); -- bug in CopyTo, so we do it ourselves: - for (size_t islot = 0; islot < vpslot.size(); ++islot) - { - m_vpslotAssoc.push_back(vpslot[islot]); - } - - // Set its character styles and features from the associated slot. - if (vpslot.size() > 0) // && !m_pslotPrevState - { - std::copy(m_vpslotAssoc[0]->PFeatureBuf(), - m_vpslotAssoc[0]->PFeatureBuf() + m_cnFeat, PFeatureBuf()); - } -} - -/*---------------------------------------------------------------------------------------------- - Clear the associations for the slot. -----------------------------------------------------------------------------------------------*/ -void GrSlotState::ClearAssocs() -{ - m_vpslotAssoc.clear(); -} - -/*---------------------------------------------------------------------------------------------- - Return a list of (ie, add into the vector) all the underlying associations, relative - to the official beginning of the segment. -----------------------------------------------------------------------------------------------*/ -void GrSlotState::AllAssocs(std::vector & vichw) -{ - if (PassModified() == 0) - { - Assert(m_ichwSegOffset != kInvalid); - vichw.push_back(m_ichwSegOffset); - } - else - { - for (size_t i = 0; i < m_vpslotAssoc.size(); ++i) - m_vpslotAssoc[i]->AllAssocs(vichw); - } -} - -/*---------------------------------------------------------------------------------------------- - Return the underlying position of the before-association, relative to the official - beginning of the segment. May be -1, if this slot maps to a character in the previous - segment, or >= the length of the segment, if it maps to a character in the following - segment. -----------------------------------------------------------------------------------------------*/ -int GrSlotState::BeforeAssoc() -{ - GrSlotState * pslot = this; - while (pslot->PassModified() > 0) - { - pslot = pslot->RawBeforeAssocSlot(); - if (pslot == NULL) - { - return kPosInfinity; - } - } - Assert(pslot->m_ichwSegOffset != kInvalid); - return pslot->m_ichwSegOffset; -} - -/*---------------------------------------------------------------------------------------------- - Return the underlying position of the after-association, relative to the official - beginning of the segment. May be -1, if this slot maps to a character in the previous - segment, or >= the length of the segment, if it maps to a character in the following - segment. -----------------------------------------------------------------------------------------------*/ -int GrSlotState::AfterAssoc() -{ - GrSlotState * pslot = this; - while (pslot->PassModified() > 0) - { - pslot = pslot->RawAfterAssocSlot(); - if (pslot == NULL) - { - return kNegInfinity; - } - } - Assert(pslot->m_ichwSegOffset != kInvalid); - return pslot->m_ichwSegOffset; -} - -/*---------------------------------------------------------------------------------------------- - It is possible to get into a state where we are associated with an invalid state. - For instance, slot C may be associated with slots B1 and B2, but slot B1 is not associated - with any earlier slot, in which case slot C should remove the association with B1 and just - be associated with B2. -----------------------------------------------------------------------------------------------*/ -void GrSlotState::CleanUpAssocs() -{ - for (size_t i = 0; i < m_vpslotAssoc.size(); i++) - m_vpslotAssoc[i]->CleanUpAssocs(); - - GrSlotState * pslot; - - pslot = RawBeforeAssocSlot(); - while (pslot && BeforeAssoc() == kPosInfinity) - { - // The before association is bogus--delete it. - m_vpslotAssoc.erase(m_vpslotAssoc.begin()); - pslot = RawBeforeAssocSlot(); - } - - pslot = RawAfterAssocSlot(); - while (pslot && AfterAssoc() == kNegInfinity) - { - // The after association is bogus--delete it. - m_vpslotAssoc.pop_back(); - pslot = RawAfterAssocSlot(); - } -} - -/*---------------------------------------------------------------------------------------------- - Fill in the array of the given output slot with the underlying positions of the - ligature components, relative to the official beginning of the segment. - Positions may be < 0, if this slot maps to a character in the previous segment, - or >= the length of the segment, if it maps to a character in the following segment. -----------------------------------------------------------------------------------------------*/ -void GrSlotState::SetComponentRefsFor(GrSlotOutput * pslout, int slatiArg) -{ - if (PassModified() > 0) - { - GrSlotState * pslot; - int slati; - if (HasComponents()) - { - for (int iComponent = 0; iComponent < m_cnCompPerLig; iComponent++) - { - pslot = CompRefSlot(iComponent); - slati = Slati(iComponent); - if (pslot) - { - Assert(slati != -1); - Assert(PassModified() >= pslot->PassModified()); - pslot->SetComponentRefsFor(pslout, slati); - } - } - } - else - { - // Follow the chain back through the passes. - for (int islot = 0; islot < AssocsSize(); islot++) - { - pslot = m_vpslotAssoc[islot]; - if (pslot) - { - Assert(PassModified() >= pslot->PassModified()); - // Passing slati here is definitely needed for our Arabic font: for instance when - // you type something like "mla", so the l is transformed into a temporary glyph - // before creating the ligature. However, this seems to have broken something, - // which I will probably find eventually. :-( - pslot->SetComponentRefsFor(pslout, slatiArg); - //pslot->SetComponentRefsFor(pslout, -1); - } - } - } - } - else - { - Assert(m_ichwSegOffset != kInvalid); - pslout->AddComponentReference(m_ichwSegOffset, slatiArg); - } -} - -/*---------------------------------------------------------------------------------------------- - Fill in the vector with the underlying positions of the - ligature components, relative to the official beginning of the segment. - Positions may be < 0, if this slot maps to a character in the previous segment, - or >= the length of the segment, if it maps to a character in the following segment. - ENHANCE: merge with method above. -----------------------------------------------------------------------------------------------*/ -void GrSlotState::AllComponentRefs(std::vector & vichw, std::vector & vicomp, - int iComponent) -{ - if (PassModified() > 0) - { - GrSlotState * pslot; - if (HasComponents()) - { - for (int iComponent = 0; iComponent < m_cnCompPerLig; iComponent++) - { - pslot = CompRefSlot(iComponent); - if (pslot) - { - Assert(PassModified() >= pslot->PassModified()); - pslot->AllComponentRefs(vichw, vicomp, iComponent); - } - } - } - else - { - for (int islot = 0; islot < AssocsSize(); islot++) - { - m_vpslotAssoc[islot]->AllComponentRefs(vichw, vicomp, iComponent); - } - } - } - else - { - Assert(m_ichwSegOffset != kInvalid); - vichw.push_back(m_ichwSegOffset); - vicomp.push_back(iComponent); - } -} - -/*---------------------------------------------------------------------------------------------- - Get the value of the component.???.ref attribute for the slot. - Note that 'i' is the local index for the component as defined for this glyph. -----------------------------------------------------------------------------------------------*/ -GrSlotState * GrSlotState::CompRefSlot(int i) -{ - Assert(i < m_cnCompPerLig); - if (i < m_cnCompPerLig) - return CompRef(i); - else - return NULL; -} - -/*---------------------------------------------------------------------------------------------- - Set the value of the component.???.ref attribute for the slot. -----------------------------------------------------------------------------------------------*/ -void GrSlotState::SetCompRefSlot(GrTableManager * ptman, int slati, GrSlotState * pslotComp) -{ - // Convert the global identifer for the component to the index for this glyph. - int icomp = ptman->ComponentIndexForGlyph(GlyphID(), slati); - Assert(icomp != -1); - if (icomp == -1) - // Component not defined for this glyph--ignore. - return; - Assert(icomp < m_cnCompPerLig); - - if (m_fHasComponents == false) - { - // None have been set yet; initialize them. - for (int iLoop = 0; iLoop < m_cnCompPerLig; iLoop++) - { - SetCompRef(iLoop, NULL); - SetSlati(iLoop, -1); - } - } - - m_fHasComponents = true; - int iLoop; - for (iLoop = 0; iLoop < m_cnCompPerLig; iLoop++) - { - if (Slati(iLoop) == slati) - break; - if (Slati(iLoop) == -1) - break; - } - //if (icomp < m_cnCompPerLig) - if (iLoop < m_cnCompPerLig) - { - //SetCompRef(icomp, pslotComp); - SetCompRef(iLoop, pslotComp); - SetSlati(iLoop, slati); - } -} - -/*---------------------------------------------------------------------------------------------- - Return the underlying position for the slot, relative to the official beginning of the - segment. -----------------------------------------------------------------------------------------------*/ -int GrSlotState::SegOffset() -{ - if (m_ichwSegOffset == kInvalid) - { - Assert(m_pslotPrevState); - Assert(m_ipassModified > 0); - return m_pslotPrevState->SegOffset(); - } - else - { - Assert(m_pslotPrevState == NULL); - Assert(m_ipassModified == 0); - return m_ichwSegOffset; - } -} - -/*---------------------------------------------------------------------------------------------- - Return the value of the glyph attribute (in design units, if this is a measurement). -----------------------------------------------------------------------------------------------*/ -int GrSlotState::GlyphAttrValueEmUnits(GrTableManager * ptman, int nAttrID) -{ - return ptman->GlyphAttrValue(m_chwGlyphID, nAttrID); -} - -/*---------------------------------------------------------------------------------------------- - Return the value of the glyph metric, in design coordinates (ie, based on the font's - em-square). -----------------------------------------------------------------------------------------------*/ -int GrSlotState::GlyphMetricEmUnits(GrTableManager * ptman, int nMetricID) -{ - int mValue; - if (ptman->State()->GetFont()) - { - // Get the actual metric, possibly adjusted for hinting, then convert back to - // design units. - float xysValue = GlyphMetricLogUnits(ptman, nMetricID); - mValue = ptman->LogToEmUnits(xysValue); - } - else - // Ask the font directly. - ////mValue = ??? - mValue = 0; - - return mValue; -} - -/*---------------------------------------------------------------------------------------------- - Return the value of the glyph attribute, converted to source device coordinates. - The attribute is assumed to be one whose value is a measurement. -----------------------------------------------------------------------------------------------*/ -float GrSlotState::GlyphAttrValueLogUnits(GrTableManager * ptman, int nAttrID) -{ - int mValue = GlyphAttrValueEmUnits(ptman, nAttrID); - float xysRet = ptman->EmToLogUnits(mValue); - return xysRet; -} - -/*---------------------------------------------------------------------------------------------- - Return the value of the glyph metric, in the source device's logical units. -----------------------------------------------------------------------------------------------*/ -float GrSlotState::GlyphMetricLogUnits(GrTableManager * ptman, int nMetricID) -{ -#ifdef OLD_TEST_STUFF - if (ptman->GlyphTable() == NULL) - return 0; -#endif // OLD_TEST_STUFF - -#ifdef _DEBUG - if (IsLineBreak(ptman->LBGlyphID())) - { - Warn("Getting metrics of line-break slot"); - } -#endif // _DEBUG - if (IsLineBreak(ptman->LBGlyphID())) - { - return 0; - } - - return GetGlyphMetric(ptman->State()->GetFont(), nMetricID, - ActualGlyphForOutput(ptman)); -} - - -float GrSlotOutput::GlyphMetricLogUnits(Font * pfont, int nMetricID) -{ - Assert(m_chwActual != kInvalidGlyph); - if (m_chwActual == kInvalidGlyph) - return 0; - - return GetGlyphMetric(pfont, nMetricID, m_chwActual); -} - -//float GrSlotOutput::GlyphMetricLogUnits(int gmet) -- obsolete: no longer caching these values -//{ -// // When the font is not passed as an argument, the values better be cached! -// -// switch (gmet) -// { // There may be off by one errors below, depending on what width and height mean -// case kgmetLsb: -// return m_xysGlyphX; -// case kgmetRsb: -// return (m_xysAdvX - m_xysGlyphX - m_xysGlyphWidth); -// case kgmetBbTop: -// return m_xysGlyphY; -// case kgmetBbBottom: -// return (m_xysGlyphY - m_xysGlyphHeight); -// case kgmetBbLeft: -// return m_xysGlyphX; -// case kgmetBbRight: -// return (m_xysGlyphX + m_xysGlyphWidth); -// case kgmetBbHeight: -// return m_xysGlyphHeight; -// case kgmetBbWidth: -// return m_xysGlyphWidth; -// case kgmetAdvWidth: -// return m_xysAdvX; -// case kgmetAdvHeight: -// return m_xysAdvY; -// default: -// Warn("GetGlyphMetric was asked for an illegal metric."); -// }; -// -// return 0; -//} - -float GrSlotState::GetGlyphMetric(Font * pfont, int nMetricID, gid16 chwGlyphID) -{ - GlyphMetric gmet = GlyphMetric(nMetricID); - switch (gmet) - { - case kgmetAscent: - case kgmetDescent: - if (m_xysFontAscent == kNegInfFloat) - { - m_xysFontAscent = GrSlotAbstract::GetGlyphMetric(pfont, kgmetAscent, chwGlyphID); - m_xysFontDescent = GrSlotAbstract::GetGlyphMetric(pfont, kgmetDescent, chwGlyphID); - } - break; - default: - if (m_xysGlyphWidth == kNegInfFloat) - { - GetGlyphMetricAux(pfont, chwGlyphID, m_xysGlyphX, m_xysGlyphY, m_xysGlyphWidth, - m_xysGlyphHeight, m_xysAdvX, m_xysAdvY, m_bIsSpace); - } - break; - } - - switch (gmet) - { // There may be off-by-one errors below, depending on what width and height mean - case kgmetAscent: - return m_xysFontAscent; - case kgmetDescent: - return m_xysFontDescent; - case kgmetLsb: - return m_xysGlyphX; - case kgmetRsb: - return (m_xysAdvX - m_xysGlyphX - m_xysGlyphWidth); - case kgmetBbTop: - return m_xysGlyphY; - case kgmetBbBottom: - return (m_xysGlyphY - m_xysGlyphHeight); - case kgmetBbLeft: - return m_xysGlyphX; - case kgmetBbRight: - return (m_xysGlyphX + m_xysGlyphWidth); - case kgmetBbHeight: - return m_xysGlyphHeight; - case kgmetBbWidth: - return m_xysGlyphWidth; - case kgmetAdvWidth: - return m_xysAdvX; - case kgmetAdvHeight: - return m_xysAdvY; - default: - Warn("GetGlyphMetric was asked for an illegal metric."); - }; - - return 0; -} - -float GrSlotAbstract::GetGlyphMetric(Font * pfont, int nMetricID, gid16 chwGlyphID) -{ - GlyphMetric gmet = GlyphMetric(nMetricID); - - float yAscent, yDescent; - - if (kgmetAscent == gmet) - { - //if (m_xysFontAscent != -1) - // return m_xysFontAscent; - pfont->getFontMetrics(&yAscent); - //m_xysFontAscent = xysRet; - //if (pfont) - // m_xysFontAscent = yAscent; - return yAscent; - } - - if (kgmetDescent == gmet) - { - //if (m_xysFontDescent != -1) - // return m_xysFontDescent; - pfont->getFontMetrics(NULL, &yDescent); - //m_xysFontDescent = xysRet; - //if (pfont) - // m_xysFontDescent = yDescent; - return yDescent; - } - - float xysGlyphX, xysGlyphY, xysGlyphWidth, xysGlyphHeight, xysAdvX, xysAdvY; - GetGlyphMetricAux(pfont, chwGlyphID, xysGlyphX, xysGlyphY, xysGlyphWidth, - xysGlyphHeight, xysAdvX, xysAdvY, m_bIsSpace); - - switch (gmet) - { // There may be off-by-one errors below, depending on what width and height mean - case kgmetLsb: - return xysGlyphX; - case kgmetRsb: - return (xysAdvX - xysGlyphX - xysGlyphWidth); - case kgmetBbTop: - return xysGlyphY; - case kgmetBbBottom: - return (xysGlyphY - xysGlyphHeight); - case kgmetBbLeft: - return xysGlyphX; - case kgmetBbRight: - return (xysGlyphX + xysGlyphWidth); - case kgmetBbHeight: - return xysGlyphHeight; - case kgmetBbWidth: - return xysGlyphWidth; - case kgmetAdvWidth: - return xysAdvX; - case kgmetAdvHeight: - return xysAdvY; - default: - Warn("GetGlyphMetric was asked for an illegal metric."); - }; - - return 0; -} - -void GrSlotAbstract::GetGlyphMetricAux(Font * pfont, gid16 chwGlyphID, - float & xysGlyphX, float & xysGlyphY, - float & xysGlyphWidth, float & xysGlyphHeight, float & xysAdvX, float & xysAdvY, sdata8 & bIsSpace) -{ - gr::Point ptAdvances; - gr::Rect rectBb; - pfont->getGlyphMetrics(chwGlyphID, rectBb, ptAdvances); - - xysGlyphX = rectBb.left; - xysGlyphY = rectBb.top; - xysGlyphWidth = (rectBb.right - rectBb.left); - xysGlyphHeight = (rectBb.top - rectBb.bottom); - xysAdvX = ptAdvances.x; - xysAdvY = ptAdvances.y; - - bIsSpace = (0 == xysGlyphX && 0 == xysGlyphY); // should agree with test done in IsSpace() below - - if (bIsSpace == 1) - { - // White space glyph - only case where nGlyphX == nGlyphY == 0 - // nGlyphWidth & nGlyphHeight are always set to 16 for unknown reasons, so correct. - xysGlyphWidth = xysGlyphHeight = 0; - } -} - -/*---------------------------------------------------------------------------------------------- - Test the glyph id to see if it is a white space glyph. -----------------------------------------------------------------------------------------------*/ -int GrSlotState::IsSpace(GrTableManager * ptman) -{ - gid16 gidActual = ActualGlyphForOutput(ptman); - - ////if (m_xysGlyphWidth == -1) - ////{ - //// res = ptman->State()->GraphicsObject()->GetGlyphMetrics(gidActual, - //// &m_xysGlyphWidth, &m_xysGlyphHeight, - //// &m_xysGlyphX, &m_xysGlyphY, &m_xysAdvX, &m_xysAdvY); - //// if (ResultFailed(res)) - //// { - //// WARN(res); - //// return 2; // will test as true but can be distinguished by separate value - //// } - - //// gr::Point ptAdvances; - //// gr::Rect rectBb; - //// ptman->State()->Font()->getGlyphMetrics(gidActual, rectBb, ptAdvances); - ////} - - if (m_bIsSpace == -1) - GetGlyphMetric(ptman->State()->GetFont(), kgmetBbLeft, gidActual); - // One call is enough to cache the information. - //GetGlyphMetric(ptman->State()->Font(), kgmetBbBottom, gidActual); - - // should agree with test done in GetGlyphMetric() above - //////m_bIsSpace = (0 == m_xysGlyphX && 0 == m_xysGlyphY); - - Assert(m_bIsSpace == 0 || m_bIsSpace == 1); - - return m_bIsSpace; -} - -bool GrSlotOutput::IsSpace() -{ - Assert(m_bIsSpace == 0 || m_bIsSpace == 1); - return m_bIsSpace; -} - -/*---------------------------------------------------------------------------------------------- - If any of the attach attributes have been modified, fix things up. Set up the attachment - tree, and set any needed default positions. Zap the cached positions of any following - glyphs in the stream. - - @param psstrm - the stream in which the modifications were made - @param islotThis - the index of the attached (leaf) slot in the stream; - -1 if we don't know -----------------------------------------------------------------------------------------------*/ -void GrSlotState::HandleModifiedPosition(GrTableManager * ptman, - GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, int islotThis) -{ - if (!m_fAttachMod && !m_fShiftMod) - return; - - if (islotThis == -1) - { - for (int islot = 0; islot < psstrmOut->WritePos(); islot++) - { - if (psstrmOut->SlotAt(islot) == this) - { - islotThis = islot; - break; - } - } - Assert(islotThis > -1); - } - - if (m_fAttachMod) - { - // Attachments. - - // Note that it doesn't make sense to attach a slot to itself, so if the value of - // the attach.to attribute is 0, that means clear the attachment. - GrSlotState * pslotNewRoot = AttachRoot(psstrmOut); - - AttachToRoot(ptman, psstrmOut, pslotNewRoot); - - if (pslotNewRoot) - { - // If this is an attachment with no positions, attach the two glyphs side by side - // in the appropriate order. - bool fRtl = ((pslotNewRoot->PostBidiDirLevel(ptman) % 2) != 0); - if ((fRtl && m_srAttachTo < 0) || (!fRtl && m_srAttachTo > 0)) - { - // The root is on the right, the leaf is on the left. - if (m_mAttachAtX == kNotYetSet && m_nAttachAtGpoint == kNotYetSet) - m_mAttachAtX = 0; - if (m_mAttachWithX == kNotYetSet && m_nAttachWithGpoint == kNotYetSet) - m_mAttachWithX = short(AdvanceX(ptman)); - } - else - { - // The root is on the left, the leaf is on the right. - if (m_mAttachAtX == kNotYetSet && m_nAttachAtGpoint == kNotYetSet) - m_mAttachAtX = short(pslotNewRoot->AdvanceX(ptman)); - if (m_mAttachWithX == kNotYetSet && m_nAttachWithGpoint == kNotYetSet) - m_mAttachWithX = 0; - } - } - } - else - { - // Shifting, or changing the advance width. - Assert(m_fShiftMod); - EnsureLocalAttachmentTree(ptman, psstrmIn, psstrmOut, islotThis); - ZapMetricsAndPositionDownToBase(psstrmOut); - ZapMetricsOfLeaves(psstrmOut); - } - - if (psstrmOut->m_ipass == ptman->NumberOfPasses() - 1) - ptman->InitPosCache(); // cached position is most likely no longer valid - - // Invalidate the positions of this and any following glyphs. - for (int islot = islotThis + 1; islot < psstrmOut->WritePos(); islot++) - psstrmOut->SlotAt(islot)->ZapPosition(); - - m_fAttachMod = false; - m_fShiftMod = false; -} - -/*---------------------------------------------------------------------------------------------- - The shift attribute of a slot has been modified. Make sure any slots that are part of the - same attachment cluster are local to this stream. The reason for this is so that the - position calculations stay consistent within the stream. -----------------------------------------------------------------------------------------------*/ -void GrSlotState::EnsureLocalAttachmentTree(GrTableManager * ptman, - GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, int islotThis) -{ - if (m_dislotRootFixed) - { - GrSlotState * pslotRoot = SlotAtOffset(psstrmOut, m_dislotRootFixed); - psstrmOut->EnsureLocalCopy(ptman, pslotRoot, psstrmIn); - pslotRoot = SlotAtOffset(psstrmOut, m_dislotRootFixed); // get the new one! - pslotRoot->EnsureLocalAttachmentTree(ptman, psstrmIn, psstrmOut, islotThis + m_dislotRootFixed); - } - for (size_t islot = 0; islot < m_vdislotAttLeaves.size(); islot++) - { - GrSlotState * pslotLeaf = SlotAtOffset(psstrmOut, m_vdislotAttLeaves[islot]); - psstrmOut->EnsureLocalCopy(ptman, pslotLeaf, psstrmIn); - } -} - -/*---------------------------------------------------------------------------------------------- - The recipient slot is being attached to the argument slot. - NOTE: the caller is responsible to zap the cached positions of following glyphs - in the stream. -----------------------------------------------------------------------------------------------*/ -void GrSlotState::AttachToRoot(GrTableManager * ptman, GrSlotStream * psstrm, - GrSlotState * pslotNewRoot) -{ - GrSlotState * pslotOldRoot = (m_dislotRootFixed == 0) ? - NULL : - SlotAtOffset(psstrm, m_dislotRootFixed); - - if (pslotOldRoot) - { - if (pslotOldRoot != pslotNewRoot) - pslotOldRoot->RemoveLeaf(m_dislotRootFixed); - pslotOldRoot->ZapMetricsAndPositionDownToBase(psstrm); - pslotOldRoot->ZapMetricsOfLeaves(psstrm); - } - - ZapCompositeMetrics(); - - if (pslotNewRoot && pslotNewRoot != pslotOldRoot) - { - pslotNewRoot->AddLeaf(m_srAttachTo); - pslotNewRoot->ZapMetricsAndPositionDownToBase(psstrm); - pslotNewRoot->ZapMetricsOfLeaves(psstrm); - } - - m_dislotRootFixed = m_srAttachTo; -} - -/*---------------------------------------------------------------------------------------------- - Return the absolute position of the glyph, relative to the start of the segment, - in font design units. -----------------------------------------------------------------------------------------------*/ -void GrSlotState::Position(GrTableManager * ptman, - GrSlotStream * psstrmOut, int * pmXPos, int * pmYPos) -{ - Assert(!m_fAttachMod); // the attachment tree should be set up - Assert(!m_fShiftMod); - - float xsWidth, xsVisWidth; - if (m_xsPositionX == kNegInfFloat || m_ysPositionY == kNegInfFloat) - ptman->CalcPositionsUpTo(psstrmOut->m_ipass, this, &xsWidth, &xsVisWidth); - - *pmXPos = ptman->LogToEmUnits(m_xsPositionX); - *pmYPos = ptman->LogToEmUnits(m_ysPositionY); -} - -/*---------------------------------------------------------------------------------------------- - Recalculate the metrics for this slot, which has attachments on it (or possibly - did in the past). -----------------------------------------------------------------------------------------------*/ -void GrSlotState::AdjustRootMetrics(GrTableManager * ptman, GrSlotStream * psstrm) -{ - Assert(m_dislotRootFixed == m_srAttachTo); - GrSlotState * pslotRoot = AttachRoot(psstrm); - CalcRootMetrics(ptman, psstrm, kPosInfinity); - if (pslotRoot) - pslotRoot->AdjustRootMetrics(ptman, psstrm); -} - -/*---------------------------------------------------------------------------------------------- - Calculate the composite metrics for this slot. - - @param psstrm - stream for which we are calculating it - @param nLevel - attachment level we are asking for; kPosInifinity means all levels - @param fThorough - true: do a thorough recalculation; false: don't recalculate - metrics for leaves (are they assumed to be accurate???) - --currently not used -----------------------------------------------------------------------------------------------*/ -void GrSlotState::CalcCompositeMetrics(GrTableManager * ptman, GrSlotStream * psstrm, - int nLevel, bool fThorough) -{ - if (m_nCompositeLevel == nLevel) - return; - - if (fThorough) - { - Assert(m_dislotRootFixed == m_srAttachTo); - GrSlotState * pslotRoot = AttachRoot(psstrm); - - InitMetrics(ptman, pslotRoot); - - for (size_t islot = 0; islot < m_vdislotAttLeaves.size(); islot++) - { - GrSlotState * pslotLeaf = SlotAtOffset(psstrm, m_vdislotAttLeaves[islot]); - if (pslotLeaf->AttachLevel() <= nLevel) - pslotLeaf->CalcCompositeMetrics(ptman, psstrm, nLevel, fThorough); - else - // this slot will be ignored in the composite metrics - pslotLeaf->ZapRootMetrics(); - } - CalcRootMetrics(ptman, psstrm, nLevel); - - m_nCompositeLevel = nLevel; - } - else - { - Assert(false); // for now - - // Don't bother with the leaves. - InitRootMetrics(ptman); - } -} - -/*---------------------------------------------------------------------------------------------- - Calculate the metrics for this node and all its leaf nodes. -----------------------------------------------------------------------------------------------*/ -void GrSlotState::CalcRootMetrics(GrTableManager * ptman, GrSlotStream * psstrm, int nLevel) -{ - for (size_t idislot = 0; idislot < m_vdislotAttLeaves.size(); idislot++) - { - GrSlotState * pslot = SlotAtOffset(psstrm, m_vdislotAttLeaves[idislot]); - if (pslot->AttachLevel() > nLevel) - continue; - - m_xsClusterXOffset = min(m_xsClusterXOffset, pslot->m_xsClusterXOffset); - if (!pslot->m_fIgnoreAdvance) - { - m_xsClusterAdv = max( - m_xsClusterAdv, - pslot->m_xsClusterAdv + m_xsRootShiftX); - } - m_xsClusterBbLeft = min(m_xsClusterBbLeft, pslot->m_xsClusterBbLeft); - m_xsClusterBbRight = max(m_xsClusterBbRight, pslot->m_xsClusterBbRight); - m_ysClusterBbTop = max(m_ysClusterBbTop, pslot->m_ysClusterBbTop); - m_ysClusterBbBottom = min(m_ysClusterBbBottom, pslot->m_ysClusterBbBottom); - } -} - -/*---------------------------------------------------------------------------------------------- - Reset the cluster metrics of this slot. -----------------------------------------------------------------------------------------------*/ -void GrSlotState::InitMetrics(GrTableManager * ptman, GrSlotState * pslotRoot) -{ - InitLeafMetrics(ptman, pslotRoot); - InitRootMetrics(ptman); -} - -/*---------------------------------------------------------------------------------------------- - Initialize the variables that store the offsets of just this node (ignoring any of its - leaves) relative to the cluster base. -----------------------------------------------------------------------------------------------*/ -void GrSlotState::InitLeafMetrics(GrTableManager * ptman, GrSlotState * pslotRoot) -{ - float xsShiftX = ptman->EmToLogUnits(ShiftX()); - float ysShiftY = ptman->EmToLogUnits(ShiftY()); - - if (ptman->RightToLeft()) - xsShiftX *= -1; - - if (IsBase()) - { - // The x-value below has to be zero because the shift is incorporated into - // m_xsRootShiftX. (m_ysRootShiftY, on the other hand, isn't used anywhere.) - m_xsOffsetX = 0; - m_ysOffsetY = ysShiftY; - - m_xsRootShiftX = xsShiftX; - m_ysRootShiftY = ysShiftY; - Assert(!IsLineBreak(ptman->LBGlyphID()) - || (m_xsRootShiftX == 0 && m_ysRootShiftY == 0)); - return; - } - - Assert(!IsLineBreak(ptman->LBGlyphID())); - - // Hint-adjusted logical coordinates equivalent to attach.at and attach.with attributes. - // If attach.at or attach.with attributes were unset, the defaults for a side-by-side - // attachment should have been supplied in HandleModifiedPosition(). - float xsAttAtX, ysAttAtY, xsAttWithX, ysAttWithY; - AttachLogUnits(ptman, pslotRoot, &xsAttAtX, &ysAttAtY, &xsAttWithX, &ysAttWithY); - - m_xsOffsetX = xsAttAtX - xsAttWithX; - m_xsOffsetX += pslotRoot->m_xsOffsetX; - m_xsOffsetX += xsShiftX; - - m_ysOffsetY = ysAttAtY - ysAttWithY; - m_ysOffsetY += pslotRoot->m_ysOffsetY; - m_ysOffsetY += ysShiftY; - - // Cumulative effect of shifts on this and all base nodes: - m_xsRootShiftX = pslotRoot->m_xsRootShiftX + xsShiftX; - m_ysRootShiftY = pslotRoot->m_ysRootShiftY + ysShiftY; -} - -/*---------------------------------------------------------------------------------------------- - Initialize the variables that store the offsets of this node taking into account its - leaves; these are relative to the cluster base. -----------------------------------------------------------------------------------------------*/ -void GrSlotState::InitRootMetrics(GrTableManager * ptman) -{ - if (IsLineBreak(ptman->LBGlyphID())) - { - m_fIgnoreAdvance = true; - m_xsClusterXOffset = 0; - m_xsClusterAdv = 0; - m_xsClusterBbLeft = 0; - m_xsClusterBbRight = 0; - m_ysClusterBbTop = 0; - m_ysClusterBbBottom = 0; - return; - } - - float xsAdvanceX = ptman->EmToLogUnits(AdvanceX(ptman)); - - // If the glyph's advance width is zero, then we NEVER want it to have any affect, - // even if the glyph is attached way out to the right of its base's advance. - m_fIgnoreAdvance = (xsAdvanceX == 0); - - float xsBbLeft = GlyphMetricLogUnits(ptman, kgmetBbLeft); - float xsBbRight = GlyphMetricLogUnits(ptman, kgmetBbRight); - float ysBbTop = GlyphMetricLogUnits(ptman, kgmetBbTop); - float ysBbBottom = GlyphMetricLogUnits(ptman, kgmetBbBottom); - - // Any shifts should be ignored for the sake of calculating actual position or width, - // hence we subtract the cumulative effect of the shifts. - m_xsClusterXOffset = m_xsOffsetX - m_xsRootShiftX; - m_xsClusterAdv = m_xsOffsetX + xsAdvanceX - m_xsRootShiftX; - - m_xsClusterBbLeft = m_xsOffsetX + xsBbLeft; - m_xsClusterBbRight = m_xsOffsetX + xsBbRight; - m_ysClusterBbTop = m_ysOffsetY + ysBbTop; - m_ysClusterBbBottom = m_ysOffsetY + ysBbBottom; -} - -/*---------------------------------------------------------------------------------------------- - X-offset of a single glyph relative to the previous advance position. -----------------------------------------------------------------------------------------------*/ -float GrSlotState::GlyphXOffset(GrSlotStream * psstrm, float fakeItalicRatio) -{ - float xsRet = Base(psstrm)->ClusterRootOffset() + m_xsOffsetX; - - // fake an italic slant - xsRet += m_ysOffsetY * fakeItalicRatio; - - return xsRet; -} - -/*---------------------------------------------------------------------------------------------- - Y-offsets of a single glyph relative to the previous advance position. -----------------------------------------------------------------------------------------------*/ -float GrSlotState::GlyphYOffset(GrSlotStream * psstrm) -{ - return m_ysOffsetY; -} - -/*---------------------------------------------------------------------------------------------- - Return the offset of the last leaf of the cluster, relative to this slot, which is - the base. Return kNegInfinity if there are not enough slots in the stream to tell. -----------------------------------------------------------------------------------------------*/ -int GrSlotState::LastLeafOffset(GrSlotStream * psstrm) -{ - int islotRet = 0; - for (size_t idislot = 0; idislot < m_vdislotAttLeaves.size(); idislot++) - { - int dislot = m_vdislotAttLeaves[idislot]; - Assert(dislot != 0); - if (!psstrm->HasSlotAtPosPassIndex(PosPassIndex() + dislot)) - return kNegInfinity; - GrSlotState * pslotLeaf = SlotAtOffset(psstrm, dislot); - int islotTmp = pslotLeaf->LastLeafOffset(psstrm); - if (islotTmp == kNegInfinity) - return kNegInfinity; - islotRet = max(islotRet, (dislot + islotTmp)); - } - return islotRet; -} - -/*---------------------------------------------------------------------------------------------- - Return the attach positions in the device context's logical units, - adjusted for hinting if possible. - - Note that m_nAttachAt/WithGpoint = 0 is always an invalid value (resulting from a - glyph attribute that was defined in terms of x/y coordinates that didn't map to an - actual on-curve point). Therefore the x/y coordinates should be used to do the - attachment. In the case where we actually want point #0 on the curve, - m_nAttachAt/WithGpoint will have the special value 'kGpointZero' (the glyph attribute - is defined this way). -----------------------------------------------------------------------------------------------*/ -void GrSlotState::AttachLogUnits(GrTableManager * ptman, GrSlotState * pslotRoot, - float * pxsAttAtX, float * pysAttAtY, - float * pxsAttWithX, float * pysAttWithY) -{ - if (m_nAttachAtGpoint == kNotYetSet || m_nAttachAtGpoint == 0) - { - // Use x- and y-coordinates; no adjustment for hinting is done. - int mX = m_mAttachAtX + m_mAttachAtXOffset; - int mY = m_mAttachAtY + m_mAttachAtYOffset; - - *pxsAttAtX = ptman->EmToLogUnits(mX); - *pysAttAtY = ptman->EmToLogUnits(mY); - } - else - { - // Look up the actual on-curve point. - int nGpoint = m_nAttachAtGpoint; - if (nGpoint == kGpointZero) - nGpoint = 0; - bool fImpl = ptman->GPointToXY(pslotRoot->GlyphID(), nGpoint, pxsAttAtX, pysAttAtY); - - // Debuggers: - //int mXTmpAt = m_mAttachAtX + m_mAttachAtXOffset; - //int mYTmpAt = m_mAttachAtY + m_mAttachAtYOffset; - //int xsAttAtXTmp = ptman->EmToLogUnits(mXTmpAt); - //int ysAttAtYTmp = ptman->EmToLogUnits(mYTmpAt); - //fImpl = false; - - if (!fImpl) - { - // Fall back to using x- and y-coordinates; no adjustment for hinting. - int mX = m_mAttachAtX + m_mAttachAtXOffset; - int mY = m_mAttachAtY + m_mAttachAtYOffset; - *pxsAttAtX = ptman->EmToLogUnits(mX); - *pysAttAtY = ptman->EmToLogUnits(mY); - } - else - { - // Adjust by offsets. - *pxsAttAtX += ptman->EmToLogUnits(m_mAttachAtXOffset); - *pysAttAtY += ptman->EmToLogUnits(m_mAttachAtYOffset); - } - } - - if (m_nAttachWithGpoint == kNotYetSet || m_nAttachWithGpoint == 0) - { - // Use x- and y-coordinates; no adjustment for hinting is done. - int mX = m_mAttachWithX + m_mAttachWithXOffset; - int mY = m_mAttachWithY + m_mAttachWithYOffset; - - *pxsAttWithX = ptman->EmToLogUnits(mX); - *pysAttWithY = ptman->EmToLogUnits(mY); - } - else - { - // Look up the actual on-curve point. - int nGpoint = m_nAttachWithGpoint; - if (nGpoint == kGpointZero) - nGpoint = 0; - bool fImpl = ptman->GPointToXY(m_chwGlyphID, nGpoint, pxsAttWithX, pysAttWithY); - - // Debuggers: - //int mXTmpWith = m_mAttachWithX + m_mAttachWithXOffset; - //int mYTmpWith = m_mAttachWithY + m_mAttachWithYOffset; - //int xsAttWithXTmp = ptman->EmToLogUnits(mXTmpWith); - //int ysAttWithYTmp = ptman->EmToLogUnits(mYTmpWith); - //fImpl = false; - - if (!fImpl) - { - // Fall back to using x- and y-coordinates; no adjustment for hinting. - int mX = m_mAttachWithX + m_mAttachWithXOffset; - int mY = m_mAttachWithY + m_mAttachWithYOffset; - *pxsAttWithX = ptman->EmToLogUnits(mX); - *pysAttWithY = ptman->EmToLogUnits(mY); - } - else - { - // Adjust by offsets. - *pxsAttWithX += ptman->EmToLogUnits(m_mAttachWithXOffset); - *pysAttWithY += ptman->EmToLogUnits(m_mAttachWithYOffset); - } - } -} - -/*---------------------------------------------------------------------------------------------- - Return the slot that is 'dislot' slots away from this slot in the given stream. - Only valid for streams that are the input to or output of positioning passes. -----------------------------------------------------------------------------------------------*/ -GrSlotState * GrSlotState::SlotAtOffset(GrSlotStream * psstrm, int dislot) -{ - Assert(psstrm->m_fUsedByPosPass); - return psstrm->SlotAtPosPassIndex(PosPassIndex() + dislot); -} - -/*---------------------------------------------------------------------------------------------- - If the direction level has not been calculated at this point, assume it is the - top direction. This should only happen if there was no bidi pass to set it. - This method should only be called by the positioning passes; it assumes any bidi - pass has been run. -----------------------------------------------------------------------------------------------*/ -int GrSlotState::PostBidiDirLevel(GrTableManager * ptman) -{ - if (m_nDirLevel == -1) - { - Assert(!ptman->HasBidiPass()); - return ptman->TopDirectionLevel(); - } - return m_nDirLevel; -} - -/*---------------------------------------------------------------------------------------------- - Return true if this glyph represents a LRM code. -----------------------------------------------------------------------------------------------*/ -bool GrSlotState::IsLrm() -{ - if (PassModified() == 0) - return (m_nUnicode == knLRM); - return m_pslotPrevState->IsLrm(); -} - -/*---------------------------------------------------------------------------------------------- - Return true if this glyph represents a RLM code. -----------------------------------------------------------------------------------------------*/ -bool GrSlotState::IsRlm() -{ - if (PassModified() == 0) - return (m_nUnicode == knRLM); - return m_pslotPrevState->IsRlm(); -} - - -/*---------------------------------------------------------------------------------------------- - Used by GlyphInfo -----------------------------------------------------------------------------------------------*/ -//float GrSlotOutput::AdvanceX(Segment * pseg) -//{ -// return pseg->EmToLogUnits(m_mAdvanceX); -//} -//float GrSlotOutput::AdvanceY(Segment * pseg) -//{ -// return pseg->EmToLogUnits(m_mAdvanceY); -//} -float GrSlotOutput::MaxStretch(Segment * pseg, int level) -{ - Assert(level == 0); - return (level == 0) ? pseg->EmToLogUnits(m_mJStretch0) : 0; -} -float GrSlotOutput::MaxShrink(Segment * pseg, int level) -{ - Assert(level == 0); - return (level == 0) ? pseg->EmToLogUnits(m_mJShrink0) : 0; -} -float GrSlotOutput::StretchStep(Segment * pseg, int level) -{ - Assert(level == 0); - return (level == 0) ? pseg->EmToLogUnits(m_mJStep0) : 0; -} -int GrSlotOutput::JustWeight(int level) -{ - Assert(level == 0); - return (level == 0) ? m_nJWeight0 : 0; -} -float GrSlotOutput::JustWidth(Segment * pseg, int level) -{ - Assert(level == 0); - return (level == 0) ? pseg->EmToLogUnits(m_mJWidth0) : 0; -} -float GrSlotOutput::MeasureSolLogUnits(Segment * pseg) -{ - return pseg->EmToLogUnits(m_mMeasureSol); -} -float GrSlotOutput::MeasureEolLogUnits(Segment * pseg) -{ - return pseg->EmToLogUnits(m_mMeasureEol); -} - -/*---------------------------------------------------------------------------------------------- - Make a copy of the GrSlotOutput. This is used in making an identical copy of the segment. - Warning: this function will break if GrSlotState and subclasses are given virtual - methods. In that case, we will need to copy from the address of the first variable in - GrSlotAbstract. -----------------------------------------------------------------------------------------------*/ -void GrSlotOutput::ExactCopyFrom(GrSlotOutput * pslout, u_intslot * pnVarLenBuf, int cnExtraPerSlot) -{ - // The chunk of the object from GrSlotAbstract can be copied exactly, - // except for the variable-length buffer. - *this = *pslout; - m_prgnVarLenBuf = pnVarLenBuf; - std::copy(pslout->m_prgnVarLenBuf, pslout->m_prgnVarLenBuf + cnExtraPerSlot, - m_prgnVarLenBuf); - - // Now copy the stuff specific to GrSlotOutput. - m_ichwBeforeAssoc = pslout->m_ichwBeforeAssoc; - m_ichwAfterAssoc = pslout->m_ichwAfterAssoc; - m_cComponents = pslout->m_cComponents; - - m_isloutClusterBase = pslout->m_isloutClusterBase; - m_disloutCluster = pslout->m_disloutCluster; - m_xsClusterXOffset = pslout->m_xsClusterXOffset; - m_xsClusterAdvance = pslout->m_xsClusterAdvance; - m_igbb = pslout->m_igbb; - m_xsAdvanceX = pslout->m_xsAdvanceX; -// m_ysAdvanceY = pslout->m_ysAdvanceY; -// m_rectBB = pslout->m_rectBB; -} - -/*---------------------------------------------------------------------------------------------- - Shift the glyph to the opposite end of the segment. This is needed for white-space-only - segments whose direction is being changed. -----------------------------------------------------------------------------------------------*/ -void GrSlotOutput::ShiftForDirDepthChange(float dxsSegWidth) -{ - float dxsShift = dxsSegWidth - m_xsAdvanceX - (2 * m_xsPositionX); - int tmp; tmp = (int) dxsShift; - m_xsPositionX += dxsShift; -// m_rectBB.left += dxsShift; -// m_rectBB.right += dxsShift; -} - -/*---------------------------------------------------------------------------------------------- - Return the indices of all the glyphs attached to this cluster, in logical order. - Return an empty vector if this glyph is not the base glyph or if there are no - attached glyphs. - This method return glyph indices, not slot indices. -----------------------------------------------------------------------------------------------*/ -void GrSlotOutput::ClusterMembers(Segment * pseg, int isloutThis, std::vector & visloutRet) -{ - if (m_isloutClusterBase == -1 || m_isloutClusterBase == isloutThis) // yes, a base - pseg->ClusterMembersForGlyph(isloutThis, m_disloutCluster, visloutRet); - else - { - Assert(visloutRet.size() == 0); - } -} - -} // namespace gr diff --git a/Build/source/libs/graphite/engine-2.3.1/src/segment/GrSlotState.h b/Build/source/libs/graphite/engine-2.3.1/src/segment/GrSlotState.h deleted file mode 100644 index 83a21bedea4..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/src/segment/GrSlotState.h +++ /dev/null @@ -1,1315 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 1999, 2001 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: GrSlotState.h -Responsibility: Sharon Correll -Last reviewed: Not yet. - -Copyright (C) 1999 by SIL International. All rights reserved. - -Description: - Classes GrSlotAbstract, GrSlotState, and GrSlotOutput -----------------------------------------------------------------------------------------------*/ -#ifdef _MSC_VER -#pragma once -#endif -#ifndef SLOTSTATE_INCLUDED -#define SLOTSTATE_INCLUDED - -namespace gr -{ - -class GrSlotAbstract; -class GrSlotState; -class GrSlotOutput; -class GrSlotStream; -class Font; - -//:End Ignore - - -/*---------------------------------------------------------------------------------------------- - Subsumes GrSlotState and GrSlotOutput, both of which represent a single glyph - and its slot attributes and features. - - Hungarian: slab -----------------------------------------------------------------------------------------------*/ -class GrSlotAbstract -{ - friend class GrSlotStream; - friend class GlyphInfo; - -public: - // Constructor: - GrSlotAbstract() - { - } - - virtual ~GrSlotAbstract() - { - // the table manager is responsible for destroying the contents of m_prgnVarLenBuf - } - - void BasicInitializeAbstract(int cnCompPerLig, u_intslot * pnBuf) - { - m_dirc = kNotYetSet8; - m_lb = kNotYetSet8; - m_fInsertBefore = true; - m_nDirLevel = -1; - - m_bIsSpace = -1; // unknown - - m_fInsertBefore = true; - - m_mMeasureSol = 0; - m_mMeasureEol = 0; - - m_mJStretch0 = 0; - m_mJShrink0 = 0; - m_mJStep0 = 0; - m_nJWeight0 = 0; - m_mJWidth0 = 0; - - m_cnCompPerLig = byte(cnCompPerLig); - m_prgnVarLenBuf = pnBuf; - } - - void CopyAbstractFrom(GrSlotState * pslot); - - void SetBufferPtr(u_intslot * pn) - { - m_prgnVarLenBuf = pn; - } - - gid16 GlyphID() { return m_chwGlyphID; } - gid16 RawActualGlyph() { return m_chwActual; } - virtual float GetGlyphMetric(Font * pfont, int nGlyphMetricID, gid16 chwGlyphID); - -protected: - void GetGlyphMetricAux(Font * pfont, gid16 chwGlyphID, - float & xysGlyphX, float & xysGlyphY, - float & xysGlyphWidth, float & xysGlyphHeight, float & xysAdvX, float & xysAdvY, - sdata8 & bIsSpace); - -public: - - //GrSlotState * CompRefSlot(int i); - - int BreakWeight() - { - return (int)m_lb; - } - DirCode Directionality() - { - return DirCode(int(m_dirc)); - } - int InsertBefore() - { - return m_fInsertBefore; - } - int MeasureSol() - { - return m_mMeasureSol; - } - int MeasureEol() - { - return m_mMeasureEol; - } - - int DirLevel() - { - return m_nDirLevel; - } - - int SpecialSlotFlag() - { - return m_spsl; - } - void SetSpecialSlotFlag(int spsl) - { - m_spsl = sdata8(spsl); - } - - enum { - kNotYetSet = 0x7FFF, - kNotYetSet8 = 0x7F, - kInvalidGlyph = 0xFFFF - }; - - gid16 ActualGlyphForOutput(GrTableManager * ptman); - - // Needed for GlyphInfo: - float XPosition() - { - return m_xsPositionX; - } - float YPosition() - { - return m_ysPositionY; // relative to baseline (positive is up) - } - -protected: - gid16 m_chwGlyphID; - gid16 m_chwActual; // actual glyph to output (which is a different glyph for pseudos) - - sdata8 m_spsl; // special slot flag: LB, bidi marker - -// bool m_fInitialLB; // for LB slots: true if this is the initial LB; - // false if it is the terminating LB - // TODO: remove - - sdata8 m_dirc; // default = kNotYetSet8 (read from glyph attr) - sdata8 m_lb; // default = kNotYetSet8 (read from glyph attr) - - sdata8 m_nDirLevel; - - // Slot attributes that are used by GrSlotOutput: - short m_mMeasureSol; - short m_mMeasureEol; - - unsigned short m_mJStretch0; - unsigned short m_mJShrink0; - unsigned short m_mJStep0; - int m_mJWidth0; - byte m_nJWeight0; - - bool m_fInsertBefore; // default = true - - sdata8 m_bIsSpace; // 0 = false, 1 = true, -1 = unknown - - byte m_cnCompPerLig; - // There is a large block managed by either the GrTableManager (for GrSlotState) - // or the segment (for GrSlotOutput); this variable points at the sub-buffer for this - // particular slot: - u_intslot * m_prgnVarLenBuf; - - float m_xsPositionX; - float m_ysPositionY; - -}; // end of class GrSlotAbstract - - -/*---------------------------------------------------------------------------------------------- - A GrSlotState represents one slot as modified by a pass in the table. - Each time a slot state is modified, a new instance is created, copying the relevant - information. - - Hungarian: slot - - Other hungarian: - m - integer indicating glyph design units ("em-units") - sr - integer indicating slot reference -----------------------------------------------------------------------------------------------*/ -class GrSlotState : public GrSlotAbstract -{ - - friend class GrSlotStream; - friend class FontMemoryUsage; - -public: - enum { kNeutral = 99 }; - - // Constructors: - GrSlotState() - : GrSlotAbstract(), - m_pslotPrevState(NULL) - { - m_vpslotAssoc.clear(); - //m_fInitialLB = false; // TODO: remove - m_spsl = kspslNone; - m_fNeutralAssocs = false; - m_dircProc = kdircUnknown; - m_fDirProcessed = false; - - m_vdislotAttLeaves.clear(); - m_fAttachMod = false; - m_fShiftMod = false; - m_dislotRootFixed = 0; - ZapCompositeMetrics(); - } - - virtual ~GrSlotState() - { - } - - void BasicInitialize(int cnUserDefn, int cnCompPerLig, int cnFeat, u_intslot * pnBuf) - { - BasicInitializeAbstract(cnCompPerLig, pnBuf); - - m_mAdvanceX = kNotYetSet; - m_mAdvanceY = kNotYetSet; - m_mShiftX = 0; - m_mShiftY = 0; - - m_fAdvXSet = false; // for transduction logging - m_fAdvYSet = false; - - m_srAttachTo = 0; - m_nAttachLevel = 0; - - m_mAttachAtX = kNotYetSet; - m_mAttachAtY = 0; - m_nAttachAtGpoint = kNotYetSet; - m_mAttachAtXOffset = 0; - m_mAttachAtYOffset = 0; - m_mAttachWithX = kNotYetSet; - m_mAttachWithY = 0; - m_nAttachWithGpoint = kNotYetSet; - m_mAttachWithXOffset = 0; - m_mAttachWithYOffset = 0; - - m_islotPosPass = kNotYetSet; - - m_cnUserDefn = byte(cnUserDefn); - m_cnFeat = byte(cnFeat); - - m_fHasComponents = false; - - m_xysFontAscent = kNegInfFloat; - m_xysFontDescent = kNegInfFloat; - m_xysGlyphWidth = kNegInfFloat; - m_xysGlyphHeight = kNegInfFloat; - m_xysGlyphX = kNegInfFloat; - m_xysGlyphY = kNegInfFloat; - m_xysAdvX = kNegInfFloat; - m_xysAdvY = kNegInfFloat; - } - - void Initialize(gid16 chw, GrEngine *, GrFeatureValues fval, - int ipass, int ichwSegOffset, int nUnicode = -1); - void Initialize(gid16 chw, GrEngine *, GrSlotState * pslotFeat, - int ipass, int ichwSegOffset); - void Initialize(gid16 chw, GrEngine *, GrSlotState * pslotFeat, - int ipass); - - void InitializeFrom(GrSlotState * pslot, int ipass); - void CopyFeaturesFrom(GrSlotState * pslotSrc); - void FixAttachmentTree(GrSlotState * pslotOld); - - void CopyFrom(GrSlotState * pslot, bool fCopyEverything = true); - - virtual float GetGlyphMetric(Font * pfont, int nGlyphMetricID, gid16 chwGlyphID); - - // General: - int RawSegOffset() { return m_ichwSegOffset; } - - void SetGlyphID(gid16 chw) - { - m_chwGlyphID = chw; - m_chwActual = kInvalidGlyph; - m_xysGlyphWidth = kNegInfFloat; // indicate glyph metrics are invalid - m_ipassFsmCol = -1; - m_colFsm = -1; - } - int PosPassIndex() - { - return m_islotPosPass; - } - void SetPosPassIndex(int islot, bool fInputToPosPass1) - { - // If we're resetting it, it should be to the same value as before: - Assert(fInputToPosPass1 || m_islotPosPass == kNotYetSet || m_islotPosPass == islot); - m_islotPosPass = islot; - } - void IncPosPassIndex() - { - m_islotPosPass++; - } - void ZapPosPassIndex() - { - m_islotPosPass = kNotYetSet; - } - - int StyleIndex() { return m_bStyleIndex; } - - int AttachTo() { return m_srAttachTo; } - int AttachLevel() { return m_nAttachLevel; } - - int RawAttachAtX() { return m_mAttachAtX; } - int AttachAtY() { return m_mAttachAtY; } - int AttachAtGpoint() { return m_nAttachAtGpoint; } - int AttachAtXOffset() { return m_mAttachAtXOffset; } - int AttachAtYOffset() { return m_mAttachAtYOffset; } - - int RawAttachWithX() { return m_mAttachWithX; } - int AttachWithY() { return m_mAttachWithY; } - int AttachWithGpoint() { return m_nAttachWithGpoint; } - int AttachWithXOffset() { return m_mAttachWithXOffset; } - int AttachWithYOffset() { return m_mAttachWithYOffset; } - - void Associate(GrSlotState *); - void Associate(GrSlotState *, GrSlotState *); - void Associate(std::vector &); - void ClearAssocs(); - - int AssocsSize() { return m_vpslotAssoc.size(); } - GrSlotState * RawBeforeAssocSlot() - { - if (m_vpslotAssoc.size() == 0) - return NULL; - return m_vpslotAssoc[0]; - } - GrSlotState * RawAfterAssocSlot() - { - if (m_vpslotAssoc.size() == 0) - return NULL; - return m_vpslotAssoc.back(); - } - GrSlotState * AssocSlot(int i) { return m_vpslotAssoc[i]; } - - void AllAssocs(std::vector & vichw); - int BeforeAssoc(); - int AfterAssoc(); - - void CleanUpAssocs(); - - void SetComponentRefsFor(GrSlotOutput *, int iComp = -1); - void AllComponentRefs(std::vector & vichw, std::vector & vicomp, int iComponent = -1); - - int PassModified() { return m_ipassModified; } - int SegOffset(); - int UnderlyingPos(); - GrSlotState * PrevState() { return m_pslotPrevState; } - - void MarkDeleted() // for now, do nothing - { - } - - int IsSpace(GrTableManager * ptman); - - // TODO: remove argument from these methods; it is no longer needed. - bool IsLineBreak(gid16 chwLB) - { - return (IsInitialLineBreak(chwLB) || IsFinalLineBreak(chwLB)); - //return (m_chwGlyphID == chwLB); // TODO: remove - } - bool IsInitialLineBreak(gid16 chwLB) - { - return (m_spsl == kspslLbInitial); - //return (IsLineBreak(chwLB) && m_fInitialLB == true); // TODO: remove - } - bool IsFinalLineBreak(gid16 chwLB) - { - return (m_spsl == kspslLbFinal); - //return (IsLineBreak(chwLB) && m_fInitialLB == false); // TODO: remove - } - - bool IsBidiMarker() - { - switch (m_spsl) - { - case kspslLRM: - case kspslRLM: - case kspslLRO: - case kspslRLO: - case kspslLRE: - case kspslRLE: - case kspslPDF: - return true; - default: - return false; - } - return false; - } - - bool HasComponents() { return m_fHasComponents; } - - // Directionality as determined by the bidi algorithm - DirCode DirProcessed() // return the value - { - Assert(m_dirc != kNotYetSet8); - if (m_dircProc == kdircUnknown) - m_dircProc = DirCode(m_dirc); - return m_dircProc; - } - void SetDirProcessed(DirCode dirc) // set the directionality - { - m_dircProc = dirc; - } - bool DirHasBeenProcessed() // has this slot been fully processed? - { - return m_fDirProcessed; - } - void MarkDirProcessed() // this slot has been fully processed - { - m_fDirProcessed = true; - } - - int RawAdvanceX() { return m_mAdvanceX; } - int RawAdvanceY() { return m_mAdvanceY; } - int ShiftX() { return m_mShiftX; } - int ShiftY() { return m_mShiftY; } - - // Slot attributes that must be calculated: - - int AdvanceX(GrTableManager * ptman) - { - if (m_mAdvanceX == kNotYetSet) - // Initialize it from the glyph metric (adjusted for hinting). - m_mAdvanceX = short(GlyphMetricEmUnits(ptman, kgmetAdvWidth)); - return m_mAdvanceX; - } - - int AdvanceY(GrTableManager * ptman) - { - if (m_mAdvanceY == kNotYetSet) - // Initialize it from the glyph metric (adjusted for hinting). - m_mAdvanceY = short(GlyphMetricEmUnits(ptman, kgmetAdvHeight)); - return m_mAdvanceY; - } - - int AttachAtX(GrTableManager * ptman, GrSlotStream * psstrm) - { - if (m_mAttachAtX == kNotYetSet) - { - Assert(false); // Should have already been set in HandleModifiedPosition, - // but just in case... - if (m_srAttachTo == 0) - return 0; - else - m_mAttachAtX = short(AttachRoot(psstrm)->AdvanceX(ptman)); // attach on the right - } - return m_mAttachAtX; - } - - int AttachWithX(GrTableManager * ptman, GrSlotStream * psstrm) - { - if (m_mAttachAtX == kNotYetSet) - { - Assert(false); // Should have already been set in HandleModifiedPosition, - // but just in case. - if (!m_srAttachTo == 0) - return 0; - else - m_mAttachAtX = 0; // attach on the right - } - return m_mAttachAtX; - } - - int JStretch() - { - return m_mJStretch0; - } - int JShrink() - { - return m_mJShrink0; - } - int JStep() - { - return m_mJStep0; - } - int JWeight() - { - return m_nJWeight0; - } - int JWidth() - { - return m_mJWidth0; - } - - // Slot attribute setters: - - void SetAdvanceX(int mVal) - { - Assert(mVal < 0xFFFF); m_mAdvanceX = short(mVal & 0xFFFF); m_fShiftMod = true; - m_fAdvXSet = true; // for transduction logging - } - void SetAdvanceY(int mVal) - { - Assert(mVal < 0xFFFF); m_mAdvanceY = short(mVal & 0xFFFF); m_fShiftMod = true; - m_fAdvYSet = true; // for transduction logging - } - void SetShiftX(int mVal) - { - Assert(mVal < 0xFFFF); m_mShiftX = short(mVal & 0xFFFF); - m_fShiftMod = true; - } - void SetShiftY(int mVal) - { - Assert(mVal < 0xFFFF); m_mShiftY = short(mVal & 0xFFFF); - m_fShiftMod = true; - } - - void SetAttachTo(int srVal) - { - Assert(srVal < 0xFFFF); - m_srAttachTo = short(srVal & 0xFFFF); - m_fAttachMod = true; - } - void SetAttachLevel(int nVal) { - Assert(nVal < 0xFFFF); m_nAttachLevel = short(nVal & 0xFFFF); m_fAttachMod = true; } - - void SetAttachAtX(int mVal) - { - Assert(mVal < 0xFFFF); - m_mAttachAtX = short(mVal) & 0xFFFF; - m_fAttachMod = true; - } - void SetAttachAtY(int mVal) { - Assert(mVal < 0xFFFF); m_mAttachAtY = short(mVal & 0xFFFF); m_fAttachMod = true; } - void SetAttachAtGpoint(int nVal) { - m_nAttachAtGpoint = short(nVal); m_fAttachMod = true; } - void SetAttachAtXOffset(int mVal) { - Assert(mVal < 0xFFFF); m_mAttachAtXOffset = short(mVal & 0xFFFF); m_fAttachMod = true; } - void SetAttachAtYOffset(int mVal) { - Assert(mVal < 0xFFFF); m_mAttachAtYOffset = short(mVal & 0xFFFF); m_fAttachMod = true; } - - void SetAttachWithX(int mVal) { - Assert(mVal < 0xFFFF); m_mAttachWithX = short(mVal & 0xFFFF); m_fAttachMod = true; } - void SetAttachWithY(int mVal) { - Assert(mVal < 0xFFFF); m_mAttachWithY = short(mVal & 0xFFFF); m_fAttachMod = true; } - void SetAttachWithGpoint(int nVal) { - m_nAttachWithGpoint = short(nVal); m_fAttachMod = true; } - void SetAttachWithXOffset(int mVal) { - Assert(mVal < 0xFFFF); m_mAttachWithXOffset = short(mVal & 0xFFFF); m_fAttachMod = true; } - void SetAttachWithYOffset(int mVal) { - Assert(mVal < 0xFFFF); m_mAttachWithYOffset = short(mVal & 0xFFFF); m_fAttachMod = true; } - - void SetCompRefSlot(GrTableManager * ptman, int i, GrSlotState * pslotComp); - - void SetBreakWeight(int lb) { m_lb = sdata8(lb); } - void SetInsertBefore(bool f) { m_fInsertBefore = f; } - - void SetDirectionality(DirCode dirc) { m_dirc = sdata8(dirc); } - void SetDirLevel(int n) { m_nDirLevel = sdata8(n); } - - void SetMeasureSol(int mVal) { m_mMeasureSol = short(mVal); } - void SetMeasureEol(int mVal) { m_mMeasureEol = short(mVal); } - - void SetJStretch(int mVal) { m_mJStretch0 = short(mVal); } - void SetJShrink(int mVal) { m_mJShrink0 = short(mVal); } - void SetJStep(int mVal) { m_mJStep0 = short(mVal); } - void SetJWeight(int nVal) { m_nJWeight0 = byte(nVal); } - void SetJWidth(int mVal) { m_mJWidth0 = mVal; } - void AddJWidthToAdvance(GrTableManager * ptman) - { - // Don't change m_fShiftMod. - m_mAdvanceX = short(m_mJWidth0 + AdvanceX(ptman)); // make sure it is calculated - m_mJWidth0 = 0; - m_fAdvXSet = true; // for transduction logging - } - - int PostBidiDirLevel(GrTableManager * ptman); - - bool BaseEarlierInStream(); - - void ZapDirLevel() - { - m_nDirLevel = -1; - m_dircProc = kdircUnknown; - m_fDirProcessed = false; - } - - int GlyphAttrValueEmUnits(GrTableManager * ptman, int nAttrID); - int GlyphMetricEmUnits(GrTableManager * ptman, int nGlyphMetricID); - - float GlyphAttrValueLogUnits(GrTableManager * ptman, int nAttrID); - float GlyphMetricLogUnits(GrTableManager * ptman, int nGlyphMetricID); - -// void HandleModifiedCluster(GrTableManager * ptman, -// GrSlotStream * psstrm, int islotThis); - void HandleModifiedPosition(GrTableManager * ptman, - GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, int islotThis); - - void CalcCompositeMetrics(GrTableManager * ptman, GrSlotStream * psstrm, - int nLevel, bool fThorough = false); - - void Position(GrTableManager * ptman, - GrSlotStream * psstrmOut, int * pmXPos, int * pmYPos); - - void ZapPosition() - { - m_xsPositionX = kNegInfFloat; - m_ysPositionY = kNegInfFloat; - } - - void SetXPos(float xs) - { - m_xsPositionX = xs; - } - void SetYPos(float ys) - { - m_ysPositionY = ys; // relative to baseline (positive is up) - } - - float ClusterRootOffset() { return -m_xsClusterXOffset; } // the offset of the root - // relative to the whole cluster - - float ClusterAdvWidthFrom(float xs) { return xs + m_xsClusterAdv; } - float ClusterBbLeftFrom(float xs) { return xs + m_xsClusterBbLeft; } - float ClusterBbRightFrom(float xs) { return xs + m_xsClusterBbRight; } - - float ClusterLsb(GrSlotStream * psstrm, float xs) - { - return ClusterBbLeft(psstrm) + xs; - } - float ClusterRsb(GrSlotStream * psstrm, float xs) - { - return ClusterAdvWidthFrom(xs) - ClusterBbRightFrom(xs); - } - - float ClusterAdvWidth(GrSlotStream * psstrm) - { - return ClusterAdvWidthFrom(Base(psstrm)->ClusterRootOffset()); - } -// int ClusterAdvHeight(GrSlotStream * psstrm) -// { -// Assert(m_mAdvanceY != kNotYetSet); -// return EmUnitsToTwips(m_mAdvanceY); -// } - float ClusterBbLeft(GrSlotStream * psstrm) - { - return ClusterBbLeftFrom(Base(psstrm)->ClusterRootOffset()); - } - float ClusterBbRight(GrSlotStream * psstrm) - { - return ClusterBbRightFrom(Base(psstrm)->ClusterRootOffset()); - } - float ClusterBbTop(GrSlotStream * psstrm) - { - return m_ysClusterBbTop; - } - float ClusterBbBottom(GrSlotStream * psstrm) - { - return m_ysClusterBbBottom; - } - float ClusterBbWidth(GrSlotStream * psstrm) - { - return m_xsClusterBbRight - m_xsClusterBbLeft + 1; - } - float ClusterBbHeight(GrSlotStream * psstrm) - { - return m_ysClusterBbTop - m_ysClusterBbBottom + 1; - } - float ClusterLsb(GrSlotStream * psstrm) - { - return ClusterBbLeft(psstrm); - } - float ClusterRsb(GrSlotStream * psstrm) - { - return ClusterAdvWidth(psstrm) - ClusterBbRight(psstrm); - } - - float GlyphXOffset(GrSlotStream * psstrm, float fakeItalicRatio = 0); - float GlyphYOffset(GrSlotStream * psstrm = NULL); - - bool IsBase() - { - Assert(m_dislotRootFixed == m_srAttachTo); - return (m_dislotRootFixed == 0); - } - - bool HasClusterMembers() - { - return (m_vdislotAttLeaves.size() > 0); - } - - GrSlotState * AttachRoot(GrSlotStream * psstrm) - { - if (m_srAttachTo == 0) - return NULL; - else - return SlotAtOffset(psstrm, m_srAttachTo); - } - - int AttachRootPosPassIndex() - { - return PosPassIndex() + m_srAttachTo; - } - - GrSlotState * Base(GrSlotStream * psstrm) - { - GrSlotState * pslotRoot = AttachRoot(psstrm); - if (!pslotRoot) - return this; - else - return pslotRoot->Base(psstrm); - } - - int LastLeafOffset(GrSlotStream * psstrm); - - void AddLeaf(int dislot) - { - m_vdislotAttLeaves.push_back(dislot * -1); - } - void RemoveLeaf(int dislot) - { - for (size_t iislot = 0; iislot < m_vdislotAttLeaves.size(); iislot++) - { - if (m_vdislotAttLeaves[iislot] == dislot * -1) - { - m_vdislotAttLeaves.erase(m_vdislotAttLeaves.begin() + iislot); - return; - } - } - Assert(false); - } - - bool HasAsRoot(GrSlotStream * psstrm, GrSlotState * pslot) - { - GrSlotState * pslotRoot = AttachRoot(psstrm); - if (pslotRoot == pslot) - return true; - else if (pslotRoot == NULL) - return false; - else - return pslotRoot->HasAsRoot(psstrm, pslot); - } - - bool HasAsPreviousState(GrSlotState * pslot) - { - if (this == pslot) - return true; - else - return m_pslotPrevState->HasAsPreviousState(pslot); - } - - void EnsureCacheForOutput(GrTableManager * ptman); - - bool IsLrm(); - bool IsRlm(); - - // Cache of FSM column information for the most recent pass: - int FsmColumn() { return m_colFsm; } - int PassNumberForColumn() { return m_ipassFsmCol; } - void CacheFsmColumn(int ipass, int col) - { - m_colFsm = col; - m_ipassFsmCol = ipass; - } - - // Variable-length buffer--includes four sub-buffers: - // * user-defined variables - // * component.???.ref assignments - // * mapping from components used to global attribute IDs for components - // * feature values - - // user-defined slot attributes - int UserDefn(int slati) - { - Assert(slati < m_cnUserDefn); - return m_prgnVarLenBuf[slati].nValue; - } - void SetUserDefn(int slati, int nVal) - { - Assert(slati < m_cnUserDefn); - m_prgnVarLenBuf[slati].nValue = nVal; - } - u_intslot * PUserDefnBuf() - { - return m_prgnVarLenBuf; - } - - // pointer to the associated slot which is the value of the comp.ref attribute - GrSlotState * CompRef(int slati) - { - Assert(slati < m_cnCompPerLig); - return m_prgnVarLenBuf[m_cnUserDefn + slati].pslot; - } - void SetCompRef(int slati, GrSlotState * pvSlot) - { - Assert(slati < m_cnCompPerLig); - m_prgnVarLenBuf[m_cnUserDefn + slati].pslot = pvSlot; - } - u_intslot * PCompRefBuf() - { - return m_prgnVarLenBuf + m_cnUserDefn; - } - - // global component identifier - int Slati(int i) - { - Assert(i < m_cnCompPerLig); - return m_prgnVarLenBuf[m_cnUserDefn + m_cnCompPerLig + i].nValue; - } - void SetSlati(int i, int n) - { - Assert(i < m_cnCompPerLig); - m_prgnVarLenBuf[m_cnUserDefn + m_cnCompPerLig + i].nValue = n; - } - u_intslot * PSlatiBuf() - { - return m_prgnVarLenBuf + m_cnUserDefn + m_cnCompPerLig; - } - - // feature settings - int FeatureValue(int i) - { - Assert(i < m_cnFeat); - return m_prgnVarLenBuf[m_cnUserDefn + (m_cnCompPerLig * 2) + i].nValue; - } - - u_intslot * PFeatureBuf() - { - return m_prgnVarLenBuf + m_cnUserDefn + (m_cnCompPerLig * 2); - } - - int CExtraSpace() - { - return m_cnUserDefn + (m_cnCompPerLig * 2) + m_cnFeat; - } - - GrSlotState * CompRefSlot(int i); - - void GetFeatureValues(GrFeatureValues * pfval) - { - pfval->m_nStyleIndex = m_bStyleIndex; - std::fill(pfval->m_rgnFValues, pfval->m_rgnFValues + kMaxFeatures, 0); - for (size_t i = 0; i < m_cnFeat; i++) - pfval->m_rgnFValues[i] = PFeatureBuf()[i].nValue; - } - -// For transduction logging: -#ifdef TRACING - void SlotAttrsModified(bool * rgfMods, bool fPreJust, int * pccomp, int * pcassoc); - void LogSlotAttribute(GrTableManager *, std::ostream &, int ipass, int slat, int icomp, - bool fPreJust, bool fPostJust); - void LogAssociation(GrTableManager * ptman, - std::ostream & strmOut, int ipass, int iassoc, bool fBoth, bool fAfter); - int m_islotTmpIn; // for use by transduction log; index of slot in input stream - int m_islotTmpOut; // ditto; index of slot in output stream -#endif // TRACING - -protected: - - // Instance variables: - int m_ipassModified; // pass in which this slot was modified - - GrSlotState * m_pslotPrevState; - - int m_ichwSegOffset; // for original (pass 0) slot states: position in - // underlying text relative to the official - // beginning of the segment; - // should == kInvalid for other slot states - int m_islotPosPass; // index of slot in positioning streams, relative to first official - // slot in the segment (possibly the LB slot) - - int m_colFsm; // which FSM column this glyph corresponds to... - int m_ipassFsmCol; // ...for the most recent pass - - std::vector m_vpslotAssoc; // association mappings - - bool m_fNeutralAssocs; // true if we've set the associations to some neutral - // default, rather than them being set explicitly - // within a rule - - int m_nUnicode; // for debugging - - DirCode m_dircProc; // directionality as processed in bidi algorithm - bool m_fDirProcessed; - - // affects length of variable-length buffer - byte m_cnUserDefn; - byte m_cnFeat; - - byte m_bStyleIndex; - - // Slot attributes: - short m_mAdvanceX; - short m_mAdvanceY; - short m_mShiftX; - short m_mShiftY; - - short m_srAttachTo; - short m_nAttachLevel; - - short m_mAttachAtX; - short m_mAttachAtY; - short m_mAttachAtXOffset; - short m_mAttachAtYOffset; - short m_mAttachWithX; - short m_mAttachWithY; - short m_mAttachWithXOffset; - short m_mAttachWithYOffset; - - short m_nAttachAtGpoint; - short m_nAttachWithGpoint; - - // Raw glyph metrics (directly from font) - float m_xysFontAscent; - float m_xysFontDescent; - float m_xysGlyphWidth; - float m_xysGlyphHeight; - float m_xysGlyphX; - float m_xysGlyphY; - float m_xysAdvX; - float m_xysAdvY; - - // Attachment and metrics - - // This is a flag that is set whenever we change the value of any of the attach - // slot attributes. Then when we want to find out something about the attachments, - // if it is set, we have some work to do in updating the pointers and metrics. - bool m_fAttachMod; - - // This is a flag that is set whenever we change the value of any of the shift or - // advance slot attributes. It forces us to zap the metrics. - bool m_fShiftMod; - - // This glyph (and all its leaves, if any) have a zero advance width; - // never allow it to affect the advance width of a cluster it is part of. - bool m_fIgnoreAdvance; - - int m_dislotRootFixed; // the offset of the slot (relative to this one) that considers - // this slot to be one of its leaves - std::vector m_vdislotAttLeaves; - - // The following are used by the CalcCompositeMetrics() method and depend on - // the cluster level that was passed as an argument. - - int m_nCompositeLevel; // cluster level last used to calculate composite metrics; - // kNegInfinity if uncalculated - - // offsets for this node only, relative to cluster base - float m_xsOffsetX; - float m_ysOffsetY; // relative to baseline (positive is up) - - // offsets for this node and its leaves, relative to cluster base (y-coords are - // relative to baseline) - float m_xsClusterXOffset; - float m_xsClusterAdv; - float m_xsClusterBbLeft; - float m_xsClusterBbRight; - float m_ysClusterBbTop; - float m_ysClusterBbBottom; - - // cumulative total of shifts for this node and roots; advance needs to ignore these - float m_xsRootShiftX; - float m_ysRootShiftY; - - bool m_fHasComponents; // default = false - - // Private methods: - - void CopyAbstractFrom(GrSlotState * pslot); - - void AdjustRootMetrics(GrTableManager * ptman, GrSlotStream *); - void InitMetrics(GrTableManager * ptman, GrSlotState * pslotRoot); - void InitLeafMetrics(GrTableManager * ptman, GrSlotState * pslotRoot); - void InitRootMetrics(GrTableManager * ptman); - void CalcRootMetrics(GrTableManager * ptman, GrSlotStream *, int nLevel); - void AttachToRoot(GrTableManager * ptman, GrSlotStream *, GrSlotState * pslotNewRoot); - void AttachLogUnits(GrTableManager * ptman, - GrSlotState * pslotRoot, - float * pxsAttAtX, float * pysAttAtY, - float * pxsAttWithX, float * pysAttWithY); - - GrSlotState * SlotAtOffset(GrSlotStream * psstrm, int dislot); // ENHANCE SharonC: inline? - - void EnsureLocalAttachmentTree(GrTableManager * ptman, - GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, int islotThis); - - void ZapCompositeMetrics() - { - m_nCompositeLevel = kNegInfinity; - m_xsPositionX = kNegInfFloat; - m_ysPositionY = kNegInfFloat; - m_xsOffsetX = 0; - m_ysOffsetY = 0; - m_xsRootShiftX = 0; - m_ysRootShiftY = 0; - ZapRootMetrics(); - } - - void ZapRootMetrics() - { - m_xsClusterXOffset = 0; - m_xsClusterAdv = 0; - m_xsClusterBbLeft = 0; - m_xsClusterBbRight = 0; - m_ysClusterBbTop = 0; - m_ysClusterBbBottom = 0; - m_fIgnoreAdvance = false; - } - - void ZapMetricsAndPositionDownToBase(GrSlotStream * psstrm) - { - ZapCompositeMetrics(); - if (m_dislotRootFixed) - SlotAtOffset(psstrm, m_dislotRootFixed)->ZapMetricsAndPositionDownToBase(psstrm); - } - - void ZapMetricsOfLeaves(GrSlotStream * psstrm, bool fThis = false) - { - if (fThis) - ZapCompositeMetrics(); - for (size_t islot = 0; islot < m_vdislotAttLeaves.size(); islot++) - { - SlotAtOffset(psstrm, m_vdislotAttLeaves[islot])->ZapMetricsOfLeaves(psstrm, true); - } - } - -public: // for transduction logging - bool m_fAdvXSet; - bool m_fAdvYSet; - -}; // end of class GrSlotState - - -/*---------------------------------------------------------------------------------------------- - A GrSlotOutput represents one slot as the final output of the final pass. These - are recorded in the segment. - - Hungarian: slout -----------------------------------------------------------------------------------------------*/ -class GrSlotOutput : public GrSlotAbstract -{ - friend class GlyphInfo; - friend class Segment; - friend class SegmentMemoryUsage; - -public: - GrSlotOutput() - { - m_cComponents = 0; - m_isloutClusterBase = -1; // not part of any cluster - m_disloutCluster = 0; - m_igbb = -1; - } - - void ExactCopyFrom(GrSlotOutput * pslout, u_intslot * pnVarLenBuf, int cnExtraPerSlot); - - void InitializeOutputFrom(GrSlotState * pslot); - - int BeforeAssoc() - { - return m_ichwBeforeAssoc; // relative to the official beginning of the segment - } - int AfterAssoc() - { - return m_ichwAfterAssoc; // relative to the official beginning of the segment - } - - void SetBeforeAssoc(int ichw) - { - m_ichwBeforeAssoc = ichw; - } - void SetAfterAssoc(int ichw) - { - m_ichwAfterAssoc = ichw; - } - - //u_intslot * PCompRefBufSlout() - //{ - // return m_prgnVarLenBuf; - //} - int CExtraSpaceSlout() - { - return (m_cnCompPerLig * 2); - } - - int IbufUnderlyingCompOffset() - { - return 0; - } - int IbufCompIdOffset() - { - return m_cnCompPerLig; - } - - void AddComponentReference(int ichw, int slati) - { - short ichw16 = short(ichw); - if (m_cComponents >= m_cnCompPerLig) - { - Assert(false); // too many--ignore the requested component ref - } - else - { - int iComp; - for (iComp = 0; iComp < m_cComponents; iComp++) - { - if (ComponentId(iComp) == slati) - { - // We already have at least one character for this component. Add another. - if (m_prgnVarLenBuf[IbufUnderlyingCompOffset() + iComp].smallint[0] > ichw16) - m_prgnVarLenBuf[IbufUnderlyingCompOffset() + iComp].smallint[0] = ichw16; // min - if (m_prgnVarLenBuf[IbufUnderlyingCompOffset() + iComp].smallint[1] < ichw16) - m_prgnVarLenBuf[IbufUnderlyingCompOffset() + iComp].smallint[1] = ichw16; // max - return; - } - } - - iComp = m_cComponents; - - m_prgnVarLenBuf[IbufUnderlyingCompOffset() + iComp].smallint[0] = ichw16; // min - m_prgnVarLenBuf[IbufUnderlyingCompOffset() + iComp].smallint[1] = ichw16; // max - - // OBSOLETE comment: - // Maps the used components to the defined components. Normally this will be - // one-to-one and the buffer will hold [0,1,2...]. But possibly we may - // have defined components a, b, and c, but only mapped a and c to actual - // characters. This buffer will then hold [0,2]. - - m_prgnVarLenBuf[IbufCompIdOffset() + iComp].nValue = slati; - -// Assert(iComp >= m_cComponents); // because we process them in order they are defined - // in, but we could have skipped some that are - // defined - m_cComponents++; - } - } - int NumberOfComponents() // the number used by the rules - { - return m_cComponents; - } - // Index of ligature components, relative to the beginning of the segment. - // iComp is index of components USED in this glyph. - int FirstUnderlyingComponent(int iComp) - { - Assert(iComp < m_cnCompPerLig); - int ichw = m_prgnVarLenBuf[IbufUnderlyingCompOffset() + iComp].smallint[0]; - return ichw; - } - int LastUnderlyingComponent(int iComp) - { - Assert(iComp < m_cnCompPerLig); - int ichw = m_prgnVarLenBuf[IbufUnderlyingCompOffset() + iComp].smallint[1]; - return ichw; - } - int ComponentId(int iComp) - { - return m_prgnVarLenBuf[IbufCompIdOffset() + iComp].nValue; - } - - void SetClusterBase(int islout) - { - m_isloutClusterBase = islout; - } - - int ClusterBase() - { - return m_isloutClusterBase; - } - - bool IsPartOfCluster() - { - return (m_isloutClusterBase > -1); - } - - //int NumClusterMembers() - //{ - // return m_visloutClusterMembers.size(); - //} - //int ClusterMember(int iislout) - //{ - // return m_visloutClusterMembers[iislout]; - //} - - void AddClusterMember(int isloutThis, int isloutAttached) - { - m_disloutCluster = sdata8(max(int(m_disloutCluster), abs(isloutThis - isloutAttached))); - } - - void ClusterMembers(Segment * pseg, int islout, std::vector & visloutRet); - - int ClusterRange() - { - return m_disloutCluster; - } - - float ClusterXOffset() { return m_xsClusterXOffset; } - float ClusterAdvance() { return m_xsClusterAdvance; } - void SetClusterXOffset(float xs) { m_xsClusterXOffset = xs; } - void SetClusterAdvance(float xs) { m_xsClusterAdvance = xs; } - - float GlyphMetricLogUnits(Font * pfont, int nGlyphMetric); - //float GlyphMetricLogUnits(int nMetricID); - - int GlyphBbIndex() { return m_igbb; } - void SetGlyphBbIndex (int i) { m_igbb = i; } - - Rect BoundingBox(Font & font) - { - Rect rectBB; - rectBB.left = m_xsPositionX + GlyphMetricLogUnits(&font, kgmetBbLeft); - if (IsSpace()) - rectBB.right = m_xsPositionX + GlyphMetricLogUnits(&font, kgmetAdvWidth); - else - rectBB.right = m_xsPositionX + GlyphMetricLogUnits(&font, kgmetBbRight); - rectBB.top = m_ysPositionY + GlyphMetricLogUnits(&font, kgmetBbTop); - rectBB.bottom = m_ysPositionY + GlyphMetricLogUnits(&font, kgmetBbBottom); - return rectBB; - } - - bool IsLineBreak() - { - return (IsInitialLineBreak() || IsFinalLineBreak()); - } - bool IsInitialLineBreak() - { - return (m_spsl == kspslLbInitial); - } - bool IsFinalLineBreak() - { - return (m_spsl == kspslLbFinal); - } - - //float AdvanceXMetric() - //{ - // return m_xysAdvX; - //} - - bool IsSpace(); - - void AdjustPosXBy(float dxs) - { - m_xsPositionX += dxs; - //m_rectBB.left += dxs; - //m_rectBB.right += dxs; - } - - void ShiftForDirDepthChange(float dxsSegWidth); - - // Used by GlyphInfo - int IndexAttachedTo(); - //inline float AdvanceX(Segment * pseg); - //inline float AdvanceY(Segment * pseg); - float MaxStretch(Segment * pseg, int level); - float MaxShrink(Segment * pseg, int level); - float StretchStep(Segment * pseg, int level); - int JustWeight(int level); - float JustWidth(Segment * pseg, int level); - float MeasureSolLogUnits(Segment * pseg); - float MeasureEolLogUnits(Segment * pseg); - Rect ComponentRect(Segment * pseg, int icomp); - -protected: - // Instance variables: - - sdata8 m_cComponents; - - data8 m_disloutCluster; // how far to search on either side of this glyph to find - // other members of the cluster; - // 0 means there are no cluster members or this glyph is - // attached to some other base - - int m_isloutClusterBase; // the index of the slot that serves as the base for the - // cluster this slot is a part of; -1 if not part of cluster - - int m_ichwBeforeAssoc; // index of associated character(s) in the string - int m_ichwAfterAssoc; // (relative to the official beginning of the segment) - // char might possibly not be officially in this segment, - // in which case value is infinity - - // Measurements for highlighting an entire cluster, relative to origin of this slot, - // which is the cluster base. - float m_xsClusterXOffset; - float m_xsClusterAdvance; // for single non-cluster glyphs, advance width of positioned glyph - - // Index into m_prggbb in Segment; -1 indicates a line break slot that is not rendered: - int m_igbb; - - float m_xsAdvanceX; -// float m_ysAdvanceY; -- not used -// Rect m_rectBB; - -}; // end of class GrSlotOutput - -} // namespace gr - - -#endif // !SLOTSTATE_INCLUDED diff --git a/Build/source/libs/graphite/engine-2.3.1/src/segment/GrSlotStream.cpp b/Build/source/libs/graphite/engine-2.3.1/src/segment/GrSlotStream.cpp deleted file mode 100644 index df1a73e5e3e..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/src/segment/GrSlotStream.cpp +++ /dev/null @@ -1,2381 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 1999, 2001 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: GrSlotStream.cpp -Responsibility: Sharon Correll -Last reviewed: Not yet. - -Description: - GrSlotStream class implementation. -----------------------------------------------------------------------------------------------*/ - -//:>******************************************************************************************** -//:> Include files -//:>******************************************************************************************** -#include "Main.h" - -#include "GrConstants.h" - -#ifdef _MSC_VER -#pragma hdrstop -#endif -#undef THIS_FILE -DEFINE_THIS_FILE - -//:End Ignore - -//:>******************************************************************************************** -//:> Forward declarations -//:>******************************************************************************************** - -//:>******************************************************************************************** -//:> Local Constants and static variables -//:>******************************************************************************************** - -namespace gr -{ - -//:>******************************************************************************************** -//:> Methods -//:>******************************************************************************************** - -/*---------------------------------------------------------------------------------------------- - Answer true if there is nothing valid available to read from the stream. -----------------------------------------------------------------------------------------------*/ -bool GrSlotStream::AtEnd() -{ - Assert(AssertValid()); - - if (m_islotReprocPos > -1 && m_islotReprocPos < signed(m_vpslotReproc.size())) - return false; - - if (m_islotSegLim > -1 && m_islotReadPos >= m_islotSegLim) - // We've determined the segment limit, and we're at or past it. - return true; - - return (m_islotReadPos == m_islotWritePos); -} - -/*---------------------------------------------------------------------------------------------- - Answer true if there is nothing at all available to read from the stream. - For substitution passes, we need to consider slots that may be beyond what we know - will be the official end of the segment. -----------------------------------------------------------------------------------------------*/ -bool GrSlotStream::AtEndOfContext() -{ - if (m_fUsedByPosPass) - return AtEnd(); - - if (m_islotReprocPos > -1 && m_islotReprocPos < signed(m_vpslotReproc.size())) - return false; - - return (m_islotReadPos == m_islotWritePos); -} - -/*---------------------------------------------------------------------------------------------- - Append a slot to the end of the stream. -----------------------------------------------------------------------------------------------*/ -void GrSlotStream::NextPut(GrSlotState * pslot) -{ - Assert(AssertValid()); - - if (m_islotWritePos < signed(m_vpslot.size())) - { - m_vpslot[m_islotWritePos] = pslot; - } - else - { - m_vpslot.push_back(pslot); - m_vislotPrevChunkMap.push_back(-1); - m_vislotNextChunkMap.push_back(-1); - } - - if (m_fUsedByPosPass && GotIndexOffset()) - pslot->SetPosPassIndex(m_islotWritePos - m_cslotPreSeg, m_fInputToPosPass1); - - m_islotWritePos++; -} - -/*---------------------------------------------------------------------------------------------- - Get the next slot from the stream. -----------------------------------------------------------------------------------------------*/ -GrSlotState * GrSlotStream::NextGet() -{ - Assert(AssertValid()); - Assert(!AtEndOfContext()); - - GrSlotState * pslotRet; - - if (m_islotReprocPos > -1) - { - if (m_islotReprocPos >= signed(m_vpslotReproc.size())) - { - // Finished reprocessing. - Assert((unsigned)m_islotReprocPos == m_vpslotReproc.size()); - m_islotReprocPos = -1; - // But leave the m_vpslotReproc array in place so that earlier slots can - // be accessed by the rules. - pslotRet = m_vpslot[m_islotReadPos]; - m_islotReadPos++; - } - else - { - // Read from the reprocess buffer. - pslotRet = m_vpslotReproc[m_islotReprocPos]; - m_islotReprocPos++; - } - } - else - { - // Read normally. - pslotRet = m_vpslot[m_islotReadPos]; - m_islotReadPos++; - } - - Assert(!m_fUsedByPosPass || pslotRet->PosPassIndex() != GrSlotAbstract::kNotYetSet); - - return pslotRet; -} - -/*--------------------------------------------------------------------------------------------- - Peek at the next slot from the stream (dislot = 0 means the very next slot). - Only used for peeking forward. RuleInputSlot is used for accessing any possible - slot in the rule's context. -----------------------------------------------------------------------------------------------*/ -GrSlotState * GrSlotStream::Peek(int dislot) -{ - Assert(AssertValid()); - Assert(!AtEndOfContext()); - Assert(dislot >= 0); - - GrSlotState * pslotRet; - - if (m_islotReprocPos > -1) - { - int cslotReproc = m_vpslotReproc.size() - m_islotReprocPos; // num left in reproc buffer - if (dislot >= cslotReproc) - { - // Not quite enough slots in the reprocess buffer. - pslotRet = m_vpslot[m_islotReadPos + dislot - cslotReproc]; - } - else if (m_islotReprocPos + dislot < 0) - { - // Reading prior to the reprocess buffer - pslotRet = m_vpslot[m_islotReadPos + dislot - cslotReproc]; - } - else - { - // Read from the reprocess buffer. - pslotRet = m_vpslotReproc[m_islotReprocPos + dislot]; - } - } - else - { - // Read normally. - Assert(m_islotWritePos - m_islotReadPos > dislot); - pslotRet = m_vpslot[m_islotReadPos + dislot]; - } - - return pslotRet; -} - -/*--------------------------------------------------------------------------------------------- - Treat the stream, which is really the output stream, as an input stream, - retrieving a recently output slot. This happens when we are reading before the - current stream position when the rule is being matched, or before the original - stream position when the rule is being run. - - @param dislot - how far back to peek before the write position - when the rule started; a negative number - (NOTE: the current write position is irrelevant) - @param fNullOkay - true if it's okay to return NULL in the situation where we're asking - for something before the beginning of the stream -----------------------------------------------------------------------------------------------*/ -GrSlotState * GrSlotStream::PeekBack(int dislot, bool fNullOkay) -{ - Assert(dislot < 0); - if (dislot < m_islotRuleStartWrite * -1) - { - Assert(fNullOkay); - return NULL; - } - GrSlotState * pslotRet; - if (m_islotReprocPos > -1) - { - if (dislot < m_islotReprocLim - m_islotRuleStartWrite && - dislot >= m_islotReprocLim - m_islotRuleStartWrite - signed(m_vpslotReproc.size())) - { - // Read from the reprocess buffer. - // Review: this is weird; can it ever happen? - pslotRet = m_vpslotReproc[m_vpslotReproc.size() - - (m_islotReprocLim - m_islotRuleStartWrite) + dislot]; - } - else - pslotRet = m_vpslot[m_islotRuleStartWrite + dislot]; - } - else - pslotRet = m_vpslot[m_islotRuleStartWrite + dislot]; - - return pslotRet; -} - -/*--------------------------------------------------------------------------------------------- - Skip the given number of slots in the stream. - ENHANCE: implement more efficiently -----------------------------------------------------------------------------------------------*/ -void GrSlotStream::Skip(int dislot) -{ - for (int islot = 0; islot < dislot; ++islot) - NextGet(); -} - -/*---------------------------------------------------------------------------------------------- - Perform assertions to ensure that the stream is in a valid state. -----------------------------------------------------------------------------------------------*/ -bool GrSlotStream::AssertValid() -{ - Assert(m_islotWritePos <= signed(m_vpslot.size())); - Assert(m_islotReadPos <= m_islotWritePos); - // Streams used by the positioning passes (input or output) should not be working - // with slots beyond the segment lim - Assert(m_islotSegLim == -1 || !m_fUsedByPosPass || m_islotReadPos <= m_islotSegLim); - Assert(m_vpslot.size() == m_vislotPrevChunkMap.size()); - Assert(m_vpslot.size() == m_vislotNextChunkMap.size()); - return true; -} - -/*---------------------------------------------------------------------------------------------- - Return the number of slots that have been completely output by the previous pass but not - yet processed by the following pass. ("Completely" output means that they do not need - to be reprocessed by the same pass, only then are they available as valid input.) - Include any slots that are present by virtue of needing to be reprocessed by the - corresponding output stream. -----------------------------------------------------------------------------------------------*/ -int GrSlotStream::SlotsPending() -{ - Assert(AssertValid()); - if (m_islotSegLim > -1) - return (m_islotSegLim - m_islotReadPos + SlotsToReprocess()); - else - return (m_islotWritePos - m_islotReadPos + SlotsToReprocess()); -} - -int GrSlotStream::SlotsPendingInContext() -{ - Assert(AssertValid()); - if (m_fUsedByPosPass) - return SlotsPending(); - else - return (m_islotWritePos - m_islotReadPos + SlotsToReprocess()); -} - -int GrSlotStream::TotalSlotsPending() -{ - int cslot = SlotsPendingInContext(); - if (m_fUsedByPosPass && m_islotSegLim > -1) - { - int ctmp = m_islotWritePos - m_islotReadPos + SlotsToReprocess(); - if (ctmp > cslot) - { - int x; x = 3; - } - cslot = max(cslot, ctmp); - } - return cslot; -} - -/*---------------------------------------------------------------------------------------------- - Return true if this pass is input or output to a positioning pass and we're past the end - of the segment. So this stream is virtually finished. -----------------------------------------------------------------------------------------------*/ -bool GrSlotStream::PastEndOfPositioning(bool fOutput) -{ - if (m_fUsedByPosPass && m_islotSegLim > -1) - { - if (fOutput) // this stream is functioning as an output stream - return (m_islotWritePos >= m_islotSegLim); - else // this stream is functioning as an input stream - return (m_islotReadPos >= m_islotSegLim); - } - return false; -} - -/*---------------------------------------------------------------------------------------------- - Mark the stream as fully written, so that the output pass doesn't keep trying to ask - for more input. -----------------------------------------------------------------------------------------------*/ -void GrSlotStream::MarkFullyWritten() -{ - m_fFullyWritten = true; -} - -/*---------------------------------------------------------------------------------------------- - Return the position of the first glyph at or following the given position - that is in the top direction, or -1 if we do not have a complete range. - - @param ptman - @param islotStart - @nTopDirLevel - top direction: 0 = left-to-right, 1 = right-to-left -----------------------------------------------------------------------------------------------*/ -int GrSlotStream::OldDirLevelRange(EngineState * pengst, int islotStart, int nTopDirLevel) -{ - Assert(m_islotReadPos <= islotStart); - Assert(islotStart < m_islotWritePos); - - int islot = islotStart; - int nSlotDirLevel = GetSlotDirLevel(pengst, islot, nTopDirLevel, nTopDirLevel, - kdircUnknown, kdircNeutral); - if (nSlotDirLevel == -1) - return -1; - while (nSlotDirLevel > nTopDirLevel) - { - islot++; - if (islot >= m_islotWritePos) - { - if (m_fFullyWritten) - return islot; - else - return -1; - } - else if (m_islotSegLim > -1 && islot >= m_islotSegLim) - { - return islot; - } - - nSlotDirLevel = GetSlotDirLevel(pengst, islot, nTopDirLevel, nTopDirLevel, - kdircUnknown, kdircNeutral); - if (nSlotDirLevel == -1) - return -1; - } - return islot; -} - -/*---------------------------------------------------------------------------------------------- - Return the position of the first glyph at or following the given position - that is in the top direction, or -1 if we do not have a complete range. - - @param ptman - @param islotStart - @nTopDirLevel - top direction: 0 = left-to-right, 1 = right-to-left -----------------------------------------------------------------------------------------------*/ -int GrSlotStream::DirLevelRange(EngineState * pengst, int islotStart, int nTopDirLevel, - std::vector & vislotStarts, std::vector & vislotStops) -{ - Assert(m_islotReadPos <= islotStart); - Assert(islotStart < m_islotWritePos); - - std::vector vislotStartStack; // indices of starts of ranges to reverse - - // Stack corresponding to embedding and override markers: - std::vector vdircMarkerStack; - std::vector vdircOverrideStack; - std::vector vnLevelStack; - - vislotStarts.clear(); - vislotStops.clear(); - - //vislotStartStack.Push(islot); - - int islotSegLim = (FullyWritten() || m_islotSegLim > -1) ? - FinalSegLim() : - WritePos() + 100; // arbitrarily large number - - if (islotStart > islotSegLim) - { - // Don't do anything fancy with stuff beyond the end of the segment. - return 0; - } - - DirCode dircMarker = kdircNeutral; // none so far - int nCurrLevel = nTopDirLevel; - int nMarkerLevel = nTopDirLevel; - //bool fHitMark = false; - DirCode dircOverride = kdircNeutral; - int islot = islotStart; - Assert(islot <= m_islotWritePos); - - while (true) - { - GrSlotState * pslot = m_vpslot[islot]; - DirCode dirc = pslot->DirProcessed(); - bool fIncludeLast = false; - int nSlotDirLevel; - if (dirc == kdircLRO || dirc == kdircLRE) // steps X1, X3 in the Unicode bidi algorithm - { - vdircMarkerStack.push_back(dircMarker); - vdircOverrideStack.push_back(dircOverride); - vnLevelStack.push_back(nCurrLevel); - dircMarker = dirc; - dircOverride = (dirc == kdircLRO) ? kdircL : kdircNeutral; - nSlotDirLevel = (nCurrLevel % 2) ? - nCurrLevel + 1 : nCurrLevel + 2; // next highest LTR level - nMarkerLevel = nSlotDirLevel; - - pslot->SetDirProcessed(dircMarker); - pslot->SetDirLevel(nMarkerLevel); - pslot->MarkDirProcessed(); - } - else if (dirc == kdircRLO || dirc == kdircRLE) // steps X2, X4 - { - vdircMarkerStack.push_back(dircMarker); - vdircOverrideStack.push_back(dircOverride); - vnLevelStack.push_back(nCurrLevel); - dircMarker = dirc; - dircOverride = (dirc == kdircRLO) ? kdircR : kdircNeutral; - nSlotDirLevel = (nCurrLevel % 2) ? - nCurrLevel + 2 : nCurrLevel + 1; // next highest RTL level - nMarkerLevel = nSlotDirLevel; - - pslot->SetDirProcessed(dircMarker); - pslot->SetDirLevel(nMarkerLevel); - pslot->MarkDirProcessed(); - } - else if (dirc == kdircPDF) - { - if (dircMarker == kdircNeutral) - pslot->SetDirProcessed((nCurrLevel % 2) ? kdircR : kdircL); - else - pslot->SetDirProcessed(RightToLeftDir(dircMarker) ? kdircPdfR : kdircPdfL); - pslot->SetDirLevel(nMarkerLevel); - pslot->MarkDirProcessed(); - - if (vnLevelStack.size()) - { - dircMarker = vdircMarkerStack.back(); - vdircMarkerStack.pop_back(); - dircOverride = vdircOverrideStack.back(); - vdircOverrideStack.pop_back(); - nMarkerLevel = vnLevelStack.back(); - vnLevelStack.pop_back(); - nSlotDirLevel = nMarkerLevel; - fIncludeLast = true; - } - else // ignore - nSlotDirLevel = nCurrLevel; - } - else - { - nSlotDirLevel = GetSlotDirLevel(pengst, islot, nTopDirLevel, nMarkerLevel, - dircMarker, dircOverride); - if (nSlotDirLevel == -1) - return -1; // not enough slots - } - - Assert(pengst->WhiteSpaceOnly() || nCurrLevel >= nTopDirLevel); - while (nSlotDirLevel > nCurrLevel) - { - vislotStartStack.push_back(islot); - nCurrLevel++; - } - // otherwise... - while (nTopDirLevel <= nCurrLevel && nSlotDirLevel < nCurrLevel) - { - if (vislotStartStack.size()) - { - int islotStartTmp = vislotStartStack.back(); - vislotStartStack.pop_back(); - vislotStarts.push_back(islotStartTmp); - vislotStops.push_back(islot - 1); // previous character was the end of the range - } - else - Assert(pengst->WhiteSpaceOnly()); // the space is higher than the segment itself - nCurrLevel--; - } - // In the case of white-space-only segments, the space may be bumped up to a level - // higher than the segment itself. - Assert(pengst->WhiteSpaceOnly() || vislotStartStack.size() + nTopDirLevel == (unsigned)nCurrLevel); - Assert(pengst->WhiteSpaceOnly() || vnLevelStack.size() == vdircMarkerStack.size()); - Assert(pengst->WhiteSpaceOnly() || vdircOverrideStack.size() == vdircMarkerStack.size()); - - if (nCurrLevel <= nTopDirLevel) - { - if (fIncludeLast) - { - // Include in the range to reverse the PDF or the char after the LRM/RLM. - // (Note: don't use a size_t below: we are decrementing below zero.) - for (int i = signed(vislotStops.size()) - 1; i >= 0 && vislotStops[i] == islot-1; i--) - { - vislotStops[i] = islot; - } - islot++; - } - break; // reached end of reversible range - } - - islot++; - if (islot >= m_islotWritePos) - { - if (m_fFullyWritten) - break; // end of input - else - return -1; // not enough slots - } - else if (islot >= islotSegLim) - { - break; // end of input - } - } - - // Reached the end of a reversable range. - while (vislotStartStack.size() > 0) - { - int islotStartTmp = vislotStartStack.back(); - vislotStartStack.pop_back(); - vislotStarts.push_back(islotStartTmp); - //vislotStops.push_back(min(islot, ReadPos() - 1)); - //vislotStops.push_back(min(islot, max(ReadPos() - 1, islotStartTmp))); - vislotStops.push_back(min(islot - 1, islotSegLim - 1)); - nCurrLevel--; - } - Assert(pengst->WhiteSpaceOnly() || nCurrLevel == nTopDirLevel); - Assert(vislotStarts.size() == vislotStops.size()); - - // The start- and stop-lists were generated in the order that we hit the stops, in other - // words, from inner to outer. Which is the order in which we need to do the reversals, too. - - return islot; -} - - -/*---------------------------------------------------------------------------------------------- - Return the direction level of the glyph at the given position, according to the - Unicode bidi algorithm. Return -1 if there aren't enough slots in the stream to - figure it out. - - ???? How should this handle the reprocessing sub-stream???? - - @param ptman - @param islot - slot for which information is requested - @param nOuterLevel - 0 = left-to-right, 1 = right-to-left - @param nCurrLevel - @param dircMarker - most recent override or embedding marker, if any - (for interpreting PDF codes) - @param dircOverride - override imposed by LRO or RLO -----------------------------------------------------------------------------------------------*/ -int GrSlotStream::GetSlotDirLevel(EngineState * pengst, int islot, - int nOuterLevel, int nCurrLevel, DirCode dircMarker, DirCode dircOverride) -{ -// Assert(m_psstrmReprocess == NULL); - - GrSlotState * pslot = m_vpslot[islot]; - - int nDirLevel = pslot->DirLevel(); - if (nDirLevel > -1) - // already figured out - return nDirLevel; - - if (pengst->WhiteSpaceOnly()) - { - // White-space-only segments should not have any reordering. - nDirLevel = pengst->ParaRightToLeft(); - pslot->SetDirLevel(nDirLevel); - pslot->MarkDirProcessed(); - return nDirLevel; - } - - DirCode dirc = pslot->DirProcessed(); - - if (!pslot->DirHasBeenProcessed() && (WeakDir(dirc) || NeutralDir(dirc)) ) - { - // Resolve weak and neutral types; process an entire run of weak types at once, - // in several passes. - - int islotWeakRunLim = islot + 1; - while (true) - { - if (islotWeakRunLim >= m_islotWritePos) - { - if (!m_fFullyWritten) - return -1; // get more slots - else - break; - } - else if (m_islotSegLim > -1 && islotWeakRunLim >= SegLimIfKnown()) - { - break; - } - if (StrongDir(m_vpslot[islotWeakRunLim]->DirProcessed())) - // ignore the line-break; we need the next strong dir after that - //// && !m_vpslot[islotWeakRunLim]->IsFinalLineBreak(ptman->LBGlyphID())) - { - break; - } - if (m_vpslot[islotWeakRunLim]->DirProcessed() == kdircPDF && - dircMarker != kdircUnknown) - { - // A valid PDF is a strong code. TODO: replace kdircPDF with kdircPdfL/R - break; - } - - islotWeakRunLim++; - } - - int islotLp; - - // X6. Handle directional overrides: LRO, RLO. - if (dircOverride != kdircNeutral) - { - for (islotLp = islot; islotLp < islotWeakRunLim; islotLp++) - { - m_vpslot[islotLp]->SetDirProcessed(dircOverride); - m_vpslot[islotLp]->MarkDirProcessed(); - } - goto LSetDir; - } - - DirCode dircLp; - //DirCode dircTmp; - - // W1. Non-spacing marks get the type of the previous slot. - for (islotLp = islot; islotLp < islotWeakRunLim; islotLp++) - { - Assert(!m_vpslot[islotLp]->DirHasBeenProcessed()); - - if (m_vpslot[islotLp]->DirProcessed() == kdircNSM) - { -#ifdef _DEBUG - if (islotLp <= 0) - { - Warn("Pathological case in bidi algorithm"); - } -#endif // _DEBUG - dircLp = AdjacentNonBndNeutralCode(pengst, islotLp - 1, -1, dircMarker); - - m_vpslot[islotLp]->SetDirProcessed(dircLp); - } - } - - // W2. European numbers are changed to Arabic numbers if the previous strong type - // was an Arabic letter. - DirCode dircPrevStrong = AdjacentStrongCode(pengst, islot - 1, -1, dircMarker); - if (dircPrevStrong == kdircRArab) - { - for (islotLp = islot; islotLp < islotWeakRunLim; islotLp++) - { - dircLp = m_vpslot[islotLp]->DirProcessed(); - if (dircLp == kdircEuroNum) - m_vpslot[islotLp]->SetDirProcessed(kdircArabNum); - } - } - - // W4. A single European separator between two Latin numbers changes to a Latin number. - // A single common separator between two numbers of the same type changes to that - // type. - for (islotLp = islot; islotLp < islotWeakRunLim; islotLp++) - { - dircLp = m_vpslot[islotLp]->DirProcessed(); - if ((dircLp == kdircEuroSep || dircLp == kdircComSep) && - islotLp + 1 < m_islotWritePos) // don't test last slot in stream - { - DirCode dircPrev = AdjacentNonBndNeutralCode(pengst, islotLp - 1, -1, dircMarker); - DirCode dircNext = AdjacentNonBndNeutralCode(pengst, islotLp + 1, 1, dircMarker); - if (dircPrev == dircNext) - { - if (dircLp == kdircEuroSep && dircPrev == kdircEuroNum) - { - m_vpslot[islotLp]->SetDirProcessed(kdircEuroNum); - } - else if (dircLp == kdircComSep && - (dircPrev == kdircEuroNum || dircPrev == kdircArabNum)) - { - m_vpslot[islotLp]->SetDirProcessed(dircPrev); - } - } - } - } - - // W5, W6. A sequence of European number terminators adjacent to Latin numbers changes - // to Latin numbers. - // This appears to be an ambiguity in the official algorithm: do we search backward - // first, or forward? For our purposes, it is easier to search backward first. - for (islotLp = islot; islotLp < islotWeakRunLim; islotLp++) - { - dircLp = m_vpslot[islotLp]->DirProcessed(); - if (dircLp == kdircEuroTerm || dircLp == kdircBndNeutral) - { - if (TerminatorSequence(pengst, islotLp - 1, -1, dircMarker) == kdircEuroNum) - dircLp = kdircEuroNum; - else - { - if (TerminatorSequence(pengst, islotLp + 1, 1, dircMarker) == kdircEuroNum) - dircLp = kdircEuroNum; - // else could possibly be unknown if we are at the end of the stream - } - } - - // W6. Separators and terminators change to neutral. (Don't change - // boundary neutrals at this point, because that would confuse step Pre-L1.) - if (dircLp == kdircEuroSep || dircLp == kdircEuroTerm || dircLp == kdircComSep) - { - dircLp = kdircNeutral; - } - m_vpslot[islotLp]->SetDirProcessed(dircLp); - } - - // W7. European numbers are changed to plain left-to-right if the previous strong type - // was left-to-right. - dircPrevStrong = AdjacentStrongCode(pengst, islot - 1, -1, dircMarker); - if (dircPrevStrong == kdircL) - { - for (islotLp = islot; islotLp < islotWeakRunLim; islotLp++) - { - dircLp = (m_vpslot[islotLp]->DirProcessed()); - if (dircLp == kdircEuroNum) - m_vpslot[islotLp]->SetDirProcessed(kdircL); - } - } - - // Pre-L1. Make a list of all the trailing whitespace characters that need to take - // on the direction of the final line break (ie, the top direction). We can't actually - // change them yet, because that would confuse the loop below. But we have to - // record them now because they might get changed in the loop below. - std::vector vislotTrailingWS; - int islotFinalLB = -1; - for (islotLp = islotWeakRunLim; islotLp-- > islot; ) - { - if (m_vpslot[islotLp]->IsFinalLineBreak(pengst->TableManager()->LBGlyphID())) - { - islotFinalLB = islotLp; - for (int islotLp2 = islotLp; islotLp2-- > islot; ) - { - dircLp = m_vpslot[islotLp2]->DirProcessed(); - if (dircLp == kdircWhiteSpace || dircLp == kdircBndNeutral) - vislotTrailingWS.push_back(islotLp2); - else - break; // hit something other than whitespace or neutral - } - break; - } - } - - // N1. A sequence of neutrals takes the direction of the strong surrounding text if - // the text on both sides has the same direction. Latin and Arabic numbers are treated - // as if they are right-to-left. - // (If they are not the same, leave the type as neutral.) - for (islotLp = islot; islotLp < islotWeakRunLim; islotLp++) - { - dircLp = m_vpslot[islotLp]->DirProcessed(); - - // Change Boundary Neutrals to plain neutrals (must happen after Pre-L1). - if (dircLp == kdircBndNeutral) - { - m_vpslot[islotLp]->SetDirProcessed(kdircNeutral); - dircLp = kdircNeutral; - } - - if (NeutralDir(dircLp)) - { - // First, look for either a strong code or a number. If we get at least - // one strong code and a number with the same direction, use that strong - // code. - DirCode dircPrev = AdjacentStrongCode(pengst, islotLp - 1, -1, dircMarker, true); - DirCode dircNext = AdjacentStrongCode(pengst, islotLp + 1, 1, dircMarker, true); - - if (dircNext == kdircUnknown) - return -1; - - if (dircPrev == kdircUnknown) - dircPrev = dircNext; - - DirCode dircResult = kdircUnknown; - if (dircNext == kdircNeutral) - {} - else if (RightToLeftDir(dircPrev) == RightToLeftDir(dircNext) && - (StrongDir(dircNext) || StrongDir(dircPrev))) - { - // Got a strong matching direction. - dircResult = (StrongDir(dircPrev)) ? dircPrev : dircNext; - } - else if (dircNext == kdircPdfL || dircNext == kdircPdfR) - { - // A following PDF flag wins, because it represents the edge of a run. - dircResult = dircNext; - } - else if (StrongDir(dircNext) && StrongDir(dircPrev)) - { // We must have text in different directions. - } - else - { - // Try again, insisting on strong codes, no numbers. - if (!StrongDir(dircPrev)) - dircPrev = AdjacentStrongCode(pengst, islotLp - 1, -1, dircMarker, false); - if (!StrongDir(dircNext)) - dircNext = AdjacentStrongCode(pengst, islotLp + 1, 1, dircMarker, false); - if (dircPrev == kdircUnknown) - dircPrev = dircNext; - - if (RightToLeftDir(dircPrev) == RightToLeftDir(dircNext) && - (StrongDir(dircNext) || StrongDir(dircPrev))) - { - // Got a strong matching direction. - dircResult = (StrongDir(dircPrev)) ? dircPrev : dircNext; - } - } - - if (dircResult != kdircUnknown) - { - dircResult = (RightToLeftDir(dircResult)) ? kdircR : kdircL; - m_vpslot[islotLp]->SetDirProcessed(dircResult); - } - // else leave as neutral - } - } - - // L1. Now change trailing neutrals recorded above to the directionality of - // the immediately following line-break, if any. - if (islotFinalLB != -1) - { - DirCode dircLB = m_vpslot[islotFinalLB]->DirProcessed(); - dircLB = (dircLB == kdircLlb) ? kdircL : kdircR; - for (int iislot = 0; iislot < signed(vislotTrailingWS.size()); iislot++) - { - int islotTmp = vislotTrailingWS[iislot]; - m_vpslot[islotTmp]->SetDirProcessed(dircLB); - } - } - - // Mark all the slots processed. - for (islotLp = islot; islotLp < islotWeakRunLim; islotLp++) - m_vpslot[islotLp]->MarkDirProcessed(); - } - else - m_vpslot[islot]->MarkDirProcessed(); - -LSetDir: - - // Final resolution. - - dirc = pslot->DirProcessed(); - - if (dirc != kdircLlb && dirc != kdircRlb && dircOverride != kdircNeutral) - { - // Enforce whatever is imposed by the override. - m_vpslot[islot]->SetDirProcessed(dircOverride); - nDirLevel = nCurrLevel; - } - else if ((nCurrLevel % 2) == 0) // current level is even (left-to-right) - { - switch (dirc) - { - case kdircNeutral: - case kdircWhiteSpace: - nDirLevel = nCurrLevel; - break; - - case kdircL: - nDirLevel = nCurrLevel; - break; - - case kdircLlb: - case kdircRlb: // all line-breaks have the direction of the paragraph - nDirLevel = nOuterLevel; - break; - - case kdircR: - case kdircRArab: - nDirLevel = nCurrLevel + 1; - break; - - case kdircEuroNum: - case kdircArabNum: - nDirLevel = nCurrLevel + 2; - break; - - default: - Assert(false); - nDirLevel = nCurrLevel; - } - } - else // current level is odd (right-to-left) - { - switch (dirc) - { - case kdircNeutral: - case kdircWhiteSpace: - nDirLevel = nCurrLevel; - break; - - case kdircR: - //case kdircRlb: - case kdircRArab: - nDirLevel = nCurrLevel; - break; - - case kdircL: - //case kdircLlb: - case kdircEuroNum: - case kdircArabNum: - nDirLevel = nCurrLevel + 1; - break; - - case kdircLlb: - case kdircRlb: // all line-breaks have the direction of the paragraph - nDirLevel = nOuterLevel; - break; - - default: - Assert(false); - nDirLevel = nCurrLevel; - } - } - pslot->SetDirLevel(nDirLevel); - - return nDirLevel; -} - -/*---------------------------------------------------------------------------------------------- - Return the next or previous strong code, kdircNeutral if we don't find one, - or kdircUnknown if we need more slots to process. - - @param islot - index of slot of interest - @param nInc - +1 to search forward, -1 to search backward - @param fNumbersAreStrong - true if we want to treat numbers as having strong - directionality - @param dircPDF - how to interpret PDF codes (from corresponding RLO, etc) -----------------------------------------------------------------------------------------------*/ -DirCode GrSlotStream::AdjacentStrongCode(EngineState * pengst, int islot, int nInc, - DirCode dircPDF, bool fNumbersAreStrong) -{ - if (islot < 0) - return pengst->InitialStrongDir(); - - else if (islot >= m_islotWritePos) - { - if (m_fFullyWritten || (m_islotSegLim > -1 && islot >= SegLimIfKnown())) - return kdircNeutral; - else - return kdircUnknown; - } - - DirCode dirc = m_vpslot[islot]->DirProcessed(); - - if (dirc == kdircPDF && StrongDir(dircPDF)) - return (RightToLeftDir(dircPDF)) ? kdircPdfR : kdircPdfL; - if (StrongDir(dirc)) - return dirc; - if (fNumbersAreStrong && (dirc == kdircEuroNum || dirc == kdircArabNum)) - return dirc; - - return AdjacentStrongCode(pengst, islot + nInc, nInc, dircPDF, fNumbersAreStrong); -} - -/*---------------------------------------------------------------------------------------------- - Return kdircEuroNum if there is a terminator sequence starting or ending with a - European number. Return kdircUnknown if we need more slots to process. - Return kdircNeutral otherwise. - - @param islot - index of slot of interest - @param nInc - +1 to search forward, -1 to search backward - @param dircPDF - how to interpret PDF codes (from corresponding RLO, etc) -----------------------------------------------------------------------------------------------*/ -DirCode GrSlotStream::TerminatorSequence(EngineState * pengst, int islot, int nInc, - DirCode dircPDF) -{ - if (islot < 0) - return pengst->InitialTermDir(); - - else if (islot >= m_islotWritePos) - { - if (m_fFullyWritten) - return kdircNeutral; - else - return kdircUnknown; - } - - DirCode dirc = m_vpslot[islot]->DirProcessed(); - - if (dirc == kdircPDF) - return (RightToLeftDir(dircPDF)) ? kdircPdfR : kdircPdfL; - else if (dirc == kdircEuroNum) - // number found at end of terminator sequence - return kdircEuroNum; - else if (dirc == kdircEuroTerm) - // yes, this slot is a terminator; are there more? - return TerminatorSequence(pengst, islot + nInc, nInc, dircPDF); - else if (dirc == kdircLlb || dirc == kdircRlb) - // line-break slot--ignore and keep going - return TerminatorSequence(pengst, islot + nInc, nInc, dircPDF); - else if (dirc == kdircBndNeutral) - // boundary neutral--ignore and keep going - return TerminatorSequence(pengst, islot + nInc, nInc, dircPDF); - else - // no number found - return kdircNeutral; -} - -/*---------------------------------------------------------------------------------------------- - Return the previous code that is not a Boundary Neutral. Return Other Neutral if there - is no such. - - @param islot - index of slot of interest - @param nInc - +1 to search forward, -1 to search backward - @param dircPDF - how to interpret PDF codes (from corresponding RLO, etc) -----------------------------------------------------------------------------------------------*/ -DirCode GrSlotStream::AdjacentNonBndNeutralCode(EngineState * pengst, int islot, int nInc, - DirCode dircPDF) -{ - Assert(islot < m_islotWritePos); - if (islot < 0) - return kdircNeutral; // or should we use: ptman->InitialStrongDir() ?? - - else if (islot >= m_islotWritePos) - { - if (m_fFullyWritten) - return kdircNeutral; - else - return kdircUnknown; - } - - DirCode dirc = m_vpslot[islot]->DirProcessed(); - - if (dirc == kdircBndNeutral) - return AdjacentNonBndNeutralCode(pengst, islot + nInc, nInc, dircPDF); - else if (dirc == kdircPDF) - return (RightToLeftDir(dircPDF)) ? kdircPdfR : kdircPdfL; - else - return dirc; -} - -/*---------------------------------------------------------------------------------------------- - Directionality type functions. -----------------------------------------------------------------------------------------------*/ -bool StrongDir(DirCode dirc) -{ - return (dirc == kdircL || dirc == kdircR || dirc == kdircRArab || - dirc == kdircLRO || dirc == kdircRLO || dirc == kdircLRE || dirc == kdircRLE || - dirc == kdircPdfL || dirc == kdircPdfR); -} - -bool WeakDir(DirCode dirc) -{ - return (dirc == kdircEuroNum || dirc == kdircEuroSep || - dirc == kdircEuroTerm || dirc == kdircArabNum || - dirc == kdircComSep || dirc == kdircBndNeutral || dirc == kdircNSM); -} - -bool NeutralDir(DirCode dirc) -{ - return (dirc == kdircWhiteSpace || dirc == kdircNeutral); -} - -/*---------------------------------------------------------------------------------------------- - Special values used by the bidi algorithm. -----------------------------------------------------------------------------------------------*/ -bool BidiCode(int nUnicode) -{ - switch (nUnicode) - { - case knLRM: - case knRLM: - case knLRO: - case knRLO: - case knLRE: - case knRLE: - case knPDF: - return true; - default: - break; - } - return false; -} - -/*---------------------------------------------------------------------------------------------- - Return true if the directionality should be treated as right-to-left. - Used for the step of resolving neutrals (N1). -----------------------------------------------------------------------------------------------*/ -bool RightToLeftDir(DirCode dirc) -{ - switch (dirc) - { - case kdircL: - case kdircLRO: - case kdircLRE: - case kdircPdfL: - case kdircLlb: - return false; - - case kdircR: - case kdircRArab: - case kdircArabNum: - case kdircEuroNum: - case kdircRLO: - case kdircRLE: - case kdircPdfR: - return true; - - case kdircNeutral: - case kdircWhiteSpace: - case kdircComSep: - case kdircEuroSep: - case kdircEuroTerm: - case kdircBndNeutral: - case kdircNSM: - case kdircPDF: - return false; - - default: - Assert(false); - return false; - } -} - -/*---------------------------------------------------------------------------------------------- - Copy a slot from prevStream, incrementing the positions. -----------------------------------------------------------------------------------------------*/ -void GrSlotStream::CopyOneSlotFrom(GrSlotStream * psstrmPrev) -{ -#ifdef _DEBUG - gid16 chw; chw = psstrmPrev->Peek()->GlyphID(); -#endif - - // If we are exactly at the segment boundary, pass the information on to this stream. - if (psstrmPrev->AtSegMin()) - SetSegMinToWritePos(); - if (psstrmPrev->AtSegLim()) - SetSegLimToWritePos(); - - NextPut(psstrmPrev->NextGet()); - - AssertValid(); - psstrmPrev->AssertValid(); -} - -/*---------------------------------------------------------------------------------------------- - Copy one slot from the input stream to the recipient, which is the output stream. - Used when reversing ranges of glyphs; caller is responsible for adjusting the read- - and write-positions of the streams. - - REVIEW: How should this handle the reprocessing sub-stream? Currently this is not a problem - because this function is only used by the bidi pass, which never has intra-pass - reprocessing. -----------------------------------------------------------------------------------------------*/ -void GrSlotStream::SimpleCopyFrom(GrSlotStream * psstrmI, int islotInput, int islotOutput) -{ - if (signed(m_vpslot.size()) < islotOutput + 1) - { - m_vpslot.resize(islotOutput + 1); - m_vislotPrevChunkMap.resize(islotOutput + 1); - m_vislotNextChunkMap.resize(islotOutput + 1); - } - - m_vpslot[islotOutput] = psstrmI->m_vpslot[islotInput]; - m_vislotPrevChunkMap[islotOutput] = -1; - m_vislotNextChunkMap[islotOutput] = -1; - - Assert(m_fUsedByPosPass); - if (m_fUsedByPosPass && GotIndexOffset()) - m_vpslot[islotOutput]->SetPosPassIndex(islotOutput - m_cslotPreSeg, m_fInputToPosPass1); - -} - -/*---------------------------------------------------------------------------------------------- - Return true if there is physical space to add more glyphs, false if the positioning - has caused them to use all the alotted space. Recipient is assumed to be output - stream from the final pass. - - @param ptman - table manager, for handling the positioning - @param pgg - graphics device - @param xsSpaceAllotted - how much space is available - @param fWidthIsCharCount - kludge for test procedures - @param fIgnoreTrailingWS - true if we are ignoring trailing white-space (currently - always true) - @param twsh - how the segment is handling trailing white-space - @param pxsWidth - return width of stuff so far -----------------------------------------------------------------------------------------------*/ -bool GrSlotStream::MoreSpace(GrTableManager * ptman, - float xsSpaceAllotted, bool fWidthIsCharCount, - bool fIgnoreTrailingWS, TrWsHandling twsh, - float * pxsWidth) -{ - Assert(ptman->NumberOfPasses() - 1 == m_ipass); - - if (fWidthIsCharCount) - { - // Used in test procedures - *pxsWidth = (float)m_islotWritePos; - return (m_islotWritePos < xsSpaceAllotted); - } - else - { - *pxsWidth = -1; - if (!GotIndexOffset()) - return true; - if (WritePos() <= IndexOffset()) - return true; - int dislot = MaxClusterSlot(WritePos()); - if (dislot == kNegInfinity || dislot > 0) - // We're in the middle of processing a cluster--we have to keep processing, - // so for now assume there is more space. - return true; - - float xsWidth, xsVisWidth; - ptman->CalcPositionsUpTo(m_ipass, NULL, &xsWidth, &xsVisWidth); - - *pxsWidth = (fIgnoreTrailingWS || twsh == ktwshOnlyWs) ? xsVisWidth : xsWidth; - return (*pxsWidth < xsSpaceAllotted); - } -} - -/*---------------------------------------------------------------------------------------------- - Work backwards from the prevLineBreak position (or if none, the readPos) to find the - previous line-break of the given weight or less. Return the position of the inserted - line-break slot, or -1 if no appropriate break point was found. Recipient should be - the output of the final line break pass, or if none, the output of the - glyph-generation pass. - - @param ptman - table manager, for supplying new slots - @param islotPrevBreak - position of previous inserted line break - @param fInsertedLB - did we actually insert a line-break glyph before? - @param islotStartTry - where to start looking, or -1 for the end of the stream - @param lb - (max) break weight to allow - @param twsh - how we are handling trailing white-space - @param islotMin - first slot that is officially part of the segment (after initial LB) - @param plbNextToTry - the best we found -----------------------------------------------------------------------------------------------*/ -int GrSlotStream::InsertLineBreak(GrTableManager * ptman, - int islotPrevBreak, bool fInsertedLB, int islotStartTry, - LineBrk lb, TrWsHandling twsh, int islotMin, - LineBrk * plbNextToTry) -{ - EngineState * pengst = ptman->State(); - - Assert(!fInsertedLB || islotPrevBreak > -1); - - int ichwSegOffset; - int islot; - LineBrk lbFound; - if (!FindSegmentEnd(ptman, islotStartTry, lb, twsh, islotMin, - &islot, &ichwSegOffset, &lbFound, plbNextToTry)) - { - return -1; // didn't find a legal break - } - - GrSlotState * pslotCopyFeat = pengst->AnAdjacentSlot(m_ipass, islot + 1); - Assert(pslotCopyFeat); - - if (islotPrevBreak > -1 && fInsertedLB) - { - //GrSlotState * pslotOld = m_vpslot[islotPrevBreak]; - - m_vpslot.erase(m_vpslot.begin() + islotPrevBreak); - m_vislotPrevChunkMap.erase(m_vislotPrevChunkMap.begin() + islotPrevBreak); - m_vislotNextChunkMap.erase(m_vislotNextChunkMap.begin() + islotPrevBreak); - AdjustPrevStreamNextChunkMap(ptman, islotPrevBreak + 1, -1); - } - else - { - m_islotReadPos++; - m_islotWritePos++; - } - - GrSlotState * pslotNew; - pengst->NewSlot(ptman->LBGlyphID(), pslotCopyFeat, 0, ichwSegOffset, &pslotNew); - - pslotNew->SetSpecialSlotFlag(kspslLbFinal); - pslotNew->SetBreakWeight(lbFound); - pslotNew->SetDirectionality(ptman->RightToLeft() ? kdircRlb : kdircLlb); - - int islotLB = islot + 1; - m_vpslot.insert(m_vpslot.begin() + islotLB, pslotNew); - // Inserting -1 makes it part of a chunk with the previous char/glyph - m_vislotPrevChunkMap.insert(m_vislotPrevChunkMap.begin() + islotLB, -1); - m_vislotNextChunkMap.insert(m_vislotNextChunkMap.begin() + islotLB, -1); - AdjustPrevStreamNextChunkMap(ptman, islotLB, 1); - // We don't need to adjust the following stream because we are going to unwind it anyway. - - if (m_fUsedByPosPass && GotIndexOffset()) - { - pslotNew->SetPosPassIndex(islot - m_cslotPreSeg, m_fInputToPosPass1); - // Increment the stream index for the following slots. - for (int islotTmp = islotLB; - islotTmp < ((islotPrevBreak == -1) ? m_islotWritePos : islotPrevBreak + 1); - islotTmp++) - { - SlotAt(islotTmp)->IncPosPassIndex(); - } - } - - m_islotSegLim = islotLB + 1; // after the line-break glyph - - return islotLB; -} - -/*---------------------------------------------------------------------------------------------- - Make a segment break that does not correspond to a line break; ie, don't insert - a line-break glyph. - - Work backwards from the prevLineBreak position (or if none, the readPos) to find the - previous line-break of the given weight or less. Return the position of the final slot - in the segment, or -1 if no appropriate break point was found. Recipient should be - the output of the final line break pass, if any, or the glyph-generation pass. - - @param ptman - table manager, for supplying new slots - @param islotPrevBreak - position of previous inserted line break - @param fInsertedLB - did we actually insert a line-break glyph previously; currently - ignored - @param islotStartTry - where to start looking, or -1 for the end of the stream - @param lb - (max) break weight to allow - @param twsh - how we are handling trailing white-space - @param islotMin - first slot that is officially part of the segment (after initial LB) -----------------------------------------------------------------------------------------------*/ -int GrSlotStream::MakeSegmentBreak(GrTableManager * ptman, - int islotPrevBreak, bool fInsertedLB, int islotStartTry, - LineBrk lb, TrWsHandling twsh, int islotMin, - LineBrk * plbNextToTry) -{ - int ichwSegOffset; - int islot; - LineBrk lbFound; - if (!FindSegmentEnd(ptman, islotStartTry, lb, twsh, islotMin, - &islot, &ichwSegOffset, &lbFound, plbNextToTry)) - { - return -1; // didn't find a legal break - } - - // Review: do we need to delete any previously-inserted line-break glyph from the stream? - // Doesn't seem like this has been a problem so far. - - m_islotSegLim = islot + 1; // after the final glyph of this segment - - return islot; -} - -/*---------------------------------------------------------------------------------------------- - Work backwards from the prev line break position (or if none, the readPos) to find an - earlier line-break of the given weight or less. - Recipient should be the output of the final line break pass, if any, or the output - of the glyph-generation pass. - - @param ptman - table manager, for supplying new slots - @param islotStartTry - where to start looking, or -1 for the end of the stream - @param lb - (max) break weight to allow - @param twsh - how we are handling trailing white-space - @param islotMin - first slot that is officially part of the segment (after initial LB) - @param pislot - slot AFTER which the break will go (not the lim of the segment) - @param pichwSegOffset - offset relative to the segment - @param plbFound - weight of break to be created - @param plbNextToTry - best found, in case we didn't find one at the requested level - - @return Whether or not an appropriate break was found. -----------------------------------------------------------------------------------------------*/ -bool GrSlotStream::FindSegmentEnd(GrTableManager * ptman, - int islotStartTry, LineBrk lb, TrWsHandling twsh, int islotMin, - int * pislot, int * pichwSegOffset, LineBrk * plbFound, - LineBrk * plbNextToTry) -{ - Assert(AssertValid()); - Assert(m_ipass == ptman->NumberOfLbPasses()); - - if (islotStartTry < 0) - return false; - - *pislot = islotStartTry; - GrSlotState * pslot = m_vpslot[*pislot]; - *plbNextToTry = klbClipBreak; // worst break - - ptman->State()->SetRemovedTrWhiteSpace(false); - - while (twsh != ktwshOnlyWs) // in white-space only case, ignore lb values - { - if (*pislot < islotMin) - { - return false; - } - *plbFound = LineBrk(pslot->m_lb); - // Sanity check - if (abs(*plbFound) > klbClipBreak) - { -// Assert(false); - Warn("Unusually large breakweight"); - *plbFound = (LineBrk)((*plbFound < 0) ? -klbClipBreak : klbClipBreak); - } - *plbNextToTry = (LineBrk)(min(static_cast(*plbNextToTry), abs(*plbFound))); - *pichwSegOffset = pslot->SegOffset(); - - if (int(*plbFound) >= 0 && *plbFound <= lb) - break; - - --(*pislot); - if (*pislot < 0) - { - return false; - } - pslot = m_vpslot[*pislot]; - - if (int(*plbFound) <= 0 && ((int)*plbFound * -1) <= lb) - { - *plbFound = LineBrk(int(*plbFound) * -1); - break; - } - } - - // Found a good break. - - if (twsh == ktwshOnlyWs) - { - // white-space-only segment - while (pslot->Directionality() != kdircWhiteSpace) - { - --(*pislot); - if (*pislot < 0) - return false; - pslot = m_vpslot[*pislot]; - *pichwSegOffset = pslot->SegOffset(); - } - } - else if (twsh == ktwshNoWs) - { - // no trailing white-space: remove it - while (pslot->Directionality() == kdircWhiteSpace) - { - --(*pislot); - if (*pislot < 0) - return false; - pslot = m_vpslot[*pislot]; - *pichwSegOffset = pslot->SegOffset(); - ptman->State()->SetRemovedTrWhiteSpace(true); - } - } - - return true; -} - -/*---------------------------------------------------------------------------------------------- - Return true if the stream (which should be the output of the last linebreak pass) has - a better break at some earlier point than the one we found. - - @param islotBreak - position of inserted or final break point in stream, or index - of last valid slot -----------------------------------------------------------------------------------------------*/ -bool GrSlotStream::HasEarlierBetterBreak(int islotBreak, LineBrk lbFound, gid16 chwLB) -{ - Assert(AssertValid()); - - int islot = islotBreak; - if (SlotAt(islot)->IsFinalLineBreak(chwLB)) - islot--; - - if (lbFound == klbNoBreak) - lbFound = (LineBrk)SlotAt(islot)->BreakWeight(); - - while (islot >= 0) - { - if (SlotAt(islot)->IsInitialLineBreak(chwLB)) - return false; - if (SlotAt(islot)->BreakWeight() < lbFound) - return true; - islot--; - } - - return false; -} - -/*---------------------------------------------------------------------------------------------- - Make sure the stream contains a local instance of the given slot, not a copy used by - a previous pass. -----------------------------------------------------------------------------------------------*/ -void GrSlotStream::EnsureLocalCopy(GrTableManager * ptman, GrSlotState * pslot, - GrSlotStream * psstrmIn) -{ - //Assert(m_vpslot[islot + m_cslotPreSeg] == pslot); - Assert(pslot->PassModified() <= m_ipass); - - if (pslot->PassModified() < m_ipass) - { - int islot = pslot->PosPassIndex(); - Assert(SlotAtPosPassIndex(islot) == pslot); - GrSlotState * pslotNew; - ptman->State()->NewSlotCopy(pslot, m_ipass, &pslotNew); - m_vpslot[islot + m_cslotPreSeg] = pslotNew; - - psstrmIn->ReplaceSlotInReprocessBuffer(pslot, pslotNew); - } -} - -/*---------------------------------------------------------------------------------------------- - A slot has been replace within the coorsponding output stream. Make sure the reprocess - buffer of this stream constains the same slot. -----------------------------------------------------------------------------------------------*/ -void GrSlotStream::ReplaceSlotInReprocessBuffer(GrSlotState * pslotOld, GrSlotState * pslotNew) -{ - if (m_islotReprocPos > -1) - { - for (size_t islot = 0; islot < m_vpslotReproc.size(); islot++) - { - if (m_vpslotReproc[islot] == pslotOld) - m_vpslotReproc[islot] = pslotNew; - } - } -} - -/*---------------------------------------------------------------------------------------------- - Inserting a line break can potentially alter the directionality of preceeding glyphs. - Zap the information that has been calculated. - - @param islotLB - index of the inserted final line-break glyph -----------------------------------------------------------------------------------------------*/ -void GrSlotStream::ZapCalculatedDirLevels(int islotLB) -{ - int islot; - for (islot = m_islotWritePos; islot-- > islotLB; ) - m_vpslot[islot]->ZapDirLevel(); - - for (islot = islotLB; islot-- > 0; ) - { - if (StrongDir(m_vpslot[islot]->Directionality())) - // We've found a strong direction code; don't need to zap beyond this point. - return; - - m_vpslot[islot]->ZapDirLevel(); - } -} - -/*---------------------------------------------------------------------------------------------- - Return the slot index of the last slot in the cluster for the just-processed chunk, - relative to the last slot in the chunk. - - Return kNegInfinity if there are not enough slots in the stream to tell. This can - happen while we are in the middle of processing a cluster. -----------------------------------------------------------------------------------------------*/ -int GrSlotStream::MaxClusterSlot(int islotChunkMin, int islotChunkLim) -{ - Assert(islotChunkLim > islotChunkMin); - - if (!m_fUsedByPosPass) - return 0; // no clusters yet - - int islotRet = SlotAt(islotChunkLim - 1)->PosPassIndex(); - - for (int islot = islotChunkMin; islot < islotChunkLim; islot++) - { - GrSlotState * pslot = SlotAt(islot); - - if (m_cslotPreSeg == -1) - return kNegInfinity; - if (!HasSlotAtPosPassIndex(pslot->AttachRootPosPassIndex())) - return kNegInfinity; - - GrSlotState * pslotBase = pslot->Base(this); - - int dislotOffset = pslotBase->LastLeafOffset(this); - if (dislotOffset == kNegInfinity) - return kNegInfinity; - islotRet = max(islotRet, pslotBase->PosPassIndex() + dislotOffset); - } - - // Make it relative to the last slot in the chunk. - islotRet -= SlotAt(islotChunkLim - 1)->PosPassIndex(); - - return islotRet; -} - -/*---------------------------------------------------------------------------------------------- - Return the break weight of the given slot, which should be a line-break. - OBSOLETE?? -----------------------------------------------------------------------------------------------*/ -LineBrk GrSlotStream::BreakWeightAt(gid16 chwLB, int islot) -{ - GrSlotState * pslot = GetSlotAt(islot); - Assert(pslot->IsLineBreak(chwLB)); - return LineBrk(pslot->m_lb); -} - -/*---------------------------------------------------------------------------------------------- - Append an initial or final line break of the given weight to the stream. - - @param ptman - table manager, for generating new slot - @param lb - break weight for the line-break glyph - @param dirc - directionality code for the line-break glyph - @param islotLB - where to insert, or -1 if at the end - @param fInitial - is this an initial line-break, or a final break? - @param ichwSegOffset - offset relative to the beginning of the segment -----------------------------------------------------------------------------------------------*/ -void GrSlotStream::AppendLineBreak(GrTableManager * ptman, GrCharStream * pchstrm, - LineBrk lb, DirCode dirc, int islotLB, bool fInitial, int ichwSegOffset) -{ - EngineState * pengst = ptman->State(); - - Assert(AssertValid()); -/// Assert(m_islotReprocPos == -1); - - Assert(islotLB == -1 || fInitial); - if (islotLB == -1) - islotLB = m_islotWritePos; - -// int islot = m_islotWritePos; - - GrSlotState * pslotCopyFeat = pengst->AnAdjacentSlot(m_ipass, islotLB); - GrSlotState * pslotNew; - if (pslotCopyFeat) - pengst->NewSlot(ptman->LBGlyphID(), pslotCopyFeat, 0, ichwSegOffset, &pslotNew); - else - { - GrFeatureValues fval; - pchstrm->CurrentFeatures(ptman, &fval); - pengst->NewSlot(ptman->LBGlyphID(), fval, 0, ichwSegOffset, -1, &pslotNew); - } - - pslotNew->m_lb = sdata8(lb); - pslotNew->SetSpecialSlotFlag(fInitial ? kspslLbInitial : kspslLbFinal); - //pslotNew->m_fInitialLB = fInitial; // TODO: remove - pslotNew->SetDirectionality(dirc); - - m_vpslot.insert(m_vpslot.begin() + islotLB, pslotNew); - // Make it part of a chunk with previous char/glyph - m_vislotPrevChunkMap.insert(m_vislotPrevChunkMap.begin() + islotLB, -1); - m_vislotNextChunkMap.insert(m_vislotNextChunkMap.begin() + islotLB, -1); - if (m_ipass > 0) - AdjustPrevStreamNextChunkMap(ptman, islotLB, 1); - - m_islotWritePos++; - - if (m_fUsedByPosPass && GotIndexOffset()) - { - pslotNew->SetPosPassIndex(islotLB - m_cslotPreSeg, m_fInputToPosPass1); - // Increment the stream index for the following slots. - for (int islotTmp = islotLB + 1; islotTmp < m_islotWritePos; islotTmp++) - { - SlotAt(islotTmp)->IncPosPassIndex(); - } - } - - if (fInitial) - m_islotSegMin = islotLB; // just before the LB - else - m_islotSegLim = islotLB + 1; // just after the LB -} - -/*---------------------------------------------------------------------------------------------- - Return the index of the line break glyph within the specified range, or -1 if none. - Recipient is functioning as the output stream. - - @param chwLB - glyph ID being used for line-break glyphs - @param islotMin/Lim - range to search -----------------------------------------------------------------------------------------------*/ -int GrSlotStream::FindFinalLineBreak(gid16 chwLB, int islotMin, int islotLim) -{ - for (int islot = islotMin; islot < islotLim; ++islot) - { - if (m_vpslot[islot]->IsFinalLineBreak(chwLB)) - return islot; - } - return -1; -} - -/*---------------------------------------------------------------------------------------------- - A slot has been inserted (nInc == 1) or deleted (nInc == -1). Adjust the next-chunk map - of the previous stream to match. -----------------------------------------------------------------------------------------------*/ -void GrSlotStream::AdjustPrevStreamNextChunkMap(GrTableManager * ptman, int islotMod, int nInc) -{ - if (m_ipass == 0) - return; // no previous stream to adjust - - int islotTmp = max(islotMod - 5, 0); - while (islotTmp > 0 && m_vislotPrevChunkMap[islotTmp] == -1) - islotTmp--; - - ptman->InputStream(m_ipass)->AdjustNextChunkMap( - ((islotTmp <= 0) ? 0 : m_vislotPrevChunkMap[islotTmp]), - islotMod, nInc); -} - -/*---------------------------------------------------------------------------------------------- - An insertion or deletion has occurred at the given location in the following stream - (specifically of an line-break glyph). Adjust the next-chunk-map accordingly so - the indices still match. -----------------------------------------------------------------------------------------------*/ -void GrSlotStream::AdjustNextChunkMap(int islotMin, int islotInsOrDel, int nInc) -{ - for (int islot = islotMin; islot < m_islotWritePos; islot++) - { - if (m_vislotNextChunkMap[islot] != -1 && m_vislotNextChunkMap[islot] >= islotInsOrDel) - m_vislotNextChunkMap[islot] += nInc; - } -} - -/*---------------------------------------------------------------------------------------------- - Unwind the read position of the stream, so that the following pass will begin - reading from the new position. The recipient is functioning as the input stream. -----------------------------------------------------------------------------------------------*/ -void GrSlotStream::UnwindInput(int islotNewPos, bool fPreBidiPass) -{ - Assert(m_islotReprocPos == -1); - Assert(islotNewPos <= m_islotReadPos); - - int islot; - for (islot = islotNewPos; islot < m_islotReadPos; ++islot) - m_vislotNextChunkMap[islot] = -1; - - m_islotReadPos = islotNewPos; - m_islotReadPosMax = m_islotReadPos; - - Assert(m_islotReadPos <= m_islotWritePos); - if (fPreBidiPass) - { - for (islot = m_islotReadPos; islot < m_islotWritePos; ++islot) - SlotAt(islot)->ZapDirLevel(); - } -} - -/*---------------------------------------------------------------------------------------------- - Unwind the write position of the stream, so that the pass will begin writing - at the new position. The recipient is functioning as the output stream -----------------------------------------------------------------------------------------------*/ -void GrSlotStream::UnwindOutput(int islotNewPos, bool fOutputOfPosPass) -{ - Assert(islotNewPos <= m_islotWritePos); - - int islot; - for (islot = islotNewPos; islot < m_islotWritePos; ++islot) - { - m_vislotPrevChunkMap[islot] = -1; - - if (!fOutputOfPosPass && m_fUsedByPosPass) - // This stream is the input to the first positioning pass, ie, the output - // of the last sub pass or the bidi pass. Zap the stream indices, - // since unwinding this pass could cause them to be invalid due to a later - // reordering. - SlotAt(islot)->ZapPosPassIndex(); - } - - m_islotWritePos = islotNewPos; - - m_fFullyWritten = false; - - if (m_islotSegMin > m_islotWritePos) - m_islotSegMin = -1; - if (m_islotSegLim > m_islotWritePos) - m_islotSegLim = -1; -} - -/*---------------------------------------------------------------------------------------------- - We've just created a new chunk, with the recipient as the output stream. The beginning - of the chunk is passed as 'islotOutput' and the end of the chunk is assumed to be the - write-position of the recipient. Store the mappings into the corresponding - input position. - - @param islotInputMin - beginning of chunk in input stream - @param islotOutputMin - beginning of chunk in output stream (recipient) - @param islotInputLim - end of chunk in input stream (currently not used) - @param fSkipChunkStart - if true, either we have reprocessed part of a - previously created chunk, - or there was no input consumed; - in either case, don't record the beginning of the chunk, - just make this chunk be part of the previous - @param fBackingUp - this chunk results in the stream position moving backwards, - so clear anything we're backing over -----------------------------------------------------------------------------------------------*/ -void GrSlotStream::MapInputChunk(int islotInputMin, int islotOutputMin, int islotInputLim, - bool fSkipChunkStart, bool fBackingUp) -{ - Assert(AssertValid()); - Assert(islotOutputMin >= -1); - - if (!fSkipChunkStart) - { - Assert(islotOutputMin >= 0); - if (islotOutputMin >= 0) // just in case an invalid value was passed - m_vislotPrevChunkMap[islotOutputMin] = islotInputMin; - } - - int islot; - for (islot = max(0, islotOutputMin + 1); islot < m_islotWritePos; ++islot) - m_vislotPrevChunkMap[islot] = -1; // not a chunk boundary - -// if (fBackingUp && m_islotWritePos < m_vislotPrevChunkMap.Size()) -// m_vislotPrevChunkMap[m_islotWritePos] = -1; - - if (fBackingUp) - for (islot = m_islotWritePos; islot < signed(m_vislotPrevChunkMap.size()); islot++) - m_vislotPrevChunkMap[islot] = -1; - -// m_vislotPrevChunkMap[m_islotWritePos] = islotInputLim; -} - -/*---------------------------------------------------------------------------------------------- - Return the length of the final chunk, where the recipient is the input stream. -----------------------------------------------------------------------------------------------*/ -int GrSlotStream::LastNextChunkLength() -{ - int cslotRet = 1; - for (int islot = m_islotReadPos; islot-- > 0; ) - { - if (m_vislotNextChunkMap[islot] != -1) - return cslotRet; - cslotRet++; - } - return cslotRet + 1; -} - -/*---------------------------------------------------------------------------------------------- - We've just created a new chunk, with the recipient as the input stream. The beginning of - the chunk is passed as 'islotInputMin' and the end of the chunk is assumed to be the - read-position of the recipient. Store the mappings into the corresponding - output position. - - @param islotOutputMin - beginning of chunk in output stream - @param islotInputMin - beginning of chunk in input stream (recipient) - @param islotOutputLim - end of chunk in output stream (currently not used) - @param fSkipChunkStart - if true, either we have reprocessed part of a - previously created chunk, - or there was no output generated; - in either case, don't record the beginning of the chunk, - just make this chunk be part of the previous - @param fBackingUp - this chunk results in the stream position moving backwards, - so clear anything we're backing over -----------------------------------------------------------------------------------------------*/ -void GrSlotStream::MapOutputChunk(int islotOutputMin, int islotInputMin, int islotOutputLim, - bool fSkipChunkStart, int cslotReprocess, bool fBackingUp) -{ - Assert(AssertValid()); - - // Note: islotInputMin can be less than -1 if there is a large reprocess buffer near the - // beginning of the input stream. In which case, fSkipChunk start should be true and - // cslotReprocess large enough to keep any of the stuff below from having any problems. - //Assert(islotInputMin >= -1); - - if (!fSkipChunkStart) - { - Assert(islotInputMin >= 0); - if (islotInputMin >= 0) // just in case an invalid value was passed - m_vislotNextChunkMap[islotInputMin] = islotOutputMin; - } - - int islot; - for (islot = max(0, islotInputMin + 1 + cslotReprocess); islot < m_islotReadPos; ++islot) - m_vislotNextChunkMap[islot] = -1; // not a chunk boundary - -// if (fBackingUp && m_islotReadPos < m_vislotNextChunkMap.Size()) -// m_vislotNextChunkMap[m_islotReadPos] = -1; - - if (fBackingUp) - for (islot = m_islotReadPos; islot < signed(m_vislotNextChunkMap.size()); islot++) - m_vislotNextChunkMap[islot] = -1; - -// m_vislotNextChunkMap[m_islotReadPos] = islotOutputLim; -} - -/*---------------------------------------------------------------------------------------------- - Ensure that the chunk maps for a pair of streams match properly. The recipient is - the input stream. -----------------------------------------------------------------------------------------------*/ -void GrSlotStream::AssertChunkMapsValid(GrSlotStream * psstrmOut) -{ -#ifdef _DEBUG - GrSlotStream * psstrmIn = this; - - Assert(m_ipass == 0 || (m_ipass + 1 == psstrmOut->m_ipass)); - - int islotMapNext; - int islotMapPrev; - int islot; - for (islot = 0; islot < m_islotReadPos; ++islot) - { - islotMapNext = psstrmIn->ChunkInNext(islot); - Assert(islotMapNext != -2); - if (islotMapNext != -1) - { - islotMapPrev = psstrmOut->ChunkInPrev(islotMapNext); - if (islotMapPrev == -2) - { - Assert(islot == psstrmOut->WritePos()); - } - else - { - Assert(islot == islotMapPrev); - } - } - } - - for (islot = 0; islot < psstrmOut->m_islotWritePos; ++islot) - { - islotMapPrev = psstrmOut->ChunkInPrev(islot); - Assert(islotMapPrev != -2); - if (islotMapPrev != -1) - { - islotMapNext = psstrmIn->ChunkInNext(islotMapPrev); - if (islotMapNext == -2) - { - Assert(islot == psstrmIn->ReadPos()); - } - else - { - Assert(islot == islotMapNext); - } - } - } -#endif // _DEBUG -} - -/*---------------------------------------------------------------------------------------------- - Ensure that corresponding items in the streams of a positioning pass have matching - stream indices. The recipient is the output stream. -----------------------------------------------------------------------------------------------*/ -void GrSlotStream::AssertStreamIndicesValid(GrSlotStream * psstrmIn) -{ -#ifdef _DEBUG - if (!GotIndexOffset()) - return; - - Assert(m_fUsedByPosPass); - - for (int islot = 0; islot < WritePos(); islot++) - { - GrSlotState * pslotOut = SlotAt(islot); - GrSlotState * pslotIn = - psstrmIn->SlotAt(islot + psstrmIn->IndexOffset() - IndexOffset()); - Assert(pslotOut->PosPassIndex() == pslotIn->PosPassIndex()); - Assert(pslotOut->HasAsPreviousState(pslotIn)); - } -#endif // _DEBUG -} - -/*---------------------------------------------------------------------------------------------- - Ensure that the roots of all attachments made in this chunk are present - in the output stream. (Currently the compiler ensures this by making it an error - to write rules that don't do this.) -----------------------------------------------------------------------------------------------*/ -void GrSlotStream::AssertAttachmentsInOutput(int islotMin, int islotLim) -{ -#ifdef _DEBUG - for (int islot = islotMin; islot < islotLim; islot++) - { - GrSlotState * pslotOut = SlotAt(islot); - int dislot = pslotOut->AttachTo(); - Assert(islotMin <= islot + dislot); - Assert(islot + dislot < islotLim); - } -#endif // _DEBUG -} - -/*---------------------------------------------------------------------------------------------- - Answer the slot index corresponding to the start of the chunk (as mapped to the following - stream). - ENHANCE: make more robust. -----------------------------------------------------------------------------------------------*/ -int GrSlotStream::ChunkInNextMin(int islot) -{ - int islotRet = islot; - while (m_vislotNextChunkMap[islotRet] == -1 && islotRet > 0) - --islotRet; - return islotRet; -} - -/*---------------------------------------------------------------------------------------------- - Answer the slot index corresponding to the end of the chunk (as mapped to the following - stream). - ENHANCE: make more robust. -----------------------------------------------------------------------------------------------*/ -int GrSlotStream::ChunkInNextLim(int islot) -{ - int islotRet = islot + 1; - if (islotRet == m_islotReadPos) - return islot; - while (m_vislotNextChunkMap[islotRet] == -1 && islotRet < m_islotReadPos) - { - ++islotRet; - //Assert(islotRet < signed(m_vislotNextChunkMap.size())); - if (islotRet >= signed(m_vislotNextChunkMap.size())) - { - islotRet = m_vislotNextChunkMap.size() - 1; - break; - } - } - return islotRet; -} - -/*---------------------------------------------------------------------------------------------- - Skip over the given number slots. This is used to resync the streams when we - are restarting a new segment. Specifically the output stream informs the - input stream of the number of slots to skip to get the boundary for a chunk that - the output finds interesting. -----------------------------------------------------------------------------------------------*/ -void GrSlotStream::ResyncSkip(int cslot) -{ - Assert(AssertValid()); - m_islotReadPos += cslot; - m_cslotSkippedForResync = cslot; - // Should never skip past the beginning of the line. - Assert(m_islotSegMin == -1 || m_islotReadPos <= m_islotSegMin); -} - -/*---------------------------------------------------------------------------------------------- - Record the number of slots in the stream that are previous to the official start of the - segment. -----------------------------------------------------------------------------------------------*/ -void GrSlotStream::CalcIndexOffset(GrTableManager * ptman) -{ - if (GotIndexOffset()) - return; // already figured it - - if (m_islotSegMin > -1) - { - m_cslotPreSeg = m_islotSegMin; - if (m_fUsedByPosPass) - { - for (int islotPre = 0; islotPre < WritePos(); islotPre++) - { - SlotAt(islotPre)->SetPosPassIndex(islotPre - m_cslotPreSeg, - m_fInputToPosPass1); - } - } - } - // else can't figure it out yet - - // Old code: -#if 0 - gid16 chwLB = ptman->LBGlyphID(); - - for (int islot = 0; islot < WritePos(); islot++) - { - if (SlotAt(islot)->IsLineBreak(chwLB)) - { - if (SlotAt(islot)->IsInitialLineBreak(chwLB)) - { - m_cslotPreSeg = islot; - } - else - { - // Otherwise, we hit the final line break, which is kind of strange, because - // in this case there is no initial line break, and we should have set - // m_cslotPreSeg to 0 immediately when it was initialized. - Assert(false); - m_cslotPreSeg = 0; - } - - if (m_fUsedByPosPass) - { - for (int islotPre = 0; islotPre < WritePos(); islotPre++) - { - SlotAt(islotPre)->SetPosPassIndex(islotPre - m_cslotPreSeg, - m_fInputToPosPass1); - } - } - return; - } - - } - // No line breaks yet, so no way to tell. -#endif -} - -/*---------------------------------------------------------------------------------------------- - Set the positions in the streams for the next rule. The recipient is the output stream. - If we are moving backwards, copy part of the output stream back to (a temporary buffer - in) the input stream, so that we can reprocess it. - - @param cslotArg - how far to skip forward or back; most commonly zero -----------------------------------------------------------------------------------------------*/ -void GrSlotStream::SetPosForNextRule(int cslotArg, GrSlotStream * psstrmIn, - bool fOutputOfPosPass) -{ - Assert(AssertValid()); - - int cslot = cslotArg; - // Can't reprocess what has already been read by the next pass. MaxBackup should allow - // the flexibility needed, but if not, we fix it here. - if (m_islotWritePos + cslot < m_islotReadPos) - cslot = m_islotReadPos - m_islotWritePos; - - Assert(psstrmIn->m_ipass == m_ipass-1); - - if (cslot >= 0) - { - // Skipping forward. - Assert(cslot <= psstrmIn->SlotsPendingInContext()); - for (int islot = 0; islot < cslot; islot++) - CopyOneSlotFrom(psstrmIn); - } - else - { - // Reprocessing. - - // Save corresponding positions before doing the back-up. - int islotReadPosInSave = psstrmIn->ReadPosForNextGet(); - int islotWritePosOutSave = this->WritePos(); - - std::vector vpslotTmp; - int islot; - if (psstrmIn->SlotsToReprocess() > 0) - { - // Stick any slots still to reprocess in a temporary buffer. - for (islot = psstrmIn->m_islotReprocPos; - islot < signed(psstrmIn->m_vpslotReproc.size()); - islot++) - { - vpslotTmp.push_back(psstrmIn->m_vpslotReproc[islot]); - } - } - - psstrmIn->ClearReprocBuffer(); - psstrmIn->m_islotReprocLim = psstrmIn->m_islotReadPos; - - for (islot = cslot; islot < 0; islot++) - psstrmIn->m_vpslotReproc.push_back(m_vpslot[m_islotWritePos+islot]); - for (islot = 0; islot < signed(vpslotTmp.size()); islot++) - psstrmIn->m_vpslotReproc.push_back(vpslotTmp[islot]); - psstrmIn->m_islotReprocPos = 0; - - if (!fOutputOfPosPass && m_fUsedByPosPass) - { - // Last substitution pass; zap the stream indices, since they may - // now be invalid. - for (islot = 0; islot < signed(psstrmIn->m_vpslotReproc.size()); islot++) - psstrmIn->m_vpslotReproc[islot]->ZapPosPassIndex(); - } - - // If either the min or lim is in the middle of the reprocess buffer, - // adjust as necessary to match where it is in the output stream. - int islotSegMinIn = psstrmIn->SegMin(); - if (islotSegMinIn > -1 && - psstrmIn->ReadPosForNextGet() <= islotSegMinIn && - islotSegMinIn < islotReadPosInSave) - { - Assert(this->SegMin() > -1); - int dislotIn = islotReadPosInSave - islotSegMinIn; - int dislotOut = islotWritePosOutSave - SegMin(); - psstrmIn->SetSegMin(islotSegMinIn + dislotIn - dislotOut, true); - if (psstrmIn->m_cslotPreSeg > psstrmIn->SegMin()) - psstrmIn->m_cslotPreSeg = -1; - } - int islotSegLimIn = psstrmIn->SegLimIfKnown(); - if (islotSegLimIn > -1 && - psstrmIn->ReadPosForNextGet() <= islotSegLimIn && - islotSegLimIn < islotReadPosInSave) - { - int islotSegLimOut = this->SegLimIfKnown(); - Assert(islotSegLimOut > -1); - int dislotIn = islotReadPosInSave - islotSegLimIn; - int dislotOut = islotWritePosOutSave - islotSegLimOut; - psstrmIn->SetSegLim(islotSegLimIn + dislotIn - dislotOut); - } - - m_islotWritePos += cslot; - - if (m_islotSegMin >= m_islotWritePos) - m_islotSegMin = -1; - if (m_islotSegLim >= m_islotWritePos) - m_islotSegLim = -1; - } -} - -/*---------------------------------------------------------------------------------------------- - If a rule was run over a LB glyph, set the appropriate flag in the table manager. - CURRENTLY NOT USED -----------------------------------------------------------------------------------------------*/ -void GrSlotStream::SetLBContextFlag(GrTableManager * ptman, int islotStart) -{ - gid16 chwLB = ptman->LBGlyphID(); - for (int islot = islotStart; islot < WritePos(); islot++) - { - GrSlotState * pslot = SlotAt(islot); - if (pslot->IsInitialLineBreak(chwLB)) - ptman->State()->SetStartLineContext(true); - if (pslot->IsFinalLineBreak(chwLB)) - ptman->State()->SetEndLineContext(true); - } -} - -/*---------------------------------------------------------------------------------------------- - Return the number of slots that have been output by the current pass but must be - reprocessed by this same pass. The recipient is serving as the input stream. -----------------------------------------------------------------------------------------------*/ -int GrSlotStream::SlotsToReprocess() -{ - Assert(AssertValid()); - - if (m_islotReprocPos == -1) - return 0; - return (m_vpslotReproc.size() - m_islotReprocPos); -} - -/*---------------------------------------------------------------------------------------------- - Get the input at the given slot, that is, the original input, ignoring the issue of - reprocessing. -----------------------------------------------------------------------------------------------*/ -GrSlotState * GrSlotStream::GetSlotAt(int islot) -{ - return m_vpslot[islot]; -} - -/*---------------------------------------------------------------------------------------------- - Return the "current" input item from the rule's perspective, ie, the last slot read. - So dislotOffset = 0 means not the slot at the read position but one slot earlier. - - If dislotOffset is less the the original read position that was in effect at the - beginning of the rule, we need to read from the output stream, which has the - up-to-date values. See the class comment for more details. - - @param dislotOffset - offset from current stream position - @param fNullOkay - true if it's okay to return NULL in the situation where we're asking - for something before the beginning of the stream -----------------------------------------------------------------------------------------------*/ - -GrSlotState * GrSlotStream::RuleInputSlot(int dislotOffset, GrSlotStream * psstrmOutput, - bool fNullOkay) -{ - Assert(m_islotRuleStartRead <= m_islotReadPos); - - if (dislotOffset > 0) - return Peek(dislotOffset - 1); - - int cslotOffsetBack = dislotOffset * -1; - - if (m_islotReprocLim > -1) - { - // There is a reprocess buffer. - - // Position when starting the rule should never be earlier than the - // beginning of the reprocess buffer. - Assert(m_islotRuleStartRead >= m_islotReprocLim - signed(m_vpslotReproc.size())); - - // number of items following the reprocess buffer: - int cslotPostReproc = m_islotReadPos - m_islotReprocLim; - - if (cslotOffsetBack >= cslotPostReproc) - { - // number of items in the reprocess buffer that were valid when the rule - // was started: - int cslotValidReproc = m_islotReprocLim - m_islotRuleStartRead; - - if (cslotOffsetBack >= cslotPostReproc + cslotValidReproc) - { - // Read from the output stream. - int dislotTmp = dislotOffset - 1 + cslotPostReproc + cslotValidReproc; - Assert(dislotTmp < 0); - return psstrmOutput->PeekBack(dislotTmp); - } - else - { - if (m_islotReprocPos > -1) - { - // Current read pos is inside reprocess buffer. - Assert(cslotPostReproc == 0); - int islotStartReadReprocBuf = m_vpslotReproc.size() - cslotValidReproc; - Assert(islotStartReadReprocBuf >= 0); - int islotInReprocBuf = m_islotReprocPos - cslotOffsetBack - 1; - if (islotInReprocBuf < islotStartReadReprocBuf) - { - // Return a slot from before the reprocess buffer, from the - // output stream (which is serving as our input stream for precontext - // items). - return psstrmOutput->PeekBack(islotInReprocBuf - islotStartReadReprocBuf); - } - else if (islotInReprocBuf < 0) - { - Assert(false); - //int islotReprocMin = m_islotReprocLim - m_vpslotReproc.Size(); - //return m_vpslot[islotReprocMin + islotInReprocBuf]; - } - else - // Read from the reprocess buffer. - return m_vpslotReproc[islotInReprocBuf]; - } - else - // Looking backwards into the reprocess buffer. - return m_vpslotReproc[ - m_vpslotReproc.size() - cslotOffsetBack + cslotPostReproc - 1]; - } - } - } - - // There is no reprocess buffer, or it is not a factor. - - if (m_islotReadPos + dislotOffset - 1 < m_islotRuleStartRead) - { - // Read from the output stream. - return psstrmOutput->PeekBack(m_islotReadPos + dislotOffset - 1 - m_islotRuleStartRead, - fNullOkay); - } - else - { - // Read normally from the input stream. - return m_vpslot[m_islotReadPos - cslotOffsetBack - 1]; - } -} - -/*---------------------------------------------------------------------------------------------- - Return the "current" output item from the rule's perspective, ie, the last slot written. - So dislotOffset = 0 means not the slot at the write position but one slot earlier. -----------------------------------------------------------------------------------------------*/ - -GrSlotState * GrSlotStream::RuleOutputSlot(int dislotOffset) -{ - return m_vpslot[m_islotWritePos - 1 + dislotOffset]; -} - -/*---------------------------------------------------------------------------------------------- - For any slot in the final output that has no associations, set the "before" pointer to - the following slot and the "after" pointer to the preceding slot. The idea of this is - that it will make it impossible to select a the glyph separately. - - Note that if the slot is the first on the line, it will not be associated with - a slot in the previous segment. - - @param chwLB - the glyph IB for the line-break glyphs -----------------------------------------------------------------------------------------------*/ -void GrSlotStream::SetNeutralAssociations(gid16 chwLB) -{ - for (int islot = 0; islot < m_islotWritePos; ++islot) - { - GrSlotState * pslot = SlotAt(islot); - if (pslot->PassModified() > 0 && - (pslot->BeforeAssoc() == kPosInfinity || pslot->AfterAssoc() == kNegInfinity)) - { - pslot->CleanUpAssocs(); - if (pslot->BeforeAssoc() != kPosInfinity && pslot->AfterAssoc() != kNegInfinity) - continue; - - Assert(pslot->BeforeAssoc() == kPosInfinity && pslot->AfterAssoc() == kNegInfinity); - - GrSlotState * pslotBefore = FindAssociatedSlot(islot, 1, chwLB); - GrSlotState * pslotAfter = FindAssociatedSlot(islot, -1, chwLB); - - if (pslotBefore && pslotAfter) - pslot->Associate(pslotBefore, pslotAfter); - else if (pslotBefore) - pslot->Associate(pslotBefore); - else if (pslotAfter) - pslot->Associate(pslotAfter); - else - // Weird, but can happen with an empty segment. - Warn("No assocations"); - -// Assert(pslot->m_vpslotAssoc.Size() > 0); - pslot->m_fNeutralAssocs = true; - } - } -} - -/*---------------------------------------------------------------------------------------------- - Find the next or previous slot in the final output that has explicit associations, or - return NULL if none. - - @param islot - starting slot - @param nInc - +1 if we want to find the next slot, -1 if we want the previous slot - @param chwLB - the glyph IB for the line-break glyphs -----------------------------------------------------------------------------------------------*/ -GrSlotState * GrSlotStream::FindAssociatedSlot(int islot, int nInc, gid16 chwLB) -{ - int islotNext = islot + nInc; - - while (islotNext >= 0 && islotNext < m_islotWritePos) - { - GrSlotState * pslotRet = SlotAt(islotNext); - if (pslotRet->IsLineBreak(chwLB)) - { } - else if (pslotRet->PassModified() == 0 || - (pslotRet->m_vpslotAssoc.size() > 0 && pslotRet->m_fNeutralAssocs == false)) - { - return pslotRet; - } - islotNext += nInc; - } - return NULL; -} - -} // namespace gr diff --git a/Build/source/libs/graphite/engine-2.3.1/src/segment/GrSlotStream.h b/Build/source/libs/graphite/engine-2.3.1/src/segment/GrSlotStream.h deleted file mode 100644 index 006191252dc..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/src/segment/GrSlotStream.h +++ /dev/null @@ -1,577 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 1999, 2001 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: GrSlotStream.h -Responsibility: Sharon Correll -Last reviewed: Not yet. - -Description: - Classes GrSlotStream and GrSlotState. -----------------------------------------------------------------------------------------------*/ -#ifdef _MSC_VER -#pragma once -#endif -#ifndef SLOTSTREAM_INCLUDED -#define SLOTSTREAM_INCLUDED - -//:End Ignore - -namespace gr -{ - -class EngineState; -class Font; - -/*---------------------------------------------------------------------------------------------- - Each GrSlotStream represents the output of one pass, which also serves as the input - of the following pass. Hence it has two positions, a write position for when it is - serving as an output stream, and a read position for when it is serving as an input - stream. The TableManager holds a list of the streams. - - The reading of slot streams is complicated by two factors. First, it may be necessary - to access the "pre-context" items of a rule, which are the slots before the current - stream position at the point when the rule is matched. These items will not be modified - by the rule, but may have been modified by a previous rule in the same pass, Therefore - we need to read these slots from the output stream, rather than the input stream, - because the output stream has the current slot attribute values that we want to work with. - In order make this happen, we keep track of the read and write positions of - the streams at the time the current rule was matched (m_islotRuleStartRead and - m_islotRuleStartWrite) and whenever we try to read a slot before m_islotRuleStartRead, - we read the corresponding slot from the output stream instead. - - Second, a rule may explicitly set the advance position so that some items are - actually reprocessed (and potentially modified) by the same pass. When this happens, - we actually copy the slots to reprocess from the output stream back - into a temporary buffer (m_vpslotReproc) in the input stream, and set up the stream so - that the next read operations will read from the buffer. - - It gets tricky because these two mechanisms can overlap with each other, so care - must be taken to read from the right place: the input stream in the normal way, - the reprocess buffer, or the output stream. See the RuleInputSlot method. - - Another messy bit of code has to do with maintaining chunks. These are used for - backtracking and unwinding after inserting a line-break. Adjacent streams have maps - showing how many slots were processed by a single rule; the maps must be consisent - between adjacent rules. The following is an example of a pair of valid chunk maps: - - Input stream Output stream - Pos next-map prev-map - 0 0 0 - 1 -1 -1 - 2 2 2 - 3 4 -1 - 4 -1 3 - 5 -1 -1 - 6 7 -1 - 7 -1 6 - 8 -1 -1 - - A -1 means that slot is not at the beginning of a chunk. Otherwise, there must be a - corresponding value in the parallel map of the adjacent stream--eg, the input stream's - next-map(3) == 4 and the output stream's prev-map(4) == 3. Assertions are run - regularly to ensure that the chunk maps stay valid. - - So above, the first chunk corresponds to slots 0-1 in the input and 0-1 in the output; - two slots were processed by the rule. The second chunk corresponds to slot 2 - in the input and slots 2-3 in the output (a slot was inserted). - The third corresponds to slots 3-5 in the input and 4-6 in the output (three slots - processed). The fourth chunk covers slots 6-8 in the input and 7-8 in the output - (one slot was deleted). - - ENHANCE SharonC: explain the effect of skipped slots on the chunk maps. - - Hungarian: sstrm -----------------------------------------------------------------------------------------------*/ -class GrSlotStream { - - friend class GrSlotState; - friend class FontMemoryUsage; - -public: - // Constructor: - GrSlotStream(int ipass) - { - m_ipass = ipass; - m_vpslot.clear(); - m_vislotPrevChunkMap.clear(); - m_vislotNextChunkMap.clear(); - m_vpslotReproc.clear(); - } - - // Destructor: - ~GrSlotStream() - { - ReleaseSlots(0, m_vpslot.size()); - } - - void ReleaseSlots(int islotMin, int islotLim) - { - // A slot stream is responsible for deleting the slot states that it created, - // that is, the ones whose modified tag equals this stream's pass index. - // NO LONGER TRUE - there is a master list of them managed by the GrTableManager. -// for (int islot = islotMin; islot < islotLim; ++islot) -// { -// if (m_vpslot[islot]->m_ipassModified == m_ipass) -// delete m_vpslot[islot]; -// } - } - - // Getters: - int WritePos() { return m_islotWritePos; } - int ReadPos() { return m_islotReadPos; } - bool FullyWritten() { return m_fFullyWritten; } - - int SlotsPresent() { return m_vpslot.size(); } - - // Setters: - void SetWritePos(int islot) - { - m_islotWritePos = islot; - } - void SetReadPos(int islot) - { - m_islotReadPos = islot; - } - - void Initialize(int ipassPos1, bool fAnythingPrevious) - { - m_islotWritePos = 0; - m_islotReadPos = 0; - m_islotReprocPos = -1; - m_islotReprocLim = -1; - m_islotRuleStartRead = 0; - m_islotRuleStartWrite = 0; - m_islotReadPosMax = 0; - m_cslotSkippedForResync = 0; - m_cslotPreSeg = (fAnythingPrevious) ? -1 : 0; - m_fFullyWritten = false; - m_islotSegMin = -1; - m_islotSegLim = -1; - m_fUsedByPosPass = (m_ipass + 1 >= ipassPos1); - m_fInputToPosPass1 = (m_ipass + 1 == ipassPos1); - m_vpslot.clear(); // not responsible for destroying the slots - m_vislotPrevChunkMap.clear(); - m_vislotNextChunkMap.clear(); - } - -public: - bool AtEnd(); - bool AtEndOfContext(); - void NextPut(GrSlotState* pslot); - GrSlotState * NextGet(); - GrSlotState * Peek(int dislot = 0); - GrSlotState * PeekBack(int dislot, bool fNullOkay = false); - void Skip(int = 1); - GrSlotState * SlotAt(int islot) - { - return m_vpslot[islot]; - } - - int OutputOfPass() - { - return m_ipass; - } - - // This function is intended to be used within positioning passes where there is a - // one-to-one correspondence beween the slots in consecutive streams. - GrSlotState * OutputSlotAt(int islot) - { - return Peek(islot - ReadPosForNextGet()); - } - - int ReadPosForNextGet() - { - return ReadPos() - SlotsToReprocess(); - } - - // Only valid for streams that are the input or output to a positioning pass. - GrSlotState * SlotAtPosPassIndex(int islot) - { - Assert(GotIndexOffset()); - Assert(m_fUsedByPosPass); - return m_vpslot[islot + m_cslotPreSeg]; - } - - // Only valid for streams that are the input or output to a positioning pass. - bool HasSlotAtPosPassIndex(int islot) - { - Assert(GotIndexOffset()); - Assert(m_fUsedByPosPass); - return (signed(m_vpslot.size()) > (islot + m_cslotPreSeg)); - } - - bool AssertValid(); - void AssertChunkMapsValid(GrSlotStream * psstrmOut); - void AssertStreamIndicesValid(GrSlotStream * psstrmIn); - void AssertAttachmentsInOutput(int islotMin, int islotLim); - bool NoReproc() - { - return (m_islotReprocPos == -1 || (m_islotReprocPos >= signed(m_vpslotReproc.size()))); - } - - int SlotsPending(); - int SlotsPendingInContext(); - int TotalSlotsPending(); - bool PastEndOfPositioning(bool fOutput); - - void ClearReprocBuffer() - { - m_islotReprocPos = -1; - m_islotReprocLim = -1; - m_vpslotReproc.clear(); - } - - int ReprocLim() - { - return m_islotReprocLim; - } - - int ReprocMin() - { - Assert(m_islotReprocPos > -1); - return m_islotReprocLim - m_vpslot.size(); - } - - int RuleStartReadPos() - { - return m_islotRuleStartRead; - } - - void SetRuleStartReadPos() - { - if (m_islotReprocPos > -1) - m_islotRuleStartRead = m_islotReprocLim - SlotsToReprocess(); - else - m_islotRuleStartRead = m_islotReadPos; - } - - int RuleStartWritePos() - { - return m_islotRuleStartWrite; - } - - void SetRuleStartWritePos() - { - m_islotRuleStartWrite = m_islotWritePos; - } - - void MarkFullyWritten(); - - void SetSegMin(int islot, bool fAdjusting = false) - { - Assert(fAdjusting || m_islotSegMin == -1 || m_islotSegMin == islot); - m_islotSegMin = islot; - } - void SetSegMinToWritePos(bool fMod = true) - { - if (m_islotSegMin == -1) - m_islotSegMin = m_islotWritePos; - else - Assert(m_islotSegMin <= m_islotWritePos); // eg, already set to before the initial LB - } - int SegMin() - { - return m_islotSegMin; - } - void SetSegLim(int islot) - { - m_islotSegLim = islot; - } - void SetSegLimToWritePos(bool fMod = true) - { - if (m_islotSegLim > -1 && !fMod) - { - Assert(m_islotSegLim <= m_islotWritePos); - return; - } - m_islotSegLim = m_islotWritePos; - } - int SegLimIfKnown() - { - return m_islotSegLim; - } - int FinalSegLim() - { - if (m_islotSegLim > -1) - return m_islotSegLim; - else - return m_islotWritePos; - } - - // Return true if we are exactly at the segment min. - bool AtSegMin() - { - if (m_islotSegMin == -1) - return false; - return (m_islotSegMin == ReadPosForNextGet()); - } - - // Return true if we are exactly at the segment lim. - bool AtSegLim() - { - if (m_islotSegLim == -1) - return false; - return (m_islotSegLim == ReadPosForNextGet()); - } - - int ReadPosMax() - { - return m_islotReadPosMax; - } - void SetReadPosMax(int islot) - { - m_islotReadPosMax = std::max(m_islotReadPosMax, islot); - } - - int OldDirLevelRange(EngineState * pengst, int islotStart, int nTopDirection); - int DirLevelRange(EngineState * pengst, int islotStart, int nTopDirection, - std::vector & vislotStarts, std::vector & vislotStops); - int GetSlotDirLevel(EngineState * pengst, int islot, - int nOuterLevel, int nCurrLevel, DirCode dircMarker, DirCode dircOverride); - DirCode AdjacentStrongCode(EngineState * pengst, int islot, int nInc, - DirCode dircPDF, bool fNumbersAreStrong = false); - DirCode TerminatorSequence(EngineState * pengst, int islot, int nInc, DirCode dircPDF); - DirCode AdjacentNonBndNeutralCode(EngineState * pengst, int islot, int nInc, - DirCode dircPDF); - - void CopyOneSlotFrom(GrSlotStream * psstrmPrev); - void SimpleCopyFrom(GrSlotStream * psstrmI, int islotInput, int islotOutput); - - bool MoreSpace(GrTableManager * ptman, - float xsSpaceAllotted, bool fWidthIsCharCount, - bool fIgnoreTrailingWS, TrWsHandling twsh, - float * pxsWidth); - - int InsertLineBreak(GrTableManager * ptman, - int islotPrevBreak, bool fInsertedLB, int islotStartTry, - LineBrk lb, TrWsHandling twsh, int islotMin, LineBrk * plbNextToTry); - int MakeSegmentBreak(GrTableManager * ptman, - int islotPrevBreak, bool fInsertedLB, int islotStartTry, - LineBrk lb, TrWsHandling twsh, int islotMin, LineBrk * plbNextToTry); - bool FindSegmentEnd(GrTableManager * ptman, - int islotStartTry, LineBrk lb, TrWsHandling twsh, int islotMin, - int * pislot, int * pichwSegOffset, - LineBrk * plbFound, LineBrk * plbNextToTry); - bool HasEarlierBetterBreak(int islotBreak, LineBrk lbFound, gid16 chwLB); - LineBrk BreakWeightAt(gid16 chwLB, int islot); - void AppendLineBreak(GrTableManager *, GrCharStream * pchstrm, - LineBrk, DirCode dirc, int islot, bool fInitial, int ichwSegOffset); - int FindFinalLineBreak(gid16 chwLB, int islotMin, int islotLim); - void AdjustPrevStreamNextChunkMap(GrTableManager * ptman, int islotMod, int nInc); - void AdjustNextChunkMap(int islotMin, int islotMod, int nInc); - - void EnsureLocalCopy(GrTableManager * ptman, GrSlotState * pslot, GrSlotStream * psstrmIn); - void ReplaceSlotInReprocessBuffer(GrSlotState * pslotOld, GrSlotState * pslotNew); - - void ZapCalculatedDirLevels(int islotLB); - - int MaxClusterSlot(int islotChunkLim) - { - return MaxClusterSlot(islotChunkLim - 1, islotChunkLim); - } - int MaxClusterSlot(int islotChunkMin, int islotChunkLim); - - void UnwindInput( int islot, bool fPreBidiPass); - void UnwindOutput(int islot, bool fOutputOfPosPass); - - void MapInputChunk( int islotIn, int islotOut, int islotInLim, - bool fReprocessing, bool fBackingUp); - void MapOutputChunk(int islotOut, int islotIn, int islotOutLim, - bool fReprocessing, int cslotReprocess, bool fBackingUp); - - int LastNextChunkLength(); - - int ChunkInPrev(int i) - { - Assert(i >= 0); - Assert(i < signed(m_vislotPrevChunkMap.size())); - Assert(i < m_islotWritePos); - return m_vislotPrevChunkMap[i]; - } - int ChunkInNext(int i) - { - Assert(i >= 0); - Assert(i < signed(m_vislotNextChunkMap.size())); - Assert(i < m_islotReadPos); - return m_vislotNextChunkMap[i]; - } - - int ChunkInNextMin(int islot); - int ChunkInNextLim(int islot); - - void ResyncSkip(int nslot); - int SlotsSkippedToResync() - { - return m_cslotSkippedForResync; - } - void ClearSlotsSkippedToResync() - { - m_cslotSkippedForResync = 0; - } - - int IndexOffset() - { - Assert(GotIndexOffset()); // should have been calculated - return m_cslotPreSeg; - } - void SetIndexOffset(int c) - { - m_cslotPreSeg = c; - } - bool GotIndexOffset() - { - return (m_cslotPreSeg >= 0); - } - void CalcIndexOffset(GrTableManager * ptman); - - void SetPosForNextRule(int nslot, GrSlotStream * psstrmInput, bool fOutputOfPosPass); - void SetLBContextFlag(GrTableManager * ptman, int islotStart); - int SlotsToReprocess(); - - void SetNeutralAssociations(gid16 chwLB); -protected: - GrSlotState * FindAssociatedSlot(int islot, int nInc, gid16 chwLB); - - GrSlotState * GetSlotAt(int islot); - -public: - // Used by the action code: - void BackupReadPos(int cslot = 1) - { - for (int islot = 0; islot < cslot; islot++) - { - if (m_islotReprocLim > -1 && m_islotReprocLim == m_islotReadPos) - { - if (m_islotReprocPos == -1) - m_islotReprocPos = m_vpslotReproc.size() - 1; - else - --m_islotReprocPos; - Assert(m_islotReprocPos >= 0); - } - else - --m_islotReadPos; - } - } - - GrSlotState * RuleInputSlot(int dislot = 0, GrSlotStream * psstrmOut = NULL, - bool fNullOkay = false); - GrSlotState * RuleOutputSlot(int dislot = 0); - - void PutSlotAt(GrSlotState * pslot, int islot) - { - // Currently only used for the final pass, when applying justify.width to - // the advance width. - Assert(signed(m_vpslot.size()) > islot); - Assert(WritePos() > islot); - Assert(ReadPos() <= islot); - Assert(SlotsToReprocess() == 0); - m_vpslot[islot] = pslot; - } - -protected: - // Instance variables: - int m_ipass; // which pass this stream is serving as OUTPUT of - - std::vector m_vpslot; // the slots being processed - - // Chunking information: - std::vector m_vislotPrevChunkMap; // chunk mapping into previous stream; - // -1 if not at a chunk boundary - // (this information is needed for - // reinitialization after inserting a line break) - - std::vector m_vislotNextChunkMap; // chunk mapping into next stream, or -1 - // (this information is needed for backtracking) - - // Since most streams serve as both input and output, there are two positions. - // Note that readPos <= writePos always. - int m_islotWritePos; // where previous pass should put next output - int m_islotReadPos; // where following pass should start processing from - - // When we are reprocessing some of the output from the next stream: - std::vector m_vpslotReproc; // temporary buffer - int m_islotReprocLim; // the read position corresponding to the end of the reprocess - // buffer; -1 if buffer is invalid - int m_islotReprocPos; // index into m_vpslotReproc from where we should read next; - // -1 if we are not reprocessing - - int m_islotRuleStartRead; // read position when the rule was started; any requests before - // this point should access the output stream, because it has - // the most up-to-date values. - int m_islotRuleStartWrite; // write position when the rule started - - bool m_fFullyWritten; // set to true when we can't get any more from the - // previous pass; initially false. - - int m_islotSegMin; // the official min of the segment; -1 if not yet set - int m_islotSegLim; // the official lim of the segment; -1 if not yet set - // (only set for the output of the final line-break pass - // and those beyond) - - int m_cslotSkippedForResync; // number of slots skipped to resync; - // specifically, the number of slots' worth of the - // next-chunk-map that are invalid, not mapped - // to any slots in the following stream - - int m_cslotPreSeg; // number of slots previous to the official beginning of the segment; - // -1 if we haven't figured it out yet. Used for keeping streams - // in the positioning pass in sync; not particularly useful for - // substitution passes, and will possibly be left uncalculated. - - bool m_fUsedByPosPass; // true if this is input to or output from a positioning pass - bool m_fInputToPosPass1; // true if this is the input to the first positioning pass - - // Max value of m_islotReadPos; used for recognizing infinite loops and forcibly - // advancing (see GrPass::CheckInputProgress). - int m_islotReadPosMax; - -public: - // For transduction logging: -#ifdef TRACING -// void LogSlotGlyphs(std::ofstream & strmOut, gid16 chwLB); -#endif // TRACING - - // For test procedures: - int NumberOfSlots() { return m_vpslot.size(); } - GrSlotState * LastSlotWritten() - { - if (m_islotWritePos == 0) - return NULL; - else - return m_vpslot[m_islotWritePos-1]; - } - GrSlotState * LastSlotRead() - { - if (m_islotReadPos == 0) - return NULL; - else - return m_vpslot[m_islotReadPos-1]; - } - - gid16 GlyphIDAt(int islot) - { - return m_vpslot[islot]->m_chwGlyphID; - } - - int PreChunk() // answer the number of prepended items that are not in any chunk; - // should be obsolete now - { - int islot; - for (islot = 0; islot < m_islotReadPos; ++islot) - { - if (m_vislotNextChunkMap[islot] != -1) - return islot; - } - Assert(false); - return islot; - } - -}; // end of class GrSlotStream - -} // namespace gr - - -#endif // !SLOTSTREAM_INCLUDED diff --git a/Build/source/libs/graphite/engine-2.3.1/src/segment/GrTableManager.cpp b/Build/source/libs/graphite/engine-2.3.1/src/segment/GrTableManager.cpp deleted file mode 100644 index e01dcf13c7b..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/src/segment/GrTableManager.cpp +++ /dev/null @@ -1,2694 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 1999, 2001 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: GrTableManager.cpp -Responsibility: Sharon Correll -Last reviewed: Not yet. - -Description: - GrTableManager, which handles the interactions between passes, including the demand-pull - algorithm. --------------------------------------------------------------------------------*//*:End Ignore*/ - -//:>******************************************************************************************** -//:> Include files -//:>******************************************************************************************** -#include "Main.h" - -#ifdef _MSC_VER -#pragma hdrstop -#endif -#undef THIS_FILE -DEFINE_THIS_FILE -#ifndef _WIN32 -#include -#endif -#include - -//:>******************************************************************************************** -//:> Forward declarations -//:>******************************************************************************************** - -//:>******************************************************************************************** -//:> Local Constants and static variables -//:>******************************************************************************************** - -namespace gr -{ - -//:>******************************************************************************************** -//:> Methods -//:>******************************************************************************************** - -/*---------------------------------------------------------------------------------------------- - Constructors and initializers -----------------------------------------------------------------------------------------------*/ -EngineState::EngineState() - : m_ipassJustCalled(-1), - m_fStartLineContext(false), - m_fEndLineContext(false), - ////m_pgg(NULL), - m_cslotPreSeg(0), - m_islotblkCurr(-1), - m_islotNext(kSlotBlockSize), - m_fInitialLB(false), - m_fFinalLB(false), - m_fInsertedLB(false), - m_fExceededSpace(false), - m_fHitHardBreak(false), - m_fRemovedWhtsp(false), - m_dxsShrinkPossible(GrSlotState::kNotYetSet), - m_islotPosNext(-1), - m_xsPosXNext(0), - m_ysPosYNext(0), - m_dxsTotWidthSoFar(0), - m_dxsVisWidthSoFar(0), - m_prgzpst(NULL), - m_prgpsstrm(NULL) -{ - m_vslotblk.clear(); - m_vprgnSlotVarLenBufs.clear(); -} - -void EngineState::Initialize(GrEngine * pgreng, GrTableManager * ptman) -{ - m_ptman = ptman; - m_cpass = ptman->NumberOfPasses(); // duplicate for convenience - - m_cUserDefn = pgreng->NumUserDefn(); - m_cFeat = pgreng->NumFeat(); - m_cCompPerLig = pgreng->NumCompPerLig(); - - if (m_prgzpst) - delete[] m_prgzpst; - m_prgzpst = new PassState[m_cpass]; - ptman->StorePassStates(m_prgzpst); -} - -/*---------------------------------------------------------------------------------------------- - Destructors -----------------------------------------------------------------------------------------------*/ -GrTableManager::~GrTableManager() -{ - for (int ipass = 0; ipass < m_cpass; ++ipass) - delete Pass(ipass); - - delete[] m_prgppass; -} - -EngineState::~EngineState() -{ - DestroySlotBlocks(); - - delete[] m_prgzpst; - - if (m_prgpsstrm) - { - for (int isstrm = 0; isstrm < m_cpass; ++isstrm) - delete OutputStream(isstrm); - - delete[] m_prgpsstrm; - } -} - -/*---------------------------------------------------------------------------------------------- - Delete all the slots. -----------------------------------------------------------------------------------------------*/ -void EngineState::DestroySlotBlocks() -{ - Assert(m_vslotblk.size() == m_vprgnSlotVarLenBufs.size()); - for (size_t islotblk = 0; islotblk < m_vslotblk.size(); ++islotblk) - { - delete[] m_vslotblk[islotblk]; - delete[] m_vprgnSlotVarLenBufs[islotblk]; - } - m_vslotblk.clear(); - m_vprgnSlotVarLenBufs.clear(); -} - -/*---------------------------------------------------------------------------------------------- - Create the passes, and them fill them in by reading from the file stream. -----------------------------------------------------------------------------------------------*/ -bool GrTableManager::CreateAndReadPasses(GrIStream & grstrm, - int fxdSilfVersion, int fxdRuleVersion, - int cpassFont, long lSubTableStart, int * rgnPassOffsets, - int ipassSub1Font, int ipassPos1Font, int ipassJust1Font, byte ipassPostBidiFont) -{ - Assert(ipassSub1Font <= ipassJust1Font); - Assert(ipassJust1Font <= ipassPos1Font); - Assert(ipassPos1Font <= cpassFont); - if (ipassSub1Font > ipassJust1Font || ipassJust1Font > ipassPos1Font - || ipassPos1Font > cpassFont) - { - return false; // bad table - } - - // Adjusted indices based on the fact that we have a glyph generation pass that is - // pass 0, and possibly a bidi pass: - m_cpass = cpassFont + 1; - int ipassLB1, ipassSub1, ipassBidi, ipassPos1, ipassJust1; - ipassLB1 = 1; - ipassSub1 = ipassSub1Font + 1; - if (ipassPostBidiFont == 0xFF) - { - // No bidi pass. - m_fBidi = false; - // Add 1 below to account for the glyph-generation pass. - ipassPos1 = ipassPos1Font + 1; - ipassJust1 = ipassJust1Font + 1; - ipassBidi = ipassJust1; - } - else - { - m_fBidi = true; - m_cpass++; - Assert(ipassPostBidiFont == ipassJust1Font); - ipassJust1 = ipassJust1Font + 2; - ipassPos1 = ipassPos1Font + 2; - ipassBidi = ipassJust1 - 1; - } - - // Always make at least one positioning pass, even if there are no rules. - if (ipassPos1 == m_cpass) - { - m_cpass++; - } - - m_prgppass = new GrPass*[m_cpass + 1]; - m_prgppass[0] = new GrGlyphGenPass(0); - - int ipass = 1; - int ipassFont = 0; - m_cpassLB = 0; - m_ipassJust1 = 1; - m_ipassPos1 = 1; - for ( ; ipass < m_cpass; ipass++, ipassFont++) - { - if (ipass < ipassSub1) - { - m_prgppass[ipass] = new GrLineBreakPass(ipass); - m_prgppass[ipass]->ReadFromFont(grstrm, fxdSilfVersion, fxdRuleVersion, - lSubTableStart + rgnPassOffsets[ipassFont]); - m_cpassLB++; - m_ipassJust1++; - m_ipassPos1++; - } - else if (ipassSub1 <= ipass && ipass < ipassBidi) - { - m_prgppass[ipass] = new GrSubPass(ipass); - m_prgppass[ipass]->ReadFromFont(grstrm, fxdSilfVersion, fxdRuleVersion, - lSubTableStart + rgnPassOffsets[ipassFont]); - m_ipassJust1++; - m_ipassPos1++; - } - else if (ipassBidi == ipass && ipass < ipassJust1) - { - m_prgppass[ipass] = new GrBidiPass(ipass); - m_prgppass[ipass]->SetTopDirLevel(TopDirectionLevel()); - ipassFont--; // no corresponding pass in font - m_ipassJust1++; - m_ipassPos1++; - } - else if (ipassJust1 <= ipass && ipass < ipassPos1) - { - // A justification pass is, in essence, a substitution pass. - m_prgppass[ipass] = new GrSubPass(ipass); - m_prgppass[ipass]->ReadFromFont(grstrm, fxdSilfVersion, fxdRuleVersion, - lSubTableStart + rgnPassOffsets[ipassFont]); - m_ipassPos1++; - } - else if (ipassPos1 <= ipass) - { - m_prgppass[ipass] = new GrPosPass(ipass); - if (ipassFont < cpassFont) - { - m_prgppass[ipass]->ReadFromFont(grstrm, fxdSilfVersion, fxdRuleVersion, - lSubTableStart + rgnPassOffsets[ipassFont]); - } - else - { - // No positioning pass in font: create a bogus one. - m_prgppass[ipass]->InitializeWithNoRules(); - } - } - else - { - Assert(false); - return false; // bad table - } - } - - return true; -} - -/*---------------------------------------------------------------------------------------------- - Create passes corresponding to an invalid font. -----------------------------------------------------------------------------------------------*/ -void GrTableManager::CreateEmpty() -{ - m_cpass = 2; - - m_prgppass = new GrPass*[2]; - m_prgppass[0] = new GrGlyphGenPass(0); - - m_prgppass[1] = new GrPosPass(1); - m_prgppass[1]->InitializeWithNoRules(); - - m_ipassPos1 = 1; - m_cpassLB = 0; - m_fBidi = false; - - m_engst.CreateEmpty(); -} - -void EngineState::CreateEmpty() -{ - m_fStartLineContext = false; - m_fEndLineContext = false; -} - -/*---------------------------------------------------------------------------------------------- - Create the slot streams corresponding to the passes. -----------------------------------------------------------------------------------------------*/ -void EngineState::CreateSlotStreams() -{ - if (m_prgpsstrm) - return; - - m_prgpsstrm = new GrSlotStream * [m_cpass]; - for (int ipass = 0; ipass < m_cpass; ++ipass) - { - m_prgpsstrm[ipass] = new GrSlotStream(ipass); - } -} - -/*---------------------------------------------------------------------------------------------- - Store information about the pass-states in the pass objects. -----------------------------------------------------------------------------------------------*/ -void GrTableManager::StorePassStates(PassState * rgzpst) -{ - for (int ipass = 0; ipass < m_cpass; ipass++) - Pass(ipass)->SetPassState(rgzpst + ipass); -} - -/*---------------------------------------------------------------------------------------------- - Demand-driven loop: with goal of filling up final slot stream, loop backward and forward - filling up slot streams until final stream has reached physical capacity. - - @param pgjus - justification agent; NULL if justification is of no interest - @param jmodi - (internal) justification mode - @param fStartLine, fEndLine - @param ichSegLim - known end of segment; -1 when using backtracking - @param dxWidthRequested - available width; when justifying, exact width desired - @param dxUnjustifiedWidth - when justifying, what the width would be normally - @param fNeedFinalBreak - true if the end of the segment needs to be a valid break point - @param fMoreText - true if char stream doesn't go up to text-stream lim - @param ichFontLim - end of the range that could be rendered by this font - @param fInfiniteWidth - used for "measured" segments - @param fWidthIsCharCount - kludge for test procedures: the width is a character count, - not a pixel count - @param lbPref - try for longest segment ending with this breakweight - - when justifying, lb to assume - @param lbMax - max (last resort) breakweight if no preferred break possible - @param ichwCallerBtLim - caller's backtrack lim; -1 if caller is not backtracking - @param twsh - how to handle trailing white-space - @param fParaRtl - overall paragraph direction - @param nDirDepth - direction depth of this segment -----------------------------------------------------------------------------------------------*/ -void GrTableManager::Run(Segment * psegNew, Font * pfont, - GrCharStream * pchstrm, IGrJustifier * pgjus, int jmodi, - LayoutEnvironment & layout, - int ichSegLim, - float dxWidthRequested, float dxUnjustifiedWidth, - bool fNeedFinalBreak, bool fMoreText, int ichFontLim, - bool fInfiniteWidth, bool fWidthIsCharCount, - int ichwCallerBtLim, - int nDirDepth, SegEnd estJ) -{ - bool fStartLine = layout.startOfLine(); - bool fEndLine = layout.endOfLine(); - LineBrk lbPref = layout.bestBreak(); - LineBrk lbMax = layout.worstBreak(); - TrWsHandling twsh = layout.trailingWs(); - bool fParaRtl = layout.rightToLeft(); - Segment * psegPrev = layout.prevSegment(); - Segment * psegInit = layout.segmentForInit(); - std::ostream * pstrmLog = layout.loggingStream(); - - m_engst.Initialize(Engine(), this); // do this after the tables have been fully read - m_engst.m_jmodi = jmodi; - m_engst.m_ipassJustCalled = -1; - m_engst.m_twsh = twsh; - m_engst.m_fParaRtl = fParaRtl; - m_engst.m_dxsShrinkPossible = GrSlotState::kNotYetSet; - m_fLogging = (pstrmLog != NULL); - - int cbPrev; - byte * pbPrevSegDat = NULL; - if (psegPrev) - cbPrev = psegPrev->NextSegInitBuffer(&pbPrevSegDat); - else if (psegInit) - cbPrev = psegInit->ThisSegInitBuffer(&pbPrevSegDat); - else - cbPrev = 0; - - if (pchstrm->IsEmpty()) - { - m_engst.m_lbPrevEnd = klbNoBreak; - InitSegmentAsEmpty(psegNew, pfont, pchstrm, fStartLine, fEndLine); - psegNew->SetWidths(0, 0); - psegNew->SetUpOutputArrays(pfont, this, NULL, 0, 0, 0, twsh, - fParaRtl, nDirDepth, true); - psegNew->SetLayout(layout); - return; - } - - int islotUnderBreak = -1; // position of inserted or final break point in underlying - // data; none so far (if an actual LB has been inserted, - // this is the index of that slot; otherwise it is the - // index of the last valid slot) - int islotSurfaceBreak = -1; // position of line break in surface stream; none so far - LineBrk lbBestToTry = lbPref; - LineBrk lbFound = klbNoBreak; - - float dxMaxWidth = dxWidthRequested; - - if (m_engst.m_jmodi == kjmodiJustify) - { - Assert(fInfiniteWidth); - lbBestToTry = klbClipBreak; - lbFound = lbPref; - } - - float dxWidth; - - std::vector vnslotNeeded; - vnslotNeeded.resize(m_cpass); - - m_engst.InitializeStreams(this, pchstrm, cbPrev, pbPrevSegDat, fNeedFinalBreak, &islotUnderBreak); - - int ipassCurr; - int nNeedInput; // kNextPass: go on to the next pass - // kBacktrack: need to insert a line break - // > 0: need more input from previous pass - - int cchwPostXlbContext = m_pgreng->PostXlbContext(); - if (ichSegLim > -1) - { - // When we know exactly where the end of the segment will be, get as much as - // we need from the character stream, and then fill up the remaining streams. - // (3 below is an arbitrary number; we just want to get slightly more than - // we really need.) - vnslotNeeded[0] = ichSegLim - pchstrm->Min() + cchwPostXlbContext + 3; - for (int ipass = 1; ipass < m_cpass; ipass++) - vnslotNeeded[ipass] = 10000; - // Start at pass 0. - ipassCurr = 0; - } - else - { - // When we're doing line-breaking to find the end of the segment, use the - // demand-driven approach that tries to fill up the available space. - vnslotNeeded[m_cpass - 1] = 1; - - // Start at the last pass. (It might be more efficient to start at the first pass and - // generate a small arbitrary number of glyphs.) - ipassCurr = m_cpass - 1; - } - - while (ipassCurr < m_cpass) - { - if (ipassCurr == 0) - { - int nNeedNow = vnslotNeeded[0]; - // Zeroth pass: generate glyph IDs from the underlying input. - nNeedInput = Pass(0)->ExtendGlyphIDOutput(this, - pchstrm, OutputStream(0), ichSegLim, cchwPostXlbContext, lbPref, - nNeedNow, fNeedFinalBreak, m_engst.m_twsh, &islotUnderBreak); - Assert(nNeedInput == kNextPass || nNeedInput == kBacktrack); - vnslotNeeded[0] -= nNeedNow; - } - else if (ipassCurr < m_cpass - 1) - { - // Middle pass. - int cslotNeedNow = vnslotNeeded[ipassCurr]; - cslotNeedNow = max(1, cslotNeedNow); - int cslotGot; - Pass(ipassCurr)->ExtendOutput(this, - InputStream(ipassCurr), OutputStream(ipassCurr), cslotNeedNow, twsh, - &nNeedInput, &cslotGot, &islotUnderBreak); - vnslotNeeded[ipassCurr] -= cslotGot; - //if (nNeedInput != kNextPass && nNeedInput != kBacktrack) - // nNeedInput = max(nNeedInput, cslotNeedNow - cslotGot); - } - else // (ipassCurr == m_cpass - 1) - { - // Final pass: position and test allotted space. - float dxWidthWShrink = dxMaxWidth; - if (m_engst.m_dxsShrinkPossible != GrSlotState::kNotYetSet) - dxWidthWShrink += (int)m_engst.m_dxsShrinkPossible; - nNeedInput = Pass(ipassCurr)->ExtendFinalOutput(this, - InputStream(ipassCurr), OutputStream(ipassCurr), - dxWidthWShrink, fWidthIsCharCount, fInfiniteWidth, - (islotUnderBreak > -1), (fNeedFinalBreak && lbFound == klbNoBreak), - lbMax, twsh, - &islotSurfaceBreak, &dxWidth); - } - - if (m_engst.m_jmodi == kjmodiJustify) - { - if (ipassCurr < m_ipassJust1 && !OutputStream(ipassCurr)->FullyWritten()) - { - // When justifying, fill up all the streams up to the point where we need - // to interact with the justification routine. - // I think this code is obsolete. - int nStillNeed = 1000; - if ((ipassCurr == 1 && nNeedInput != kNextPass) || ipassCurr == 0) - nStillNeed = ichSegLim - (pchstrm->Pos() - pchstrm->Min()) - + cchwPostXlbContext + 3; - if (nStillNeed > 0) - { - if (nNeedInput == kNextPass) - ipassCurr++; // repeat this pass - nNeedInput = nStillNeed; - } - } - else if (nNeedInput == kNextPass && ipassCurr + 1 == m_ipassJust1) - { - CallJustifier(pgjus, ipassCurr, dxUnjustifiedWidth, dxWidthRequested, fEndLine); - } - } - DetermineShrink(pgjus, ipassCurr); - - if (nNeedInput == kBacktrack) - { - // Final output has overflowed its space--find (or adjust) the break point. - - bool fFoundBreak = Backtrack(&islotUnderBreak, - &lbBestToTry, lbMax, twsh, fMoreText, ichwCallerBtLim, fEndLine, &lbFound); - if (!fFoundBreak) - { - // Nothing will fit. Initialize the new segment just enough so that - // we can delete it. - InitSegmentToDelete(psegNew, pfont, pchstrm); - return; - } - } - else if (nNeedInput == kNextPass) - { - // This pass is sufficiently full--return to following pass. - ipassCurr++; - } - else - { - // Get more input from previous pass. - ipassCurr--; - vnslotNeeded[ipassCurr] = nNeedInput; - } - } - - // At this point we have fully transduced all the text for this segment. - - // Figure out why we broke the segment and what the caller is supposed to do about it. - SegEnd est; - if (m_engst.m_jmodi == kjmodiJustify) - { - // Don't change what was passed in. - est = estJ; - } - else if (m_engst.m_fRemovedWhtsp) // (islotUnderBreak > -1 && twsh == ktwshNoWs) - { - Assert(!m_engst.m_fInsertedLB); - est = kestMoreWhtsp; - } - - else if (m_engst.m_fHitHardBreak) - { - est = kestHardBreak; - } - - else if (!m_engst.m_fExceededSpace && !fMoreText) - // Rendered to the end of the original requested range. - est = kestNoMore; - -// else if (!m_fExceededSpace && !fNextIsSameWs && fMoreText) -// // Writing system break; may be more room on the line. But see tweak below. -// *pest = kestWsBreak; - - else if (m_engst.m_fExceededSpace) - { - // Exceeded available space, found a legal break. - if (twsh == ktwshNoWs && m_engst.m_fRemovedWhtsp) - est = kestMoreWhtsp; - else - est = kestMoreLines; - } - - else if (twsh == ktwshOnlyWs) - { - est = kestOkayBreak; // but see tweak below - } - - else - { - // Broke because of something like a font change. Determine whether this is a legal - // break or not. - // TODO SharonC: handle the situation where it is legal to break BEFORE the first - // character of the following segment. - Assert(fMoreText); - //Assert(fNextIsSameWs); - if (ichwCallerBtLim > -1) - { - Assert(m_engst.m_fInsertedLB); - } - else if (ichSegLim > -1) - { - // We stopped where caller said to. - Assert(fInfiniteWidth); - } - else - { - Assert(!m_engst.m_fInsertedLB); - Assert(islotUnderBreak == -1 || m_engst.m_fFinalLB); - } - int islotTmp = OutputStream(m_cpass - 1)->WritePos(); - GrSlotState * pslotTmp; - if (m_engst.m_fFinalLB || m_engst.m_fInsertedLB) - pslotTmp = OutputStream(m_cpass-1)->SlotAt(islotTmp - 2); - else - pslotTmp = OutputStream(m_cpass-1)->SlotAt(islotTmp - 1); - - if (abs(pslotTmp->BreakWeight()) <= lbPref) - est = kestOkayBreak; - - else if (abs(pslotTmp->BreakWeight()) > lbMax) - est = kestBadBreak; - - else if (OutputStream(m_cpassLB)->HasEarlierBetterBreak(islotUnderBreak, lbFound, - this->LBGlyphID())) - { - est = kestBadBreak; - } - else - est = kestOkayBreak; - - // We no longer have the ability to know whether or not the next segment will use - // the same writing system. - //if (est == kestBadBreak && m_engst.m_fExceededSpace && !fNextIsSameWs && fMoreText) - // est = kestWsBreak; - } - - // Make a segment out of it and return it. - int dichSegLen; - InitNewSegment(psegNew, pfont, pchstrm, pgjus, - islotUnderBreak, islotSurfaceBreak, fStartLine, fEndLine, ichFontLim, lbFound, est, - &dichSegLen); - if (psegNew->segmentTermination() == kestNothingFit) - { - return; - } - else if (psegNew->segmentTermination() == kestHardBreak && - psegNew->startCharacter() == psegNew->stopCharacter()) - { - // Empty segment caused by a hard-break. - m_engst.m_lbPrevEnd = klbNoBreak; - psegNew->SetWidths(0, 0); - psegNew->SetUpOutputArrays(pfont, this, NULL, 0, 0, 0, twsh, - fParaRtl, nDirDepth, true); - psegNew->SetLayout(layout); - return; - } - - psegNew->RecordInitializationForThisSeg(cbPrev, pbPrevSegDat); - - if ((est == kestNoMore || est == kestWsBreak) && twsh == ktwshOnlyWs && - dichSegLen < pchstrm->Lim() - pchstrm->Min()) - { - // If we are asking for white-space only, and we didn't use up everything in the font - // range, we could possibly have gotten an initial white-space only segment - // (as opposed to a writing system break). - est = kestOkayBreak; - psegNew->FixTermination(est); - } - - // Do this before fixing up the associations below. - //if (m_pgreng->LoggingTransduction()) - // WriteTransductionLog(pchstrm, *ppsegRet, - // cbPrev, pbPrevSegDat, pbNextSegDat, pcbNextSegDat); - WriteTransductionLog(pstrmLog, pchstrm, psegNew, cbPrev, pbPrevSegDat); - - RecordAssocsAndOutput(pfont, psegNew, fWidthIsCharCount, twsh, fParaRtl, nDirDepth); - - // Do this after fixing up the associations. - //if (m_pgreng->LoggingTransduction()) - // WriteAssociationLog(pchstrm, *ppsegRet); - WriteAssociationLog(pstrmLog, pchstrm, psegNew); - - psegNew->SetLayout(layout); -} - -/*---------------------------------------------------------------------------------------------- - Create a new segment to return. - - @param pchstrm - input stream - @param pgjus - justification agent, in case this segment needs to be - stretched or shrunk - @param islotLBStreamBreak - position of inserted line break slot (which should be equal - to the position in the glyph generation stream); - -1 if no line-break was inserted (we rendered to the - end of the range) - @param islotSurfaceBreak - position of line break slot in final (surface) stream - @param fStartLine - does this segment start a line? - @param fEndLine - does this segment end a line? - @param ichFontLim - end of range that could be rendered by this font - @param lbEndFound - line break found; possibly adjusted here - @param est - why did the segment terminate -----------------------------------------------------------------------------------------------*/ -void GrTableManager::InitNewSegment(Segment * psegNew, - Font * pfont, GrCharStream * pchstrm, IGrJustifier * pgjus, - int islotLBStreamBreak, int islotSurfaceBreak, bool fStartLine, bool fEndLine, int ichFontLim, - LineBrk lbEndFound, SegEnd est, int * pdichSegLen) -{ - LineBrk lbStart = m_engst.m_lbPrevEnd; - LineBrk lbEnd = lbEndFound; - if (est == kestBadBreak) - lbEnd = klbLetterBreak; - - int ichwMin = pchstrm->Min(); - int ichwLim; - -// int cslotPreSegStream0 = m_cslotPreSeg; -// if (m_fInitialLB && m_cpassLB > 0) -// { -// // Initial LB is included in m_cslotPreSeg, but is not in stream 0. -// // --Not really needed, because both islotLBStreamBreak and m_cslotPreSeg take -// // the initial LB into account if it is there. -// cslotPreSegStream0--; -// } - - // No longer have to subtract this, because the chunk map takes it into - // consideration. - //int cslotPreInitialLB = m_cslotPreSeg - (m_fInitialLB ? 1 : 0); - - //int ichwOldTmp; - - if (m_engst.m_fInsertedLB) - { - Assert(islotLBStreamBreak > -1); - int ichwSegLim = m_engst.LbSlotToSegLim(islotLBStreamBreak, pchstrm, m_cpassLB); - ichwLim = ichwSegLim + pchstrm->Min(); // - cslotPreInitialLB; - - // Old result, for debugging: - //ichwOldTmp = islotLBStreamBreak + pchstrm->Min() - m_cslotPreSeg; - } - else if (m_engst.m_fFinalLB || islotLBStreamBreak == -1) - ichwLim = pchstrm->Lim(); - else - { - int ichwSegLim = m_engst.LbSlotToSegLim(islotLBStreamBreak, pchstrm, m_cpassLB); - ichwLim = ichwSegLim + pchstrm->Min(); // - cslotPreInitialLB; - - // Old result, for debugging: - // islotLBStreamBreak is the last slot in the segment, not the LB glyph; hence +1. - //ichwOldTmp = islotLBStreamBreak + pchstrm->Min() - m_cslotPreSeg + 1; - } - - *pdichSegLen = ichwLim - ichwMin; - - if (ichwMin >= ichwLim) - { - if (est == kestHardBreak) - { - // Empty segment cause by a hard-break. - InitSegmentAsEmpty(psegNew, pfont, pchstrm, fStartLine, fEndLine); - psegNew->FixTermination(est); - } - else - { - // Invalid empty segment. - Assert(ichwMin == ichwLim); - InitSegmentToDelete(psegNew, pfont, pchstrm); - } - return; - } - - Assert(psegNew); - - psegNew->Initialize(pchstrm->TextSrc(), - ichwMin, ichwLim, - lbStart, lbEnd, est, fStartLine, fEndLine, m_pgreng->RightToLeft()); - - psegNew->SetEngine(m_pgreng); - psegNew->SetFont(pfont); - psegNew->SetJustifier(pgjus); - psegNew->SetFaceName(m_pgreng->FaceName(), m_pgreng->BaseFaceName()); - - bool fNextSegNeedsContext = - !(est == kestNoMore || est == kestWsBreak - || ichwLim >= pchstrm->Lim() || ichwLim >= ichFontLim); - - InitializeForNextSeg(psegNew, islotLBStreamBreak, islotSurfaceBreak, lbEnd, - fNextSegNeedsContext, pchstrm); - - psegNew->SetPreContext(0 - m_pgreng->PreXlbContext()); -} - -/*---------------------------------------------------------------------------------------------- - The newly created segment is invalid, for instance, because we were backtracking and - couldn't find a valid break point. Initialize it just enough so that it can be - deleted by the client. -----------------------------------------------------------------------------------------------*/ -void GrTableManager::InitSegmentToDelete(Segment * psegNew, Font * pfont, - GrCharStream * pchstrm) -{ - psegNew->Initialize(pchstrm->TextSrc(), 0, 0, - klbClipBreak, klbClipBreak, kestNothingFit, false, false, - m_pgreng->RightToLeft()); - - psegNew->SetEngine(m_pgreng); - psegNew->SetFont(pfont); - psegNew->SetJustifier(NULL); // can't justify an empty segment - psegNew->SetFaceName(m_pgreng->FaceName(), m_pgreng->BaseFaceName()); - psegNew->SetPreContext(0); -} - -/*---------------------------------------------------------------------------------------------- - Map from the given slot (which is generally the final LB slot) to the end of the segment, - taking into account the fact that a single slot may represent two 16-bit surrogates. - - There are several approaches that seem reasonable but do NOT work. (I tried them!) - You can't calculate it directly from the length of the streams, because that doesn't take - into account the possible presence of surrogate pairs in the character stream. You can't - use the chunk map at the point of the LB, because if a rule spanned a LB the chunk won't - have ended there and so there won't be any valid information. - - What seems to work is to figure out the slot(s) in the zeroth stream using the associations - and then use the segment offset for this slot. This should be reliable because there is - always a one-to-one correspondence between glyphs in the line-break passes (ie, no - insertions or deletions), so the associations should be dependable and straightforward. -----------------------------------------------------------------------------------------------*/ -int EngineState::LbSlotToSegLim(int islotLB, GrCharStream * pchstrm, int cpassLB) -{ - Assert(islotLB < OutputStream(cpassLB)->WritePos()); - - // Figure out the corresponding characters in the zeroth stream. These should be straight- - // forward to figure out because no substitutions are permitted in the LB passes. - // I do the slots before and after the LB, if possible, as a sanity check. - GrSlotStream * psstrmLB = OutputStream(cpassLB); - GrSlotState * pslotPreLB = (m_fFinalLB || m_fInsertedLB) ? - psstrmLB->SlotAt(islotLB - 1) : - psstrmLB->SlotAt(islotLB); - GrSlotState * pslotPostLB = (psstrmLB->WritePos() > islotLB + 1) ? - psstrmLB->SlotAt(islotLB + 1) : - NULL; - - int ichwPreLB = pslotPreLB->AfterAssoc(); - - int ichwSegLim; - if (pslotPostLB) - { - ichwSegLim = pslotPostLB->BeforeAssoc(); - Assert(ichwPreLB + 1 == ichwSegLim - || ichwPreLB + 2 == ichwSegLim); // in case of a surrogate - } - else - { - ichwSegLim = ichwPreLB + 1; - while (!pchstrm->AtUnicodeCharBoundary(ichwSegLim)) - ichwSegLim++; - Assert(pchstrm->AtUnicodeCharBoundary(ichwSegLim)); - } - - // Old buggy routine that doesn't handle the case where a rule (and hence the chunk map) did - // not end at the LB character: - // Map backwards through the LB pass streams, if any. - //int islotAdjusted = islotLB + 1; // after the LB - //for (int ipass = m_cpassLB; ipass > 0; ipass--) - //{ - // islotAdjusted = ChunkInPrev(ipass, islotAdjusted, pchstrm); - //} - // - //int ichwSegLim = ChunkInPrev(0, islotAdjusted, pchstrm); - - // Mapping from 32-bit to 16-bit should only increase the index. Except that there - // may be a LB in the slot stream that is not in the character stream, so it could be - // one less. - Assert(ichwSegLim + m_cslotPreSeg >= islotLB - 1); - - return ichwSegLim; -} - -/*---------------------------------------------------------------------------------------------- - Return the chunk mapping into the previous stream, taking into account the fact that it - is not recorded for the write-position. -----------------------------------------------------------------------------------------------*/ -int GrTableManager::ChunkInPrev(int ipass, int islot, GrCharStream * pchstrm) -{ - GrSlotStream * psstrmOut = OutputStream(ipass); - GrSlotStream * psstrmIn = (ipass == 0) ? NULL : InputStream(ipass); - - int islotTmp = islot; - int islotAdjusted; - do { - if (islot >= psstrmOut->WritePos()) - { - Assert(islot == psstrmOut->WritePos()); - islotAdjusted = (ipass == 0) ? pchstrm->SegOffset() : psstrmIn->ReadPos(); - Assert(islotAdjusted > -1); - } - else - islotAdjusted = psstrmOut->ChunkInPrev(islotTmp); - islotTmp--; - } while (islotAdjusted == -1); - - return islotAdjusted; -} - -/*---------------------------------------------------------------------------------------------- - Create a new segment corresponding to an empty string. - - @param pchstrm - input stream - @param fStartLine - does this segment start a line? - @param fEndLine - does this segment end a line? -----------------------------------------------------------------------------------------------*/ -void GrTableManager::InitSegmentAsEmpty(Segment * psegNew, Font * pfont, - GrCharStream * pchstrm, bool fStartLine, bool fEndLine) -{ - LineBrk lbStart = m_engst.m_lbPrevEnd; - LineBrk lbEnd = klbNoBreak; - - int ichwMin = 0; - int ichwLim = 0; - - Assert(psegNew); - - psegNew->Initialize(pchstrm->TextSrc(), ichwMin, ichwLim, - lbStart, lbEnd, kestNoMore, fStartLine, fEndLine, m_pgreng->RightToLeft()); - - psegNew->SetEngine(m_pgreng); - psegNew->SetFont(pfont); - psegNew->SetJustifier(NULL); // can't justify an empty segment - psegNew->SetFaceName(m_pgreng->FaceName(), m_pgreng->BaseFaceName()); - - byte pbNextSegDat[256]; - int cbNextSegDat; - int * pcbNextSegDat = &cbNextSegDat; - - // Initialization for (theoretical) next segment. - byte * pb = pbNextSegDat; - *pb++ = byte(lbEnd); - *pb++ = kdircNeutral; - *pb++ = kdircNeutral; - *pb++ = 0; - for (int ipass = 0; ipass < m_cpass; ipass++) - *pb++ = 0; - *pcbNextSegDat = 0; - psegNew->RecordInitializationForNextSeg(*pcbNextSegDat, pbNextSegDat); - - psegNew->SetPreContext(0); -} - -/*---------------------------------------------------------------------------------------------- - Find a line-break and unwind the passes. Return true if we were able to - backtrack successfully (which may have meant using a less-than-optimal line-break). - Return false if no line-break could be found (because maxBreakWeight did not allow - letter breaks or clipping--generally because there was already something on this - line). - - @param pislotPrevBreak - position of previously-created break, -1 if none; - this is the index of the line-break glyph if any, - or the index of the last slot in the segment; - adjusted to contain the position of the newly - found break - @param plbMin - minimum (best) line break weight to try - @param lbMax - maximum (worst possible) line break weight - @param twsh - how to handle trailing white-space - @param fMoreText - true if char stream doesn't go up to original lim - @param ichwCallerBtLim - caller's backtrack lim; -1 if caller is not backtracking - @param plbFound - kind of line-break created -----------------------------------------------------------------------------------------------*/ -bool GrTableManager::Backtrack(int * pislotPrevBreak, - LineBrk * plbMin, LineBrk lbMax, TrWsHandling twsh, bool fMoreText, - int ichwCallerBtLim, bool fEndLine, - LineBrk * plbFound) -{ - int islotStartTry; - //if (*pislotPrevBreak == ichwCallerBtLim - 1) - //{ - // islotStartTry = *pislotPrevBreak; - //} - //else - if (*pislotPrevBreak == -1) - { - // If no line break has been found so far, figure out where to start trying based - // on where the final stream choked. - GrSlotStream * psstrmFinal = OutputStream(m_cpass-1); - if ((islotStartTry - = m_engst.TraceStreamZeroPos(psstrmFinal->WritePos()-1, TopDirectionLevel())) - == -1) - { - // Just start looking at the end of what's been generated. - islotStartTry = OutputStream(m_cpassLB)->ReadPos() - 1; - } - } - else - { - // Start just before previous line break. - if (m_engst.m_fInsertedLB || m_engst.m_fFinalLB) - islotStartTry = *pislotPrevBreak - 2; // skip inserted LB and previous slot - else - islotStartTry = *pislotPrevBreak - 1; // skip previous slot - } - if (ichwCallerBtLim > -1 && islotStartTry > ichwCallerBtLim - 1) - { - islotStartTry = ichwCallerBtLim - 1; - } - - // Determine if we want to insert an actual line-break "glyph". Don't do that if - // we are omitting trailing white space or we are at a writing-system or font break. - bool fInsertLB; - if (twsh == ktwshNoWs) - // omitting trailing white-space - fInsertLB = false; - - // These rules seem more complicated than what is necessary... :-/ - //else if (twsh == ktwshOnlyWs) - // // trailing white-space segment - // fInsertLB = true; - //else if (ichwCallerBtLim > -1) - // // backtracking - // fInsertLB = true; - //else if (*pislotPrevBreak > -1) - // // no longer at the edge of the writing system or font - // fInsertLB = true; - //else if (!fMoreText) - // // at final edge of total range to render - // fInsertLB = true; - //else - // fInsertLB = false; - - else if (!fEndLine) - fInsertLB = false; - else - fInsertLB = true; - - // Try to insert a line-break in the output of the (final) line-break pass (if any, or - // the output of the glyph-generation pass). First try the preferred (strictest) - // break weight and gradually relax. - LineBrk lb = *plbMin; - Assert(*plbMin <= lbMax); - GrSlotStream * psstrmLB = OutputStream(m_cpassLB); - islotStartTry = min(islotStartTry, psstrmLB->WritePos() - 1); - int islotNewBreak = -1; - while (lb <= lbMax) - { - LineBrk lbNextToTry; - if (fInsertLB) - { - islotNewBreak = psstrmLB->InsertLineBreak(this, - *pislotPrevBreak, m_engst.m_fInsertedLB, islotStartTry, - lb, twsh, m_engst.m_cslotPreSeg, &lbNextToTry); - } - else - { - islotNewBreak = psstrmLB->MakeSegmentBreak(this, - *pislotPrevBreak, m_engst.m_fInsertedLB, islotStartTry, - lb, twsh, m_engst.m_cslotPreSeg, &lbNextToTry); - } - if (islotNewBreak > -1) - break; - if (lb >= lbMax) - break; - lb = IncLineBreak(lb); // relax the break weight - } - - if (islotNewBreak == -1) - { - return false; - } - - // We've successfully inserted a line break. - - if (fInsertLB) - m_engst.m_fInsertedLB = true; - - m_engst.m_fFinalLB = false; - - UnwindAndReinit(islotNewBreak); - - *pislotPrevBreak = islotNewBreak; - *plbMin = lb; // return the best break we were able to find, so we don't keep trying - // for a better one when we know now that we can't find it - *plbFound = lb; - - return true; -} - -/*---------------------------------------------------------------------------------------------- - This method is called after backtracking or removing trailing white-space. - Unwind the following slot streams as necessary depending on where the change was made. - - @param islotNewBreak - in output of (final) line-break pass -----------------------------------------------------------------------------------------------*/ -void GrTableManager::UnwindAndReinit(int islotNewBreak) -{ - OutputStream(m_cpassLB)->ZapCalculatedDirLevels(islotNewBreak); - - // Mark the passes before the line-break pass as fully written, so that if there - // isn't a line-break glyph to intercept, we don't keep trying to get more input - // from them. - int ipass; - for (ipass = 1; ipass < m_cpassLB + 1; ++ipass) - { - InputStream(ipass)->MarkFullyWritten(); - } - - // Unwind the passes to the changed positions. - // Note that we don't need to unwind pass 0, since all it does is generate glyph IDs. - // Also we don't need to unwind the line-break passes, because conceptually they happen - // before the break is inserted. - - int islotChgPos = islotNewBreak; - bool fFirst = true; - for (ipass = m_cpassLB + 1 ; ipass < m_cpass ; ++ipass) - { - islotChgPos = - Pass(ipass)->Unwind(this, islotChgPos, InputStream(ipass), OutputStream(ipass), - fFirst); - fFirst = false; - } - // For anything that may have been skipped in the final output: - OutputStream(m_cpass - 1)->SetReadPos(0); - OutputStream(m_cpass - 1)->SetReadPosMax(0); - Pass(m_cpass - 1)->UndoResyncSkip(); - OutputStream(m_cpass - 1)->ClearSlotsSkippedToResync(); - - m_engst.InitPosCache(); - - m_engst.m_dxsShrinkPossible = GrSlotState::kNotYetSet; // recalculate it -} - -/*---------------------------------------------------------------------------------------------- - Store information in the newly created segment that will allow us to reinitalize - the streams in order to process the next segment, appropriately handling any - cross-line-boundary contextuals. - - The information required is the number of glyphs in the first stream that must - be reprocessed, and a skip-offset between each stream indicating the beginning - of chunk boundaries. - - In most cases, where there are no cross-line-boundary contextuals, all these numbers - will be zero. - - The buffer generated is of the following format (all are 1 byte, unsigned): - end breakweight - previous strong directionality code - previous terminator dir code - restart backup - skip offsets for each pass - This format must match what is generated by InitializeStreams. - - @param pseg - newly created segment - @param islotUnderBreak - position of line break inserted in underlying stream (output - of glyph-generation pass--stream 0); -1 if we rendered to - the end of the range - @param islotSurfaceBreak - position of line break in surface stream; - -1 if we rendered to the end of the range - @param lbEnd - kind of line-break at the end of this segment - @param fNextSegNeedsContext - true if we need to remember the context for the next seg - @param pchstrm - character stream input for this segment - @param cbNextMax - amount of space available in the buffer - @param pbNextSegDat - buffer for initializing next segment - @param pcbNextSegDat - amount of space used in buffer -----------------------------------------------------------------------------------------------*/ -void GrTableManager::InitializeForNextSeg(Segment * pseg, - int islotUnderBreak, int islotSurfaceBreak, LineBrk lbEnd, - bool fNextSegNeedsContext, GrCharStream * pchstrm) -{ - byte pbNextSegDat[256]; - int cbNextSegDat; - int * pcbNextSegDat = &cbNextSegDat; - - std::vector vcslotSkipOffsets; - vcslotSkipOffsets.resize(m_cpass); - - byte * pb = pbNextSegDat; - - if (!fNextSegNeedsContext) - { - // No contextualization between this segment and the next, whatever kind of renderer - // it might use. - *pcbNextSegDat = 0; - return; - } - - gid16 chwLB = LBGlyphID(); - - int islotUnderLim = islotUnderBreak; - if (!m_engst.m_fInsertedLB && !m_engst.m_fFinalLB) - // Then islotUnderBreak is the position of the last slot in the segment; increment - // to get the lim in stream zero. - islotUnderLim++; - - int islotSurfaceLim = islotSurfaceBreak; - if (islotSurfaceLim == -1) - islotSurfaceLim = OutputStream(m_cpass - 1)->FinalSegLim(); - - *pb++ = byte(lbEnd); - - // Find previous strong and terminator directionality codes. - - GrSlotStream * psstrm = OutputStream(m_cpass - 1); - DirCode dircStrong = kdircNeutral; - DirCode dircTerm = kdircNeutral; - int islot; - for (islot = islotSurfaceLim; islot-- > 0; ) - { - GrSlotState * pslot = psstrm->SlotAt(islot); - DirCode dirc = pslot->Directionality(); - if (dircTerm == kdircNeutral && dirc == kdircEuroTerm) - dircTerm = dirc; - if (StrongDir(dirc)) - { - dircStrong = dirc; - break; - } - } - *pb++ = byte(dircStrong); - *pb++ = byte(dircTerm); - - // Record how much of each pass to redo in the next segment. - // The basic algorithm is described in the "WR Data Transform Engine" document. - // But here we are doing a variation on what is described there. We are calculating - // the backup locations for BOTH the rule start locations and the necessary pre-contexts. - // It is the precontext values that are recorded for use by the following segment. But we - // also calculate the positions for the rule-start locations to make sure there is enough - // pre-context at each pass. - - int islotRS = islotSurfaceLim; // rule-start positions - int islotPC = islotRS; // to handle pre-context positions - - // If line-breaks are irrelevant to this font, we don't need to bother. - bool fGiveUp = !m_pgreng->LineBreakFlag(); - - int ipass; - for (ipass = m_cpass - 1; ipass >= 0 && !fGiveUp; --ipass) - { - GrSlotStream * psstrmIn = (ipass == 0) ? NULL : InputStream(ipass); - GrSlotStream * psstrmOut = OutputStream(ipass); - int islotBackupMin = (ipass == 0) ? 0 : psstrmOut->SegMin(); - if (ipass >= m_cpassLB && m_engst.m_fInitialLB) - islotBackupMin++; // how far we can back up--not before the start of this segment - - int islotPrevRS = 0; // corresponding slot in the previous stream for rule-start position - int islotPrevPC = 0; // same for pre-context position - - // Initially we have to include at least this many prior slots: - int cslotSkipOffset = 0; - - if (islotRS == psstrmOut->WritePos()) - { - islotPrevRS = (ipass == 0) ? pchstrm->Pos() : psstrmIn->ReadPos(); - } - else - { - // Ignore the final line-break, because it is explicitly inserted during - // the (final) line-break pass. -// if (ipass == m_cpassLB && psstrm->SlotAt(islotRS)->IsFinalLineBreak(chwLB)) -// { -// Assert(islotRS > 0); -// islotRS--; -// } - // Ignore the chunk in the pass that generated the line break that corresponds - // to the inserted line break being chunked with the previous glyph--we don't - // want to treat that as a cross-line-boundary contextual! - if (ipass == m_cpassLB && psstrmOut->SlotAt(islotRS)->IsFinalLineBreak(chwLB)) - { -// Assert(psstrm->ChunkInPrev(islotRS) == -1); - if (islotRS + 1 == psstrmOut->WritePos()) - islotPrevRS = (ipass == 0) ? pchstrm->SegOffset() : psstrmIn->ReadPos(); - else - islotPrevRS = psstrmOut->ChunkInPrev(islotRS + 1); - } - else - { - // Back up to the beginning of a chunk. - while (islotRS >= islotBackupMin && - (islotPrevRS = psstrmOut->ChunkInPrev(islotRS)) == -1) - { - --islotRS; - //++cslotSkipOffset; - } - } - } - if (islotPrevRS == -1 || islotRS < islotBackupMin) // hit the start of the segment - { - // In order to get enough context to be sure to run the same rules again, - // we'd have to back up into the previous segment. Too complicated, so give up. - fGiveUp = true; - break; - } - - int cslotPreContext = Pass(ipass)->MaxRulePreContext(); -LBackupPC: - if (islotPC == psstrmOut->WritePos()) - { - islotPrevPC = (ipass == 0) ? pchstrm->Pos() : psstrmIn->ReadPos(); - } - else - { - if (ipass == m_cpassLB && psstrmOut->SlotAt(islotPC)->IsFinalLineBreak(chwLB)) - { - if (islotPC+1 == psstrmOut->WritePos()) - islotPrevPC = (ipass == 0) ? pchstrm->SegOffset() : psstrmIn->ReadPos(); - else - islotPrevPC = psstrmOut->ChunkInPrev(islotPC+1); - } - else - { - // Back up to the beginning of a chunk; also make sure there are enough slots - // to handle the required pre-context for this pass. - while (islotPC >= islotBackupMin && - ((islotPrevPC = psstrmOut->ChunkInPrev(islotPC)) == -1 || - islotPrevRS - islotPrevPC < cslotPreContext)) - { - --islotPC; - ++cslotSkipOffset; - } - } - } - if (islotPC >= islotBackupMin && islotPrevRS - islotPrevPC < cslotPreContext) - { - --islotPC; - ++cslotSkipOffset; - goto LBackupPC; - } - if (islotPrevPC == -1 || islotPC < islotBackupMin) // hit the start of the segment - { - fGiveUp = true; - break; - } - - vcslotSkipOffsets[ipass] = cslotSkipOffset; - - islotRS = islotPrevRS; - islotPC = islotPrevPC; - - if (ipass == 0) - { - // Convert from underlying chars to stream-zero slots. - islotRS += m_engst.m_cslotPreSeg; - islotPC += m_engst.m_cslotPreSeg; - } - } - - // The following should be the case unless they tried to position contextually across - // the line break boundary, which is a very strange thing to do! - no longer true, - // because the pre-context is now included in this count, and it normal to have - // a pre-context in the final positioning pass. - //Assert(vcslotSkipOffsets[m_cpass-1] == 0); - - // Also no adjustments are made by the glyph-generation pass, so this should always - // be true: - Assert(vcslotSkipOffsets[0] == 0); - - // The number of slots in the underlying input previous to the line-break - // that must be reprocessed: - int cslotPreLB = islotUnderLim - islotPC; - - if (fGiveUp) - { - // We can't reasonably provide enough context, so don't try to do it at all. - cslotPreLB = 0; - for (ipass = 0; ipass < m_cpass; ipass++) - vcslotSkipOffsets[ipass] = 0; - } - - Assert(cslotPreLB >= 0); - Assert(cslotPreLB < 0xFF); - - *pb++ = byte(cslotPreLB); - for (ipass = 0; ipass < m_cpass; ipass++) - *pb++ = byte(vcslotSkipOffsets[ipass]); - - *pcbNextSegDat = 4 + m_cpass; - - pseg->RecordInitializationForNextSeg(*pcbNextSegDat, pbNextSegDat); -} - -/*---------------------------------------------------------------------------------------------- - Calculate the associations, and record the output slots in the segment. -----------------------------------------------------------------------------------------------*/ -void GrTableManager::RecordAssocsAndOutput(Font * pfont, - Segment * pseg, bool fWidthIsCharCount, - TrWsHandling twsh, bool fParaRtl, int nDirDepth) -{ - int cchwUnderlying = pseg->stopCharacter() - pseg->startCharacter(); - - GrSlotStream * psstrmFinal = OutputStream(m_cpass-1); - int csloutSurface = psstrmFinal->WritePos() - psstrmFinal->IndexOffset(); // # of output slots - - psstrmFinal->SetNeutralAssociations(LBGlyphID()); - - float xsTotalWidth, xsVisWidth; - -#ifdef OLD_TEST_STUFF - if (fWidthIsCharCount) - xsTotalWidth = xsVisWidth = 0; - else -#endif // OLD_TEST_STUFF - - // Make sure the final positions are set for every glyph. - CalcPositionsUpTo(m_cpass-1, reinterpret_cast(NULL), - &xsTotalWidth, &xsVisWidth); - pseg->SetWidths(xsVisWidth, xsTotalWidth); - - pseg->SetUpOutputArrays(pfont, this, psstrmFinal, cchwUnderlying, csloutSurface, LBGlyphID(), - twsh, fParaRtl, nDirDepth); - - // Set underlying-to-surface assocations in the segment. - CalculateAssociations(pseg, csloutSurface); -} - -/*---------------------------------------------------------------------------------------------- - Calculate the underlying-to-surface associations and ligature mappings. - Assumes the arrays have been properly initialized. -----------------------------------------------------------------------------------------------*/ -void GrTableManager::CalculateAssociations(Segment * pseg, int csloutSurface) -{ - GrSlotStream * psstrmFinal = OutputStream(m_cpass-1); - - std::vector vichwAssocs; - std::vector vichwComponents; - std::vector vicomp; - - for (int islot = psstrmFinal->IndexOffset(); islot < psstrmFinal->WritePos(); islot++) - { - GrSlotState * pslot = psstrmFinal->SlotAt(islot); - int islout = islot - psstrmFinal->IndexOffset(); - if (!pslot->IsLineBreak(LBGlyphID())) - { - vichwAssocs.clear(); - pslot->AllAssocs(vichwAssocs); - - size_t iichw; - for (iichw = 0; iichw < vichwAssocs.size(); ++iichw) - { - pseg->RecordSurfaceAssoc(vichwAssocs[iichw], islout, 0); - } - - vichwComponents.clear(); - vicomp.clear(); - if (pslot->HasComponents()) - pslot->AllComponentRefs(vichwComponents, vicomp); - - for (iichw = 0; iichw < vichwComponents.size(); iichw++) - { - pseg->RecordLigature(vichwComponents[iichw], islout, vicomp[iichw]); - } - } - } - - AdjustAssocsForOverlaps(pseg); - pseg->CleanUpAssocsVectors(); - -// pseg->AdjustForOverlapsWithPrevSeg(); // for any characters officially in the - // previous segment but rendered in this one, - // or vice versa - - // TODO SharonC: for all characters that are right-to-left in the underlying stream, - // reverse the before and after flags in the segment. -} - -/*---------------------------------------------------------------------------------------------- - For any slots associated with characters in the new segment but not rendered in the - segment, adjust the underlying-to-surface mappings accordingly. Ie, set the before - mapping to kNegInfinity for slots at the beginning of the streams, and set the - after mapping to kPosInfinity for slots at the end of the streams. - - TODO SharonC: Rework this method more carefully to handle each slot exactly once. The current - approach could possibly, for instance, process a slot that is inserted in one pass - and deleted in the next. -----------------------------------------------------------------------------------------------*/ -void GrTableManager::AdjustAssocsForOverlaps(Segment * pseg) -{ - if (!m_engst.m_fInitialLB && !m_engst.m_fFinalLB && !m_engst.m_fInsertedLB) - // no cross-line contextualization possible - return; - - gid16 chwLB = LBGlyphID(); - std::vector vichwAssocs; - - // Process any slots output by any substitution pass (or later) on either side of the - // line-breaks. These are the relevant slots that are rendered in the previous and - // following segments. - for (int ipass = m_cpass; ipass-- > m_cpassLB + 1; ) - { - GrSlotStream * psstrm = OutputStream(ipass); - int islotMin = (ipass == m_cpass - 1) ? psstrm->IndexOffset() : 0; - - if (m_engst.m_fInitialLB) - { - for (int islot = islotMin; ; islot++) - { - GrSlotState * pslot = psstrm->SlotAt(islot); - if (pslot->IsInitialLineBreak(chwLB)) - break; - Assert(!pslot->IsFinalLineBreak(chwLB)); - if (pslot->PassModified() != ipass) - continue; - - vichwAssocs.clear(); - pslot->AllAssocs(vichwAssocs); - for (size_t iichw = 0; iichw < vichwAssocs.size(); ++iichw) - pseg->MarkSlotInPrevSeg(vichwAssocs[iichw], islot); - } - } - - if ((m_engst.m_fFinalLB || m_engst.m_fInsertedLB) && ipass > m_cpassLB) - { - for (int islot = psstrm->WritePos(); islot-- > islotMin ; ) - { - GrSlotState * pslot = psstrm->SlotAt(islot); - if (pslot->IsFinalLineBreak(chwLB)) - break; - Assert(!pslot->IsInitialLineBreak(chwLB)); - if (pslot->PassModified() != ipass) - continue; - - vichwAssocs.clear(); - pslot->AllAssocs(vichwAssocs); - for (size_t iichw = 0; iichw < vichwAssocs.size(); ++iichw) - pseg->MarkSlotInNextSeg(vichwAssocs[iichw], islot); - } - } - } -} - -/*---------------------------------------------------------------------------------------------- - Initialize all the streams. In particular, process the information about the - skip-offsets to handle segments other than the first. - - @param cbPrev - number of bytes in the pbPrevSegDat buffer - @param pbPrevSegDat - buffer in the following format (all are 1 byte, unsigned): - prev seg's end breakweight - prev seg's previous strong directionality code - prev seg's previous terminator dir code - restart backup - skip offsets for each pass - This format must match what is generated by InitializeForNextSeg. -----------------------------------------------------------------------------------------------*/ -void EngineState::InitializeStreams(GrTableManager * ptman, - GrCharStream * pchstrm, - int cbPrev, byte * pbPrevSegDat, bool fNeedFinalBreak, int * pislotFinalBreak) -{ - int cpassLB = ptman->NumberOfLbPasses(); - int ipassPos1 = ptman->FirstPosPass(); - - CreateSlotStreams(); - - int cslotBackup = 0; - - InitForNewSegment(ptman); - - if (cbPrev == 0) - { - m_lbPrevEnd = klbNoBreak; - m_dircInitialStrongDir = kdircNeutral; - m_dircInitialTermDir = kdircNeutral; - for (int ipass = 0; ipass < m_cpass; ++ipass) - { - OutputStream(ipass)->Initialize(ipassPos1, false); - m_prgzpst[ipass].SetResyncSkip(0); - - if (ptman->LoggingTransduction()) - m_prgzpst[ipass].InitializeLogInfo(); - } - } - else - { - Assert(cbPrev >= 4); - byte * pb = pbPrevSegDat; - - m_lbPrevEnd = LineBrk(*pb++); - - // Directionality codes from the previous segment. - m_dircInitialStrongDir = DirCode((int)*pb++); - m_dircInitialTermDir = DirCode((int)*pb++); - - cslotBackup = (int)*pb++; - Assert((cbPrev == 4 || cslotBackup == 0) || cbPrev == m_cpass + 4); - - for (int ipass = 0; ipass < m_cpass; ++ipass) - { - OutputStream(ipass)->Initialize(ipassPos1, true); - if (cbPrev == 4) - m_prgzpst[ipass].SetResyncSkip(0); // different writing system - else - m_prgzpst[ipass].SetResyncSkip(*pb++); - - if (ptman->LoggingTransduction()) - m_prgzpst[ipass].InitializeLogInfo(); - } - - pchstrm->Backup(cslotBackup); - } - - if (cbPrev > 0 || pchstrm->StartLine()) - { - // Go ahead and run the initial line-break passes (if any), and then insert - // a line-break at the appropriate place where the new segment will begin. - int cslotToGet = cslotBackup; -LGetMore: - ptman->Pass(0)->ExtendGlyphIDOutput(ptman, pchstrm, OutputStream(0), - -1, 0, klbWordBreak, - cslotToGet, fNeedFinalBreak, m_twsh, pislotFinalBreak); - OutputStream(0)->SetSegMin(cslotBackup); - for (int ipass = 1; ipass <= cpassLB; ipass++) - { - if (cslotToGet > 0) - { - int nRet = kNextPass; - int cslotGot; - ptman->Pass(ipass)->ExtendOutput(ptman, - InputStream(ipass), OutputStream(ipass), - cslotToGet, m_twsh, &nRet, &cslotGot, pislotFinalBreak); - if (nRet != kNextPass) - { - cslotToGet = 1; - goto LGetMore; - } - } - OutputStream(ipass)->SetSegMin(cslotBackup); - } - Assert(OutputStream(cpassLB)->WritePos() >= cslotBackup); - m_cslotPreSeg = cslotBackup; - if (pchstrm->StartLine()) - { - OutputStream(cpassLB)->AppendLineBreak(ptman, pchstrm, m_lbPrevEnd, - (ptman->RightToLeft() ? kdircRlb : kdircLlb), cslotBackup, true, -1); - SetInitialLB(); - m_cslotPreSeg++; - if (cpassLB > 0 && *pislotFinalBreak > -1) - // See corresponding kludge in GrPass::ExtendGlyphIDOutput. - *pislotFinalBreak += 1; - } - else - { - OutputStream(cpassLB)->SetSegMin(cslotBackup); - } - OutputStream(cpassLB)->CalcIndexOffset(ptman); - } - - else - { - Assert(cslotBackup == 0); - OutputStream(0)->SetSegMin(0); - m_cslotPreSeg = 0; - } -} - -/*---------------------------------------------------------------------------------------------- - Reinitialize as we start to generate a new segment. -----------------------------------------------------------------------------------------------*/ -void EngineState::InitForNewSegment(GrTableManager * ptman) -{ - // Set up a fresh batch of slots. - DestroySlotBlocks(); - m_islotblkCurr = -1; - m_islotNext = kSlotBlockSize; - - m_fInitialLB = false; - m_fFinalLB = false; - m_fInsertedLB = false; - m_fExceededSpace = false; - m_fHitHardBreak = false; - m_fRemovedWhtsp = false; - InitPosCache(); - //////m_pgg = pgg; - - for (int ipass = 0; ipass < m_cpass; ipass++) - m_prgzpst[ipass].InitForNewSegment(ipass, ptman->Pass(ipass)->MaxRuleContext()); -} - -/*---------------------------------------------------------------------------------------------- - Calculate the position in stream zero of the given slot in the final stream, - based on the associations. (This will be the same as the position at the end of the - line-break passes, which is really what we want.) - - @param islotFinal - index of the final slot in the final stream -----------------------------------------------------------------------------------------------*/ -int EngineState::TraceStreamZeroPos(int islotFinal, int nTopDir) -{ - GrSlotStream * psstrmFinal = OutputStream(m_cpass - 1); - if (psstrmFinal->WritePos() == 0) - return -1; - - GrSlotState * pslot = psstrmFinal->SlotAt(islotFinal); - - // If we're in the middle of reordered bidi stuff, just use the end of the stream. - if (pslot->DirLevel() > nTopDir) - return -1; - - int islot = pslot->BeforeAssoc(); - if (islot == kPosInfinity || islot < 0) - return -1; - return islot + m_cslotPreSeg; -} - -/*---------------------------------------------------------------------------------------------- - Return the next higher (more relaxed, less desirable) line break weight. -----------------------------------------------------------------------------------------------*/ -LineBrk GrTableManager::IncLineBreak(LineBrk lb) -{ - Assert(lb != klbClipBreak); - return (LineBrk)((int)lb + 1); -} - -/*---------------------------------------------------------------------------------------------- - Return a pointer to a slot that is near the current position in the given stream. - Return NULL if no slots have been output at all. - This is used for initializing features of line-break slots. - @param ipassArg - pass at which to start looking - @param islot - slot to look for; -1 if considering the current position -----------------------------------------------------------------------------------------------*/ -GrSlotState * EngineState::AnAdjacentSlot(int ipassArg, int islot) -{ - int ipass = ipassArg; - while (ipass >= 0) - { - GrSlotStream * psstrm = OutputStream(ipass); - if (psstrm->NumberOfSlots() > 0) - { - if (islot == -1) - { - if (psstrm->AtEnd()) - return psstrm->SlotAt(psstrm->WritePos() - 1); - else - return psstrm->Peek(); - } - else - { - if (psstrm->WritePos() <= islot) - return psstrm->SlotAt(psstrm->WritePos() - 1); - else - return psstrm->SlotAt(islot); - } - } - ipass--; - } - return NULL; -} - -/*---------------------------------------------------------------------------------------------- - Simple access methods. -----------------------------------------------------------------------------------------------*/ -GrEngine * GrTableManager::Engine() -{ - return m_pgreng; -} - -EngineState * GrTableManager::State() -{ - return &m_engst; -} - -GrEngine * EngineState::Engine() -{ - return m_ptman->Engine(); -} - -GrTableManager * EngineState::TableManager() -{ - return m_ptman; -} - -/*---------------------------------------------------------------------------------------------- - Memory management for slots -----------------------------------------------------------------------------------------------*/ - -// standard for pass 0 slots -void EngineState::NewSlot( - gid16 gID, GrFeatureValues fval, int ipass, int ichwSegOffset, int nUnicode, - GrSlotState ** ppslotRet) -{ - NextSlot(ppslotRet); - (*ppslotRet)->Initialize(gID, Engine(), fval, ipass, ichwSegOffset, nUnicode); -} - -// line-break slots -void EngineState::NewSlot( - gid16 gID, GrSlotState * pslotFeat, int ipass, int ichwSegOffset, - GrSlotState ** ppslotRet) -{ - NextSlot(ppslotRet); - (*ppslotRet)->Initialize(gID, Engine(), pslotFeat, ipass, ichwSegOffset); -} - -// for inserting new slots after pass 0 (under-pos and unicode are irrelevant) -void EngineState::NewSlot( - gid16 gID, GrSlotState * pslotFeat, int ipass, - GrSlotState ** ppslotRet) -{ - NextSlot(ppslotRet); - (*ppslotRet)->Initialize(gID, Engine(), pslotFeat, ipass); -} - -// for making a new version of the slot initialized from the old -void EngineState::NewSlotCopy(GrSlotState * pslotCopyFrom, int ipass, - GrSlotState ** ppslotRet) -{ - NextSlot(ppslotRet); - (*ppslotRet)->InitializeFrom(pslotCopyFrom, ipass); -} - -void EngineState::NextSlot(GrSlotState ** ppslotRet) -{ - int cnExtraPerSlot = m_cUserDefn + (m_cCompPerLig * 2) + m_cFeat; - if (m_islotNext >= kSlotBlockSize) - { - // Allocate a new block of slots - GrSlotState * slotblkNew = new GrSlotState[kSlotBlockSize]; - u_intslot * prgnSlotBuf = new u_intslot[kSlotBlockSize * cnExtraPerSlot]; - - m_vslotblk.push_back(slotblkNew); - m_vprgnSlotVarLenBufs.push_back(prgnSlotBuf); - m_islotblkCurr++; - m_islotNext = 0; - Assert((unsigned)m_islotblkCurr == m_vslotblk.size()-1); - } - - *ppslotRet = m_vslotblk[m_islotblkCurr] + m_islotNext; - (*ppslotRet)->BasicInitialize(m_cUserDefn, m_cCompPerLig, m_cFeat, - (m_vprgnSlotVarLenBufs[m_islotblkCurr] + (m_islotNext * cnExtraPerSlot))); - m_islotNext++; -} - -/*---------------------------------------------------------------------------------------------- - Convert the number of font design units into source device logical units. -----------------------------------------------------------------------------------------------*/ -float GrTableManager::EmToLogUnits(int m) -{ - return m_engst.EmToLogUnits(m); -} - -float EngineState::EmToLogUnits(int m) -{ - if (m == 0) - return 0; - - float xysFontEmSquare; - m_pfont->getFontMetrics(NULL, NULL, &xysFontEmSquare); - - // mEmUnits should be equal to the design units in the font's em square - int mEmUnits = Engine()->GetFontEmUnits(); - if (mEmUnits <= 0) - { - Warn("Failed to obtain font em-units"); - return (float)m; - } - - return GrEngine::GrIFIMulDiv(m, xysFontEmSquare, mEmUnits); -} - -/*---------------------------------------------------------------------------------------------- - Convert the source device coordinates to font design units. -----------------------------------------------------------------------------------------------*/ -int GrTableManager::LogToEmUnits(float xys) -{ - return m_engst.LogToEmUnits(xys); -} - -int EngineState::LogToEmUnits(float xys) -{ - if (xys == 0) - return 0; - - float xysFontEmSquare; - m_pfont->getFontMetrics(NULL, NULL, &xysFontEmSquare); - - // mEmUnits should be equal to the design units in the font's em square - int mEmUnits = Engine()->GetFontEmUnits(); - if (mEmUnits < 0) - { - Warn("Failed to obtain font em-units"); - return (int)xys; - } - - return GrEngine::GrFIFMulDiv(xys, mEmUnits, xysFontEmSquare); -} - -/*---------------------------------------------------------------------------------------------- - Find the coordinates for a given glyph point. - Return true on success, false otherwise. -----------------------------------------------------------------------------------------------*/ -bool GrTableManager::GPointToXY(gid16 chwGlyphID, int nGPoint, float * pxs, float * pys) -{ - return m_engst.GPointToXY(chwGlyphID, nGPoint, pxs, pys); -} - -bool EngineState::GPointToXY(gid16 chwGlyphID, int nGPoint, float * pxs, float * pys) -{ - *pxs = INT_MIN; - *pys = INT_MIN; - Point pointRet; - m_pfont->getGlyphPoint(chwGlyphID, nGPoint, pointRet); - *pxs = pointRet.x; - *pys = pointRet.y; - - return true; -} - -/*---------------------------------------------------------------------------------------------- - Call the justification routines. -----------------------------------------------------------------------------------------------*/ -void GrTableManager::CallJustifier(IGrJustifier * pgjus, int ipassCurr, - float dxUnjustified, float dxJustified, bool fEndLine) -{ - // Indicates the stream the justification routines will read and modify: - m_engst.m_ipassJustCalled = ipassCurr; - - int iGlyphMin = OutputStream(ipassCurr)->SegMin(); - int iGlyphLim = OutputStream(ipassCurr)->SegLimIfKnown(); - if (iGlyphLim == -1) - iGlyphLim = OutputStream(ipassCurr)->WritePos(); - - GrSlotStream * psstrm = OutputStream(ipassCurr); - if (m_pgreng->BasicJustification() && fEndLine) - UnstretchTrailingWs(psstrm, iGlyphLim); - - pgjus->adjustGlyphWidths(m_pgreng, iGlyphMin, iGlyphLim, dxUnjustified, dxJustified); - - // After returning, reading and modifying slot attributes is not permitted: - m_engst.m_ipassJustCalled = -1; -} - -/*---------------------------------------------------------------------------------------------- - For the basic justification approach, remove stretch from the trailing whitespace. -----------------------------------------------------------------------------------------------*/ -void GrTableManager::UnstretchTrailingWs(GrSlotStream * psstrm, int iGlyphLim) -{ - int islot = iGlyphLim - 1; - while (islot >= 0) - { - GrSlotState * pslot = psstrm->SlotAt(islot); - if (pslot->IsLineBreak(LBGlyphID())) - { } // keep looking for the trailing space - else if (pslot->IsSpace(this)) - pslot->SetJStretch(0); // TODO: do this at level 0 - else - // something other than space--quit - return; - islot--; - } -} - -/*---------------------------------------------------------------------------------------------- - Determine how much shrink is permissible. - - This method is really used only for testing the shrink mechanism, since at this time - we don't allow low-end justification to do any shrinking. -----------------------------------------------------------------------------------------------*/ -void GrTableManager::DetermineShrink(IGrJustifier * pgjus, int ipassCurr) -{ - if (m_engst.m_dxsShrinkPossible != GrSlotState::kNotYetSet) - return; - - if (m_engst.m_jmodi != kjmodiCanShrink || pgjus == NULL) - { - m_engst.m_dxsShrinkPossible = 0; - return; - } - - if (ipassCurr != m_ipassJust1 - 1) - return; - - GrSlotStream * psstrm = OutputStream(ipassCurr); - if (!psstrm->FullyWritten()) - return; - - // Normally just answer 0. To test shrinking, turn on the code below. - m_engst.m_dxsShrinkPossible = 0; - -#if TEST_SHRINK - int mTotal = 0; - int mShrink = 0; - int islotLim = psstrm->SegLimIfKnown(); - if (islotLim == -1) - islotLim = psstrm->WritePos(); - for ( ; islotLim >= 0; islotLim--) - { - // Trailing white space is not shrinkable. - GrSlotState * pslot = psstrm->SlotAt(islotLim - 1); - if (pslot->IsLineBreak(LBGlyphID())) - continue; - if (!pslot->IsSpace(this)) - break; - } - int islot; - for (islot = psstrm->SegMin(); islot < islotLim; islot++) - { - GrSlotState * pslot = psstrm->SlotAt(islot); - if (pslot->IsLineBreak(LBGlyphID())) - continue; - mTotal += pslot->AdvanceX(this); - mShrink += pslot->JShrink(); - } - - // Say that we are allowed to shrink up to 10% of the width of the segment. - mShrink = min(mShrink, mTotal/10); - m_engst.m_dxsShrinkPossible = EmToLogUnits(mShrink); -#endif // TEST_SHRINK -} - -/*---------------------------------------------------------------------------------------------- - Return the attribute of the given slot, back to the justification routine. Return - logical units. -----------------------------------------------------------------------------------------------*/ -GrResult EngineState::GetGlyphAttrForJustification(int iGlyph, int jgat, int nLevel, - float * pValueRet) -{ - GrResult res; - int valueRetInt = 0; - switch(jgat) - { - case kjgatWeight: - case kjgatStretchInSteps: - case kjgatBreak: - res = GetGlyphAttrForJustification(iGlyph, jgat, nLevel, &valueRetInt); - *pValueRet = (float)valueRetInt; - return res; - default: - break; - } - - if (m_ipassJustCalled == -1) - return kresUnexpected; - - if (nLevel != 1) - return kresInvalidArg; - - GrSlotStream * psstrm = OutputStream(m_ipassJustCalled); - - if (iGlyph < -1 || iGlyph >= psstrm->WritePos()) - return kresInvalidArg; - - GrSlotState * pslot = psstrm->SlotAt(iGlyph); - - // bool fConvertUnits = true; - - switch(jgat) - { - case kjgatStretch: - *pValueRet = EmToLogUnits(pslot->JStretch()); - break; - case kjgatShrink: - *pValueRet = EmToLogUnits(pslot->JShrink()); - break; - case kjgatStep: - *pValueRet = EmToLogUnits(pslot->JStep()); - break; - default: - return kresNotImpl; - } - return kresOk; -} - -GrResult EngineState::GetGlyphAttrForJustification(int iGlyph, int jgat, int nLevel, - int * pValueRet) -{ - GrResult res; - float valueRetFloat; - switch(jgat) - { - case kjgatStretch: - case kjgatShrink: - case kjgatStep: - res = GetGlyphAttrForJustification(iGlyph, jgat, nLevel, &valueRetFloat); - *pValueRet = GrEngine::RoundFloat(valueRetFloat); - return res; - default: - break; - } - - if (m_ipassJustCalled == -1) - return kresUnexpected; - - if (nLevel != 1) - return kresInvalidArg; - - GrSlotStream * psstrm = OutputStream(m_ipassJustCalled); - - if (iGlyph < -1 || iGlyph >= psstrm->WritePos()) - return kresInvalidArg; - - GrSlotState * pslot = psstrm->SlotAt(iGlyph); - - int mStretch, mStep; - //float xsStretch, xsStep; - - switch(jgat) - { - case kjgatWeight: - *pValueRet = pslot->JWeight(); - break; - case kjgatStretchInSteps: - // ???? should this be calculated in terms of logical units?? - // Probably doesn't matter, since the logical units are floating point, so the - // level of precision is about the same. - mStretch = pslot->JStretch(); - mStep = pslot->JStep(); - if (mStep == 0) - return kresUnexpected; - *pValueRet = int(mStretch / mStep); // round down - break; - //case kjgatStretchInSteps: - // xsStretch = EmToLogUnits(pslot->JStretch()); - // xsStep = EmToLogUnits(pslot->JStep()); - // if (xsStep == 0) - // return kresUnexpected; - // *pValueRet = int(xsStretch / xsStep); // round down - // break; - case kjgatBreak: - *pValueRet = pslot->BreakWeight(); - break; - default: - return kresNotImpl; - } - return kresOk; -} - -/*---------------------------------------------------------------------------------------------- - Set the attribute of the given slot, for the justification routine. -----------------------------------------------------------------------------------------------*/ -GrResult EngineState::SetGlyphAttrForJustification(int iGlyph, int jgat, int nLevel, - float value) -{ - GrResult res; - int valueInt; - switch(jgat) - { - case kjgatWeight: - case kjgatStretchInSteps: - case kjgatBreak: - valueInt = (int)value; - res = SetGlyphAttrForJustification(iGlyph, jgat, nLevel, valueInt); - return res; - default: - break; - } - - if (m_ipassJustCalled == -1) - return kresUnexpected; - - if (nLevel != 1) - return kresInvalidArg; - - GrSlotStream * psstrm = OutputStream(m_ipassJustCalled); - - if (iGlyph < -1 || iGlyph >= psstrm->WritePos()) - return kresInvalidArg; - - GrSlotState * pslot = psstrm->SlotAt(iGlyph); - - int mValue = LogToEmUnits(value); - mValue = min(mValue, 0xFFFF); // truncate to an unsigned short - - // Review: do we really want to allow them to set stretch/shrink/step/weight? The normal - // thing for them to do is set width. - switch(jgat) - { - case kjgatStretch: - pslot->SetJStretch(mValue); - break; - case kjgatShrink: - pslot->SetJShrink(mValue); - break; - case kjgatStep: - pslot->SetJStep(mValue); - break; - case kjgatWidth: - pslot->SetJWidth(mValue); - break; - default: - return kresNotImpl; - } - return kresOk; -} - -GrResult EngineState::SetGlyphAttrForJustification(int iGlyph, int jgat, int nLevel, - int value) -{ - GrResult res; - float valueFloat; - switch(jgat) - { - case kjgatStretch: - case kjgatShrink: - case kjgatStep: - case kjgatWidth: - valueFloat = (float)value; - res = SetGlyphAttrForJustification(iGlyph, jgat, nLevel, valueFloat); - return res; - default: - break; - } - - if (m_ipassJustCalled == -1) - return kresUnexpected; - - if (nLevel != 1) - return kresInvalidArg; - - GrSlotStream * psstrm = OutputStream(m_ipassJustCalled); - - if (iGlyph < -1 || iGlyph >= psstrm->WritePos()) - return kresInvalidArg; - - GrSlotState * pslot = psstrm->SlotAt(iGlyph); - - int mValue, cSteps; - switch(jgat) - { - case kjgatWeight: - pslot->SetJWeight(value); - break; - case kjgatWidthInSteps: - cSteps = value; - mValue = pslot->JStep(); - if (mValue == 0) - return kresUnexpected; - pslot->SetJWidth(mValue * cSteps); - break; - default: - return kresNotImpl; - } - return kresOk; -} - -//:>-------------------------------------------------------------------------------------------- -//:> Functions to forward to the engine. -//:>------------------------------------------------------------------------------------------*/ -gid16 GrTableManager::GetGlyphIDFromUnicode(int nUnicode) -{ - return m_pgreng->GetGlyphIDFromUnicode(nUnicode); -} - -/*--------------------------------------------------------------------------------------------*/ - -gid16 GrTableManager::ActualGlyphForOutput(utf16 chw) -{ - return m_pgreng->ActualGlyphForOutput(chw); -} - -/*--------------------------------------------------------------------------------------------*/ - -GrGlyphTable * GrTableManager::GlyphTable() -{ - return m_pgreng->GlyphTable(); -} - -/*--------------------------------------------------------------------------------------------*/ - -gid16 GrTableManager::LBGlyphID() -{ - return m_pgreng->LBGlyphID(); -} - -/*--------------------------------------------------------------------------------------------*/ - -gid16 GrTableManager::GetClassGlyphIDAt(int nClass, int nIndex) -{ - return m_pgreng->GetClassGlyphIDAt(nClass, nIndex); -} - -/*--------------------------------------------------------------------------------------------*/ - -int GrTableManager::GetIndexInGlyphClass(int nClass, gid16 chwGlyphID) -{ - return m_pgreng->GetIndexInGlyphClass(nClass, chwGlyphID); -} - -/*--------------------------------------------------------------------------------------------*/ - -size_t GrTableManager::NumberOfGlyphsInClass(int nClass) -{ - return m_pgreng->NumberOfGlyphsInClass(nClass); -} - -/*--------------------------------------------------------------------------------------------*/ - -void GrTableManager::SetSlotAttrsFromGlyphAttrs(GrSlotState * pslot) -{ - m_pgreng->SetSlotAttrsFromGlyphAttrs(pslot); -} - -/*--------------------------------------------------------------------------------------------*/ - -int GrTableManager::NumFeat() -{ - return m_pgreng->NumFeat(); -} - -/*--------------------------------------------------------------------------------------------*/ - -int GrTableManager::DefaultForFeatureAt(int ifeat) -{ - return m_pgreng->DefaultForFeatureAt(ifeat); -} - -/*--------------------------------------------------------------------------------------------*/ - -void GrTableManager::DefaultsForLanguage(isocode lgcode, - std::vector & vnFeats, std::vector & vnValues) -{ - return m_pgreng->DefaultsForLanguage(lgcode, vnFeats, vnValues); -} - -/*--------------------------------------------------------------------------------------------*/ - -GrFeature * GrTableManager::FeatureWithID(featid nID, int * pifeat) -{ - return m_pgreng->FeatureWithID(nID, pifeat); -} - -/*--------------------------------------------------------------------------------------------*/ - -GrFeature * GrTableManager::Feature(int ifeat) -{ - return m_pgreng->Feature(ifeat); -} - -/*--------------------------------------------------------------------------------------------*/ - -bool GrTableManager::RightToLeft() -{ - if (m_engst.WhiteSpaceOnly()) - return m_engst.m_fParaRtl; - else - return m_pgreng->RightToLeft(); -} - -/*--------------------------------------------------------------------------------------------*/ - -int GrTableManager::TopDirectionLevel() -{ - return m_pgreng->TopDirectionLevel(); -} - -/*--------------------------------------------------------------------------------------------*/ - -float GrTableManager::VerticalOffset() -{ - return m_pgreng->VerticalOffset(); -} - -/*--------------------------------------------------------------------------------------------*/ - -int GrTableManager::NumUserDefn() -{ - return m_pgreng->NumUserDefn(); -} - -/*--------------------------------------------------------------------------------------------*/ - -int GrTableManager::NumCompPerLig() -{ - return m_pgreng->NumCompPerLig(); -} - -/*--------------------------------------------------------------------------------------------*/ - -int GrTableManager::ComponentIndexForGlyph(gid16 chwGlyphID, int nCompID) -{ - return m_pgreng->ComponentIndexForGlyph(chwGlyphID, nCompID); -} - -/*--------------------------------------------------------------------------------------------*/ - -int GrTableManager::GlyphAttrValue(gid16 chwGlyphID, int nAttrID) -{ - return m_pgreng->GlyphAttrValue(chwGlyphID, nAttrID); -} - -/*--------------------------------------------------------------------------------------------*/ - -bool GrTableManager::LoggingTransduction() -{ - return m_fLogging; - //return m_pgreng->LoggingTransduction(); -} - -/*---------------------------------------------------------------------------------------------- - Calculate the positions of the glyphs up to the given slot, within the output of the given - pass. If the slot is NULL, go all the way to the end of what has been generated. - - @param ipass - index of pass needing positioning; normally this will be the - final pass, but it could be another if positions are - requested by the rules themselves - @param pslotLast - last slot that needs to be positioned, or NULL - @param pxsWidth - return the total width used so far - @param psxVisibleWidth - return the visible width so far - - MOVE to EngineState -----------------------------------------------------------------------------------------------*/ -void GrTableManager::CalcPositionsUpTo(int ipass, GrSlotState * pslotLast, - float * pxsWidth, float * pxsVisibleWidth) -{ - Assert(ipass >= m_ipassPos1 - 1); - - int isstrm = ipass; - GrSlotStream * psstrm = OutputStream(isstrm); - Assert(psstrm->GotIndexOffset()); - if (psstrm->WritePos() <= psstrm->IndexOffset()) - { - Assert(psstrm->WritePos() == 0); - *pxsWidth = 0; - *pxsVisibleWidth = 0; - return; - } - if (!pslotLast) - { - pslotLast = psstrm->SlotAt(psstrm->WritePos() - 1); - } - Assert(pslotLast); - - // First set positions of all base slots. - - int islot = psstrm->IndexOffset(); - GrSlotState * pslot; - float xs = 0; - float ys = VerticalOffset(); - *pxsWidth = 0; - *pxsVisibleWidth = 0; - - bool fLast = false; - bool fLastBase = false; - - bool fFakeItalic = m_pgreng->FakeItalic(); - float fakeItalicRatio = 0; - if (fFakeItalic) - fakeItalicRatio = State()->GetFont()->fakeItalicRatio(); - bool fBasicJust = m_pgreng->BasicJustification(); - - // Figure out how to know when to stop. - // We need to calculate up to the base of the last leaf slot, if it happens - // to be later in the stream than the last actual slot passed in. - if (!psstrm->HasSlotAtPosPassIndex(pslotLast->AttachRootPosPassIndex())) - return; - GrSlotState * pslotLastBase = pslotLast->Base(psstrm); - - if (ipass == m_cpass - 1 && m_engst.m_islotPosNext > -1) - { - // For final pass, initialize from cache of previous calculations. - islot = m_engst.m_islotPosNext; - xs = m_engst.m_xsPosXNext; - ys = m_engst.m_ysPosYNext; - *pxsWidth = m_engst.m_dxsTotWidthSoFar; - *pxsVisibleWidth = m_engst.m_dxsVisWidthSoFar; - - if (psstrm->SlotsPresent() <= islot) - return; - - if (pslotLastBase->PosPassIndex() == GrSlotAbstract::kNotYetSet) - { - Assert(false); // I think this case is handled above - return; // can't position this slot yet; its base has not been processed - } - - if (pslotLastBase->PosPassIndex() + psstrm->IndexOffset() < islot) - { - fLastBase = true; - if (pslotLast == pslotLastBase) - fLast = true; - } - } - - std::vector vpslotAttached; - - bool fRtl = RightToLeft(); - - while (!fLast || !fLastBase) - { - Assert(islot < psstrm->SlotsPresent()); - - pslot = (isstrm == ipass) ? psstrm->SlotAt(islot) : psstrm->OutputSlotAt(islot); - - if (!pslot->IsBase()) - { - // This slot is attached to another; it will be positioned strictly - // relative to that one. This happens in the loop below. - vpslotAttached.push_back(pslot); - } - else - { - // Base character. - - bool fLB = pslot->IsLineBreak(LBGlyphID()); - if (InternalJustificationMode() == kjmodiJustify && fBasicJust - && ipass == m_cpass - 1 && !fLB) - { - m_engst.AddJWidthToAdvance(psstrm, &pslot, islot, &pslotLast, &pslotLastBase); - } - - // Make sure the metrics are the complete ones. - pslot->CalcCompositeMetrics(this, psstrm, kPosInfinity, true); - - float xsInc = pslot->GlyphXOffset(psstrm, fakeItalicRatio); - float ysInc = pslot->GlyphYOffset(psstrm); - float xsAdvX = pslot->ClusterAdvWidth(psstrm); - float ysAdvY = (fLB) ? - 0 : - EmToLogUnits(pslot->AdvanceY(this)); - - if (fRtl) - { - xs -= xsAdvX; - ys -= ysAdvY; - pslot->SetXPos(xs + xsInc); - pslot->SetYPos(ys + ysInc); - } - else - { - pslot->SetXPos(xs + xsInc); - pslot->SetYPos(ys + ysInc); - xs += xsAdvX; - ys += ysAdvY; - } - - *pxsWidth = max(*pxsWidth, fabsf(xs)); - if (!IsWhiteSpace(pslot)) - *pxsVisibleWidth = *pxsWidth; - - if (isstrm == m_cpass - 1) - { - // For the final output pass, cache the results of the calculation so far. - // Only do this for slots that have actually been processed by the final - // pass, because others may have intermediate values that may be changed - // later. - m_engst.m_islotPosNext = pslot->PosPassIndex() + psstrm->IndexOffset() + 1; - m_engst.m_xsPosXNext = xs; - m_engst.m_ysPosYNext = ys; - m_engst.m_dxsTotWidthSoFar = *pxsWidth; - m_engst.m_dxsVisWidthSoFar = *pxsVisibleWidth; - } - } - - // Need to have calculated both the last leaf and the last base (if they happen to - // be different); if so, we're done. - if (pslot == pslotLast) - fLast = true; - if (pslot == pslotLastBase) - fLastBase = true; - - islot++; - } - - Assert(fLast); - Assert(fLastBase); - - // Now set positions of non-base slots, relative to their bases. - - for (size_t ipslot = 0; ipslot < vpslotAttached.size(); ipslot++) - { - GrSlotState * pslot = vpslotAttached[ipslot]; - GrSlotState * pslotBase = pslot->Base(psstrm); - if (pslotBase->XPosition() == kNegInfinity || pslotBase->YPosition() == kNegInfinity) - { - Assert(false); - continue; - } - float xsCluster = pslotBase->XPosition() - pslotBase->GlyphXOffset(psstrm, fakeItalicRatio); - float ysCluster = pslotBase->YPosition() - pslotBase->GlyphYOffset(psstrm); - float xsInc = pslot->GlyphXOffset(psstrm, fakeItalicRatio); - float ysInc = pslot->GlyphYOffset(psstrm); - pslot->SetXPos(xsCluster + xsInc); - pslot->SetYPos(ysCluster + ysInc); - - // My theory is that we don't need to adjust *pxsWidth here, because the width of - // any non-base slots should be factored into the advance width of their cluster - // base, which was handled above. - } -} - -/*---------------------------------------------------------------------------------------------- - Return true if the given slot is white space. -----------------------------------------------------------------------------------------------*/ -bool GrTableManager::IsWhiteSpace(GrSlotState * pslot) -{ - if (pslot->IsLineBreak(LBGlyphID())) - return true; - return pslot->IsSpace(this); -} - -/*---------------------------------------------------------------------------------------------- - When doing basic justification, apply the value of justify.width to the advance width. - This happens during the final positioning routine. -----------------------------------------------------------------------------------------------*/ -void EngineState::AddJWidthToAdvance(GrSlotStream * psstrm, GrSlotState ** ppslot, int islot, - GrSlotState ** ppslotLast, GrSlotState ** ppslotLastBase) -{ - Assert(psstrm->OutputOfPass() == m_cpass - 1); // only used for final stream - if ((*ppslot)->JWidth() > 0) - { - if ((*ppslot)->PassModified() != m_cpass - 1) - { - // Replace the slot with a new slot, so it gets marked properly with the - // pass in which it was modified. (Otherwise the debug log gets screwed up.) - GrSlotState * pslotNew; - NewSlotCopy((*ppslot), m_cpass - 1, &pslotNew); - psstrm->PutSlotAt(pslotNew, islot); - if (*ppslot == *ppslotLast) - *ppslotLast = pslotNew; - if (*ppslot == *ppslotLastBase) - *ppslotLastBase = pslotNew; - *ppslot = pslotNew; - } - (*ppslot)->AddJWidthToAdvance(TableManager()); - } -} - - -//:>******************************************************************************************** -//:> Debuggers and utilities -//:>******************************************************************************************** - -//:Ignore -#if 0 -void GrTableManager::TempDebug() -{ - for (int ipass = 0; ipass < m_cpass; ++ipass) - { - int wpos = OutputStream(ipass)->WritePos(); - int rpos = OutputStream(ipass)->ReadPos(); - GrSlotState * wslot = OutputStream(ipass)->LastSlotWritten(); - GrSlotState * rslot = OutputStream(ipass)->LastSlotRead(); - - } -} -#endif -/*---------------------------------------------------------------------------------------------- - Given a character index in the original string, locate the corresponding line-break slot - in the final surface stream. The character index must be one before which there is a - line-break (seg lim), or the beginning or the end of the string. - TODO SharonC: fix the bugs -----------------------------------------------------------------------------------------------*/ -int GrTableManager::SurfaceLineBreakSlot(int ichw, GrCharStream * pchstrm, bool fInitial) -{ - if (ichw == 0) - { - Assert(fInitial); - return -1; // no initial line break - } - if (ichw == pchstrm->Lim()) - { - Assert(!fInitial); - return -1; // no terminating line break - } - - int islotIn = pchstrm->SegOffset(ichw); - Assert(islotIn >= 0); - islotIn += (fInitial? m_engst.m_cslotPreSeg - 1: m_engst.m_cslotPreSeg); - - gid16 chwLBGlyphID = LBGlyphID(); - - // Now islotIn is the position in stream 0; - - for (int ipass = 1; ipass < m_cpass; ++ipass) - { - int islotChunkMin; - int islotChunkLim; - GrSlotStream * psstrmOut = OutputStream(ipass); - - GrSlotStream * psstrmIn = InputStream(ipass); - if (fInitial) - islotIn = max(islotIn, psstrmIn->PreChunk()); - int islotT = psstrmIn->ChunkInNextMin(islotIn); - islotChunkMin = psstrmIn->ChunkInNext(islotT); - islotChunkMin = (islotChunkMin == -1)? 0: islotChunkMin; - - islotT = psstrmIn->ChunkInNextLim(islotIn); - Assert(islotT <= psstrmIn->ReadPos()); - if (islotT == psstrmIn->ReadPos()) - islotChunkLim = psstrmOut->WritePos(); - else - islotChunkLim = psstrmIn->ChunkInNext(islotT); - - int islotOut; - for (islotOut = islotChunkMin; islotOut < islotChunkLim; ++islotOut) - { - gid16 chw = psstrmOut->GlyphIDAt(islotOut); - if (chw == chwLBGlyphID) - break; - } - Assert(psstrmOut->GlyphIDAt(islotOut) == chwLBGlyphID); - - islotIn = islotOut; - } - return islotIn; -} - -/*---------------------------------------------------------------------------------------------- - Generate a debugger string showing the chunk boundaries for the given stream. -----------------------------------------------------------------------------------------------*/ -std::wstring GrTableManager::ChunkDebugString(int ipass) -{ - GrSlotStream * psstrm = OutputStream(ipass); - std::wstring stuRet; - //utf16 chwN = '\\'; - //utf16 chwR = '^'; - - gid16 chwLBGlyphID = LBGlyphID(); - - for (int islot = 0; islot < psstrm->WritePos(); islot++) - { - if (psstrm->ChunkInPrev(islot) != -1) - { - if (psstrm->ChunkInNext(islot) != -1) - stuRet.append(L">"); - else - stuRet.append(L"\\"); - } - else if (psstrm->ChunkInNext(islot) != -1) - stuRet.append(L"/"); - else - stuRet.append(L" "); - -// if (islot == psstrm->ReadPos()) -// stuRet.Append(&chwR, 1); - - wchar_t chw = psstrm->SlotAt(islot)->GlyphID(); - if (chw == chwLBGlyphID) - stuRet.append(L"#"); - else - stuRet.append(&chw, 1); - } - return stuRet; -} - -} // namespace gr - -//:End Ignore diff --git a/Build/source/libs/graphite/engine-2.3.1/src/segment/GrTableManager.h b/Build/source/libs/graphite/engine-2.3.1/src/segment/GrTableManager.h deleted file mode 100644 index b75034479e4..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/src/segment/GrTableManager.h +++ /dev/null @@ -1,557 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 1999, 2001 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: GrTableManager.h -Responsibility: Sharon Correll -Last reviewed: Not yet. - -Description: - The GrTableManager class. -----------------------------------------------------------------------------------------------*/ -#ifdef _MSC_VER -#pragma once -#endif -#ifndef GR_TABLEMAN_INCLUDED -#define GR_TABLEMAN_INCLUDED - -#include -//:End Ignore - -namespace gr -{ - -class Font; - -/*---------------------------------------------------------------------------------------------- - There is a single instance of Engine State that keeps track of the state of the processing - for a single segment generation. - - Hungarian: engst -----------------------------------------------------------------------------------------------*/ -class EngineState -{ - friend class GrTableManager; - friend class FontMemoryUsage; - -public: - EngineState(); - void Initialize(GrEngine *, GrTableManager *); - - ~EngineState(); - void DestroySlotBlocks(); - - void InitForNewSegment(GrTableManager * ptman); - - void CreateEmpty(); - - GrEngine * Engine(); - GrTableManager * TableManager(); - - void CreateSlotStreams(); - - GrSlotStream * InputStream(int ipass) - { - Assert(ipass > 0); // the char stream serves as input to the zeroth pass - return m_prgpsstrm[ipass - 1]; - } - - // Return the stream that serves as output to the given pass. - GrSlotStream * OutputStream(int ipass) - { - Assert(ipass < m_cpass); - return m_prgpsstrm[ipass]; - } - - GrSlotState * AnAdjacentSlot(int ipassArg, int islotArg); - - GrResult GetGlyphAttrForJustification(int iGlyph, int jgat, int nLevel, float * pxysValueRet); - GrResult GetGlyphAttrForJustification(int iGlyph, int jgat, int nLevel, int * pxysValueRet); - GrResult SetGlyphAttrForJustification(int iGlyph, int jgat, int nLevel, float xysValue); - GrResult SetGlyphAttrForJustification(int iGlyph, int jgat, int nLevel, int xysValue); - - enum { kSlotBlockSize = 50 }; // number of slots to allocate in a block - - void InitPosCache() - { - m_islotPosNext = -1; - m_xsPosXNext = 0; - m_ysPosYNext = 0; - m_dxsTotWidthSoFar = 0; - m_dxsVisWidthSoFar = 0; - } - - void SetFont(Font * pfont) - { - m_pfont = pfont; - } - Font * GetFont() - { - return m_pfont; - } - - bool StartLineContext() - { - return m_fStartLineContext; - } - bool EndLineContext() - { - return m_fEndLineContext; - } - void SetStartLineContext(bool f) - { - m_fStartLineContext = f; - } - void SetEndLineContext(bool f) - { - m_fEndLineContext = f; - } - - void SetInitialLB(bool f = true) - { - m_fInitialLB = f; - } - - void SetFinalLB(bool f = true) - { - m_fFinalLB = f; - } - - void SetInsertedLB(bool f = true) - { - m_fInsertedLB = f; - } - - bool HasInitialLB() - { - return m_fInitialLB; - } - bool HasInsertedLB() - { - return m_fInsertedLB; - } - bool HasFinalLB() - { - return m_fFinalLB; - } - - void SetExceededSpace(bool f = true) - { - m_fExceededSpace = f; - } - - bool ExceededSpace() - { - return m_fExceededSpace; - } - - void SetHitHardBreak(bool f = true) - { - m_fHitHardBreak = f; - } - - bool HitHardBreak() - { - return m_fHitHardBreak; - } - - void SetRemovedTrWhiteSpace(bool f = true) - { - m_fRemovedWhtsp = f; - } - - bool RemovedTrWhiteSpace() - { - return m_fRemovedWhtsp; - } - - bool WhiteSpaceOnly() - { - return (m_twsh == ktwshOnlyWs); - } - - bool ParaRightToLeft() - { - return m_fParaRtl; - } - - //int PrevPassMaxBackup(int ipass) - //{ - // if (ipass == 0) - // return 0; - // return Pass(ipass - 1)->MaxBackup(); - //} - - DirCode InitialStrongDir() - { - return m_dircInitialStrongDir; - } - DirCode InitialTermDir() - { - return m_dircInitialTermDir; - } - - void InitializeStreams(GrTableManager * ptman, GrCharStream * pchstrm, - int cbPrev, byte * pbPrevSegDat, bool fNeedFinalBreak, int * pislotFinalBreak); - int LbSlotToSegLim(int islot, GrCharStream * pchstrm, int cpassLB); - int TraceStreamZeroPos(int islotFinal, int nTopDir); - - float EmToLogUnits(int m); - int LogToEmUnits(float xys); - bool GPointToXY(gid16 chwGlyphID, int nGPoint, float * xs, float * ys); - - void AddJWidthToAdvance(GrSlotStream * psstrm, GrSlotState ** ppslot, int islot, - GrSlotState ** ppslotLast, GrSlotState ** ppslotLastBase); - - // Memory management for slots: - void NewSlot(gid16 gID, GrFeatureValues fval, int ipass, int ichwSegOffset, int nUnicode, - GrSlotState **); - void NewSlot(gid16 gID, GrSlotState * pslotFeat, int ipass, int ichwSegOffset, - GrSlotState **); - void NewSlot(gid16 gID, GrSlotState * pslotFeat, int ipass, GrSlotState **); - void NewSlotCopy(GrSlotState * pslotCopyFrom, int ipass, - GrSlotState ** pslotRet); -protected: - void NextSlot(GrSlotState ** ppslot); - -protected: - GrTableManager * m_ptman; - - int m_cFeat; - int m_cCompPerLig; - int m_cUserDefn; - - int m_jmodi; // justification mode - int m_ipassJustCalled; // pass after which justification routine was called; - // -1 if we are not in the midst of interacting with the - // GrJustifier - - // Pointer to font - Font * m_pfont; - - bool m_fStartLineContext; // true if there was a rule that ran over the initial LB - bool m_fEndLineContext; // true if there was a rule that ran over the final LB - - // the number of slots inserted in the first stream before the official beginning - // of the segment, including any initial line break - int m_cslotPreSeg; - - // List of allocated GrSlotStates; hungarian slotblk = prgslot - std::vector m_vslotblk; - std::vector m_vprgnSlotVarLenBufs; // corresponding var-length blocks - int m_islotblkCurr; - int m_islotNext; - - // Directionality codes from previous segment; these are used by the bidi algorithm - // at the initial line-break character. - DirCode m_dircInitialStrongDir; - DirCode m_dircInitialTermDir; - - LineBrk m_lbPrevEnd; - - // All of the following 3 are true only when there is an actual LB glyph in the stream - bool m_fInitialLB; // is there is an initial LB (an actual LB glyph--in all streams) - bool m_fFinalLB; // is there is a final LB (in all streams--true when we've hit - // the end of the input and end-of-line is true) - bool m_fInsertedLB; // is there is a final LB inserted in the output of LB pass - // (true when we've backtracked) - - bool m_fExceededSpace; // true if we backtracked due to exceeding space; false if we - // haven't backtracked, or we did so for some other reason - // (eg, omitting trailing whitespace) - - bool m_fHitHardBreak; // true if we encountered a hard-break in the input stream - // (before the natural end of the segment) - - bool m_fRemovedWhtsp; // true if we've hit trailing whitespace characters that we've - // removed - - TrWsHandling m_twsh; // white-space handling - bool m_fParaRtl; // paragraph direction - - float m_dxsShrinkPossible; - - // The final positioning pass is where we are going to do most of the positioning. - // Cache the intermediate results so we don't have to calculate from the beginning of - // the segment every time. - int m_islotPosNext; // where to continue calculating positions in final output stream - // (one past the last base that was calculated) - float m_xsPosXNext; - float m_ysPosYNext; - float m_dxsTotWidthSoFar; - float m_dxsVisWidthSoFar; - - int m_cpass; // number of passes - - // array of pass-state objects - PassState * m_prgzpst; - - // array of slot streams which are output of passes (input of zeroth - // pass is the character stream, not a slot stream): - GrSlotStream ** m_prgpsstrm; - // For instance, a simple set of passes might look like this: - // CharStream - // GlyphGenPass pass 0 - // SlotStream stream 0 - // SubPass pass 1 - // SlotStream stream 1 - // PosPass pass 2 - // SlotStream stream 2 - // - // m_cpass = 3 - -}; // end of class EngineState - -/*---------------------------------------------------------------------------------------------- - There is a single instance of GrTableManager that handle the interactions between - passes, including the demand-pull mechanism. - - Hungarian: tman -----------------------------------------------------------------------------------------------*/ - -class GrTableManager { - friend class FontMemoryUsage; - -public: - // Constructor & destructor: - GrTableManager(GrEngine * pgreng) - : m_cpass(0), - m_fBidi(false), - m_prgppass(NULL), - m_pgreng(pgreng) - { - Assert(pgreng); - } - - ~GrTableManager(); - - bool CreateAndReadPasses(GrIStream & grstrm, int fxdSilfVersion, int fxdRuleVersion, - int cpassFont, long lSubTableStart, int * rgnPassOffsets, - int ipassSub1Font, int ipassPos1Font, int ipassJust1Font, byte ipassPostBidiFont); - - void CreateEmpty(); - - GrEngine * Engine(); - EngineState * State(); - - void Run(Segment * psegNew, Font * pfont, GrCharStream * pchstrm, - IGrJustifier * pgjus, int jmodi, - LayoutEnvironment & layout, - int ichStop, float dxWidth, float dxUnjustified, - bool fNeedFinalBreak, bool fMoreText, int ichFontLim, - bool fInfiniteWidth, bool fWidthIsCharCount, - int ichwCallerBtLim, - int nDirDepth, SegEnd estJ); - - GrPass* Pass(int ipass) - { - Assert(ipass >= 0); - return m_prgppass[ipass]; - } - - int NumberOfPasses() - { - return m_cpass; - } - - int NumberOfLbPasses() - { - return m_cpassLB; - } - - bool HasBidiPass() - { - return m_fBidi; - } - - int FirstPosPass() - { - return m_ipassPos1; - } - - void StorePassStates(PassState * rgzpst); - - // Return the stream that serves as input to the given pass. - GrSlotStream * InputStream(int ipass) - { - return m_engst.InputStream(ipass); - } - GrSlotStream * OutputStream(int ipass) - { - return m_engst.OutputStream(ipass); - } - - void UnwindAndReinit(int islotNewBreak); - -public: - int InternalJustificationMode() - { - return m_engst.m_jmodi; - } - - bool ShouldLogJustification() - { - return (m_engst.m_jmodi != kjmodiNormal); - } - - int PrevPassMaxBackup(int ipass) - { - if (ipass == 0) - return 0; - return Pass(ipass - 1)->MaxBackup(); - } - - // Forward to the engine itself - gid16 GetGlyphIDFromUnicode(int nUnicode); - gid16 ActualGlyphForOutput(utf16 chwGlyphID); - GrGlyphTable * GlyphTable(); - - gid16 LBGlyphID(); - - gid16 GetClassGlyphIDAt(int nClass, int nIndex); - int GetIndexInGlyphClass(int nClass, gid16 chwGlyphID); - size_t NumberOfGlyphsInClass(int nClass); - - void SetSlotAttrsFromGlyphAttrs(GrSlotState * pslot); - - int NumFeat(); - int DefaultForFeatureAt(int ifeat); - GrFeature * FeatureWithID(featid nID, int * pifeat); - GrFeature * Feature(int ifeat); - void DefaultsForLanguage(isocode lgcode, - std::vector & vnFeats, std::vector & vnValues); - - bool RightToLeft(); - int TopDirectionLevel(); - - float VerticalOffset(); - - int NumUserDefn(); - int NumCompPerLig(); - - int ComponentIndexForGlyph(gid16 chwGlyphID, int nCompID); - int GlyphAttrValue(gid16 chwGlyphID, int nAttrID); - - // --- - - bool LoggingTransduction(); - - float EmToLogUnits(int m); - int LogToEmUnits(float xys); - bool GPointToXY(gid16 chwGlyphID, int nGPoint, float * xs, float * ys); - - void CalcPositionsUpTo(int ipass, GrSlotState * pslotLast, - float * pxsWidth, float * pxsVisibleWidth); - - void InitPosCache() - { - m_engst.InitPosCache(); - } - - bool IsWhiteSpace(GrSlotState * pslot); - - // For transduction logging: - //bool WriteTransductionLog(GrCharStream * pchstrm, Segment * psegRet, - // int cbPrev, byte * pbPrevSegDat, byte * pbNextSegDat, int * pcbNextSegDat); - //bool WriteAssociationLog(GrCharStream * pchstrm, Segment * psegRet); - bool WriteTransductionLog(std::ostream * pstrmLog, - GrCharStream * pchstrm, Segment * psegRet, int cbPrevSetDat, byte * pbPrevSegDat); - bool WriteAssociationLog(std::ostream * pstrmLog, - GrCharStream * pchstrm, Segment * psegRet); -#ifdef TRACING - void WriteXductnLog(std::ostream & strmOut, GrCharStream * pchstrm, Segment * psegRet, - int cbPrevSegDat, byte * pbPrevSegDat); - //bool LogFileName(std::string & staFile); - void LogUnderlying(std::ostream & strmOut, GrCharStream * pchstrm, int cchwBackup); - void LogPass1Input(std::ostream & strmOut); - void LogPassOutput(std::ostream & strmOut, int ipass, int cslotSkipped); - void LogAttributes(std::ostream & strmOut, int ipass, bool fJustWidths = false); - void LogFinalPositions(std::ostream & strmOut); - void LogUnderlyingHeader(std::ostream & strmOut, int ichwMin, - int ichwLim, int cchwBackup, int * prgichw16bit); - void LogSlotHeader(std::ostream & strmOut, int cslot, - int cspPerSlot, int cspLeading, int islotMin = 0); - void LogSlotGlyphs(std::ostream & strmOut, GrSlotStream * psstrm); - void SlotAttrsModified(int ipass, bool * rgfMods, bool fPreJust, int * pccomp, int *pcassoc); - void LogInTable(std::ostream & strmOut, int n); - void LogInTable(std::ostream & strmOut, float n); - void LogHexInTable(std::ostream & strmOut, gid16 chw, bool fPlus = false); - void LogDirCodeInTable(std::ostream & strmOut, int dirc); - void LogBreakWeightInTable(std::ostream & strmOut, int lb); -#endif // TRACING - -protected: - void InitNewSegment(Segment * psegNew, Font * pfont, GrCharStream * pchstrm, IGrJustifier * pgjus, - int islotStream0Break, int islotSurfaceBreak, bool fStartLine, bool fEndLine, int ichFontLim, - LineBrk lbEnd, SegEnd est, int * dichSegLen); - - void InitSegmentAsEmpty(Segment * psegNew, Font * pfont, GrCharStream * pchstrm, - bool fStartLine, bool fEndLine); - - void InitSegmentToDelete(Segment * psegNew, Font * pfont, GrCharStream * pchstrm); - - int ChunkInPrev(int ipass, int islot, GrCharStream * pchstrm); - - bool Backtrack(int * islotPrevLB, - LineBrk * plbPref, LineBrk lbMax, TrWsHandling, bool fMoreText, - int ichwCallerBtLim, bool fEndLine, LineBrk * plbFound); - - LineBrk IncLineBreak(LineBrk lb); - - void InitializeForNextSeg(Segment* pseg, - int islotStream0Break, int islotSurfaceBreak, LineBrk lbEnd, - bool fNextSegNeedsContext, GrCharStream * pchstrm); - - void RecordAssocsAndOutput(Font * pfont, - Segment * pseg, bool fWidthIsCharCount, - TrWsHandling twsh, bool fParaRtl, int nDirDepth); - - void CalculateAssociations(Segment * pseg, int csloutSurface); - void AdjustAssocsForOverlaps(Segment * pseg); - - void UnstretchTrailingWs(GrSlotStream * psstrm, int iGlyphLim); - void CallJustifier(IGrJustifier * pgjus, int ipassCurr, float dxUnjustified, float dxJustified, - bool fEndLine); - - void DetermineShrink(IGrJustifier * pgjus, int ipass); - -protected: - // Instance variables: - - int m_cpass; // number of passes; zero-th pass is Unicode character -> glyph ID mapping; - // Note thatwe always have one positioning pass to measure things even - // if there are no tables to run. - - int m_cpassLB; // number of line-break passes - int m_ipassPos1; // first positioning pass - int m_ipassJust1; // first justification pass (== m_ipassPos1 if none) - - bool m_fBidi; // is there a bidi pass? - - // array of passes: - GrPass ** m_prgppass; - - // Pointer back to Graphite engine, to give access to global constants and tables. - GrEngine * m_pgreng; - - // State of processing. - EngineState m_engst; - - bool m_fLogging; - -public: - // For test procedures: - void SetUpTest(std::wstring); - -protected: - void TempDebug(); - int SurfaceLineBreakSlot(int ichw, GrCharStream * pchstrm, bool fInitial); - std::wstring ChunkDebugString(int ipass); -}; // end of class GrTableManager - -} // namespace gr - - -#endif // !GR_TABLEMAN_INCLUDED diff --git a/Build/source/libs/graphite/engine-2.3.1/src/segment/Main.h b/Build/source/libs/graphite/engine-2.3.1/src/segment/Main.h deleted file mode 100644 index e3f971bfdbb..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/src/segment/Main.h +++ /dev/null @@ -1,182 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 1999, 2001 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: Main.h -Responsibility: Sharon Correll -Last reviewed: Not yet. - -Description: - Main.header file for the Graphite engine. -----------------------------------------------------------------------------------------------*/ -#ifdef _MSC_VER -#pragma once -#endif -#ifndef GRAPHITE_H -#define GRAPHITE_H 1 - -//:End Ignore - -#define NO_EXCEPTIONS 1 - -// It's okay to use functions that were declared deprecated by VS 2005: -#ifdef _MSC_VER -#define _CRT_SECURE_NO_DEPRECATE -#pragma warning(disable: 4996) // warning: function was declared deprecated -#pragma warning(disable: 4702) // unreachable code -#endif - -#include "GrCommon.h" - -//:>******************************************************************************************** -//:> Interfaces. -//:>******************************************************************************************** -#include "GrData.h" - -//:>******************************************************************************************** -//:> Implementations. -//:>******************************************************************************************** - -#ifndef _WIN32 -#include "GrMstypes.h" -#ifndef HAVE_FABSF -float fabsf(float x); -#endif -#endif -#include "GrDebug.h" - -// For reading the font (FieldWorks's approach) and transduction logging: -#include -#include - -#include -////#include -#include -#include - -// gAssert should be used for any kind of assertions that can be caused by a corrupted font, -// particularly those that won't be caught when loading the tables. -#define gAssert(x) Assert(x) -// When testing the error mechanism (because the process of bringing up the assertion dialog -// interferes with FW repainting the invalid window: -////#define gAssert(x) if (!(x)) Warn("corrupted font?") - -// Internal headers. -#include "FileInput.h" - -// Public headers. -#include "GrResult.h" -//////#include "IGrGraphics.h" -#include "ITextSource.h" -#include "IGrJustifier.h" -#include "IGrEngine.h" -#include "GrConstants.h" -#include "GrFeature.h" - -// External helper classes. -#include "GrExt.h" - - -// Forward declarations. -namespace gr -{ - class GrTableManager; - class Segment; - class GrEngine; -} - -// Define after GrExt.h to avoid conflict with FW Rect class. -namespace gr -{ -/* -struct Point -{ - float x; - float y; - - Point() - { - x = y = 0; - } - - Point(POINT & p) - { - x = (float)p.x; - y = (float)p.y; - } -}; - - -struct Rect -{ - float top; - float bottom; - float left; - float right; - - Rect() - { - top = bottom = left = right = 0; - }; - - Rect(RECT & r) - { - top = (float)r.top; - bottom = (float)r.bottom; - left = (float)r.left; - right = (float)r.right; - }; -}; -*/ -}; // namespace gr - -#include "GrFeatureValues.h" -#include "GrSlotState.h" - -#include "SegmentAux.h" - -// Internal headers -#include "GrCharStream.h" -#include "GrGlyphTable.h" -#include "GrClassTable.h" -#include "GrPseudoMap.h" -#include "GrSlotStream.h" -#include "GrFSM.h" -#include "GrPass.h" -#include "GrTableManager.h" -#include "FontCache.h" - - -// Public headers -#include "Font.h" -#include "GraphiteProcess.h" -#include "GrEngine.h" -#include "FontFace.h" -#include "Segment.h" -#include "SegmentPainter.h" - -//#ifdef _WIN32 -//#include -//#include "WinFont.h" -//#include "WinSegmentPainter.h" -//#endif - -// Internal headers -#include "TtfUtil.h" -//#include "GrUtil.h" - -#include "GrWrappers.h" - -//#include "IGrDebug.h" -//#include "GrSegmentDebug.h" -//#include "GrEngineDebug.h" - -/////<<<<<<< .mine -// clashes with non gr stuff -// using namespace gr; -///////>>>>>>> .r98 - -#endif // GRAPHITE_H - diff --git a/Build/source/libs/graphite/engine-2.3.1/src/segment/Makefile.am b/Build/source/libs/graphite/engine-2.3.1/src/segment/Makefile.am deleted file mode 100644 index 59113aa924b..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/src/segment/Makefile.am +++ /dev/null @@ -1,26 +0,0 @@ -segmentdir = $(top_srcdir)/src/segment - -libgraphite_la_SOURCES += $(segmentdir)/FileInput.cpp -libgraphite_la_SOURCES += $(segmentdir)/FontCache.cpp -libgraphite_la_SOURCES += $(segmentdir)/FontFace.cpp -libgraphite_la_SOURCES += $(segmentdir)/GrCharStream.cpp -libgraphite_la_SOURCES += $(segmentdir)/GrClassTable.cpp -libgraphite_la_SOURCES += $(segmentdir)/GrEngine.cpp -libgraphite_la_SOURCES += $(segmentdir)/GrFeature.cpp -libgraphite_la_SOURCES += $(segmentdir)/GrFSM.cpp -libgraphite_la_SOURCES += $(segmentdir)/GrGlyphTable.cpp -libgraphite_la_SOURCES += $(segmentdir)/GrPassActionCode.cpp -libgraphite_la_SOURCES += $(segmentdir)/GrPass.cpp -libgraphite_la_SOURCES += $(segmentdir)/GrSlotState.cpp -libgraphite_la_SOURCES += $(segmentdir)/GrSlotStream.cpp -libgraphite_la_SOURCES += $(segmentdir)/GrTableManager.cpp -libgraphite_la_SOURCES += $(segmentdir)/MemoryUsage.cpp -libgraphite_la_SOURCES += $(segmentdir)/Platform.cpp -libgraphite_la_SOURCES += $(segmentdir)/SegmentAux.cpp -libgraphite_la_SOURCES += $(segmentdir)/Segment.cpp -libgraphite_la_SOURCES += $(segmentdir)/TestFSM.cpp -libgraphite_la_SOURCES += $(segmentdir)/TestPasses.cpp -libgraphite_la_SOURCES += $(segmentdir)/TransductionLog.cpp - -EXTRA_DIST += $(segmentdir)/*.h - diff --git a/Build/source/libs/graphite/engine-2.3.1/src/segment/MemoryUsage.cpp b/Build/source/libs/graphite/engine-2.3.1/src/segment/MemoryUsage.cpp deleted file mode 100644 index 1fb3fc25282..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/src/segment/MemoryUsage.cpp +++ /dev/null @@ -1,781 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 1999, 2001 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: MemoryUsage.cpp -Responsibility: Sharon Correll -Last reviewed: Not yet. - -Description: - Calculates memory usage for the engine and segments. -----------------------------------------------------------------------------------------------*/ - -#pragma warning(disable: 4244) // conversion from wchar_t to char -#pragma warning(disable: 4702) // unreachable code - -//:>******************************************************************************************** -//:> Include files -//:>******************************************************************************************** - -#include "GrCommon.h" -#include "GrData.h" -#ifndef _WIN32 -#include "GrMstypes.h" -#endif -#include "GrDebug.h" -//#include -#include -#include -//#include -// Forward declarations. - -#include "Main.h" - -//namespace gr -//{ -// class GrTableManager; -// class Segment; -// class GrEngine; -//} -// -//#include "GrTableManager.h" -//#include "GrFeatureValues.h" -//#include "GrSlotState.h" -//#include "SegmentAux.h" -//#include "Segment.h" -#include "MemoryUsage.h" - -//#ifndef _MSC_VER -//#include "config.h" -//#endif - -#ifdef _MSC_VER -#pragma hdrstop -#endif -#undef THIS_FILE -DEFINE_THIS_FILE - -//:End Ignore - -//:>******************************************************************************************** -//:> Forward declarations -//:>******************************************************************************************** - -//:>******************************************************************************************** -//:> Local Constants and static variables -//:>******************************************************************************************** - -const int stringOverhead = (3 * sizeof(int)) + (sizeof(void *)) + (8 * sizeof(short)); -const int vectorOverhead = 3 * sizeof(void *); - -namespace gr -{ - -//:>******************************************************************************************** -//:> Font/engine -//:>******************************************************************************************** - -void FontMemoryUsage::initialize() -{ - font = 0; - fontCache = 0; - fontFace = 0; - - eng_count = 0; - eng_overhead = 0; - eng_scalars = 0; - eng_strings = 0; - eng_pointers = 0; - eng_cmap = 0; - eng_nameTable = 0; - - pseudoMap = 0; - - clstbl_counters = 0; - clstbl_offsets = 0; - clstbl_glyphList = 0; - - glftbl_general = 0; - glftbl_compDefns = 0; - glftbl_attrTable = 0; - glftbl_attrOffsets = 0; - - lngtbl_general = 0; - lngtbl_entries = 0; - lngtbl_featureSets = 0; - - tman_general = 0; - - pass_count = 0; - pass_general = 0; - pass_fsm = 0; - pass_ruleExtras = 0; - pass_constraintOffsets = 0; - pass_constraintCode = 0; - pass_actionOffsets = 0; - pass_actionCode = 0; - - engst_general = 0; - engst_passState = 0; - - sstrm_count = 0; - sstrm_general = 0; - sstrm_chunkMapsUsed = 0; - sstrm_chunkMapsAlloc = 0; - sstrm_reprocBuf = 0; - - slot_count = 0; - slot_general = 0; - slot_abstract = 0; - slot_varLenBuf = 0; - slot_assocsUsed = 0; - slot_assocsAlloc = 0; - slot_attachUsed = 0; - slot_attachAlloc = 0; -} - -/*---------------------------------------------------------------------------------------------- - Return the total byte count. -----------------------------------------------------------------------------------------------*/ -int FontMemoryUsage::total() -{ - int grandTotal = 0; - grandTotal += font + fontCache + fontFace; - grandTotal += eng_overhead + eng_scalars + eng_strings + eng_pointers + eng_cmap + eng_nameTable; - grandTotal += pseudoMap; - grandTotal += clstbl_counters + clstbl_offsets + clstbl_glyphList; - grandTotal += glftbl_general + glftbl_compDefns + glftbl_attrTable + glftbl_attrOffsets; - grandTotal += lngtbl_general + lngtbl_entries + lngtbl_featureSets; - grandTotal += tman_general; - grandTotal += pass_general + pass_fsm + pass_ruleExtras - + pass_constraintOffsets + pass_constraintCode + pass_actionOffsets + pass_actionCode; - grandTotal += engst_general + engst_passState; - grandTotal += sstrm_general + sstrm_chunkMapsAlloc + sstrm_reprocBuf; - grandTotal += slot_general + slot_abstract + slot_varLenBuf + slot_assocsAlloc + slot_attachAlloc; - - return grandTotal; -} - -/*---------------------------------------------------------------------------------------------- - Add the results of two runs together. -----------------------------------------------------------------------------------------------*/ -void FontMemoryUsage::add(FontMemoryUsage & fmu) -{ - font += fmu.font; - fontCache += fmu.fontCache; - fontFace += fmu.fontFace; - - eng_count += fmu.eng_count; - eng_overhead += fmu.eng_overhead; - eng_scalars += fmu.eng_scalars; - eng_strings += fmu.eng_strings; - eng_pointers += fmu.eng_pointers; - eng_cmap += fmu.eng_cmap; - eng_nameTable += fmu.eng_nameTable; - - pseudoMap += fmu.pseudoMap; - - clstbl_counters += fmu.clstbl_counters; - clstbl_offsets += fmu.clstbl_offsets; - clstbl_glyphList += fmu.clstbl_glyphList; - - glftbl_general += fmu.glftbl_general; - glftbl_compDefns += fmu.glftbl_compDefns; - glftbl_attrTable += fmu.glftbl_attrTable; - glftbl_attrOffsets += fmu.glftbl_attrOffsets; - - lngtbl_general += fmu.lngtbl_general; - lngtbl_entries += fmu.lngtbl_entries; - lngtbl_featureSets += fmu.lngtbl_featureSets; - - tman_general += fmu.tman_general; - - pass_count += fmu.pass_count; - pass_general += fmu.pass_general; - pass_fsm += fmu.pass_fsm; - pass_ruleExtras += fmu.pass_ruleExtras; - pass_constraintOffsets += fmu.pass_constraintOffsets; - pass_constraintCode += fmu.pass_constraintCode; - pass_actionOffsets += fmu.pass_actionOffsets; - pass_actionCode += fmu.pass_actionCode; - - engst_general += fmu.engst_general; - engst_passState += fmu.engst_passState; - - sstrm_count += fmu.sstrm_count; - sstrm_general += fmu.sstrm_general; - sstrm_chunkMapsUsed += fmu.sstrm_chunkMapsUsed; - sstrm_chunkMapsAlloc += fmu.sstrm_chunkMapsAlloc; - sstrm_reprocBuf += fmu.sstrm_reprocBuf; - - slot_count += fmu.slot_count; - slot_general += fmu.slot_general; - slot_abstract += fmu.slot_abstract; - slot_varLenBuf += fmu.slot_varLenBuf; - slot_assocsUsed += fmu.slot_assocsUsed; - slot_assocsAlloc += fmu.slot_assocsAlloc; - slot_attachUsed += fmu.slot_attachUsed; - slot_attachAlloc += fmu.slot_attachAlloc; -} - -/*---------------------------------------------------------------------------------------------- - Add up the memory used by all the engines in the cache. -----------------------------------------------------------------------------------------------*/ -FontMemoryUsage Font::calculateMemoryUsage() -{ - FontMemoryUsage fmu; - FontFace::calculateAllMemoryUsage(fmu); - return fmu; -} - -void FontFace::calculateAllMemoryUsage(FontMemoryUsage & fmu) -{ - s_pFontCache->calculateMemoryUsage(fmu); -} - -void FontCache::calculateMemoryUsage(FontMemoryUsage & fmuTotal) -{ - fmuTotal.fontCache += sizeof(int) * 4; // m_cfci, m_cfciMax, m_cfface, m_flush - fmuTotal.fontCache += sizeof(void*); // m_prgfci; - - // Iterate through all the font faces in the cache. - for (int ifci = 0; ifci < m_cfci; ifci++) - { - CacheItem * pfci = m_prgfci + ifci; - char rgchFontName[32]; - memset(rgchFontName, 0, 32 * sizeof(char)); - std::copy(pfci->szFaceName, pfci->szFaceName + 32, rgchFontName); - std::string strFontName(rgchFontName); - fmuTotal.vstrFontNames.push_back(strFontName); - int cface = 0; - if (pfci->pffaceRegular) - { - FontMemoryUsage fmu; - pfci->pffaceRegular->calculateMemoryUsage(fmu); - fmuTotal.add(fmu); - fmuTotal.vFontTotalsReg.push_back(fmu.total()); - cface++; - } - else - fmuTotal.vFontTotalsReg.push_back(0); - - if (pfci->pffaceBold) - { - FontMemoryUsage fmu; - pfci->pffaceBold->calculateMemoryUsage(fmu); - fmuTotal.add(fmu); - fmuTotal.vFontTotalsBold.push_back(fmu.total()); - cface++; - } - else - fmuTotal.vFontTotalsBold.push_back(0); - - if (pfci->pffaceItalic) - { - FontMemoryUsage fmu; - pfci->pffaceItalic->calculateMemoryUsage(fmu); - fmuTotal.add(fmu); - fmuTotal.vFontTotalsItalic.push_back(fmu.total()); - cface++; - } - else - fmuTotal.vFontTotalsItalic.push_back(0); - - if (pfci->pffaceBI) - { - FontMemoryUsage fmu; - pfci->pffaceBI->calculateMemoryUsage(fmu); - fmuTotal.add(fmu); - fmuTotal.vFontTotalsBI.push_back(fmu.total()); - cface++; - } - else - fmuTotal.vFontTotalsBI.push_back(0); - - fmuTotal.vFaceCount.push_back(cface); - } -} - -void FontFace::calculateMemoryUsage(FontMemoryUsage & fmu) -{ - fmu.fontFace += sizeof(int); // m_cfonts - fmu.fontFace += sizeof(void *) * 2; // s_pFontCache, m_pgreng - - fmu.font += m_cfonts * sizeof(void*); // m_pfface - - fmu.addEngine(m_pgreng); -} - -void FontMemoryUsage::addEngine(GrEngine * pgreng) -{ - eng_count++; - - eng_overhead += sizeof(long); // m_cref - eng_scalars += sizeof(bool) * 6; // m_fBold, m_fItalic, m_fSmart... - eng_scalars += sizeof(bool) * 2; // m_fFakeItalicCache, m_fFakeBICache; - eng_strings += stringOverhead * 4; // m_strCtrlFileReg/Bold/Italic/BI - eng_strings += sizeof(wchar_t) * pgreng->m_strCtrlFileReg.length(); - eng_strings += sizeof(wchar_t) * pgreng->m_strCtrlFileBold.length(); - eng_strings += sizeof(wchar_t) * pgreng->m_strCtrlFileItalic.length(); - eng_strings += sizeof(wchar_t) * pgreng->m_strCtrlFileBI.length(); - eng_scalars += sizeof(bool); - eng_strings += stringOverhead * 6; // m_stuCtrlFile etc. - eng_strings += sizeof(wchar_t) * pgreng->m_stuCtrlFile.length(); - eng_strings += sizeof(wchar_t) * pgreng->m_stuInitError.length(); - eng_strings += sizeof(wchar_t) * pgreng->m_stuFaceName.length(); - eng_strings += sizeof(wchar_t) * pgreng->m_stuFeatures.length(); - eng_strings += sizeof(wchar_t) * pgreng->m_stuBaseFaceName.length(); - eng_scalars += sizeof(bool); // m_fUseSepBase - eng_scalars += sizeof(GrResult) * 2; // m_resFontRead, m_resFontValid - eng_scalars += sizeof(FontErrorCode); - eng_scalars += sizeof(int) * 3; // m_fxdBadVersion, m_nFontCheckSum, m_nScriptTag, m_grfsdc - eng_scalars += sizeof(bool); // m_fRightToLeft - eng_scalars += sizeof(int) * 2; // m_mXAscent, m_mXDescent - eng_scalars += sizeof(float); // m_dysOffset - eng_scalars += sizeof(bool); // m_fBasicJust - eng_scalars += sizeof(int); // m_cJLevels - eng_pointers += sizeof(void*) * 4; // m_ptman, m_pctbl, m_pgtbl, m_pfface - eng_scalars += sizeof(GrFeature) * kMaxFeatures; - eng_scalars += sizeof(int); // m_cfeat - eng_scalars += sizeof(size_t); // m_clcidFeatLabelLangs - eng_scalars += sizeof(short) * pgreng->m_clcidFeatLabelLangs; - // m_langtbl - eng_scalars += sizeof(bool); // m_fLineBreak - eng_scalars += sizeof(int) * 2; // m_cchwPreXlbContext, m_cchwPostXlbContext - eng_scalars += sizeof(data16) * 7; // m_chwPseudoAttr, etc. - eng_scalars += sizeof(gid16); // m_chwLBGlyphID - eng_scalars += sizeof(int) * 4; // m_cComponents, m_cnUserDefn, m_cnCompPerLig, m_mFontEmUnits - - pseudoMap += sizeof(int) * 3; - pseudoMap += sizeof(GrPseudoMap) * pgreng->m_cpsd; - - eng_cmap += sizeof(void*) * 2; - eng_cmap += sizeof(byte*); - eng_cmap += sizeof(bool); - if (pgreng->m_fCmapTblCopy) - eng_cmap += pgreng->m_cbCmapTbl; - - eng_nameTable += sizeof(byte *); - eng_nameTable += sizeof(bool); - if (pgreng->m_fNameTblCopy) - eng_nameTable += pgreng->m_cbNameTbl; - - eng_scalars += sizeof(bool) * 2; // m_fLogXductn, m_fInErrorState - - clstbl_counters += sizeof(int) * 2; // m_ccls, m_cclsLinear - clstbl_offsets += sizeof(data16) * (pgreng->m_pctbl->m_ccls + 1); - clstbl_glyphList += sizeof(data16) * (pgreng->m_pctbl->m_prgichwOffsets[pgreng->m_pctbl->m_ccls]); - - glftbl_general += sizeof(int) * 3; // m_cglf, m_cComponents, m_cgstbl - glftbl_general += vectorOverhead; // m_vpgstbl - GrGlyphSubTable * pgstbl = pgreng->m_pgtbl->m_vpgstbl[0]; - glftbl_general += sizeof(int) * 4; // m_fxdSilfVersion, m_nAttrIDLim, m_cComponents, m_cnCompPerLig - glftbl_general += sizeof(bool) * 2; // m_fHasDebugStrings, m_fGlocShort - glftbl_general += sizeof(data16) * 3; // m_chw...Attr - glftbl_compDefns += sizeof(int) * (pgstbl->m_cnCompPerLig + 1) * pgreng->m_pgtbl->m_cglf; - glftbl_attrTable += sizeof(int) * 2; // m_fxdSilfVersion, m_cbEntryBufLen - glftbl_attrTable += sizeof(byte) * pgstbl->m_pgatbl->m_cbEntryBufLen; - glftbl_attrOffsets += - (pgreng->m_pgtbl->m_cglf + 1) * ((pgstbl->m_fGlocShort) ? sizeof(data16) : sizeof(data32)); - - lngtbl_general += sizeof(size_t); // m_clang - lngtbl_general += sizeof(data16) * 3; // m_dilangInit, m_cLoop, m_ilangStart - lngtbl_general += sizeof(void*) * 2; // m_prglang, m_prgfset - lngtbl_general += sizeof(int); // m_cbOffset0 - lngtbl_entries += sizeof(GrLangTable::LangEntry) * pgreng->m_langtbl.m_clang; - lngtbl_featureSets += sizeof(GrLangTable::FeatSet) * pgreng->m_langtbl.m_cfset; - - GrTableManager * ptman = pgreng->m_ptman; - tman_general += sizeof(int) * 4; // m_cpass, m_cpassLB, m_ipassPos1, m_ipassJust1 - tman_general += sizeof(bool); // m_fBidi - tman_general += sizeof(void*) * 2; // m_prgppass, m_pgreng - tman_general += sizeof(void*) * ptman->m_cpass; // m_prgppass - tman_general += sizeof(bool); // m_fLogging - - pass_count += ptman->m_cpass; - for (int ipass = 0; ipass < ptman->m_cpass; ipass++) - { - GrPass * ppass = ptman->m_prgppass[ipass]; - pass_general = sizeof(GrPass); - - GrFSM * pfsm = ppass->m_pfsm; - if (pfsm) - { - pass_fsm += sizeof(int) * 5; // m_crow, m_crowFinal, m_rowFinalMin, m_crowNonAcpt, m_ccol - pass_fsm += sizeof(void*) * 3; // m_prgirulnMin, m_prgrulnMatched, m_prgrowTransitions - int crowSuccess = pfsm->m_crow - pfsm->m_crowNonAcpt; - pass_fsm += sizeof(data16) * (crowSuccess + 1); // m_prgirulnMin - pass_fsm += sizeof(data16) * (pfsm->m_crulnMatched); // m_prgrulnMatched - pass_fsm += sizeof(short) * ((pfsm->m_crow - pfsm->m_crowFinal) * pfsm->m_ccol); - pass_fsm += sizeof(data16); // m_dimcrInit, m_cLoop, m_imcrStart - pass_fsm += sizeof(int); // m_cmcr - pass_fsm += sizeof(void*); // m_prgmcr - pass_fsm += sizeof(GrFSMClassRange) * pfsm->m_cmcr; - pass_fsm += sizeof(int) * 2; // m_critMinRulePreContext, m_critMaxRulePreContext - pass_fsm += sizeof(void*); // m_prgrowStartStates - pass_fsm += sizeof(short) * (pfsm->m_critMaxRulePreContext - pfsm->m_critMinRulePreContext + 1); - } - - pass_ruleExtras = sizeof(data16) * ppass->m_crul; // m_prgchwRuleSortKeys - pass_ruleExtras = sizeof(byte*) * ppass->m_crul; // m_prgcritRulePreModContext - - pass_constraintOffsets += sizeof(data16) * (ppass->m_crul + 1); - pass_actionOffsets =+ sizeof(data16) * (ppass->m_crul + 1); - - pass_constraintCode += sizeof(byte) * ppass->m_cbConstraints; - pass_actionCode += sizeof(byte) * ppass->m_cbActions; - - pass_general += sizeof(bool) * ppass->m_crul; // m_prgfRuleOkay - pass_general += vectorOverhead; // m_vnStack - pass_general += sizeof(int) * ppass->m_vnStack.capacity(); - } - - engst_general += sizeof(EngineState); - engst_general += sizeof(void *) * ptman->m_engst.m_vslotblk.capacity(); - engst_general += sizeof(void *) * ptman->m_engst.m_vprgnSlotVarLenBufs.capacity(); - engst_general += sizeof(void *) * ptman->m_engst.m_cpass; // m_prgpsstrm - - engst_passState += sizeof(PassState) * ptman->m_engst.m_cpass; - - for (int isstrm = 0; isstrm < ptman->m_engst.m_cpass; isstrm++) - { - sstrm_count++; - GrSlotStream * psstrm = ptman->m_engst.m_prgpsstrm[isstrm]; - sstrm_general += sizeof(GrSlotStream); - sstrm_chunkMapsUsed += psstrm->m_vislotPrevChunkMap.size(); - sstrm_chunkMapsUsed += psstrm->m_vislotPrevChunkMap.size(); - sstrm_chunkMapsAlloc += psstrm->m_vislotPrevChunkMap.capacity(); - sstrm_chunkMapsAlloc += psstrm->m_vislotNextChunkMap.capacity(); - sstrm_reprocBuf += psstrm->m_vpslotReproc.capacity(); - sstrm_reprocBuf += sizeof(int) * 2; - sstrm_general -= sizeof(int) * 2; - } - - slot_general += ptman->m_engst.m_vslotblk.size() * EngineState::kSlotBlockSize - * (sizeof(GrSlotState) - sizeof(GrSlotAbstract)); - slot_abstract += ptman->m_engst.m_vslotblk.size() * EngineState::kSlotBlockSize - * sizeof(GrSlotAbstract); - int cnExtraPerSlot = ptman->m_engst.m_cUserDefn + (ptman->m_engst.m_cCompPerLig * 2) - + ptman->m_engst.m_cFeat; - slot_varLenBuf += EngineState::kSlotBlockSize * cnExtraPerSlot * sizeof(u_intslot); - for (size_t islotblk = 0; islotblk < ptman->m_engst.m_vslotblk.size(); islotblk++) - { - for (int islot = 0; islot < EngineState::kSlotBlockSize; islot++) - { - slot_count++; - GrSlotState * pslot = ptman->m_engst.m_vslotblk[islotblk] + islot; - slot_assocsUsed += pslot->m_vpslotAssoc.size(); - slot_assocsAlloc += pslot->m_vpslotAssoc.capacity(); - slot_attachUsed += pslot->m_vdislotAttLeaves.size(); - slot_attachAlloc += pslot->m_vdislotAttLeaves.capacity(); - } - } - -} - -/*---------------------------------------------------------------------------------------------- - Write out the memory usage onto a stream. -----------------------------------------------------------------------------------------------*/ -void FontMemoryUsage::prettyPrint(std::ostream & strm) -{ - int totalBytes = total(); - - strm << "Number of engines: " << eng_count << "\n"; - strm << "Number of passes: " << pass_count << "\n\n"; - - strm << "Number of slot streams: " << sstrm_count << "\n"; - strm << "Number of slots: " << slot_count << "\n\n"; - - int classTableTotal = clstbl_counters + clstbl_offsets + clstbl_glyphList; - int glyphTableTotal = glftbl_general + glftbl_compDefns + glftbl_attrTable + glftbl_attrOffsets; - int langTableTotal = lngtbl_general + lngtbl_entries + lngtbl_featureSets; - int passTotal = pass_general + pass_fsm + pass_ruleExtras + pass_constraintOffsets + pass_constraintCode - + pass_actionOffsets + pass_actionCode; - int engineTotal = eng_overhead + eng_scalars + eng_strings + eng_pointers + eng_cmap + eng_nameTable - + pseudoMap + classTableTotal + glyphTableTotal + langTableTotal + tman_general - + passTotal; - - strm << "BYTE COUNT TOTALS\n"; - strm << "Font: " << font << "\n"; - strm << "Font cache: " << fontCache << "\n"; - strm << "Font face: " << fontFace << "\n"; - strm << "Engine " << engineTotal << "\n"; - strm << " Overhead: " << eng_overhead << "\n"; - strm << " Scalars: " << eng_scalars << "\n"; - strm << " Strings: " << eng_strings << "\n"; - strm << " Pointers: " << eng_pointers << "\n"; - strm << " Cmap table: " << eng_cmap << "\n"; - strm << " Name table: " << eng_nameTable << "\n"; - strm << " Pseudo map: " << pseudoMap << "\n"; - strm << " Class table: " << classTableTotal << "\n"; - strm << " Counters: " << clstbl_counters << "\n"; - strm << " Offsets: " << clstbl_offsets << "\n"; - strm << " Glyph list: " << clstbl_glyphList << "\n"; - strm << " Glyph table: " << glyphTableTotal << "\n"; - strm << " General: " << glftbl_general << "\n"; - strm << " Component defns: " << glftbl_compDefns << "\n"; - strm << " Attr table: " << glftbl_attrTable << "\n"; - strm << " Attr offsets: " << glftbl_attrOffsets << "\n"; - strm << " Language table: " << langTableTotal << "\n"; - strm << " General: " << lngtbl_general << "\n"; - strm << " Entries: " << lngtbl_entries << "\n"; - strm << " Feature sets: " << lngtbl_featureSets << "\n"; - strm << " Table manager: " << tman_general << "\n"; - strm << " Passes: " << passTotal << "\n"; - strm << " General: " << pass_general << "\n"; - strm << " FSM: " << pass_fsm << "\n"; - strm << " Rule extras: " << pass_ruleExtras << "\n"; - strm << " Constraint offsets: " << pass_constraintOffsets << "\n\n"; - strm << " Constraint code: " << pass_constraintCode << "\n"; - strm << " Action offsets: " << pass_actionOffsets << "\n"; - strm << " Action code: " << pass_actionCode << "\n\n"; - - int slotTotal = slot_general + slot_abstract + slot_varLenBuf + slot_assocsAlloc + slot_attachAlloc; - int streamTotal = sstrm_general + sstrm_chunkMapsAlloc + sstrm_reprocBuf + slotTotal; - int engineStateTotal = engst_general + engst_passState + streamTotal; - - strm << " Engine State: " << engineStateTotal << "\n"; - strm << " General: " << engst_general << "\n"; - strm << " Pass states: " << engst_passState << "\n"; - strm << " Slot streams: " << streamTotal << "\n"; - strm << " General: " << sstrm_general << "\n"; - strm << " Chunk maps: " << sstrm_chunkMapsAlloc << " (" << sstrm_chunkMapsUsed << " used)\n"; - strm << " Reprocess buffer: " << sstrm_reprocBuf << "\n"; - strm << " Slots: " << slotTotal << "\n"; - strm << " General: " << slot_general << "\n"; - strm << " Abstract: " << slot_abstract << "\n"; - strm << " Var-length buf: " << slot_varLenBuf << "\n"; - strm << " Associations: " << slot_assocsAlloc << " (" << slot_assocsUsed << " used)\n"; - strm << " Attachments: " << slot_attachAlloc << " (" << slot_attachUsed << " used)\n\n"; - - strm << "Total bytes used: " << totalBytes << "\n\n"; - - strm << "TOTALS PER FONT\n"; - for (size_t ifont = 0; ifont < vstrFontNames.size(); ifont++) - { - strm << vstrFontNames[ifont].c_str() << "\n"; - strm << " Regular: " << vFontTotalsReg[ifont] << "\n"; - strm << " Bold: " << vFontTotalsBold[ifont] << "\n"; - strm << " Italic: " << vFontTotalsItalic[ifont] << "\n"; - strm << " Bold-italic: " << vFontTotalsBI[ifont] << "\n\n"; - } -} - - -//:>******************************************************************************************** -//:> Segment -//:>******************************************************************************************** - -/*---------------------------------------------------------------------------------------------- - Initialize the data structure. -----------------------------------------------------------------------------------------------*/ -void SegmentMemoryUsage::initialize() -{ - seg_count = 0; - overhead = 0; - pointers = 0; - scalars = 0; - strings = 0; - metrics = 0; - associations = 0; - init = 0; - obsolete = 0; - - slot_count = 0; - slot_abstract = 0; - slot_varLenBuf = 0; - slot_scalars = 0; - slot_clusterMembers = 0; - - glyphInfo_count = 0; - glyphInfo = 0; - - wastedVector = 0; -} - -/*---------------------------------------------------------------------------------------------- - Add the memory for the segemtn to the SegmentMemoryUsage data structure. -----------------------------------------------------------------------------------------------*/ -void Segment::calculateMemoryUsage(SegmentMemoryUsage & smu) -{ - smu.addSegment(*this); -} - - -void SegmentMemoryUsage::addSegment(Segment & seg) -{ - seg_count++; - - overhead += sizeof(long); // m_cref - pointers += sizeof(void*); // m_pgts - scalars += sizeof(int); // m_dichwLim - scalars += sizeof(int); // m_ichwMin - pointers += sizeof(void*); // m_pfont - pointers += sizeof(void*); // m_preneng - scalars += sizeof(bool); // m_fErroneous - pointers += sizeof(void*); // m_pgjus - scalars += sizeof(LayoutEnvironment); - scalars += sizeof(bool); // m_fWsRtl - scalars += sizeof(bool); // m_fParaRtl - scalars += sizeof(TrWsHandling); - scalars += sizeof(int); // m_nDirDepth - init += sizeof(byte*); // m_prgbNextSegDat - init += sizeof(int); // m_cbNextSegDat - init += sizeof(byte) * seg.m_cbNextSegDat; - init += sizeof(byte*); // m_prgInitDat - init += sizeof(int); // m_cbInitDat - init += sizeof(byte) * seg.m_cbInitDat; - init += sizeof(int); // m_dichPreContext -// obsolete += sizeof(void *); // m_psegPrev -// obsolete += sizeof(void *); // m_psegNext -// strings += stringOverhead * 2; -// strings += sizeof(wchar_t) * seg.m_stuFaceName.length(); -// strings += sizeof(wchar_t) * seg.m_stuBaseFaceName.length(); -// scalars += sizeof(bool); // m_fUseSepBase; -// scalars += sizeof(float); // m_pixHeight -// scalars += sizeof(bool); // m_fBold -// scalars += sizeof(bool); // m_fItalic - scalars += sizeof(LineBrk); // m_lbStart - scalars += sizeof(LineBrk); // m_lbEnd - scalars += sizeof(bool); // m_fStartLine - scalars += sizeof(bool); // m_fEndLine - scalars += sizeof(SegEnd); // m_est - metrics += sizeof(int); // m_mFontEmUnits - metrics += sizeof(float) * 17; // was 19, removed m_x/ysDPI - associations += sizeof(int); // m_ichwAssocsMin - associations += sizeof(int); // m_ichwAssocsLim - int dichw = seg.m_ichwAssocsLim - seg.m_ichwAssocsMin; - associations += sizeof(int*); // m_prgisloutBefore - associations += sizeof(int) * dichw; - associations += sizeof(int*); // m_prgisloutAfter - associations += sizeof(int) * dichw; - associations += sizeof(void*); // m_prgpvisloutAssocs - associations += sizeof(void*) * dichw; - for (int idichw = 0; idichw < dichw; idichw++) - { - std::vector * pvisloutAssocs = seg.m_prgpvisloutAssocs[idichw]; - if (pvisloutAssocs) - { - associations += vectorOverhead; - associations += sizeof(int) * pvisloutAssocs->capacity(); - wastedVector += sizeof(int) * (pvisloutAssocs->capacity() - pvisloutAssocs->size()); - } - } - associations += sizeof(int*); // m_prgisloutLigature - associations += sizeof(int) * dichw; - associations += sizeof(sdata8*); // m_prgiComponent - associations += sizeof(sdata8) * dichw; -// obsolete += sizeof(void*); // m_psstrm - scalars += sizeof(int); // m_cslout - slot_count += seg.m_cslout; - for (int islout = 0; islout < seg.m_cslout; islout++) - { - GrSlotOutput * pslout = seg.m_prgslout + islout; - slot_abstract += sizeof(gid16) * 2; // m_chwGlyphID, m_chwActual - slot_abstract += sizeof(sdata8) * 4; // m_spsl, m_dirc, m_lb, m_nDirLevel -// slot_abstract += sizeof(float) * 8; // font/glyph metrics - slot_abstract += sizeof(short) * 5; // slot attributes - was 21 - slot_abstract += sizeof(int); // m_mJWidth0; - slot_abstract += sizeof(byte); // m_nJWeight0; - slot_abstract += sizeof(bool); // m_fInsertBefore - slot_abstract += sizeof(sdata8); // m_bIsSpace - slot_abstract += sizeof(byte); // m_cnCompPerLig - slot_abstract += sizeof(void*); // m_prgnVarLenBuf - slot_varLenBuf += pslout->CExtraSpaceSlout() * sizeof(u_intslot); - slot_abstract += sizeof(float); // m_xsPositionX, m_ysPositionY -// slot_abstract += sizeof(bool); // m_fAdvXSet, m_fAdvYSet - slot_scalars += sizeof(int) * 2; // m_ichwBefore/AfterAssoc - slot_scalars += sizeof(sdata8); // m_cComponents - slot_scalars += sizeof(int); // m_isloutClusterBase - slot_scalars += sizeof(sdata8); // m_disloutCluster - slot_scalars += sizeof(float) * 3; // m_xsClusterXOffset, m_xsClusterAdvance, m_xsAdvanceX - slot_scalars += sizeof(int); // m_igbb -// slot_scalars += sizeof(Rect); // m_rectBB - } - scalars += sizeof(int); // m_cnUserDefn - scalars += sizeof(int); // m_cnCompPerLig - scalars += sizeof(int); // m_cnFeat - glyphInfo_count += seg.m_cginf; - scalars += sizeof(int); // m_cginf; - scalars += sizeof(int); // m_isloutGinf0 - for (int iginf = 0; iginf < seg.m_cginf; iginf++) - { - ///GlyphInfo * pginf = seg.m_prgginf + iginf; - glyphInfo += sizeof(void *); // m_pseg - glyphInfo += sizeof(void *); // m_pslout - glyphInfo += sizeof(int); // m_islout - } - init += sizeof(int); // m_cslotRestartBackup - init += vectorOverhead; - init += sizeof(sdata8) * seg.m_vnSkipOffsets.capacity(); - wastedVector += sizeof(sdata8) * (seg.m_vnSkipOffsets.capacity() - seg.m_vnSkipOffsets.size()); - init += sizeof(DirCode); // m_dircPrevStrong - init += sizeof(DirCode); // m_dircPrevTerm - - //int grandTotal; - //grandTotal = overhead + pointers + scalars + strings + metrics + associations - // + init + obsolete + slot_count + slot_abstract + slot_varLenBuf + slot_scalars - // + slot_clusterMembers + glyphInfo_count + glyphInfo; - - //int totalPerSeg = grandTotal / seg_count; -} - -/*---------------------------------------------------------------------------------------------- - Write out the memory usage onto a stream. -----------------------------------------------------------------------------------------------*/ -void SegmentMemoryUsage::prettyPrint(std::ostream & strm) -{ - int totalBytes = overhead + pointers + scalars + strings + metrics + associations - + init + obsolete + slot_count + slot_abstract + slot_varLenBuf + slot_scalars - + slot_clusterMembers + glyphInfo_count + glyphInfo; - - int slotTotal = slot_abstract + slot_varLenBuf + slot_scalars + slot_clusterMembers; - - strm << "Number of segments: " << seg_count << "\n\n"; - - strm << "TOTALS\n"; - strm << "Overhead: " << overhead << "\n"; - strm << "Pointers: " << pointers << "\n"; - strm << "Scalars: " << scalars << "\n"; - strm << "Strings: " << strings << "\n"; - strm << "Metrics: " << metrics << "\n"; - strm << "Associations: " << associations << "\n"; - strm << "Obsolete: " << obsolete << "\n"; - strm << "Slot data: " << slotTotal << "\n"; - strm << " Abstract: " << slot_abstract << "\n"; - strm << " Var-length buffer: " << slot_varLenBuf << "\n"; - strm << " Scalars: " << slot_scalars << "\n"; - strm << " Cluster members: " << slot_clusterMembers << "\n"; - strm << "Glyph info: " << glyphInfo << "\n\n"; - - strm << "Wasted in vectors: " << wastedVector << "\n\n"; - - strm << "Total bytes used: " << totalBytes << "\n\n"; - - if (seg_count > 0) - { - strm << "AVERAGES\n"; - strm << "Overhead: " << overhead/seg_count << "\n"; - strm << "Pointers: " << pointers/seg_count << "\n"; - strm << "Scalars: " << scalars/seg_count << "\n"; - strm << "Strings: " << strings/seg_count << "\n"; - strm << "Metrics: " << metrics/seg_count << "\n"; - strm << "Associations: " << associations/seg_count << "\n"; - strm << "Obsolete: " << obsolete/seg_count << "\n"; - strm << "Slot data: " << slotTotal/seg_count << "\n"; - strm << " Abstract: " << slot_abstract/seg_count << "\n"; - strm << " Var-length buffer: " << slot_varLenBuf/seg_count << "\n"; - strm << " Scalars: " << slot_scalars/seg_count << "\n"; - strm << " Cluster members: " << slot_clusterMembers/seg_count << "\n"; - strm << "Glyph info: " << glyphInfo/seg_count << "\n\n"; - - strm << "Avg. bytes per segment: " << totalBytes / seg_count << "\n\n"; - - strm << "Avg. # of slots per segment: " << slot_count / seg_count << "\n\n"; - } -} - -} //namespace gr - diff --git a/Build/source/libs/graphite/engine-2.3.1/src/segment/Platform.cpp b/Build/source/libs/graphite/engine-2.3.1/src/segment/Platform.cpp deleted file mode 100644 index 30ec3f4bf1f..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/src/segment/Platform.cpp +++ /dev/null @@ -1,113 +0,0 @@ -#include "GrPlatform.h" - -#ifdef _WIN32 -#include "windows.h" - -namespace gr -{ - -size_t Platform_UnicodeToANSI(const utf16 * prgchwSrc, size_t cchwSrc, char * prgchsDst, size_t cchsDst) -{ - return ::WideCharToMultiByte(CP_ACP, 0, (LPCWSTR)prgchwSrc, cchwSrc, prgchsDst, cchsDst, NULL, NULL); -} - -size_t Platform_AnsiToUnicode(const char * prgchsSrc, size_t cchsSrc, utf16 * prgchwDst, size_t cchwDst) -{ - return ::MultiByteToWideChar(CP_ACP, 0, prgchsSrc, cchsSrc, (LPWSTR)prgchwDst, cchwDst); -} - -size_t Platform_8bitToUnicode(int nCodePage, const char * prgchsSrc, int cchsSrc, - utf16 * prgchwDst, int cchwDst) -{ - return ::MultiByteToWideChar(nCodePage, 0, prgchsSrc, cchsSrc, (LPWSTR)prgchwDst, cchwDst); -} - -size_t utf8len(const char *s) -{ - return mbstowcs(NULL,s,0); -} - -utf16 *utf16cpy(utf16 *dest, const utf16 *src) -{ - return (utf16*)wcscpy((wchar_t*)dest, (const wchar_t*)src); -} - -utf16 *utf16ncpy(utf16 *dest, const utf16 *src, size_t n) -{ - return (utf16*)wcsncpy((wchar_t*)dest, (const wchar_t*)src, n); -} - -utf16 *utf16ncpy(utf16 *dest, const char *src, size_t n) -{ - #ifdef UTF16DEBUG - std::cerr << "utf16ncpy8: " << src << std::endl; - #endif - Platform_AnsiToUnicode(src, strlen(src), dest, n); - return dest; -} - - -size_t utf16len(const utf16 *s) -{ - return wcslen((const wchar_t*)s); -} - -int utf16cmp(const utf16 *s1, const utf16 *s2) -{ -return wcscmp((const wchar_t*)s1, (const wchar_t*)s2); -} - -int utf16ncmp(const utf16 *s1, const utf16 *s2, size_t n) -{ - return wcsncmp((const wchar_t*)s1, (const wchar_t*)s2, n); -} - -int utf16cmp(const utf16 *s1, const char *s2) -{ - while (*s1 && s2) - { - if (*s1 < *s2) - { - return -1; - } - if (*s1 > *s2) - { - return 1; - } - *s1++; - *s2++; - } - if (*s1) return -1; - else if (*s2) return 1; - return 0; -} - -} -#else // not _WIN32 - -#include -#include -#include - -#ifndef HAVE_FABSF -float fabsf(float x) -{ - return (x < 0.0f) ? -x : x; -} -#endif - -namespace gr -{ - -size_t utf16len(const utf16 *s) -{ - // assumes NULL terminated strings - const utf16 *start = s; - for (; *s; ++s); - - return s - start; -} - -} // namespace gr -#endif // _WIN32 - diff --git a/Build/source/libs/graphite/engine-2.3.1/src/segment/Segment.cpp b/Build/source/libs/graphite/engine-2.3.1/src/segment/Segment.cpp deleted file mode 100644 index c2e71c4afaa..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/src/segment/Segment.cpp +++ /dev/null @@ -1,3558 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 1999, 2001 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: Segment.cpp -Responsibility: Sharon Correll -Last reviewed: Not yet. - -Description: - Implements a Graphite segment--a range of rendered text in one writing system, that can be - rendered with a single font, and that fits on a single line. --------------------------------------------------------------------------------*//*:End Ignore*/ - -//:>******************************************************************************************** -//:> Include files -//:>******************************************************************************************** -#include "Main.h" -#ifdef _MSC_VER -#pragma hdrstop -#endif -// any other headers (not precompiled) -#include -#ifndef _WIN32 -#include -#endif - -#undef THIS_FILE -DEFINE_THIS_FILE - -//:>******************************************************************************************** -//:> Forward declarations -//:>******************************************************************************************** - -//:>******************************************************************************************** -//:> Local Constants and static variables -//:>******************************************************************************************** -#if 0 // TODO remove -namespace -{ - -static bool g_fDrawing; - -} // namespace -#endif - - -static int g_csegTotal = 0; - -namespace gr -{ - -//:>******************************************************************************************** -//:> Segment methods -//:>******************************************************************************************** - - -int Segment::GetSegmentCount() /// TEMP -{ - return g_csegTotal; -} - - -/*---------------------------------------------------------------------------------------------- - Constructor: basic initialization. -----------------------------------------------------------------------------------------------*/ -Segment::Segment() : - m_pgts(NULL), - m_pfont(NULL), - m_preneng(NULL), - m_fErroneous(false), - m_pgjus(NULL), - m_prgbNextSegDat(NULL), - m_cbNextSegDat(0), - m_prgInitDat(NULL), - m_cbInitDat(0), -// m_fUseSepBase(0), - //m_psegAltEndLine(NULL), - m_prgisloutBefore(NULL), - m_prgisloutAfter(NULL), - m_prgpvisloutAssocs(NULL), - m_prgisloutLigature(NULL), - m_prgiComponent(NULL), -// m_psstrm(NULL), - m_cslout(0), - m_prgslout(NULL), - m_prgnSlotVarLenBuf(NULL), -// m_cnUserDefn(0), - m_cnCompPerLig(0), -// m_cnFeat(0), - m_cginf(0), - m_prgginf(NULL) -{ - m_cref = 1; - - g_csegTotal++; - -// m_stuFaceName.erase(); -// m_stuBaseFaceName.erase(); - m_vnSkipOffsets.clear(); -} - -/*---------------------------------------------------------------------------------------------- - Reference counting. -----------------------------------------------------------------------------------------------*/ - -long Segment::IncRefCount(void) -{ - AssertPtr(this); - return InterlockedIncrement(&m_cref); -} - -long Segment::DecRefCount(void) -{ - AssertPtr(this); - long cref = InterlockedDecrement(&m_cref); - if (cref == 0) { - m_cref = 1; - delete this; - } - return cref; -} - -/*---------------------------------------------------------------------------------------------- - Constructor to fit as much of the text on the line as possible, - finding a reasonable break point if necessary. -----------------------------------------------------------------------------------------------*/ -LineFillSegment::LineFillSegment( - Font * pfont, - ITextSource * pts, - LayoutEnvironment * playoutArg, - toffset ichStart, - toffset ichStop, - float xsMaxWidth, - bool fBacktracking) - : Segment() -{ - if (!pfont) - throw; - if (!pts) - throw; - - LayoutEnvironment layoutDefault; - LayoutEnvironment * playout = (!playoutArg) ? &layoutDefault : playoutArg; - - pfont->RenderLineFillSegment(this, pts, *playout, ichStart, ichStop, xsMaxWidth, - fBacktracking); -} - -/*---------------------------------------------------------------------------------------------- - Constructor to create a segment representing the given range of characters. -----------------------------------------------------------------------------------------------*/ -RangeSegment::RangeSegment( - Font * pfont, - ITextSource * pts, - LayoutEnvironment * playoutArg, - toffset ichStart, - toffset ichStop, - Segment * psegInitLike) - : Segment() -{ - if (!pfont) - throw; - if (!pts) - throw; - - LayoutEnvironment layoutDefault; - LayoutEnvironment * playout = (!playoutArg) ? &layoutDefault : playoutArg; - playout->setSegmentForInit(psegInitLike); - - pfont->RenderRangeSegment(this, pts, *playout, ichStart, ichStop); - - playout->setSegmentForInit(NULL); -} - -/*---------------------------------------------------------------------------------------------- - Constructor to create a justified segment. Private. -----------------------------------------------------------------------------------------------*/ -JustSegmentAux::JustSegmentAux( - Font * pfont, - ITextSource * pts, - LayoutEnvironment * playoutArg, - toffset ichStart, - toffset ichStop, - float xsNaturalWidth, - float xsJustifiedWidth, - Segment * psegInitLike) - : Segment() -{ - if (!pfont) - throw; - if (!pts) - throw; - - LayoutEnvironment layoutDefault; - LayoutEnvironment * playout = (!playoutArg) ? &layoutDefault : playoutArg; - playout->setSegmentForInit(psegInitLike); - - pfont->RenderJustifiedSegment(this, pts, *playout, ichStart, ichStop, - xsNaturalWidth, xsJustifiedWidth); - - playout->setSegmentForInit(NULL); -} - -//Segment::Segment(ITextSource * pgts, int ichwMin, int ichwLim, -// LineBrk lbStart, LineBrk lbEnd, -// bool fStartLine, bool fEndLine, bool fWsRtl) -//{ -// m_cref = 1; -// Initialize(pgts, ichwMin, ichwLim, lbStart, lbEnd, fStartLine, fEndLine, fWsRtl); -//} - -void Segment::Initialize(ITextSource * pgts, int ichwMin, int ichwLim, - LineBrk lbStart, LineBrk lbEnd, SegEnd est, - bool fStartLine, bool fEndLine, bool fWsRtl) -{ - AssertPtrN(pgts); - Assert(ichwMin >= 0); - Assert(ichwLim >= 0); - Assert(ichwMin <= ichwLim); - - //pgts->TextSrcObject(&m_pgts); // create a permanent wrapper, if necessary - // m_pgts->AddRef(); no, smart pointer - m_pgts = pgts; - - m_ichwMin = ichwMin; - m_dichwLim = ichwLim - ichwMin; - m_lbStart = lbStart; - m_lbEnd = lbEnd; - m_est = est; - m_dxsStretch = 0; - m_dxsWidth = -1; - m_dysAscent = -1; // to properly init, ComputeDimensions must be called - m_dysHeight = -1; - m_dysXAscent = -1; - m_dysXDescent = -1; - m_dysAscentOverhang = -1; - m_dysDescentOverhang = -1; - m_dxsLeftOverhang = -1; - m_dxsRightOverhang = -1; - m_dysOffset = 0; - m_fStartLine = fStartLine; - m_fEndLine = fEndLine; - m_fWsRtl = fWsRtl; - - m_dxsVisibleWidth = -1; - m_dxsTotalWidth = -1; - -// m_psstrm = NULL; - m_prgslout = NULL; - m_prgnSlotVarLenBuf = NULL; - m_prgisloutBefore = NULL; - m_prgisloutAfter = NULL; - m_prgpvisloutAssocs = NULL; - m_prgisloutLigature = NULL; - m_prgiComponent = NULL; - - m_prgbNextSegDat = NULL; - m_cbNextSegDat = 0; - - //m_psegAltEndLine = NULL; - -// m_stuFaceName.erase(); -// m_stuBaseFaceName.erase(); -// m_fUseSepBase = false; - -// m_psegPrev = NULL; // obsolete -// m_psegNext = NULL; - - //InitializePlatform(); -} - -/*---------------------------------------------------------------------------------------------- - Destructor. -----------------------------------------------------------------------------------------------*/ -Segment::~Segment() -{ - g_csegTotal--; - - DestroyContents(); -} - -void Segment::DestroyContents() -{ - delete m_pfont; - m_pfont = NULL; - - //if (m_pgts) - // // A specially-created wrapper object has to be deleted. - // m_pgts->DeleteTextSrcPtr(); - m_pgts = NULL; - - //if (m_pgjus) - // // A specially-created wrapper object has to be deleted. - // m_pgjus->DeleteJustifierPtr(); - m_pgjus = NULL; - - //if (m_psegAltEndLine) - //{ - // if (m_psegAltEndLine->m_psegAltEndLine == this) - // m_psegAltEndLine->m_psegAltEndLine = NULL; - // delete m_psegAltEndLine; - //} - - //for (int iginf = 0; iginf < m_cginf; iginf++) // DELETE - // delete m_prgginf[iginf].components; - - Assert((m_prgslout && m_prgnSlotVarLenBuf) || (!m_prgslout && !m_prgnSlotVarLenBuf)); - delete[] m_prgslout; - delete[] m_prgnSlotVarLenBuf; - delete[] m_prgisloutBefore; - delete[] m_prgisloutAfter; - for (int ichw = 0; ichw < m_ichwAssocsLim - m_ichwAssocsMin; ichw++) - { - if (m_prgpvisloutAssocs && m_prgpvisloutAssocs[ichw]) - delete m_prgpvisloutAssocs[ichw]; - } - delete[] m_prgpvisloutAssocs; - delete[] m_prgisloutLigature; - delete[] m_prgiComponent; - delete[] m_prgbNextSegDat; - delete[] m_prgInitDat; - delete[] m_prgginf; - m_cginf = 0; - - //DestroyContentsPlatform(); - - // ReleaseObj(m_pgts); automatic because smart pointer -} - -/*---------------------------------------------------------------------------------------------- - Factory method to create a new version of an existing segment with different - line-boundary flags. -----------------------------------------------------------------------------------------------*/ -Segment * Segment::LineContextSegment(Segment & seg, bool fStartLine, bool fEndLine) -{ - if (!seg.hasLineBoundaryContext()) - { - // Make an identical segment and just change the flags. - Segment * psegNew = new Segment(seg); - psegNew->InitLineContextSegment(fStartLine, fEndLine); - return psegNew; - } - else - { - // Rerun the processing. - LayoutEnvironment layout = seg.Layout(); - layout.setStartOfLine(fStartLine); - layout.setEndOfLine(fEndLine); - ITextSource & gts = seg.getText(); - Font & font = seg.getFont(); - return new RangeSegment(&font, >s, &layout, - seg.startCharacter(), seg.stopCharacter(), &seg); - } -} - -void Segment::InitLineContextSegment(bool fStartLine, bool fEndLine) -{ - // For RTL end-of-line segments, trailing white space hangs off the left of - // the origin of the segment. So when changing that flag - // shift appropriately. - bool fShift = ((m_nDirDepth % 2) && (m_fEndLine != fEndLine)); - - m_fStartLine = fStartLine; - m_fEndLine = fEndLine; - - m_layout.setStartOfLine(fStartLine); - m_layout.setEndOfLine(fEndLine); - - if (fShift) - { - (m_fEndLine) ? - ShiftGlyphs(m_dxsVisibleWidth - m_dxsTotalWidth) : // shift left - ShiftGlyphs(m_dxsTotalWidth - m_dxsVisibleWidth); // shift right - } - - m_dxsWidth = -1; -} - -/*---------------------------------------------------------------------------------------------- - A factory method to create a justified version of an existing segment. -----------------------------------------------------------------------------------------------*/ -Segment * Segment::JustifiedSegment(Segment & seg, float xsNewWidth) -{ - LayoutEnvironment layout(seg.Layout()); - ITextSource & gts = seg.getText(); - - // Why do we have to do this? - layout.setJustifier(seg.Justifier()); - Font & font = seg.getFont(); - return new JustSegmentAux(&font, >s, &layout, - seg.startCharacter(), seg.stopCharacter(), - seg.advanceWidth(), xsNewWidth, &seg); -} - -/*---------------------------------------------------------------------------------------------- - A factory method to create a new version of an existing trailing white-space segment - with a different direction. -----------------------------------------------------------------------------------------------*/ -Segment * Segment::WhiteSpaceSegment(Segment & seg, int nNewDepth) -{ - Segment * psegNew = new Segment(seg); - psegNew->InitWhiteSpaceSegment(nNewDepth); - return psegNew; -} - -void Segment::InitWhiteSpaceSegment(int nNewDepth) -{ - if (nNewDepth == m_nDirDepth) - { - return; - } - else if ((nNewDepth % 2) == (m_nDirDepth % 2)) - { - // Same direction, not much to change. - m_nDirDepth = nNewDepth; - return; - } - else if (m_twsh != ktwshOnlyWs) - return; // couldn't change it, oh, well - - // Otherwise, do the hard stuff: reverse the positions of the glyphs. - for (int islout = 0; islout < m_cslout; islout++) - { - OutputSlot(islout)->ShiftForDirDepthChange(m_dxsTotalWidth); - } - m_nDirDepth = nNewDepth; - - //SetDirectionDepthPlatform(nNewDepth); -} - -/*---------------------------------------------------------------------------------------------- - Basic copy method. -----------------------------------------------------------------------------------------------*/ -Segment::Segment(const Segment & seg) -{ - int islout; - - m_pgts = seg.m_pgts; - m_dichwLim = seg.m_dichwLim; - m_ichwMin = seg.m_ichwMin; - m_pfont = seg.m_pfont->copyThis(); - m_preneng = seg.m_preneng; - m_fErroneous = seg.m_fErroneous; - m_pgjus = seg.m_pgjus; - m_fWsRtl = seg.m_fWsRtl; - m_fParaRtl = seg.m_fParaRtl; - m_twsh = seg.m_twsh; - m_nDirDepth = seg.m_nDirDepth; - m_cbNextSegDat = seg.m_cbNextSegDat; - m_prgbNextSegDat = new byte[m_cbNextSegDat]; - std::copy(seg.m_prgbNextSegDat, seg.m_prgbNextSegDat + m_cbNextSegDat, m_prgbNextSegDat); -// m_psegPrev = seg.m_psegPrev; -// m_psegNext = seg.m_psegNext; -// m_stuFaceName = seg.m_stuFaceName; -// m_stuBaseFaceName = seg.m_stuBaseFaceName; -// m_fUseSepBase = seg.m_fUseSepBase; -// m_pixHeight = seg.m_pixHeight; -// m_fBold = seg.m_fBold; -// m_fItalic = seg.m_fItalic; - m_lbStart = seg.m_lbStart; - m_lbEnd = seg.m_lbEnd; - m_fStartLine = seg.m_fStartLine; - m_fEndLine = seg.m_fEndLine; - m_est = seg.m_est; - m_mFontEmUnits = seg.m_mFontEmUnits; - m_dysFontAscent = seg.m_dysFontAscent; - m_dysFontDescent = seg.m_dysFontDescent; - m_xysEmSquare = seg.m_xysEmSquare; -// m_xsDPI = seg.m_xsDPI; -// m_ysDPI = seg.m_ysDPI; - m_dxsStretch = seg.m_dxsStretch; - m_dxsWidth = seg.m_dxsWidth; - m_dysHeight = seg.m_dysHeight; - m_dysAscent = seg.m_dysAscent; - m_dysXAscent = seg.m_dysXAscent; - m_dysXDescent = seg.m_dysXDescent; - m_dysAscentOverhang = seg.m_dysAscentOverhang; - m_dysDescentOverhang = seg.m_dysDescentOverhang; - m_dxsLeftOverhang = seg.m_dxsLeftOverhang; - m_dxsRightOverhang = seg.m_dxsRightOverhang; - m_dxsVisibleWidth = seg.m_dxsVisibleWidth; - m_dxsTotalWidth = seg.m_dxsTotalWidth; - m_isloutVisLim = seg.m_isloutVisLim; - m_dysOffset = seg.m_dysOffset; - - m_ichwAssocsMin = seg.m_ichwAssocsMin; - m_ichwAssocsLim = seg.m_ichwAssocsLim; - - int dichw = m_ichwAssocsLim - m_ichwAssocsMin; - m_prgisloutBefore = new int[dichw]; - std::copy(seg.m_prgisloutBefore, seg.m_prgisloutBefore + dichw, m_prgisloutBefore); - m_prgisloutAfter = new int[dichw]; - std::copy(seg.m_prgisloutAfter, seg.m_prgisloutAfter + dichw, m_prgisloutAfter); - m_prgpvisloutAssocs = new std::vector * [dichw]; - for (int ivislout = 0; ivislout < dichw; ivislout++) - { - std::vector * pvislout = seg.m_prgpvisloutAssocs[ivislout]; - if (pvislout) - { - std::vector * pvisloutNew = new std::vector; - m_prgpvisloutAssocs[ivislout] = pvisloutNew; - *pvisloutNew = *pvislout; // copy the vector - } - } - m_prgisloutLigature = new int[dichw]; - std::copy(seg.m_prgisloutLigature, seg.m_prgisloutLigature + dichw, m_prgisloutLigature); - m_prgiComponent = new sdata8[dichw]; - std::copy(seg.m_prgiComponent, seg.m_prgiComponent + dichw, m_prgiComponent); - - m_cslout = seg.m_cslout; - int cnExtraPerSlot = (m_cslout > 0) ? seg.m_prgslout[0].CExtraSpaceSlout() : 0; - m_prgnSlotVarLenBuf = new u_intslot[m_cslout * cnExtraPerSlot]; - m_prgslout = new GrSlotOutput[m_cslout]; - for (islout = 0; islout < m_cslout; islout++) - { - GrSlotOutput * psloutOrig = seg.m_prgslout + islout; - GrSlotOutput * psloutThis = m_prgslout + islout; - psloutThis->ExactCopyFrom(psloutOrig, - m_prgnSlotVarLenBuf + (islout * cnExtraPerSlot), // var-length buffer location - cnExtraPerSlot); - } - -// m_cnUserDefn = seg.m_cnUserDefn; - m_cnCompPerLig = seg.m_cnCompPerLig; -// m_cnFeat = seg.m_cnFeat; - m_cslotRestartBackup = seg.m_cslotRestartBackup; - std::copy(seg.m_prgnSlotVarLenBuf, seg.m_prgnSlotVarLenBuf + - (m_cslout * cnExtraPerSlot), m_prgnSlotVarLenBuf); - - m_cginf = seg.m_cginf; - m_isloutGinf0 = seg.m_isloutGinf0; - m_prgginf = new GlyphInfo[m_cginf]; - std::copy(seg.m_prgginf, seg.m_prgginf + m_cginf, m_prgginf); - for (int iginf = 0; iginf < m_cginf; iginf++) - { - m_prgginf[iginf].m_pseg = this; - m_prgginf[iginf].m_pslout = m_prgslout + m_prgginf[iginf].m_islout; - } - - // Platform-specific; remove eventually: - //m_cgstrm = seg.m_cgstrm; - //m_prggstrm = new GlyphStrm[m_cgstrm]; - //for (int igstrm = 0; igstrm < m_cgstrm; igstrm++) - //{ - // m_prggstrm[igstrm].gsk.ys = seg.m_prggstrm[igstrm].gsk.ys; - // m_prggstrm[igstrm].gsk.clrFore = seg.m_prggstrm[igstrm].gsk.clrFore; - // m_prggstrm[igstrm].gsk.clrBack = seg.m_prggstrm[igstrm].gsk.clrBack; - // m_prggstrm[igstrm].vchwGlyphId = seg.m_prggstrm[igstrm].vchwGlyphId; - // m_prggstrm[igstrm].vdxs = seg.m_prggstrm[igstrm].vdxs; - // m_prggstrm[igstrm].vigbb = seg.m_prggstrm[igstrm].vigbb; - // m_prggstrm[igstrm].xsStart = seg.m_prggstrm[igstrm].xsStart; - // m_prggstrm[igstrm].xsStartInt = seg.m_prggstrm[igstrm].xsStartInt; - //} - //m_cgbb = seg.m_cgbb; - //m_prggbb = new GlyphBb[m_cgbb]; - //memcpy(m_prggbb, seg.m_prggbb, m_cgbb * sizeof(GlyphBb)); - //------------------------------------- - - m_vnSkipOffsets = seg.m_vnSkipOffsets; - m_dircPrevStrong = seg.m_dircPrevStrong; - m_dircPrevTerm = seg.m_dircPrevTerm; - m_cbInitDat = seg.m_cbInitDat; - m_prgInitDat = new byte[m_cbInitDat]; - std::copy(seg.m_prgInitDat, seg.m_prgInitDat + m_cbInitDat, m_prgInitDat); -} - -/*---------------------------------------------------------------------------------------------- - Swap the guts of the two segments. - OBSOLETE -----------------------------------------------------------------------------------------------*/ -void Segment::SwapWith(Segment * pgrseg) -{ - int crefThis = m_cref; - int crefOther = pgrseg->m_cref; - - std::swap(*this, *pgrseg); - - m_cref = crefThis; - pgrseg->m_cref = crefOther; -} - -/*---------------------------------------------------------------------------------------------- - Delete the pointer to the alternate-end-of-line segment. -----------------------------------------------------------------------------------------------*/ -void Segment::ClearAltEndLineSeg() -{ - //if (m_psegAltEndLine) - //{ - // if (m_psegAltEndLine->m_psegAltEndLine == this) - // m_psegAltEndLine->m_psegAltEndLine = NULL; // so we don't get into a loop - // delete m_psegAltEndLine; - // m_psegAltEndLine = NULL; - //} -} - - -//:>******************************************************************************************** -//:> Interface methods -//:>******************************************************************************************** - -/*---------------------------------------------------------------------------------------------- - Return the font that was used to create this segment. - Note that in some implementations, the font may be invalid; eg, on Windows the font - may not contain a valid device context. -----------------------------------------------------------------------------------------------*/ -Font & Segment::getFont() -{ - return *m_pfont; -} - -/*---------------------------------------------------------------------------------------------- - Return the text-source that the segment is representing. -----------------------------------------------------------------------------------------------*/ -ITextSource & Segment::getText() -{ - return *m_pgts; -} - -/*---------------------------------------------------------------------------------------------- - The distance the drawing point should advance after drawing this segment. - Always positive, even for RtoL segments. -----------------------------------------------------------------------------------------------*/ -float Segment::advanceWidth() -{ - if (m_dxsWidth < 0) - { - ////SetUpGraphics(ichwBase, pgg, true); - ComputeDimensions(); - } - return m_dxsWidth; -} - -/*---------------------------------------------------------------------------------------------- - Compute the rectangle in destination coords which contains all the pixels drawn by - this segment. This should be a sufficient rectangle to invalidate if the segment is - about to be discarded. -----------------------------------------------------------------------------------------------*/ -Rect Segment::boundingRect() -{ - if (m_dxsWidth < 0) - { - ////SetUpGraphics(ichwBase, pgg, true); - ComputeDimensions(); - } - - Rect rectRet; - rectRet.top = m_dysAscent + m_dysAscentOverhang; - rectRet.bottom = (m_dysAscent - m_dysHeight) - m_dysDescentOverhang; - rectRet.left = m_dxsLeftOverhang; - rectRet.right = m_dxsVisibleWidth + m_dxsRightOverhang; - - return rectRet; -} - -/*---------------------------------------------------------------------------------------------- - Answer whether the primary direction of the segment is right-to-left. This is based - on the direction of the writing system, except for white-space-only segments, in - which case it is based on the main paragraph direction. -----------------------------------------------------------------------------------------------*/ -bool Segment::rightToLeft() -{ - if (m_twsh == ktwshOnlyWs) - { - // White-space-only segment: use main paragraph direction. - return (m_nDirDepth % 2); - } - - GrEngine * pgreng = EngineImpl(); - if (pgreng) - { - return pgreng->RightToLeft(); - } - return (m_pgts->getRightToLeft(m_ichwMin)); -} - -/*---------------------------------------------------------------------------------------------- - Get the depth of direction embedding used by this segment. It is presumably the same - for all runs of the segment, otherwise, some of them would use a different writing - system and therefore be part of a different segment. So just use the first. -----------------------------------------------------------------------------------------------*/ -int Segment::directionDepth(bool * pfWeak) -{ - if (pfWeak) - *pfWeak = (m_twsh == ktwshOnlyWs); - -// *pnDepth = m_pgts->getDirectionDepth(m_ichwLim); -// Assert(*pnDepth == m_nDirDepth); - - return m_nDirDepth; -} - -/*---------------------------------------------------------------------------------------------- - Change the direction of the segment. This is needed specifically for white-space-only - segments, which are initially created to be in the direction of the paragraph, but then - later are discovered to not be line-end after all, and need to be changed to use the - directionality of the writing system. - - @return kresFail for segments that do not have weak directionality and therefore - cannot be changed. -----------------------------------------------------------------------------------------------*/ -bool Segment::setDirectionDepth(int nNewDepth) -{ - Assert(false); - - if (nNewDepth == m_nDirDepth) - { - return true; - } - else if ((nNewDepth % 2) == (m_nDirDepth % 2)) - { - // Same direction, not much to change. - m_nDirDepth = nNewDepth; - return true; - } - else if (m_twsh != ktwshOnlyWs) - return false; - - // Otherwise, do the hard stuff: reverse the positions of the glyphs. - for (int islout = 0; islout < m_cslout; islout++) - { - OutputSlot(islout)->ShiftForDirDepthChange(m_dxsTotalWidth); - } - - //SetDirectionDepthPlatform(nNewDepth); - - return true; - -} - -/*---------------------------------------------------------------------------------------------- - The logical range of characters covered by the segment, relative to the beginning of - the segment. The stop character is the index of the first character beyond the end - of the segment. - - These values should be exact at a writing system or string boundary, - but may be somewhat fuzzy at a line-break, since characters may be re-ordered - across such boundaries. The renderer is free to apply any definition it likes of - where a line-break occurs. This should always be the same value obtained from the - renderer as pdichLimSeg. -----------------------------------------------------------------------------------------------*/ -int Segment::startCharacter() -{ - return m_ichwMin; -} - -int Segment::stopCharacter() -{ - return m_ichwMin + m_dichwLim; -} - -/*---------------------------------------------------------------------------------------------- - Returns an indication of why the segment ended. -----------------------------------------------------------------------------------------------*/ -bool Segment::startOfLine() -{ - return m_fStartLine; -} - -/*---------------------------------------------------------------------------------------------- - Returns an indication of why the segment ended. -----------------------------------------------------------------------------------------------*/ -bool Segment::endOfLine() -{ - return m_fEndLine; -} - -/*---------------------------------------------------------------------------------------------- - Returns true if this segment has something special happening at line boundaries. -----------------------------------------------------------------------------------------------*/ -bool Segment::hasLineBoundaryContext() -{ - return (EngineImpl()->LineBreakFlag()); -} - -/*---------------------------------------------------------------------------------------------- - Returns an indication of why the segment ended. -----------------------------------------------------------------------------------------------*/ -SegEnd Segment::segmentTermination() -{ - return m_est; -} - -/*---------------------------------------------------------------------------------------------- - Indicates the last character of interest to the segment, relative to the beginning - of the segment. The meaning of this is that no behavior of this segment will be - affected if characters beyond that change. This does not necessarily mean that - a different line break could not have been obtained by the renderer if characters - beyond that change, just that a segment with the boundaries of this one would - not behave differently. -----------------------------------------------------------------------------------------------*/ -//GrResult Segment::get_LimInterest(int ichwBase, int * pdichw) -//{ -// ChkGrOutPtr(pdichw); -// -// GrEngine * pgreng = EngineImpl(); -// Assert(pgreng); -// *pdichw = m_dichwLim + pgreng->PostXlbContext(); -// ReturnResult(kresOk); -//} - -/*---------------------------------------------------------------------------------------------- - Changes the end-of-line status of the segment. This is used after making the last segment - of a string if we want to attempt to put some more text after it (e.g., in another - writing system), or if we have reordered due to bidirectionality. - - ENHANCE: the current version handles switching back and forth when we are trying to - decide whether we can put more stuff on a line. So it assumes we are at the end of - the contextual run (ie, the next batch of stuff will be in a different ows). - This will not correctly handle the way this function could or possibly - should be used for bidirectional reordering. -----------------------------------------------------------------------------------------------*/ -/* -GrResult Segment::changeLineEnds(bool fNewStart, bool fNewEnd) -{ - if (m_fStartLine != fNewStart || m_fEndLine != fNewEnd) - { - if (EngineImpl()->LineBreakFlag()) - { - if (!m_psegAltEndLine) - { - int dichwLimSeg, dichwContext; - float dxWidth; - SegEnd est; - int cbNextSegDat; - byte rgbNextSegDat[256]; - OLECHAR rgchErrMsg[256]; - Segment * pseg; - - EngineImpl()->FindBreakPointAux(m_pfont, m_pgts, m_pgjus, - m_ichwMin, m_ichwMin + m_dichwLim, m_ichwMin + m_dichwLim, - false, fNewStart, fNewEnd, kPosInfFloat, false, - klbNoBreak, klbNoBreak, m_twsh, m_fParaRtl, - &pseg, - &dichwLimSeg, &dxWidth, &est, - m_cbInitDat, m_prgInitDat, 256, rgbNextSegDat, &cbNextSegDat, - &dichwContext, - NULL, - rgchErrMsg, 256); - // TODO: do something with the error message. This shouldn't really happen, - // since to get here we already created a segment with this font. - if (!pseg) - { - // Because we provide INT_MAX as the amount of space, there should - // always be enough room to generate the alternate segment. - Assert(false); - THROW(kresUnexpected); - } - Assert(cbNextSegDat == 0); - m_psegAltEndLine = pseg; - } - Assert(m_psegAltEndLine->m_fEndLine == fNewEnd); - Segment * pseg = m_psegAltEndLine; // save the value - SwapWith(m_psegAltEndLine); - m_psegAltEndLine = pseg; // reset it after swap - pseg->m_psegAltEndLine = this; - } - else - { - bool fShift = ((m_nDirDepth % 2) && (m_fEndLine != fNewEnd)); - m_fStartLine = fNewStart; - m_fEndLine = fNewEnd; - if (fShift) - { - (m_fEndLine) ? - ShiftGlyphs(m_dxsVisibleWidth - m_dxsTotalWidth) : // shift left - ShiftGlyphs(m_dxsTotalWidth - m_dxsVisibleWidth); // shift right - } - m_dxsWidth = -1; - } - } - - ReturnResult(kresOk); -} -*/ - -/*---------------------------------------------------------------------------------------------- - Get the type of break that occurs at the logical start of the segment. -----------------------------------------------------------------------------------------------*/ -LineBrk Segment::startBreakWeight() -{ - return m_lbStart; -} - -/*---------------------------------------------------------------------------------------------- - Get the type of break that occurs at the logical end of the segment. -----------------------------------------------------------------------------------------------*/ -LineBrk Segment::endBreakWeight() -{ - return m_lbEnd; -} - -/*---------------------------------------------------------------------------------------------- - Read the amount of stretch, that is, the difference between the actual and natural width. - If the segment has been shrunk, returns a negative number. - TODO: implement properly. -----------------------------------------------------------------------------------------------*/ -float Segment::stretch() -{ - return (float)m_dxsStretch; -} - -/*---------------------------------------------------------------------------------------------- - Return the maximum stretch possible. - TODO: implement properly. -----------------------------------------------------------------------------------------------*/ -float Segment::maxStretch() -{ - return 1000; -} - -/*---------------------------------------------------------------------------------------------- - Return the maximum shrink possible. - TODO: implement properly. -----------------------------------------------------------------------------------------------*/ -float Segment::maxShrink() -{ - return 0; -} - -/*---------------------------------------------------------------------------------------------- - Return iterators representing the complete range of glyphs in the segment. -----------------------------------------------------------------------------------------------*/ -std::pair Segment::glyphs() -{ - return std::make_pair(GlyphIterator(*this, 0), GlyphIterator(*this, m_cginf)); -} - -/*---------------------------------------------------------------------------------------------- - Return iterators representing the set of glyphs for the given character. -----------------------------------------------------------------------------------------------*/ -std::pair Segment::charToGlyphs(toffset ich) -{ - std::vector vislout = UnderlyingToLogicalAssocs(ich); - - if (vislout.size() == 0) - return std::make_pair(GlyphSetIterator(), GlyphSetIterator()); - else - { - // Note that BOTH instances of GlyphSetIterator must use the same underlying vector, - // so that comparisons make sense. - RcVector * qvislout = new RcVector(vislout); - return std::make_pair( - GlyphSetIterator(*this, 0, qvislout), - GlyphSetIterator(*this, vislout.size(), qvislout)); - } -} - -/*---------------------------------------------------------------------------------------------- - Return the rendered glyphs and their x- and y-coordinates, in the order generated by - the final positioning pass, relative to the top-left of the segment. They are always - returned in (roughly) left-to-right order. Note: any of the arrays may be null. -----------------------------------------------------------------------------------------------*/ -/* -GrResult Segment::GetGlyphsAndPositions( - Rect rs, Rect rd, int cchMax, int * pcchRet, - utf16 * prgchGlyphs, float * prgxd, float * prgyd, float * prgdxdAdv) -{ - ChkGrOutPtr(pcchRet); - if (prgchGlyphs) - ChkGrArrayArg(prgchGlyphs, cchMax); - if (prgxd) - ChkGrArrayArg(prgxd, cchMax); - if (prgyd) - ChkGrArrayArg(prgyd, cchMax); - if (prgdxdAdv) - ChkGrArrayArg(prgdxdAdv, cchMax); - - GrResult res; - - //SetUpGraphics(ichwBase, pgg, true); - - Assert(m_dxsWidth >= 0); - Assert(m_dysAscent >= 0); - - *pcchRet = m_cginf; - if (cchMax < m_cginf) - { - res = (cchMax == 0) ? kresFalse : kresInvalidArg; - //RestoreFont(pgg); - ReturnResult(res); - } - - if (m_dxsWidth < 0) - ComputeDimensions(); - - float dysFontAscent = m_dysFontAscent; - //////res = GetFontAscentSourceUnits(pgg, &dysFontAscent); - //////if (ResultFailed(res)) - //////{ - ////// RestoreFont(pgg); - ////// ReturnResult(res); - //////} - - float xs = 0; - // Top of text that sits on the baseline, relative to top of segment: - float ys = m_dysAscent - dysFontAscent; - - float * prgxdLocal; - if (prgxd == NULL) - prgxdLocal = new float[cchMax]; - else - prgxdLocal = prgxd; - - res = GetGlyphsAndPositionsPlatform(xs, ys, rs, rd, - prgchGlyphs, prgxdLocal, prgyd, prgdxdAdv); - - if (!prgxd) - delete[] prgxdLocal; - - //RestoreFont(pgg); - - ReturnResult(res); -} -*/ - -/*---------------------------------------------------------------------------------------------- - For debugging. Return the characters in this segment. - OBSOLETE -----------------------------------------------------------------------------------------------*/ -GrResult Segment::GetCharData(int cchMax, utf16 * prgch, int * pcchRet) -{ - ChkGrArgPtr(prgch); - ChkGrOutPtr(pcchRet); - - int ichLimTmp = m_ichwMin + min(m_dichwLim, cchMax); - m_pgts->fetch(m_ichwMin, ichLimTmp - m_ichwMin, prgch); - *pcchRet = ichLimTmp - m_ichwMin; - ReturnResult(kresOk); -} - -/*---------------------------------------------------------------------------------------------- - Return either the first or last character that the the glyph corresponds to. The - index of the glyph matches what was returned by GetGlyphsAndPositions. - OBSOLETE -----------------------------------------------------------------------------------------------*/ -GrResult Segment::GlyphToChar(int iginf, bool fFirst, int * pich) -{ - Assert(m_dxsWidth >= 0); - Assert(m_dysAscent >= 0); - - *pich = PhysicalSurfaceToUnderlying(iginf, fFirst); - ReturnResult(kresOk); -} - -/*---------------------------------------------------------------------------------------------- - Return all the characters that the glyph corresponds to. Most commonly this will - be only one char, but ligatures, for instance, will have several. The index of the - glyph matches what was returned by GetGlyphsAndPositions. - OBSOLETE -----------------------------------------------------------------------------------------------*/ -GrResult Segment::GlyphToAllChars(int iginf, - int cichMax, int * prgich, int * pcichRet) -{ - Assert(m_dxsWidth >= 0); - Assert(m_dysAscent >= 0); - - std::vector vich; - int ichFirst = PhysicalSurfaceToUnderlying(iginf, true); - int ichLast = PhysicalSurfaceToUnderlying(iginf, false); - Assert(ichFirst <= ichLast); - - if (ichFirst < ichLast) - { - // Loop over the range of characters that might be associated with this glyph - // and add any that actually are. - // TODO: we should probably use a method that gets us all the physical associations, - // but this should get us 99.5% of the way there for now. - for (int ich = ichFirst; ich <= ichLast; ich++) - { - int iginfFirst = UnderlyingToPhysicalSurface(ich, true); - int iginfLast = UnderlyingToPhysicalSurface(ich, false); - if (iginfFirst == iginf || iginfLast == iginf) - vich.push_back(ich); - } - } - else - vich.push_back(ichFirst); - - *pcichRet = vich.size(); - if (cichMax < signed(vich.size())) - { - GrResult res = (cichMax == 0 ? kresFalse : kresInvalidArg); - ReturnResult(res); - } - int * pi = prgich; - for (size_t i = 0; i < vich.size(); i++) - *pi++ = vich[i]; - - ReturnResult(kresOk); -} - -/*---------------------------------------------------------------------------------------------- - Return either the first or last glyph that corresponds to the character. The - index of the glyph matches what was returned by GetGlyphsAndPositions. - OBSOLETE -----------------------------------------------------------------------------------------------*/ -GrResult Segment::CharToGlyph(int ich, bool fFirst, int * pigbb) -{ - Assert(m_dxsWidth >= 0); - Assert(m_dysAscent >= 0); - - *pigbb = UnderlyingToPhysicalSurface(ich, fFirst); - ReturnResult(kresOk); -} - - -//:>******************************************************************************************** -//:> Non-FieldWorks interface methods -//:>******************************************************************************************** - -/*---------------------------------------------------------------------------------------------- - Return the breakweight for the given character. Returns the best value if the character is - mapped to glyphs with different values. -----------------------------------------------------------------------------------------------*/ -LineBrk Segment::getBreakWeight(int ich, bool fBreakBefore) -{ - LineBrk lbFirst, lbLast; - - int isloutFirst = UnderlyingToLogicalSurface(ich, true); - if (isloutFirst == kPosInfinity || isloutFirst == kNegInfinity) - return klbClipBreak; - GrSlotOutput * psloutFirst = m_prgslout + isloutFirst; - bool fNotFirst = false; - if ((psloutFirst->NumberOfComponents() > 0) - && psloutFirst->FirstUnderlyingComponent(0) != ich) - { - // Not the first component of a ligature. - lbFirst = (LineBrk) ((int)klbClipBreak * -1); - fNotFirst = true; - } - else - { - lbFirst = (LineBrk) psloutFirst->BreakWeight(); - } - - int isloutLast = UnderlyingToLogicalSurface(ich, false); - if (isloutLast == kPosInfinity || isloutLast == kNegInfinity) - return klbClipBreak; - GrSlotOutput * psloutLast = m_prgslout + isloutLast; - bool fNotLast = false; - int icompLast = psloutLast->NumberOfComponents() - 1; - if ((psloutLast->NumberOfComponents() > 0) - && psloutLast->LastUnderlyingComponent(icompLast) != ich) - { - // Not the last component of a ligature. - lbLast = klbClipBreak; - fNotLast = true; - } - else - { - lbLast = (LineBrk) psloutLast->BreakWeight(); - } - - LineBrk lbRet; - if (fNotLast && fNotFirst) - // middle of a ligature - lbRet = klbClipBreak; - else if (fNotLast) - lbRet = (fBreakBefore) ? lbFirst : klbClipBreak; - else if (fNotFirst) - lbRet = (fBreakBefore) ? klbClipBreak : lbLast; - else - lbRet = (fBreakBefore) ? lbFirst : lbLast; - - return lbRet; -} - -/*---------------------------------------------------------------------------------------------- - Return the width of the range of characters. Line-boundary contextualization is handled - by the measure attributes on the glyphs. The width returned is equivalent to the sum of - the widths of any line-segments that would be needed to underline all the characters. - - Since this method is intended to be used on "measured" segments that include the entire - paragraph, it is not very smart about handling cross-line-boundary contextualization. - It basically ignores any glyphs that are rendered by this segment but not officially - part of the segment. -----------------------------------------------------------------------------------------------*/ -float Segment::getRangeWidth(int ichMin, int ichLim, - bool fStartLine, bool fEndLine, bool fSkipSpace) -{ - if (m_dxsWidth < 0) - { - ////SetUpGraphics(ichwBase, pgg, true); - ComputeDimensions(); - } - - Assert(m_dxsWidth >= 0); - Assert(m_dysAscent >= 0); - - //float xsSegRight = m_dxsTotalWidth; - - int ichMinRange = min(ichMin, ichLim); - int ichLimRange = max(ichMin, ichLim); - - //int ichMinSeg = max(ichMinRange, m_ichwMin + m_ichwAssocsMin); - //int ichLimSeg = min(ichLimRange, m_ichwMin + m_ichwAssocsLim); - int ichMinSeg = max(ichMinRange, m_ichwMin); - int ichLimSeg = min(ichLimRange, m_ichwMin + m_dichwLim); - - if (ichLimSeg < m_ichwMin) // not + m_ichwAssocsMin - return 0; - if (ichMinSeg >= m_ichwMin + m_dichwLim) // not m_ichwAssocsLim - return 0; - - if (fSkipSpace) - { - int islout = UnderlyingToLogicalSurface(ichLimSeg - 1, true); - GrSlotOutput * pslout = (islout == kNegInfinity || islout == kPosInfinity) ? - NULL : - OutputSlot(islout); - while (pslout && pslout->IsSpace()) - { - ichLimSeg--; - islout = UnderlyingToLogicalSurface(ichLimSeg - 1, true); -// pslout = OutputSlot(islout); - pslout = (islout == kNegInfinity || islout == kPosInfinity) ? - NULL : OutputSlot(islout); - } - } - - float xsWidth = 0; - SegmentNonPainter segp(this); // doesn't really need to paint - float rgxdLefts[100]; - float rgxdRights[100]; - size_t cxd = 0; - if (ichMinRange < ichLimRange) - cxd = segp.getUnderlinePlacement(ichMinSeg, ichLimSeg, fSkipSpace, - 100, rgxdLefts, rgxdRights, NULL); - for (size_t i = 0; i < cxd; i++) - xsWidth += rgxdRights[i] - rgxdLefts[i]; - - // Add in the line-boundary contextualization. - int isloutFirst = UnderlyingToLogicalSurface(ichMin, true); - int isloutLast = UnderlyingToLogicalSurface(ichLim - 1, false); - int mSol = 0; - int mEol = 0; - if (0 <= isloutFirst && isloutFirst < m_cslout) - mSol = m_prgslout[isloutFirst].MeasureSol(); - if (0 <= isloutLast && isloutLast < m_cslout) - mEol = m_prgslout[isloutLast].MeasureEol(); - float dxsSol = GrEngine::GrIFIMulDiv(mSol, m_xysEmSquare, m_mFontEmUnits); - float dxsEol = GrEngine::GrIFIMulDiv(mEol, m_xysEmSquare, m_mFontEmUnits); - xsWidth += dxsSol; - xsWidth += dxsEol; - - //RestoreFont(pgg); - - return xsWidth; -} - -/*---------------------------------------------------------------------------------------------- - Return the next reasonable breakpoint after ichStart resulting in range that fits in - the specified width. -----------------------------------------------------------------------------------------------*/ -int Segment::findNextBreakPoint(int ichStart, - LineBrk lbPref, LineBrk lbWorst, float dxMaxWidth, - float * pdxBreakWidth, bool fStartLine, bool fEndLine) -{ - ChkGrOutPtr(pdxBreakWidth); - - int ichBreak; - - // First make a rough estimation of how much will fit, using a binary chop approach. - int iginfStart = UnderlyingToPhysicalSurface(ichStart, !m_fWsRtl); - int iginfEnd = UnderlyingToPhysicalSurface(m_ichwMin + m_dichwLim - 1, m_fWsRtl); - int iginfLeft = min(iginfStart, iginfEnd); - int iginfRight= max(iginfStart, iginfEnd); - - int iginfMin = iginfLeft; - int iginfLim = iginfRight; - int ichFit; - if (m_fWsRtl) // right-to-left - { - float xRight = GlyphLeftEdge(iginfRight + 1); - float xLeftMost = xRight - dxMaxWidth; - while (GlyphLeftEdge(iginfLim) < xLeftMost) - { - if (iginfLim - iginfMin <= 1) - break; - int iginfMid = (iginfLim + iginfMin) >> 1; // divide by 2 - if (GlyphLeftEdge(iginfMid) < xLeftMost) - iginfLim = iginfMid; - else - iginfMin = iginfMid; - } - ichFit = PhysicalSurfaceToUnderlying(iginfLim, false); - } - else // left-to-right - { - float xLeft = GlyphLeftEdge(iginfLeft); - float xRightMost = dxMaxWidth - xLeft; // QUESTION: shouldn't this be +, not -? - iginfLim++; - while (GlyphLeftEdge(iginfLim) > xRightMost) - { - if (iginfLim - iginfMin <= 1) - break; - int iginfMid = (iginfLim + iginfMin) >> 1; // divide by 2 - if (GlyphLeftEdge(iginfMid) > xRightMost) - iginfLim = iginfMid; - else - iginfMin = iginfMid; - } - Assert(iginfLim <= m_cginf); - if (iginfLim >= m_cginf) iginfLim = m_cginf - 1; - ichFit = PhysicalSurfaceToUnderlying(iginfLim, false); - } - - // Breaking after ichFit should pretty much fit in the space. But make sure. - float dxWidthFit; - while (ichFit > ichStart) - { - dxWidthFit = getRangeWidth(ichStart, ichFit, fStartLine, fEndLine); - if (dxWidthFit <= dxMaxWidth) - break; - ichFit--; - } - - if (ichFit <= ichStart) - { - // Nothing will fit. - return ichStart - 1; - } - - // Now look for a good break. First look forward until the range doesn't fit anymore. - int ichTry = ichFit; - int nExtra = 2; - LineBrk lbBest = klbClipBreak; - int ichBestBreak = -1; - while (nExtra > 0 && ichTry < m_ichwMin + m_dichwLim) - { - float dxWTmp; - dxWTmp = getRangeWidth(ichStart, ichTry, fStartLine, fEndLine); - if (dxWTmp <= dxMaxWidth) - { - LineBrk lbTmp; - lbTmp = getBreakWeight(ichTry - 1, false); - if (lbTmp > 0 && lbTmp < lbWorst && max(lbTmp, lbPref) <= lbBest) - { - ichBestBreak = ichTry; - lbBest = max(lbTmp, lbPref); // any value better than lbPref is insignificant - } - else - { - lbTmp = getBreakWeight(ichTry - 1, true); - if (lbTmp < 0) - { - lbTmp = LineBrk(max(lbTmp * -1L, long(lbPref))); - if (lbTmp < lbWorst && lbTmp <= lbBest) - { - ichBestBreak = ichTry - 1; - lbBest = lbTmp; - } - } - } - } - else - { - // Didn't fit. But it is theoretically possible that actually adding another - // character will! Try a few more. - nExtra--; - } - ichTry++; - } - - if (ichBestBreak > -1) - { - if (ichTry >= m_ichwMin + m_dichwLim) - { - // Break at the end of the segment. - ichBreak = m_ichwMin + m_dichwLim; - *pdxBreakWidth = getRangeWidth(ichStart, m_dichwLim, fStartLine, fEndLine); - return ichBreak; - } - - if (lbBest <= lbPref) - { - // Found a reasonable break by looking forward; return it. - ichBreak = ichBestBreak;// + m_ichwMin; - *pdxBreakWidth = getRangeWidth(ichStart, ichBestBreak, fStartLine, fEndLine); - return ichBreak; - } - } - - // Didn't find a really good break point looking forward from our rough guess. - // Now look backward. - - ichTry = ichFit; - while (ichTry > ichStart) - { - LineBrk lbTmp; - lbTmp = getBreakWeight(ichTry - 1, false); - if (lbTmp > 0 && lbTmp < lbWorst && max(lbTmp, lbPref) < lbBest) - { - ichBestBreak = ichTry; - lbBest = max(lbTmp, lbPref); // any value better than lbPref is insignificant - } - else - { - lbTmp = getBreakWeight(ichTry - 1, true); - if (lbTmp < 0) - { - lbTmp = LineBrk(max(lbTmp * -1L, long(lbPref))); - if (lbTmp < lbWorst && lbTmp < lbBest) - { - ichBestBreak = ichTry - 1; - lbBest = lbTmp; - } - } - } - if (lbBest <= lbPref) - break; - - ichTry--; - } - - if (ichBestBreak > -1 && ichBestBreak > ichStart) - { - // Found a reasonable break by looking backward; return it. - ichBreak = ichBestBreak;// + m_ichwMin; - *pdxBreakWidth = getRangeWidth(ichStart, ichBestBreak, fStartLine, fEndLine); - return ichBreak; - } - - // No reasonable break. - return ichStart - 1; -} - -/*---------------------------------------------------------------------------------------------- - Private; used by findNextBreakPoint(). -----------------------------------------------------------------------------------------------*/ -float Segment::GlyphLeftEdge(int iginf) -{ - if (iginf >= m_cginf) - return m_prgginf[m_cginf - 1].origin() + m_prgginf[m_cginf - 1].advanceWidth(); -// return m_prgginf[m_cginf].origin() + m_prgginf[m_cginf].advanceWidth(); - else - return m_prgginf[iginf].origin(); -} - - -//:>******************************************************************************************** -//:> Other methods -//:>******************************************************************************************** - -/*---------------------------------------------------------------------------------------------- - Get the embedded string. For temporary use; AddRef is not automatically called. - Do not release unless you AddRef. -----------------------------------------------------------------------------------------------*/ -ITextSource * Segment::GetString() -{ - return m_pgts; -} - -/*---------------------------------------------------------------------------------------------- - Compute the ascent, height, width, and overhangs of the segment. - The ascent is the ascent of the font (distance from the baseline to the top) - plus any extra ascent height specified by the font. - The descent is distance from the baseline to the bottom of font, plus any extra descent - specified by the font (ExtraDescent). - The ascent overhang is the distance from the top of the font to the top of the highest - glyph, or zero if all the glyphs fit within the ascent. - The descent overhang is the distance from the bottom of the font to the bottom of the lowest - glyph, or zero if all the glyphs fit within the descent. - The height is the sum of the ascent and descent. -----------------------------------------------------------------------------------------------*/ -void Segment::ComputeDimensions() -{ - if (m_fEndLine) - m_dxsWidth = m_dxsVisibleWidth; // don't include trailing white space. - else - m_dxsWidth = m_dxsTotalWidth; - - if (m_dxsWidth == -1) - { - for (int iginf = 0; iginf < m_cginf; iginf++) - { - GlyphInfo * pginf = m_prgginf + iginf; - if (pginf->isSpace()) - continue; - m_dxsWidth = max(m_dxsWidth, (pginf->origin() + pginf->advanceWidth())); - } - } - - int dysNegFontDescent = (int)m_dysFontDescent * -1; - - // if there were no glyphs in the segment then there is sometimes no EngineImpl - if (!EngineImpl()) - { - Assert(m_cslout == 0); - Assert(m_cginf == 0); - m_dxsWidth = 0; - m_dysAscent = 0; // max(0.0, m_dysFontAscent); - m_dysHeight = 0; // max(0.0, m_dysAscent - dysNegFontDescent); - m_dysAscentOverhang = 0; - m_dysDescentOverhang = 0; - m_dxsLeftOverhang = 0; - m_dxsRightOverhang = 0; - return; - } - - // Calculate the extra ascent and descent. - int mXAscent = EngineImpl()->ExtraAscent(); - int mXDescent = EngineImpl()->ExtraDescent(); - - m_dysXAscent = GrEngine::GrIFIMulDiv(mXAscent, m_xysEmSquare, m_mFontEmUnits); - m_dysXDescent = GrEngine::GrIFIMulDiv(mXDescent, m_xysEmSquare, m_mFontEmUnits); - - m_dysAscent = m_dysFontAscent + m_dysXAscent; - float dysNegDescent = dysNegFontDescent - m_dysXDescent; // dysNegDescent < 0 - m_dysHeight = m_dysAscent - dysNegDescent; - - // Calculate the overhangs. - float dysVisAscent = m_dysAscent; - float dysNegVisDescent = dysNegDescent; - float dxsVisLeft = 0; - float dxsVisRight = m_dxsTotalWidth; - ComputeOverhangs(&dysVisAscent, &dysNegVisDescent, &dxsVisLeft, &dxsVisRight); - m_dysAscentOverhang = max(float(0), (dysVisAscent - m_dysAscent)); - m_dysDescentOverhang = max(float(0), (dysNegDescent - dysNegVisDescent)); - m_dxsLeftOverhang = min(float(0), dxsVisLeft); - m_dxsRightOverhang = max(float(0), dxsVisRight - m_dxsTotalWidth); - - m_dysOffset = EngineImpl()->VerticalOffset(); -} - -/*---------------------------------------------------------------------------------------------- - Compute the visible ascent and descent, based on how much the bounding box of any - glyph may extend beyond the ascent or descent of the font. - Also compute the left- and right-overhangs. -----------------------------------------------------------------------------------------------*/ -void Segment::ComputeOverhangs(float * pdysVisAscent, float * pdysNegVisDescent, - float * pdxsVisLeft, float * pdxsVisRight) -{ - for (int iginf = 0; iginf < m_cginf; iginf++) - { - *pdysVisAscent = max(*pdysVisAscent, m_prgginf[iginf].bb().top); - *pdysNegVisDescent = min(*pdysNegVisDescent, m_prgginf[iginf].bb().bottom); - - *pdxsVisLeft = min(*pdxsVisLeft, m_prgginf[iginf].bb().left); - *pdxsVisRight = max(*pdxsVisRight, m_prgginf[iginf].bb().right); - } -} - -/*---------------------------------------------------------------------------------------------- - Create the arrays to store the final output and association information. -----------------------------------------------------------------------------------------------*/ -void Segment::SetUpOutputArrays(Font * pfont, GrTableManager * ptman, - GrSlotStream * psstrmFinal, - int cchwInThisSeg, int csloutSurface, gid16 chwLB, - TrWsHandling twsh, bool fParaRtl, int nDirDepth, bool fEmpty) -{ - m_mFontEmUnits = EngineImpl()->GetFontEmUnits(); - - pfont->getFontMetrics(&m_dysFontAscent, &m_dysFontDescent, &m_xysEmSquare); -// m_xsDPI = (float)pfont->getDPIx(); -// m_ysDPI = (float)pfont->getDPIy(); - - // Note that storing both of these values is redundant; they should be the same. -// Assert(m_xysEmSquare == m_pixHeight); - - m_twsh = twsh; - m_fParaRtl = fParaRtl; - if (m_twsh == ktwshOnlyWs) - m_nDirDepth = (int)fParaRtl; - else if (fParaRtl && nDirDepth == 0) - m_nDirDepth = 2; - else - m_nDirDepth = nDirDepth; - - // Create association mappings and set up final versions of slots. - - Assert((psstrmFinal == NULL) == fEmpty); - - m_ichwAssocsMin = 0; - m_ichwAssocsLim = cchwInThisSeg; - - m_prgisloutBefore = new int[cchwInThisSeg]; - - m_prgisloutAfter = new int[cchwInThisSeg]; - - m_prgpvisloutAssocs = new std::vector * [cchwInThisSeg]; - - m_prgisloutLigature = new int[cchwInThisSeg]; - - m_prgiComponent = new sdata8[cchwInThisSeg]; - - int cslot = 0; - //m_psstrm = psstrmFinal; // TODO: make a local variable - if (psstrmFinal) - cslot = psstrmFinal->FinalSegLim(); - else - Assert(fEmpty); - - float xsMin = 0; - int islot; - int islotMin = (psstrmFinal) ? psstrmFinal->IndexOffset() : 0; - for (islot = islotMin; islot < cslot; islot++) - xsMin = min(xsMin, psstrmFinal->SlotAt(islot)->XPosition()); - - // For right-to-left segments, the draw origin is at the left side of the visible - // portion of the text. So if necessary, scoot everything left so that the invisible - // trailing white-space is to the left of the draw position. - Assert(m_dxsTotalWidth > -1); - Assert(m_dxsVisibleWidth > -1); - float dxsInvisible = (m_fEndLine) ? m_dxsTotalWidth - m_dxsVisibleWidth : 0; - for (islot = islotMin; ((m_nDirDepth % 2) && (islot < cslot)); islot++) - { - GrSlotState * pslot = psstrmFinal->SlotAt(islot); - // int islout = islot - islotMin; - if (pslot->GlyphID() == chwLB) - continue; // skip over linebreak markers - if (m_nDirDepth % 2) // redundant test - { - // RTL will have descending neg values, adjust to be positive. Also make sure - // invisible trailing white space is to the left of the draw origin. - // Review: will changing this value have side affects? - pslot->SetXPos(pslot->XPosition() - xsMin - dxsInvisible); - } - } - - Assert(kPosInfinity > 0); - Assert(kNegInfinity < 0); - for (int ichw = 0; ichw < cchwInThisSeg; ++ichw) - { - m_prgisloutBefore[ichw] = kPosInfinity; - m_prgisloutAfter[ichw] = kNegInfinity; - m_prgpvisloutAssocs[ichw] = new std::vector; - m_prgisloutLigature[ichw] = kNegInfinity; - m_prgiComponent[ichw] = 0; - } - - m_cslout = csloutSurface; - if (ptman->NumUserDefn() > 0 && ptman->NumCompPerLig() > 0) - { - int x; x = 3; - } - -// m_cnUserDefn = ptman->NumUserDefn(); - m_cnCompPerLig = ptman->NumCompPerLig(); -// m_cnFeat = ptman->NumFeat(); - // Normal buffers, plus: - // - underlying indices of ligature components - // - map from used components to defined components -// int cnExtraPerSlot = m_cnUserDefn + (m_cnCompPerLig * 2) + m_cnFeat + (m_cnCompPerLig * 2); - - // We don't need to store the user-defined slot attributes or the features in the segment itself. - // What we need is: (1) component.ref attr settings, (2) slot-attribute indices, - // (3) underlying indices of ligature components, and (4) map from used components - // to defined components - // 18Jul08 - it looks like all we need are underlying chars for ligature components and - // map from components to defined components. - int cnExtraPerSlot = m_cnCompPerLig * 2; - m_prgslout = new GrSlotOutput[m_cslout]; - m_prgnSlotVarLenBuf = new u_intslot[m_cslout * cnExtraPerSlot]; - - m_isloutVisLim = 0; - if (psstrmFinal) - { - for (islot = islotMin; islot < psstrmFinal->FinalSegLim(); ++islot) - { - int isloutRel = islot - islotMin; - - GrSlotState * pslot = psstrmFinal->SlotAt(islot); - pslot->SetPosPassIndex(isloutRel, false); - pslot->EnsureCacheForOutput(ptman); - GrSlotOutput * pslout = OutputSlot(isloutRel); - pslout->SetBufferPtr(m_prgnSlotVarLenBuf + (isloutRel * cnExtraPerSlot)); - pslout->InitializeOutputFrom(pslot); - pslout->SetBeforeAssoc(pslot->BeforeAssoc()); - pslout->SetAfterAssoc(pslot->AfterAssoc()); - if (pslot->HasComponents()) - pslot->SetComponentRefsFor(pslout); - Assert(pslot->HasComponents() == (pslout->NumberOfComponents() > 0)); - //if (pslot->HasClusterMembers()) - //{ - //Assert(pslot->HasClusterMembers() || pslot->ClusterRootOffset() == 0); - pslout->SetClusterXOffset(pslot->ClusterRootOffset() * -1); - pslout->SetClusterAdvance(pslot->ClusterAdvWidthFrom(0)); - - //} - - if (!ptman->IsWhiteSpace(pslot)) - m_isloutVisLim = islot + 1; - } - } - - // Set up the clusters. - for (islot = islotMin; islot < m_cslout; islot++) - { - GrSlotState * pslot = psstrmFinal->SlotAt(islot); - int isloutAdj = islot - islotMin; - int isloutBaseIndex = pslot->Base(psstrmFinal)->PosPassIndex(); - if (!pslot->IsBase()) - { - OutputSlot(isloutBaseIndex)->AddClusterMember(isloutBaseIndex, pslot->PosPassIndex()); - OutputSlot(isloutAdj)->SetClusterBase(isloutBaseIndex); - } - else if (pslot->HasClusterMembers() && pslot->IsBase()) - { - Assert(isloutBaseIndex == islot - islotMin); - OutputSlot(isloutAdj)->SetClusterBase(isloutBaseIndex); - } - } - - ///AssertValidClusters(psstrmFinal); - -#ifdef OLD_TEST_STUFF - if (ptman->GlyphTable() == NULL) - return; // test procedures -#endif // OLD_TEST_STUFF - - // CalcPositionsUpTo() called on final pass already from Table Mgr - - // Final output for draw routines. - - SetUpGlyphInfo(ptman, psstrmFinal, chwLB, nDirDepth, islotMin, cslot); - - //SetUpOutputArraysPlatform(ptman, chwLB, nDirDepth, islotMin, cslot); - -} - -/*---------------------------------------------------------------------------------------------- - Set up the data structures that represent the actual rendered glyphs for the new segment. -----------------------------------------------------------------------------------------------*/ -void Segment::SetUpGlyphInfo(GrTableManager * ptman, GrSlotStream * psstrmFinal, - gid16 chwLB, int nDirDepth, int islotMin, int cslot) -{ - //int paraDirLevel = (ptman->State()->ParaRightToLeft()) ? 1 : 0; - - m_cginf = 0; - - int islot; - for (islot = islotMin; islot < cslot; islot++) - { - if (psstrmFinal->SlotAt(islot)->GlyphID() != chwLB) - { - m_cginf++; - } - } - - // For right-to-left segments, the draw origin will be at the left side of the visible - // portion of the text. So if necessary, scoot everything left so that the invisible - // trailing white-space is to the left of the draw position. - Assert(m_dxsTotalWidth > -1); - Assert(m_dxsVisibleWidth > -1); - //float dxsInvisible = (m_fEndLine) ? m_dxsTotalWidth - m_dxsVisibleWidth : 0; - - m_prgginf = new GlyphInfo [m_cginf]; - - m_isloutGinf0 = -1; - int iginf = 0; - for (int islot = islotMin; islot < cslot; islot++) - { - GrSlotState * pslot = psstrmFinal->SlotAt(islot); - - if (pslot->GlyphID() == chwLB) - { - continue; // skip over linebreak markers - } - - int islout = islot - islotMin; - GrSlotOutput * pslout = OutputSlot(islout); - - if (m_isloutGinf0 == -1) - m_isloutGinf0 = islout; - - m_prgginf[iginf].m_pslout = pslout; - m_prgginf[iginf].m_islout = islout; - m_prgginf[iginf].m_pseg = this; - - // Fill in stuff in the output slot that is needed by the GlyphInfo object. - ////pslout->m_xsAdvanceX = pslot->GlyphMetricLogUnits(ptman, kgmetAdvWidth); // wrong - pslout->m_xsAdvanceX = ptman->EmToLogUnits(pslot->AdvanceX(ptman)); - //pslout->m_ysAdvanceY = ptman->EmToLogUnits(pslot->AdvanceY(ptman)); - //pslout->m_rectBB.top - // = pslot->YPosition() + pslot->GlyphMetricLogUnits(ptman, kgmetBbTop); - //pslout->m_rectBB.bottom - // = pslot->YPosition() + pslot->GlyphMetricLogUnits(ptman, kgmetBbBottom); - //pslout->m_rectBB.left - // = pslot->XPosition() + pslot->GlyphMetricLogUnits(ptman, kgmetBbLeft); - //if (pslot->IsSpace(ptman)) - // pslout->m_rectBB.right - // = pslot->XPosition() + pslot->GlyphMetricLogUnits(ptman, kgmetAdvWidth); - //else - // pslout->m_rectBB.right - // = pslot->XPosition() + pslot->GlyphMetricLogUnits(ptman, kgmetBbRight); - - iginf++; - } - - if (cslot - islotMin == 0) - m_isloutGinf0 = 0; - if (m_isloutGinf0 == -1) - { - Assert(m_cginf == 0); - m_isloutGinf0 = ((OutputSlot(0)->IsInitialLineBreak()) ? 1 : 0); - } - - Assert(m_isloutGinf0 == 0 || m_isloutGinf0 == 1); -} - -/* -// OLD VERSION -void Segment::SetUpGlyphInfo(GrTableManager * ptman, GrSlotStream * psstrmFinal, gid16 chwLB, int nDirDepth, - int islotMin, int cslot) -{ - int paraDirLevel = (ptman->State()->ParaRightToLeft()) ? 1 : 0; - - m_cginf = 0; - int islot; - for (islot = islotMin; islot < cslot; islot++) - { - if (psstrmFinal->SlotAt(islot)->GlyphID() != chwLB) - m_cginf++; - } - - // For right-to-left segments, the draw origin will be at the left side of the visible - // portion of the text. So if necessary, scoot everything left so that the invisible - // trailing white-space is to the left of the draw position. - Assert(m_dxsTotalWidth > -1); - Assert(m_dxsVisibleWidth > -1); - float dxsInvisible = (m_fEndLine) ? m_dxsTotalWidth - m_dxsVisibleWidth : 0; - - m_prgginf = new GlyphInfo [m_cginf]; - - // Fill in glyph information structures. - m_isloutGinf0 = -1; - for (islot = islotMin; islot < cslot; islot++) - { - GrSlotState * pslot = psstrmFinal->SlotAt(islot); - - int islout = islot - islotMin; - if (pslot->GlyphID() == chwLB) - { - continue; // skip over linebreak markers - } - if (m_isloutGinf0 == -1) - m_isloutGinf0 = islout; - - GrSlotOutput * pslout = OutputSlot(islout); - - int iginf = islout - m_isloutGinf0; - GlyphInfo & ginf = m_prgginf[iginf]; - - ginf.glyphID = pslot->ActualGlyphForOutput(ptman); - ginf.pseudoGlyphID = pslot->GlyphID(); - if (ginf.glyphID == ginf.pseudoGlyphID) - ginf.pseudoGlyphID = 0; - - ginf.isSpace = pslot->IsSpace(ptman); - - ginf.origin = pslot->XPosition(); - ginf.yOffset = pslot->YPosition(); - - ginf.bbLeft = pslot->XPosition() + pslot->GlyphMetricLogUnits(ptman, kgmetBbLeft); - ginf.bbTop = pslot->YPosition() + pslot->GlyphMetricLogUnits(ptman, kgmetBbTop); - if (ginf.isSpace) - { - ginf.bbRight = pslot->XPosition() + pslot->GlyphMetricLogUnits(ptman, kgmetAdvWidth); - } - else - { - ginf.bbRight = pslot->XPosition() + pslot->GlyphMetricLogUnits(ptman, kgmetBbRight); - } - ginf.bbBottom = pslot->YPosition() + pslot->GlyphMetricLogUnits(ptman, kgmetBbBottom); - - ginf.advanceWidth = pslot->GlyphMetricLogUnits(ptman, kgmetAdvWidth); - ginf.advanceHeight = 0; - - if (pslot->AttachTo() == 0) // not attached - ginf.attachedTo = -1; - else - ginf.attachedTo = pslot->AttachTo() + islot; - - ginf.directionality = byte(pslot->Directionality()); - if (pslot->DirLevel() == -1) - ginf.directionLevel = paraDirLevel; - else - ginf.directionLevel = byte(pslot->DirLevel()); - - //ginf.firstChar = LogicalSurfaceToUnderlying(islout, true); - //ginf.lastChar = LogicalSurfaceToUnderlying(islout, false); - - if (pslot->HasComponents()) - { - SetUpLigInfo(ptman, ginf, pslout); - } - else - { - ginf.numberOfComponents = 0; - ginf.components = NULL; - } - - ginf.insertBefore = pslot->InsertBefore(); - - ginf.maxStretch[0] = ptman->EmToLogUnits(pslot->JStretch()); - ginf.maxShrink[0] = ptman->EmToLogUnits(pslot->JShrink()); - ginf.stretchStep[0]= ptman->EmToLogUnits(pslot->JStep()); - ginf.justWidth[0] = ptman->EmToLogUnits(pslot->JWidth()); - ginf.justWeight[0] = pslot->JWeight(); - - ginf.measureStartOfLine = pslout->MeasureSolLogUnits(); - ginf.measureEndOfLine = pslout->MeasureEolLogUnits(); - } -} -*/ - -/*---------------------------------------------------------------------------------------------- - Set up the data structures that represent the components of a ligature glyph. -----------------------------------------------------------------------------------------------*/ -/* -void Segment::SetUpLigInfo(GrTableManager * ptman, GlyphInfo & ginf, GrSlotOutput * pslout) -{ - GrGlyphTable * pgtbl = ptman->GlyphTable(); - - int ccomp = pslout->NumberOfComponents(); - ginf.numberOfComponents = ccomp; - ginf.components = new ComponentBox[ccomp]; - for (int icomp = 0; icomp < ccomp; icomp++) - { - ComponentBox & cb = ginf.components[icomp]; - - // TODO: Rework ComponentIndexForGlyph to take slati rather than iForGlyph. - float xsLeft, xsRight, ysTop, ysBottom; - int slati = pslout->ComponentId(icomp); - int iForGlyph = pgtbl->ComponentIndexForGlyph(pslout->GlyphID(), slati); - pgtbl->ComponentBoxLogUnits(m_xysEmSquare, pslout->GlyphID(), iForGlyph, - m_mFontEmUnits, m_dysAscent, - &xsLeft, &ysTop, &xsRight, &ysBottom, false); - - cb.firstChar = pslout->UnderlyingComponent(icomp); - cb.lastChar = cb.firstChar; // TODO: is this supported? - cb.left = xsLeft; - cb.right = xsRight; - cb.top = ysTop; - cb.bottom = ysBottom; - } -} -*/ - - -// --------- OBSOLETE - replaced by GrTableManager::AdjustAssocsForOverlaps() --------------- -#if 0 - -/*---------------------------------------------------------------------------------------------- - Now that this segment is finished and has its associations set, handle any overlaps in - the associations between the previous segment and this one. - - Review: Think about whether we need to distinguish between before==kPosInfinity meaning - that the glyph is in the next segment vs. there is no association at all. - OBSOLETE -----------------------------------------------------------------------------------------------*/ -void Segment::AdjustForOverlapsWithPrevSeg() -{ - if (m_psegPrev) - { - AdjustBeforeArrayFromPrevSeg(); - m_psegPrev->AdjustAfterArrayFromNextSeg(); - } -} - -/*---------------------------------------------------------------------------------------------- - For any characters that are officially in this segment but are rendered in - the previous segment, initialize this segment's before array appropriately. Specifically, - set this segment's before value to something invalid--negative infinity, which will - never be overwritten. - OBSOLETE - replaced by AdjustAfterArrayFromNextSeg -----------------------------------------------------------------------------------------------*/ -void Segment::InitBeforeArrayFromPrevSeg() -{ - Assert(m_psegPrev); - - int ichwPrevMin = m_psegPrev->m_ichwMin; - int ichwPrevLim = m_psegPrev->m_ichwLim; -// int ichwPrevContextLim = -// m_psegPrev->m_ichwAssocsLim - m_psegPrev->m_ichwAssocsMin + m_psegPrev->m_ichwMin; - int cchwPrevAssocsMin = m_psegPrev->m_ichwAssocsMin; - int cchwPrevAssocsLim = m_psegPrev->m_ichwAssocsLim; - - // Loop over associations appended to the end of the previous segment; - // ichwPrev and ichwThis are relative to the start of their respective segments. - for (int ichwPrev = ichwPrevLim - ichwPrevMin; ichwPrev < cchwPrevAssocsLim; ++ichwPrev) - { - int ichwThis = ichwPrev - (ichwPrevLim - ichwPrevMin); // relative to start of this seg - if (m_psegPrev->m_prgisloutBefore[ichwPrev - cchwPrevAssocsMin] < kPosInfinity) - // The "before" value is in the previous segment, so make this segment's - // before value invalid. - m_prgisloutBefore[ichwThis - m_ichwAssocsMin] = kNegInfinity; - } -} - -/*---------------------------------------------------------------------------------------------- - For any associations that overlap between the previous segment and this, adjust - this segment's before array appropriately. Specifically, for any characters that - are rendered in both, set this segment's before value to something invalid. - OBSOLETE -----------------------------------------------------------------------------------------------*/ -void Segment::AdjustBeforeArrayFromPrevSeg() -{ - Assert(m_psegPrev); - - int ichwPrevMin = m_psegPrev->m_ichwMin; - int ichwPrevLim = m_psegPrev->m_ichwLim; - int ichwPrevAssocsMin = m_psegPrev->m_ichwAssocsMin; - int ichwPrevAssocsLim = m_psegPrev->m_ichwAssocsLim; - - // Loop over associations appended to the end of the previous segment - // (ie, rendered in the previous segment but officially in this one); - // ichwPrev and ichwThis are relative to the start of their respective segments. - for (int ichwPrev = ichwPrevLim - ichwPrevMin; ichwPrev < ichwPrevAssocsLim; ++ichwPrev) - { - int ichwThis = ichwPrev - (ichwPrevLim - ichwPrevMin); // relative to start of this seg - if (m_psegPrev->m_prgisloutBefore[ichwPrev - ichwPrevAssocsMin] < kPosInfinity) - // The "before" value is in the previous segment, so make this segment's - // before value invalid. - m_prgisloutBefore[ichwThis - m_ichwAssocsMin] = kNegInfinity; - } - // Loop over associations prepended to the start of this segment - // (ie, rendered in this segment but officially in the previous one); - // ichwPrev and ichwThis are relative to the start of their respective segments. - for (int ichwThis = m_ichwAssocsMin; ichwThis < 0; ++ichwThis) - { - int ichwPrev = ichwThis + (ichwPrevLim - ichwPrevMin); - if (m_psegPrev->m_prgisloutBefore[ichwPrev - ichwPrevAssocsMin] < kPosInfinity) - // The "before" value is in the previous segment, so make this segment's - // before value invalid. - m_prgisloutBefore[ichwThis - m_ichwAssocsMin] = kNegInfinity; - } -} - -/*---------------------------------------------------------------------------------------------- - For any associations that overlap between this segment and the next, adjust - this segment's after array appropriately. Specifically, for any characters that - are rendered in both, set this segment's after value to something invalid. - OBSOLETE -----------------------------------------------------------------------------------------------*/ -void Segment::AdjustAfterArrayFromNextSeg() -{ - Assert(m_psegNext); - - int ichwNextMin = m_psegNext->m_ichwMin; - int ichwNextContextMin = ichwNextMin + m_psegNext->m_ichwAssocsMin; - int ichwNextAssocsMin = m_psegNext->m_ichwAssocsMin; - - // Loop over associations prepended to the beginning of the following segment - // (ie, rendered in the next segment but officially in this one); - // ichwThis and ichwNext are relative to the start of their respective segments. - for (int ichwNext = cchwNextAssocsMin; ichwNext < 0; ++ichwNext) - { - int ichwThis = ichwNext + (m_ichwLim - m_ichwMin); - if (m_psegNext->m_prgisloutAfter[ichwNext - ichwNextAssocsMin] > kNegInfinity) - // The "after" value is in the next segment, so make this segment's - // after value invalid. - m_prgisloutAfter[ichwThis - m_ichwAssocsMin] = kPosInfinity; - } - - // Loop over associations appended to the end of this segment - // (ie, rendered in this segment but officially in the next one); - // ichwThis and ichwNext are relative to the start of their respective segments. - for (int ichwThis = m_ichwLim - m_ichwMin; ichwThis < m_cchwAssocsLim; ++ichwThis) - { - int ichwNext = ichwThis - (m_ichwLim - m_ichwMin); - if (m_psegNext->m_prgisloutAfter[ichwNext - ichwNextAssocsMin] > kNegInfinity) - // The "after" value is in the next segment, so make this segment's - // after value invalid. - m_prgisloutAfter[ichwThis - m_ichwAssocsMin] = kPosInfinity; - } -} - -#endif // -------------------------- END OF OBSOLETE CODE ---------------------------------- - - -/*---------------------------------------------------------------------------------------------- - Generate a list of all the glyphs that are attached to the base with the given index. - Note that we want to generate glyph indices, not slot indices. - - @param disloutCluster - indicates how far on either side of the base to look. -----------------------------------------------------------------------------------------------*/ -void Segment::ClusterMembersForGlyph(int isloutBase, int disloutCluster, - std::vector & visloutRet) -{ - for (int islout = max(0, isloutBase - disloutCluster); - islout < min(m_cslout, isloutBase + disloutCluster + 1); - islout++) - { - if (islout == isloutBase) - continue; // don't include the base itself - GrSlotOutput * pslout = m_prgslout + islout; - if (pslout->ClusterBase() == isloutBase) - { - visloutRet.push_back(islout); - } - } -} - -/*---------------------------------------------------------------------------------------------- - Record an underlying-to-surface association mapping, based on the fact that there is - a corresponding surface-to-underlying association in the streams. - - @param ichwUnder - character index relative to the official beginning of the segment - @param islotSurface - surface glyph it maps to -----------------------------------------------------------------------------------------------*/ -void Segment::RecordSurfaceAssoc(int ichwUnder, int islotSurface, int nDir) -{ - // If we are recording an association across the line boundary, make sure there - // is space for it. - EnsureSpaceAtLineBoundaries(ichwUnder); - - // For left-to-right chars, the before-value is the minimum of the previous - // and new values, and the after-value is the maximum. - if (nDir % 2 == 0) - { - // left-to-right - m_prgisloutBefore[ichwUnder - m_ichwAssocsMin] = - min(m_prgisloutBefore[ichwUnder - m_ichwAssocsMin], islotSurface); - m_prgisloutAfter[ ichwUnder - m_ichwAssocsMin] = - max(m_prgisloutAfter[ ichwUnder - m_ichwAssocsMin], islotSurface); - } - else - { - // right-to-left: the before-value is the max and the after-value is the min - m_prgisloutBefore[ichwUnder - m_ichwAssocsMin] = - max(m_prgisloutBefore[ichwUnder - m_ichwAssocsMin], islotSurface); - m_prgisloutAfter[ ichwUnder - m_ichwAssocsMin] = - min(m_prgisloutAfter[ ichwUnder - m_ichwAssocsMin], islotSurface); - } - - m_prgpvisloutAssocs[ichwUnder - m_ichwAssocsMin]->push_back(islotSurface); -} - -/*---------------------------------------------------------------------------------------------- - Record an underlying-to-surface ligature mapping, based on the fact that there is - a component.ref attribute in the surface stream. Note that if there was a previous - ligature value there, it will be overwritten. - - @param ichwUnder - character index relative to the official beginning of the segment - @param islotSurface - surface glyph it maps to - @param iComponent - which component this glyph represents -----------------------------------------------------------------------------------------------*/ -void Segment::RecordLigature(int ichwUnder, int islotSurface, int iComponent) -{ - // If we are recording a mapping across the line boundary, make sure there - // is space for it. - EnsureSpaceAtLineBoundaries(ichwUnder); - - Assert(m_prgisloutLigature[ichwUnder - m_ichwAssocsMin] == kNegInfinity); - - m_prgisloutLigature[ichwUnder - m_ichwAssocsMin] = islotSurface; - Assert(iComponent < kMaxComponentsPerGlyph); - m_prgiComponent[ ichwUnder - m_ichwAssocsMin] = sdata8(iComponent); -} - -/*---------------------------------------------------------------------------------------------- - The given slot is one that is rendered in the previous segment. - If it is associated with a character officially in this segment, mark the - before-association kNegInfinity. - - @param ichwUnder - character index relative to the official beginning of the segment - @param islot - processed glyph it maps to -----------------------------------------------------------------------------------------------*/ -void Segment::MarkSlotInPrevSeg(int ichwUnder, int islot) -{ - if (ichwUnder >= m_ichwAssocsMin) - m_prgisloutBefore[ichwUnder - m_ichwAssocsMin] = kNegInfinity; -} - -/*---------------------------------------------------------------------------------------------- - The given slot is one that is rendered in the following segment. - If it is associated with a character officially in this segment, mark the - after-association kPosInfinity. - - @param ichwUnder - character index relative to the official beginning of the segment - @param islot - processed glyph it maps to -----------------------------------------------------------------------------------------------*/ -void Segment::MarkSlotInNextSeg(int ichwUnder, int islot) -{ - if (ichwUnder < m_ichwAssocsLim) - m_prgisloutAfter[ichwUnder - m_ichwAssocsMin] = kPosInfinity; -} - -/*---------------------------------------------------------------------------------------------- - If we are recording an association across the line boundary (in either direction), - make sure there is space for it. This involves adding space to the beginning or - the end of the association arrays, and adjusting the min and lim indicators. -----------------------------------------------------------------------------------------------*/ -void Segment::EnsureSpaceAtLineBoundaries(int ichwUnder) -{ - int cchwNewMin = min(ichwUnder, m_ichwAssocsMin); - int cchwNewLim = max(ichwUnder+1, m_ichwAssocsLim); - if (cchwNewMin < m_ichwAssocsMin || cchwNewLim > m_ichwAssocsLim) - { - // Make space either at the beginning or the end of the arrays. - int cchwPreAdd = m_ichwAssocsMin - cchwNewMin; - int cchwPostAdd = cchwNewLim - m_ichwAssocsLim; - - int * prgisloutTmp = m_prgisloutBefore; - m_prgisloutBefore = new int[cchwNewLim - cchwNewMin]; - std::copy(prgisloutTmp, prgisloutTmp + (m_ichwAssocsLim - m_ichwAssocsMin), - m_prgisloutBefore + cchwPreAdd); - delete[] prgisloutTmp; - - prgisloutTmp = m_prgisloutAfter; - m_prgisloutAfter = new int[cchwNewLim - cchwNewMin]; - std::copy(prgisloutTmp, prgisloutTmp + (m_ichwAssocsLim - m_ichwAssocsMin), - m_prgisloutAfter + cchwPreAdd); - delete[] prgisloutTmp; - - std::vector ** ppvisloutTmp = m_prgpvisloutAssocs; - m_prgpvisloutAssocs = new std::vector * [cchwNewLim - cchwNewMin]; - std::swap_ranges(m_prgpvisloutAssocs + cchwPreAdd, - m_prgpvisloutAssocs + cchwPreAdd + - (m_ichwAssocsLim - m_ichwAssocsMin), ppvisloutTmp); - delete[] ppvisloutTmp; - - prgisloutTmp = m_prgisloutLigature; - m_prgisloutLigature = new int[cchwNewLim - cchwNewMin]; - std::copy(prgisloutTmp, prgisloutTmp + (m_ichwAssocsLim - m_ichwAssocsMin), - m_prgisloutLigature + cchwPreAdd); - delete[] prgisloutTmp; - - sdata8 * prgiCompTmp = m_prgiComponent; - m_prgiComponent = new sdata8[cchwNewLim - cchwNewMin]; - std::copy(prgiCompTmp, prgiCompTmp + (m_ichwAssocsLim - m_ichwAssocsMin), - m_prgiComponent + cchwPreAdd); - delete[] prgiCompTmp; - - // Initialize new slots. - int i; - for (i = 0; i < cchwPreAdd; ++i) - { - m_prgisloutBefore[i] = kPosInfinity; - m_prgisloutAfter[i] = kNegInfinity; - m_prgpvisloutAssocs[i] = new std::vector; - m_prgisloutLigature[i] = kNegInfinity; - m_prgiComponent[i] = 0; - } - for (i = m_ichwAssocsLim - m_ichwAssocsMin + cchwPreAdd; - i < m_ichwAssocsLim - m_ichwAssocsMin + cchwPreAdd + cchwPostAdd; - ++i) - { - m_prgisloutBefore[i] = kPosInfinity; - m_prgisloutAfter[i] = kNegInfinity; - m_prgpvisloutAssocs[i] = new std::vector; - m_prgisloutLigature[i] = kNegInfinity; - m_prgiComponent[i] = 0; - } - m_ichwAssocsMin = cchwNewMin; - m_ichwAssocsLim = cchwNewLim; - } -} - -/*---------------------------------------------------------------------------------------------- - Return the given output slot. -----------------------------------------------------------------------------------------------*/ -GrSlotOutput * Segment::OutputSlot(int islout) -{ - return m_prgslout + islout; -} - -/*---------------------------------------------------------------------------------------------- - Set the rendering engine to the current one. -----------------------------------------------------------------------------------------------*/ -void Segment::SetEngine(GrEngine * pgreng) -{ - //if (m_preneng) - // m_preneng->DecRefCount(); - m_preneng = pgreng; - //if (m_preneng) - // m_preneng->IncRefCount(); -} - -/*---------------------------------------------------------------------------------------------- - Set the font. -----------------------------------------------------------------------------------------------*/ -void Segment::SetFont(Font * pfont) -{ - m_pfont = pfont->copyThis(); - -// m_fBold = pfont->bold(); -// m_fItalic = pfont->italic(); - // Note that we store the character height (which does not include the internal leading), - // not the actual font height, ie, ascent + descent. This is what is used in the LOGFONT. - pfont->getFontMetrics(NULL, NULL, &m_xysEmSquare); // m_xysEmSquare = m_pixHeight -} - -/*---------------------------------------------------------------------------------------------- - Switch the font out. - ??? Do we need to change the member variables too? -----------------------------------------------------------------------------------------------*/ -void Segment::SwitchFont(Font * pfont) -{ - m_pfont = pfont; -} - -/*---------------------------------------------------------------------------------------------- - Return the engine implementation if it is a proper GrEngine, or NULL otherwise. -----------------------------------------------------------------------------------------------*/ -GrEngine * Segment::EngineImpl() -{ - return m_preneng; -} - -/*---------------------------------------------------------------------------------------------- - Set the justification agent, in case this segment will ever need to be stretched - or shrunk. -----------------------------------------------------------------------------------------------*/ -void Segment::SetJustifier(IGrJustifier * pgjus) -{ - m_pgjus = pgjus; - //if (pgjus) - // pgjus->JustifierObject(&m_pgjus); - //else - // m_pgjus = NULL; -} - -/*---------------------------------------------------------------------------------------------- - Set the graphics object to use the base font. -----------------------------------------------------------------------------------------------*/ -//void Segment::SetToBaseFont(IGrGraphics * pgg) -//{ -// if (m_fUseSepBase) -// EngineImpl()->SwitchGraphicsFont(pgg, true); -//} - -/*---------------------------------------------------------------------------------------------- - Restore the graphics object to use the font that it originally had when passed in to - the interface method. -----------------------------------------------------------------------------------------------*/ -//void Segment::RestoreFont(IGrGraphics * pgg) -//{ -// if (m_fUseSepBase) -// EngineImpl()->SwitchGraphicsFont(pgg, false); -//} - -/*---------------------------------------------------------------------------------------------- - Given a logical surface location, return the underlying position (relative to the - beginning of the string). NOTE that we are returning the index of the closest charater - (plus an indication of which side the click was on), not a position between characters. - - @param islout - output slot - @param xsOffset - x coordinate of physical click, relative to left of glyph; - kPosInfinity means all the way to the right; - kNegInfinity means all the way to the left - @param ysOffset - y coordinate of physical click, relative to TOP of segment (NOT - upwards from baseline); kPosInfinity means all the way at - the top; kNegInfinity means all the way at the bottom - @param dxsGlyphWidth - width of glyph clicked on, or 0 if irrelevant - @param dysGlyphHeight - actually line height -- CURRENTLY NOT USED - @param pfAfter - return true if they clicked on trailing side; possibly NULL -----------------------------------------------------------------------------------------------*/ -int Segment::LogicalSurfaceToUnderlying(int islout, float xsOffset, float ysClick, - float dxsGlyphWidth, float dysGlyphHeight, bool * pfAfter) -{ - Assert(islout >= 0); - Assert(islout < m_cslout); - - GrSlotOutput * pslout = OutputSlot(islout); - bool fGlyphRtl = SlotIsRightToLeft(pslout); - - int dichw; - bool fAfter, fRight; - - float ysForGlyph = pslout->YPosition(); - - float dysFontAscent = m_dysFontAscent; - ////GrResult res = GetFontAscentSourceUnits(pgg, &dysFontAscent); - ////if (ResultFailed(res)) - //// THROW(WARN(res)); - dysFontAscent += m_dysXAscent; - - float dysOffset = ysClick - (m_dysAscent - dysFontAscent); // relative to top of 0-baseline text - - // If the slot has components, see if the offset falls within one of them. - - if (pslout->NumberOfComponents() > 0) - { - GrEngine * pgreng = EngineImpl(); - if (!pgreng) - goto LNotLigature; - - GrGlyphTable * pgtbl = pgreng->GlyphTable(); - - for (int icomp = 0; icomp < pslout->NumberOfComponents(); icomp++) - { - float xsLeft, xsRight, ysTop, ysBottom; - - // TODO: Rework ComponentIndexForGlyph to take slati rather than iForGlyph. - int slati = pslout->ComponentId(icomp); - int iForGlyph = pgtbl->ComponentIndexForGlyph(pslout->GlyphID(), slati); - if (!pgtbl->ComponentBoxLogUnits(m_xysEmSquare, pslout->GlyphID(), iForGlyph, - m_mFontEmUnits, m_dysAscent, - &xsLeft, &ysTop, &xsRight, &ysBottom)) - { - continue; // component not defined - } - Assert(xsLeft <= xsRight); - Assert(ysTop <= ysBottom); - if (xsOffset < xsLeft || xsOffset > xsRight) - continue; - if ((dysOffset - ysForGlyph) < ysTop || (dysOffset - ysForGlyph) > ysBottom) - continue; - - // Click was within the component's box. - - fRight = (xsOffset - xsLeft > xsRight - xsOffset); - fAfter = (fGlyphRtl) ? !fRight : fRight; - if (pfAfter) - *pfAfter = fAfter; - - if (fAfter) - dichw = pslout->LastUnderlyingComponent(icomp); - else - dichw = pslout->FirstUnderlyingComponent(icomp); - Assert(m_ichwMin + dichw >= 0); - Assert(dichw < m_dichwLim); - - Assert(GrCharStream::AtUnicodeCharBoundary(m_pgts, m_ichwMin + dichw)); - - return m_ichwMin + dichw; - } - } - -LNotLigature: - - // No relevant ligature component. - // If the x-offset is less than half way across, - // answer the before-association; otherwise answer the after-association. - - if (xsOffset == kPosInfinity) - fRight = true; - else if (xsOffset == kNegInfinity) - fRight = false; - else - fRight = (xsOffset > (dxsGlyphWidth / 2)); - - fAfter = (fGlyphRtl) ? !fRight : fRight; - - int diCharAdj = 0; - if (fAfter) - { - dichw = pslout->AfterAssoc(); - if (pfAfter) - *pfAfter = true; - // The following should not be necessary because of the way associations are set up: - //while (!GrCharStream::AtUnicodeCharBoundary(m_pgts, ichwBase + dichw + diCharAdj)) - // diCharAdj++; - } - else - { - dichw = pslout->BeforeAssoc(); - if (pfAfter) - *pfAfter = false; - // The following should not be necessary because of the way associations are set up: - //while (!GrCharStream::AtUnicodeCharBoundary(m_pgts, ichwBase + dichw + diCharAdj)) - // diCharAdj--; - } - - if (dichw == kNegInfinity || dichw == kPosInfinity) - return dichw; - - // This should be true because of the way the associations are set up: - Assert(GrCharStream::AtUnicodeCharBoundary(m_pgts, m_ichwMin + dichw)); // + diCharAdj)); - - return m_ichwMin + dichw + diCharAdj; -} - -/*--------------------------------------------------------------------------------------------*/ - -int Segment::LogicalSurfaceToUnderlying(int islout, bool fBefore) -{ - if (fBefore) - return LogicalSurfaceToUnderlying(islout, kNegInfFloat, kNegInfFloat); - else - return LogicalSurfaceToUnderlying(islout, kPosInfFloat, kPosInfFloat); -} - -/*---------------------------------------------------------------------------------------------- - Given a physical surface location (an index into the glyph boxes), - return the underlying position, relative to the beginning of the string. - - @param igbb - index of glyph - @param xsOffset - relative to left side of glyph - @param ysOffset - downwards from top of segment (not upwards from baseline) -----------------------------------------------------------------------------------------------*/ -int Segment::PhysicalSurfaceToUnderlying( - int iginf, float xsOffset, float ysOffset, - float dxsGlyphWidth, float dysGlyphHeight, bool * pfAfter) -{ - int islout = iginf + m_isloutGinf0; - return LogicalSurfaceToUnderlying(islout, xsOffset, ysOffset, - dxsGlyphWidth, dysGlyphHeight, pfAfter); -} - -/*--------------------------------------------------------------------------------------------*/ - -int Segment::PhysicalSurfaceToUnderlying(int iginf, bool fBefore) -{ - int islout = iginf + m_isloutGinf0; - bool fGlyphRtl = SlotIsRightToLeft(OutputSlot(islout)); - if (fBefore == fGlyphRtl) - return PhysicalSurfaceToUnderlying(iginf, kPosInfFloat, kPosInfFloat); - else - return PhysicalSurfaceToUnderlying(iginf, kNegInfFloat, kNegInfFloat); -} - -/*---------------------------------------------------------------------------------------------- - Given an underlying position (relative to the beginning of the string), - return the logical surface location (ignoring right-to-left). - NOTE that ichw indicates a CHARACTER, not a location between characters. So ichw = 3, - fBefore = false indicates a selection between characters 3 and 4. - For surrogates, it indicates the FIRST of the pair of 16-bit chars. -----------------------------------------------------------------------------------------------*/ -int Segment::UnderlyingToLogicalSurface(int ichw, bool fBefore) -{ - int ichwSegOffset = ichw - m_ichwMin; - - if (ichwSegOffset < m_ichwAssocsMin) - return kNegInfinity; // probably rendered in previous segment - - - // if the buffers aren't even allocated, then it probably means there - // wasn't room for any glyphs, so the following segment is most likely -// else if (ichwSegOffset >= m_ichwAssocsLim) - else if (ichwSegOffset >= m_ichwAssocsLim || !m_prgisloutBefore || !m_prgisloutAfter) - return kPosInfinity; // probably rendered in following segment - - else if (fBefore) - { - int isloutRet; - int ichw = ichwSegOffset; - // If no association has been made, loop forward to the next slot - // we are before. As a last resort, answer kPosInfinity, meaning we - // aren't before anything. - do - { - isloutRet = m_prgisloutBefore[ichw - m_ichwAssocsMin]; - do { ++ichw; } - while (!GrCharStream::AtUnicodeCharBoundary(m_pgts, ichw)); - } while (isloutRet == kPosInfinity && ichw < m_ichwAssocsLim); - return isloutRet; - } - else - { - int isloutRet; - int ichw = ichwSegOffset; - // If no association has been made, loop backward to the previous slot - // we are after. As a last resort, answer kNegInfinity, meaning we - // aren't after anything. - do - { - isloutRet = m_prgisloutAfter[ichw - m_ichwAssocsMin]; - do { --ichw; } - while (!GrCharStream::AtUnicodeCharBoundary(m_pgts, ichw)); - } while (isloutRet == kNegInfinity && ichw >= 0); - return isloutRet; - } - Assert(false); // should never reach here -} - -/*---------------------------------------------------------------------------------------------- - Given an underlying position (relative to the beginning of the string), - return the physical surface location, the index into m_prgginf. -----------------------------------------------------------------------------------------------*/ -int Segment::UnderlyingToPhysicalSurface(int ichw, bool fBefore) -{ - int islout = UnderlyingToLogicalSurface(ichw, fBefore); - return LogicalToPhysicalSurface(islout); -} - -/*---------------------------------------------------------------------------------------------- - Given a logical position (index into output slots), return the physical position, - the index into the list of glyphs (m_prgginf). -----------------------------------------------------------------------------------------------*/ -int Segment::LogicalToPhysicalSurface(int islout) -{ - if (islout == kNegInfinity || islout == kPosInfinity) - return islout; - - Assert(m_prgginf[islout - m_isloutGinf0].logicalIndex() == (unsigned)(islout - m_isloutGinf0)); - - return islout - m_isloutGinf0; -} - -/*---------------------------------------------------------------------------------------------- - Given an underlying position (relative to the beginning of the string), - return the physical surface locations of all the associated surface glyphs. - OBSOLETE -----------------------------------------------------------------------------------------------*/ -#if 0 -void Segment::UnderlyingToPhysicalAssocs(int ichw, std::vector & viginf) -{ - int ichwSegOffset = ichw - m_ichwMin; - - if (ichwSegOffset < m_ichwAssocsMin) - return; // possibly rendered in previous segment - - else if (ichwSegOffset >= m_ichwAssocsLim) - return; // possibly rendered in following segment - - else - { - std::vector * pvisloutTmp = &(m_prgvisloutAssocs[ichwSegOffset - m_ichwAssocsMin]); - - for (size_t i = 0; i < pvisloutTmp->size(); i++) - { - int islout = (*pvisloutTmp)[i]; - Assert(islout != kNegInfinity); - Assert(islout != kPosInfinity); - viginf.push_back(LogicalToPhysicalSurface(islout)); - } - } -} -#endif - -/*---------------------------------------------------------------------------------------------- - Given an underlying character position (relative to the beginning of the string), - return a pointer to the vector containing the logical surface locations of - all the associated surface glyphs. - - Returns an empty vector (not something containing infinities) if the character is - "invisible." -----------------------------------------------------------------------------------------------*/ -std::vector Segment::UnderlyingToLogicalAssocs(int ichw) -{ - std::vector vnEmpty; - vnEmpty.clear(); - Assert(vnEmpty.size() == 0); - - int ichwSegOffset = ichw - m_ichwMin; - - if (ichwSegOffset < m_ichwAssocsMin) - return vnEmpty; // probably rendered in previous segment - - else if (ichwSegOffset >= m_ichwAssocsLim) - return vnEmpty; // probably rendered in following segment - - else if (m_prgpvisloutAssocs[ichwSegOffset - m_ichwAssocsMin] == NULL) - { - // Create a vector using the before and after values. - std::vector visloutRet; - int isloutBefore = m_prgisloutBefore[ichwSegOffset - m_ichwAssocsMin]; - int isloutAfter = m_prgisloutAfter[ichwSegOffset - m_ichwAssocsMin]; - if (isloutBefore != kPosInfinity && isloutBefore != kNegInfinity) - visloutRet.push_back(isloutBefore); - if (isloutAfter != kPosInfinity && isloutAfter != kNegInfinity && isloutBefore != isloutAfter) - { - visloutRet.push_back(isloutAfter); - } - return visloutRet; - } - else - { - std::vector * pvisloutRet = m_prgpvisloutAssocs[ichwSegOffset - m_ichwAssocsMin]; - return *pvisloutRet; - } -} - -/*---------------------------------------------------------------------------------------------- - Given an underlying character position (relative to the beginning of the string), - return an index of a slot in this segment that can used to test things like - InsertBefore. Don't return kNegInfinity or kPosInfinity except as a last resort. -----------------------------------------------------------------------------------------------*/ -int Segment::UnderlyingToLogicalInThisSeg(int ichw) -{ - int isloutTest = kNegInfinity; - std::vector vislout = UnderlyingToLogicalAssocs(ichw); - for (size_t iislout = 0; iislout < vislout.size(); iislout++) - { - isloutTest = vislout[iislout]; - if (isloutTest != kNegInfinity && isloutTest != kPosInfinity) - return isloutTest; - } - return isloutTest; -} - -/*---------------------------------------------------------------------------------------------- - Return true if the two characters map to exactly the same set of glyphs. -----------------------------------------------------------------------------------------------*/ -bool Segment::SameSurfaceGlyphs(int ichw1, int ichw2) -{ - std::vector vislout1 = UnderlyingToLogicalAssocs(ichw1); - std::vector vislout2 = UnderlyingToLogicalAssocs(ichw2); - - bool fRet = true; - if (vislout1.size() == 0 || vislout2.size() == 0) - fRet = false; - else if (vislout1.size() != vislout2.size()) - fRet = false; - else - { - for (size_t islout = 0; islout < vislout1.size(); islout++) - { - if (vislout1[islout] != vislout2[islout]) - { - fRet = false; - break; - } - } - } - return fRet; -} - -/*---------------------------------------------------------------------------------------------- - Return the direction level of the given character. -----------------------------------------------------------------------------------------------*/ -int Segment::DirLevelOfChar(int ichw, bool fBefore) -{ - if (m_twsh == ktwshOnlyWs) - return m_nDirDepth; - int islot = UnderlyingToLogicalSurface(ichw, fBefore); - if (islot == kNegInfinity || islot == kPosInfinity) - return 0; - int nDir = OutputSlot(islot)->DirLevel(); - if (nDir == -1) - // Not calculated: assume to be the top direction level. - nDir = TopDirLevel(); - - return nDir; -} - -/*---------------------------------------------------------------------------------------------- - Return whether the given character is right-to-left. -----------------------------------------------------------------------------------------------*/ -int Segment::CharIsRightToLeft(int ichw, bool fBefore) -{ - int nDir = DirLevelOfChar(ichw, fBefore); - return ((nDir % 2) != 0); -} - -/*---------------------------------------------------------------------------------------------- - Return whether the given slot is right-to-left. -----------------------------------------------------------------------------------------------*/ -int Segment::SlotIsRightToLeft(GrSlotOutput * pslout) -{ - if (m_twsh == ktwshOnlyWs) - return (m_nDirDepth % 2); - int nDir = pslout->DirLevel(); - if (nDir == -1) - nDir = TopDirLevel(); - return (nDir % 2); -} - -/*---------------------------------------------------------------------------------------------- - Check to make sure that the attachments are valid. Specifically, for every glyph that - is part of a cluster, all glyphs between that glyph and its root must (ultimately) have - that root glyph as one of its roots. - OBSOLETE -----------------------------------------------------------------------------------------------*/ -void Segment::AssertValidClusters(GrSlotStream * psstrm) -{ -#ifdef _DEBUG - for (int islot = 0; islot < psstrm->WritePos(); islot++) - { - GrSlotState * pslotThis = psstrm->SlotAt(islot); - GrSlotState * pslotRoot = pslotThis->AttachRoot(psstrm); - if (!pslotRoot) - continue; - Assert(pslotRoot != pslotThis); - - int inc = (pslotThis->PosPassIndex() > pslotRoot->PosPassIndex()) ? -1 : 1; - - for (int islot2 = pslotThis->PosPassIndex() + inc; - islot2 != pslotRoot->PosPassIndex(); - islot2 += inc) - { - GrSlotState * pslotMid = psstrm->SlotAt(islot2); - Assert(pslotMid->HasAsRoot(psstrm, pslotRoot)); - } - } -#endif // _DEBUG -} - -/*---------------------------------------------------------------------------------------------- - Return information about (editing) clusters as appropriate for Uniscribe, ie, consistent - with the ScriptShape funciton. - A cluster includes all attachments, all clumps of characters created by insert = false, - and clumps of reordered glyphs. - - prgiginfFirstOfCluster returns the first glyph of the cluster for each CHARACTER - (glyph indices returned are zero-based and refer to physical order--left-to-right, etc.). - pfClusterStart returns a flag for each GLYPH indicating whether it is the first (left-most) - of a cluster. - Both arrays are optional. - CORRECTION: for now we use strictly logical order. It's not clear whether physical - order is needed for right-to-left text or not. See note below. - - TODO: convert from GlyphInfo objects which are RTL. -----------------------------------------------------------------------------------------------*/ -GrResult Segment::getUniscribeClusters( - int * prgiginfFirstOfCluster, int cchMax, int * pcch, - bool * pfClusterStart, int cfMax, int * pcf) -{ - ChkGrOutPtr(pcch); - if (prgiginfFirstOfCluster) - ChkGrArrayArg(prgiginfFirstOfCluster, cchMax); - ChkGrOutPtr(pcf); - if (pfClusterStart) - ChkGrArrayArg(pfClusterStart, cfMax); - - GrResult res = kresOk; - - //SetUpGraphics(ichwBase, pgg, true); - - if (m_dxsWidth == -1) - ComputeDimensions(); - - Assert(m_dxsWidth >= 0); - Assert(m_dysAscent >= 0); - - if (pcch) - *pcch = m_dichwLim; - if (pcf) - *pcf = m_cginf; - if (cchMax < m_dichwLim) - { - if (cchMax == 0 && cfMax == 0) - res = kresFalse; // just asking for size information - else if (prgiginfFirstOfCluster || cchMax > 0) - res = kresInvalidArg; // not enough space - } - if (cfMax < m_cginf) - { - if (cchMax == 0 && cfMax == 0) - res = kresFalse; - else if (pfClusterStart || cfMax > 0) - res = kresInvalidArg; - } - if (res != kresOk) - { - //RestoreFont(pgg); - ReturnResult(res); - } - - // Generate a pair of arrays, indicating the first and last (logical) slots - // of the cluster for each character. Initially clusters are based just on - // character-to-glyph associations, but they expand as we process - // insert=false settings, attachments, and reordering. - - std::vector visloutBefore; - std::vector visloutAfter; - visloutBefore.resize(m_dichwLim); - visloutAfter.resize(m_dichwLim); - - int ich; - for (ich = 0; ich < m_dichwLim; ich++) - { - visloutBefore[ich] = m_prgisloutBefore[ich - m_ichwAssocsMin]; - visloutAfter[ich] = m_prgisloutAfter[ich - m_ichwAssocsMin]; - } - - if (m_dichwLim == 1) - { - // Only one character, therefore only one cluster. - visloutBefore[0] = m_isloutGinf0; - visloutAfter[0] = max(m_cginf - 1, 0) + m_isloutGinf0; - } - else - { - // Make all glyphs attached to each other part of a cluster, or glyphs where - // insertion is not allowed. - for (ich = 0; ich < m_dichwLim; ich++) - { - std::vector vislout = UnderlyingToLogicalAssocs(ich + m_ichwMin); - - if (vislout.size() == 0) - { - // No glyphs represent this character. Merge it with the previous - // character. - visloutBefore[ich] = (ich == 0) ? visloutBefore[ich + 1] : visloutBefore[ich - 1]; - visloutAfter[ich] = (ich == 0) ? visloutAfter[ich + 1] : visloutAfter[ich - 1]; - continue; - } - - size_t iislout; - for (iislout = 0; iislout < vislout.size(); iislout++) - { - int islout = vislout[iislout]; - if (!m_prgslout[islout].InsertBefore()) - { - // This glyph does not allow insertion before it; make its character part - // of the same cluster as the previous character. - MergeUniscribeCluster(visloutBefore, visloutAfter, ich - 1, ich); -/* -+ // Keith Stribley's fix: -+ // NOTE: this is NOT always the same as the previous character, so -+ // check whether the next character actually has a glyph before this -+ // one -+ if ((ich == m_dichwLim - 1) || -+ (std::min(visloutBefore[ich + 1], visloutAfter[ich + 1]) > -+ std::max(visloutBefore[ich], visloutAfter[ich]))) -+ { -+ MergeUniscribeCluster(visloutBefore, visloutAfter, ich - 1, ich); -+ } -+ else -+ MergeUniscribeCluster(visloutBefore, visloutAfter, ich, ich + 1); -*/ - } - else if (m_prgslout[islout].ClusterBase() != -1 - && m_prgslout[islout].ClusterBase() != islout) - { - // This glyph is attached to something; make them part of the same cluster. - int isloutBase = m_prgslout[islout].ClusterBase(); - int ichBase = LogicalSurfaceToUnderlying(isloutBase, false) - m_ichwMin; - MergeUniscribeCluster(visloutBefore, visloutAfter, - ich, ichBase); - int ichBase1 = LogicalSurfaceToUnderlying(isloutBase, false) - m_ichwMin; - if (ichBase1 != ichBase) - MergeUniscribeCluster(visloutBefore, visloutAfter, - ich, ichBase1); - } - } - } - - // Handle reordering. Whenever the islout values get out of order, we need to - // merge into a single cluster. - for (ich = 0; ich < m_dichwLim - 1; ich++) - { - Assert(visloutBefore[ich] <= visloutAfter[ich]); - Assert(visloutBefore[ich] != kPosInfinity); - Assert(visloutBefore[ich] != kNegInfinity); - Assert(visloutAfter[ich] != kPosInfinity); - Assert(visloutAfter[ich] != kNegInfinity); - const int b1 = visloutBefore[ich]; - const int a1 = visloutAfter[ich]; - const int b2 = visloutBefore[ich + 1]; - const int a2 = visloutAfter[ich + 1]; - if (b1 == b2 && a1 == a2) - continue; // already a cluster - - if (std::min(b2, a2) <= std::max(b1, a1)) - { - MergeUniscribeCluster(visloutBefore, visloutAfter, ich, ich + 1); - } - } - } - - if (pfClusterStart) - { - // Initialize. - int iginf; - for (iginf = 0; iginf < m_cginf; iginf++) - pfClusterStart[iginf] = false; - } - - // To skip line-break slots; remember that the number of output slots equals the - // number of gbbs plus initial and/or final line-break slots if any. - // In this case the beginning of the first cluster indicates the first real glyph. - int isloutFirstReal = (m_dichwLim) ? ((m_fWsRtl)? visloutAfter[0] : visloutBefore[0]) : 0; - - // Kludge to make assertions below easier: - if (m_dichwLim > 0) - { - visloutBefore.push_back(visloutAfter.back() + 1); - visloutAfter.push_back(visloutAfter.back() + 1); - } - - // Convert (logical) slots to actual glyphs. - for (ich = 0; ich < m_dichwLim; ich++) - { - // NOTE: to treat the first of the cluster as the left-most, use visloutAfter for - // right-to-left situations. - - if (prgiginfFirstOfCluster) - prgiginfFirstOfCluster[ich] - = LogicalToPhysicalSurface((m_fWsRtl) ? visloutAfter[ich] : visloutBefore[ich]); - int clusterStartPos = ((m_fWsRtl) ? visloutAfter[ich] : visloutBefore[ich]) - isloutFirstReal; - if (pfClusterStart) - pfClusterStart[clusterStartPos] = true; - - Assert((visloutBefore[ich] == visloutBefore[ich + 1] && - visloutAfter[ich] == visloutAfter[ich + 1]) - || (visloutBefore[ich] <= visloutAfter[ich] && - visloutAfter[ich] < visloutBefore[ich + 1])); - } - - //RestoreFont(pgg); - - return kresOk; -} - - -// suppress GCC 4.3 warning for optimized min()/max() when called with (ich, ich+1) or similar -#pragma GCC diagnostic ignored "-Wstrict-overflow" - -/*---------------------------------------------------------------------------------------------- - Merge the given characters into the same Uniscribe cluster. This means merging any - intervening characters as well. -----------------------------------------------------------------------------------------------*/ -void Segment::MergeUniscribeCluster( - std::vector & visloutBefore, std::vector & visloutAfter, - int ich1, int ich2) -{ - int ichStartOrig = min(ich1, ich2); - int ichStopOrig = max(ich1, ich2); - - int isloutMin = visloutBefore[ichStopOrig]; - int isloutMax = visloutAfter[ichStartOrig]; - - int ichStart = ichStopOrig; - int ichStop = ichStartOrig; - // Find the beginning of the cluster. - while (ichStart > 0 && - (ichStart > ichStartOrig - || visloutBefore[ichStart - 1] >= visloutBefore[ichStopOrig] - || visloutBefore[ichStart - 1] == visloutBefore[ichStart])) - { - ichStart--; - isloutMin = std::min(isloutMin, visloutBefore[ichStart]); - isloutMax = std::max(isloutMax, visloutAfter[ichStart]); - } - // Find end of cluster. - while (ichStop < m_dichwLim - 1 && - (ichStop < ichStopOrig - || visloutAfter[ichStop + 1] <= visloutAfter[ichStartOrig] - || visloutAfter[ichStop + 1] == visloutAfter[ichStop])) - { - ichStop++; - isloutMin = std::min(isloutMin, visloutBefore[ichStop]); - isloutMax = std::max(isloutMax, visloutAfter[ichStop]); - } - - int ich; - for (ich = ichStart; ich <= ichStop; ich++) - { - visloutBefore[ich] = isloutMin; - visloutAfter[ich] = isloutMax; - } -} - -/*---------------------------------------------------------------------------------------------- - Return information about the positioning of glyphs as appropriate for Uniscribe. - The advance widths returned are the natural ones (what would be applied if no smart - rendering were happening), and the x-offsets are the difference between the - natural location of the glyph and what is produced by Graphite. The y-offset - is the same as GetGlyphsAndPositions. - - This is an experimental method. Its behavior may change signficantly in the future. -----------------------------------------------------------------------------------------------*/ -/* -GrResult Segment::GetUniscribePositions( - Rect rs, Rect rd, int cgidMax, int *pcgidRet, - float * prgxd, float * prgyd, float * prgdxdAdv) -{ - ChkGrOutPtr(pcgidRet); - ChkGrArrayArg(prgxd, cgidMax); - ChkGrArrayArg(prgyd, cgidMax); - ChkGrArrayArg(prgdxdAdv, cgidMax); - - GrResult res; - - //SetUpGraphics(ichBase, pgg, true); - - Assert(m_dxsWidth >= 0); - Assert(m_dysAscent >= 0); - - *pcgidRet = m_cginf; - if (cgidMax < m_cginf) - { - res = (cgidMax == 0) ? kresFalse : kresInvalidArg; - //RestoreFont(pgg); - ReturnResult(res); - } - - if (m_dxsWidth < 0) - ComputeDimensions(); - - float * rgxdTmp = new float[cgidMax]; - float * rgdxdAdvTmp = new float[cgidMax]; - res = GetGlyphsAndPositions(rs, rd, cgidMax, pcgidRet, - NULL, rgxdTmp, prgyd, rgdxdAdvTmp); - if (ResultFailed(res)) - { - delete[] rgxdTmp; - delete[] rgdxdAdvTmp; - //RestoreFont(pgg); - ReturnResult(res); - } - - float xdLeft = SegmentPainter::ScaleX(0, rs, rd); - float xdXPosNatural = xdLeft; - for (int iginf = 0; iginf < *pcgidRet; iginf++) - { - int islout = iginf + m_isloutGinf0; - GrSlotOutput * pslout = OutputSlot(islout); - float dxsAdvNatural = pslout->AdvanceXMetric(); - float dxdAdvNatural = SegmentPainter::ScaleX(dxsAdvNatural, rs, rd) - xdLeft; - prgdxdAdv[iginf] = dxdAdvNatural; - prgxd[iginf] = rgxdTmp[iginf] - xdXPosNatural; - - xdXPosNatural += dxdAdvNatural; - } - - delete[] rgxdTmp; - delete[] rgdxdAdvTmp; - - //RestoreFont(pgg); - - ReturnResult(res); - -} -*/ - -/*---------------------------------------------------------------------------------------------- - Return information about the positioning of glyphs as appropriate for Uniscribe. - The advance widths returned are the natural ones (what would be applied if no smart - rendering were happening), and the x-offsets are the difference between the - natural location of the glyph and what is produced by Graphite. The y-offset - is the same as GetGlyphsAndPositions. - - This is an experimental method. Its behavior may change signficantly in the future. -----------------------------------------------------------------------------------------------*/ -/* -GrResult Segment::GetUniscribeGlyphsAndPositions( - Rect rs, Rect rd, int cgidMax, int *pcgidRet, utf16 * prgchGlyphs, - float * prgxd, float * prgyd, float * prgdxdAdv) -{ - ChkGrOutPtr(pcgidRet); - ChkGrArrayArg(prgxd, cgidMax); - ChkGrArrayArg(prgyd, cgidMax); - ChkGrArrayArg(prgdxdAdv, cgidMax); - - GrResult res; - - //SetUpGraphics(ichBase, pgg, true); - - Assert(m_dxsWidth >= 0); - Assert(m_dysAscent >= 0); - - *pcgidRet = m_cginf; - if (cgidMax < m_cginf) - { - res = (cgidMax == 0) ? kresFalse : kresInvalidArg; - //RestoreFont(pgg); - ReturnResult(res); - } - - if (m_dxsWidth < 0) - ComputeDimensions(); - - float * rgxdTmp = new float[cgidMax]; - float * rgdxdAdvTmp = new float[cgidMax]; - res = GetGlyphsAndPositions(rs, rd, cgidMax, pcgidRet, - prgchGlyphs, rgxdTmp, prgyd, rgdxdAdvTmp); - if (ResultFailed(res)) - { - delete[] rgxdTmp; - delete[] rgdxdAdvTmp; - //RestoreFont(pgg); - ReturnResult(res); - } - - float xdLeft = SegmentPainter::ScaleX(0, rs, rd); - float xdXPosNatural = xdLeft; - for (int iginf = 0; iginf < *pcgidRet; iginf++) - { - int islout = iginf + m_isloutGinf0; - GrSlotOutput * pslout = OutputSlot(islout); - float dxsAdvNatural = pslout->AdvanceXMetric(); - float dxdAdvNatural = SegmentPainter::ScaleX(dxsAdvNatural, rs, rd) - xdLeft; - prgdxdAdv[iginf] = dxdAdvNatural; - prgxd[iginf] = rgxdTmp[iginf] - xdXPosNatural; - - xdXPosNatural += dxdAdvNatural; - } - - delete[] rgxdTmp; - delete[] rgdxdAdvTmp; - - //RestoreFont(pgg); - - ReturnResult(res); -} -*/ - -/*---------------------------------------------------------------------------------------------- - Return the visual box for the given ligature component. Return (0,0,0,0) if the component - is not defined. -----------------------------------------------------------------------------------------------*/ -Rect Segment::ComponentRect(GrSlotOutput * pslout, int icomp) -{ - Rect rectRet; - rectRet.top = rectRet.bottom = rectRet.left = rectRet.right = 0; - if (icomp < 0 || icomp > pslout->NumberOfComponents()) - return rectRet; - - GrEngine * pgreng = EngineImpl(); - if (!pgreng) - return rectRet; - GrGlyphTable * pgtbl = pgreng->GlyphTable(); - if (!pgtbl) - return rectRet; - - float xsLeft, xsRight, ysTop, ysBottom; - - // TODO: Rework ComponentIndexForGlyph to take slati rather than iForGlyph. - int slati = pslout->ComponentId(icomp); - int iForGlyph = pgtbl->ComponentIndexForGlyph(pslout->GlyphID(), slati); - if (!pgtbl->ComponentBoxLogUnits(m_xysEmSquare, pslout->GlyphID(), iForGlyph, - m_mFontEmUnits, m_dysAscent, - &xsLeft, &ysTop, &xsRight, &ysBottom, - false)) // origin is baseline - { - return rectRet; - } - rectRet.top = ysTop; - rectRet.bottom = ysBottom; - rectRet.left = xsLeft; - rectRet.right = xsRight; - - return rectRet; -} - -/*---------------------------------------------------------------------------------------------- - Shift the glyphs physically by the given amount. This happens when a right-to-left - segment is changed from being end-of-line to not, so we have to account for the fact - that the trailing white-space was previous invisible but is now visible. -----------------------------------------------------------------------------------------------*/ -void Segment::ShiftGlyphs(float dxsShift) -{ - for (int islout = 0; islout < m_cslout; islout++) - { - GrSlotOutput * pslout = OutputSlot(islout); - pslout->AdjustPosXBy(dxsShift); - } - - //ShiftGlyphsPlatform(dxsShift); -} - -/*---------------------------------------------------------------------------------------------- - Find the glyph that best matches the given click location. - - @param xsClick - relative to start of segment - @param ysClick - relative to segment baseline -----------------------------------------------------------------------------------------------*/ -int Segment::GlyphHit(float xsClick, float ysClick) -{ - float xsLeft = kPosInfFloat; - float xsRight = kNegInfFloat; - - int iginf; - for (iginf = 0; iginf < m_cginf; iginf++) - { - GlyphInfo * pginf = m_prgginf + iginf; - xsLeft = min(xsLeft, pginf->origin()); - xsRight = max(xsRight, pginf->origin() + pginf->advanceWidth()); - } - - if (xsClick < xsLeft) - return m_fWsRtl ? m_cginf - 1 : 0; - else if (xsClick > xsRight) - return m_fWsRtl ? 0 : m_cginf - 1; - - int iginfHit; - std::vector viginfNear; - std::vector viginfHit; - std::vector viginfInside; - - // Find glyph which might contain click point. - - for (iginfHit = m_cginf; iginfHit-- > 0; ) - { - if (m_fWsRtl) - { - if (m_prgginf[iginfHit].bb().right >= xsClick) - break; - } - else - { - if (m_prgginf[iginfHit].bb().left <= xsClick) - break; - } - } - if (iginfHit < 0) // click within lsb of first glyph - { - return 0; - } - - // Find all BB that OVERLAP the click point (bb.left < XClick < bb.right). - for (iginf = iginfHit; iginf >= 0; iginf--) - { - Rect rectBB = m_prgginf[iginf].bb(); - if (rectBB.left <= xsClick && xsClick <= rectBB.right) - { - viginfNear.push_back(iginf); - } - } - - // Find all BB that CONTAIN the click point (considering the click's Y coor too). - int iiginf; - for (iiginf = 0; iiginf < (int)viginfNear.size(); iiginf++) - { - Rect rectBB = m_prgginf[viginfNear[iiginf]].bb(); - if (rectBB.bottom <= ysClick && ysClick <= rectBB.top) - { - viginfHit.push_back(viginfNear[iiginf]); - } - } - - if (viginfNear.size() > 2 && viginfHit.size() == 0) - { - // No hit along y-axis; find the closest thing. - float dy = float(10000000.0); - for (int iiginf2 = 0; iiginf2 < (int)viginfNear.size(); iiginf2++) - { - Rect rectBB = m_prgginf[viginfNear[iiginf2]].bb(); - if (fabsf(rectBB.top - ysClick) < dy) - { - dy = fabsf(rectBB.top - ysClick); - viginfHit.clear(); - viginfHit.push_back(viginfNear[iiginf2]); - } - if (fabsf(rectBB.bottom - ysClick) < dy) - { - dy = fabsf(rectBB.bottom - ysClick); - viginfHit.clear(); - viginfHit.push_back(viginfNear[iiginf2]); - } - } - } - - // Find all BB for which the click is within their advance width, if any. - for (iiginf = 0; iiginf < (int)viginfHit.size(); iiginf++) - { - //Rect rectBB = m_prgginf[viginfHit[iiginf]].bb(); -- ?? this tests the bounding box again :-/ - //if (rectBB.left <= xsClick && xsClick <= rectBB.right) - gr::GlyphInfo * pginf = m_prgginf + viginfHit[iiginf]; - if (pginf->advanceWidth() == 0 // advance width is irrelevant - || (pginf->origin() < xsClick && xsClick <= pginf->origin() + pginf->advanceWidth())) - { - viginfInside.push_back(viginfHit[iiginf]); - } - } - - // If no BB coincides in any way with the click point, take the BB whose leading edge - // is closest to the click point. - // There could be more than one BB with the same leading x coor. - if (viginfHit.size() == 0 && viginfNear.size() == 0 && viginfInside.size() == 0) - { - float xsLeading; - if (iginfHit + 1 == m_cginf) - { - viginfNear.push_back(iginfHit); - } - else if (!m_fWsRtl) - { - // Left-to-right: - xsLeading = m_prgginf[iginfHit + 1].bb().left; - for (iginf = iginfHit + 1; iginf < m_cginf; iginf++) - { - if (m_prgginf[iginf].bb().left == xsLeading) - viginfNear.push_back(iginf); - } - } - else - { - // Right-to-left: - xsLeading = m_prgginf[iginfHit].bb().right; - for (iginf = iginfHit; iginf < m_cginf; iginf++) - { - if (m_prgginf[iginf].bb().right == xsLeading) - viginfNear.push_back(iginf); - } - } - } - - Assert(viginfNear.size()); - - int iginfLoc; - - // Select the BB based on its leading edge, offset from baseline, position in final pass. - if (viginfInside.size()) - iginfLoc = SelectBb(viginfInside, m_fWsRtl); - else if (viginfHit.size()) - iginfLoc = SelectBb(viginfHit, m_fWsRtl); - else - iginfLoc = SelectBb(viginfNear, m_fWsRtl); - - return iginfLoc; -} - -/*---------------------------------------------------------------------------------------------- - Select the bounding box we will use for a mouse hit. - First select any glyph with a significantly smaller bounding box. - Then, select the BB with the left-most (LTR) or right-most (RTL) edge. - If more than one BB has same edge of interest, select the one that is closest to the - the baseline. - If that is a tie, select the one with the lowest islout. - - @param vigbb - list of indexes into m_prggbb - @param fRTL - writing system direction -----------------------------------------------------------------------------------------------*/ -int Segment::SelectBb(std::vector & viginf, bool fRTL) -{ - if (!viginf.size()) - { - Assert(false); - return -1; - } - - if (viginf.size() == 1) - return viginf[0]; - - // Find a glyph that has a signficantly smaller bounding box. - // The idea is that it is going to be harder to hit than the bigger glyph. - float smallestArea = float(1000000000.0); - float largestArea = 0.0; - size_t iiginfSmallest = 0; - size_t iiginf; - for (iiginf = 0; iiginf < viginf.size(); iiginf++) - { - gr::GlyphInfo * pginf = m_prgginf + viginf[iiginf]; - Rect rectBB = pginf->bb(); - float thisArea = (rectBB.right - rectBB.left) * (rectBB.top - rectBB.bottom); - if (smallestArea > thisArea) - { - smallestArea = thisArea; - iiginfSmallest = iiginf; - } - largestArea = max(largestArea, thisArea); - } - if (smallestArea * 2.0 < largestArea) - return viginf[iiginfSmallest]; - - // Find appropriate x coor of leading edge. - float xsLeading; - if (!fRTL) - xsLeading = m_prgginf[viginf[0]].bb().left; - else - xsLeading = m_prgginf[viginf[0]].bb().right; - - for (iiginf = 1; iiginf < viginf.size(); iiginf++) - { - Rect rectBB = m_prgginf[viginf[iiginf]].bb(); - if (!fRTL) - xsLeading = min(xsLeading, rectBB.left); - else - xsLeading = max(xsLeading, rectBB.right); - } - - // Find BBs with the leading edge. - std::vector viginfSameEdge; - for (iiginf = 0; iiginf < viginf.size(); iiginf++) - { - Rect rectBB = m_prgginf[viginf[iiginf]].bb(); - if (!fRTL) - { - if (rectBB.left == xsLeading) - viginfSameEdge.push_back(viginf[iiginf]); - } - else - { - if (rectBB.right == xsLeading) - viginfSameEdge.push_back(viginf[iiginf]); - } - } - - if (viginfSameEdge.size() == 1) - return viginfSameEdge[0]; - - // Find minimum distance from baseline. - float ysMin = fabsf(m_prgginf[viginfSameEdge[0]].yOffset()); - for (iiginf = 1; iiginf < viginfSameEdge.size(); iiginf++) - { - float ysThis = fabsf(m_prgginf[viginfSameEdge[iiginf]].yOffset()); - ysMin = min(ysMin, ysThis); - } - - // Find BBs with minimum distance from baseline. - std::vector viginfSameY; - for (iiginf = 0; iiginf < viginfSameEdge.size(); iiginf++) - { - if (fabsf(m_prgginf[viginfSameEdge[iiginf]].yOffset()) == ysMin) - viginfSameY.push_back(viginfSameEdge[iiginf]); - } - - if (viginfSameY.size() == 1) - return viginfSameY[0]; - - // Find minimum index of current candidates. - int islout = m_prgginf[viginfSameY[0]].logicalIndex(); - for (iiginf = 1; iiginf < viginfSameY.size(); iiginf++) - { - int isloutThis = m_prgginf[viginfSameY[iiginf]].logicalIndex(); - islout = min(islout, isloutThis); - } - - // Find BB with minimum islout - islout should be unique for all glyphs. - for (iiginf = 0; iiginf < viginfSameY.size(); iiginf++) - { - if (m_prgginf[viginfSameY[iiginf]].logicalIndex() == (unsigned)islout) - return viginfSameY[iiginf]; - } - - Assert(false); - return -1; // needed to stop compiler warning -} - -/*---------------------------------------------------------------------------------------------- - Return the right-most glyph on the physical surface. If there are ties, it will - prefer the one that is logically closest to the edge. -----------------------------------------------------------------------------------------------*/ -int Segment::RightMostGlyph() -{ - float xsRight = kNegInfFloat; - int iginfRet = -1; - for (int iginf = 0; iginf < m_cginf; iginf++) - { - float xsThis = m_prgginf[iginf].bb().right; - // For RTL, we prefer the glyph that is logically first; for LTR we prefer logically last. - if (xsThis > xsRight || (!m_fWsRtl && xsRight == xsThis)) - { - xsRight = xsThis; - iginfRet = iginf; - } - } - return iginfRet; -} - -/*---------------------------------------------------------------------------------------------- - Return the left-most glyph on the physical surface. If there are ties, it will - prefer the one that is logically closest to the edge. -----------------------------------------------------------------------------------------------*/ -int Segment::LeftMostGlyph() -{ - float xsLeft = kPosInfFloat; - int iginfRet = -1; - for (int iginf = 0; iginf < m_cginf; iginf++) - { - float xsThis = m_prgginf[iginf].bb().left; - // For RTL, we prefer the glyph that is logically last; for LTR we prefer logically first. - if (xsThis < xsLeft || (m_fWsRtl && xsLeft == xsThis)) - { - xsLeft = xsThis; - iginfRet = iginf; - } - } - return iginfRet; -} - -/*---------------------------------------------------------------------------------------------- - Convert from em-units to logical units. -----------------------------------------------------------------------------------------------*/ -float Segment::EmToLogUnits(int m) -{ - return GrEngine::GrIFIMulDiv(m, m_xysEmSquare, m_mFontEmUnits); -} - -/*---------------------------------------------------------------------------------------------- - Return the line-break pseudo glyph ID. -----------------------------------------------------------------------------------------------*/ -gid16 Segment::LBGlyphID() -{ - return m_preneng->LBGlyphID(); -} - -} // namespace gr diff --git a/Build/source/libs/graphite/engine-2.3.1/src/segment/SegmentAux.cpp b/Build/source/libs/graphite/engine-2.3.1/src/segment/SegmentAux.cpp deleted file mode 100644 index 2d475f9114f..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/src/segment/SegmentAux.cpp +++ /dev/null @@ -1,256 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 2005 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: SegmentAux.cpp -Responsibility: Sharon Correll -Last reviewed: Not yet. - -Description: - Implements auxiliary class that work with Segment: - - GlyphInfo - - GlyphIterator - - LayoutEnvironment --------------------------------------------------------------------------------*//*:End Ignore*/ - -//:>******************************************************************************************** -//:> Include files -//:>******************************************************************************************** -#include "Main.h" -#ifdef _MSC_VER -#pragma hdrstop -#endif -// any other headers (not precompiled) -#ifndef _WIN32 -#include -#endif - -#undef THIS_FILE -DEFINE_THIS_FILE - -//:>******************************************************************************************** -//:> Forward declarations -//:>******************************************************************************************** - -//:>******************************************************************************************** -//:> Local Constants and static variables -//:>******************************************************************************************** - -namespace gr -{ - -//:>******************************************************************************************** -//:> GlyphInfo methods -//:>******************************************************************************************** - -gid16 GlyphInfo::glyphID() -{ - return m_pslout->m_chwActual; -} - -gid16 GlyphInfo::pseudoGlyphID() -{ - if (m_pslout->m_chwActual == m_pslout->m_chwGlyphID) - return 0; // not a pseudo-glyph - return m_pslout->m_chwGlyphID; -} - -bool GlyphInfo::isAttached() const throw() -{ - return m_pslout->IsPartOfCluster(); -} - -gr::GlyphIterator GlyphInfo::attachedClusterBase() const throw() -{ - const int islout = m_pslout->ClusterBase(); - - // Since we are not passing an array, the constructor expects a ginf index, not a slout index. - return GlyphIterator(*m_pseg, ((islout >= 0) ? islout : m_islout) - m_pseg->m_isloutGinf0); -} - -float GlyphInfo::attachedClusterAdvance() const throw() -{ - return m_pslout->ClusterAdvance(); -} - -std::pair GlyphInfo::attachedClusterGlyphs() const -{ - std::vector visloutClusterMembers; - m_pslout->ClusterMembers(m_pseg, m_islout, visloutClusterMembers); - RcVector * qvislout = new RcVector(visloutClusterMembers); - return std::make_pair( - GlyphSetIterator(*m_pseg, 0, qvislout), - GlyphSetIterator(*m_pseg, visloutClusterMembers.size(), qvislout)); -} - -size_t GlyphInfo::logicalIndex() -{ - if (m_pseg->OutputSlot(0)->IsLineBreak()) - return m_islout - 1; - else - return m_islout; -} - -float GlyphInfo::origin() -{ - return m_pslout->XPosition(); -} - -float GlyphInfo::advanceWidth() // logical units -{ - return m_pslout->m_xsAdvanceX; -} - -float GlyphInfo::advanceHeight() // logical units; zero for horizontal fonts -{ - Font & font = m_pseg->getFont(); - return m_pslout->GlyphMetricLogUnits(&font, kgmetAdvHeight); -} - -float GlyphInfo::yOffset() -{ - return m_pslout->YPosition(); -} - -Rect GlyphInfo::bb() // logical units -{ - return m_pslout->BoundingBox(m_pseg->getFont()); -} - -bool GlyphInfo::isSpace() -{ - return m_pslout->IsSpace(); -} - -// first char associated with this glyph, relative to start of the text-source -toffset GlyphInfo::firstChar() -{ - return m_pseg->LogicalSurfaceToUnderlying(m_islout, true); -} - -// last char associated with this glyph, relative to start of the text-source -toffset GlyphInfo::lastChar() -{ - return m_pseg->LogicalSurfaceToUnderlying(m_islout, false); -} - -unsigned int GlyphInfo::directionality() -{ - return m_pslout->Directionality(); -} - -// Embedding depth -unsigned int GlyphInfo::directionLevel() -{ - return m_pslout->DirLevel(); -} - -bool GlyphInfo::insertBefore() -{ - return m_pslout->InsertBefore(); -} - -int GlyphInfo::breakweight() -{ - return m_pslout->BreakWeight(); -} - -float GlyphInfo::maxStretch(size_t level) -{ - return m_pslout->MaxStretch(m_pseg, (int)level); -} - -float GlyphInfo::maxShrink(size_t level) -{ - return m_pslout->MaxShrink(m_pseg, (int)level); -} - -float GlyphInfo::stretchStep(size_t level) -{ - return m_pslout->StretchStep(m_pseg, (int)level); -} - -byte GlyphInfo::justWeight(size_t level) -{ - return byte(m_pslout->JustWeight((int)level)); -} - -float GlyphInfo::justWidth(size_t level) -{ - return m_pslout->JustWidth(m_pseg, (int)level); -} - -float GlyphInfo::measureStartOfLine() -{ - return m_pslout->MeasureSolLogUnits(m_pseg); -} - -float GlyphInfo::measureEndOfLine() -{ - return m_pslout->MeasureEolLogUnits(m_pseg); -} - -size_t GlyphInfo::numberOfComponents() -{ - return m_pslout->NumberOfComponents(); -} - -Rect GlyphInfo::componentBox(size_t icomp) -{ - return m_pseg->ComponentRect(m_pslout, icomp); -} - -toffset GlyphInfo::componentFirstChar(size_t icomp) -{ - Assert((int)icomp < m_pslout->NumberOfComponents()); - return m_pslout->FirstUnderlyingComponent(icomp) + m_pseg->startCharacter(); -} -toffset GlyphInfo::componentLastChar(size_t icomp) -{ - Assert((int)icomp < m_pslout->NumberOfComponents()); - return m_pslout->LastUnderlyingComponent(icomp) + m_pseg->startCharacter(); -} - -bool GlyphInfo::erroneous() -{ - return m_pseg->Erroneous(); -} - - -//:>******************************************************************************************** -//:> GlyphIterator methods -//:>******************************************************************************************** - -// Constructor -GlyphIterator::GlyphIterator(Segment & seg, size_t iginf) -: m_pginf(seg.m_prgginf + iginf) -{} - -// Copy constructor. -// Check if the incoming iterator is null, as we cannot dereference -// it to get the segment, and create a null GlyphIterator. -// Technically this might better be an assert as converting a null -// GlyphSetIterator into a null GlyphIterator is pointless and suggests -// some kind of error. -GlyphIterator::GlyphIterator(const GlyphSetIterator & sit) -: m_pginf((sit == GlyphSetIterator()) - ? 0 - : sit->segment().m_prgginf + sit->logicalIndex()) -{} - -/*---------------------------------------------------------------------------------------------- - Dereference the iterator, returning a GlyphInfo object. -----------------------------------------------------------------------------------------------*/ - -GlyphSetIterator::reference GlyphSetIterator::operator*() const -{ - assert(m_pseg != 0); - assert(m_vit != std::vector::const_iterator()); - // in the case of a non-contiguous list - return m_pseg->m_prgginf[(*m_vit) - m_pseg->m_isloutGinf0]; -} - - -} // namespace gr diff --git a/Build/source/libs/graphite/engine-2.3.1/src/segment/TestFSM.cpp b/Build/source/libs/graphite/engine-2.3.1/src/segment/TestFSM.cpp deleted file mode 100644 index 6dad1dc9dc8..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/src/segment/TestFSM.cpp +++ /dev/null @@ -1,3416 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 1999, 2001 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: TestFSM.cpp -Responsibility: Sharon Correll -Last reviewed: Not yet. - -Description: - Hard-coded FSMs for test procedures. --------------------------------------------------------------------------------*//*:End Ignore*/ - -//:Ignore - -//:>******************************************************************************************** -//:> Include files -//:>******************************************************************************************** -#include "Main.h" - -#ifdef _MSC_VER -#pragma hdrstop -#endif -#undef THIS_FILE -DEFINE_THIS_FILE - -#ifdef OLD_TEST_STUFF - -//:>******************************************************************************************** -//:> Forward declarations -//:>******************************************************************************************** - -//:>******************************************************************************************** -//:> Local Constants and static variables -//:>******************************************************************************************** - -namespace gr -{ - -//:>******************************************************************************************** -//:> Methods -//:>******************************************************************************************** - -#ifndef _DEBUG - -bool GrLineBreakPass::RunTestRules(GrTableManager * ptman, int ruln, - GrSlotStream * psstrmInput, GrSlotStream * psstrmOutput) -{ - return false; -} - -bool GrSubPass::RunTestRules(GrTableManager * ptman, int ruln, - GrSlotStream * psstrmInput, GrSlotStream * psstrmOutput) -{ - return false; -} - -bool GrPosPass::RunTestRules(GrTableManager * ptman, int ruln, - GrSlotStream * psstrmInput, GrSlotStream * psstrmOutput) -{ - return false; -} -#endif // !_DEBUG - - -#ifdef _DEBUG - -/*---------------------------------------------------------------------------------------------- - Call the appropriate test function. -----------------------------------------------------------------------------------------------*/ - -bool GrLineBreakPass::RunTestRules(GrTableManager * ptman, int ruln, - GrSlotStream * psstrmInput, GrSlotStream * psstrmOutput) -{ - return false; -} - -bool GrSubPass::RunTestRules(GrTableManager * ptman, int ruln, - GrSlotStream * psstrmInput, GrSlotStream * psstrmOutput) -{ - if (m_staBehavior == "SimpleFSM") - return RunSimpleFSMTest(ptman, ruln, psstrmInput, psstrmOutput); - else if (m_staBehavior == "RuleAction") - return false; - else if (m_staBehavior == "RuleAction2") - return false; - else if (m_staBehavior == "Assoc") - return false; - else - return false; -} - -bool GrPosPass::RunTestRules(GrTableManager * ptman, int ruln, - GrSlotStream * psstrmInput, GrSlotStream * psstrmOutput) -{ - return false; -} - - -/*---------------------------------------------------------------------------------------------- - A simple FSM. - - Rules: - r1. clsCons clsVowel clsDiacrAcute - r2. clsCons clsVowelAE clsDiacr - r3. clsCons clsVowelI - r4. clsCons clsVowelI clsDiacrGrave - r5. clsCons clsVowelI clsDiacr - - Machine classes: - mcCons: b,c,d / f,g,h / j,k,l,m,n / p,q,r,s,t / v,w,x,y,z - mcVae: a 97/ e 101 - mcVi: i 105 - mcVou: o 111 / u 117 - mcDa: acute '/' 47 - mcDg: grave '\' 92 - mcDct: other diacritics-circumflex '^' 94 / tilde '~' 126 - - - FSM: (T=transition, F=final, A=accepting, NA=non-accepting) - - | mcCons mcVae mcVi mcVou mcDa mcDg mcDct - --------------------------------------------------------------------------- - T NA s0 | s1 - | - - - - - - - - T NA s1 | s2 s4 s3 - | - - - - - - - - T NA s2 | s5 s6 s6 - | - - - - - - - - T NA s3 | s10 - | - - - - - - - - T A s4 | s7 s8 s9 - | - - - - - - - - F A s5 | - | - - - - - - - - F A s6 | - | - - - - - - - - F A s7 | - | - - - - - - - - F A s8 | - | - - - - - - - - F A s9 | - | - - - - - - - - F A s10 | - | - - - - - - - - - Rules Matched: - s4: r3 - s5: r1, r2 - s6: r2 - s7: r1, r5 - s8: r4, r5 - s9: r5 - s10: r1 - -----------------------------------------------------------------------------------------------*/ - -void GrSubPass::SetUpSimpleFSMTest() -{ - m_nMaxRuleContext = m_nMaxChunk = 3; - m_nMaxRuleLoop = 2; - m_staBehavior = "SimpleFSM"; - - m_pfsm = new GrFSM(); - Assert(m_pfsm); - m_pfsm->SetUpSimpleFSMTest(); -} - -void GrFSM::SetUpSimpleFSMTest() -{ - // Create machine class ranges. - m_cmcr = 14; - m_prgmcr = new GrFSMClassRange[14]; - m_prgmcr[0].m_chwFirst = 47; // forward slash (acute): mcDa - m_prgmcr[0].m_chwLast = 47; - m_prgmcr[0].m_col = 4; - - m_prgmcr[1].m_chwFirst = 92; // backslash: mcDg - m_prgmcr[1].m_chwLast = 92; - m_prgmcr[1].m_col = 5; - - m_prgmcr[2].m_chwFirst = 94; // caret: mcDct - m_prgmcr[2].m_chwLast = 94; - m_prgmcr[2].m_col = 6; - - m_prgmcr[3].m_chwFirst = 97; // a: mcVae - m_prgmcr[3].m_chwLast = 97; - m_prgmcr[3].m_col = 1; - - m_prgmcr[4].m_chwFirst = 98; // b - d: mcCons - m_prgmcr[4].m_chwLast = 100; - m_prgmcr[4].m_col = 0; - - m_prgmcr[5].m_chwFirst = 101; // e: mcVae - m_prgmcr[5].m_chwLast = 101; - m_prgmcr[5].m_col = 1; - - m_prgmcr[6].m_chwFirst = 102; // f - h: mcCons - m_prgmcr[6].m_chwLast = 104; - m_prgmcr[6].m_col = 0; - - m_prgmcr[7].m_chwFirst = 105; // i: mcVi - m_prgmcr[7].m_chwLast = 105; - m_prgmcr[7].m_col = 2; - - m_prgmcr[8].m_chwFirst = 106; // j - n: mcCons - m_prgmcr[8].m_chwLast = 110; - m_prgmcr[8].m_col = 0; - - m_prgmcr[9].m_chwFirst = 111; // o: mcVou - m_prgmcr[9].m_chwLast = 111; - m_prgmcr[9].m_col = 3; - - m_prgmcr[10].m_chwFirst = 112; // p - t: mcCons - m_prgmcr[10].m_chwLast = 116; - m_prgmcr[10].m_col = 0; - - m_prgmcr[11].m_chwFirst = 117; // u: mcVou - m_prgmcr[11].m_chwLast = 117; - m_prgmcr[11].m_col = 3; - - m_prgmcr[12].m_chwFirst = 118; // v - z: mcCons - m_prgmcr[12].m_chwLast = 122; - m_prgmcr[12].m_col = 0; - - m_prgmcr[13].m_chwFirst = 126; // tilde: mcDct - m_prgmcr[13].m_chwLast = 126; - m_prgmcr[13].m_col = 6; - - m_dimcrInit = 8; // (max power of 2 <= m_cmcr); - m_cLoop = 3; // log2(max power of 2 <= m_cmcr); - m_imcrStart = m_cmcr - m_dimcrInit; - - - m_crow = 11; - m_crowNonAcpt = 4; - m_crowFinal = 6; - m_rowFinalMin = m_crow - m_crowFinal; - m_ccol = 7; - - // Set up transition table. - m_prgrowTransitions = new short[35]; // 35 = (m_crow-m_crowFinal) * m_ccol - short * psn = m_prgrowTransitions; - *psn++ = 1; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; - *psn++ = 0; *psn++ = 2; *psn++ = 4; *psn++ = 3; *psn++ = 0; *psn++ = 0; *psn++ = 0; - *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 5; *psn++ = 6; *psn++ = 6; - *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ =10; *psn++ = 0; *psn++ = 0; - *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 7; *psn++ = 8; *psn++ = 9; - - // Set up matched-rules tables. - m_prgrulnMatched = new data16[10]; // 10 = sum of rules matched for each accepting state - m_prgirulnMin = new data16[7+1]; // 7 = m_crow - m_crowNonAcpt - - m_prgirulnMin[0] = 0; // s4: r3 - m_prgrulnMatched[0] = 3; - - m_prgirulnMin[1] = 1; // s5: r1, r2 - m_prgrulnMatched[1] = 1; - m_prgrulnMatched[2] = 2; - - m_prgirulnMin[2] = 3; // s6: r2 - m_prgrulnMatched[3] = 2; - - m_prgirulnMin[3] = 4; // s7: r1, r5 - m_prgrulnMatched[4] = 1; - m_prgrulnMatched[5] = 5; - - m_prgirulnMin[4] = 6; // s8: r4, r5 - m_prgrulnMatched[6] = 4; - m_prgrulnMatched[7] = 5; - - m_prgirulnMin[5] = 8; // s9: r5 - m_prgrulnMatched[8] = 5; - - m_prgirulnMin[6] = 9; // s10: r1 - m_prgrulnMatched[9] = 1; - - m_prgirulnMin[7] = 10; -} - - -/*---------------------------------------------------------------------------------------------- - The "rule" does something silly: just inserts *'s--the number equals the number of the - rule. -----------------------------------------------------------------------------------------------*/ -bool GrSubPass::RunSimpleFSMTest(GrTableManager * ptman, int ruln, GrSlotStream * psstrmInput, - GrSlotStream * psstrmOutput) -{ - int cslotMatched = (ruln == 3)? 2: 3; - - GrSlotState * pslot0 = psstrmInput->Peek(0); - - for (int islot = 0; islot < cslotMatched; islot++) - psstrmOutput->CopyOneSlotFrom(psstrmInput); - - for (islot = 0; islot < ruln; islot++) - { - GrSlotState * pslot; - ptman->NewSlot('*', pslot0, NULL, m_ipass, &pslot); - pslot->Associate(pslot0); - psstrmOutput->NextPut(pslot); - } - - return true; -} - - -/*---------------------------------------------------------------------------------------------- - A simple set of rules with actions. - - Rules: - r0. clsDigit gSlash clsDigit _ > @3 _ @1 gTilde; // tilde = 126 - r1. _ clsDigit gBackSlash clsDigit > gDollar @4 _ @2; // dollar sign = 36 - - Machine classes: - mcDigit: '0' - '9' 48 - 57 - mcSlash: '/' 47 - mcBSlash: '\' 92 - - - FSM: (T=transition, F=final, A=accepting, NA=non-accepting) - - | clsDig mcSlash mcBSlash - ------------------------------------------------------ - T NA s0 | s1 - | - - - - T NA s1 | s2 s3 - | - - - - T NA s2 | s4 - | - - - - T NA s3 | s5 - | - - - - F A s4 | - | - - - - F A s5 | - | - - - - - Rules Matched: - s4: r0 - s5: r1 - -----------------------------------------------------------------------------------------------*/ -void GrEngine::SetUpRuleActionTest() -{ - if (m_pctbl) - delete m_pctbl; - - m_pctbl = new GrClassTable(); - m_pctbl->SetUpRuleActionTest(); -} - -void GrClassTable::SetUpRuleActionTest() -{ - m_ccls = 2; // number of classes - m_cclsLinear = 2; // number of classes in linear format - - m_prgchwBIGGlyphList = new data16[100]; - - m_prgichwOffsets = new data16[2+1]; - - gid16 * pchw = m_prgchwBIGGlyphList; - - // Output class 0: tilde - m_prgichwOffsets[0] = 0; - *pchw++ = msbf(data16(126)); // '~' - - // Output class 1: dollar - m_prgichwOffsets[1] = 1; - *pchw++ = msbf(data16(36)); // '$' - - m_prgichwOffsets[2] = 2; -} - -void GrSubPass::SetUpRuleActionTest() -{ - m_nMaxRuleContext = m_nMaxChunk = 3; - m_nMaxRuleLoop = 2; - m_staBehavior = "RuleAction"; - - m_pfsm = new GrFSM(); - Assert(m_pfsm); - m_pfsm->SetUpRuleActionTest(); - - m_crul = 2; - - // Set up constraint code--succeed trivially. - m_prgbConstraintBlock = new byte[3]; - byte * pb = m_prgbConstraintBlock; - *pb++ = kopPushByte; *pb++ = 1; // Push true - *pb++ = kopPopRet; // PopAndRet - - m_prgibConstraintStart = new data16[m_crul]; - m_prgibConstraintStart[0] = 0; - m_prgibConstraintStart[1] = 0; - - // Set up rule action code. - m_prgbActionBlock = new byte[30]; - pb = m_prgbActionBlock; - - // Rule 1: clsDigit gSlash clsDigit _ > @3 _ @1 gTilde; - - *pb++ = kopPutCopy; *pb++ = 2; // PutCopy 2 - *pb++ = kopNext; // Next - *pb++ = kopDelete; // Delete - *pb++ = kopNext; // Next - *pb++ = kopPutCopy; *pb++ = -2; // PutCopy -2 - *pb++ = kopNext; // Next - *pb++ = kopInsert; // Insert - *pb++ = kopPutGlyph8bitObs; *pb++ = 0; // PutGlyph 0 ('~' = 126) - *pb++ = kopNext; // Next - *pb++ = kopPushByte; *pb++ = 0; // Push 0 - *pb++ = kopPopRet; // PopAndRet - - // Rule 2: _ clsDigit gBackSlash clsDigit > gDollar @4 _ @2; - - *pb++ = kopInsert; // Insert - *pb++ = kopPutGlyph8bitObs; *pb++ = 1; // PutGlyph 1 ('$' = 36) - *pb++ = kopNext; // Next - *pb++ = kopPutCopy; *pb++ = 2; // PutCopy 2 - *pb++ = kopNext; // Next - *pb++ = kopDelete; // Delete - *pb++ = kopNext; // Next - *pb++ = kopPutCopy; *pb++ = -2; // PutCopy -2 - *pb++ = kopNext; // Next - *pb++ = kopPushByte; *pb++ = 0; // Push 0 - *pb++ = kopPopRet; // PopAndRet - - m_prgibActionStart = new data16[m_crul]; - m_prgibActionStart[0] = 0; - m_prgibActionStart[1] = 15; -} - -void GrFSM::SetUpRuleActionTest() -{ - // Create machine class ranges. - m_cmcr = 3; - m_prgmcr = new GrFSMClassRange[3]; - m_prgmcr[0].m_chwFirst = 47; // forward slash: mcSlash - m_prgmcr[0].m_chwLast = 47; - m_prgmcr[0].m_col = 1; - - m_prgmcr[1].m_chwFirst = 48; // 0 - 9: mcDigit - m_prgmcr[1].m_chwLast = 57; - m_prgmcr[1].m_col = 0; - - m_prgmcr[2].m_chwFirst = 92; // backslash - m_prgmcr[2].m_chwLast = 92; - m_prgmcr[2].m_col = 2; - - - m_dimcrInit = 2; // (max power of 2 <= m_cmcr); - m_cLoop = 1; // log2(max power of 2 <= m_cmcr); - m_imcrStart = m_cmcr - m_dimcrInit; - - - m_crow = 6; - m_crowNonAcpt = 4; - m_crowFinal = 2; - m_rowFinalMin = m_crow - m_crowFinal; - m_ccol = 3; - - // Set up transition table. - m_prgrowTransitions = new short[12]; // 12 = (m_crow-m_crowFinal) * m_ccol - short * psn = m_prgrowTransitions; - *psn++ = 1; *psn++ = 0; *psn++ = 0; - *psn++ = 0; *psn++ = 2; *psn++ = 3; - *psn++ = 4; *psn++ = 0; *psn++ = 0; - *psn++ = 5; *psn++ = 0; *psn++ = 0; - - // Set up matched-rules tables. - m_prgrulnMatched = new data16[2]; // 2 = sum of rules matched for each accepting state - m_prgirulnMin = new data16[2+1]; // 2 = m_crow - m_crowNonAcpt - - m_prgirulnMin[0] = 0; // s4: r0 - m_prgrulnMatched[0] = 0; - - m_prgirulnMin[1] = 1; // s5: r1 - m_prgrulnMatched[1] = 1; - - m_prgirulnMin[2] = 2; -} - -/*---------------------------------------------------------------------------------------------- - A more complicated set of rules with actions. - - PASS 1: - r0. clsDigit > @1 {dir = DIR_RIGHT} / ^ _ {dir == DIR_LEFT}; - r1. clsSpecial > @2 {dir = DIR_ARABNUMBER} / clsDigit {dir != DIR_LEFT} ^ _; - r2. clsSpecial > @2 {dir = @1.dir} / clsSpecial ^ _; - - Pass 1 machine classes: - mcDigit: '0' - '9' 48 - 57 - mcSpecial: '-', '_', '=', '~' 45, 95, 61, 126 - - Pass 1 FSM: (T=transition, F=final, A=accepting, NA=non-accepting) - - | mcDigit mcSpecial - ------------------------------------------ - T NA s0 | s2 s1 - | - _ - T NA s1 | s4 - | - - - T A s2 | s3 - | - - - F A s3 | - | - - - F A s4 | - | - - - - Rules Matched: - s2: r0 - s3: r1 - s4: r2 - - PASS 2: - r0. clsVowel gCaret > clsCirumVowel _; - r1. clsVowel gSlash > _ clsAcuteVowel$1; - - Pass 2 machine classes: - mcVowel - mcCaret: '^' 94 - mcSlash: '/' 47 - - - Pass 2 FSM: - | mcVowel mcCaret mcSlash - ----------------------------------------------------- - T NA s0 | s1 - | - _ - T NA s1 | s2 s3 - | - - - F A s2 | - | - - - F A s3 | - | - - - - Rules matched: - s2: r0 - s3: r1 - - - PASS 3: - r0. clsLeft > clsRight {dir = @1.dir} / _ clsDir {dir==DIR_RIGHT}; - r1. clsRight > clsLeft {dir = @1.dir} / clsDir {dir==DIR_RIGHT} _; - - Pass 3 machine classes: - mcDir: (clsDigit, clsSpecial) - mcLeft: '(', '[', '{' 40, 91, 123 - mcRight: ')', ']', '}' 41, 93, 125 - - Pass 3 FSM: - | mcDir mcLeft mcRight - ----------------------------------------------------- - T NA s0 | s2 s1 - | - _ - T NA s1 | s3 - | - - - T NA s2 | s4 - | - - - F A s3 | - | - - - F A s4 | - | - - - - Rules matched: - s3: r0 - s4: r1 - - -----------------------------------------------------------------------------------------------*/ -void GrEngine::SetUpRuleAction2Test() -{ - if (m_pctbl) - delete m_pctbl; - - m_pctbl = new GrClassTable(); - m_pctbl->SetUpRuleAction2Test(); -} - -void GrClassTable::SetUpRuleAction2Test() -{ - m_ccls = 7; // number of classes - m_cclsLinear = 4; // number of classes in linear format - - m_prgchwBIGGlyphList = new data16[70]; - - m_prgichwOffsets = new data16[7+1]; - - data16 * pchw = m_prgchwBIGGlyphList; - - // Output class 0: clsCirumVowel - m_prgichwOffsets[0] = 0; - *pchw++ = msbf(data16(226)); // a - *pchw++ = msbf(data16(234)); // e - *pchw++ = msbf(data16(238)); // i - *pchw++ = msbf(data16(244)); // o - *pchw++ = msbf(data16(251)); // u - *pchw++ = msbf(data16(194)); // A - *pchw++ = msbf(data16(202)); // E - *pchw++ = msbf(data16(206)); // I - *pchw++ = msbf(data16(212)); // O - *pchw++ = msbf(data16(219)); // U - - // Output class 1: clsAcuteVowel - m_prgichwOffsets[1] = 10; - *pchw++ = msbf(data16(225)); // a - *pchw++ = msbf(data16(233)); // e - *pchw++ = msbf(data16(237)); // i - *pchw++ = msbf(data16(243)); // o - *pchw++ = msbf(data16(250)); // u - *pchw++ = msbf(data16(193)); // A - *pchw++ = msbf(data16(201)); // E - *pchw++ = msbf(data16(205)); // I - *pchw++ = msbf(data16(211)); // O - *pchw++ = msbf(data16(218)); // U - - // Output class 2: clsLeft - m_prgichwOffsets[2] = 10 + 10; - *pchw++ = msbf(data16(40)); // ( - *pchw++ = msbf(data16(91)); // [ - *pchw++ = msbf(data16(123)); // { - - // Output class 3: clsRight - m_prgichwOffsets[3] = 20 + 3; - *pchw++ = msbf(data16(41)); // ) - *pchw++ = msbf(data16(93)); // ] - *pchw++ = msbf(data16(125)); // } - - // Input class 4: clsVowel - m_prgichwOffsets[4] = 23 + 3; // 26 - *pchw++ = msbf(data16(10)); - *pchw++ = msbf(data16(8)); *pchw++ = msbf(data16(3)); *pchw++ = msbf(data16(10-8)); - *pchw++ = msbf(data16(65)); *pchw++ = msbf(data16(5)); // A - *pchw++ = msbf(data16(69)); *pchw++ = msbf(data16(6)); // E - *pchw++ = msbf(data16(73)); *pchw++ = msbf(data16(7)); // I - *pchw++ = msbf(data16(79)); *pchw++ = msbf(data16(8)); // O - *pchw++ = msbf(data16(85)); *pchw++ = msbf(data16(9)); // U - *pchw++ = msbf(data16(97)); *pchw++ = msbf(data16(0)); // a - *pchw++ = msbf(data16(101)); *pchw++ = msbf(data16(1)); // e - *pchw++ = msbf(data16(105)); *pchw++ = msbf(data16(2)); // i - *pchw++ = msbf(data16(111)); *pchw++ = msbf(data16(3)); // o - *pchw++ = msbf(data16(117)); *pchw++ = msbf(data16(4)); // u - - // Input class 5: clsLeft - m_prgichwOffsets[5] = 26 + 4 + 10*2; // 50 - *pchw++ = msbf(data16(3)); - *pchw++ = msbf(data16(2)); *pchw++ = msbf(data16(1)); *pchw++ = msbf(data16(3-2)); - *pchw++ = msbf(data16(40)); *pchw++ = msbf(data16(0)); // ( - *pchw++ = msbf(data16(91)); *pchw++ = msbf(data16(1)); // [ - *pchw++ = msbf(data16(123)); *pchw++ = msbf(data16(2)); // { - - // Input class 6: clsRight - m_prgichwOffsets[6] = 50 + 4 + 3*2; // 60 - *pchw++ = msbf(data16(3)); - *pchw++ = msbf(data16(2)); *pchw++ = msbf(data16(1)); *pchw++ = msbf(data16(3-2)); - *pchw++ = msbf(data16(41)); *pchw++ = msbf(data16(0)); // ) - *pchw++ = msbf(data16(93)); *pchw++ = msbf(data16(1)); // ] - *pchw++ = msbf(data16(125)); *pchw++ = msbf(data16(2)); // } - - m_prgichwOffsets[7] = 60 + 4 + 3*2; // 70 -} - -void GrSubPass::SetUpRuleAction2Test() -{ - if (m_ipass == 1) - { - m_nMaxRuleContext = m_nMaxChunk = 2; - m_nMaxRuleLoop = 5; - m_staBehavior = "RuleAction2"; - - m_pfsm = new GrFSM(); - Assert(m_pfsm); - m_pfsm->SetUpRuleAction2Test(m_ipass); - - m_crul = 3; - - // Set up constraint code. - m_prgbConstraintBlock = new byte[1 + 10 + 10]; - byte * pb = m_prgbConstraintBlock; - *pb++ = kopRetTrue; // RetTrue - - *pb++ = kopCntxtItem; *pb++ = 0; // ContextItem 0 - *pb++ = kopPushSlotAttr; *pb++= kslatDir; // PushSlotAttr dir 0 - *pb++ = 0; - *pb++ = kopPushByte; *pb++ = kdircL; // Push DIR_LEFT - *pb++ = kopEqual; // Equal - *pb++ = kopOr; // Or - *pb++ = kopPopRet; // PopAndRet - - *pb++ = kopCntxtItem; *pb++ = 0; // ContextItem 0 - *pb++ = kopPushSlotAttr; *pb++= kslatDir; // PushSlotAttr dir 0 - *pb++ = 0; - *pb++ = kopPushByte; *pb++ = kdircL; // Push DIR_LEFT - *pb++ = kopNotEq; // NotEqual - *pb++ = kopOr; // Or - *pb++ = kopPopRet; // PopAndRet - - m_prgibConstraintStart = new data16[m_crul]; - m_prgibConstraintStart[0] = 1; - m_prgibConstraintStart[1] = 11; - m_prgibConstraintStart[2] = 0; - - // Set up rule action code. - m_prgbActionBlock = new byte[10 + 11 + 12]; - pb = m_prgbActionBlock; - - // Rule 0: clsDigit > @1 {dir = DIR_RIGHT} / ^ _ {dir == DIR_LEFT}; - - *pb++ = kopPutCopy; *pb++ = 0; // PutCopy 0 - *pb++ = kopPushByte; *pb++ = kdircR; // PushByte DIR_RIGHT - *pb++ = kopAttrSet; *pb++ = kslatDir; // AttrSet dir - *pb++ = kopNext; // Next - *pb++ = kopPushByte; *pb++ = -1; // Push -1 - *pb++ = kopPopRet; // PopAndRet - - // Rule 1: clsSpecial > @2 {dir = DIR_ARABNUMBER} / clsDigit {dir != DIR_LEFT} ^ _; - - *pb++ = kopCopyNext; // CopyNext - *pb++ = kopPutCopy; *pb++ = 0; // PutCopy 0 - *pb++ = kopPushByte; *pb++ = kdircArabNum; // Push DIR_ARABNUMBER - *pb++ = kopAttrSet; *pb++ = kslatDir; // AttrSet dir - *pb++ = kopNext; // Next - *pb++ = kopPushByte; *pb++ = -1; // Push -1 - *pb++ = kopPopRet; // PopAndRet - - // Rule 2: clsSpecial > @2 {dir = @1.dir} / clsSpecial ^ _; - - *pb++ = kopCopyNext; // CopyNext - *pb++ = kopPutCopy; *pb++ = 0; // PutCopy 0 - *pb++ = kopPushSlotAttr;*pb++ = kslatDir; // PushSlotAttr dir -1 - *pb++ = -1; - *pb++ = kopAttrSet; *pb++ = kslatDir; // AttrSet dir - *pb++ = kopNext; // Next - *pb++ = kopPushByte; *pb++ = -1; // Push -1 - *pb++ = kopPopRet; // PopAndRet - - m_prgibActionStart = new data16[m_crul]; - m_prgibActionStart[0] = 0; - m_prgibActionStart[1] = 10; - m_prgibActionStart[2] = 10 + 11; - } - else if (m_ipass == 2) - { - m_nMaxRuleContext = m_nMaxChunk = 2; - m_nMaxRuleLoop = 3; - m_staBehavior = "RuleAction2"; - - m_pfsm = new GrFSM(); - Assert(m_pfsm); - m_pfsm->SetUpRuleAction2Test(m_ipass); - - m_crul = 2; - - // Set up constraint code--succeed trivially. - m_prgbConstraintBlock = new byte[1]; - byte * pb = m_prgbConstraintBlock; - *pb++ = kopRetTrue; // RetTrue - - m_prgibConstraintStart = new data16[m_crul]; - m_prgibConstraintStart[0] = 0; - m_prgibConstraintStart[1] = 0; - - // Set up rule action code. - m_prgbActionBlock = new byte[16]; - pb = m_prgbActionBlock; - - // Rule 0: clsVowel gCaret > clsCirumVowel _; - - *pb++ = kopPutSubs8bitObs; *pb++ = 0; // PutSubs 0 clsVowel clsCircumVowel - *pb++ = 4; *pb++ = 0; - *pb++ = kopNext; // Next - *pb++ = kopDelete; // Delete - *pb++ = kopNext; // Next - *pb++ = kopRetZero; // RetZero - - // Rule 1: clsVowel gSlash > _ clsAcuteVowel$1; - - *pb++ = kopDelete; // Delete - *pb++ = kopNext; // Next - *pb++ = kopPutSubs8bitObs; *pb++ = -1; // PutSubs -1 clsVowel clsAcuteVowel - *pb++ = 4; *pb++ = 1; - *pb++ = kopNext; // Next - *pb++ = kopRetZero; // RetZero - - m_prgibActionStart = new data16[m_crul]; - m_prgibActionStart[0] = 0; - m_prgibActionStart[1] = 8; - } - else if (m_ipass == 3) - { - m_nMaxRuleContext = m_nMaxChunk = 2; - m_nMaxRuleLoop = 3; - m_staBehavior = "RuleAction2"; - - m_pfsm = new GrFSM(); - Assert(m_pfsm); - m_pfsm->SetUpRuleAction2Test(m_ipass); - - m_crul = 2; - - // Set up constraint code. - m_prgbConstraintBlock = new byte[1 + 10 + 10]; - byte * pb = m_prgbConstraintBlock; - *pb++ = kopRetTrue; // RetTrue - - *pb++ = kopCntxtItem; *pb++ = 1; // ContextItem 1 - *pb++ = kopPushSlotAttr;*pb++ = kslatDir; // PushSlotAttr dir 0 - *pb++ = 0; - *pb++ = kopPushByte; *pb++ = kdircR; // Push DIR_RIGHT - *pb++ = kopEqual; // Equal - *pb++ = kopOr; // Or - *pb++ = kopPopRet; // PopAndRet - - *pb++ = kopCntxtItem; *pb++ = 0; // ContextItem 0 - *pb++ = kopPushSlotAttr;*pb++ = kslatDir; // PushSlotAttr dir 0 - *pb++ = 0; - *pb++ = kopPushByte; *pb++ = kdircR; // Push DIR_RIGHT - *pb++ = kopEqual; // Equal - *pb++ = kopOr; // Or - *pb++ = kopPopRet; // PopAndRet - - m_prgibConstraintStart = new data16[m_crul]; - m_prgibConstraintStart[0] = 1; - m_prgibConstraintStart[1] = 1 + 10; - - // Set up rule action code. - m_prgbActionBlock = new byte[23]; - pb = m_prgbActionBlock; - - // Rule 0: clsLeft > clsRight {dir = @1.dir} / _ clsDir {dir == DIR_RIGHT}; - - *pb++ = kopPutSubs8bitObs; *pb++ = 0; // PutSubs 0 clsLeft clsRight - *pb++ = 5; *pb++ = 3; - *pb++ = kopPushSlotAttr;*pb++ = kslatDir; // PushSlotAttr dir 1 - *pb++ = 1; - *pb++ = kopAttrSet; *pb++ = kslatDir; // AttrSet dir - *pb++ = kopNext; // Next - *pb++ = kopRetZero; // RetZero - - // Rule 1: clsRight > clsLeft {dir = @1.dir} / clsDir {dir == DIR_RIGHT} _; - - *pb++ = kopCopyNext; // CopyNext - *pb++ = kopPutSubs8bitObs; *pb++ = 0; // PutSubs 0 clsRight clsLeft - *pb++ = 6; *pb++ = 2; - *pb++ = kopPushSlotAttr;*pb++ = kslatDir; // PushSlotAttr dir -1 - *pb++ = -1; - *pb++ = kopAttrSet; *pb++ = kslatDir; // AttrSet dir - *pb++ = kopNext; // Next - *pb++ = kopRetZero; // RetZero - - m_prgibActionStart = new data16[m_crul]; - m_prgibActionStart[0] = 0; - m_prgibActionStart[1] = 11; - } -} - - -void GrFSM::SetUpRuleAction2Test(int ipass) -{ - if (ipass == 1) - { - // Create machine class ranges. - m_cmcr = 5; - m_prgmcr = new GrFSMClassRange[5]; - m_prgmcr[0].m_chwFirst = 45; // hyphen - m_prgmcr[0].m_chwLast = 45; - m_prgmcr[0].m_col = 1; - - m_prgmcr[1].m_chwFirst = 48; // 0 - 9: mcDigit - m_prgmcr[1].m_chwLast = 57; - m_prgmcr[1].m_col = 0; - - m_prgmcr[2].m_chwFirst = 61; // equals sign - m_prgmcr[2].m_chwLast = 61; - m_prgmcr[2].m_col = 1; - - m_prgmcr[3].m_chwFirst = 95; // underscore - m_prgmcr[3].m_chwLast = 95; - m_prgmcr[3].m_col = 1; - - m_prgmcr[4].m_chwFirst = 126; // tilde - m_prgmcr[4].m_chwLast = 126; - m_prgmcr[4].m_col = 1; - - m_dimcrInit = 4; // (max power of 2 <= m_cmcr); - m_cLoop = 2; // log2(max power of 2 <= m_cmcr); - m_imcrStart = m_cmcr - m_dimcrInit; - - - m_crow = 5; - m_crowNonAcpt = 2; - m_crowFinal = 2; - m_rowFinalMin = m_crow - m_crowFinal; - m_ccol = 2; - - // Set up transition table. - m_prgrowTransitions = new short[6]; // 6 = (m_crow-m_crowFinal) * m_ccol - short * psn = m_prgrowTransitions; - *psn++ = 2; *psn++ = 1; - *psn++ = 0; *psn++ = 4; - *psn++ = 0; *psn++ = 3; - - // Set up matched-rules tables. - m_prgrulnMatched = new data16[3]; // 3 = sum of rules matched for each accepting state - m_prgirulnMin = new data16[3+1]; // 3 = m_crow - m_crowNonAcpt - - m_prgirulnMin[0] = 0; // s2: r0 - m_prgrulnMatched[0] = 0; - - m_prgirulnMin[1] = 1; // s3: r1 - m_prgrulnMatched[1] = 1; - - m_prgirulnMin[2] = 2; // s3: r2 - m_prgrulnMatched[2] = 2; - - m_prgirulnMin[3] = 3; - } - else if (ipass == 2) - { - // Create machine class ranges. - m_cmcr = 12; - m_prgmcr = new GrFSMClassRange[12]; - m_prgmcr[0].m_chwFirst = 47; // slash - m_prgmcr[0].m_chwLast = 47; - m_prgmcr[0].m_col = 2; - - m_prgmcr[1].m_chwFirst = 65; // A - m_prgmcr[1].m_chwLast = 65; - m_prgmcr[1].m_col = 0; - - m_prgmcr[2].m_chwFirst = 69; // E - m_prgmcr[2].m_chwLast = 69; - m_prgmcr[2].m_col = 0; - - m_prgmcr[3].m_chwFirst = 73; // I - m_prgmcr[3].m_chwLast = 73; - m_prgmcr[3].m_col = 0; - - m_prgmcr[4].m_chwFirst = 79; // O - m_prgmcr[4].m_chwLast = 79; - m_prgmcr[4].m_col = 0; - - m_prgmcr[5].m_chwFirst = 85; // U - m_prgmcr[5].m_chwLast = 85; - m_prgmcr[5].m_col = 0; - - m_prgmcr[6].m_chwFirst = 94; // caret - m_prgmcr[6].m_chwLast = 94; - m_prgmcr[6].m_col = 1; - - m_prgmcr[7].m_chwFirst = 97; // a - m_prgmcr[7].m_chwLast = 97; - m_prgmcr[7].m_col = 0; - - m_prgmcr[8].m_chwFirst = 101; // e - m_prgmcr[8].m_chwLast = 101; - m_prgmcr[8].m_col = 0; - - m_prgmcr[9].m_chwFirst = 105; // i - m_prgmcr[9].m_chwLast = 105; - m_prgmcr[9].m_col = 0; - - m_prgmcr[10].m_chwFirst = 111; // o - m_prgmcr[10].m_chwLast = 111; - m_prgmcr[10].m_col = 0; - - m_prgmcr[11].m_chwFirst = 117; // u - m_prgmcr[11].m_chwLast = 117; - m_prgmcr[11].m_col = 0; - - m_dimcrInit = 8; // (max power of 2 <= m_cmcr); - m_cLoop = 3; // log2(max power of 2 <= m_cmcr); - m_imcrStart = m_cmcr - m_dimcrInit; - - - m_crow = 4; - m_crowNonAcpt = 2; - m_crowFinal = 2; - m_rowFinalMin = m_crow - m_crowFinal; - m_ccol = 3; - - // Set up transition table. - m_prgrowTransitions = new short[6]; // 6 = (m_crow-m_crowFinal) * m_ccol - short * psn = m_prgrowTransitions; - *psn++ = 1; *psn++ = 0; *psn++ = 0; - *psn++ = 0; *psn++ = 2; *psn++ = 3; - - // Set up matched-rules tables. - m_prgrulnMatched = new data16[2]; // 2 = sum of rules matched for each accepting state - m_prgirulnMin = new data16[2+1]; // 2 = m_crow - m_crowNonAcpt - - m_prgirulnMin[0] = 0; // s1: r0 - m_prgrulnMatched[0] = 0; - - m_prgirulnMin[1] = 1; // s2: r1 - m_prgrulnMatched[1] = 1; - - m_prgirulnMin[2] = 2; - } - else if (ipass == 3) - { - // Create machine class ranges. - m_cmcr = 11; - m_prgmcr = new GrFSMClassRange[11]; - m_prgmcr[0].m_chwFirst = 40; // ( - m_prgmcr[0].m_chwLast = 40; - m_prgmcr[0].m_col = 1; - - m_prgmcr[1].m_chwFirst = 41; // ) - m_prgmcr[1].m_chwLast = 41; - m_prgmcr[1].m_col = 2; - - m_prgmcr[2].m_chwFirst = 45; // hyphen - m_prgmcr[2].m_chwLast = 45; - m_prgmcr[2].m_col = 0; - - m_prgmcr[3].m_chwFirst = 48; // 0 - 9: mcDigit - m_prgmcr[3].m_chwLast = 57; - m_prgmcr[3].m_col = 0; - - m_prgmcr[4].m_chwFirst = 61; // = - m_prgmcr[4].m_chwLast = 61; - m_prgmcr[4].m_col = 0; - - m_prgmcr[5].m_chwFirst = 91; // [ - m_prgmcr[5].m_chwLast = 91; - m_prgmcr[5].m_col = 1; - - m_prgmcr[6].m_chwFirst = 93; // ] - m_prgmcr[6].m_chwLast = 93; - m_prgmcr[6].m_col = 2; - - m_prgmcr[7].m_chwFirst = 95; // underscore - m_prgmcr[7].m_chwLast = 95; - m_prgmcr[7].m_col = 0; - - m_prgmcr[8].m_chwFirst = 123; // { - m_prgmcr[8].m_chwLast = 123; - m_prgmcr[8].m_col = 1; - - m_prgmcr[9].m_chwFirst = 125; // } - m_prgmcr[9].m_chwLast = 125; - m_prgmcr[9].m_col = 2; - - m_prgmcr[10].m_chwFirst = 126; // tilde - m_prgmcr[10].m_chwLast = 126; - m_prgmcr[10].m_col = 0; - - m_dimcrInit = 8; // (max power of 2 <= m_cmcr); - m_cLoop = 3; // log2(max power of 2 <= m_cmcr); - m_imcrStart = m_cmcr - m_dimcrInit; - - - m_crow = 5; - m_crowNonAcpt = 3; - m_crowFinal = 2; - m_rowFinalMin = m_crow - m_crowFinal; - m_ccol = 3; - - // Set up transition table. - m_prgrowTransitions = new short[9]; // 9 = (m_crow-m_crowFinal) * m_ccol - short * psn = m_prgrowTransitions; - *psn++ = 2; *psn++ = 1; *psn++ = 0; - *psn++ = 3; *psn++ = 0; *psn++ = 0; - *psn++ = 0; *psn++ = 0; *psn++ = 4; - - // Set up matched-rules tables. - m_prgrulnMatched = new data16[2]; // 2 = sum of rules matched for each accepting state - m_prgirulnMin = new data16[2+1]; // 2 = m_crow - m_crowNonAcpt - - m_prgirulnMin[0] = 0; // s3: r0 - m_prgrulnMatched[0] = 0; - - m_prgirulnMin[1] = 1; // s4: r1 - m_prgrulnMatched[1] = 1; - - m_prgirulnMin[2] = 2; - } -} - - -/*---------------------------------------------------------------------------------------------- - Tests of various kinds of assocations. - - PASS 1 (line-break): - r0. gX / # _ ^ ; // do nothing - r1. gX {break = -2}; - - Pass 1 machine classes: - mcX: 'x' 120 - mcLB: 35 - - Pass 1 FSM: (T=transition, F=final, A=accepting, NA=non-accepting) - - | gX gLB - -------------------------------- - T NA s0 | s2 s1 - | - T NA s1 | s3 - | - F A s2 | - | - F A s3 | - - - Rules Matched: - s2: r1 - s3: r0 - - - - PASS 2: - r0. clsOA clsE > clsELig:(1 2) _; - r1. clsLC _ _ gX > @1 @5 @1 @5 / _ _ # {break==2} _ _ ; - r2. _ clsFraction _ > clsNumerator:2 gSlash:2 clsDenom:2; - - Pass 2 machine classes: - mcOA: O A 79 65 - mcOAlc: o a 111 97 - mcE E e 69 101 - mcFraction: 188 189 190 - mcX: x 120 - mcLCother - mcLB: 35 - - - Pass 2 FSM: mcLC - | mcOA mcOAlc mcE mcElc other mcX mcFractn mcLB - ----------------------------------------------------------------------------------------- - T NA s0 | s1 s2 s4 s3 s3 s6 - | - - - - - - - - T NA s1 | s7 - | - - - - - - - - T NA s2 | s7 s5 - | - - - - - - - - T NA s3 | s5 - | - - - - - - - - T NA s4 | s5 - | - - - - - - - - T NA s5 | s8 - | - - - - - - - - F A s6 | - | - - - - - - - F A s7 | - | - - - - - - - F A s8 | - | - - - - - - - - Rules matched: - s6: r2 - s7: r0 - s8: r1 - - - PASS 3: - r0. _ > gHyphen / _ # {break == 2} ^; - - Pass 3 machine classes: - mcLB: 35 - - Pass 3 FSM: - - | gLB - -------------------------------- - T NA s0 | s1 - | - F A s1 | - | - - Rules Matched: - s1: r0 -----------------------------------------------------------------------------------------------*/ -void GrEngine::SetUpAssocTest() -{ - if (m_pctbl) - delete m_pctbl; - - m_pctbl = new GrClassTable(); - m_pctbl->SetUpAssocTest(); - - m_fLineBreak = true; - m_cchwPreXlbContext = 1; - m_cchwPostXlbContext = 1; -} - -void GrClassTable::SetUpAssocTest() -{ - m_ccls = 11; // number of classes - m_cclsLinear = 5; // number of classes in linear format (output classes) - - m_prgchwBIGGlyphList = new data16[143]; - - m_prgichwOffsets = new data16[m_ccls+1]; - - data16 * pchw = m_prgchwBIGGlyphList; - - // Output class 0: clsELig - m_prgichwOffsets[0] = 0; - *pchw++ = msbf(data16(140)); // OE - *pchw++ = msbf(data16(198)); // AE - *pchw++ = msbf(data16(156)); // oe - *pchw++ = msbf(data16(230)); // ae - - // Output class 1: clsNumerator - m_prgichwOffsets[1] = 4; - *pchw++ = msbf(data16(49)); // 1 - *pchw++ = msbf(data16(49)); // 1 - *pchw++ = msbf(data16(51)); // 3 - - // Output class 2: clsDenom - m_prgichwOffsets[2] = 4 + 3; - *pchw++ = msbf(data16(52)); // 4 - *pchw++ = msbf(data16(50)); // 2 - *pchw++ = msbf(data16(52)); // 4 - - // Output class 3: gSlash - m_prgichwOffsets[3] = 7 + 3; - *pchw++ = msbf(data16(47)); // '/' - - // Output class 4: gHyphen - m_prgichwOffsets[4] = 10 + 1; - *pchw++ = msbf(data16(45)); // '-' - - // Input class 5: clsOA - m_prgichwOffsets[5] = 11 + 1; - *pchw++ = msbf(data16(4)); - *pchw++ = msbf(data16(4)); *pchw++ = msbf(data16(2)); *pchw++ = msbf(data16(0)); - *pchw++ = msbf(data16(65)); *pchw++ = msbf(data16(1)); // A - *pchw++ = msbf(data16(79)); *pchw++ = msbf(data16(0)); // O - *pchw++ = msbf(data16(97)); *pchw++ = msbf(data16(3)); // a - *pchw++ = msbf(data16(111)); *pchw++ = msbf(data16(2)); // o - - // Input class 6: clsE - m_prgichwOffsets[6] = 12 + 4 + 4*2; // 24 - *pchw++ = msbf(data16(3)); - *pchw++ = msbf(data16(2)); *pchw++ = msbf(data16(1)); *pchw++ = msbf(data16(3-2)); - *pchw++ = msbf(data16(40)); *pchw++ = msbf(data16(0)); // E - *pchw++ = msbf(data16(91)); *pchw++ = msbf(data16(1)); // e - - // Input class 7: clsLC - m_prgichwOffsets[7] = 24 + 4 + 2*2; // 32 - *pchw++ = msbf(data16(26)); - *pchw++ = msbf(data16(16)); *pchw++ = msbf(data16(4)); *pchw++ = msbf(data16(26-16)); - for (int i = 0; i < 26; ++i) - { - *pchw++ = msbf(data16(97+i)); *pchw++ = msbf(data16(i)); - } - - // Input class 8: gX - m_prgichwOffsets[8] = 32 + 4 + 26*2; // 88 - *pchw++ = msbf(data16(1)); - *pchw++ = msbf(data16(1)); *pchw++ = msbf(data16(0)); *pchw++ = msbf(data16(0)); - *pchw++ = msbf(data16(120)); *pchw++ = msbf(data16(0)); - - // Input class 9: clsFraction - m_prgichwOffsets[9] = 88 + 4 + 1*2; // 127 - *pchw++ = msbf(data16(3)); - *pchw++ = msbf(data16(2)); *pchw++ = msbf(data16(1)); *pchw++ = msbf(data16(3-2)); - *pchw++ = msbf(data16(188)); *pchw++ = msbf(data16(0)); // 1/4 - *pchw++ = msbf(data16(189)); *pchw++ = msbf(data16(1)); // 1/2 - *pchw++ = msbf(data16(190)); *pchw++ = msbf(data16(2)); // 3/4 - - // Input class 10: # - m_prgichwOffsets[10] = 127 + 4 + 3*2; // 137 - *pchw++ = msbf(data16(1)); - *pchw++ = msbf(data16(1)); *pchw++ = msbf(data16(0)); *pchw++ = msbf(data16(0)); - *pchw++ = msbf(data16(35)); *pchw++ = msbf(data16(0)); // 1/4 - - m_prgichwOffsets[11] = 137 + 4 + 1*2; // 143 -} - -void GrLineBreakPass::SetUpAssocTest() -{ - m_nMaxRuleContext = m_nMaxChunk = 1; - m_nMaxRuleLoop = 5; - m_staBehavior = "Assoc"; - - m_pfsm = new GrFSM(); - Assert(m_pfsm); - m_pfsm->SetUpAssocTest(m_ipass); - - m_crul = 2; - - // Set up constraint code--succeed trivially. - m_prgbConstraintBlock = new byte[1]; - byte * pb = m_prgbConstraintBlock; - *pb++ = kopRetTrue; // RetTrue - - m_prgibConstraintStart = new data16[m_crul]; - m_prgibConstraintStart[0] = 0; - m_prgibConstraintStart[1] = 0; - - // Set up rule action code. - m_prgbActionBlock = new byte[7 + 8]; - pb = m_prgbActionBlock; - - // Rule 0: gX / # _ ^ ; // do nothing - - *pb++ = kopPutCopy; *pb++ = 0; // PutCopy 0 - *pb++ = kopNext; // Next - *pb++ = kopPutCopy; *pb++ = 0; // PutCopy 0 - *pb++ = kopNext; // Next - *pb++ = kopRetZero; // RetZero - - // Rule 1: gX {break = -2}; - - *pb++ = kopPutCopy; *pb++ = 0; // PutCopy 0 - *pb++ = kopPushByte; *pb++ = -2; // PushByte -2 - *pb++ = kopAttrSet; *pb++ = kslatBreak; // AttrSet breakweight - *pb++ = kopNext; // Next - *pb++ = kopRetZero; // RetZero - - m_prgibActionStart = new data16[m_crul]; - m_prgibActionStart[0] = 0; - m_prgibActionStart[1] = 7; -} - -void GrSubPass::SetUpAssocTest() -{ - if (m_ipass == 2) - { - m_nMaxRuleContext = m_nMaxChunk = 3; - m_nMaxRuleLoop = 5; - m_staBehavior = "Assoc"; - - m_pfsm = new GrFSM(); - Assert(m_pfsm); - m_pfsm->SetUpAssocTest(m_ipass); - - m_crul = 3; - - // Set up constraint code. - m_prgbConstraintBlock = new byte[1 + 10]; - byte * pb = m_prgbConstraintBlock; - *pb++ = kopRetTrue; // RetTrue - - *pb++ = kopCntxtItem; *pb++ = 1; // ContextItem 1 - *pb++ = kopPushSlotAttr;*pb++ = kslatBreak; // PushSlotAttr break 0 - *pb++ = 0; - *pb++ = kopPushByte; *pb++ = 2; // Push 2 - *pb++ = kopEqual; // Equal - *pb++ = kopOr; // Or - *pb++ = kopPopRet; // PopAndRet - - m_prgibConstraintStart = new data16[m_crul]; - m_prgibConstraintStart[0] = 0; - m_prgibConstraintStart[1] = 1; - m_prgibConstraintStart[2] = 0; - - // Set up rule action code. - m_prgbActionBlock = new byte[12 + 12 + 22]; - pb = m_prgbActionBlock; - - // Rule 0: clsOA clsE > clsELig:(1 2) _ ; - - *pb++ = kopPutSubs8bitObs; *pb++ = 0; // PutSubs 0 clsOA clsELig - *pb++ = 5; *pb++ = 0; - *pb++ = kopAssoc; *pb++ = 2; // Assoc 2 0 1 - *pb++ = 0; *pb++ = 1; - *pb++ = kopNext; // Next - *pb++ = kopDelete; // Delete - *pb++ = kopNext; // Next - *pb++ = kopRetZero; // RetZero - - // Rule 1: clsLC _ _ gX > @1 @5 @1 @5 / _ _ # {break==2} _ _ ; - - *pb++ = kopCopyNext; // CopyNext - *pb++ = kopInsert; // Insert - *pb++ = kopPutCopy; *pb++ = 2; // PutCopy 2 - *pb++ = kopNext; // Next - *pb++ = kopCopyNext; // CopyNext - line break - *pb++ = kopInsert; // Insert - *pb++ = kopPutCopy; *pb++ = -1; // PutCopy -1 - *pb++ = kopNext; // Next - *pb++ = kopCopyNext; // CopyNext - *pb++ = kopRetZero; // RetZero - - // Rule 2: _ clsFraction _ > clsNumerator:2 gSlash:2 clsDenom:2; - - *pb++ = kopInsert; // Insert - *pb++ = kopPutSubs8bitObs; *pb++ = 1; // PutSubs 1 clsFraction clsNumerator - *pb++ = 9; *pb++ = 1; - *pb++ = kopAssoc; *pb++ = 1; // Assoc 1 1 - *pb++ = 1; - *pb++ = kopNext; // Next - *pb++ = kopPutGlyph8bitObs; *pb++ = 3; // PutGlyph gSlash - *pb++ = kopNext; // Next - *pb++ = kopInsert; // Insert - *pb++ = kopPutSubs8bitObs; *pb++ = 0; // PutSubs 0 clsFraction clsDenom - *pb++ = 9; *pb++ = 2; - *pb++ = kopAssoc; *pb++ = 1; // Assoc 1 0 - *pb++ = 0; - *pb++ = kopNext; // Next - *pb++ = kopRetZero; // RetZero - - m_prgibActionStart = new data16[m_crul]; - m_prgibActionStart[0] = 0; - m_prgibActionStart[1] = 12; - m_prgibActionStart[2] = 12 + 12; - } - else if (m_ipass == 3) - { - m_nMaxRuleContext = m_nMaxChunk = 1; - m_nMaxRuleLoop = 3; - m_staBehavior = "Assoc"; - - m_pfsm = new GrFSM(); - Assert(m_pfsm); - m_pfsm->SetUpAssocTest(m_ipass); - - m_crul = 1; - - // Set up constraint code. - m_prgbConstraintBlock = new byte[1 + 10]; - byte * pb = m_prgbConstraintBlock; - *pb++ = kopRetTrue; // RetTrue - - *pb++ = kopCntxtItem; *pb++ = 0; // ContextItem 0 - *pb++ = kopPushSlotAttr;*pb++ = kslatBreak; // PushSlotAttr break 0 - *pb++ = 0; - *pb++ = kopPushByte; *pb++ = 2; // Push 2 - *pb++ = kopEqual; // Equal - *pb++ = kopOr; // Or - *pb++ = kopPopRet; // PopAndRet - - m_prgibConstraintStart = new data16[m_crul]; - m_prgibConstraintStart[0] = 1; - - m_prgbActionBlock = new byte[7]; - pb = m_prgbActionBlock; - - // Rule 0: _ > gHyphen / _ # {break == 2} ^; - - *pb++ = kopInsert; // Insert - *pb++ = kopPutGlyph8bitObs; *pb++ = 4; // PutGlyph 4 ('-' = 45) - *pb++ = kopNext; // Next - *pb++ = kopPushByte; *pb++ = 1; // Push 1 - *pb++ = kopPopRet; // PopAndRet - - m_prgibActionStart = new data16[m_crul]; - m_prgibActionStart[0] = 0; - } - else - Assert(false); -} - - -void GrFSM::SetUpAssocTest(int ipass) -{ - if (ipass == 1) - { - // Create machine class ranges. - m_cmcr = 2; - m_prgmcr = new GrFSMClassRange[m_cmcr]; - m_prgmcr[0].m_chwFirst = 35; // # - m_prgmcr[0].m_chwLast = 35; - m_prgmcr[0].m_col = 1; - - m_prgmcr[1].m_chwFirst = 120; // x - m_prgmcr[1].m_chwLast = 120; - m_prgmcr[1].m_col = 0; - - m_dimcrInit = 2; // (max power of 2 <= m_cmcr); - m_cLoop = 1; // log2(max power of 2 <= m_cmcr); - m_imcrStart = m_cmcr - m_dimcrInit; - - - m_crow = 4; - m_crowNonAcpt = 2; - m_crowFinal = 2; - m_rowFinalMin = m_crow - m_crowFinal; - m_ccol = 2; - - // Set up transition table. - m_prgrowTransitions = new short[(m_crow-m_crowFinal) * m_ccol]; // 4 - short * psn = m_prgrowTransitions; - *psn++ = 2; *psn++ = 1; - *psn++ = 3; *psn++ = 0; - - // Set up matched-rules tables. - m_prgrulnMatched = new data16[2]; // 2 = sum of rules matched for each accepting state - m_prgirulnMin = new data16[m_crow - m_crowNonAcpt + 1]; - - m_prgirulnMin[0] = 0; // s2: r1 - m_prgrulnMatched[0] = 1; - - m_prgirulnMin[1] = 1; // s3: r0 - m_prgrulnMatched[1] = 0; - - m_prgirulnMin[2] = 2; - } - else if (ipass == 2) - { - // Create machine class ranges. - m_cmcr = 13; - m_prgmcr = new GrFSMClassRange[m_cmcr]; - m_prgmcr[0].m_chwFirst = 35; // # - m_prgmcr[0].m_chwLast = 35; - m_prgmcr[0].m_col = 7; - - m_prgmcr[1].m_chwFirst = 65; // A - m_prgmcr[1].m_chwLast = 65; - m_prgmcr[1].m_col = 0; - - m_prgmcr[2].m_chwFirst = 69; // E - m_prgmcr[2].m_chwLast = 69; - m_prgmcr[2].m_col = 2; - - m_prgmcr[3].m_chwFirst = 79; // O - m_prgmcr[3].m_chwLast = 79; - m_prgmcr[3].m_col = 0; - - m_prgmcr[4].m_chwFirst = 97; // a - m_prgmcr[4].m_chwLast = 97; - m_prgmcr[4].m_col = 1; - - m_prgmcr[5].m_chwFirst = 98; // b - d - m_prgmcr[5].m_chwLast = 100; - m_prgmcr[5].m_col = 4; - - m_prgmcr[6].m_chwFirst = 101; // e - m_prgmcr[6].m_chwLast = 101; - m_prgmcr[6].m_col = 3; - - m_prgmcr[7].m_chwFirst = 102; // f - n - m_prgmcr[7].m_chwLast = 110; - m_prgmcr[7].m_col = 4; - - m_prgmcr[8].m_chwFirst = 111; // o - m_prgmcr[8].m_chwLast = 111; - m_prgmcr[8].m_col = 1; - - m_prgmcr[9].m_chwFirst = 112; // p - w - m_prgmcr[9].m_chwLast = 119; - m_prgmcr[9].m_col = 4; - - m_prgmcr[10].m_chwFirst = 120; // x - m_prgmcr[10].m_chwLast = 120; - m_prgmcr[10].m_col = 5; - - m_prgmcr[11].m_chwFirst = 121; // y - z - m_prgmcr[11].m_chwLast = 122; - m_prgmcr[11].m_col = 4; - - m_prgmcr[12].m_chwFirst = 188; // 1/4, 1/2, 3/4 - m_prgmcr[12].m_chwLast = 190; - m_prgmcr[12].m_col = 6; - - - m_dimcrInit = 8; // (max power of 2 <= m_cmcr); - m_cLoop = 3; // log2(max power of 2 <= m_cmcr); - m_imcrStart = m_cmcr - m_dimcrInit; - - - m_crow = 9; - m_crowNonAcpt = 6; - m_crowFinal = 3; - m_rowFinalMin = m_crow - m_crowFinal; - m_ccol = 8; - - // Set up transition table. - m_prgrowTransitions = new short[(m_crow-m_crowFinal) * m_ccol]; // 48 - short * psn = m_prgrowTransitions; - *psn++ = 1; *psn++ = 2; *psn++ = 0; *psn++ = 4; *psn++ = 3; *psn++ = 3; *psn++ = 6; *psn++ = 0; - *psn++ = 0; *psn++ = 0; *psn++ = 7; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; - *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 7; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 5; - *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 5; - *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 5; - *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 8; *psn++ = 0; *psn++ = 0; - - // Set up matched-rules tables. - m_prgrulnMatched = new data16[3]; // 3 = sum of rules matched for each accepting state - m_prgirulnMin = new data16[3+1]; // 3 = m_crow - m_crowNonAcpt - - m_prgirulnMin[0] = 0; // s6: r2 - m_prgrulnMatched[0] = 2; - - m_prgirulnMin[1] = 1; // s7: r0 - m_prgrulnMatched[1] = 0; - - m_prgirulnMin[2] = 2; // s8: r1 - m_prgrulnMatched[2] = 1; - - m_prgirulnMin[3] = 3; - } - else if (ipass == 3) - { - // Create machine class ranges. - m_cmcr = 1; - m_prgmcr = new GrFSMClassRange[m_cmcr]; - m_prgmcr[0].m_chwFirst = 35; // # - m_prgmcr[0].m_chwLast = 35; - m_prgmcr[0].m_col = 0; - - m_dimcrInit = 1; // (max power of 2 <= m_cmcr); - m_cLoop = 0; // log2(max power of 2 <= m_cmcr); - m_imcrStart = m_cmcr - m_dimcrInit; - - - m_crow = 2; - m_crowNonAcpt = 1; - m_crowFinal = 1; - m_rowFinalMin = m_crow - m_crowFinal; - m_ccol = 1; - - // Set up transition table. - m_prgrowTransitions = new short[(m_crow-m_crowFinal) * m_ccol]; // 1 - short * psn = m_prgrowTransitions; - *psn++ = 1; - - // Set up matched-rules tables. - m_prgrulnMatched = new data16[1]; // 1 = sum of rules matched for each accepting state - m_prgirulnMin = new data16[m_crow - m_crowNonAcpt + 1]; - - m_prgirulnMin[0] = 0; // s1: r0 - m_prgrulnMatched[0] = 0; - - m_prgirulnMin[1] = 1; - } -} - - -/*---------------------------------------------------------------------------------------------- - Second batch of association tests. - - PASS 1: - r0. clsSymbol _ > _ @1 / _ gNumber gHyphen # gNumber _; - r1. clsSymbol _ > _ @1 / _ gHyphen # _; - r2. _ clsSymbol > @6 _ / _ gNumber gHyphen # gNumber _; - r3. _ clsSymbol > @4 _ / _ gHyphen # _; - r4. clsLeft _ > @1 clsRight$1:1 / _ clsLetter gHyphen # _ gSpace; - r5. clsLeft _ > @1 clsRight$1:1 / _ clsLetter gHyphen # clsLetter _ gSpace; - r6. clsLeft _ > @1 clsRight$1:1 / _ clsLetter _ gSpace; - r7. clsLeft _ > @1 clsRight$1:1 / _ clsLetter clsLetter _ gSpace; - - Pass 1 machine classes: - mcSym: @, $, %, & 64, 36, 37, 38 - mcNum: 48-57 - mcHyphen: 45 - mcSpace: 32 - mcLet: 97-122 - mcLeft: ( [ { 40, 91, 123 - mcRight: ) ] } 41, 93, 125 - - Pass 1 FSM: (T=transition, F=final, A=accepting, NA=non-accepting) - - | mcSym mcNum mcHyph mcSpace mcLet mcLeft mcLB - ---------------------------------------------------------------------------------- - T NA s0 | s1 s2 s3 s4 - | - T NA s1 | s5 s6 - | - T NA s2 | s7 - | - T NA s3 | s8 - | - T NA s4 | s9 - | - T NA s5 | s10 - | - T NA s6 | s18 - | - T NA s7 | s11 - | - T NA s8 | s19 - | - T NA s9 | s12 s20 s13 - | - T NA s10 | s14 - | - T NA s11 | s15 - | - T NA s12 | s16 - | - T NA s13 | s21 - | - T NA s14 | s22 - | - T NA s15 | s23 - | - T NA s16 | s24 s17 - | - T NA s17 | s25 - | - F A s18 | - | - F A s19 | - | - F A s20 | - | - F A s21 | - | - F A s22 | - | - F A s23 | - | - F A s24 | - | - F A s25 | - - - Rules Matched: - s18: r1 - s19: r3 - s20: r6 - s21: r7 - s22: r0 - s23: r2 - s24: r4 - s25: r5 -----------------------------------------------------------------------------------------------*/ -void GrEngine::SetUpAssoc2Test() -{ - if (m_pctbl) - delete m_pctbl; - - m_pctbl = new GrClassTable(); - m_pctbl->SetUpAssoc2Test(); - - m_fLineBreak = true; - m_cchwPreXlbContext = 3; - m_cchwPostXlbContext = 2; -} - -void GrClassTable::SetUpAssoc2Test() -{ - m_ccls = 2; // number of classes - m_cclsLinear = 1; // number of classes in linear format (output classes) - - m_prgchwBIGGlyphList = new data16[13]; - - m_prgichwOffsets = new data16[m_ccls+1]; - - data16 * pchw = m_prgchwBIGGlyphList; - - // Output class 0: clsRight - m_prgichwOffsets[0] = 0; - *pchw++ = msbf(data16(41)); // ) - *pchw++ = msbf(data16(93)); // ] - *pchw++ = msbf(data16(125)); // } - - // Input class 1: clsLeft - m_prgichwOffsets[1] = 3; - *pchw++ = msbf(data16(3)); - *pchw++ = msbf(data16(2)); *pchw++ = msbf(data16(1)); *pchw++ = msbf(data16(3-2)); - *pchw++ = msbf(data16(40)); *pchw++ = msbf(data16(0)); // ( - *pchw++ = msbf(data16(91)); *pchw++ = msbf(data16(1)); // [ - *pchw++ = msbf(data16(123)); *pchw++ = msbf(data16(2)); // { - - m_prgichwOffsets[2] = 3 + 4 + 3*2; // 13 -} - -void GrSubPass::SetUpAssoc2Test() -{ - m_nMaxRuleContext = m_nMaxChunk = 6; - m_nMaxRuleLoop = 5; - m_staBehavior = "Assoc2"; - - m_pfsm = new GrFSM(); - Assert(m_pfsm); - m_pfsm->SetUpAssoc2Test(m_ipass); - - m_crul = 8; - - // Set up constraint code. - m_prgbConstraintBlock = new byte[1]; - byte * pb = m_prgbConstraintBlock; - *pb++ = kopRetTrue; // RetTrue - - m_prgibConstraintStart = new data16[m_crul]; - m_prgibConstraintStart[0] = 0; - m_prgibConstraintStart[1] = 0; - m_prgibConstraintStart[2] = 0; - m_prgibConstraintStart[3] = 0; - m_prgibConstraintStart[4] = 0; - m_prgibConstraintStart[5] = 0; - m_prgibConstraintStart[6] = 0; - m_prgibConstraintStart[7] = 0; - - // Set up rule action code. - m_prgbActionBlock = new byte[11 + 9 + 11 + 9 + 14 + 15 + 12 + 13]; - pb = m_prgbActionBlock; - - // Rule 0: clsSymbol _ > _ @1 / _ gNumber gHyphen # gNumber _; - - *pb++ = kopDelete; // Delete - *pb++ = kopNext; // Next - *pb++ = kopCopyNext; // CopyNext - *pb++ = kopCopyNext; // CopyNext - *pb++ = kopCopyNext; // CopyNext - *pb++ = kopCopyNext; // CopyNext - *pb++ = kopInsert; // Insert - *pb++ = kopPutCopy; *pb++ = -4; // PutCopy -4 - *pb++ = kopNext; // Next - *pb++ = kopRetZero; // RetZero - - // Rule 1: clsSymbol _ > _ @1 / _ gHyphen # _; - - *pb++ = kopDelete; // Delete - *pb++ = kopNext; // Next - *pb++ = kopCopyNext; // CopyNext - *pb++ = kopCopyNext; // CopyNext - *pb++ = kopInsert; // Insert - *pb++ = kopPutCopy; *pb++ = -2; // PutCopy -2 - *pb++ = kopNext; // Next - *pb++ = kopRetZero; // RetZero - - // Rule 2: _ clsSymbol > @6 _ / _ gNumber gHyphen # gNumber _; - - *pb++ = kopInsert; // Insert - *pb++ = kopPutCopy; *pb++ = 5; // PutCopy 5 - *pb++ = kopNext; // Next - *pb++ = kopCopyNext; // CopyNext - *pb++ = kopCopyNext; // CopyNext - *pb++ = kopCopyNext; // CopyNext - *pb++ = kopCopyNext; // CopyNext - *pb++ = kopDelete; // Delete - *pb++ = kopNext; // Next - *pb++ = kopRetZero; // RetZero - - // Rule 3: _ clsSymbol > @4 _ / _ gHyphen # _; - - *pb++ = kopInsert; // Insert - *pb++ = kopPutCopy; *pb++ = 3; // PutCopy 3 - *pb++ = kopNext; // Next - *pb++ = kopCopyNext; // CopyNext - *pb++ = kopCopyNext; // CopyNext - *pb++ = kopDelete; // Delete - *pb++ = kopNext; // Next - *pb++ = kopRetZero; // RetZero - - // Rule 4: clsLeft _ > @1 clsRight$1 / _ clsLetter gHyphen # _ gSpace; - - *pb++ = kopCopyNext; // CopyNext - *pb++ = kopCopyNext; // CopyNext - *pb++ = kopCopyNext; // CopyNext - *pb++ = kopCopyNext; // CopyNext - *pb++ = kopInsert; // Insert - *pb++ = kopPutSubs8bitObs; *pb++ = -3; // PutSubs -3 1 0 - *pb++ = 1; *pb++ = 0; - *pb++ = kopAssoc; *pb++ = 1; // Assoc 1 -3 - *pb++ = -3; - *pb++ = kopNext; // Next; - *pb++ = kopRetZero; // RetZero - - // Rule 5: clsLeft _ > @1 clsRight$1 / _ clsLetter gHyphen # clsLetter _ gSpace; - - *pb++ = kopCopyNext; // CopyNext - *pb++ = kopCopyNext; // CopyNext - *pb++ = kopCopyNext; // CopyNext - *pb++ = kopCopyNext; // CopyNext - *pb++ = kopCopyNext; // CopyNext - *pb++ = kopInsert; // Insert - *pb++ = kopPutSubs8bitObs; *pb++ = -4; // PutSubs -4 1 0 - *pb++ = 1; *pb++ = 0; - *pb++ = kopAssoc; *pb++ = 1; // Assoc 1 -4 - *pb++ = -4; - *pb++ = kopNext; // Next; - *pb++ = kopRetZero; // RetZero - - // Rule 6: clsLeft _ > @1 clsRight$1 / _ clsLetter _ gSpace; - - *pb++ = kopCopyNext; // CopyNext - *pb++ = kopCopyNext; // CopyNext - *pb++ = kopInsert; // Insert - *pb++ = kopPutSubs8bitObs; *pb++ = -1; // PutSubs -1 1 0 - *pb++ = 1; *pb++ = 0; - *pb++ = kopAssoc; *pb++ = 1; // Assoc 1 -1 - *pb++ = -1; - *pb++ = kopNext; // Next; - *pb++ = kopRetZero; // RetZero - - // Rule 7: clsLeft _ > @1 clsRight$1 / _ clsLetter clsLetter _ gSpace; - - *pb++ = kopCopyNext; // CopyNext - *pb++ = kopCopyNext; // CopyNext - *pb++ = kopCopyNext; // CopyNext - *pb++ = kopInsert; // Insert - *pb++ = kopPutSubs8bitObs; *pb++ = -2; // PutSubs -2 1 0 - *pb++ = 1; *pb++ = 0; - *pb++ = kopAssoc; *pb++ = 1; // Assoc 1 -2 - *pb++ = -2; - *pb++ = kopNext; // Next; - *pb++ = kopRetZero; // RetZero - - - m_prgibActionStart = new data16[m_crul]; - m_prgibActionStart[0] = 0; - m_prgibActionStart[1] = 11; - m_prgibActionStart[2] = 11 + 9; - m_prgibActionStart[3] = 20 + 11; - m_prgibActionStart[4] = 31 + 9; - m_prgibActionStart[5] = 40 + 14; - m_prgibActionStart[6] = 54 + 15; - m_prgibActionStart[7] = 69 + 12; -} - - -void GrFSM::SetUpAssoc2Test(int ipass) -{ - // Create machine class ranges. - m_cmcr = 10; - m_prgmcr = new GrFSMClassRange[m_cmcr]; - m_prgmcr[0].m_chwFirst = 32; // space - m_prgmcr[0].m_chwLast = 32; - m_prgmcr[0].m_col = 3; - - m_prgmcr[1].m_chwFirst = 35; // # - m_prgmcr[1].m_chwLast = 35; - m_prgmcr[1].m_col = 6; - - m_prgmcr[2].m_chwFirst = 36; // $, %, & - m_prgmcr[2].m_chwLast = 38; - m_prgmcr[2].m_col = 0; - - m_prgmcr[3].m_chwFirst = 40; // ( - m_prgmcr[3].m_chwLast = 40; - m_prgmcr[3].m_col = 5; - - m_prgmcr[4].m_chwFirst = 45; // - - m_prgmcr[4].m_chwLast = 45; - m_prgmcr[4].m_col = 2; - - m_prgmcr[5].m_chwFirst = 48; // 0 - 9 - m_prgmcr[5].m_chwLast = 57; - m_prgmcr[5].m_col = 1; - - m_prgmcr[6].m_chwFirst = 64; // @ - m_prgmcr[6].m_chwLast = 64; - m_prgmcr[6].m_col = 0; - - m_prgmcr[7].m_chwFirst = 91; // [ - m_prgmcr[7].m_chwLast = 91; - m_prgmcr[7].m_col = 5; - - m_prgmcr[8].m_chwFirst = 97; // a - z - m_prgmcr[8].m_chwLast = 122; - m_prgmcr[8].m_col = 4; - - m_prgmcr[9].m_chwFirst = 123; // { - m_prgmcr[9].m_chwLast = 123; - m_prgmcr[9].m_col = 5; - - - m_dimcrInit = 8; // (max power of 2 <= m_cmcr); - m_cLoop = 3; // log2(max power of 2 <= m_cmcr); - m_imcrStart = m_cmcr - m_dimcrInit; - - - m_crow = 26; - m_crowNonAcpt = 18; - m_crowFinal = 8; - m_rowFinalMin = m_crow - m_crowFinal; - m_ccol = 7; - - // Set up transition table. - m_prgrowTransitions = new short[(m_crow-m_crowFinal) * m_ccol]; // 126 - short * psn = m_prgrowTransitions; - *psn++ = 1; *psn++ = 2; *psn++ = 3; *psn++ = 0; *psn++ = 0; *psn++ = 4; *psn++ = 0; - *psn++ = 0; *psn++ = 5; *psn++ = 6; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; - *psn++ = 0; *psn++ = 0; *psn++ = 7; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; - *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 8; - *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 9; *psn++ = 0; *psn++ = 0; - *psn++ = 0; *psn++ = 0; *psn++ =10; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; - *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ =18; - *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ =11; - *psn++ =19; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; - *psn++ = 0; *psn++ = 0; *psn++ =12; *psn++ =20; *psn++ =13; *psn++ = 0; *psn++ = 0; - *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ =14; - *psn++ = 0; *psn++ =15; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; - *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ =16; - *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ =21; *psn++ = 0; *psn++ = 0; *psn++ = 0; - *psn++ = 0; *psn++ =22; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; - *psn++ =23; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; - *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ =24; *psn++ =17; *psn++ = 0; *psn++ = 0; - *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ =25; *psn++ = 0; *psn++ = 0; *psn++ = 0; - - // Set up matched-rules tables. - m_prgrulnMatched = new data16[8]; // 3 = sum of rules matched for each accepting state - m_prgirulnMin = new data16[m_crow - m_crowNonAcpt + 1]; - - m_prgirulnMin[0] = 0; // s18: r1 - m_prgrulnMatched[0] = 1; - - m_prgirulnMin[1] = 1; // s19: r3 - m_prgrulnMatched[1] = 3; - - m_prgirulnMin[2] = 2; // s20: r6 - m_prgrulnMatched[2] = 6; - - m_prgirulnMin[3] = 3; // s21: r7 - m_prgrulnMatched[3] = 7; - - m_prgirulnMin[4] = 4; // s22: r0 - m_prgrulnMatched[4] = 0; - - m_prgirulnMin[5] = 5; // s23: r2 - m_prgrulnMatched[5] = 2; - - m_prgirulnMin[6] = 6; // s24: r4 - m_prgrulnMatched[6] = 4; - - m_prgirulnMin[7] = 7; // s25: r5 - m_prgrulnMatched[7] = 5; - - m_prgirulnMin[8] = 8; -} - -/*---------------------------------------------------------------------------------------------- - Test of default associations - - PASS 1: - r0. gDollar _ > @1 gEquals; - r1. gAtSign > _ ; - - Pass 1 machine classes: - mcDollar: $ 36 - mcAt: @ 64 - - Pass 1 FSM: (T=transition, F=final, A=accepting, NA=non-accepting) - - | mcDollar mcAt - -------------------------------------- - T NA s0 | s1 s2 - | - F A s1 | - | - F A s2 | - - - Rules Matched: - s1: r0 - s2: r1 -----------------------------------------------------------------------------------------------*/ -void GrEngine::SetUpDefaultAssocTest() -{ - if (m_pctbl) - delete m_pctbl; - - m_pctbl = new GrClassTable(); - m_pctbl->SetUpDefaultAssocTest(); -} - -void GrClassTable::SetUpDefaultAssocTest() -{ - m_ccls = 1; // number of classes - m_cclsLinear = 1; // number of classes in linear format - - m_prgchwBIGGlyphList = new data16[1]; - - m_prgichwOffsets = new data16[m_ccls+1]; - - data16 * pchw = m_prgchwBIGGlyphList; - - // Output class 0: gEquals - m_prgichwOffsets[0] = 0; - *pchw++ = msbf(data16(61)); - - m_prgichwOffsets[1] = 1; -} - -void GrSubPass::SetUpDefaultAssocTest() -{ - m_nMaxRuleContext = m_nMaxChunk = 1; - m_nMaxRuleLoop = 5; - m_staBehavior = "DefaultAssoc"; - - m_pfsm = new GrFSM(); - Assert(m_pfsm); - m_pfsm->SetUpDefaultAssocTest(); - - m_crul = 2; - - // Set up constraint code. - m_prgbConstraintBlock = new byte[1]; - byte * pb = m_prgbConstraintBlock; - *pb++ = kopRetTrue; - - m_prgibConstraintStart = new data16[m_crul]; - m_prgibConstraintStart[0] = 0; - m_prgibConstraintStart[1] = 0; - - // Set up rule action code. - m_prgbActionBlock = new byte[6 + 3]; - pb = m_prgbActionBlock; - - // Rule 0: gDollar _ > @1 gEquals; - - *pb++ = kopCopyNext; // CopyNext - *pb++ = kopInsert; // Insert - *pb++ = kopPutGlyph8bitObs; *pb++ = 0; // PutGlyph 0 - *pb++ = kopNext; // Next - *pb++ = kopRetZero; // RetZero - - // Rule 1: gAtSign > _ ; - - *pb++ = kopDelete; // Delete - *pb++ = kopNext; // Next - *pb++ = kopRetZero; // RetZero - - m_prgibActionStart = new data16[m_crul]; - m_prgibActionStart[0] = 0; - m_prgibActionStart[1] = 6; -} - - -void GrFSM::SetUpDefaultAssocTest() -{ - // Create machine class ranges. - m_cmcr = 2; - m_prgmcr = new GrFSMClassRange[m_cmcr]; - m_prgmcr[0].m_chwFirst = 36; // $ - m_prgmcr[0].m_chwLast = 36; - m_prgmcr[0].m_col = 0; - - m_prgmcr[1].m_chwFirst = 64; // @ - m_prgmcr[1].m_chwLast = 64; - m_prgmcr[1].m_col = 1; - - - m_dimcrInit = 2; // (max power of 2 <= m_cmcr); - m_cLoop = 1; // log2(max power of 2 <= m_cmcr); - m_imcrStart = m_cmcr - m_dimcrInit; - - - m_crow = 3; - m_crowNonAcpt = 1; - m_crowFinal = 2; - m_rowFinalMin = m_crow - m_crowFinal; - m_ccol = 2; - - // Set up transition table. - m_prgrowTransitions = new short[(m_crow-m_crowFinal) * m_ccol]; // 2 - short * psn = m_prgrowTransitions; - *psn++ = 1; *psn++ = 2; - - // Set up matched-rules tables. - m_prgrulnMatched = new data16[2]; // 2 = sum of rules matched for each accepting state - m_prgirulnMin = new data16[m_crow - m_crowNonAcpt + 1]; - - m_prgirulnMin[0] = 0; // s1: r0 - m_prgrulnMatched[0] = 0; - - m_prgirulnMin[1] = 1; // s2: r1 - m_prgrulnMatched[1] = 1; - - m_prgirulnMin[2] = 2; -} - -/*---------------------------------------------------------------------------------------------- - Test of features. The ID of "theFeature" == 234, its index is 0. The default value is 1. - - PASS 1: - if (theFeature == 0) // * -> $ - r0. gAsterisk > gDollar ; - else if (theFeature == 1) // * -> % - r1. gAsterisk > gPercent ; - else // * -> @ - r2. gAsterisk > gAt ; - - Pass 1 machine classes: - mcAsterisk: * 42 - - Pass 1 FSM: (T=transition, F=final, A=accepting, NA=non-accepting) - - | mcAsterisk - -------------------------------- - T NA s0 | s1 - | - F A s1 | - - - Rules Matched: - s1: r0, r1, r2 -----------------------------------------------------------------------------------------------*/ -void GrEngine::SetUpFeatureTest() -{ - AddFeature(234, 0, 1, 1); - - if (m_pctbl) - delete m_pctbl; - - m_pctbl = new GrClassTable(); - m_pctbl->SetUpFeatureTest(); -} - -void GrClassTable::SetUpFeatureTest() -{ - m_ccls = 4; // number of classes - m_cclsLinear = 4; // number of classes in linear format - - m_prgchwBIGGlyphList = new data16[4]; - - m_prgichwOffsets = new data16[m_ccls + 1]; - - data16 * pchw = m_prgchwBIGGlyphList; - - m_prgichwOffsets[0] = 0; - *pchw++ = msbf(data16(36)); // $ - - m_prgichwOffsets[1] = 1; - *pchw++ = msbf(data16(37)); // % - - m_prgichwOffsets[2] = 2; - *pchw++ = msbf(data16(64)); // @ - - m_prgichwOffsets[3] = 3; - *pchw++ = msbf(data16(42)); // * - - m_prgichwOffsets[4] = 4; -} - -void GrSubPass::SetUpFeatureTest() -{ - m_nMaxRuleContext = m_nMaxChunk = 1; - m_nMaxRuleLoop = 5; - m_staBehavior = "Feature"; - - m_pfsm = new GrFSM(); - Assert(m_pfsm); - m_pfsm->SetUpFeatureTest(); - - m_crul = 3; - - // Set up constraint code. - m_prgbConstraintBlock = new byte[1 + 6 + 12 + 12]; - byte * pb = m_prgbConstraintBlock; - *pb++ = kopRetTrue; - - // (theFeature == 0) - *pb++ = kopPushFeat; *pb++ = 0; // PushFeat 0 - *pb++ = kopPushByte; *pb++ = 0; // PushByte 0 - *pb++ = kopEqual; // Equal - *pb++ = kopPopRet; // PopAndRet - - // (theFeature != 0 && theFeature == 1) - *pb++ = kopPushFeat; *pb++ = 0; // PushFeat 0 - *pb++ = kopPushByte; *pb++ = 0; // PushByte 0 - *pb++ = kopNotEq; // NotEq - *pb++ = kopPushFeat; *pb++ = 0; // PushFeat 0 - *pb++ = kopPushByte; *pb++ = 1; // PushByte 1 - *pb++ = kopEqual; // Equal - *pb++ = kopAnd; // And - *pb++ = kopPopRet; // PopAndRet - - // (theFeature != 0 && theFeature != 1) - *pb++ = kopPushFeat; *pb++ = 0; // PushFeat 0 - *pb++ = kopPushByte; *pb++ = 0; // PushByte 0 - *pb++ = kopNotEq; // NotEq - *pb++ = kopPushFeat; *pb++ = 0; // PushFeat 0 - *pb++ = kopPushByte; *pb++ = 1; // PushByte 1 - *pb++ = kopNotEq; // NotEq - *pb++ = kopAnd; // And - *pb++ = kopPopRet; // PopAndRet - - m_prgibConstraintStart = new data16[m_crul]; - m_prgibConstraintStart[0] = 1; - m_prgibConstraintStart[1] = 1 + 6; - m_prgibConstraintStart[2] = 1 + 6 + 12; - - // Set up rule action code. - m_prgbActionBlock = new byte[4 + 4 + 4]; - pb = m_prgbActionBlock; - - // Rule 0: gAsterisk > gDollar ; - - *pb++ = kopPutGlyph8bitObs; *pb++ = 0; // PutGlyph 0 - *pb++ = kopNext; // Next - *pb++ = kopRetZero; // RetZero - - // Rule 1: gAsterisk > gPercent ; - - *pb++ = kopPutGlyph8bitObs; *pb++ = 1; // PutGlyph 1 - *pb++ = kopNext; // Next - *pb++ = kopRetZero; // RetZero - - // Rule 2: gAsterisk > gAt ; - - *pb++ = kopPutGlyph8bitObs; *pb++ = 2; // PutGlyph 2 - *pb++ = kopNext; // Next - *pb++ = kopRetZero; // RetZero - - m_prgibActionStart = new data16[m_crul]; - m_prgibActionStart[0] = 0; - m_prgibActionStart[1] = 4; - m_prgibActionStart[2] = 4 + 4; -} - - -void GrFSM::SetUpFeatureTest() -{ - // Create machine class ranges. - m_cmcr = 1; - m_prgmcr = new GrFSMClassRange[m_cmcr]; - m_prgmcr[0].m_chwFirst = 42; // * - m_prgmcr[0].m_chwLast = 42; - m_prgmcr[0].m_col = 0; - - - m_dimcrInit = 1; // (max power of 2 <= m_cmcr); - m_cLoop = 0; // log2(max power of 2 <= m_cmcr); - m_imcrStart = m_cmcr - m_dimcrInit; - - - m_crow = 2; - m_crowNonAcpt = 1; - m_crowFinal = 1; - m_rowFinalMin = m_crow - m_crowFinal; - m_ccol = 1; - - // Set up transition table. - m_prgrowTransitions = new short[(m_crow-m_crowFinal) * m_ccol]; // 1 - short * psn = m_prgrowTransitions; - *psn++ = 1; - - // Set up matched-rules tables. - m_prgrulnMatched = new data16[3]; // 3 = sum of rules matched for each accepting state - m_prgirulnMin = new data16[m_crow - m_crowNonAcpt + 1]; - - m_prgirulnMin[0] = 0; // s1: r0, r1, r2 - m_prgrulnMatched[0] = 0; - m_prgrulnMatched[1] = 1; - m_prgrulnMatched[2] = 2; - - m_prgirulnMin[1] = 3; -} - - -/*---------------------------------------------------------------------------------------------- - Tests of ligatures and components. - - PASS 1 (line-break): - r0. clsLetter { break = 2 } - - Pass 1 machine classes: - mcLetter: a - z 97 - 122 - - Pass 1 FSM: (T=transition, F=final, A=accepting, NA=non-accepting) - - | clsLetter - -------------------------------- - T NA s0 | s1 - | - F A s1 | - - - Rules Matched: - s1: r0 - - - PASS 2 (substitution): - r0. gX gY gZ > gCapX:(1 2 4) { comp {X.ref=@1; Y.ref=@2; Z.ref=@4 }} _ _ - / _ _ # {break==2} _; - r1. gX gY gZ > _ _ gCapZ:(1 3 4) { comp {X.ref=@1; Y.ref=@3; Z.ref=@4 }} - / _ # {break==2} _ _; - r2. gX gY gZ > _ gCapY:(1 2 3) { comp {X.ref=@1; Y.ref=@2; Z.ref=@3 }} gPlus; - - Pass 2 machine classes: - mcX: x 120 - mcY: y 121 - mcZ: z 122 - mcLB: 35 - - - Pass 2 FSM: - | mcX mcY mcZ mcLB - ---------------------------------------------------- - T NA s0 | s1 - | - - - - T NA s1 | s2 s3 - | - - - - T NA s2 | s6 s4 - | - - - - T NA s3 | s5 - | - - - - T NA s4 | s7 - | - - - - T NA s5 | s8 - | - - - - F A s6 | - | - - - - F A s7 | - | - - - - F A s8 | - | - - - - - Rules matched: - s6: r2 - s7: r0 - s8: r1 -----------------------------------------------------------------------------------------------*/ -void GrEngine::SetUpLigatureTest() -{ - if (m_pctbl) - delete m_pctbl; - - m_pctbl = new GrClassTable(); - m_pctbl->SetUpLigatureTest(); - - m_pgtbl = new GrGlyphTable(); - m_pgtbl->SetUpLigatureTest(); - - m_fLineBreak = true; - m_cchwPreXlbContext = 2; - m_cchwPostXlbContext = 2; -} - -void GrClassTable::SetUpLigatureTest() -{ - m_ccls = 7; // number of classes - m_cclsLinear = 7; // number of classes in linear format (all classes are single-item) - - m_prgchwBIGGlyphList = new data16[7]; - - m_prgichwOffsets = new data16[m_ccls+1]; - - data16 * pchw = m_prgchwBIGGlyphList; - - // Class 0: gCapX - m_prgichwOffsets[0] = 0; - *pchw++ = msbf(data16(88)); // X - - // Class 1: gCapY - m_prgichwOffsets[1] = 1; - *pchw++ = msbf(data16(89)); // Y - - // Class 2: gCapZ - m_prgichwOffsets[2] = 2; - *pchw++ = msbf(data16(90)); // Z - - // Class 3: gPlus - m_prgichwOffsets[3] = 3; - *pchw++ = msbf(data16(43)); // + - - // Class 4: gX - m_prgichwOffsets[4] = 4; - *pchw++ = msbf(data16(120)); // x - - // Class 5: gY - m_prgichwOffsets[5] = 5; - *pchw++ = msbf(data16(121)); // y - - // Class 6: gZ - m_prgichwOffsets[6] = 6; - *pchw++ = msbf(data16(122)); // z - - m_prgichwOffsets[7] = 7; -} - -void GrGlyphTable::SetUpLigatureTest() -{ - SetNumberOfGlyphs(128); - SetNumberOfStyles(1); - - GrGlyphSubTable * pgstbl = new GrGlyphSubTable(); - Assert(pgstbl); - - pgstbl->Initialize(1, 0, 128, 10, 4); - SetSubTable(0, pgstbl); - - SetNumberOfComponents(4); // comp.w, comp.x, comp.y, comp.z - - pgstbl->SetUpLigatureTest(); -} - -/*********************************************************************************************** - TODO: This method is BROKEN because m_prgibBIGAttrValues has been changed. It is no - longer a data16 *. The Gloc table can contain 16-bit or 32-bit entries and must be - accessed accordingly. -***********************************************************************************************/ -void GrGlyphSubTable::SetUpLigatureTest() -{ - m_nAttrIDLim = 20; - - m_pgatbl = new GrGlyphAttrTable(); - m_pgatbl->Initialize(0, 102); - - for (int i = 0; i < 88; i++) - m_prgibBIGAttrValues[i] = (byte)msbf(data16(0)); - - m_prgibBIGAttrValues[88] = (byte)msbf(data16(0)); - m_prgibBIGAttrValues[89] = (byte)msbf(data16(34)); - m_prgibBIGAttrValues[90] = (byte)msbf(data16(68)); - - for (i = 91; i < 128; i++) - m_prgibBIGAttrValues[i] = (byte)msbf(data16(102)); - - m_pgatbl->SetUpLigatureTest(); -} - -void GrGlyphAttrTable::SetUpLigatureTest() -{ - // Glyph 88 'X' (2 runs; offset = 0): - // 0 = 0 comp.w undefined - // 1 = 8 comp.x: (0,0, 25,100) - // 2 = 12 comp.y: (25,0, 75,100) - // 3 = 16 comp.z: (75,0, 100,100) - // 4-7 = 0 comp.w box corners - // 8 = 100 comp.x. top - // 9 = 0 bottom - // 10= 0 left - // 11= 25 right - // 12= 100 comp.y. top - // 13= 0 bottom - // 14= 25 left - // 15= 75 right - // 16= 100 comp.z. top - // 17= 0 bottom - // 18= 75 left - // 19= 100 right - // - // Glyph 89 (2 runs; offset = 34): - // 0 = 0 comp.w undefined - // 1 = 8 comp.x: (0,0, 33,100) - // 2 = 12 comp.y: (33,0, 67,100) - // 3 = 16 comp.z: (67,0, 100,100) - // 4-7 = 0 comp.w box corners - // 8 = 100 comp.x. top - // 9 = 0 bottom - // 10= 0 left - // 11= 33 right - // 12= 100 comp.y. top - // 13= 0 bottom - // 14= 33 left - // 15= 67 right - // 16= 100 comp.z. top - // 17= 0 bottom - // 18= 67 left - // 19= 100 right - // - // Glyph 90 (2 runs; offset = 68): - // 0 = 0 comp.w undefined - // 1 = 8 comp.x: (0,0, 10,100) - // 2 = 12 comp.y: (10,0, 90,100) - // 3 = 16 comp.z: (90,0, 100,100) - // 4-7 = 0 comp.w box corners - // 8 = 100 comp.x. top - // 9 = 0 bottom - // 10= 0 left - // 11= 10 right - // 12= 100 comp.y. top - // 13= 0 bottom - // 14= 10 left - // 15= 90 right - // 16= 100 comp.z. top - // 17= 0 bottom - // 18= 90 left - // 19= 100 right - - byte * pbBIG = m_prgbBIGEntries; - - GrGlyphAttrRun gatrun; - - // Glyph 88 'X' - gatrun.m_bMinAttrID = 1; - gatrun.m_cAttrs = 3; - gatrun.m_rgchwBIGValues[0] = msbf(data16(8)); - gatrun.m_rgchwBIGValues[1] = msbf(data16(12)); - gatrun.m_rgchwBIGValues[2] = msbf(data16(16)); - memcpy(pbBIG, &gatrun, 8); // 8 = 3*2 + 2 - pbBIG += 8; - gatrun.m_bMinAttrID = 8; // comp.x.top - gatrun.m_cAttrs = 12; - gatrun.m_rgchwBIGValues[0] = msbf(data16(100)); - gatrun.m_rgchwBIGValues[1] = msbf(data16(0)); - gatrun.m_rgchwBIGValues[2] = msbf(data16(0)); - gatrun.m_rgchwBIGValues[3] = msbf(data16(25)); - gatrun.m_rgchwBIGValues[4] = msbf(data16(100)); - gatrun.m_rgchwBIGValues[5] = msbf(data16(0)); - gatrun.m_rgchwBIGValues[6] = msbf(data16(25)); - gatrun.m_rgchwBIGValues[7] = msbf(data16(75)); - gatrun.m_rgchwBIGValues[8] = msbf(data16(100)); - gatrun.m_rgchwBIGValues[9] = msbf(data16(0)); - gatrun.m_rgchwBIGValues[10] = msbf(data16(75)); - gatrun.m_rgchwBIGValues[11] = msbf(data16(100)); - memcpy(pbBIG, &gatrun, 26); // 26 = 12*2 + 2 - pbBIG += 26; - - // Glyph 89 'Y' - gatrun.m_bMinAttrID = 1; - gatrun.m_cAttrs = 3; - gatrun.m_rgchwBIGValues[0] = msbf(data16(8)); - gatrun.m_rgchwBIGValues[1] = msbf(data16(12)); - gatrun.m_rgchwBIGValues[2] = msbf(data16(16)); - memcpy(pbBIG, &gatrun, 8); // 8 = 3*2 + 2 - pbBIG += 8; - gatrun.m_bMinAttrID = 8; // comp.x.top - gatrun.m_cAttrs = 12; - gatrun.m_rgchwBIGValues[0] = msbf(data16(100)); - gatrun.m_rgchwBIGValues[1] = msbf(data16(0)); - gatrun.m_rgchwBIGValues[2] = msbf(data16(0)); - gatrun.m_rgchwBIGValues[3] = msbf(data16(33)); - gatrun.m_rgchwBIGValues[4] = msbf(data16(100)); - gatrun.m_rgchwBIGValues[5] = msbf(data16(0)); - gatrun.m_rgchwBIGValues[6] = msbf(data16(33)); - gatrun.m_rgchwBIGValues[7] = msbf(data16(67)); - gatrun.m_rgchwBIGValues[8] = msbf(data16(100)); - gatrun.m_rgchwBIGValues[9] = msbf(data16(0)); - gatrun.m_rgchwBIGValues[10] = msbf(data16(67)); - gatrun.m_rgchwBIGValues[11] = msbf(data16(100)); - memcpy(pbBIG, &gatrun, 26); // 26 = 12*2 + 2 - pbBIG += 26; - - // Glyph 90 'Z' - gatrun.m_bMinAttrID = 1; - gatrun.m_cAttrs = 3; - gatrun.m_rgchwBIGValues[0] = msbf(data16(8)); - gatrun.m_rgchwBIGValues[1] = msbf(data16(12)); - gatrun.m_rgchwBIGValues[2] = msbf(data16(16)); - memcpy(pbBIG, &gatrun, 8); // 8 = 3*2 + 2 - pbBIG += 8; - gatrun.m_bMinAttrID = 8; // comp.x.top - gatrun.m_cAttrs = 12; - gatrun.m_rgchwBIGValues[0] = msbf(data16(100)); - gatrun.m_rgchwBIGValues[1] = msbf(data16(0)); - gatrun.m_rgchwBIGValues[2] = msbf(data16(0)); - gatrun.m_rgchwBIGValues[3] = msbf(data16(10)); - gatrun.m_rgchwBIGValues[4] = msbf(data16(100)); - gatrun.m_rgchwBIGValues[5] = msbf(data16(0)); - gatrun.m_rgchwBIGValues[6] = msbf(data16(10)); - gatrun.m_rgchwBIGValues[7] = msbf(data16(90)); - gatrun.m_rgchwBIGValues[8] = msbf(data16(100)); - gatrun.m_rgchwBIGValues[9] = msbf(data16(0)); - gatrun.m_rgchwBIGValues[10] = msbf(data16(90)); - gatrun.m_rgchwBIGValues[11] = msbf(data16(100)); - memcpy(pbBIG, &gatrun, 26); // 26 = 12*2 + 2 - pbBIG += 26; - - Assert(pbBIG == m_prgbBIGEntries + 102); -} - -void GrLineBreakPass::SetUpLigatureTest() -{ - m_nMaxRuleContext = m_nMaxChunk = 1; - m_nMaxRuleLoop = 5; - m_staBehavior = "Ligatures"; - - m_pfsm = new GrFSM(); - Assert(m_pfsm); - m_pfsm->SetUpLigatureTest(m_ipass); - - m_crul = 1; - - // Set up constraint code--succeed trivially. - m_prgbConstraintBlock = new byte[1]; - byte * pb = m_prgbConstraintBlock; - *pb++ = kopRetTrue; // RetTrue - - m_prgibConstraintStart = new data16[m_crul]; - m_prgibConstraintStart[0] = 0; - - // Set up rule action code. - m_prgbActionBlock = new byte[8]; - pb = m_prgbActionBlock; - - // Rule 0: clsLetter { break = 2 } - - *pb++ = kopPutCopy; *pb++ = 0; // PutCopy 0 - *pb++ = kopPushByte; *pb++ = 2; // PushByte 2 - *pb++ = kopAttrSet; *pb++ = kslatBreak; // AttrSet breakweight - *pb++ = kopNext; // Next - *pb++ = kopRetZero; // RetZero - - m_prgibActionStart = new data16[m_crul]; - m_prgibActionStart[0] = 0; -} - -void GrSubPass::SetUpLigatureTest() -{ - if (m_ipass == 2) - { - m_nMaxRuleContext = m_nMaxChunk = 4; - m_nMaxRuleLoop = 5; - m_staBehavior = "Ligatures"; - - m_pfsm = new GrFSM(); - Assert(m_pfsm); - m_pfsm->SetUpLigatureTest(m_ipass); - - m_crul = 3; - - // Set up constraint code. - m_prgbConstraintBlock = new byte[1 + 10 + 10]; - byte * pb = m_prgbConstraintBlock; - *pb++ = kopRetTrue; // RetTrue - - *pb++ = kopCntxtItem; *pb++ = 2; // ContextItem 2 - *pb++ = kopPushSlotAttr;*pb++ = kslatBreak; // PushSlotAttr break 0 - *pb++ = 0; - *pb++ = kopPushByte; *pb++ = 2; // Push 2 - *pb++ = kopEqual; // Equal - *pb++ = kopOr; // Or - *pb++ = kopPopRet; // PopAndRet - - *pb++ = kopCntxtItem; *pb++ = 1; // ContextItem 1 - *pb++ = kopPushSlotAttr;*pb++ = kslatBreak; // PushSlotAttr break 0 - *pb++ = 0; - *pb++ = kopPushByte; *pb++ = 2; // Push 2 - *pb++ = kopEqual; // Equal - *pb++ = kopOr; // Or - *pb++ = kopPopRet; // PopAndRet - - m_prgibConstraintStart = new data16[m_crul]; - m_prgibConstraintStart[0] = 1; - m_prgibConstraintStart[1] = 11; - m_prgibConstraintStart[2] = 0; - - // Set up rule action code. - m_prgbActionBlock = new byte[29 + 29 + 29]; - pb = m_prgbActionBlock; - - // Rule 0: gX gY gZ > gCapX:(1 2 4) { comp {X.ref=@1; Y.ref=@2; Z.ref=@4 }} _ _ - // / _ _ # {break==2} _; - - *pb++ = kopPutGlyph8bitObs; *pb++ = 0; // PutGlyph 0 (gCapX) - *pb++ = kopAssoc; *pb++ = 3; // Assoc 3 0 1 3 - *pb++ = 0; *pb++ = 1; *pb++ = 3; - *pb++ = kopPushByte; *pb++ = 0; // Push 0 - *pb++ = kopIAttrSetSlot; // IAttrSetSlot comp_ref x - *pb++ = kslatCompRef; *pb++ = 1; - *pb++ = kopPushByte; *pb++ = 1; // Push 1 - *pb++ = kopIAttrSetSlot; // IAttrSetSlot comp_ref y - *pb++ = kslatCompRef; *pb++ = 2; - *pb++ = kopPushByte; *pb++ = 3; // Push 3 - *pb++ = kopIAttrSetSlot; // IAttrSetSlot comp_ref z - *pb++ = kslatCompRef; *pb++ = 3; - *pb++ = kopNext; // Next - *pb++ = kopDelete; // Delete - *pb++ = kopNext; // Next - *pb++ = kopCopyNext; // CopyNext - *pb++ = kopDelete; // Delete - *pb++ = kopNext; // Next - *pb++ = kopRetZero; // RetZero - - // Rule 1: gX gY gZ > _ _ gCapZ:(1 3 4) { comp {X.ref=@1; Y.ref=@3; Z.ref=@4 }} - // / _ # {break==2} _ _; - - *pb++ = kopDelete; // Delete - *pb++ = kopNext; // Next - *pb++ = kopCopyNext; // CopyNext - *pb++ = kopDelete; // Delete - *pb++ = kopNext; // Next - *pb++ = kopPutGlyph8bitObs; *pb++ = 2; // PutGlyph 2 (gCapZ) - *pb++ = kopAssoc; *pb++ = 3; // Assoc 3 -3 -1 0 - *pb++ = -3; *pb++ = -1; *pb++ = 0; - *pb++ = kopPushByte; *pb++ = -3; // Push -3 - *pb++ = kopIAttrSetSlot; // IAttrSetSlot comp_ref x - *pb++ = kslatCompRef; *pb++ = 1; - *pb++ = kopPushByte; *pb++ = -1; // Push -1 - *pb++ = kopIAttrSetSlot; // IAttrSetSlot comp_ref y - *pb++ = kslatCompRef; *pb++ = 2; - *pb++ = kopPushByte; *pb++ = 0; // Push 0 - *pb++ = kopIAttrSetSlot; // IAttrSetSlot comp_ref z - *pb++ = kslatCompRef; *pb++ = 3; - *pb++ = kopNext; // Next - *pb++ = kopRetZero; // RetZero - - // Rule 2: gX gY gZ > _ gCapY:(1 2 3) { comp {X.ref=@1; Y.ref=@2; Z.ref=@3 }} gPlus; - - *pb++ = kopDelete; // Delete - *pb++ = kopNext; // Next - *pb++ = kopPutGlyph8bitObs; *pb++ = 1; // PutGlyph 1 (gCapY) - *pb++ = kopAssoc; *pb++ = 3; // Assoc 3 -1 0 1 - *pb++ = -1; *pb++ = 0; *pb++ = 1; - *pb++ = kopPushByte; *pb++ = -1; // Push -1 - *pb++ = kopIAttrSetSlot; // IAttrSetSlot comp_ref x - *pb++ = kslatCompRef; *pb++ = 1; - *pb++ = kopPushByte; *pb++ = 0; // Push 0 - *pb++ = kopIAttrSetSlot; // IAttrSetSlot comp_ref y - *pb++ = kslatCompRef; *pb++ = 2; - *pb++ = kopPushByte; *pb++ = 1; // Push 1 - *pb++ = kopIAttrSetSlot; // IAttrSetSlot comp_ref z - *pb++ = kslatCompRef; *pb++ = 3; - *pb++ = kopNext; // Next - *pb++ = kopPutGlyph8bitObs; *pb++ = 3; // PutGlyph 3 (gPlus) - *pb++ = kopNext; // Next - *pb++ = kopRetZero; // RetZero - - m_prgibActionStart = new data16[m_crul]; - m_prgibActionStart[0] = 0; - m_prgibActionStart[1] = 29; - m_prgibActionStart[2] = 29 + 29; - } - else - Assert(false); -} - - -void GrFSM::SetUpLigatureTest(int ipass) -{ - if (ipass == 1) - { - // Create machine class ranges. - m_cmcr = 1; - m_prgmcr = new GrFSMClassRange[m_cmcr]; - m_prgmcr[0].m_chwFirst = 97; // a - z - m_prgmcr[0].m_chwLast = 122; - m_prgmcr[0].m_col = 0; - - m_dimcrInit = 1; // (max power of 2 <= m_cmcr); - m_cLoop = 0; // log2(max power of 2 <= m_cmcr); - m_imcrStart = m_cmcr - m_dimcrInit; - - - m_crow = 2; - m_crowNonAcpt = 1; - m_crowFinal = 1; - m_rowFinalMin = m_crow - m_crowFinal; - m_ccol = 1; - - // Set up transition table. - m_prgrowTransitions = new short[(m_crow-m_crowFinal) * m_ccol]; // 1 - short * psn = m_prgrowTransitions; - *psn++ = 1; - - // Set up matched-rules tables. - m_prgrulnMatched = new data16[1]; // 1 = sum of rules matched for each accepting state - m_prgirulnMin = new data16[m_crow - m_crowNonAcpt + 1]; - - m_prgirulnMin[0] = 0; // s1: r0 - m_prgrulnMatched[0] = 0; - - m_prgirulnMin[1] = 1; - } - else if (ipass == 2) - { - // Create machine class ranges. - m_cmcr = 4; - m_prgmcr = new GrFSMClassRange[m_cmcr]; - m_prgmcr[0].m_chwFirst = 35; // # - m_prgmcr[0].m_chwLast = 35; - m_prgmcr[0].m_col = 3; - - m_prgmcr[1].m_chwFirst = 120; // x - m_prgmcr[1].m_chwLast = 120; - m_prgmcr[1].m_col = 0; - - m_prgmcr[2].m_chwFirst = 121; // y - m_prgmcr[2].m_chwLast = 121; - m_prgmcr[2].m_col = 1; - - m_prgmcr[3].m_chwFirst = 122; // z - m_prgmcr[3].m_chwLast = 123; - m_prgmcr[3].m_col = 2; - - - m_dimcrInit = 4; // (max power of 2 <= m_cmcr); - m_cLoop = 2; // log2(max power of 2 <= m_cmcr); - m_imcrStart = m_cmcr - m_dimcrInit; - - - m_crow = 9; - m_crowNonAcpt = 6; - m_crowFinal = 3; - m_rowFinalMin = m_crow - m_crowFinal; - m_ccol = 4; - - // Set up transition table. - m_prgrowTransitions = new short[(m_crow-m_crowFinal) * m_ccol]; // 24 - short * psn = m_prgrowTransitions; - *psn++ = 1; *psn++ = 0; *psn++ = 0; *psn++ = 0; - *psn++ = 0; *psn++ = 2; *psn++ = 0; *psn++ = 3; - *psn++ = 0; *psn++ = 0; *psn++ = 6; *psn++ = 4; - *psn++ = 0; *psn++ = 5; *psn++ = 0; *psn++ = 0; - *psn++ = 0; *psn++ = 0; *psn++ = 7; *psn++ = 0; - *psn++ = 0; *psn++ = 0; *psn++ = 8; *psn++ = 0; - - // Set up matched-rules tables. - m_prgrulnMatched = new data16[3]; // 3 = sum of rules matched for each accepting state - m_prgirulnMin = new data16[3+1]; // 3 = m_crow - m_crowNonAcpt - - m_prgirulnMin[0] = 0; // s6: r2 - m_prgrulnMatched[0] = 2; - - m_prgirulnMin[1] = 1; // s7: r0 - m_prgrulnMatched[1] = 0; - - m_prgirulnMin[2] = 2; // s8: r1 - m_prgrulnMatched[2] = 1; - - m_prgirulnMin[3] = 3; - } -} - - -/*---------------------------------------------------------------------------------------------- - Tests of ligatures and components where the components are modified glyphs. - - PASS 1: - r0. gX gI > @2 @1; - r1. clsPlainVowel gAcute > clsVowelAcute:(1 2) _; - r2. clsPlainVowel gGrave > clsVowelGrave:(1 2) _; - - Pass 1 machine classes: - mcX: x 120 - mcI: i 105 - mcPV: a e o u 97 101 111 117 - mcAcute: / 47 - mcGrave: \ 92 - - Pass 1 FSM: (T=transition, F=final, A=accepting, NA=non-accepting) - - | mcX mcPV mcI mcAcute mcGrave - --------------------------------------------------------------- - T NA s0 | s1 s2 s2 - | - - - - - T NA s1 | s3 - | - - - - - T NA s2 | s4 s5 - | - - - - - F A s3 | - | - - - - - F A s4 | - | - - - - - F A s5 | - | - - - - - - - Rules Matched: - s3: r0 - s4: r1 - s5: r2 - - - PASS 2: - r0. clsVowel gI > clsCapVowel:(1 2) { comp {v.ref = @1; i.ref = @2}} _; - - Pass 2 machine classes: - mcV: 97 101 111 117 - 224 225 232 233 236 237 242 243 249 250 - mcI: i 105 - - - Pass 2 FSM: - | mcV mcI - ---------------------------------------------------- - T NA s0 | s1 s1 - | - - T NA s1 | s2 - | - - F A s2 | - | - - - Rules matched: - s2: r0 -----------------------------------------------------------------------------------------------*/ -void GrEngine::SetUpLigature2Test() -{ - if (m_pctbl) - delete m_pctbl; - - m_pctbl = new GrClassTable(); - m_pctbl->SetUpLigature2Test(); - - m_pgtbl = new GrGlyphTable(); - m_pgtbl->SetUpLigature2Test(); -} - -void GrClassTable::SetUpLigature2Test() -{ - m_ccls = 5; // number of classes - m_cclsLinear = 3; // number of classes in linear format - - m_prgchwBIGGlyphList = new data16[73]; - - m_prgichwOffsets = new data16[m_ccls+1]; - - data16 * pchw = m_prgchwBIGGlyphList; - - // Output class 0: clsVowelAcute - m_prgichwOffsets[0] = 0; - *pchw++ = msbf(data16(225)); // a-acute - *pchw++ = msbf(data16(233)); // e-acute - *pchw++ = msbf(data16(237)); // i-acute - *pchw++ = msbf(data16(243)); // o-acute - *pchw++ = msbf(data16(250)); // u-acute - - // Output class 1: clsVowelGrave - m_prgichwOffsets[1] = 5; - *pchw++ = msbf(data16(224)); // a-grave - *pchw++ = msbf(data16(232)); // e-grave - *pchw++ = msbf(data16(236)); // i-grave - *pchw++ = msbf(data16(242)); // o-grave - *pchw++ = msbf(data16(249)); // u-grave - - // Output class 2: clsCapVowel - m_prgichwOffsets[2] = 5 + 5; // 10 - *pchw++ = msbf(data16(65)); // A - *pchw++ = msbf(data16(69)); // E - *pchw++ = msbf(data16(73)); // I - *pchw++ = msbf(data16(79)); // O - *pchw++ = msbf(data16(85)); // U - *pchw++ = msbf(data16(193)); // A-acute - *pchw++ = msbf(data16(201)); // E-acute - *pchw++ = msbf(data16(205)); // I-acute - *pchw++ = msbf(data16(211)); // O-acute - *pchw++ = msbf(data16(218)); // U-acute - *pchw++ = msbf(data16(192)); // A-grave - *pchw++ = msbf(data16(200)); // E-grave - *pchw++ = msbf(data16(204)); // I-grave - *pchw++ = msbf(data16(210)); // O-grave - *pchw++ = msbf(data16(217)); // U-grave - - // Input class 3: clsPlainVowel - m_prgichwOffsets[3] = 10 + 15; // 25 - *pchw++ = msbf(data16(5)); - *pchw++ = msbf(data16(4)); *pchw++ = msbf(data16(2)); *pchw++ = msbf(data16(5-4)); - *pchw++ = msbf(data16(97)); *pchw++ = msbf(data16(0)); // a - *pchw++ = msbf(data16(101)); *pchw++ = msbf(data16(1)); // e - *pchw++ = msbf(data16(105)); *pchw++ = msbf(data16(2)); // i - *pchw++ = msbf(data16(111)); *pchw++ = msbf(data16(3)); // o - *pchw++ = msbf(data16(117)); *pchw++ = msbf(data16(4)); // u - - // Input class 4: clsVowel - m_prgichwOffsets[4] = 25 + 4+(5*2); // 39 - *pchw++ = msbf(data16(15)); - *pchw++ = msbf(data16(8)); *pchw++ = msbf(data16(3)); *pchw++ = msbf(data16(15-8)); - *pchw++ = msbf(data16(97)); *pchw++ = msbf(data16(0)); // a - *pchw++ = msbf(data16(101)); *pchw++ = msbf(data16(1)); // e - *pchw++ = msbf(data16(105)); *pchw++ = msbf(data16(2)); // i - *pchw++ = msbf(data16(111)); *pchw++ = msbf(data16(3)); // o - *pchw++ = msbf(data16(117)); *pchw++ = msbf(data16(4)); // u - *pchw++ = msbf(data16(224)); *pchw++ = msbf(data16(10)); // a-grave - *pchw++ = msbf(data16(225)); *pchw++ = msbf(data16(5)); // a-acute - *pchw++ = msbf(data16(232)); *pchw++ = msbf(data16(11)); // e-grave - *pchw++ = msbf(data16(233)); *pchw++ = msbf(data16(6)); // e-acute - *pchw++ = msbf(data16(236)); *pchw++ = msbf(data16(12)); // i-grave - *pchw++ = msbf(data16(237)); *pchw++ = msbf(data16(7)); // i-acute - *pchw++ = msbf(data16(242)); *pchw++ = msbf(data16(13)); // o-grave - *pchw++ = msbf(data16(243)); *pchw++ = msbf(data16(8)); // o-acute - *pchw++ = msbf(data16(249)); *pchw++ = msbf(data16(14)); // u-grave - *pchw++ = msbf(data16(250)); *pchw++ = msbf(data16(9)); // u-acute - - m_prgichwOffsets[5] = 39 + 4+(15*2); // 73 -} - -void GrGlyphTable::SetUpLigature2Test() -{ - SetNumberOfGlyphs(256); - SetNumberOfStyles(1); - - GrGlyphSubTable * pgstbl = new GrGlyphSubTable(); - Assert(pgstbl); - - pgstbl->Initialize(1, 0, 256, 10, 4); - SetSubTable(0, pgstbl); - - SetNumberOfComponents(2); // comp.base, comp.i - - pgstbl->SetUpLigature2Test(); -} - -/*********************************************************************************************** - TODO: This method is BROKEN because m_prgibBIGAttrValues has been changed. It is no - longer a data16 *. The Gloc table can contain 16-bit or 32-bit entries and must be - accessed accordingly. -***********************************************************************************************/ -void GrGlyphSubTable::SetUpLigature2Test() -{ - m_nAttrIDLim = 10; - - m_pgatbl = new GrGlyphAttrTable(); - m_pgatbl->Initialize(0, 330); - - for (int i = 0; i <= 65; i++) // A - m_prgibBIGAttrValues[i] = (byte)msbf(data16(0)); - - for (i = 66; i <= 69; i++) // E - m_prgibBIGAttrValues[i] = (byte)msbf(data16(22)); - - for (i = 70; i <= 73; i++) // I - m_prgibBIGAttrValues[i] = (byte)msbf(data16(44)); - - for (i = 74; i <= 79; i++) // O - m_prgibBIGAttrValues[i] = (byte)msbf(data16(66)); - - for (i = 80; i <= 85; i++) // U - m_prgibBIGAttrValues[i] = (byte)msbf(data16(88)); - - for (i = 86; i <= 192; i++) // A-grave - m_prgibBIGAttrValues[i] = (byte)msbf(data16(110)); - - m_prgibBIGAttrValues[193] = (byte)msbf(data16(132)); // A-acute - - for (i = 194; i <= 200; i++) // E-grave - m_prgibBIGAttrValues[i] = (byte)msbf(data16(154)); - - m_prgibBIGAttrValues[201] = (byte)msbf(data16(176)); // E-acute - - for (i = 202; i <= 204; i++) // I-grave - m_prgibBIGAttrValues[i] = (byte)msbf(data16(198)); - - m_prgibBIGAttrValues[205] = (byte)msbf(data16(220)); // I-acute - - for (i = 206; i <= 210; i++) // O-grave - m_prgibBIGAttrValues[i] = (byte)msbf(data16(242)); - - m_prgibBIGAttrValues[211] = (byte)msbf(data16(264)); // O-acute - - for (i = 212; i <= 217; i++) // U-grave - m_prgibBIGAttrValues[i] = (byte)msbf(data16(286)); - - m_prgibBIGAttrValues[218] = (byte)msbf(data16(308)); // O-acute - - for (i = 219; i < 256; i++) - m_prgibBIGAttrValues[i] = (byte)msbf(data16(330)); - - m_pgatbl->SetUpLigature2Test(); -} - -void GrGlyphAttrTable::SetUpLigature2Test() -{ - // All ligatures have the following defined: - // - // 0 = 2 comp.base (0,30, 100,100) - // 1 = 6 comp.i (0,0, 100,30) - // 2= 100 comp.base.top - // 3= 30 bottom - // 4= 0 left - // 5= 100 right - // 6 = 30 comp.i.top - // 7 = 0 bottom - // 8= 0 left - // 9= 100 right - - byte * pbBIG = m_prgbBIGEntries; - - GrGlyphAttrRun gatrun; - - for (int i = 0; i < 15; i++) - { - gatrun.m_bMinAttrID = 0; - gatrun.m_cAttrs = 10; - gatrun.m_rgchwBIGValues[0] = msbf(data16(2)); - gatrun.m_rgchwBIGValues[1] = msbf(data16(6)); - gatrun.m_rgchwBIGValues[2] = msbf(data16(100)); - gatrun.m_rgchwBIGValues[3] = msbf(data16(30)); - gatrun.m_rgchwBIGValues[4] = msbf(data16(0)); - gatrun.m_rgchwBIGValues[5] = msbf(data16(100)); - gatrun.m_rgchwBIGValues[6] = msbf(data16(30)); - gatrun.m_rgchwBIGValues[7] = msbf(data16(0)); - gatrun.m_rgchwBIGValues[8] = msbf(data16(0)); - gatrun.m_rgchwBIGValues[9] = msbf(data16(100)); - memcpy(pbBIG, &gatrun, 22); // 22 = 10*2 + 2 - pbBIG += 22; - } - - Assert(pbBIG == m_prgbBIGEntries + (22 * 15)); -} - -void GrSubPass::SetUpLigature2Test() -{ - if (m_ipass == 1) - { - m_nMaxRuleContext = m_nMaxChunk = 2; - m_nMaxRuleLoop = 5; - m_staBehavior = "Ligatures2"; - - m_pfsm = new GrFSM(); - Assert(m_pfsm); - m_pfsm->SetUpLigature2Test(m_ipass); - - m_crul = 3; - - // Set up constraint code. - m_prgbConstraintBlock = new byte[1]; - byte * pb = m_prgbConstraintBlock; - *pb++ = kopRetTrue; // RetTrue - - m_prgibConstraintStart = new data16[m_crul]; - m_prgibConstraintStart[0] = 0; - m_prgibConstraintStart[1] = 0; - m_prgibConstraintStart[2] = 0; - - // Set up rule action code. - m_prgbActionBlock = new byte[7 + 12 + 12]; - pb = m_prgbActionBlock; - - // Rule 0: gX gI > @2 @1; - - *pb++ = kopPutCopy; *pb++ = 1; // PutCopy 1 - *pb++ = kopNext; // Next - *pb++ = kopPutCopy; *pb++ = -1; // PutCopy -1 - *pb++ = kopNext; // Next - *pb++ = kopRetZero; // RetZero - - // Rule 1: clsPlainVowel gAcute > clsVowelAcute:(1 2) _; - - *pb++ = kopPutSubs8bitObs; *pb++ = 0; // PutSubs 0 3 0 - *pb++ = 3; *pb++ = 0; - *pb++ = kopAssoc; *pb++ = 2; // Assoc 2 0 1 - *pb++ = 0; *pb++ = 1; - *pb++ = kopNext; // Next - *pb++ = kopDelete; // Delete - *pb++ = kopNext; // Next - *pb++ = kopRetZero; // RetZero - - // Rule 2: clsPlainVowel gGrave > clsVowelGrave:(1 2) _; - - *pb++ = kopPutSubs8bitObs; *pb++ = 0; // PutSubs 0 3 1 - *pb++ = 3; *pb++ = 1; - *pb++ = kopAssoc; *pb++ = 2; // Assoc 2 0 1 - *pb++ = 0; *pb++ = 1; - *pb++ = kopNext; // Next - *pb++ = kopDelete; // Delete - *pb++ = kopNext; // Next - *pb++ = kopRetZero; // RetZero - - m_prgibActionStart = new data16[m_crul]; - m_prgibActionStart[0] = 0; - m_prgibActionStart[1] = 7; - m_prgibActionStart[2] = 7 + 12; - } - else if (m_ipass == 2) - { - m_nMaxRuleContext = m_nMaxChunk = 2; - m_nMaxRuleLoop = 5; - m_staBehavior = "Ligatures2"; - - m_pfsm = new GrFSM(); - Assert(m_pfsm); - m_pfsm->SetUpLigature2Test(m_ipass); - - m_crul = 1; - - // Set up constraint code. - m_prgbConstraintBlock = new byte[1]; - byte * pb = m_prgbConstraintBlock; - *pb++ = kopRetTrue; // RetTrue - - m_prgibConstraintStart = new data16[m_crul]; - m_prgibConstraintStart[0] = 0; - - // Set up rule action code. - m_prgbActionBlock = new byte[7 + 12 + 12]; - pb = m_prgbActionBlock; - - // Rule 0: clsVowel gI > clsCapVowel:(1 2) { comp {v.ref = @1; i.ref = @2}} _; - - *pb++ = kopPutSubs8bitObs; *pb++ = 0; // PutSubs 0 4 2 - *pb++ = 4; *pb++ = 2; - *pb++ = kopAssoc; *pb++ = 2; // Assoc 2 0 1 - *pb++ = 0; *pb++ = 1; - *pb++ = kopPushByte; *pb++ = 0; // Push 0 - *pb++ = kopIAttrSetSlot; // IAttrSetSlot compRef v - *pb++ = kslatCompRef; *pb++ = 0; - *pb++ = kopPushByte; *pb++ = 1; // Push 1 - *pb++ = kopIAttrSetSlot; // IAttrSetSlot compRef i - *pb++ = kslatCompRef; *pb++ = 1; - *pb++ = kopNext; // Next - *pb++ = kopDelete; // Delete - *pb++ = kopNext; // Next - *pb++ = kopRetZero; // RetZero - - m_prgibActionStart = new data16[m_crul]; - m_prgibActionStart[0] = 0; - } - else - Assert(false); -} - - -void GrFSM::SetUpLigature2Test(int ipass) -{ - if (ipass == 1) - { - // Create machine class ranges. - m_cmcr = 8; - m_prgmcr = new GrFSMClassRange[m_cmcr]; - m_prgmcr[0].m_chwFirst = 47; // acute - m_prgmcr[0].m_chwLast = 47; - m_prgmcr[0].m_col = 3; - - m_prgmcr[1].m_chwFirst = 92; // grave - m_prgmcr[1].m_chwLast = 92; - m_prgmcr[1].m_col = 4; - - m_prgmcr[2].m_chwFirst = 97; // a - m_prgmcr[2].m_chwLast = 97; - m_prgmcr[2].m_col = 1; - - m_prgmcr[3].m_chwFirst = 101; // e - m_prgmcr[3].m_chwLast = 101; - m_prgmcr[3].m_col = 1; - - m_prgmcr[4].m_chwFirst = 105; // i - m_prgmcr[4].m_chwLast = 105; - m_prgmcr[4].m_col = 2; - - m_prgmcr[5].m_chwFirst = 111; // o - m_prgmcr[5].m_chwLast = 111; - m_prgmcr[5].m_col = 1; - - m_prgmcr[6].m_chwFirst = 117; // u - m_prgmcr[6].m_chwLast = 117; - m_prgmcr[6].m_col = 1; - - m_prgmcr[7].m_chwFirst = 120; // x - m_prgmcr[7].m_chwLast = 120; - m_prgmcr[7].m_col = 0; - - m_dimcrInit = 8; // (max power of 2 <= m_cmcr); - m_cLoop = 3; // log2(max power of 2 <= m_cmcr); - m_imcrStart = m_cmcr - m_dimcrInit; - - - m_crow = 6; - m_crowNonAcpt = 3; - m_crowFinal = 3; - m_rowFinalMin = m_crow - m_crowFinal; - m_ccol = 5; - - // Set up transition table. - m_prgrowTransitions = new short[(m_crow-m_crowFinal) * m_ccol]; // 15 - short * psn = m_prgrowTransitions; - *psn++ = 1; *psn++ = 2; *psn++ = 2; *psn++ = 0; *psn++ = 0; - *psn++ = 0; *psn++ = 0; *psn++ = 3; *psn++ = 0; *psn++ = 0; - *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 4; *psn++ = 5; - - // Set up matched-rules tables. - m_prgrulnMatched = new data16[3]; // 3 = sum of rules matched for each accepting state - m_prgirulnMin = new data16[3+1]; // 3 = m_crow - m_crowNonAcpt - - m_prgirulnMin[0] = 0; // s3: r0 - m_prgrulnMatched[0] = 0; - - m_prgirulnMin[1] = 1; // s4: r1 - m_prgrulnMatched[1] = 1; - - m_prgirulnMin[2] = 2; // s5: r2 - m_prgrulnMatched[2] = 2; - - m_prgirulnMin[3] = 3; - } - else if (ipass == 2) - { - // Create machine class ranges. - m_cmcr = 10; - m_prgmcr = new GrFSMClassRange[m_cmcr]; - m_prgmcr[0].m_chwFirst = 97; // a - m_prgmcr[0].m_chwLast = 97; - m_prgmcr[0].m_col = 0; - - m_prgmcr[1].m_chwFirst = 101; // e - m_prgmcr[1].m_chwLast = 101; - m_prgmcr[1].m_col = 0; - - m_prgmcr[2].m_chwFirst = 105; // i - m_prgmcr[2].m_chwLast = 105; - m_prgmcr[2].m_col = 1; - - m_prgmcr[3].m_chwFirst = 111; // o - m_prgmcr[3].m_chwLast = 111; - m_prgmcr[3].m_col = 0; - - m_prgmcr[4].m_chwFirst = 117; // u - m_prgmcr[4].m_chwLast = 117; - m_prgmcr[4].m_col = 0; - - m_prgmcr[5].m_chwFirst = 224; // a-grave, a-acute - m_prgmcr[5].m_chwLast = 225; - m_prgmcr[5].m_col = 0; - - m_prgmcr[6].m_chwFirst = 232; // e-grave, e-acute - m_prgmcr[6].m_chwLast = 233; - m_prgmcr[6].m_col = 0; - - m_prgmcr[7].m_chwFirst = 236; // i-grave, i-acute - m_prgmcr[7].m_chwLast = 237; - m_prgmcr[7].m_col = 0; - - m_prgmcr[8].m_chwFirst = 242; // o-grave, o-acute - m_prgmcr[8].m_chwLast = 243; - m_prgmcr[8].m_col = 0; - - m_prgmcr[9].m_chwFirst = 249; // u-grave, u-acute - m_prgmcr[9].m_chwLast = 250; - m_prgmcr[9].m_col = 0; - - - m_dimcrInit = 8; // (max power of 2 <= m_cmcr); - m_cLoop = 3; // log2(max power of 2 <= m_cmcr); - m_imcrStart = m_cmcr - m_dimcrInit; - - - m_crow = 3; - m_crowNonAcpt = 2; - m_crowFinal = 1; - m_rowFinalMin = m_crow - m_crowFinal; - m_ccol = 2; - - // Set up transition table. - m_prgrowTransitions = new short[(m_crow-m_crowFinal) * m_ccol]; // 4 - short * psn = m_prgrowTransitions; - *psn++ = 1; *psn++ = 1; - *psn++ = 0; *psn++ = 2; - - // Set up matched-rules tables. - m_prgrulnMatched = new data16[1]; // 1 = sum of rules matched for each accepting state - m_prgirulnMin = new data16[1+1]; // 1 = m_crow - m_crowNonAcpt - - m_prgirulnMin[0] = 0; // s2: r0 - m_prgrulnMatched[0] = 0; - - m_prgirulnMin[1] = 1; - } -} - -#endif // _DEBUG - -} // namespace gr - -#endif // OLD_TEST_STUFF - -//:End Ignore diff --git a/Build/source/libs/graphite/engine-2.3.1/src/segment/TestPasses.cpp b/Build/source/libs/graphite/engine-2.3.1/src/segment/TestPasses.cpp deleted file mode 100644 index a85e6c56207..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/src/segment/TestPasses.cpp +++ /dev/null @@ -1,1005 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 1999, 2001 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: TestPasses.cpp -Responsibility: Sharon Correll -Last reviewed: Not yet. - -Description: - Hard-coded passes for test procedures. --------------------------------------------------------------------------------*//*:End Ignore*/ - -//:Ignore - -//:>******************************************************************************************** -//:> Include files -//:>******************************************************************************************** -#include "Main.h" - -#ifdef _MSC_VER -#pragma hdrstop -#endif -#undef THIS_FILE -DEFINE_THIS_FILE - -#ifdef OLD_TEST_STUFF - -//:>******************************************************************************************** -//:> Forward declarations -//:>******************************************************************************************** - -//:>******************************************************************************************** -//:> Local Constants and static variables -//:>******************************************************************************************** - -namespace gr -{ - -//:>******************************************************************************************** -//:> Methods -//:>******************************************************************************************** - -/*---------------------------------------------------------------------------------------------- - For release version. -----------------------------------------------------------------------------------------------*/ -#ifndef _DEBUG - -bool GrLineBreakPass::RunTestRules(GrTableManager * ptman, - GrSlotStream * psstrmInput, GrSlotStream * psstrmOutput) -{ - return false; -} - -bool GrSubPass::RunTestRules(GrTableManager * ptman, - GrSlotStream * psstrmInput, GrSlotStream * psstrmOutput) -{ - return false; -} - -bool GrPosPass::RunTestRules(GrTableManager * ptman, - GrSlotStream * psstrmInput, GrSlotStream * psstrmOutput) -{ - return false; -} - -#endif // !_DEBUG - - -#ifdef _DEBUG - -/*---------------------------------------------------------------------------------------------- - Set up a table manager for testing. -----------------------------------------------------------------------------------------------*/ -void GrTableManager::SetUpTest(std::wstring stuRendBehavior) -{ - if (stuRendBehavior == L"NoRules") - { - m_cpass = 2; - m_cpassLB = 0; - m_ipassPos1 = 1; - m_fBidi = false; - - m_prgppass = new GrPass*[m_cpass]; - m_prgppass[0] = new GrGlyphGenPass(0); - m_prgppass[1] = new GrPosPass(1); - - m_prgppass[0]->SetUpTestData(); - m_prgppass[1]->SetUpTestData(); - } - else if (stuRendBehavior == L"JustReorder" || stuRendBehavior == "RightToLeftLayout") - { - m_cpass = 4; - m_cpassLB = 0; - m_ipassPos1 = 3; - m_fBidi = true; - - m_prgppass = new GrPass*[m_cpass]; - m_prgppass[0] = new GrGlyphGenPass(0); - m_prgppass[1] = new GrSubPass(1); - m_prgppass[2] = new GrBidiPass(2); - m_prgppass[3] = new GrPosPass(3); - - m_prgppass[0]->SetUpTestData(); - m_prgppass[1]->SetUpReverseNumbersTest(); - m_prgppass[2]->SetUpTestData(); - m_prgppass[3]->SetUpTestData(); - - m_prgppass[2]->SetTopDirLevel(TopDirectionLevel()); - } - else if (stuRendBehavior == L"CrossLineContext") - { - m_cpass = 4; - m_cpassLB = 1; - m_ipassPos1 = 3; - m_fBidi = false; - - m_prgppass = new GrPass*[m_cpass]; - m_prgppass[0] = new GrGlyphGenPass(0); - m_prgppass[1] = new GrLineBreakPass(1); - m_prgppass[2] = new GrSubPass(2); - m_prgppass[3] = new GrPosPass(3); - - m_prgppass[0]->SetUpTestData(); - m_prgppass[1]->SetUpCrossLineContextTest(); - m_prgppass[2]->SetUpCrossLineContextTest(); - m_prgppass[3]->SetUpTestData(); - } - else if (stuRendBehavior == L"Reprocess") - { - m_cpass = 6; - m_cpassLB = 1; - m_ipassPos1 = 5; - m_fBidi = true; - - m_prgppass = new GrPass*[m_cpass]; - m_prgppass[0] = new GrGlyphGenPass(0); - m_prgppass[1] = new GrLineBreakPass(1); - m_prgppass[2] = new GrSubPass(2); - m_prgppass[3] = new GrSubPass(3); - m_prgppass[4] = new GrBidiPass(4); - m_prgppass[5] = new GrPosPass(5); - - m_prgppass[0]->SetUpTestData(); // glyph-gen pass - m_prgppass[1]->SetUpReprocessTest(); // line-break pass - m_prgppass[2]->SetUpReverseNumbersTest(); // sub pass 1 - m_prgppass[3]->SetUpReprocessTest(); // sub pass 2 - m_prgppass[4]->SetUpTestData(); // bidi pass - m_prgppass[5]->SetUpTestData(); // pos pass - - m_prgppass[4]->SetTopDirLevel(TopDirectionLevel()); - } - else if (stuRendBehavior == L"LineEdgeContext") - { - m_cpass = 4; - m_cpassLB = 0; - m_ipassPos1 = 3; - m_fBidi = false; - - m_prgppass = new GrPass*[m_cpass]; - m_prgppass[0] = new GrGlyphGenPass(0); - m_prgppass[1] = new GrSubPass(1); - m_prgppass[2] = new GrSubPass(2); - m_prgppass[3] = new GrPosPass(3); - - m_prgppass[0]->SetUpTestData(); - m_prgppass[1]->SetUpLineEdgeContextTest(1); - m_prgppass[2]->SetUpLineEdgeContextTest(2); - m_prgppass[3]->SetUpTestData(); - } - else if (stuRendBehavior == L"BidiAlgorithm") - { - m_cpass = 4; - m_cpassLB = 0; - m_ipassPos1 = 3; - m_fBidi = true; - - m_prgppass = new GrPass*[m_cpass]; - m_prgppass[0] = new GrGlyphGenPass(0); - m_prgppass[1] = new GrSubPass(1); - m_prgppass[2] = new GrBidiPass(2); - m_prgppass[3] = new GrPosPass(3); - - m_prgppass[0]->SetUpTestData(); - m_prgppass[1]->SetUpBidiAlgorithmTest(); - m_prgppass[2]->SetUpBidiAlgorithmTest(); - m_prgppass[3]->SetUpTestData(); - - m_prgppass[2]->SetTopDirLevel(TopDirectionLevel()); - } - else if (stuRendBehavior == L"PseudoGlyphs") - { - m_cpass = 3; - m_cpassLB = 0; - m_ipassPos1 = 2; - m_fBidi = false; - - m_prgppass = new GrPass*[m_cpass]; - m_prgppass[0] = new GrGlyphGenPass(0); - m_prgppass[1] = new GrSubPass(1); - m_prgppass[2] = new GrPosPass(2); - - m_prgppass[0]->SetUpTestData(); - m_prgppass[1]->SetUpPseudoGlyphsTest(); - m_prgppass[2]->SetUpTestData(); - } - else if (stuRendBehavior == L"SimpleFSM") - { - m_cpass = 3; - m_cpassLB = 0; - m_ipassPos1 = 2; - m_fBidi = false; - - m_prgppass = new GrPass*[m_cpass]; - m_prgppass[0] = new GrGlyphGenPass(0); - m_prgppass[1] = new GrSubPass(1); - m_prgppass[2] = new GrPosPass(2); - - m_prgppass[0]->SetUpTestData(); - m_prgppass[1]->SetUpSimpleFSMTest(); - m_prgppass[2]->SetUpTestData(); - } - else if (stuRendBehavior == L"RuleAction") - { - m_cpass = 3; - m_cpassLB = 0; - m_ipassPos1 = 2; - m_fBidi = false; - - m_prgppass = new GrPass*[m_cpass]; - m_prgppass[0] = new GrGlyphGenPass(0); - m_prgppass[1] = new GrSubPass(1); - m_prgppass[2] = new GrPosPass(2); - - m_prgppass[0]->SetUpTestData(); - m_prgppass[1]->SetUpRuleActionTest(); - m_prgppass[2]->SetUpTestData(); - } - else if (stuRendBehavior == L"RuleAction2") - { - m_cpass = 6; - m_cpassLB = 0; - m_ipassPos1 = 5; - m_fBidi = true; - - m_prgppass = new GrPass*[m_cpass]; - m_prgppass[0] = new GrGlyphGenPass(0); - m_prgppass[1] = new GrSubPass(1); - m_prgppass[2] = new GrSubPass(2); - m_prgppass[3] = new GrSubPass(3); - m_prgppass[4] = new GrBidiPass(4); - m_prgppass[5] = new GrPosPass(5); - - m_prgppass[0]->SetUpTestData(); // glyph-gen pass - m_prgppass[1]->SetUpRuleAction2Test(); // sub pass 1 - m_prgppass[2]->SetUpRuleAction2Test(); // sub pass 2 - m_prgppass[3]->SetUpRuleAction2Test(); // sub pass 3 - m_prgppass[4]->SetUpTestData(); // bidi pass - m_prgppass[5]->SetUpTestData(); // pos pass - - m_prgppass[4]->SetTopDirLevel(TopDirectionLevel()); - } - else if (stuRendBehavior == L"Assoc") - { - m_cpass = 5; - m_cpassLB = 1; - m_ipassPos1 = 4; - m_fBidi = false; - - m_prgppass = new GrPass*[m_cpass]; - m_prgppass[0] = new GrGlyphGenPass(0); - m_prgppass[1] = new GrLineBreakPass(1); - m_prgppass[2] = new GrSubPass(2); - m_prgppass[3] = new GrSubPass(3); - m_prgppass[4] = new GrPosPass(4); - - m_prgppass[0]->SetUpTestData(); - m_prgppass[1]->SetUpAssocTest(); - m_prgppass[2]->SetUpAssocTest(); - m_prgppass[3]->SetUpAssocTest(); - m_prgppass[4]->SetUpTestData(); - } - else if (stuRendBehavior == L"Assoc2") - { - m_cpass = 3; - m_cpassLB = 0; - m_ipassPos1 = 2; - m_fBidi = false; - - m_prgppass = new GrPass*[m_cpass]; - m_prgppass[0] = new GrGlyphGenPass(0); - m_prgppass[1] = new GrSubPass(1); - m_prgppass[2] = new GrPosPass(2); - - m_prgppass[0]->SetUpTestData(); - m_prgppass[1]->SetUpAssoc2Test(); - m_prgppass[2]->SetUpTestData(); - } - else if (stuRendBehavior == L"DefaultAssoc") - { - m_cpass = 3; - m_cpassLB = 0; - m_ipassPos1 = 2; - m_fBidi = false; - - m_prgppass = new GrPass*[m_cpass]; - m_prgppass[0] = new GrGlyphGenPass(0); - m_prgppass[1] = new GrSubPass(1); - m_prgppass[2] = new GrPosPass(2); - - m_prgppass[0]->SetUpTestData(); - m_prgppass[1]->SetUpDefaultAssocTest(); - m_prgppass[2]->SetUpTestData(); - } - else if (stuRendBehavior == L"BidiNumbers") - { - m_cpass = 4; - m_cpassLB = 0; - m_ipassPos1 = 3; - m_fBidi = true; - - m_prgppass = new GrPass*[m_cpass]; - m_prgppass[0] = new GrGlyphGenPass(0); - m_prgppass[1] = new GrSubPass(1); - m_prgppass[2] = new GrBidiPass(2); - m_prgppass[3] = new GrPosPass(3); - - m_prgppass[0]->SetUpTestData(); - m_prgppass[1]->SetUpBidiNumbersTest(); - m_prgppass[2]->SetUpBidiNumbersTest(); - m_prgppass[3]->SetUpTestData(); - - m_prgppass[2]->SetTopDirLevel(TopDirectionLevel()); - } - else if (stuRendBehavior == L"Feature") - { - m_cpass = 3; - m_cpassLB = 0; - m_ipassPos1 = 2; - m_fBidi = false; - - m_prgppass = new GrPass*[m_cpass]; - m_prgppass[0] = new GrGlyphGenPass(0); - m_prgppass[1] = new GrSubPass(1); - m_prgppass[2] = new GrPosPass(2); - - m_prgppass[0]->SetUpTestData(); - m_prgppass[1]->SetUpFeatureTest(); - m_prgppass[2]->SetUpTestData(); - } - else if (stuRendBehavior == L"Ligatures") - { - m_cpass = 4; - m_cpassLB = 1; - m_ipassPos1 = 3; - m_fBidi = false; - - m_prgppass = new GrPass*[m_cpass]; - m_prgppass[0] = new GrGlyphGenPass(0); - m_prgppass[1] = new GrLineBreakPass(1); - m_prgppass[2] = new GrSubPass(2); - m_prgppass[3] = new GrPosPass(3); - - m_prgppass[0]->SetUpTestData(); - m_prgppass[1]->SetUpLigatureTest(); - m_prgppass[2]->SetUpLigatureTest(); - m_prgppass[3]->SetUpTestData(); - } - else if (stuRendBehavior == L"Ligatures2") - { - m_cpass = 4; - m_cpassLB = 1; - m_ipassPos1 = 3; - m_fBidi = false; - - m_prgppass = new GrPass*[m_cpass]; - m_prgppass[0] = new GrGlyphGenPass(0); - m_prgppass[1] = new GrSubPass(1); - m_prgppass[2] = new GrSubPass(2); - m_prgppass[3] = new GrPosPass(3); - - m_prgppass[0]->SetUpTestData(); - m_prgppass[1]->SetUpLigature2Test(); - m_prgppass[2]->SetUpLigature2Test(); - m_prgppass[3]->SetUpTestData(); - } - else - Assert(false); - - m_engst.m_prgpsstrm = new GrSlotStream*[m_cpass]; - for (int ipass = 0; ipass < m_cpass; ++ipass) - m_engst.m_prgpsstrm[ipass] = new GrSlotStream(ipass); -} - - -/*---------------------------------------------------------------------------------------------- - Set the pass variables that normally will be read from the ECF. -----------------------------------------------------------------------------------------------*/ - -void GrPass::SetUpTestData() -{ - m_nMaxRuleContext = m_nMaxChunk = 2; - m_nMaxRuleLoop = 2; -} - -//void GrBidiPass::SetUpTestData() -//{ -// m_nMaxRuleContext = m_nMaxChunk = 1; -// m_nMaxRuleLoop = 2; -//} - -/*---------------------------------------------------------------------------------------------- - Call the appropriate test function. -----------------------------------------------------------------------------------------------*/ - -bool GrLineBreakPass::RunTestRules(GrTableManager * ptman, - GrSlotStream * psstrmInput, GrSlotStream * psstrmOutput) -{ - if (m_staBehavior == "Reprocess") - return RunReprocessTest(ptman, psstrmInput, psstrmOutput); - else if (m_staBehavior == "CrossLineContext") - return RunCrossLineContextTest(ptman, psstrmInput, psstrmOutput); - else - return false; -} - -bool GrSubPass::RunTestRules(GrTableManager * ptman, - GrSlotStream * psstrmInput, GrSlotStream * psstrmOutput) -{ - if (m_staBehavior == "ReverseNumbers") - return RunReverseNumbersTest(ptman, psstrmInput, psstrmOutput); - else if (m_staBehavior == "CrossLineContext") - return RunCrossLineContextTest(ptman, psstrmInput, psstrmOutput); - else if (m_staBehavior == "Reprocess") - return RunReprocessTest(ptman, psstrmInput, psstrmOutput); - else if (m_staBehavior == "LineEdgeContext") - return RunLineEdgeContextTest(ptman, psstrmInput, psstrmOutput); - else if (m_staBehavior == "BidiAlgorithm") - return RunBidiAlgorithmTest(ptman, psstrmInput, psstrmOutput); - else if (m_staBehavior == "PseudoGlyphs") - return RunPseudoGlyphsTest(ptman, psstrmInput, psstrmOutput); - else if (m_staBehavior == "BidiNumbers") - return RunBidiNumbersTest(ptman, psstrmInput, psstrmOutput); - else - return false; -} - -bool GrPosPass::RunTestRules(GrTableManager * ptman, - GrSlotStream * psstrmInput, GrSlotStream * psstrmOutput) -{ - return false; -} - -/*---------------------------------------------------------------------------------------------- - A substitution pass that causes numbers to be reversed. Used by both the JustReorder test - and the Reprocess test. -----------------------------------------------------------------------------------------------*/ - -void GrSubPass::SetUpReverseNumbersTest() -{ - m_nMaxRuleContext = m_nMaxChunk = 1; - m_nMaxRuleLoop = 2; - m_staBehavior = "ReverseNumbers"; -} - -bool GrSubPass::RunReverseNumbersTest(GrTableManager * ptman, - GrSlotStream * psstrmInput, GrSlotStream * psstrmOutput) -{ - data16 chw0; - - // clsDigit { dir = DIR_RIGHT }; - if (psstrmInput->SlotsPending() >= 1) - { - bool fRtl = ptman->RightToLeft(); - chw0 = psstrmInput->Peek(0)->GlyphID(); - if ((chw0 >= '0') && (chw0 <= '9')) - { - GrSlotState * pslot0 = psstrmInput->NextGet(); -// GrFeatureValues fval0; -// pslot0->GetFeatureValues(&fval0); - - GrSlotState * pslotNew; - ptman->NewSlotCopy(pslot0, m_ipass, &pslotNew); - pslotNew->SetDirectionality(fRtl ? kdircArabNum : kdircR); - pslotNew->Associate(pslot0); - psstrmOutput->NextPut(pslotNew); - - return true; - } - else - { - GrSlotState * pslot0 = psstrmInput->NextGet(); -// GrFeatureValues fval0; -// pslot0->GetFeatureValues(&fval0); - - GrSlotState * pslotNew; - ptman->NewSlotCopy(pslot0, m_ipass, &pslotNew); - if (chw0 == 32) - pslotNew->SetDirectionality(kdircWhiteSpace); - else if (chw0 == '.') - pslotNew->SetDirectionality(kdircComSep); - else - pslotNew->SetDirectionality(fRtl ? kdircR : kdircL); - pslotNew->Associate(pslot0); - psstrmOutput->NextPut(pslotNew); - - return true; - } - } - else - return false; -} - -/*---------------------------------------------------------------------------------------------- - A substitution pass that will do some hard-coded actions resulting in cross-line-boundary - contextuals. -----------------------------------------------------------------------------------------------*/ -void GrEngine::SetUpCrossLineContextTest() -{ - m_fLineBreak = true; - m_cchwPreXlbContext = 2; - m_cchwPostXlbContext = 0; -} - -void GrLineBreakPass::SetUpCrossLineContextTest() -{ - m_nMaxRuleContext = m_nMaxChunk = 1; - m_nMaxRuleLoop = 2; - m_staBehavior = "CrossLineContext"; -} - -void GrSubPass::SetUpCrossLineContextTest() -{ - m_nMaxRuleContext = m_nMaxChunk = 3; - m_nMaxRuleLoop = 2; - m_staBehavior = "CrossLineContext"; -} - -bool GrLineBreakPass::RunCrossLineContextTest(GrTableManager * ptman, - GrSlotStream * psstrmInput, GrSlotStream * psstrmOutput) -{ - // '=' { break = intra }; - if ((psstrmInput->SlotsPending() >= 1) && - (psstrmInput->Peek(0)->GlyphID() == 61)) - { - GrSlotState * pslotNew0; - ptman->NewSlotCopy(psstrmInput->NextGet(), m_ipass, &pslotNew0); - pslotNew0->SetBreakWeight(int(klbHyphenBreak)); - psstrmOutput->NextPut(pslotNew0); - - psstrmOutput->SetPosForNextRule(0, psstrmInput, false); - - return true; - } - else - return false; -} - -bool GrSubPass::RunCrossLineContextTest(GrTableManager * ptman, - GrSlotStream * psstrmInput, GrSlotStream * psstrmOutput) -{ - // any '=' _ _ > any '=' '=':2 any:1 / _ _ # _ _ - if ((psstrmInput->SlotsPending() >= 3) && - (psstrmInput->Peek(1)->GlyphID() == 61) && - (psstrmInput->Peek(2)->GlyphID() == ptman->LBGlyphID())) - { - GrSlotState * pslot0 = psstrmInput->Peek(0); - GrSlotState * pslot1 = psstrmInput->Peek(1); - gid16 chw0 = pslot0->GlyphID(); -// GrFeatureValues fval0; -// pslot0->GetFeatureValues(&fval0); -// GrFeatureValues fval1; -// pslot1->GetFeatureValues(&fval1); - - // copy the first 3 slots - psstrmOutput->CopyOneSlotFrom(psstrmInput); - psstrmOutput->CopyOneSlotFrom(psstrmInput); - psstrmOutput->CopyOneSlotFrom(psstrmInput); - - // insert 2 more - GrSlotState * pslot3; - ptman->NewSlot(61, pslot1, NULL, m_ipass, &pslot3); - pslot3->Associate(pslot1); - psstrmOutput->NextPut(pslot3); - - GrSlotState * pslot4; - ptman->NewSlot(chw0, pslot0, NULL, m_ipass, &pslot4); - pslot4->Associate(pslot0); - psstrmOutput->NextPut(pslot4); - - return true; - } - else - return false; -} - -/*---------------------------------------------------------------------------------------------- - Line break and substitution passes that cause intra-pass reprocessing (ie, the ^ mechanism). -----------------------------------------------------------------------------------------------*/ - -void GrLineBreakPass::SetUpReprocessTest() -{ - m_nMaxRuleContext = m_nMaxChunk = 2; - m_nMaxRuleLoop = 2; - m_staBehavior = "Reprocess"; -} - -bool GrLineBreakPass::RunReprocessTest(GrTableManager * ptman, - GrSlotStream * psstrmInput, GrSlotStream * psstrmOutput) -{ - gid16 chw; - - // '^' {lb=2} / _ lc - if ((psstrmInput->SlotsPending() >=2) && - (psstrmInput->Peek(0)->GlyphID() == '^') && - (((chw = psstrmInput->Peek(1)->GlyphID()) >= 'a') && - (chw <= 'z'))) - { - GrSlotState * pslotNew0; - ptman->NewSlotCopy(psstrmInput->NextGet(), m_ipass, &pslotNew0); - pslotNew0->SetBreakWeight(int(klbHyphenBreak)); - psstrmOutput->NextPut(pslotNew0); - - psstrmOutput->SetPosForNextRule(0, psstrmInput, false); - - return true; - } - else - return false; -} - - -void GrSubPass::SetUpReprocessTest() -{ - m_nMaxRuleContext = m_nMaxChunk = 3; - m_nMaxRuleLoop = 2; - m_staBehavior = "Reprocess"; -} - -bool GrSubPass::RunReprocessTest(GrTableManager * ptman, - GrSlotStream * psstrmInput, GrSlotStream * psstrmOutput) -{ - gid16 chw; - gid16 chwLB = ptman->LBGlyphID(); - - // symbol > @2 {dir = DIR_ARABNUMBER} / any {dir != DIR_LEFT} ^ _ - if ((psstrmInput->SlotsPending() >= 2) && - (psstrmInput->Peek(0)->Directionality() != kdircL) && - (((chw = psstrmInput->Peek(1)->GlyphID()) == '@') || - (chw == '@') || (chw == '$') || (chw == '%') || - (chw == '^') || (chw == '&') || (chw == '*'))) - { - psstrmOutput->CopyOneSlotFrom(psstrmInput); - GrSlotState * pslotNew1; - ptman->NewSlotCopy(psstrmInput->NextGet(), m_ipass, &pslotNew1); - pslotNew1->SetDirectionality(kdircArabNum); - psstrmOutput->NextPut(pslotNew1); - - psstrmOutput->SetPosForNextRule(-1, psstrmInput, false); - - return true; - } - - // '^' lc > @1 uc - else if ((psstrmInput->SlotsPending() >= 2) && - (psstrmInput->Peek(0)->GlyphID() == '^') && - (((chw = psstrmInput->Peek(1)->GlyphID()) >= 'a') && - (chw <= 'z'))) - { - psstrmOutput->CopyOneSlotFrom(psstrmInput); - - gid16 chwNew = chw - 'a' + 'A'; - GrSlotState * pslotNew1; - ptman->NewSlotCopy(psstrmInput->NextGet(), m_ipass, &pslotNew1); - pslotNew1->SetGlyphID(chwNew); - psstrmOutput->NextPut(pslotNew1); - - psstrmOutput->SetPosForNextRule(0, psstrmInput, false); - - return true; - } - - // '^' lc > @1 uc / _ # _ - else if ((psstrmInput->SlotsPending() >= 3) && - (psstrmInput->Peek(0)->GlyphID() == '^') && - (psstrmInput->Peek(1)->IsLineBreak(chwLB)) && - (((chw = psstrmInput->Peek(2)->GlyphID()) >= 'a') && - (chw <= 'z'))) - { - psstrmOutput->CopyOneSlotFrom(psstrmInput); - psstrmOutput->CopyOneSlotFrom(psstrmInput); - - gid16 chwNew = chw - 'a' + 'A'; - GrSlotState * pslotNew1; - ptman->NewSlotCopy(psstrmInput->NextGet(), m_ipass, &pslotNew1); - pslotNew1->SetGlyphID(chwNew); - psstrmOutput->NextPut(pslotNew1); - - psstrmOutput->SetPosForNextRule(0, psstrmInput, false); - - return true; - } - - else - return false; -} - - -/*---------------------------------------------------------------------------------------------- - Substitution passes that create contextual forms at the line breaks; also a cross-line- - boundary contextual. -----------------------------------------------------------------------------------------------*/ - -void GrSubPass::SetUpLineEdgeContextTest(int ipass) -{ - m_nMaxRuleContext = (ipass == 2)? 5: 2; - m_nMaxChunk = m_nMaxRuleContext; - m_nMaxRuleLoop = 2; - m_staBehavior = "LineEdgeContext"; -} - -bool GrSubPass::RunLineEdgeContextTest(GrTableManager * ptman, - GrSlotStream * psstrmInput, GrSlotStream * psstrmOutput) -{ - gid16 chwLB = ptman->LBGlyphID(); - - // any _ _ > @1 '-' '-' / _ _ _ # - if ((m_ipass == 1) && - (psstrmInput->SlotsPending() >= 2) && - (psstrmInput->Peek(1)->IsLineBreak(chwLB))) - { - GrSlotState * pslot0 = psstrmInput->Peek(0); -// GrFeatureValues fval; -// pslot0->GetFeatureValues(&fval); - - psstrmOutput->CopyOneSlotFrom(psstrmInput); - - GrSlotState * pslotNew1; - ptman->NewSlot('-', pslot0, NULL, m_ipass, &pslotNew1); - pslotNew1->Associate(pslot0); - psstrmOutput->NextPut(pslotNew1); - - GrSlotState * pslotNew2; - ptman->NewSlot('-', pslot0, NULL, m_ipass, &pslotNew2); - pslotNew2->Associate(pslot0); - psstrmOutput->NextPut(pslotNew2); - - return true; - } - - // _ _ any > '+' '+' @4 / # _ _ _ - else if ((m_ipass == 1) && - (psstrmInput->SlotsPending() >= 2) && - (psstrmInput->Peek(0)->IsLineBreak(chwLB))) - { - GrSlotState * pslot2 = psstrmInput->Peek(1); -// GrFeatureValues fval; -// pslot2->GetFeatureValues(&fval); - - psstrmOutput->CopyOneSlotFrom(psstrmInput); - - GrSlotState * pslotNew0; - ptman->NewSlot('+', pslot2, NULL, m_ipass, &pslotNew0); - pslotNew0->Associate(pslot2); - psstrmOutput->NextPut(pslotNew0); - - GrSlotState * pslotNew1; - ptman->NewSlot('+', pslot2, NULL, m_ipass, &pslotNew1); - pslotNew1->Associate(pslot2); - psstrmOutput->NextPut(pslotNew1); - - psstrmOutput->CopyOneSlotFrom(psstrmInput); - - return true; - } - - // '-' '-' '+' '+' > @1 _ _ @4 / _ _ # _ _ - else if ((m_ipass == 2) && - (psstrmInput->SlotsPending() >= 5) && - (psstrmInput->Peek(0)->GlyphID() == '-') && - (psstrmInput->Peek(1)->GlyphID() == '-') && - (psstrmInput->Peek(2)->IsLineBreak(chwLB)) && - (psstrmInput->Peek(3)->GlyphID() == '+') && - (psstrmInput->Peek(4)->GlyphID() == '+')) - { - psstrmOutput->CopyOneSlotFrom(psstrmInput); - psstrmInput->Skip(1); - psstrmOutput->CopyOneSlotFrom(psstrmInput); - psstrmInput->Skip(1); - psstrmOutput->CopyOneSlotFrom(psstrmInput); - - return true; - } - - else - return false; -} - -/*---------------------------------------------------------------------------------------------- - Substitution passes that do something special with pseudo glyphs. -----------------------------------------------------------------------------------------------*/ - -void GrSubPass::SetUpPseudoGlyphsTest() -{ - m_nMaxRuleContext = m_nMaxChunk = 3; - m_nMaxRuleLoop = 2; - m_staBehavior = "PseudoGlyphs"; -} - -bool GrSubPass::RunPseudoGlyphsTest(GrTableManager * ptman, - GrSlotStream * psstrmInput, GrSlotStream * psstrmOutput) -{ - gid16 chwLB = ptman->LBGlyphID(); - - // pseudo > uppercase / _ ' ' - if ((psstrmInput->SlotsPending() >= 2) && - (psstrmInput->Peek(0)->GlyphID() > 1000) && // pseudo - (psstrmInput->Peek(1)->GlyphID() == 32)) - { - GrSlotState * pslot0 = psstrmInput->NextGet(); -// GrFeatureValues fval; -// pslot0->GetFeatureValues(&fval); - - GrSlotState * pslotNew; - ptman->NewSlotCopy(pslot0, m_ipass, &pslotNew); - pslotNew->SetGlyphID(pslot0->GlyphID() - 1000); - pslotNew->Associate(pslot0); - psstrmOutput->NextPut(pslotNew); - - psstrmOutput->SetPosForNextRule(0, psstrmInput, false); - - return true; - } - - // pseudo > uppercase / _ | - // pseudo > uppercase / _ # - else if ((psstrmInput->SlotsPending() <= 2) && - (psstrmInput->Peek(0)->GlyphID() > 1000) && // pseudo - (psstrmInput->SlotsPending() < 2 || psstrmInput->Peek(1)->GlyphID() == 35)) - { - GrSlotState * pslot0 = psstrmInput->NextGet(); -// GrFeatureValues fval; -// pslot0->GetFeatureValues(&fval); - - GrSlotState * pslotNew; - ptman->NewSlotCopy(pslot0, m_ipass, &pslotNew); - pslotNew->SetGlyphID(pslot0->GlyphID() - 1000); - pslotNew->Associate(pslot0); - psstrmOutput->NextPut(pslotNew); - - psstrmOutput->SetPosForNextRule(0, psstrmInput, false); - - return true; - } - - // pseudo any _ > lowercase:1 @2 @1 / _ _ ^ _; - else if ((psstrmInput->SlotsPending() >= 3) && - (psstrmInput->Peek(0)->GlyphID() > 1000)) // pseudo - { - GrSlotState * pslot0 = psstrmInput->NextGet(); -// GrFeatureValues fval; -// pslot0->GetFeatureValues(&fval); - - GrSlotState * pslotNew0; - ptman->NewSlot(pslot0->GlyphID()-1000-65+97, pslot0, NULL, m_ipass, &pslotNew0); - pslotNew0->Associate(pslot0); - psstrmOutput->NextPut(pslotNew0); - - psstrmOutput->CopyOneSlotFrom(psstrmInput); - - GrSlotState * pslotNew2; - ptman->NewSlot(pslot0->GlyphID(), pslot0, NULL, m_ipass, &pslotNew2); - pslotNew2->Associate(pslot0); - psstrmOutput->NextPut(pslotNew2); - - psstrmOutput->SetPosForNextRule(-1, psstrmInput, false); - - return true; - } - else - return false; -} - -/*---------------------------------------------------------------------------------------------- - Substitution pass that tests reversing numbers. -----------------------------------------------------------------------------------------------*/ -void GrSubPass::SetUpBidiNumbersTest() -{ - m_nMaxRuleContext = m_nMaxChunk = 1; - m_nMaxRuleLoop = 2; - m_staBehavior = "BidiNumbers"; -} - -bool GrSubPass::RunBidiNumbersTest(GrTableManager * ptman, - GrSlotStream * psstrmInput, GrSlotStream * psstrmOutput) -{ - gid16 chw0; - - // clsDigit > clsDigit { dir = DIR_ARABNUMBER }; - if ((psstrmInput->SlotsPending() >= 1) && - (((chw0 = psstrmInput->Peek(0)->GlyphID()) >= '0' && chw0 <= '9') || - (chw0 >= 'A' && chw0 <= 'Z') || (chw0 >= 'a' && chw0 <= 'z'))) - { - GrSlotState * pslot0 = psstrmInput->NextGet(); -// GrFeatureValues fval0; -// pslot0->GetFeatureValues(&fval0); - - GrSlotState * pslotNew; - ptman->NewSlot(chw0, pslot0, NULL, m_ipass, &pslotNew); - if (chw0 >= '0' && chw0 <= '9') - pslotNew->SetDirectionality(kdircArabNum); - else // a-z and A-Z - pslotNew->SetDirectionality(kdircR); - pslotNew->Associate(pslot0); - psstrmOutput->NextPut(pslotNew); - - return true; - } - else - return false; -} - -void GrBidiPass::SetUpBidiNumbersTest() -{ - m_nMaxRuleContext = m_nMaxChunk = 1; - m_nMaxRuleLoop = 2; - m_nTopDirection = 1; -} - -/*---------------------------------------------------------------------------------------------- - Substitution pass that tests the bidi algorithm thoroughly. -----------------------------------------------------------------------------------------------*/ -void GrSubPass::SetUpBidiAlgorithmTest() -{ - m_nMaxRuleContext = m_nMaxChunk = 1; - m_nMaxRuleLoop = 2; - m_staBehavior = "BidiAlgorithm"; -} - -bool GrSubPass::RunBidiAlgorithmTest(GrTableManager * ptman, - GrSlotStream * psstrmInput, GrSlotStream * psstrmOutput) -{ - gid16 chw0; - - if (psstrmInput->SlotsPending() >= 1) - { - chw0 = psstrmInput->Peek(0)->GlyphID(); - - DirCode dircNew; - - if (chw0 >= '0' && chw0 <= '9') - dircNew = kdircEuroNum; - else if (chw0 >= 'a' && chw0 <= 'z') - dircNew = kdircL; - else if (chw0 >= 'A' && chw0 <= 'M') - dircNew = kdircR; - else if (chw0 >= 'N' && chw0 <= 'T') - dircNew = kdircRArab; - else if (chw0 >= 'U' && chw0 <= 'Z') - dircNew = kdircArabNum; - else if (chw0 == '$' || chw0 == '%') - dircNew = kdircEuroTerm; - else if (chw0 == '.' || chw0 == '*' || chw0 == '+') - dircNew = kdircEuroSep; - else if (chw0 == '@') - dircNew = kdircComSep; - else if (chw0 == '_' || chw0 == '=') - dircNew = kdircNeutral; - else if (chw0 == ':') - dircNew = kdircNSM; - else - return false; - - GrSlotState * pslot0 = psstrmInput->NextGet(); -// GrFeatureValues fval0; -// pslot0->GetFeatureValues(&fval0); - - GrSlotState * pslotNew; - ptman->NewSlot(chw0, pslot0, NULL, m_ipass, &pslotNew); - pslotNew->SetDirectionality(dircNew); - pslotNew->Associate(pslot0); - psstrmOutput->NextPut(pslotNew); - - return true; - } - else - return false; -} - -void GrBidiPass::SetUpBidiAlgorithmTest() -{ - m_nMaxRuleContext = m_nMaxChunk = 1; - m_nMaxRuleLoop = 2; - m_nTopDirection = 0; -} - - -#endif // _DEBUG - -} // namespace gr - -#endif // OLD_TEST_STUFF - -//:End Ignore diff --git a/Build/source/libs/graphite/engine-2.3.1/src/segment/TransductionLog.cpp b/Build/source/libs/graphite/engine-2.3.1/src/segment/TransductionLog.cpp deleted file mode 100644 index 9071e3fd462..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/src/segment/TransductionLog.cpp +++ /dev/null @@ -1,2129 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 2000, 2001 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: TransductionLog.cpp -Responsibility: Sharon Correll -Last reviewed: Not yet. - -Description: - Contains the functions for writing a log of the transduction process. -----------------------------------------------------------------------------------------------*/ - -//:>******************************************************************************************** -//:> Include files -//:>******************************************************************************************** -#include "Main.h" - -#ifdef _MSC_VER -#pragma hdrstop -#endif -#include -#include - -#undef THIS_FILE -DEFINE_THIS_FILE - -//:End Ignore - -//:>******************************************************************************************** -//:> Forward declarations -//:>******************************************************************************************** - -//:>******************************************************************************************** -//:> Local Constants and static variables -//:>******************************************************************************************** - -namespace gr -{ - -//:>******************************************************************************************** -//:> Methods -//:>******************************************************************************************** - -#define SP_PER_SLOT 7 -#define LEADING_SP 15 -#define MAX_SLOTS 128 - -/*---------------------------------------------------------------------------------------------- - Output a file showing a log of the transduction process and the resulting segment. -----------------------------------------------------------------------------------------------*/ -//bool GrTableManager::WriteTransductionLog(GrCharStream * pchstrm, Segment * psegRet, -// int cbPrevSegDat, byte * pbPrevSegDat, byte * pbNextSegDat, int * pcbNextSegDat) -//{ -//#ifdef TRACING -// std::string staFile; -// if (!LogFileName(staFile)) -// return false; -// -// std::ofstream strmOut; -// if (cbPrevSegDat > 0) -// strmOut.open(staFile.c_str(), std::ios::app); // append -// else -// strmOut.open(staFile.c_str()); -// if (strmOut.fail()) -// return false; -// -// WriteXductnLog(strmOut, pchstrm, psegRet, cbPrevSegDat, pbPrevSegDat); -// -// strmOut.close(); -// return true; -//#else -// return false; -//#endif // TRACING -//} - -bool GrTableManager::WriteTransductionLog(std::ostream * pstrmLog, - GrCharStream * pchstrm, Segment * psegRet, int cbPrevSegDat, byte * pbPrevSegDat) -{ -#ifdef TRACING - if (!pstrmLog) - return false; - std::ostream & strmOut = *pstrmLog; - WriteXductnLog(strmOut, pchstrm, psegRet, cbPrevSegDat, pbPrevSegDat); - return true; -#else - return false; -#endif // TRACING -} - -/*---------------------------------------------------------------------------------------------- - Append to the file, showing the surface/underlying mappings. This must be done after - figuring out all the associations. - - Also write the final glyph positions, since they are now determined. -----------------------------------------------------------------------------------------------*/ -//bool GrTableManager::WriteAssociationLog(GrCharStream * pchstrm, Segment * psegRet) -//{ -//#ifdef TRACING -// std::string staFile; -// if (!LogFileName(staFile)) -// return false; -// -// std::ofstream strmOut; -// strmOut.open(staFile.c_str(), std::ios::app); // append -// if (strmOut.fail()) -// return false; -// -// LogFinalPositions(strmOut); -// -// strmOut << "\n\n- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n\n"; -// -// psegRet->LogUnderlyingToSurface(this, strmOut, pchstrm); -// psegRet->LogSurfaceToUnderlying(this, strmOut); -// -// strmOut << "\n\n=======================================================================\n\n"; -// -// strmOut.close(); -// return true; -//#else -// return false; -//#endif // TRACING -//} - - -bool GrTableManager::WriteAssociationLog(std::ostream * pstrmLog, - GrCharStream * pchstrm, Segment * psegRet) -{ -#ifdef TRACING - if (!pstrmLog) - return false; - - std::ostream & strmOut = *pstrmLog; - LogFinalPositions(strmOut); - - strmOut << "\n\n- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n\n"; - - psegRet->LogUnderlyingToSurface(this, strmOut, pchstrm); - psegRet->LogSurfaceToUnderlying(this, strmOut); - - strmOut << "\n\n=======================================================================\n\n"; - - return true; -#else - return false; -#endif // TRACING -} - -#ifdef TRACING - -/*---------------------------------------------------------------------------------------------- - Generate the name of the file where the log will be written. It goes in the directory - defined by either the TEMP or TMP environment variable. - - TODO: remove -----------------------------------------------------------------------------------------------*/ -//bool GrTableManager::LogFileName(std::string & staFile) -//{ -// char * pchTmpEnv = getenv("TEMP"); -// if (pchTmpEnv == 0) -// pchTmpEnv = getenv("TMP"); -// if (pchTmpEnv == 0) -// return false; -// -// staFile.assign(pchTmpEnv); -// if (staFile[staFile.size() - 1] != '\\') -// staFile.append("\\"); -// staFile.append("gr_xductn.log"); -// -// return true; -//} - -/*---------------------------------------------------------------------------------------------- - Output a file showing a log of the transduction process and the resulting segment. -----------------------------------------------------------------------------------------------*/ -void GrTableManager::WriteXductnLog(std::ostream & strmOut, - GrCharStream * pchstrm, Segment * psegRet, - int cbPrevSegDat, byte * pbPrevSegDat) -{ - if (cbPrevSegDat == 0) - LogUnderlying(strmOut, pchstrm, 0); - else - { - Assert(*(pbPrevSegDat + 4) == 0); // skip offset for first pass - LogUnderlying(strmOut, pchstrm, *(pbPrevSegDat + 3)); - } - - LogPass1Input(strmOut); - - for (int ipass = 1; ipass < m_cpass; ipass++) - { - if (cbPrevSegDat == 0) - LogPassOutput(strmOut, ipass, 0); - else - LogPassOutput(strmOut, ipass, *(pbPrevSegDat + 4 + ipass)); - } - - // Do this later, after outputting final positions: - //strmOut << "\n\n- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n\n"; -} - -/*---------------------------------------------------------------------------------------------- - Write out a log of the underlying input. -----------------------------------------------------------------------------------------------*/ -void GrTableManager::LogUnderlying(std::ostream & strmOut, GrCharStream * pchstrm, - int cchwBackup) -{ - strmOut << "UNDERLYING INPUT\n\n"; - - int rgnChars[MAX_SLOTS]; - bool rgfNewRun[MAX_SLOTS]; - std::fill_n(rgfNewRun, MAX_SLOTS, false); - GrFeatureValues rgfval[MAX_SLOTS]; - int cchwMaxRawChars; - - int cnUtf32 = pchstrm->GetLogData(this, rgnChars, rgfNewRun, rgfval, - cchwBackup, &cchwMaxRawChars); - cnUtf32 = min(cnUtf32, MAX_SLOTS); - - int ichw; - - // For UTF-8 and surrogate representation: - utf16 rgchwChars2[MAX_SLOTS]; - utf16 rgchwChars3[MAX_SLOTS]; - utf16 rgchwChars4[MAX_SLOTS]; - utf16 rgchwChars5[MAX_SLOTS]; - utf16 rgchwChars6[MAX_SLOTS]; - int rgcchwRaw[MAX_SLOTS]; - - if (cchwMaxRawChars > 1) - { - cchwMaxRawChars = min(cchwMaxRawChars, 6); // max of 6 raw (UTF-8 or UTF-16) chars per slot - pchstrm->GetLogDataRaw(this, cnUtf32, cchwBackup, cchwMaxRawChars, - rgnChars, rgchwChars2, rgchwChars3, rgchwChars4, rgchwChars5, rgchwChars6, - rgcchwRaw); - } - else - { - for (ichw = 0; ichw < cnUtf32; ichw++) - { - rgcchwRaw[ichw] = 1; - rgchwChars2[ichw] = 0; - rgchwChars3[ichw] = 0; - rgchwChars4[ichw] = 0; - rgchwChars5[ichw] = 0; - rgchwChars6[ichw] = 0; - } - } - - LogUnderlyingHeader(strmOut, pchstrm->Min(), (pchstrm->Min() + cnUtf32 - cchwBackup), - cchwBackup, rgcchwRaw); - - // Text - strmOut << "Text: "; // 15 spaces - for (ichw = 0; ichw < cnUtf32; ichw++) - { - if (rgnChars[ichw] < 0x0100 && rgchwChars2[ichw] == 0) // ANSI - strmOut << (char)rgnChars[ichw] << " "; // 6 spaces - else if (rgnChars[ichw] == knLRM) - strmOut << " "; - else if (rgnChars[ichw] == knRLM) - strmOut << " "; - else if (rgnChars[ichw] == knLRO) - strmOut << " "; - else if (rgnChars[ichw] == knRLO) - strmOut << " "; - else if (rgnChars[ichw] == knLRE) - strmOut << " "; - else if (rgnChars[ichw] == knRLE) - strmOut << " "; - else if (rgnChars[ichw] == knPDF) - strmOut << " "; - else - strmOut << " "; - } - strmOut << "\n"; - - // Unicode - strmOut << "Unicode: "; - for (ichw = 0; ichw < cnUtf32; ichw++) - LogHexInTable(strmOut, utf16(rgnChars[ichw])); - strmOut << "\n"; - for (int icchRaw = 2; icchRaw <= cchwMaxRawChars; icchRaw++) - { - strmOut << " "; - for (ichw = 0; ichw < cnUtf32; ichw++) - { - utf16 chw; - switch (icchRaw) - { - case 2: chw = rgchwChars2[ichw]; break; - case 3: chw = rgchwChars3[ichw]; break; - case 4: chw = rgchwChars4[ichw]; break; - case 5: chw = rgchwChars5[ichw]; break; - case 6: chw = rgchwChars6[ichw]; break; - default: chw = 0; - } - if (chw == 0) - strmOut << " "; - else - LogHexInTable(strmOut, chw); - } - strmOut << "\n"; - } - - // Runs - strmOut << "Runs: "; - int crun = 0; - for (ichw = 0; ichw < cnUtf32; ichw++) - { - if (rgfNewRun[ichw]) - { - crun++; - strmOut << "|" << crun << ((crun < 10) ? " " : " "); - } - else - strmOut << " "; - } - strmOut << "\n"; - - // Features - strmOut << "Features and character properties:\n"; - crun = 0; - for (ichw = 0; ichw < cnUtf32; ichw++) - { - if (rgfNewRun[ichw]) - { - crun++; - strmOut << " Run " << crun << ": "; - rgfval[ichw].WriteXductnLog(this, strmOut); - - } - } -} - - -void GrFeatureValues::WriteXductnLog(GrTableManager * ptman, std::ostream & strmOut) -{ - bool fFirst = true; - for (int i = 0; i < kMaxFeatures; i++) - { - if (m_rgnFValues[i] != 0) - { - GrFeature * pfeat = ptman->Feature(i); - if (!fFirst) - strmOut << ","; - strmOut << pfeat->ID() << "=" << m_rgnFValues[i]; - fFirst = false; - } - } - if (fFirst) - strmOut << "all features=0"; - - strmOut << "\n\n"; -} - -/*---------------------------------------------------------------------------------------------- - Loop through the input stream of underlying characters, storing information in the - arrays for the log. - ENHANCE SharonC: do we need to show the underline properties? -----------------------------------------------------------------------------------------------*/ -int GrCharStream::GetLogData(GrTableManager * ptman, int * rgchl, bool * rgfNewRun, - GrFeatureValues * rgfval, int cchrBackup, int * pcchrMax) -{ - Assert(cchrBackup <= m_cchrBackedUp); - - int ichrPosToStop = m_ichrPos; - int ichrStart = m_ichrMin - max(cchrBackup, m_cchrBackedUp); - - *pcchrMax = 0; - - // Restart the stream. - m_ichrPos = ichrStart; - m_ichrRunMin = 0; - m_ichrRunLim = 0; - m_ichrRunOffset = kPosInfinity; - m_vislotNextChunkMap.clear(); - - int cchrSkipBackup = m_cchrBackedUp - cchrBackup; - - int c = 0; - int cchr = 0; - - while (m_ichrPos < ichrPosToStop) - { - if ((c < MAX_SLOTS) && (m_ichrPos >= m_ichrRunLim)) - { - rgfNewRun[c] = true; - } - - GrFeatureValues fval; - int ichrOffset, cchrThis; - int chl = NextGet(ptman, &fval, &ichrOffset, &cchrThis); - cchr += cchrThis; - if (cchr <= cchrSkipBackup) - {} // ignore - this is before the pre-segment stuff that we want to skip - else if (c < MAX_SLOTS) - { - rgchl[c] = chl; - *pcchrMax = max(*pcchrMax, cchrThis); - if (rgfNewRun[c]) - { - rgfval[c] = fval; - } - c++; - } - } - - ////return (m_ichwPos - (m_ichwMin - cchwBackup)); - return c; -} - -/*---------------------------------------------------------------------------------------------- - If any of the characters are comprised of surrogates or UTF-8, fill in the arrays with - the raw (UTF-16 or UTF-8) chars for display. To do this we get the raw characters - directly from the text source. -----------------------------------------------------------------------------------------------*/ -void GrCharStream::GetLogDataRaw(GrTableManager * ptman, int cchl, int cchrBackup, - int cchrMaxRaw, int * prgchl, - utf16 * prgchw2, utf16 * prgchw3, utf16 * prgchw4, utf16 * prgchw5, utf16 * prgchw6, - int * prgcchr) -{ - for (int i = 0; i < cchl; i++) - { - prgchw2[i] = 0; - } - - int ichrLim = m_ichrPos; - int ichrMin = m_ichrMin - cchrBackup; - - int cchrRange = ichrLim - ichrMin; - int ichr; - utf16 * prgchwRunText = new utf16[cchrRange]; - utf8 * prgchsRunText8 = NULL; - - UtfType utf = m_pgts->utfEncodingForm(); - - switch (utf) - { - case kutf8: - prgchsRunText8 = new utf8[cchrRange]; - m_pgts->fetch(ichrMin, cchrRange, prgchsRunText8); - for (int ichr = 0; ichr < cchrRange; ichr++) - prgchwRunText[ichr] = (utf16)prgchsRunText8[ichr]; // zero-extend into UTF-16 buffer - break; - case kutf16: - m_pgts->fetch(ichrMin, cchrRange, prgchwRunText); - break; - default: - case kutf32: // this method should never have been called - Assert(false); - for (int ichrLp = 0; ichrLp < cchrRange; ichrLp++) - { - prgcchr[ichrLp] = 1; - prgchw2[ichrLp] = 0; - prgchw3[ichrLp] = 0; - prgchw4[ichrLp] = 0; - prgchw5[ichrLp] = 0; - prgchw6[ichrLp] = 0; - } - return; - } - - ichr = ichrMin; - int ichl = 0; - while (ichr < ichrLim) - { - int cchrThis = 1; - // Replace 32-bit char with (first) 16-bit or 8-bit char. - prgchl[ichl] = (int)prgchwRunText[ichr - ichrMin]; - prgcchr[ichr] = cchrThis; - ichr++; - - while (!AtUnicodeCharBoundary(prgchwRunText, cchrRange, ichr - ichrMin, utf)) - { - cchrThis++; - switch (cchrThis) - { - case 2: prgchw2[ichl] = prgchwRunText[ichr - ichrMin]; break; - case 3: prgchw3[ichl] = prgchwRunText[ichr - ichrMin]; break; - case 4: prgchw4[ichl] = prgchwRunText[ichr - ichrMin]; break; - case 5: prgchw5[ichl] = prgchwRunText[ichr - ichrMin]; break; - case 6: prgchw6[ichl] = prgchwRunText[ichr - ichrMin]; break; - default: - break; - } - prgcchr[ichr] = cchrThis; - ichr++; - } - switch (cchrThis) - { - case 1: - prgchw2[ichl] = 0; - // fall through - case 2: - prgchw3[ichl] = 0; - // fall through - case 3: - prgchw4[ichl] = 0; - // fall through - case 4: - prgchw5[ichl] = 0; - // fall through - case 5: - prgchw6[ichl] = 0; - } - ichl++; - } - - delete[] prgchwRunText; - delete[] prgchsRunText8; -} - -/*---------------------------------------------------------------------------------------------- - Output the glyph IDs generated by the glyph generation pass (pass 0). -----------------------------------------------------------------------------------------------*/ -void GrTableManager::LogPass1Input(std::ostream & strmOut) -{ - strmOut << "INPUT TO PASS 1\n\n"; - - GrSlotStream * psstrm = OutputStream(0); - - LogSlotHeader(strmOut, psstrm->WritePos(), SP_PER_SLOT, LEADING_SP); - - LogSlotGlyphs(strmOut, psstrm); - - strmOut << "\n"; -} - -/*---------------------------------------------------------------------------------------------- - Output the the results of pass. -----------------------------------------------------------------------------------------------*/ -void GrTableManager::LogPassOutput(std::ostream & strmOut, int ipass, int cslotSkipped) -{ - strmOut << "\n"; - - GrPass * ppass = Pass(ipass); - GrSlotStream * psstrmIn = InputStream(ipass); - GrSlotStream * psstrmOut = OutputStream(ipass); - - int islot; - // Mark each slot with its index in the input and output streams. - for (islot = 0; islot < psstrmIn->ReadPos(); islot++) - psstrmIn->SlotAt(islot)->m_islotTmpIn = islot; - - for (islot = 0; islot < psstrmOut->WritePos(); islot++) - psstrmOut->SlotAt(islot)->m_islotTmpOut = islot; - - if (!dynamic_cast(ppass)) - ppass->LogRulesFiredAndFailed(strmOut, psstrmIn); - - strmOut << "\nOUTPUT OF PASS " << ipass; - if (dynamic_cast(ppass)) - strmOut << " (bidi)"; - else if (dynamic_cast(ppass)) - { - if (ipass >= m_ipassJust1) - strmOut << " (justification)"; - else - strmOut << " (substitution)"; - } - else if (dynamic_cast(ppass)) - strmOut << " (positioning)"; - else if (dynamic_cast(ppass)) - strmOut << " (linebreak)"; - strmOut << "\n"; - - ppass->LogInsertionsAndDeletions(strmOut, psstrmOut); - - LogSlotHeader(strmOut, psstrmOut->WritePos(), SP_PER_SLOT, LEADING_SP); - - LogSlotGlyphs(strmOut, psstrmOut); - - bool fAnyPseudos = false; - if (dynamic_cast(ppass)) - { - for (islot = 0; islot < psstrmOut->WritePos(); islot++) - { - GrSlotState * pslotTmp = psstrmOut->SlotAt(islot); - if (pslotTmp->GlyphID() != pslotTmp->ActualGlyphForOutput(this)) - { - fAnyPseudos = true; - break; - } - } - } - if (fAnyPseudos) - { - strmOut << "Actual glyphs: "; - for (islot = 0; islot < psstrmOut->WritePos(); islot++) - { - GrSlotState * pslotTmp = psstrmOut->SlotAt(islot); - if (pslotTmp->GlyphID() != pslotTmp->ActualGlyphForOutput(this)) - LogHexInTable(strmOut, pslotTmp->ActualGlyphForOutput(this)); - else - strmOut << " "; - } - strmOut << "\n"; - } - - LogAttributes(strmOut, ipass); - - // Do this later, after we're sure the positions have been set: - //if (ipass == m_cpass - 1) - // LogFinalPositions(strmOut); - - if (cslotSkipped > 0) - { - strmOut << "\n "; - for (islot = 0; islot < cslotSkipped; islot++) - strmOut << "SKIP "; - strmOut << "\n"; - } - - // If this was the pass just before the justification routines get run, output a - // special line that just shows the results, ie, the values of justify.width. - // TODO: adjust this when measure mode get functioning. - if (ipass == m_ipassJust1 - 1 && ShouldLogJustification() - && m_engst.m_jmodi == kjmodiJustify) - { - strmOut << "\nJUSTIFICATION\n\n"; - LogSlotHeader(strmOut, psstrmOut->WritePos(), SP_PER_SLOT, LEADING_SP); - LogSlotGlyphs(strmOut, psstrmOut); - LogAttributes(strmOut, ipass, true); - } -} - -/*---------------------------------------------------------------------------------------------- - Write the list of rules fired and failed for a given pass. -----------------------------------------------------------------------------------------------*/ -void GrPass::LogRulesFiredAndFailed(std::ostream & strmOut, GrSlotStream * psstrmIn) -{ - m_pzpst->LogRulesFiredAndFailed(strmOut, psstrmIn); -} - -void PassState::LogRulesFiredAndFailed(std::ostream & strmOut, GrSlotStream * psstrmIn) -{ - - strmOut << "PASS " << m_ipass << "\n\n" << "Rules matched: "; - if (m_crulrec == 0) - strmOut << "none"; - strmOut << "\n"; - - for (int irulrec = 0; irulrec < m_crulrec; irulrec++) - { - if (m_rgrulrec[irulrec].m_fFired) - strmOut << " * "; - else - strmOut << " "; - - strmOut << m_rgrulrec[irulrec].m_islot << ". "; - - if (m_rgrulrec[irulrec].m_irul == PassState::kHitMaxRuleLoop) - strmOut << "hit MaxRuleLoop\n"; - else if (m_rgrulrec[irulrec].m_irul == PassState::kHitMaxBackup) - strmOut << "hit MaxBackup\n"; - else - { - strmOut << "rule " << m_ipass << "." << m_rgrulrec[irulrec].m_irul; - - if (m_rgrulrec[irulrec].m_fFired) - strmOut << " FIRED\n"; - else - strmOut << " failed\n"; - } - } -} - -/*---------------------------------------------------------------------------------------------- - Write out the marks on top of the slot table indicating insertions and deletions. -----------------------------------------------------------------------------------------------*/ -void GrPass::LogInsertionsAndDeletions(std::ostream & strmOut, GrSlotStream * psstrmOut) -{ - m_pzpst->LogInsertionsAndDeletions(strmOut, psstrmOut); -} - -void PassState::LogInsertionsAndDeletions(std::ostream & strmOut, GrSlotStream * psstrmOut) -{ - int cslotDel = m_rgcslotDeletions[0]; - bool fIns; - if (cslotDel > 1) - strmOut << "\n DEL-" << cslotDel; - else if (cslotDel == 1) - strmOut << "\n DEL "; - else - strmOut << "\n "; - - for (int islot = 0; islot < psstrmOut->WritePos(); islot++) - { - cslotDel = (islot + 1 >= MAX_SLOTS) ? 0 : m_rgcslotDeletions[islot + 1]; - fIns = (islot >= MAX_SLOTS) ? 0 : m_rgfInsertion[islot]; - - if (fIns) - { - strmOut << "INS"; - if (cslotDel > 0) - { - if (cslotDel > 1) - strmOut << "/D-" << cslotDel; - else - strmOut << "/DEL"; - } - else - strmOut << " "; - - } - else if (cslotDel > 0) - { - if (cslotDel >= 10) - strmOut << "DEL-" << cslotDel << " "; - else if (cslotDel > 1) - strmOut << " DEL-" << cslotDel << " "; - else - strmOut << " DEL "; - } - else - strmOut << " "; - } - - strmOut << "\n"; -} - -/*---------------------------------------------------------------------------------------------- - Write out a line for each slot attribute that changed during the pass. - - @param fJustWidths - a special pass that writes out just the effects of the justification - routines, ie, the values of justify.width -----------------------------------------------------------------------------------------------*/ -void GrTableManager::LogAttributes(std::ostream & strmOut, int ipass, - bool fJustWidths) -{ - // Figure out which slot attributes were modified for some slot during the pass. - bool * prgfMods = new bool[kslatMax + NumUserDefn() - 1]; - - bool fPreJust = (!fJustWidths && ipass == m_ipassJust1 - 1 && ShouldLogJustification()); - bool fPostJust = ((fJustWidths || ipass == m_ipassJust1) && ShouldLogJustification()); - - int ccomp; // max number of components per slot - int cassoc; // max number of associations per slot - SlotAttrsModified(ipass, prgfMods, fPreJust, &ccomp, &cassoc); - - if (fPreJust) - { - // prgfMods[kslatJStretch] = true; - // prgfMods[kslatJShrink] = true; - // prgfMods[kslatJStep] = true; - // prgfMods[kslatWeight] = true; - prgfMods[kslatJWidth] = false; // output j.width in its own line (we call this - // method with fJustWidths == true) - } - else if (fPostJust) - prgfMods[kslatJWidth] = true; - - GrPass * ppass = Pass(ipass); - GrPass * ppassNext = (ipass < m_cpass - 1) ? Pass(ipass + 1) : NULL; - GrSlotStream * psstrm = OutputStream(ipass); - - if (fJustWidths) - {} - else if (dynamic_cast(ppass)) - { - // Special stuff for Bidi pass: - // Log value of directionality attribute. - strmOut << "directionality "; - int islot; - for (islot = 0; islot < psstrm->WritePos(); islot++) - { - GrSlotState * pslot = psstrm->SlotAt(islot); - LogDirCodeInTable(strmOut, pslot->DirProcessed()); - } - strmOut << "\n"; - - // Log final direction level for bidi pass. - strmOut << "dir level "; - for (islot = 0; islot < psstrm->WritePos(); islot++) - { - GrSlotState * pslot = psstrm->SlotAt(islot); - LogInTable(strmOut, pslot->DirLevel()); - } - strmOut << "\n"; - } - else if (ppassNext && dynamic_cast(ppassNext)) - { - // Next pass is Bidi: log input values of directionality attribute that are input for it. - strmOut << "directionality "; - for (int islot = 0; islot < psstrm->WritePos(); islot++) - { - GrSlotState * pslot = psstrm->SlotAt(islot); - LogDirCodeInTable(strmOut, pslot->Directionality()); - } - strmOut << "\n"; - } - - for (int slat = 0; slat < kslatMax + NumUserDefn() - 1; slat++) - { - int cIndexLim = 1; - if (slat == kslatCompRef) - cIndexLim = ccomp; - else if (slat == kslatUserDefn) - cIndexLim = 1; // kMaxUserDefinedSlotAttributes; - - if (fJustWidths && slat != kslatJWidth) - continue; - - bool fValidAttr = true; - for (int iIndex = 0; iIndex < cIndexLim; iIndex++) - { - if (prgfMods[slat]) - { - switch(slat) - { - case kslatAdvX: strmOut << "advance.x "; break; - case kslatAdvY: strmOut << "advance.y "; break; - case kslatAttTo: strmOut << "att.to "; break; - case kslatAttAtX: strmOut << "att.at.x "; break; - case kslatAttAtY: strmOut << "att.at.y "; break; - case kslatAttAtGpt: strmOut << "att.at.gpt "; break; - case kslatAttAtXoff: strmOut << "att.at.xoff "; break; - case kslatAttAtYoff: strmOut << "att.at.yoff "; break; - case kslatAttWithX: strmOut << "att.with.x "; break; - case kslatAttWithY: strmOut << "att.with.y "; break; - case kslatAttWithGpt: strmOut << "att.with.gpt "; break; - case kslatAttWithXoff: strmOut << "att.with.xoff "; break; - case kslatAttWithYoff: strmOut << "att.with.yoff "; break; - case kslatAttLevel: strmOut << "att.level "; break; - case kslatBreak: strmOut << "breakweight "; break; - case kslatCompRef: strmOut << "component " << iIndex + 1 // 1-based - << " "; break; - case kslatDir: strmOut << "dir "; break; - case kslatInsert: strmOut << "insert "; break; - case kslatMeasureSol: strmOut << "measure.sol "; break; - case kslatMeasureEol: strmOut << "measure.eol "; break; - case kslatJStretch: strmOut << "j.stretch "; break; - case kslatJShrink: strmOut << "j.shrink "; break; - case kslatJStep: strmOut << "j.step "; break; - case kslatJWeight: strmOut << "j.weight "; break; - case kslatJWidth: strmOut << "j.width "; break; - case kslatPosX: - case kslatPosY: - Assert(false); - break; - case kslatShiftX: strmOut << "shift.x "; break; - case kslatShiftY: strmOut << "shift.y "; break; - default: - if (kslatUserDefn <= slat && - slat < kslatUserDefn + NumUserDefn()) - { - strmOut << "user" << (slat - kslatUserDefn + 1) // 1-based - << ((iIndex >= 9) ? " " : " "); - } - else - { - // Invalid attribute: - Warn("bad slot attribute"); - fValidAttr = false; - break; - } - } - - if (!fValidAttr) - break; // out of iIndex loop - - for (int islot = 0; islot < psstrm->WritePos(); islot++) - { - GrSlotState * pslot = psstrm->SlotAt(islot); - pslot->LogSlotAttribute(this, strmOut, ipass, slat, iIndex, - fPreJust, fPostJust); - } - - strmOut << "\n"; - } - } - } - - if (fJustWidths) - goto LDone; - - for (int iassoc = 0; iassoc < cassoc; iassoc++) - { - // Log associations. Put them on one line it that will work; otherwise use several. - bool fBoth = (cassoc <= 2); - bool fAfter = (iassoc == (cassoc - 1)); - if (fBoth) - strmOut << "assocs "; - else if (iassoc == 0) - strmOut << "assocs-before "; - else if (fAfter) - strmOut << " -after "; - else - strmOut << " -other "; - - for (int islot = 0; islot < psstrm->WritePos(); islot++) - { - GrSlotState * pslot = psstrm->SlotAt(islot); - pslot->LogAssociation(this, strmOut, ipass, iassoc, fBoth, fAfter); - } - - strmOut << "\n"; - - if (fBoth) - break; - } - - if (cassoc == 0 && dynamic_cast(ppass)) - { - strmOut << "assocs "; - - // Log associations for all slots moved during the Bidi pass. - for (int islot = 0; islot < psstrm->WritePos(); islot++) - { - GrSlotState * pslot = psstrm->SlotAt(islot); - if (pslot->m_islotTmpIn != pslot->m_islotTmpOut) - LogInTable(strmOut, pslot->m_islotTmpIn); - else - strmOut << " "; - } - - strmOut << "\n"; - } - -LDone: - - delete[] prgfMods; -} - -/*---------------------------------------------------------------------------------------------- - Write out the final positions. -----------------------------------------------------------------------------------------------*/ -void GrTableManager::LogFinalPositions(std::ostream & strmOut) -{ - GrSlotStream * psstrm = OutputStream(m_cpass - 1); - - strmOut << "x position "; - for (int islot = 0; islot < psstrm->WritePos(); islot++) - { - GrSlotState * pslot = psstrm->SlotAt(islot); - if (pslot->IsLineBreak(LBGlyphID())) - { - strmOut << " "; - continue; - } - LogInTable(strmOut, pslot->XPosition()); - } - strmOut << "\n"; - - strmOut << "y position "; - for (int islot = 0; islot < psstrm->WritePos(); islot++) - { - GrSlotState * pslot = psstrm->SlotAt(islot); - if (pslot->IsLineBreak(LBGlyphID())) - { - strmOut << " "; - continue; - } - LogInTable(strmOut, pslot->YPosition()); - } - strmOut << "\n"; -} -#endif // TRACING - -/*---------------------------------------------------------------------------------------------- - Write out the final underlying-to-surface associations. -----------------------------------------------------------------------------------------------*/ -void Segment::LogUnderlyingToSurface(GrTableManager * ptman, std::ostream & strmOut, - GrCharStream * pchstrm) -{ -#ifdef TRACING - strmOut << "\n\nUNDERLYING TO SURFACE MAPPINGS\n\n"; - - size_t cassocs = 0; - int fLigs = false; - int ichw; - for (ichw = 0; ichw < (m_ichwAssocsLim - m_ichwAssocsMin); ichw++) - { - if (m_prgpvisloutAssocs[ichw]) - cassocs = max(cassocs, m_prgpvisloutAssocs[ichw]->size()); - if (m_prgisloutLigature[ichw] != kNegInfinity) - fLigs = true; - } - -// ptman->LogSlotHeader(strmOut, m_ichwAssocsLim, SP_PER_SLOT, LEADING_SP, m_ichwAssocsMin); - ptman->LogUnderlyingHeader(strmOut, pchstrm->Min(), (pchstrm->Min() + m_ichwAssocsLim), - -m_ichwAssocsMin, NULL); - - int rgnChars[MAX_SLOTS]; - bool rgfNewRun[MAX_SLOTS]; - std::fill_n(rgfNewRun, MAX_SLOTS, false); - GrFeatureValues rgfval[MAX_SLOTS]; - int cchwMaxRawChars; - - int cchw = pchstrm->GetLogData(ptman, rgnChars, rgfNewRun, rgfval, - -m_ichwAssocsMin, &cchwMaxRawChars); - cchw = min(cchw, MAX_SLOTS); - - utf16 rgchwChars2[MAX_SLOTS]; - utf16 rgchwChars3[MAX_SLOTS]; - utf16 rgchwChars4[MAX_SLOTS]; - utf16 rgchwChars5[MAX_SLOTS]; - utf16 rgchwChars6[MAX_SLOTS]; - int rgcchwRaw[MAX_SLOTS]; - if (cchwMaxRawChars > 1) - { - cchwMaxRawChars = min(cchwMaxRawChars, 6); - pchstrm->GetLogDataRaw(ptman, cchw, -m_ichwAssocsMin, cchwMaxRawChars, - rgnChars, rgchwChars2, rgchwChars3, rgchwChars4, rgchwChars5, rgchwChars6, - rgcchwRaw); - } - else - { - for (ichw = 0 ; ichw <(m_ichwAssocsLim - m_ichwAssocsMin); ichw++) - { - rgcchwRaw[ichw] = 1; - rgchwChars2[ichw] = 0; - rgchwChars3[ichw] = 0; - rgchwChars4[ichw] = 0; - rgchwChars5[ichw] = 0; - rgchwChars6[ichw] = 0; - } - } - - // Text - strmOut << "Text: "; // 15 spaces - int inUtf32 = 0; - for (ichw = 0; ichw < (m_ichwAssocsLim - m_ichwAssocsMin); ichw++) - { - utf16 chw, chwNext; - switch (rgcchwRaw[ichw]) - { - default: - case 1: chw = utf16(rgnChars[inUtf32]); chwNext = rgchwChars2[inUtf32]; break; - case 2: chw = rgchwChars2[inUtf32]; chwNext = rgchwChars3[inUtf32]; break; - case 3: chw = rgchwChars3[inUtf32]; chwNext = rgchwChars4[inUtf32]; break; - case 4: chw = rgchwChars4[inUtf32]; chwNext = rgchwChars5[inUtf32]; break; - case 5: chw = rgchwChars5[inUtf32]; chwNext = rgchwChars6[inUtf32]; break; - case 6: chw = rgchwChars6[inUtf32]; chwNext = 0; break; - } - if (rgcchwRaw[ichw] == 1 && chwNext == 0 && chw < 0x0100) // ANSI - strmOut << (char)chw << " "; // 6 spaces - else - strmOut << " "; // 7 spaces - if (chwNext == 0) - inUtf32++; - } - strmOut << "\n"; - - // Unicode - strmOut << "Unicode: "; - inUtf32 = 0; - for (ichw = 0; ichw < (m_ichwAssocsLim - m_ichwAssocsMin); ichw++) - { - utf16 chw, chwNext; - switch (rgcchwRaw[ichw]) - { - default: - case 1: chw = utf16(rgnChars[inUtf32]); chwNext = rgchwChars2[inUtf32]; break; - case 2: chw = rgchwChars2[inUtf32]; chwNext = rgchwChars3[inUtf32]; break; - case 3: chw = rgchwChars3[inUtf32]; chwNext = rgchwChars4[inUtf32]; break; - case 4: chw = rgchwChars4[inUtf32]; chwNext = rgchwChars5[inUtf32]; break; - case 5: chw = rgchwChars5[inUtf32]; chwNext = rgchwChars6[inUtf32]; break; - case 6: chw = rgchwChars6[inUtf32]; chwNext = 0; break; - } - ptman->LogHexInTable(strmOut, chw, chwNext != 0); - if (chwNext == 0) - inUtf32++; - } - strmOut << "\n"; - - strmOut << "before "; - for (ichw = 0; ichw < (m_ichwAssocsLim - m_ichwAssocsMin); ichw++) - { - if (rgcchwRaw[ichw] > 1) - // continuation of Unicode codepoint - strmOut << " "; - else if (m_prgisloutBefore[ichw] == kNegInfinity) - strmOut << "<-- "; - else if (m_prgisloutBefore[ichw] == kPosInfinity) - strmOut << "--> "; - else - ptman->LogInTable(strmOut, m_prgisloutBefore[ichw]); - } - strmOut <<"\n"; - - for (int ix = 1; ix < signed(cassocs) - 1; ix++) //(cassocs > 2) - { - if (ix == 1) - strmOut << "other "; - else - strmOut << " "; - for (ichw = 0; ichw < (m_ichwAssocsLim - m_ichwAssocsMin); ichw++) - { - std::vector * pvislout = m_prgpvisloutAssocs[ichw]; - if (pvislout == NULL) - strmOut << " "; - else if (signed(pvislout->size()) <= ix) - strmOut << " "; - else if ((*pvislout)[ix] != m_prgisloutAfter[ichw]) - ptman->LogInTable(strmOut, (*pvislout)[ix]); - else - strmOut << " "; - } - strmOut << "\n"; - } - - strmOut << "after "; - for (ichw = 0; ichw < (m_ichwAssocsLim - m_ichwAssocsMin); ichw++) - { - if (rgcchwRaw[ichw] > 1) - // continuation of Unicode codepoint - strmOut << " "; - else if (m_prgisloutAfter[ichw] == kNegInfinity) - strmOut << "<-- "; - else if (m_prgisloutAfter[ichw] == kPosInfinity) - strmOut << "--> "; - else - ptman->LogInTable(strmOut, m_prgisloutAfter[ichw]); - } - strmOut <<"\n"; - - if (fLigs) - { - strmOut << "ligature "; - for (ichw = 0; ichw < (m_ichwAssocsLim - m_ichwAssocsMin); ichw++) - { - if (rgcchwRaw[ichw] > 1) - // continuation of Unicode codepoint - strmOut << " "; - else if (m_prgisloutLigature[ichw] != kNegInfinity) - ptman->LogInTable(strmOut, m_prgisloutLigature[ichw]); - else - strmOut << " "; - } - strmOut << "\n"; - - strmOut << "component "; - for (ichw = 0; ichw < (m_ichwAssocsLim - m_ichwAssocsMin); ichw++) - { - if (rgcchwRaw[ichw] > 1) - // continuation of Unicode codepoint - strmOut << " "; - else if (m_prgisloutLigature[ichw] != kNegInfinity) - ptman->LogInTable(strmOut, m_prgiComponent[ichw] + 1); // 1-based - else - strmOut << " "; - } - strmOut << "\n"; - } - - strmOut << "\n"; -#endif -} - -/*---------------------------------------------------------------------------------------------- - Write out the final surface-to-underlying associations. -----------------------------------------------------------------------------------------------*/ -void Segment::LogSurfaceToUnderlying(GrTableManager * ptman, std::ostream & strmOut) -{ -#ifdef TRACING - strmOut << "\nSURFACE TO UNDERLYING MAPPINGS\n\n"; - - ptman->LogSlotHeader(strmOut, m_cslout, SP_PER_SLOT, LEADING_SP); - - int ccomp = 0; - - strmOut << "Glyph IDs: "; - int islout; - for (islout = 0; islout < m_cslout; islout++) - { - GrSlotOutput * psloutTmp = m_prgslout + islout; - if (psloutTmp->SpecialSlotFlag() == kspslLbInitial || - psloutTmp->SpecialSlotFlag() == kspslLbFinal) - { - strmOut << "# "; - } - else - { - ptman->LogHexInTable(strmOut, psloutTmp->GlyphID()); - ccomp = max(ccomp, psloutTmp->NumberOfComponents()); - } - } - strmOut << "\n"; - - bool fAnyPseudos = false; - for (islout = 0; islout < m_cslout; islout++) - { - GrSlotOutput * psloutTmp = m_prgslout + islout; - if (psloutTmp->GlyphID() != psloutTmp->ActualGlyphForOutput(ptman)) - { - fAnyPseudos = true; - break; - } - } - if (fAnyPseudos) - { - strmOut << "Actual glyphs: "; - for (int islout = 0; islout < m_cslout; islout++) - { - GrSlotOutput * psloutTmp = m_prgslout + islout; - if (psloutTmp->GlyphID() != psloutTmp->ActualGlyphForOutput(ptman)) - ptman->LogHexInTable(strmOut, psloutTmp->ActualGlyphForOutput(ptman)); - else - strmOut << " "; - } - strmOut << "\n"; - } - - strmOut << "before "; - for (islout = 0; islout < m_cslout; islout++) - { - GrSlotOutput * psloutTmp = m_prgslout + islout; - if (psloutTmp->SpecialSlotFlag() == kspslLbInitial || - psloutTmp->SpecialSlotFlag() == kspslLbFinal) - { - strmOut << " "; - } - else - ptman->LogInTable(strmOut, psloutTmp->BeforeAssoc()); - } - strmOut << "\n"; - - strmOut << "after "; - for (islout = 0; islout < m_cslout; islout++) - { - GrSlotOutput * psloutTmp = m_prgslout + islout; - if (psloutTmp->SpecialSlotFlag() == kspslLbInitial || - psloutTmp->SpecialSlotFlag() == kspslLbFinal) - { - strmOut << " "; - } - else - ptman->LogInTable(strmOut, psloutTmp->AfterAssoc()); - } - strmOut << "\n"; - - for (int icomp = 0; icomp < ccomp; icomp++) - { - strmOut << "component " << icomp + 1 // 1=based - << " "; - for (islout = 0; islout < m_cslout; islout++) - { - GrSlotOutput * psloutTmp = m_prgslout + islout; - if (psloutTmp->SpecialSlotFlag() == kspslLbInitial || - psloutTmp->SpecialSlotFlag() == kspslLbFinal) - { - strmOut << " "; - } - else if (icomp < psloutTmp->NumberOfComponents()) - { - if (psloutTmp->FirstUnderlyingComponent(icomp) - != psloutTmp->LastUnderlyingComponent(icomp)) // $$$$$ - { - // Multiple characters represented by this component. - char rgch[10]; - std::string strTmp; - sprintf(rgch, "%d", psloutTmp->FirstUnderlyingComponent(icomp)); - strTmp += rgch; - memset(rgch, 0, 10); - sprintf(rgch, "%d", psloutTmp->LastUnderlyingComponent(icomp)); - strTmp += "/"; - strTmp += rgch; - if (strlen(strTmp.c_str()) > SP_PER_SLOT-1) - strmOut << "****** "; - else - { - while (strlen(strTmp.c_str()) < SP_PER_SLOT) // pad with spaces - strTmp += " "; - strmOut << strTmp; - } - } - else - ptman->LogInTable(strmOut, psloutTmp->FirstUnderlyingComponent(icomp)); // $$$$$ - } - else - strmOut << " "; - } - strmOut << "\n"; - } -#endif -} - -#ifdef TRACING -/*---------------------------------------------------------------------------------------------- - Write out the header lines for the underlying data. -----------------------------------------------------------------------------------------------*/ -void GrTableManager::LogUnderlyingHeader(std::ostream & strmOut, int iMin, - int iLim, int cBackup, int * prgichr) -{ - strmOut << "string "; - int i, iLabel; - int * pichr = prgichr; - for (i = iMin - cBackup, iLabel = i; i < iLim; i++, iLabel++, pichr++) - { - while (prgichr && *pichr > 1) - { - // continuation of upper-plane char - iLabel++; - pichr++; - } - LogInTable(strmOut, iLabel); - } - strmOut << "\n"; - - strmOut << "segment "; - pichr = prgichr; - for (i = 0 - cBackup, iLabel = i; i < (iLim - iMin); i++, iLabel++, pichr++) - { - while (prgichr && *pichr > 1) - { - // continuation of upper-plane char - iLabel++; - pichr++; - } - LogInTable(strmOut, iLabel); - } - strmOut << "\n\n"; -} - -/*---------------------------------------------------------------------------------------------- - Write out the header lines for the slot contents. -----------------------------------------------------------------------------------------------*/ -void GrTableManager::LogSlotHeader(std::ostream & strmOut, int islotLim, - int cspPerSlot, int cspLeading, int islotMin) -{ - islotLim = min(islotLim, MAX_SLOTS); - - int isp, islot; - - for (isp = 0; isp < cspLeading; isp++) - strmOut << " "; - - for (islot = islotMin; islot < islotLim; islot++) - LogInTable(strmOut, islot); - strmOut << "\n\n"; - -/**** - if (cslot >= 100) - { - for (isp = 0; isp < cspLeading; isp++) - strmOut << " "; - - for (islot = 0; islot < 100; islot++) - { - for (isp = 0; isp < cspPerSlot; isp++) - strmOut << " "; - } - - for (islot = 100; islot < cslot; islot++) - { - strmOut << "1"; - for (isp = 1; isp < cspPerSlot; isp++) - strmOut << " "; - } - } - - if (cslot > 10) - { - for (isp = 0; isp < cspLeading; isp++) - strmOut << " "; - - for (islot = 0; islot < 10; islot++) - { - for (isp = 0; isp < cspPerSlot; isp++) - strmOut << " "; - } - - for (islot = 10; islot < cslot; islot++) - { - if (true) // (islot % 10 == 0) - { - if (islot >= 100) - strmOut << ((islot - 100) / 10); - else - strmOut << (islot / 10); - } - else - strmOut << " "; - - for (isp = 1; isp < cspPerSlot; isp++) - strmOut << " "; - } - strmOut << "\n"; - } - - for (isp = 0; isp < cspLeading; isp++) - strmOut << " "; - - for (islot = 0; islot < cslot; islot++) - { - strmOut << (islot % 10); - for (isp = 1; isp < cspPerSlot; isp++) - strmOut << " "; - - } - strmOut << "\n"; -****/ -} - -/*---------------------------------------------------------------------------------------------- - Write out the glyph numbers for the given stream. -----------------------------------------------------------------------------------------------*/ -void GrTableManager::LogSlotGlyphs(std::ostream & strmOut, GrSlotStream * psstrm) -{ - strmOut << "Glyph IDs: "; - int islot; - for (islot = 0; islot < psstrm->WritePos(); islot++) - { - GrSlotState * pslotTmp = psstrm->SlotAt(islot); - if (pslotTmp->IsLineBreak(LBGlyphID())) - strmOut << "# "; - else - LogHexInTable(strmOut, pslotTmp->GlyphID()); - } - strmOut << "\n"; -} - -/*---------------------------------------------------------------------------------------------- - Return flags indicating which attributes were modified for some slot during the pass - and therefore need a line in the log file. - - The 'pfMods' array has one flag per slot attribute; the final group are the user- - definable attributes. 'pccomp' returns the maximum number of ligature components - in this pass. Associations are assumed to have changed if anything else for the slot did. -----------------------------------------------------------------------------------------------*/ -void GrTableManager::SlotAttrsModified(int ipass, bool * rgfMods, bool fPreJust, - int * pccomp, int * pcassoc) -{ - // Zero the flags - std::fill_n(rgfMods, kslatMax + NumUserDefn() - 1, false); - *pccomp = 0; - *pcassoc = 0; - - //GrSlotStream * psstrmIn = InputStream(ipass); - GrSlotStream * psstrmOut = OutputStream(ipass); - - for (int islot = 0; islot < psstrmOut->WritePos(); islot++) - { - GrSlotState * pslot = psstrmOut->SlotAt(islot); - Assert(pslot->PassModified() <= ipass); - if (pslot->PassModified() < ipass && !fPreJust) - continue; // not modified during this pass - - pslot->SlotAttrsModified(rgfMods, fPreJust, pccomp, pcassoc); - } -} - -void GrSlotState::SlotAttrsModified(bool * rgfMods, bool fPreJust, int * pccomp, int * pcassoc) -{ - // To handle reprocessing, in which case there may be a chain of slots modified - // in the same pass: - GrSlotState * pslotPrev = m_pslotPrevState; - while (pslotPrev && pslotPrev->PassModified() == PassModified()) - pslotPrev = pslotPrev->m_pslotPrevState; - - if (!pslotPrev) - { - // Inserted slot? - if (m_fAdvXSet) - rgfMods[kslatAdvX] = true; - if (m_fAdvYSet) - rgfMods[kslatAdvY] = true; - - if (m_srAttachTo != 0) - rgfMods[kslatAttTo] = true; - - if (m_mAttachAtX != kNotYetSet || m_mAttachAtY != 0) - { // always do these in pairs - rgfMods[kslatAttAtX] = true; - rgfMods[kslatAttAtY] = true; - } - if (m_nAttachAtGpoint != kNotYetSet) - rgfMods[kslatAttAtGpt] = true; - if (m_mAttachAtXOffset != 0 || m_mAttachAtYOffset != 0) - { // always do these in pairs - rgfMods[kslatAttAtXoff] = true; - rgfMods[kslatAttAtYoff] = true; - } - - if (m_mAttachWithX != kNotYetSet || m_mAttachWithY != 0) - { // always do these in pairs - rgfMods[kslatAttWithX] = true; - rgfMods[kslatAttWithY] = true; - } - if (m_nAttachWithGpoint != kNotYetSet) - rgfMods[kslatAttWithGpt] = true; - if (m_mAttachWithXOffset != 0 || m_mAttachWithYOffset != 0) - { // always do these in pairs - rgfMods[kslatAttWithXoff] = true; - rgfMods[kslatAttWithYoff] = true; - } - - if (m_nAttachLevel != 0) - rgfMods[kslatAttLevel] = true; - - if (m_lb != kNotYetSet8) - rgfMods[kslatBreak] = true; - if (m_dirc != kNotYetSet8) - rgfMods[kslatDir] = true; - if (m_fInsertBefore != true) - rgfMods[kslatInsert] = true; - - if (m_mMeasureSol != kNotYetSet && m_mMeasureSol != 0) - rgfMods[kslatMeasureSol] = true; - if (m_mMeasureEol != kNotYetSet && m_mMeasureEol != 0) - rgfMods[kslatMeasureEol] = true; - - if (m_mJStretch0 != kNotYetSet && m_mJStretch0 != 0) - rgfMods[kslatJStretch] = true; - if (m_mJShrink0 != kNotYetSet && m_mJShrink0 != 0) - rgfMods[kslatJShrink] = true; - if (m_mJStep0 != kNotYetSet && m_mJStep0 != 0) - rgfMods[kslatJStep] = true; - if (m_nJWeight0 != byte(kNotYetSet) && - m_nJWeight0 != 0 && m_nJWeight0 != 1) - rgfMods[kslatJWeight] = true; - if (m_mJWidth0 != kNotYetSet && m_mJWidth0 != 0) - rgfMods[kslatJWidth] = true; - - if (m_mShiftX != 0) - rgfMods[kslatShiftX] = true; - if (m_mShiftY != 0) - rgfMods[kslatShiftY] = true; - - int i; - for (i = 0; i < m_cnCompPerLig; i++) - { - if (CompRef(i) != NULL) - rgfMods[kslatCompRef] = true; - if (CompRef(i)) - *pccomp = max(*pccomp, i + 1); // max number of ligatures in this pass - } - - for (i = 0; i < m_cnUserDefn; i++) - { - if (UserDefn(i) != 0) - rgfMods[kslatUserDefn + i] = true; - } - } - else - { - if (m_fAdvXSet && m_mAdvanceX != pslotPrev->m_mAdvanceX) - rgfMods[kslatAdvX] = true; - if (m_fAdvYSet && m_mAdvanceY != pslotPrev->m_mAdvanceY) - rgfMods[kslatAdvY] = true; - - if (m_srAttachTo != pslotPrev->m_srAttachTo) - rgfMods[kslatAttTo] = true; - - if (m_mAttachAtX != pslotPrev->m_mAttachAtX || m_mAttachAtY != pslotPrev->m_mAttachAtY) - { - rgfMods[kslatAttAtX] = true; - rgfMods[kslatAttAtY] = true; - } - if (m_nAttachAtGpoint != pslotPrev->m_nAttachAtGpoint) - rgfMods[kslatAttAtGpt] = true; - if (m_mAttachAtXOffset != pslotPrev->m_mAttachAtXOffset || - m_mAttachAtYOffset != pslotPrev->m_mAttachAtYOffset) - { - rgfMods[kslatAttAtXoff] = true; - rgfMods[kslatAttAtYoff] = true; - } - - if (m_mAttachWithX != pslotPrev->m_mAttachWithX || - m_mAttachWithY != pslotPrev->m_mAttachWithY) - { - rgfMods[kslatAttWithX] = true; - rgfMods[kslatAttWithY] = true; - } - if (m_nAttachWithGpoint != pslotPrev->m_nAttachWithGpoint) - rgfMods[kslatAttWithGpt] = true; - if (m_mAttachWithXOffset != pslotPrev->m_mAttachWithXOffset || - m_mAttachWithYOffset != pslotPrev->m_mAttachWithYOffset) - { - rgfMods[kslatAttWithXoff] = true; - rgfMods[kslatAttWithYoff] = true; - } - - if (m_nAttachLevel != pslotPrev->m_nAttachLevel) - rgfMods[kslatAttLevel] = true; - - if (m_lb != pslotPrev->m_lb) - rgfMods[kslatBreak] = true; - if (m_dirc != pslotPrev->m_dirc) - rgfMods[kslatDir] = true; - if (m_fInsertBefore != pslotPrev->m_fInsertBefore) - rgfMods[kslatInsert] = true; - - if (m_mMeasureSol != pslotPrev->m_mMeasureSol) - rgfMods[kslatMeasureSol] = true; - if (m_mMeasureEol != pslotPrev->m_mMeasureEol) - rgfMods[kslatMeasureEol] = true; - - if (m_mJStretch0 != pslotPrev->m_mJStretch0 || (fPreJust && m_mJStretch0 != 0)) - rgfMods[kslatJStretch] = true; - if (m_mJShrink0 != pslotPrev->m_mJShrink0 || (fPreJust && m_mJShrink0 != 0)) - rgfMods[kslatJShrink] = true; - if (m_mJStep0 != pslotPrev->m_mJStep0 || (fPreJust && m_mJStep0 != 0)) - rgfMods[kslatJStep] = true; - if (m_nJWeight0 != pslotPrev->m_nJWeight0 || (fPreJust && m_nJWeight0 != 0)) - rgfMods[kslatJWeight] = true; - if (m_mJWidth0 != pslotPrev->m_mJWidth0) - rgfMods[kslatJWidth] = true; - - if (m_mShiftX != pslotPrev->m_mShiftX) - rgfMods[kslatShiftX] = true; - if (m_mShiftY != pslotPrev->m_mShiftY) - rgfMods[kslatShiftY] = true; - - int i; - for (i = 0; i < m_cnCompPerLig; i++) - { - if (CompRef(i) != pslotPrev->CompRef(i)) - rgfMods[kslatCompRef] = true; - if (CompRef(i)) - *pccomp = max(*pccomp, i + 1); // max number of ligatures in this pass - } - - for (i = 0; i < m_cnUserDefn; i++) - { - if (UserDefn(i) != pslotPrev->UserDefn(i)) - rgfMods[kslatUserDefn + i] = true; - } - } - - *pcassoc = max(*pcassoc, AssocsSize()); -} - -/*---------------------------------------------------------------------------------------------- - Log the value of the slot attribute for the given slot, if it changed. -----------------------------------------------------------------------------------------------*/ -void GrSlotState::LogSlotAttribute(GrTableManager * ptman, - std::ostream & strmOut, int ipass, int slat, int iIndex, - bool fPreJust, bool fPostJust) -{ - if (m_ipassModified != ipass && !fPreJust && !fPostJust) - { - strmOut << " "; - return; - } - - // To handle reprocessing, in which case there may be a chain of slots modified - // in the same pass: - GrSlotState * pslotPrev = m_pslotPrevState; - while (pslotPrev && pslotPrev->PassModified() == PassModified()) - pslotPrev = pslotPrev->m_pslotPrevState; - - // General-purpose variables for em-unit attributes: - int mThis = 0; - int mPrev = 0; - switch (slat) - { - case kslatShiftX: - mThis = m_mShiftX; - mPrev = (pslotPrev) ? pslotPrev->m_mShiftX : 0; - break; - case kslatShiftY: - mThis = m_mShiftY; - mPrev = (pslotPrev) ? pslotPrev->m_mShiftY : 0; - break; - case kslatMeasureSol: - mThis = m_mMeasureSol; - mPrev = (pslotPrev) ? pslotPrev->m_mMeasureSol : 0; - break; - case kslatMeasureEol: - mThis = m_mMeasureEol; - mPrev = (pslotPrev) ? pslotPrev->m_mMeasureEol : 0; - break; - case kslatJStretch: - mThis = m_mJStretch0; - mPrev = (pslotPrev) ? pslotPrev->m_mJStretch0 : 0; - mPrev = (fPreJust && mThis > 0) ? -1 : mPrev; // log it even if it didn't change - break; - case kslatJShrink: - mThis = m_mJShrink0; - mPrev = (pslotPrev) ? pslotPrev->m_mJShrink0 : 0; - mPrev = (fPreJust && mThis > 0) ? -1 : mPrev; // log it even if it didn't change - break; - case kslatJStep: - mThis = m_mJStep0; - mPrev = (pslotPrev) ? pslotPrev->m_mJStep0 : 0; - mPrev = (fPreJust && mThis > 1) ? -1 : mPrev; // log it even if it didn't change - break; - case kslatJWeight: - mThis = m_nJWeight0; - mPrev = (pslotPrev) ? pslotPrev->m_nJWeight0 : 0; - mPrev = (fPreJust && mThis > 1) ? -1 : mPrev; // log it even if it didn't change - break; - case kslatJWidth: - mThis = m_mJWidth0; - mPrev = (pslotPrev) ? pslotPrev->m_mJWidth0 : 0; - mPrev = (fPostJust && mThis > 0) ? -1 : mPrev; // log it even if it didn't change - break; - default: - // don't use these variables - break; - } - - switch (slat) - { - case kslatAdvX: - if (m_fAdvXSet && (!pslotPrev || m_mAdvanceX != pslotPrev->m_mAdvanceX)) - { - ptman->LogInTable(strmOut, m_mAdvanceX); - return; - } - break; - case kslatAdvY: - if (m_fAdvYSet && (!pslotPrev || m_mAdvanceY != pslotPrev->m_mAdvanceY)) - { - ptman->LogInTable(strmOut, m_mAdvanceY); - return; - } - break; - - case kslatAttTo: - if (m_srAttachTo != (pslotPrev ? pslotPrev->m_srAttachTo : 0)) - { - ptman->LogInTable(strmOut, m_srAttachTo); - return; - } - break; - - case kslatAttAtX: // always do these in pairs - case kslatAttAtY: - if (m_mAttachAtX != (pslotPrev ? pslotPrev->m_mAttachAtX : kNotYetSet) || - m_mAttachAtY != (pslotPrev ? pslotPrev->m_mAttachAtY : 0)) - { - ptman->LogInTable(strmOut, - ((slat == kslatAttAtX) ? m_mAttachAtX : m_mAttachAtY)); - return; - } - break; - case kslatAttAtGpt: - if (m_nAttachAtGpoint != (pslotPrev ? pslotPrev->m_nAttachAtGpoint : kNotYetSet)) - { - ptman->LogInTable(strmOut, - ((m_nAttachAtGpoint == kGpointZero) ? 0 : m_nAttachAtGpoint)); - return; - } - break; - case kslatAttAtXoff: // always do these in pairs - case kslatAttAtYoff: - if (m_mAttachAtXOffset != (pslotPrev ? pslotPrev->m_mAttachAtXOffset : 0) || - m_mAttachAtYOffset != (pslotPrev ? pslotPrev->m_mAttachAtYOffset : 0)) - { - ptman->LogInTable(strmOut, - ((slat == kslatAttAtXoff) ? m_mAttachAtXOffset : m_mAttachAtYOffset)); - return; - } - break; - - case kslatAttWithX: // always do these in pairs - case kslatAttWithY: - if (m_mAttachWithX != (pslotPrev ? pslotPrev->m_mAttachWithX : kNotYetSet) || - m_mAttachWithY != (pslotPrev ? pslotPrev->m_mAttachWithY : 0)) - { - ptman->LogInTable(strmOut, - ((slat == kslatAttWithX) ? m_mAttachWithX : m_mAttachWithY)); - return; - } - break; - case kslatAttWithGpt: - if (m_nAttachWithGpoint != (pslotPrev ? pslotPrev->m_nAttachWithGpoint : kNotYetSet)) - { - ptman->LogInTable(strmOut, - ((m_nAttachWithGpoint == kGpointZero) ? 0 : m_nAttachWithGpoint)); - return; - } - break; - case kslatAttWithXoff: // always do these in pairs - case kslatAttWithYoff: - if (m_mAttachWithXOffset != (pslotPrev ? pslotPrev->m_mAttachWithXOffset : 0) || - m_mAttachWithYOffset != (pslotPrev ? pslotPrev->m_mAttachWithYOffset : 0)) - { - ptman->LogInTable(strmOut, - ((slat == kslatAttWithXoff) ? m_mAttachWithXOffset : m_mAttachWithYOffset)); - return; - } - break; - - case kslatAttLevel: - if (m_nAttachLevel != (pslotPrev ? pslotPrev->m_nAttachLevel : 0)) - { - ptman->LogInTable(strmOut, m_nAttachLevel); - return; - } - break; - - case kslatBreak: - if (m_lb != (pslotPrev ? pslotPrev->m_lb : kNotYetSet8)) - { - ptman->LogBreakWeightInTable(strmOut, m_lb); - return; - } - break; - case kslatDir: - if (m_dirc != (pslotPrev ? pslotPrev->m_dirc : kNotYetSet8)) - { - ptman->LogDirCodeInTable(strmOut, m_dirc); - return; - } - break; - case kslatInsert: - if (m_fInsertBefore != (pslotPrev ? pslotPrev->m_fInsertBefore : true)) - { - if (m_fInsertBefore) - strmOut << "true "; - else - strmOut << "false "; - return; - } - break; - - case kslatJWeight: - if (m_mJStretch0 == 0 && m_mJShrink0 == 0) - mPrev = mThis; // don't log; weight is irrelevant - // fall through - case kslatShiftX: - case kslatShiftY: - case kslatMeasureSol: - case kslatMeasureEol: - case kslatJStretch: - case kslatJShrink: - case kslatJStep: - case kslatJWidth: - if (mThis != mPrev) - { - ptman->LogInTable(strmOut, mThis); - return; - } - break; - - case kslatCompRef: - if (CompRef(iIndex) != (pslotPrev ? pslotPrev->CompRef(iIndex) : 0)) - { - GrSlotState * pslotComp = reinterpret_cast(CompRef(iIndex)); - ptman->LogInTable(strmOut, pslotComp->m_islotTmpIn); - return; - } - break; - - default: - if (kslatUserDefn <= slat && slat <= kslatUserDefn + m_cnUserDefn) - { - int iTmp = slat - kslatUserDefn; - if (UserDefn(iTmp) != (pslotPrev ? pslotPrev->UserDefn(iTmp) : 0)) - { - ptman->LogInTable(strmOut, UserDefn(iTmp)); - return; - } - } - else - gAssert(false); - } - - strmOut << " "; -} - -/*---------------------------------------------------------------------------------------------- - Log the value of the association, if the slot changed. -----------------------------------------------------------------------------------------------*/ -void GrSlotState::LogAssociation(GrTableManager * ptman, - std::ostream & strmOut, int ipass, int iassoc, bool fBoth, bool fAfter) -{ - if (m_ipassModified != ipass) - { - strmOut << " "; - return; - } - - if (fBoth) - { - GrSlotState * pslotBefore = (m_vpslotAssoc.size()) ? m_vpslotAssoc[0] : NULL; - GrSlotState * pslotAfter = (m_vpslotAssoc.size()) ? m_vpslotAssoc.back() : NULL; - // handle possible reprocessing - while (pslotBefore && pslotBefore->PassModified() == m_ipassModified) - pslotBefore = pslotBefore->m_pslotPrevState; - while (pslotAfter && pslotAfter->PassModified() == m_ipassModified) - pslotAfter = pslotAfter->m_pslotPrevState; - - int nBefore, nAfter; - - - int csp = 4; - if (pslotBefore) - { - nBefore = pslotBefore->m_islotTmpIn; - strmOut << nBefore; - if (nBefore > 99) csp--; - if (nBefore > 9) csp--; - } - else - { - strmOut << "??"; - csp--; - } - if (pslotAfter) - { - nAfter = pslotAfter->m_islotTmpIn; - strmOut << "/" << nAfter; - if (nAfter > 99) csp--; - if (nAfter > 9) csp--; - } - else - { - if (pslotBefore) - { - strmOut << "/" << "??"; - csp--; - } - else - csp = 5; - } - - for (int isp = 0; isp < csp; isp++) - strmOut << " "; - } - - else if (fAfter) - { - Assert(m_vpslotAssoc.size()); - GrSlotState * pslotAfter = m_vpslotAssoc.back(); - // handle possible reprocessing - while (pslotAfter && pslotAfter->PassModified() == m_ipassModified) - pslotAfter = pslotAfter->m_pslotPrevState; - - if (pslotAfter) - { - int nAfter = pslotAfter->m_islotTmpIn; - ptman->LogInTable(strmOut, nAfter); - } - else - strmOut << "?? "; - } - else if (iassoc < signed(m_vpslotAssoc.size())) - { - GrSlotState * pslot = m_vpslotAssoc[iassoc]; - // handle possible reprocessing - while (pslot && pslot->PassModified() == m_ipassModified) - pslot = pslot->m_pslotPrevState; - - if (pslot) - { - int n = pslot->m_islotTmpIn; - ptman->LogInTable(strmOut, n); - } - else - strmOut << "?? "; - } - else - strmOut << " "; -} - -/*---------------------------------------------------------------------------------------------- - Write a hex value (a glyphID or Unicode codepoint) into the table. -----------------------------------------------------------------------------------------------*/ -void GrTableManager::LogInTable(std::ostream & strmOut, int n) -{ - if (n == kNegInfinity) - { - strmOut << "-inf "; - return; - } - if (n == kPosInfinity) - { - strmOut << "+inf "; - return; - } - if (n > 999999) - { - strmOut << "****** "; - return; - } - if (n < -99999) - { - strmOut << "-***** "; - return; - } - - strmOut << n; - int csp = SP_PER_SLOT - 1; - - if (abs(n) > 99999) csp--; - if (abs(n) > 9999) csp--; - if (abs(n) > 999) csp--; - if (abs(n) > 99) csp--; - if (abs(n) > 9) csp--; - - if (n < 0) csp--; - - for (int isp = 0; isp < csp; isp++) - strmOut << " "; -} - -void GrTableManager::LogInTable(std::ostream & strmOut, float n) -{ - if (n == kNegInfFloat) - { - strmOut << "-inf "; - return; - } - if (n == kPosInfFloat) - { - strmOut << "+inf "; - return; - } - if (n > 9999) - { - strmOut << "****.* "; - return; - } - if (n < -999) - { - strmOut << "-***.* "; - return; - } - - int csp = SP_PER_SLOT - 4; - - int nInt = (int)(fabsf(n)); - int nTenths = (int)fabsf((fabsf(n) - float(nInt) + 0.05f) * 10); - if (nTenths >= 10) - { - nTenths = 0; - nInt++; - } - - if (nInt >= 1000) csp--; - if (nInt >= 100) csp--; - if (nInt >= 10) csp--; - - if (n < 0) csp--; - - for (int isp = 0; isp < csp; isp++) - strmOut << " "; - if (n < 0) - strmOut << "-"; - strmOut << nInt << "." << nTenths << " "; -} - -/*---------------------------------------------------------------------------------------------- - Write a hex value (a glyphID or Unicode codepoint) into the table. -----------------------------------------------------------------------------------------------*/ -void GrTableManager::LogHexInTable(std::ostream & strmOut, utf16 chw, bool fPlus) -{ - //char rgch[20]; - if (chw <= 0x0fff) strmOut << "0"; - if (chw <= 0x00ff) strmOut << "0"; - if (chw <= 0x000f) strmOut << "0"; - - strmOut << std::hex << chw << std::dec; - - for (int i = 4; i < SP_PER_SLOT - 2; i++) - strmOut << " "; - - if (fPlus) - strmOut << "+ "; - else - strmOut << " "; -} - -/*---------------------------------------------------------------------------------------------- - Write a directionality code to the table. -----------------------------------------------------------------------------------------------*/ -void GrTableManager::LogDirCodeInTable(std::ostream & strmOut, int dirc) -{ - switch (dirc) - { - case kdircUnknown: strmOut << "??? "; break; - case kdircNeutral: strmOut << "ON "; break; - case kdircL: strmOut << "L "; break; - case kdircR: strmOut << "R "; break; - case kdircRArab: strmOut << "AR "; break; - case kdircEuroNum: strmOut << "EN "; break; - case kdircEuroSep: strmOut << "ES "; break; - case kdircEuroTerm: strmOut << "ET "; break; - case kdircArabNum: strmOut << "AN "; break; - case kdircComSep: strmOut << "CS "; break; - case kdircWhiteSpace: strmOut << "WS "; break; - case kdircBndNeutral: strmOut << "BN "; break; - case kdircNSM: strmOut << "NSM "; break; - case kdircLRO: strmOut << "LRO "; break; - case kdircRLO: strmOut << "RLO "; break; - case kdircLRE: strmOut << "LRE "; break; - case kdircRLE: strmOut << "RLE "; break; - case kdircPDF: strmOut << "PDF "; break; - case kdircPdfL: strmOut << "PDF-L "; break; - case kdircPdfR: strmOut << "PDF-R "; break; - case kdircLlb: strmOut << "L "; break; - case kdircRlb: strmOut << "R "; break; - default: LogInTable(strmOut, dirc); break; - } -} - -/*---------------------------------------------------------------------------------------------- - Write a breakweight code to the table. -----------------------------------------------------------------------------------------------*/ -void GrTableManager::LogBreakWeightInTable(std::ostream & strmOut, int lb) -{ - if (lb < 0) - { - lb = lb * -1; - switch (lb) - { - case klbWsBreak: strmOut << "-ws "; break; - case klbWordBreak: strmOut << "-word "; break; - case klbHyphenBreak: strmOut << "-intra "; break; - case klbLetterBreak: strmOut << "-lettr "; break; - case klbClipBreak: strmOut << "-clip "; break; - default: LogInTable(strmOut, lb); break; - } - } - else - { - switch (lb) - { - case klbNoBreak: strmOut << "none "; break; - case klbWsBreak: strmOut << "ws "; break; - case klbWordBreak: strmOut << "word "; break; - case klbHyphenBreak: strmOut << "intra "; break; - case klbLetterBreak: strmOut << "letter "; break; - case klbClipBreak: strmOut << "clip "; break; - default: LogInTable(strmOut, lb); break; - } - } -} - -#endif // TRACING - -} // namespace gr diff --git a/Build/source/libs/graphite/engine-2.3.1/src/segment/resource.h b/Build/source/libs/graphite/engine-2.3.1/src/segment/resource.h deleted file mode 100644 index 775418f76bf..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/src/segment/resource.h +++ /dev/null @@ -1,15 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by Graphite.rc -// - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 101 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1000 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/Build/source/libs/graphite/engine-2.3.1/test/Makefile.am b/Build/source/libs/graphite/engine-2.3.1/test/Makefile.am deleted file mode 100644 index 96570ad125a..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/test/Makefile.am +++ /dev/null @@ -1,2 +0,0 @@ -SUBDIRS = ProfileHarness RegressionTest -EXTRA_DIST = fonterrors diff --git a/Build/source/libs/graphite/engine-2.3.1/test/Makefile.in b/Build/source/libs/graphite/engine-2.3.1/test/Makefile.in deleted file mode 100644 index 053f36594b4..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/test/Makefile.in +++ /dev/null @@ -1,490 +0,0 @@ -# Makefile.in generated by automake 1.10.1 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -subdir = test -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_CLEAN_FILES = -SOURCES = -DIST_SOURCES = -RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ - html-recursive info-recursive install-data-recursive \ - install-dvi-recursive install-exec-recursive \ - install-html-recursive install-info-recursive \ - install-pdf-recursive install-ps-recursive install-recursive \ - installcheck-recursive installdirs-recursive pdf-recursive \ - ps-recursive uninstall-recursive -RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ - distclean-recursive maintainer-clean-recursive -ETAGS = etags -CTAGS = ctags -DIST_SUBDIRS = $(SUBDIRS) -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -GREP = @GREP@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LSB_RELEASE = @LSB_RELEASE@ -LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ -MAKEINFO = @MAKEINFO@ -MKDIR_P = @MKDIR_P@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -RANLIB = @RANLIB@ -REL_CODENAME = @REL_CODENAME@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SIZEOF_WCHAR_T = @SIZEOF_WCHAR_T@ -STRIP = @STRIP@ -VERSION = @VERSION@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -SUBDIRS = ProfileHarness RegressionTest -EXTRA_DIST = fonterrors -all: all-recursive - -.SUFFIXES: -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign test/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --foreign test/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -# This directory's subdirectories are mostly independent; you can cd -# into them and run `make' without going through this Makefile. -# To change the values of `make' variables: instead of editing Makefiles, -# (1) if the variable is set in `config.status', edit `config.status' -# (which will cause the Makefiles to be regenerated when you run `make'); -# (2) otherwise, pass the desired values on the `make' command line. -$(RECURSIVE_TARGETS): - @failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - target=`echo $@ | sed s/-recursive//`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - dot_seen=yes; \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done; \ - if test "$$dot_seen" = "no"; then \ - $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ - fi; test -z "$$fail" - -$(RECURSIVE_CLEAN_TARGETS): - @failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - rev=''; for subdir in $$list; do \ - if test "$$subdir" = "."; then :; else \ - rev="$$subdir $$rev"; \ - fi; \ - done; \ - rev="$$rev ."; \ - target=`echo $@ | sed s/-recursive//`; \ - for subdir in $$rev; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done && test -z "$$fail" -tags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ - done -ctags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ - done - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ - include_option=--etags-include; \ - empty_fix=.; \ - else \ - include_option=--include; \ - empty_fix=; \ - fi; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test ! -f $$subdir/TAGS || \ - tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ - fi; \ - done; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done - list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test -d "$(distdir)/$$subdir" \ - || $(MKDIR_P) "$(distdir)/$$subdir" \ - || exit 1; \ - distdir=`$(am__cd) $(distdir) && pwd`; \ - top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ - (cd $$subdir && \ - $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$$top_distdir" \ - distdir="$$distdir/$$subdir" \ - am__remove_distdir=: \ - am__skip_length_check=: \ - distdir) \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-recursive -all-am: Makefile -installdirs: installdirs-recursive -installdirs-am: -install: install-recursive -install-exec: install-exec-recursive -install-data: install-data-recursive -uninstall: uninstall-recursive - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-recursive -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-recursive - -clean-am: clean-generic clean-libtool mostlyclean-am - -distclean: distclean-recursive - -rm -f Makefile -distclean-am: clean-am distclean-generic distclean-tags - -dvi: dvi-recursive - -dvi-am: - -html: html-recursive - -info: info-recursive - -info-am: - -install-data-am: - -install-dvi: install-dvi-recursive - -install-exec-am: - -install-html: install-html-recursive - -install-info: install-info-recursive - -install-man: - -install-pdf: install-pdf-recursive - -install-ps: install-ps-recursive - -installcheck-am: - -maintainer-clean: maintainer-clean-recursive - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-recursive - -mostlyclean-am: mostlyclean-generic mostlyclean-libtool - -pdf: pdf-recursive - -pdf-am: - -ps: ps-recursive - -ps-am: - -uninstall-am: - -.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \ - install-strip - -.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ - all all-am check check-am clean clean-generic clean-libtool \ - ctags ctags-recursive distclean distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-strip installcheck \ - installcheck-am installdirs installdirs-am maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-generic \ - mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ - uninstall uninstall-am - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/Build/source/libs/graphite/engine-2.3.1/test/ProfileHarness/GrUtfTextSrc.cpp b/Build/source/libs/graphite/engine-2.3.1/test/ProfileHarness/GrUtfTextSrc.cpp deleted file mode 100644 index 30bfac34a9f..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/test/ProfileHarness/GrUtfTextSrc.cpp +++ /dev/null @@ -1,310 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: NPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Netscape Public License - * Version 1.1 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is sila.mozdev.org code. - * - * The Initial Developer of the Original Code is - * Keith Stribley. - * Portions created by the Initial Developer are Copyright (C) 2004 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the NPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the NPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "GrUtfTextSrc.h" - - - -GrUtfTextSrc::GrUtfTextSrc() -: mLength(0), - mBufferLength8(64), mBufferLength16(64), mBufferLength32(64), - mData8(NULL), mData16(NULL), mData32(NULL), - mType(gr::kutf16), - mForeground(gr::kclrBlack), mBackground(gr::kclrTransparent), - mSelectForeground(0), mSelectBackground(0), - mIsSelected(false), - mFont(NULL), - mRtl(false) -{ - -} - -GrUtfTextSrc::~GrUtfTextSrc() -{ - if (mData8) delete [] mData8; - if (mData16) delete [] mData16; - if (mData32) delete [] mData32; - mSelectionVector.clear(); -} - -bool GrUtfTextSrc::setText(const char * pszText, int len) -{ - return setText((gr::utf8*)pszText, len); -} - -bool GrUtfTextSrc::setText(const gr::utf8 * pszText, int len) -{ - mType = gr::kutf8; - mLength = len; - if (!checkBuffer8()) return false; - - for(size_t i = 0; i < mLength; i++) - { - mData8[i] = pszText[i]; - // stray line feeds and other control characters from the html file - // cause artificial truncation of segments - if (mData8[i] < 0x0020)//(pszText[i] == '\n' || pszText[i] == '\r') - mData8[i] = 0x20; // ZWSP - } - mData8[mLength] = '\0'; // zero-terminate - mSelectionVector.clear(); - mIsSelected = false; - return true; -} - - -bool GrUtfTextSrc::setText(const gr::utf16 * pszText, int len) -{ - mType = gr::kutf16; - mLength = len; - if (!checkBuffer16()) return false; - - for(size_t i = 0; i < mLength; i++) - { - mData16[i] = pszText[i]; - // stray line feeds and other control characters from the html file - // cause artificial truncation of segments - if (mData16[i] < 0x0020)//(pszText[i] == '\n' || pszText[i] == '\r') - mData16[i] = 0x200B; // ZWSP - } - mData16[mLength] = '\0'; // zero-terminate - mSelectionVector.clear(); - mIsSelected = false; - return true; -} - -bool GrUtfTextSrc::setText(const gr::utf32 * pszText, int len) -{ - mType = gr::kutf32; - mLength = len; - if (!checkBuffer32()) return false; - - for(size_t i = 0; i < mLength; i++) - { - mData32[i] = pszText[i]; - } - mData32[mLength] = '\0'; // zero-terminate - mSelectionVector.clear(); - mIsSelected = false; - return true; -} - -bool GrUtfTextSrc::checkBuffer8(void) -{ - if (!mData8 || mBufferLength8 < mLength + 1) - { - do - { - mBufferLength8 *= 2; - } while (mBufferLength8 < mLength + 1); - if (mData8) delete [] mData8; - mData8 = new gr::utf8[mBufferLength8]; - } - return (mData8) ? true : false; -} - -bool GrUtfTextSrc::checkBuffer16(void) -{ - if (!mData16 || mBufferLength16 < mLength + 1) - { - do - { - mBufferLength16 *= 2; - } while (mBufferLength16 < mLength + 1); - if (mData16) delete [] mData16; - mData16 = new gr::utf16[mBufferLength16]; - } - return (mData16) ? true : false; -} - -bool GrUtfTextSrc::checkBuffer32(void) -{ - if (!mData32 || mBufferLength32 < mLength + 1) - { - do - { - mBufferLength32 *= 2; - } while (mBufferLength32 < mLength + 1); - if (mData32) delete [] mData32; - mData32 = new gr::utf32[mBufferLength32]; - } - return (mData32) ? true : false; -} - -size_t GrUtfTextSrc::fetch(gr::toffset ichMin, size_t cch, gr::utf8 * prgchwBuffer) -{ - assert(cch <= mLength); - if (cch > mLength) - { - return 0; - } - std::copy(mData8 + ichMin, mData8 + ichMin + cch, prgchwBuffer); - return (cch - ichMin); -} - -size_t GrUtfTextSrc::fetch(gr::toffset ichMin, size_t cch, gr::utf16 * prgchwBuffer) -{ - assert(cch <= mLength); - if (cch > mLength) - { - return 0; - } - std::copy(mData16 + ichMin, mData16 + ichMin + cch, prgchwBuffer); - return (cch - ichMin); -} - -size_t GrUtfTextSrc::fetch(gr::toffset ichMin, size_t cch, gr::utf32 * prgchwBuffer) -{ - assert(cch <= mLength); - if (cch > mLength) - { - return 0; - } - std::copy(mData32 + ichMin, mData32 + ichMin + cch, prgchwBuffer); - return (cch - ichMin); -} - - -bool GrUtfTextSrc::getRightToLeft(gr::toffset ich) -{ - return mRtl; // assumes src only contains one direction -} - -unsigned int GrUtfTextSrc::getDirectionDepth(gr::toffset ich) -{ - return (mRtl) ? 1 : 0; // TBD -} - -std::pair GrUtfTextSrc::propertyRange(gr::toffset ich) -{ - std::pair range(0, mLength); - if (mIsSelected) - { - bool selectState = mSelectionVector[ich]; - // find start - int s = ich - 1; - int e = ich + 1; - if (s > -1) - for ( ; s >= 0; s--) - { - if (mSelectionVector[s] != selectState) - { - s++; // backup - break; - } - } - if (s < 0) s = 0; - // find end - for ( ; e < static_cast(mLength); e++) - { - if (mSelectionVector[e] != selectState) - { - // don't need to backup for end - break; - } - } - range.first = s; - range.second = e; - } - return range; -} - -size_t GrUtfTextSrc::getFontFeatures(gr::toffset ich, gr::FeatureSetting * prgfset) -{ - return 0; -} - -void GrUtfTextSrc::getColors(gr::toffset ich, int * pclrFore, int * pclrBack) -{ - // selections are handled here - if (mIsSelected && mSelectionVector[ich]) - { - *pclrFore = mSelectForeground; - *pclrBack = mSelectBackground; - } - else - { - *pclrFore = mForeground; - *pclrBack = mBackground; - } -} - - -// these should be called I hope -float -GrUtfTextSrc::getFontSize(gr::toffset ich) -{ - assert(mFont); - return mPointSize; -} - -bool -GrUtfTextSrc::getBold(gr::toffset ich) -{ - assert(mFont); -// NS_ASSERTION(false, "unexpected call to getBold"); -// return false; - return mFont->bold(); -} - -bool -GrUtfTextSrc::getItalic(gr::toffset ich) -{ - assert(mFont); - //NS_ASSERTION(false, "unexpected call to getItalic"); - //return false; - return mFont->italic(); -} - -gr::isocode GrUtfTextSrc::getLanguage(gr::toffset ich) -{ - gr::isocode unknown; - std::fill_n(unknown.rgch, 4, '\0'); - return unknown; -} - diff --git a/Build/source/libs/graphite/engine-2.3.1/test/ProfileHarness/GrUtfTextSrc.h b/Build/source/libs/graphite/engine-2.3.1/test/ProfileHarness/GrUtfTextSrc.h deleted file mode 100644 index cae0a4850b5..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/test/ProfileHarness/GrUtfTextSrc.h +++ /dev/null @@ -1,146 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: NPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Netscape Public License - * Version 1.1 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is sila.mozdev.org code. - * - * The Initial Developer of the Original Code is - * Keith Stribley. - * Portions created by the Initial Developer are Copyright (C) 2004 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the NPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the NPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ -#ifdef _MSC_VER -#pragma once -#endif -#ifndef GRUTFTXTSRC_INCLUDED -#define GRUTFTXTSRC_INCLUDED - -#include -#include - -#include -#include -#include - -class nsIGrSegWrapper; - -/*----------------------------------------------------------------------------- - Class: ITextSource - This class provides an interface of a text source for the Graphite engine. -------------------------------------------------------------------------------*/ -class GrUtfTextSrc : public gr::IColorTextSource -{ -public: - GrUtfTextSrc(); - ~GrUtfTextSrc(); - bool setText(const gr::utf8 * pszText, int len); - bool setText(const char * pszText, int len); - bool setText(const gr::utf16 * pszText, int len); - bool setText(const gr::utf32 * pszText, int len); - void setColors(int foreground, int background) - { - mForeground = foreground; - mBackground = background; - }; - //void setSelectionDetails(nsIGrSegWrapper * wrapper); - void setFont(gr::Font * font) { mFont = font; }; - void setPointSize(float & pointSize) { mPointSize = pointSize; }; - // -------------------------------------------------------------------------- - // New V2 interface: - - virtual gr::UtfType utfEncodingForm() { return mType; }; - virtual size_t getLength() { return mLength; }; - virtual size_t fetch(gr::toffset ichMin, size_t cch, gr::utf32 * prgchBuffer); - virtual size_t fetch(gr::toffset ichMin, size_t cch, gr::utf16 * prgchwBuffer); - virtual size_t fetch(gr::toffset ichMin, size_t cch, gr::utf8 * prgchsBuffer); - virtual gr::GrResult getFaceName(int ich, unsigned int cchMax, - gr::utf16 * prgchFaceName, unsigned int * pcchLen) - { - prgchFaceName[0] = 0; - *pcchLen = 0; - return gr::kresNotImpl; - }; - //virtual std::wstring getFaceName(int ich) { return mFont->getFaceName(); }; - virtual float getFontSize(gr::toffset ich); - virtual bool getBold(gr::toffset ich); - virtual bool getItalic(gr::toffset ich); - virtual bool getRightToLeft(gr::toffset ich); - virtual unsigned int getDirectionDepth(gr::toffset ich); - virtual float getVerticalOffset(gr::toffset ich) { return 0;}; - virtual gr::isocode getLanguage(gr::toffset ich); - - virtual std::pair propertyRange(gr::toffset ich); - virtual size_t getFontFeatures(gr::toffset ich, gr::FeatureSetting * prgfset); - virtual bool sameSegment(gr::toffset ich1, gr::toffset ich2) { return true; }; - -protected: - bool checkBuffer8(); - bool checkBuffer16(); - bool checkBuffer32(); - -private: - size_t mLength; - size_t mBufferLength8; - size_t mBufferLength16; - size_t mBufferLength32; - gr::utf8 * mData8; - gr::utf16 * mData16; - gr::utf32 * mData32; - gr::UtfType mType; - int mForeground; - int mBackground; - int mSelectForeground; - int mSelectBackground; - bool mIsSelected; - std::wstring mFaceName; - std::vector mSelectionVector; - gr::Font * mFont; - bool mRtl; - float mPointSize; - -public: // methods that will go - // Temporary--eventually these will be of interest only to SegmentPainter. - virtual void getColors(gr::toffset ich, int * pclrFore, int * pclrBack); - - // Shouldn't be here! - virtual gr::GrResult Fetch(int ichMin, int ichLim, gr::utf16 * prgchBuf) { return gr::kresNotImpl; }; - virtual gr::GrResult get_Length(int * pcch) { return gr::kresNotImpl; }; - virtual gr::GrResult GetFontVariations(int ich, - wchar_t * prgchFontVar, int ichMax, int * pich, - int * pichMin, int * pichLim) { return gr::kresNotImpl; }; - -}; - - -#if !defined(GR_NAMESPACE) -using namespace gr; -#endif - -#endif // !GRUTFTXTSRC_INCLUDED - diff --git a/Build/source/libs/graphite/engine-2.3.1/test/ProfileHarness/Makefile.am b/Build/source/libs/graphite/engine-2.3.1/test/ProfileHarness/Makefile.am deleted file mode 100644 index 07d07348eff..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/test/ProfileHarness/Makefile.am +++ /dev/null @@ -1,14 +0,0 @@ -AUTOMAKE_OPTIONS = 1.6 - -noinst_PROGRAMS = profile-graphite - -AM_CPPFLAGS = -I$(top_srcdir)/include - -profile_graphite_LDFLAGS = -L$(top_builddir)/src -lgraphite - -profile_graphite_SOURCES = \ - GrUtfTextSrc.cpp GrUtfTextSrc.h \ - ProfileHarness.cpp - -#dist-hook: -# rm -f grregtest.log tracelog.txt diff --git a/Build/source/libs/graphite/engine-2.3.1/test/ProfileHarness/Makefile.in b/Build/source/libs/graphite/engine-2.3.1/test/ProfileHarness/Makefile.in deleted file mode 100644 index 778e839eecb..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/test/ProfileHarness/Makefile.in +++ /dev/null @@ -1,462 +0,0 @@ -# Makefile.in generated by automake 1.10.1 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -noinst_PROGRAMS = profile-graphite$(EXEEXT) -subdir = test/ProfileHarness -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_CLEAN_FILES = -PROGRAMS = $(noinst_PROGRAMS) -am_profile_graphite_OBJECTS = GrUtfTextSrc.$(OBJEXT) \ - ProfileHarness.$(OBJEXT) -profile_graphite_OBJECTS = $(am_profile_graphite_OBJECTS) -profile_graphite_LDADD = $(LDADD) -profile_graphite_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ - $(CXXFLAGS) $(profile_graphite_LDFLAGS) $(LDFLAGS) -o $@ -DEFAULT_INCLUDES = -I.@am__isrc@ -depcomp = $(SHELL) $(top_srcdir)/config/depcomp -am__depfiles_maybe = depfiles -CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -CXXLD = $(CXX) -CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ - $(LDFLAGS) -o $@ -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ - $(LDFLAGS) -o $@ -SOURCES = $(profile_graphite_SOURCES) -DIST_SOURCES = $(profile_graphite_SOURCES) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -GREP = @GREP@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LSB_RELEASE = @LSB_RELEASE@ -LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ -MAKEINFO = @MAKEINFO@ -MKDIR_P = @MKDIR_P@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -RANLIB = @RANLIB@ -REL_CODENAME = @REL_CODENAME@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SIZEOF_WCHAR_T = @SIZEOF_WCHAR_T@ -STRIP = @STRIP@ -VERSION = @VERSION@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -AUTOMAKE_OPTIONS = 1.6 -AM_CPPFLAGS = -I$(top_srcdir)/include -profile_graphite_LDFLAGS = -L$(top_builddir)/src -lgraphite -profile_graphite_SOURCES = \ - GrUtfTextSrc.cpp GrUtfTextSrc.h \ - ProfileHarness.cpp - -all: all-am - -.SUFFIXES: -.SUFFIXES: .cpp .lo .o .obj -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign test/ProfileHarness/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --foreign test/ProfileHarness/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -clean-noinstPROGRAMS: - @list='$(noinst_PROGRAMS)'; for p in $$list; do \ - f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f $$p $$f"; \ - rm -f $$p $$f ; \ - done -profile-graphite$(EXEEXT): $(profile_graphite_OBJECTS) $(profile_graphite_DEPENDENCIES) - @rm -f profile-graphite$(EXEEXT) - $(profile_graphite_LINK) $(profile_graphite_OBJECTS) $(profile_graphite_LDADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GrUtfTextSrc.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ProfileHarness.Po@am__quote@ - -.cpp.o: -@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< - -.cpp.obj: -@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` - -.cpp.lo: -@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(PROGRAMS) -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ - mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: - -install-dvi: install-dvi-am - -install-exec-am: - -install-html: install-html-am - -install-info: install-info-am - -install-man: - -install-pdf: install-pdf-am - -install-ps: install-ps-am - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: - -.MAKE: install-am install-strip - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstPROGRAMS ctags distclean \ - distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am install-man \ - install-pdf install-pdf-am install-ps install-ps-am \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags uninstall uninstall-am - - -#dist-hook: -# rm -f grregtest.log tracelog.txt -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/Build/source/libs/graphite/engine-2.3.1/test/ProfileHarness/ProfileHarness.cpp b/Build/source/libs/graphite/engine-2.3.1/test/ProfileHarness/ProfileHarness.cpp deleted file mode 100644 index 361d6a6b734..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/test/ProfileHarness/ProfileHarness.cpp +++ /dev/null @@ -1,476 +0,0 @@ -/*----------------------------------------------------------------------------- -Copyright (C) 2007 SIL International - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: -Responsibility: Sharon Correll -Last reviewed: Not yet. - -Description: -A simple console app that creates a segment using FileFont and dumps a -diagnostic table of the resulting glyph vector to the console. -If graphite has been built with -DTRACING then it will also produce a -diagnostic log of the segment creation in grSegmentLog.txt ------------------------------------------------------------------------------*/ - -//#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -///#include -#include -#include -#include -#include -#include -#include - -#include "GrUtfTextSrc.h" - -typedef std::pair< gr::GlyphIterator, gr::GlyphIterator > GlyphRange; - -#ifndef HAVE_STRTOF -float strtof(char * text, char ** ignore) -{ - return static_cast(atof(text)); -} -#endif - -#ifndef HAVE_STRTOL -long strtol(char * text, char ** ignore) -{ - return atol(text); -} -#endif - -struct Parameters -{ - const char * textFile; - const char * fontFile; - float pointSize; - int dpi; - bool lineStart; - bool lineEnd; - bool useLineFill; - bool useCodes; - float width; - int textArgIndex; - gr::utf16 * pText16; - gr::utf32 * pText32; - size_t charLength; - size_t offset; -}; - -#ifdef HAVE_ICONV -void -convertUtf8ToUtf32(char* pText, Parameters & parameters) -{ - int length = strlen(reinterpret_cast(pText)); - //gr::utf8 * pText = reinterpret_cast(argv[2]); - // convert text to utf32 using iconv because its easier to debug string placements - size_t bytesLeft = length; - size_t outBytesLeft = (length + 1) * sizeof(gr::utf32); - size_t outBufferSize = outBytesLeft; - gr::utf32 * text32 = new gr::utf32[length + 1]; - iconv_t utf8to32 = iconv_open("utf32","utf8"); - assert(utf8to32 != (iconv_t)(-1)); - char * pText32 = reinterpret_cast(&text32[0]); - size_t convertLength = iconv(utf8to32, &pText, &bytesLeft, &pText32, &outBytesLeft); - if (convertLength == size_t(-1)) perror("iconv failed:"); - size_t charLength = (outBufferSize - outBytesLeft) / sizeof(gr::utf32); - assert(convertLength != size_t(-1)); - // size_t offset = 0; - // offset by 1 to avoid bom - if (text32[0] == 0xfeff) - { - parameters.offset = 1; - charLength--; - } - std::cout << "String has " << charLength << " characters (" << length << " bytes)" << std::endl; - size_t ci; - for (ci = 0; ci < 10 && ci < charLength; ci++) - { - std::cout << std::setw(4) << ci << '\t'; - } - std::cout << std::endl; - for (ci = 0; ci < charLength; ci++) - { - std::cout << std::setw(4) << std::hex - << text32[ci+parameters.offset] << '\t'; - if (((ci + 1) % 10) == 0) std::cout << std::endl; - } - std::cout << std::endl; - parameters.charLength = charLength; - parameters.pText32 = text32; - iconv_close(utf8to32); -} -#endif - -bool parseArgs(int argc, char *argv[], Parameters & parameters) -{ - int mainArgOffset = 0; - bool argError = false; - char* pText = NULL; - typedef enum - { - NONE, - POINT_SIZE, - DPI, - LINE_START, - LINE_END, - LINE_FILL, - CODES - } TestOptions; - TestOptions option = NONE; - char * pIntEnd = NULL; - char * pFloatEnd = NULL; - long lTestSize = 0; - float fTestSize = 0.0f; - for (int a = 1; a < argc; a++) - { - switch (option) - { - case DPI: - pIntEnd = NULL; - lTestSize = strtol(argv[a],&pIntEnd, 10); - if (lTestSize > 0 && lTestSize < INT_MAX && lTestSize != LONG_MAX) - { - parameters.dpi = lTestSize; - } - else - { - fprintf(stderr,"Invalid dpi %s\n", argv[a]); - } - option = NONE; - break; - case POINT_SIZE: - pFloatEnd = NULL; - fTestSize = strtof(argv[a],&pFloatEnd); - // what is a reasonable maximum here - if (fTestSize > 0 && fTestSize < 5000.0f) - { - parameters.pointSize = fTestSize; - } - else - { - fprintf(stderr,"Invalid point size %s\n", argv[a]); - argError = true; - } - option = NONE; - break; - case LINE_FILL: - pFloatEnd = NULL; - fTestSize = strtof(argv[a],&pFloatEnd); - // what is a good max width? - if (fTestSize > 0 && fTestSize < 10000) - { - parameters.width = fTestSize; - } - else - { - fprintf(stderr,"Invalid line width %s\n", argv[a]); - argError = true; - } - option = NONE; - break; - default: - option = NONE; - if (argv[a][0] == '-') - { - if (strcmp(argv[a], "-pt") == 0) - { - option = POINT_SIZE; - } - else if (strcmp(argv[a], "-dpi") == 0) - { - option = DPI; - } - else if (strcmp(argv[a], "-ls") == 0) - { - option = NONE; - parameters.lineStart = true; - } - else if (strcmp(argv[a], "-le") == 0) - { - option = NONE; - parameters.lineEnd = true; - } - else if (strcmp(argv[a], "-linefill") == 0) - { - option = LINE_FILL; - parameters.useLineFill = true; - } - else if (strcmp(argv[a], "-codes") == 0) - { - option = NONE; - parameters.useCodes = true; - // must be less than argc - parameters.pText32 = new gr::utf32[argc]; - printf("\nText codes\n"); - } - else - { - argError = true; - fprintf(stderr,"Unknown option %s\n",argv[a]); - } - } - else if (mainArgOffset == 0) - { - parameters.textFile = argv[a]; - mainArgOffset++; - } - else if (mainArgOffset == 1) - { - parameters.fontFile = argv[a]; - mainArgOffset++; - } - else if (parameters.useCodes) - { - pIntEnd = NULL; - mainArgOffset++; - gr::utf32 code = strtol(argv[a],&pIntEnd, 16); - if (code > 0) - { - parameters.pText32[parameters.charLength++] = code; - if (parameters.charLength % 10 == 0) - printf("%4x\n",code); - else - printf("%4x\t",code); - } - else - { - fprintf(stderr,"Invalid dpi %s\n", argv[a]); - } - } - else if (mainArgOffset == 1) - { - mainArgOffset++; - pText = argv[a]; - parameters.textArgIndex = a; - } - else - { - argError = true; - fprintf(stderr,"too many arguments %s\n",argv[a]); - } - } - } - if (mainArgOffset < 2) argError = true; - else - { - if (!parameters.useCodes && pText != NULL) - { -#ifdef HAVE_ICONV - convertUtf8ToUtf32(pText, parameters); -#else - fprintf(stderr,"Only the -codes option is supported on Win32\r\n"); - argError = true; -#endif - } - else - { - ///parameters.pText32[parameters.charLength] = 0; - printf("\n"); - } - } - return (argError) ? false : true; -} - - -void initParameters(Parameters & parameters) -{ - parameters.textFile = ""; - parameters.fontFile = ""; - parameters.pointSize = 12.0f; - parameters.dpi = 72; - parameters.lineStart = false; - parameters.lineEnd = false; - parameters.useLineFill = false; - parameters.useCodes = false; - parameters.width = 100.0f; - parameters.pText16 = NULL; - parameters.pText32 = NULL; - parameters.textArgIndex = 0; - parameters.charLength = 0; - parameters.offset = 0; -} - - - -int runGraphite(Parameters parameters) -{ - int returnCode = 0; - FILE * file = fopen(parameters.fontFile, "rb"); - gr::FileFont * fileFont = NULL; - - // Put the text into an array of string, each string is one paragraph. - std::ifstream textFileStrm(parameters.textFile); - std::cout << "FILE: " << parameters.textFile << "\n"; - std::string stringArray[100]; - - std::stringbuf buf; - textFileStrm >> &buf; - std::cout << "read " << buf.str().length() << " characters" << std::endl; - std::cout << "====BEGIN===" << buf.str() << "====END====" << std::endl; - const std::string strTemp = buf.str(); - stringArray[0] = strTemp; - int cpara = 1; - - try - { - if (file) - { - fileFont = new gr::FileFont(file, parameters.pointSize, parameters.dpi); - if (!fileFont || !fileFont->isValid()) - { - fprintf(stderr,"graphitejni:Invalid font!"); - delete fileFont; - fileFont = NULL; - return 2; - } - printf("Font: %s bold=%d italic=%d %4.1fpt dpi %d\n", - parameters.fontFile, - fileFont->bold(), fileFont->italic(), - parameters.pointSize, parameters.dpi); - bool isGraphite = fileFont->fontHasGraphiteTables(); - if (!isGraphite) - { - fprintf(stderr,"graphitejni: %s does not have graphite tables", - parameters.fontFile); - delete fileFont; - fileFont = NULL; - return 3; - } - } - else - { - fprintf(stderr, "Failed to open %s\n", parameters.fontFile); - return 4; - } - - for (int ipara = 0; ipara < cpara; ipara++) - { - GrUtfTextSrc textSrc; - gr::LayoutEnvironment layout; - - textSrc.setText(stringArray[ipara].data(), stringArray[ipara].length()); - textSrc.setPointSize(parameters.pointSize); - textSrc.setFont(fileFont); - - layout.setStartOfLine(parameters.lineStart); - layout.setEndOfLine(parameters.lineEnd); - layout.setDumbFallback(true); - layout.setJustifier(NULL); - - gr::Segment * pSegment = NULL; - //try - //{ - if (parameters.useLineFill) - { - pSegment = new gr::LineFillSegment(fileFont, &textSrc, &layout, - 0, stringArray[ipara].length(), - parameters.width); - printf("LineFillSegment overing char %d - %d\nline start=%d line end=%d\n", - pSegment->startCharacter(), pSegment->stopCharacter(), - parameters.lineStart, parameters.lineEnd); - } - else - { - pSegment = new gr::RangeSegment(fileFont, &textSrc, &layout, - 0, stringArray[ipara].length()); - printf("RangeSegment covering char %d - %d\nline start=%d line end=%d\n", - pSegment->startCharacter(), pSegment->stopCharacter(), - parameters.lineStart, parameters.lineEnd); - } - //} - //catch (...) - //{ - // printf("Exception occurred while creating segment\n"); - // returnCode = 5; - // throw; - //} - - if (!pSegment) return returnCode; - - // for justifier testing - /* - gr::GrJustifier justifier; - pSegment->SetJustifier(&justifier); - gr::Segment * justified = gr::Segment::JustifiedSegment(*pSegment, 2.0f * advanceWidth); - delete justified; - */ - - delete pSegment; - } - } - catch (...) - { - printf("Exception occurred\n"); - returnCode = 5; - } - - delete fileFont; - - return returnCode; -} - -#ifdef WIN32 - -int _tmain(int argc, _TCHAR* argv[]) -{ - Parameters parameters; - initParameters(parameters); - - if (!parseArgs(argc, argv, parameters)) - { - fprintf(stderr,"Usage: %s [options] textfile fontfile \n",argv[0]); - return 1; - } - // UTF16 arguments - //if (parameters.textArgIndex > 0) - //{ - // parameters.pText16 = reinterpret_cast(argv[parameters.textArgIndex]); - // std::wstring text(parameters.pText16); - // parameters.charLength = text.size(); - // for (int i = 0; i < text.size(); i++) - // { - // if (i % 10 == 0) - // printf("\r\n%4x", text[i]); - // else - // printf("\t%4x", text[i]); - // } - //} - //else - //{ - // assert(parameters.pText32); - //} - - return runGraphite(parameters); -} - -#else - -int main(int argc, char *argv[]) -{ - - Parameters parameters; - initParameters(parameters); - - if (!parseArgs(argc, argv, parameters)) - { - fprintf(stderr,"Usage: %s [options] textfile fontfile \n",argv[0]); - return 1; - } - return runGraphite(parameters); -} - -#endif diff --git a/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/GrJustifier.cpp b/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/GrJustifier.cpp deleted file mode 100644 index 566811c9907..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/GrJustifier.cpp +++ /dev/null @@ -1,566 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 2003 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: GrJustifier.cpp -Responsibility: Sharon Correll -Last reviewed: Not yet. - -Description: - A default justification agent for Graphite. --------------------------------------------------------------------------------*//*:End Ignore*/ - -//:>******************************************************************************************** -//:> Include files -//:>******************************************************************************************** -//#include "main.h" // This is used by clients, so main.h is not available - -#pragma hdrstop -// any other headers (not precompiled) -#include "GrClient.h" -#include "ITextSource.h" -#include "IGrJustifier.h" -#include "GraphiteProcess.h" -#include "GrDebug.h" - -#include "GrJustifier.h" - -#ifdef WIN32 -#include -#endif - -#undef THIS_FILE -DEFINE_THIS_FILE - -//:>******************************************************************************************** -//:> Global constants -//:>******************************************************************************************** - -const int g_cnPrimes = 7; -static const int g_rgnPrimes[] = -{ - 2, 3, 5, 7, 11, 13, 17, // these primes will allow a range of weights up to 255 - // 19, 23, 31, 37, 41, 43, 47, 53, 59, 61 -}; - -//:>******************************************************************************************** -//:> Forward declarations -//:>******************************************************************************************** - -//:>******************************************************************************************** -//:> Methods -//:>******************************************************************************************** - -/*---------------------------------------------------------------------------------------------- - Constructors. -----------------------------------------------------------------------------------------------*/ -GrJustifier::GrJustifier() -{ - m_cref = 1; // COM-like behavior -} - - -/*---------------------------------------------------------------------------------------------- - Destructor. -----------------------------------------------------------------------------------------------*/ -GrJustifier::~GrJustifier() -{ -} - -/*---------------------------------------------------------------------------------------------- - Determine how to adjust the widths of the glyphs to get a justified effect. - Return kresFalse if we can't achieve the desired width. -----------------------------------------------------------------------------------------------*/ -gr::GrResult GrJustifier::adjustGlyphWidths(gr::GraphiteProcess * pgje, - int iGlyphMin, int iGlyphLim, - float dxCurrentWidthArg, float dxDesiredWidthArg) -{ - if (dxCurrentWidthArg == dxDesiredWidthArg) - return gr::kresOk; // no stretch needed - - int dxCurrentWidth = (int)dxCurrentWidthArg; - int dxDesiredWidth = (int)dxDesiredWidthArg; - - bool fShrinking = (dxDesiredWidth < dxCurrentWidth); - - // First, get the relevant values for each glyph out of the Graphite engine. - - int dxsStretchAvail = 0; - std::vector viGlyphs; - std::vector vdxStretchLeft; - std::vector vdxStep; - std::vector vnWeight; - std::vector vdxWidth; - std::vector vdxStretchOrig; - bool fStep = false; - int nMaxWt = 1; - int cUnits = 0; // glyph-weight units - int cStretchable = 0; - for (int iGlyph = iGlyphMin; iGlyph < iGlyphLim; iGlyph++) - { - int dx; - pgje->getGlyphAttribute(iGlyph, - (fShrinking ? gr::kjgatShrink : gr::kjgatStretch), 1, &dx); - if (dx > 0) - { - int dxStep = 0; - pgje->getGlyphAttribute(iGlyph, gr::kjgatStep, 1, &dxStep); - if (fShrinking) - dxStep = (dxStep > 0) ? 0 : dxStep; // step is applicable if it is negative - else // stretching - dxStep = (dxStep < 0) ? 0 : dxStep; // step is applicable if it is positive - if (dxStep != 0) - { - // Get the actual number of steps allowed. This is more accurate than - // trying to calculate it, due to rounding when converting between - // font units and pixels. - int cSteps; - pgje->getGlyphAttribute(iGlyph, gr::kjgatStretchInSteps, 1, &cSteps); - dx = abs(dxStep * cSteps); - fStep = true; - } - dxStep = abs(dxStep); - - int nWt; - pgje->getGlyphAttribute(iGlyph, gr::kjgatWeight, 1, &nWt); - nWt = max(nWt, 0); - nMaxWt = max(nMaxWt, nWt); - - viGlyphs.push_back(iGlyph); - vdxStretchLeft.push_back(dx); - vdxStep.push_back(dxStep); - vnWeight.push_back(nWt); - vdxWidth.push_back(0); - vdxStretchOrig.push_back(dx); - - dxsStretchAvail += dx; - cUnits += nWt; - cStretchable++; - } - } - - int dxStretchNeeded = dxDesiredWidth - dxCurrentWidth; - if (fShrinking) - dxStretchNeeded *= -1; // always a positive number - int dxStretchAchieved = 0; - bool fIgnoreStepGlyphs = false; - int iiGlyph; - std::vector vnMFactor; - - if (viGlyphs.size() > 0) - { - - // The way weights are handled is the following: we calculate the least common multiple - // of all the weights, and then scale each stretch value accordingly before distributing - // widths. In other words, we put the stretch values into an alternate "common" scaled - // system based on the LCM. "cUnits" represents the total number of stretch-units - // available, where each glyph contributes a number of units equal to its weight. - // To get into this scaled system, small-weight stretches are scaled by a large amount - // and large-weight stretches are scaled by a small amount. After assigning the width, - // we do the reverse scaling on that width. Since large-weight stretches are scaled - // back by less, this results in more width being assigned to glyphs with a large weight. - - int nLcm = 1; - if (nMaxWt > 1) - nLcm = Lcm(vnWeight, vnMFactor); - else - { - vnMFactor.push_back(1); // weight 0 - bogus - vnMFactor.push_back(1); // weight 1 - } - - // Loop over the glyphs until we have assigned all the available space. (If a small amount - // is left over it will be distributed using a special method.) - -LMainLoop: - - int dxStretchStillNeeded = dxStretchNeeded - dxStretchAchieved; - int dxNonStepMore = 0; - int dxNonStepLess = 0; - while (cUnits > 0 && dxStretchStillNeeded >= cStretchable) - // && dxStretchStillNeeded * nLcm >= cUnits) - { - // This is the scaled stretch per glyph, that is, in the scaled system of the LCM. - int dxwStretchPerGlyph = dxStretchStillNeeded * nLcm / cUnits; - - // Recalculate these for the next round: - cUnits = 0; - cStretchable = 0; - - for (iiGlyph = 0; iiGlyph < (signed)viGlyphs.size(); iiGlyph++) - { - if (vdxStep[iiGlyph] > 0 && fIgnoreStepGlyphs) - continue; // leave step-glyphs as they are - - int nWt = vnWeight[iiGlyph]; - int dxwThis = vdxStretchLeft[iiGlyph] * vnMFactor[nWt]; // weighted stretch - dxwThis = min(dxwStretchPerGlyph, dxwThis); - int dxThis = dxwThis / vnMFactor[nWt]; // scale back to unweighted stretch - vdxWidth[iiGlyph] += dxThis; - dxStretchAchieved += dxThis; - vdxStretchLeft[iiGlyph] -= dxThis; - if (vdxStretchLeft[iiGlyph] > 0) - { - cUnits += nWt; // can do some more on the next round - cStretchable++; - } - - // Keep track of how much we could adjust in either direction - // on the second round to handle steps. - if (vdxStep[iiGlyph] == 0) - { - dxNonStepMore += vdxStretchOrig[iiGlyph] - vdxWidth[iiGlyph]; - dxNonStepLess += vdxWidth[iiGlyph]; - } - } - dxStretchStillNeeded = dxStretchNeeded - dxStretchAchieved; - } - - Assert(dxStretchAchieved <= dxStretchNeeded); - - // Make adjustments so that the step values are honored. - - if (fStep // there are some step-glyphs - && !fIgnoreStepGlyphs) // and we didn't already do this - { - // First make some basic adjustments, alternating making more and fewer steps - // and see how much that buys us. - int dxAdjusted = 0; - int cNonStepUnits = 0; - int cStretchableNonStep = 0; - bool fReloop = false; - for (iiGlyph = 0; iiGlyph < (signed)viGlyphs.size(); iiGlyph++) - { - if (vdxStep[iiGlyph] > 1) - { - int dxRem = vdxWidth[iiGlyph] % vdxStep[iiGlyph]; - int dxFewer = vdxWidth[iiGlyph] - dxRem; // round down - int dxMore = dxFewer + vdxStep[iiGlyph]; // round up - int dxAdd = dxMore - vdxWidth[iiGlyph]; - if (dxRem == 0) - { // Step is okay; no adjustment needed. - } - else if ( - // this glyph has stretch available to make more steps: - (dxMore <= vdxStretchOrig[iiGlyph]) - // and we need at least this much extra: - && (dxAdd + dxStretchAchieved <= dxStretchNeeded) - // and we still have enough slack in the non-step-glyphs: - && (dxNonStepLess - dxAdjusted - dxAdd > 0) - // and we don't have to adjust much to get to the next step - // (we're 75% of the way there): - && ((dxRem > ((vdxStep[iiGlyph] * 3) << 2)) - // or this glyph has a high weight: - || (vnWeight[iiGlyph] > (nMaxWt >> 2)) - // or we've removed a fair amount already: - || (dxAdjusted < (dxAdd * -2)) - // or we don't have enough slack to remove more: - || (dxNonStepMore + dxAdjusted - dxRem < 0))) - { - // Use the next larger number of steps. - vdxWidth[iiGlyph] += dxAdd; - dxStretchAchieved += dxAdd; - dxAdjusted += dxAdd; - fReloop = true; - } - else - { - // Use the next smaller number of steps. - vdxWidth[iiGlyph] -= dxRem; - dxStretchAchieved -= dxRem; - dxAdjusted -= dxRem; - fReloop = true; - } - } - else if (vdxStep[iiGlyph] == 0) - { - cNonStepUnits += vnWeight[iiGlyph]; - cStretchableNonStep++; - } - } - - if (cNonStepUnits < cUnits || cStretchableNonStep < cStretchable) - { - // Even if no step-glyphs need to be adjusted, there is a different number - // of (non-step) glyphs to divide the space over. (The first time through - // there may not have been enough space per glyph to run the main loop, - // but now there may be.) - fReloop = true; - } - - // Any left over adjustments need to be made by adjusting the items with - // step = 1 (ie, the glyphs that allow fine-grained adjustments). - // Do the main loop again, but only adjust the non-step glyphs. - if (fReloop) - { - cUnits = cNonStepUnits; - cStretchable = cStretchableNonStep; - fIgnoreStepGlyphs = true; - goto LMainLoop; - } - } - - // Divide up any remainder that is due to rounding errors. - - int dxRemainder = dxStretchNeeded - dxStretchAchieved; - if (0 < dxRemainder && dxRemainder < cStretchable) - { - if (cStretchable < (signed)viGlyphs.size() || fStep) - { - // Make sub-lists using the glyphs that are still stretchable. - std::vector vdxStretchRem; - std::vector vdxWidthRem; - std::vector viiGlyphsRem; - for (iiGlyph = 0; iiGlyph < (signed)viGlyphs.size(); iiGlyph++) - { - if (vdxStretchLeft[iiGlyph] > 0 && vdxStep[iiGlyph] == 0) - { - viiGlyphsRem.push_back(iiGlyph); - vdxStretchRem.push_back(vdxStretchLeft[iiGlyph]); - vdxWidthRem.push_back(vdxWidth[iiGlyph]); - } - } - Assert(viiGlyphsRem.size() == size_t(cStretchable)); - DistributeRemainder(vdxWidthRem, vdxStretchRem, dxRemainder, 0, vdxWidthRem.size(), - &dxStretchAchieved); - for (int iiiGlyph = 0; iiiGlyph < cStretchable; iiiGlyph++) - { - int iiGlyph = viiGlyphsRem[iiiGlyph]; - vdxStretchLeft[iiGlyph] = vdxStretchRem[iiiGlyph]; - vdxWidth[iiGlyph] = vdxWidthRem[iiiGlyph]; - } - } - else - { - // All glyphs are still stretchable. - DistributeRemainder(vdxWidth, vdxStretchLeft, dxRemainder, 0, vdxWidth.size(), - &dxStretchAchieved); - } - } - // otherwise we assume left-over is cannot be handled - - // Assign the widths to the glyphs. - - for (iiGlyph = 0; iiGlyph < (signed)viGlyphs.size(); iiGlyph++) - { - int dxThis = vdxWidth[iiGlyph] * ((fShrinking) ? -1 : 1); - if (vdxStep[iiGlyph] == 0) - pgje->setGlyphAttribute(viGlyphs[iiGlyph], gr::kjgatWidth, 1, dxThis); - else - { - // Set the actual number of steps allowed. This is more accurate than - // setting the pixels and then converting to font em-units. - Assert(int(dxThis) % vdxStep[iiGlyph] == 0); // width divides evenly into steps - int cSteps = dxThis/vdxStep[iiGlyph]; - pgje->setGlyphAttribute(viGlyphs[iiGlyph], gr::kjgatWidthInSteps, 1, cSteps); - } - } - } -//LLeave: - - if (dxStretchAchieved == dxStretchNeeded) - return gr::kresOk; - else - { -#ifdef WIN32 - wchar_t rgchw[20]; - std::fill_n(rgchw, 20, 0); - _itow(dxStretchNeeded - dxStretchAchieved, rgchw, 10); - std::wstring strTmp(L"justification failed by "); - strTmp += rgchw; - strTmp += L" units (width needed = "; - std::fill_n(rgchw, 10, 0); - _itow(dxDesiredWidth, rgchw, 10); - strTmp += rgchw; - strTmp += L")\n"; - OutputDebugString(strTmp.c_str()); -#else - Assert(fprintf(stderr, - "justification failed by %d units (width needed = %d)\n", - dxStretchNeeded - dxStretchAchieved, dxDesiredWidth)); -#endif - return gr::kresFalse; - } -} - -/*---------------------------------------------------------------------------------------------- - Distribute the remainder of the width evenly over the stretchable glyphs. -----------------------------------------------------------------------------------------------*/ -void GrJustifier::DistributeRemainder(std::vector & vdxWidths, std::vector & vdxStretch, - int dx, int iiMin, int iiLim, - int * pdxStretchAchieved) -{ - if (dx == 0) - return; - - Assert(dx <= iiLim - iiMin); - if (iiMin + 1 == iiLim) - { - int dxThis = min(dx, vdxStretch[iiMin]); - Assert(dxThis == 1); // we're never adjusting by more than 1, and the glyph should be - // adjustable by that much - vdxWidths[iiMin] += dxThis; - vdxStretch[iiMin] -= dxThis; - *pdxStretchAchieved += dxThis; - } - else - { - int iiMid = (iiLim + iiMin) / 2; - int dxHalf1 = dx / 2; - int dxHalf2 = dx - dxHalf1; - DistributeRemainder(vdxWidths, vdxStretch, dxHalf1, iiMin, iiMid, pdxStretchAchieved); - DistributeRemainder(vdxWidths, vdxStretch, dxHalf2, iiMid, iiLim, pdxStretchAchieved); - } -} - -/*---------------------------------------------------------------------------------------------- - Return the least common multiple of the given weights. Also return - a std::vector of multiplicative factors for each weight. -----------------------------------------------------------------------------------------------*/ -int GrJustifier::Lcm(std::vector & vnWeights, std::vector & vnMFactors) -{ - // The basic algorithm is to factor each weight into primes, counting how many times - // each prime occurs in the factorization. The LCM is the multiple of the primes - // with each prime raised to maximum power encountered within the factorizations. - // Example: weights = [2, 4, 5, 10] - // 2 = 2^1 - // 4 = 2^2 - // 5 = 5^1 - // 10 = 2^1 * 5^1 - // So the LCM = 2^2 * 5^1 = 20. - - std::vector vnPowersForLcm; - int inPrime; - for (inPrime = 0; inPrime < g_cnPrimes; inPrime++) - vnPowersForLcm.push_back(0); - - std::vector vnPowersPerPrime; - vnPowersPerPrime.resize(g_cnPrimes); - int nWtMax = 1; - for (int inWt = 0; inWt < (signed)vnWeights.size(); inWt++) - { - int inMax = PrimeFactors(vnWeights[inWt], vnPowersPerPrime); - for (inPrime = 0; inPrime <= inMax; inPrime++) - vnPowersForLcm[inPrime] = max(vnPowersForLcm[inPrime], vnPowersPerPrime[inPrime]); - nWtMax = max(nWtMax, vnWeights[inWt]); - } - - int nLcm = 1; - for (inPrime = 0; inPrime < g_cnPrimes; inPrime++) - nLcm = nLcm * NthPower(g_rgnPrimes[inPrime], vnPowersForLcm[inPrime]); - - // For each weight, calculate the multiplicative factor. This is the value by which - // to multiply stretch values of this weight in order to get them properly proportioned. - // Note that weights that are not used will have bogus factors. - vnMFactors.push_back(nLcm); // bogus, for weight 0 - for (int nWt = 1; nWt <= nWtMax; nWt++) - { - vnMFactors.push_back(nLcm / nWt); - } - return nLcm; -} - -/*---------------------------------------------------------------------------------------------- - Return a std::vector indicating the prime factors of n. The values of the std::vector correspond - to the primes in g_rgnPrimes: [2, 3, 5, 7, ...]; they are the powers to which each - prime should be raised. For instance, 20 = 2^2 * 5^1, so the result would contain - [2, 0, 1, 0, 0, ...]. - The returned int is index of the highest prime in the list that we found. -----------------------------------------------------------------------------------------------*/ -int GrJustifier::PrimeFactors(int n, std::vector & vnPowersPerPrime) -{ - // Short-cut for common cases: - switch (n) - { - case 0: - case 1: - vnPowersPerPrime[0] = 0; - return 0; - case 2: - vnPowersPerPrime[0] = 1; // 2^1 - return 0; - case 3: - vnPowersPerPrime[0] = 0; - vnPowersPerPrime[1] = 1; // 3^1 - return 1; - case 4: - vnPowersPerPrime[0] = 2; // 2^2 - return 0; - case 5: - vnPowersPerPrime[0] = 0; - vnPowersPerPrime[1] = 0; - vnPowersPerPrime[2] = 1; // 5^1 - return 2; - case 6: - vnPowersPerPrime[0] = 1; // 2^1 - vnPowersPerPrime[1] = 1; // 3^1 - return 1; - case 7: - vnPowersPerPrime[0] = 0; - vnPowersPerPrime[1] = 0; - vnPowersPerPrime[2] = 0; - vnPowersPerPrime[3] = 1; // 7^1 - return 3; - case 8: - vnPowersPerPrime[0] = 3; // 2^3 - return 0; - case 9: - vnPowersPerPrime[0] = 0; - vnPowersPerPrime[1] = 2; // 3^2 - return 1; - case 10: - vnPowersPerPrime[0] = 1; // 2^1 - vnPowersPerPrime[1] = 0; - vnPowersPerPrime[2] = 1; // 5^1 - return 2; - default: - break; - } - - // Otherwise use the general algorithm: suck out prime numbers one by one, - // keeping track of how many we have of each. - - int inPrime; - for (inPrime = 0; inPrime < g_cnPrimes; inPrime++) - vnPowersPerPrime[inPrime] = 0; - - int nRem = n; - for (inPrime = 0; inPrime < g_cnPrimes; inPrime++) - { - while (nRem % g_rgnPrimes[inPrime] == 0) - { - vnPowersPerPrime[inPrime] += 1; - nRem = nRem / g_rgnPrimes[inPrime]; - } - if (nRem == 1) - break; - } - Assert(n > 255 || nRem == 1); - return inPrime; -} - -/*---------------------------------------------------------------------------------------------- - Return nX raised to the nY power. -----------------------------------------------------------------------------------------------*/ -int GrJustifier::NthPower(int nX, int nY) -{ - int nRet = 1; - for (int i = 0; i < nY; i++) - nRet *= nX; - return nRet; -} - -/*---------------------------------------------------------------------------------------------- - Determine how much shrinking is possible for low-end justification. -----------------------------------------------------------------------------------------------*/ -//GrResult GrJustifier::suggestShrinkAndBreak(GraphiteProcess * pgje, -// int iGlyphMin, int iGlyphLim, int dxsWidth, LgLineBreak lbPref, LgLineBreak lbMax, -// int * pdxShrink, LgLineBreak * plbToTry) -//{ -// *pdxShrink = 0; -// *plbToTry = lbPref; -// return kresOk; -//} - diff --git a/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/GrJustifier.h b/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/GrJustifier.h deleted file mode 100644 index ea5fc21bec9..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/GrJustifier.h +++ /dev/null @@ -1,82 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 2003 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: GrJustifier.h -Responsibility: Sharon Correll -Last reviewed: Not yet. - -Description: - A default justification agent for Graphite. --------------------------------------------------------------------------------*//*:End Ignore*/ -#pragma once -#ifndef GRJUSTIFIER_INCLUDED -#define GRJUSTIFIER_INCLUDED - -/*---------------------------------------------------------------------------------------------- - Class: GrJustifier - This class provides a basic justification/layout algorithm for applications that use - Graphite. -----------------------------------------------------------------------------------------------*/ -class GrJustifier : public gr::IGrJustifier -{ -public: - // Constructor: - GrJustifier(); - ~GrJustifier(); - -/* - virtual long IncRefCount(void) - { - return InterlockedIncrement(&m_cref); - } - virtual long DecRefCount(void) - { - long cref = InterlockedDecrement(&m_cref); - if (cref == 0) { - m_cref = 1; - delete this; - } - return cref; - } -*/ - - virtual gr::GrResult adjustGlyphWidths(gr::GraphiteProcess * pfgje, - int iGlyphMin, int iGlyphLim, - float dxCurrWidth, float dxDesiredWidth); - - //virtual GrResult suggestShrinkAndBreak(GraphiteProcess * pfgjwe, - // int iGlyphMin, int iGlyphLim, int dxsWidth, LgLineBreak lbPref, LgLineBreak lbMax, - // int * pdxShrink, LgLineBreak * plbToTry); - - // Return a Graphite-compatible justifier that can be stored in a Graphite segment. - // TODO: remove - //virtual void JustifierObject(IGrJustifier ** ppgjus) - //{ - // *ppgjus = this; - //} - - // When a segment is being destroyed, there is nothing to do, since this is a pointer - // to an object that is allocated elsewhere. - // TODO: remove - //virtual void DeleteJustifierPtr() - //{ - //} - -protected: - long m_cref; - - gr::GraphiteProcess * m_pgreng; - - void DistributeRemainder(std::vector & vdxWidths, std::vector & vdxStretch, - int dx, int iiMin, int iiLim, - int * pdxStretchAchieved); - int Lcm(std::vector & vnWeights, std::vector & vnMFactors); - int PrimeFactors(int n, std::vector & vnPowersPerPrime); - int NthPower(int nX, int nY); -}; - - -#endif // !GRJUSTIFIER_INCLUDED diff --git a/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/Makefile.am b/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/Makefile.am deleted file mode 100644 index fe59b65fbaa..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/Makefile.am +++ /dev/null @@ -1,38 +0,0 @@ -AUTOMAKE_OPTIONS = 1.6 - -EXTRA_DIST = \ - burmeseText.wpx \ - romanText.wpx \ - xlineText.wpx \ - grtest_arabic.ttf \ - grtest_badVersion.ttf \ - grtest_badCmap.ttf \ - grtest_burmese.ttf \ - grtest_roman.ttf \ - grtest_taiviet.ttf \ - grtest_xline.ttf \ - xline.gdl \ - Makefile.vc \ - makedebug.bat \ - readme.txt - -noinst_PROGRAMS = regression-test - -AM_CPPFLAGS = -I$(top_srcdir)/include/graphite - -regression_test_LDFLAGS = -L$(top_builddir)/src -lgraphite - -regression_test_SOURCES = \ - main.h \ - stdafx.cpp stdafx.h \ - RegressionTest.cpp \ - TestCase.cpp TestCase.h \ - RtTextSrc.h \ - SimpleTextSrc.cpp SimpleTextSrc.h \ - GrJustifier.cpp GrJustifier.h - -check-local: regression-test - $(top_builddir)/test/RegressionTest/regression-test -p $(srcdir) - -dist-hook: - rm -f grregtest.log tracelog.txt diff --git a/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/Makefile.in b/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/Makefile.in deleted file mode 100644 index 57078ea2d9b..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/Makefile.in +++ /dev/null @@ -1,495 +0,0 @@ -# Makefile.in generated by automake 1.10.1 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -noinst_PROGRAMS = regression-test$(EXEEXT) -subdir = test/RegressionTest -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_CLEAN_FILES = -PROGRAMS = $(noinst_PROGRAMS) -am_regression_test_OBJECTS = stdafx.$(OBJEXT) RegressionTest.$(OBJEXT) \ - TestCase.$(OBJEXT) SimpleTextSrc.$(OBJEXT) \ - GrJustifier.$(OBJEXT) -regression_test_OBJECTS = $(am_regression_test_OBJECTS) -regression_test_LDADD = $(LDADD) -regression_test_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ - $(CXXFLAGS) $(regression_test_LDFLAGS) $(LDFLAGS) -o $@ -DEFAULT_INCLUDES = -I.@am__isrc@ -depcomp = $(SHELL) $(top_srcdir)/config/depcomp -am__depfiles_maybe = depfiles -CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -CXXLD = $(CXX) -CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ - $(LDFLAGS) -o $@ -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ - $(LDFLAGS) -o $@ -SOURCES = $(regression_test_SOURCES) -DIST_SOURCES = $(regression_test_SOURCES) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -GREP = @GREP@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LSB_RELEASE = @LSB_RELEASE@ -LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ -MAKEINFO = @MAKEINFO@ -MKDIR_P = @MKDIR_P@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -RANLIB = @RANLIB@ -REL_CODENAME = @REL_CODENAME@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SIZEOF_WCHAR_T = @SIZEOF_WCHAR_T@ -STRIP = @STRIP@ -VERSION = @VERSION@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -AUTOMAKE_OPTIONS = 1.6 -EXTRA_DIST = \ - burmeseText.wpx \ - romanText.wpx \ - xlineText.wpx \ - grtest_arabic.ttf \ - grtest_badVersion.ttf \ - grtest_badCmap.ttf \ - grtest_burmese.ttf \ - grtest_roman.ttf \ - grtest_taiviet.ttf \ - grtest_xline.ttf \ - xline.gdl \ - Makefile.vc \ - makedebug.bat \ - readme.txt - -AM_CPPFLAGS = -I$(top_srcdir)/include/graphite -regression_test_LDFLAGS = -L$(top_builddir)/src -lgraphite -regression_test_SOURCES = \ - main.h \ - stdafx.cpp stdafx.h \ - RegressionTest.cpp \ - TestCase.cpp TestCase.h \ - RtTextSrc.h \ - SimpleTextSrc.cpp SimpleTextSrc.h \ - GrJustifier.cpp GrJustifier.h - -all: all-am - -.SUFFIXES: -.SUFFIXES: .cpp .lo .o .obj -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign test/RegressionTest/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --foreign test/RegressionTest/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -clean-noinstPROGRAMS: - @list='$(noinst_PROGRAMS)'; for p in $$list; do \ - f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f $$p $$f"; \ - rm -f $$p $$f ; \ - done -regression-test$(EXEEXT): $(regression_test_OBJECTS) $(regression_test_DEPENDENCIES) - @rm -f regression-test$(EXEEXT) - $(regression_test_LINK) $(regression_test_OBJECTS) $(regression_test_LDADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GrJustifier.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/RegressionTest.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SimpleTextSrc.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TestCase.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stdafx.Po@am__quote@ - -.cpp.o: -@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< - -.cpp.obj: -@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` - -.cpp.lo: -@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done - $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$(top_distdir)" distdir="$(distdir)" \ - dist-hook -check-am: all-am - $(MAKE) $(AM_MAKEFLAGS) check-local -check: check-am -all-am: Makefile $(PROGRAMS) -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ - mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: - -install-dvi: install-dvi-am - -install-exec-am: - -install-html: install-html-am - -install-info: install-info-am - -install-man: - -install-pdf: install-pdf-am - -install-ps: install-ps-am - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: - -.MAKE: install-am install-strip - -.PHONY: CTAGS GTAGS all all-am check check-am check-local clean \ - clean-generic clean-libtool clean-noinstPROGRAMS ctags \ - dist-hook distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags uninstall uninstall-am - - -check-local: regression-test - $(top_builddir)/test/RegressionTest/regression-test -p $(srcdir) - -dist-hook: - rm -f grregtest.log tracelog.txt -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/Makefile.vc b/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/Makefile.vc deleted file mode 100644 index ff75d7e9e16..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/Makefile.vc +++ /dev/null @@ -1,121 +0,0 @@ -!IF "$(OS)" == "Windows_NT" -NULL= -!ELSE -NULL=nul -!ENDIF - -TARGET=RegressionTest -REGT_SRC=. -REGT_RES=. -REGT_APPLIB=..\..\..\examples\applib - - -!IF "$(CFG)" == "" -CFG=DEBUG -!ENDIF - -!IF "$(CFG)" == "RELEASE" - -OUTDIR=.\release -INTDIR=.\release_temp - -all : "$(OUTDIR)\$(TARGET).exe" - -clean : - @- rd /s/q $(INTDIR) - -realclean : clean - @- rd /s/q $(OUTDIR) - -CPP_PROJ=/nologo /MT /W3 /GR /GX /O2 /I "." /I "../../examples/applib" /I "../../include" /I "../../include/graphite" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_UNICODE" /D "UNICODE" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /c -RSC_PROJ=/l 0x409 /fo"$(INTDIR)\$(TARGET).res" /d "NDEBUG" -LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib graphite.lib /nologo /subsystem:console /incremental:no /machine:I386 /out:"$(OUTDIR)\$(TARGET).exe" /libpath:"..\..\release" -BSC32_FLAGS=/nologo /o"$(OUTDIR)\$(TARGET).bsc" - -!ELSEIF "$(CFG)" == "DEBUG" - -OUTDIR=.\debug -INTDIR=.\debug_temp - -all : "$(OUTDIR)\$(TARGET).exe" "$(OUTDIR)\$(TARGET).bsc" - -clean : - @- rd /s/q $(INTDIR) - -realclean : clean - @- rd /s/q $(OUTDIR) - -CPP_PROJ=/nologo /MTd /W3 /Gm /GR /GX /GZ /ZI /Od /I "." /I "../../examples/applib" /I "../../include" /I "../../include/graphite" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_UNICODE" /D "UNICODE" /FR"$(INTDIR)\\" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /c -RSC_PROJ=/l 0x409 /fo"$(INTDIR)\$(TARGET).res" /d "_DEBUG" -LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib graphite.lib /nologo /subsystem:console /incremental:yes /pdb:"$(OUTDIR)\$(TARGET).pdb" /debug /machine:I386 /out:"$(OUTDIR)\$(TARGET).exe" /libpath:"..\..\debug" -BSC32_FLAGS=/nologo /o"$(OUTDIR)\$(TARGET).bsc" - -!ENDIF - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -"$(INTDIR)" : - if not exist "$(INTDIR)/$(NULL)" mkdir "$(INTDIR)" - -{$(REGT_SRC)}.cpp{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -{$(REGT_SRC)}.cpp{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -{$(REGT_APPLIB)}.cpp{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -{$(REGT_APPLIB)}.cpp{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - - - -CPP=cl.exe -RSC=rc.exe -BSC32=bscmake.exe -LINK32=link.exe - -LINK32_OBJS= \ - "$(INTDIR)\RegressionTest.obj" \ - "$(INTDIR)\TestCase.obj" \ - "$(INTDIR)\GrJustifier.obj" \ - "$(INTDIR)\SimpleTextSrc.obj" \ - -# "$(INTDIR)\RegressionTest.res" - -"$(OUTDIR)\$(TARGET).exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -BSC32_SBRS= \ - "$(INTDIR)\RegressionTest.sbr" \ - "$(INTDIR)\TestCase.sbr" \ - "$(INTDIR)\GrJustifier.sbr" \ - "$(INTDIR)\SimpleTextSrc.sbr" \ -# - -"$(OUTDIR)\$(TARGET).bsc" : "$(OUTDIR)" $(BSC32_SBRS) - $(BSC32) @<< - $(BSC32_FLAGS) $(BSC32_SBRS) -<< - -"$(INTDIR)\RegressionTest.obj" "$(INTDIR)\RegressionTest.sbr" : "$(REGT_SRC)\RegressionTest.cpp" "$(INTDIR)" -"$(INTDIR)\TestCase.obj" "$(INTDIR)\TestCase.sbr" : "$(REGT_SRC)\TestCase.cpp" "$(INTDIR)" -"$(INTDIR)\GrJustifier.obj" "$(INTDIR)\GrJustifier.sbr" : "$(REGT_APPLIB)\GrJustifier.cpp" "$(INTDIR)" -"$(INTDIR)\SimpleTextSrc.obj" "$(INTDIR)\SimpleTextSrc.sbr" : "$(REGT_APPLIB)\SimpleTextSrc.cpp" "$(INTDIR)" - - -"$(INTDIR)\$(TARGET).res" : "$(REGT_RES)\$(TARGET).rc" "$(INTDIR)" - $(RSC) $(RSC_PROJ) "$(REGT_RES)\$(TARGET).rc" - diff --git a/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/RegressionTest.cpp b/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/RegressionTest.cpp deleted file mode 100644 index b549daa38f3..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/RegressionTest.cpp +++ /dev/null @@ -1,749 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 2004 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: RegressionTest.cpp -Responsibility: Sharon Correll -Last reviewed: Not yet. - -Description: - Main file for the Graphite regression test program. --------------------------------------------------------------------------------*//*:End Ignore*/ - -#include "main.h" -#include "MemoryUsage.h" -#include - -//:>******************************************************************************************** -//:> Global variables -//:>******************************************************************************************** -std::ofstream g_strmLog; // log file output stream -std::ofstream g_strmTrace; // debugger trace for selected tests -std::ofstream g_strmMemUsage; - -int g_errorCount; - -// HDC g_hdc; // device-context for bogus window on which to do drawing - -bool g_debugMode = false; -bool g_silentMode = false; - -int g_itcaseStart = 0; // adjust to skip to a certain test - -SegmentMemoryUsage g_smu; -FontMemoryUsage g_fmu; -const int TestCase::kAbsent; - -std::string g_fontPath = "."; -#ifdef _WIN32 -#define PATH_SEP "\\" -#else -#define PATH_SEP "/" -#endif - -// Forward defintions. -int WriteLog(int); -void CopyWstringToUtf16(std::wstring textStr, gr::utf16 * utf16Buf, int bufSize); - -//:>******************************************************************************************** -//:> Functions -//:>******************************************************************************************** - -/*---------------------------------------------------------------------------------------------- - Main function. -----------------------------------------------------------------------------------------------*/ - -int main(int argc, char* argv[]) -{ -#ifdef _WIN32 - _CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | _CRTDBG_LEAK_CHECK_DF); -#endif // WIN32 - - int iargc = 1; - while (iargc < argc) - { - if ((strcmp(argv[iargc], "/d") == 0) || (strcmp(argv[iargc], "-d") == 0)) - { - g_debugMode = true; - } - if ((strcmp(argv[iargc], "/s") == 0) || (strcmp(argv[iargc], "-s") == 0)) - { - g_silentMode = true; - } - if ((strcmp(argv[iargc], "/p") == 0) || (strcmp(argv[iargc], "-p") == 0)) - { - iargc++; - if (iargc < argc) - { - g_fontPath = argv[iargc]; - } - } - iargc++; - } - - if (!g_silentMode) - { - std::cout << "Graphite Regression Test\n"; - std::cout << "Files path is " << g_fontPath << "\n\n"; - if (g_debugMode) - std::cout << "In debug mode\n"; - } - - // Start a new log. - g_strmLog.open("grregtest.log"); - if (g_strmLog.fail()) - { - std::cout << "Unable to open log file."; - return -1; - } - - g_errorCount = 0; - -// g_hdc = ::GetDC(NULL); - - WriteToLog("Graphite Regression Test\n\n"); - - // Initialize the tracelog file. - g_strmTrace.open("tracelog.txt"); - g_strmTrace.close(); - - TestCase * ptcaseList = NULL; - int numberOfTests = TestCase::SetupTests(&ptcaseList); - - RunTests(numberOfTests, ptcaseList); - - WriteToLog("\n==============================================\n"); - g_strmLog << "\n\nTOTAL NUMBER OF ERRORS: " << g_errorCount << "\n"; - if (!g_silentMode) - std::cout << "\n\nTOTAL NUMBER OF ERRORS: " << g_errorCount << "\n"; - - g_strmLog.close(); - - ////EngineInstance::DeleteEngines(); - TestCase::DeleteTests(); - -// ::ReleaseDC(NULL, g_hdc); - - // Output segment memory usage information. - //g_strmMemUsage.open("SegMemoryUsage.log"); - //g_smu.prettyPrint(g_strmMemUsage); - //g_strmMemUsage.close(); - - return g_errorCount; -} - -/*---------------------------------------------------------------------------------------------- - Run the tests. -----------------------------------------------------------------------------------------------*/ -void RunTests(int numberOfTests, TestCase * ptcaseList) -{ - Segment * psegPrev = NULL; - RtTextSrc * ptsrcPrev = NULL; - Segment * psegRet = NULL; - RtTextSrc * ptsrcRet = NULL; - - for (int itcase = g_itcaseStart; itcase < numberOfTests; itcase++) - { - TestCase * ptcase = ptcaseList + itcase; - WriteToLog("\n----------------------------------------------\n"); - WriteToLog("Test: "); - - if (!g_silentMode) - std::cout << "Test " << ptcase->TestName() << "..."; - WriteToLog(ptcase->TestName()); - WriteToLog("\n"); - - RunOneTestCase(ptcase, psegPrev, &psegRet, &ptsrcRet); - - delete psegPrev; - delete ptsrcPrev; - psegPrev = psegRet; - ptsrcPrev = ptsrcRet; - psegRet = NULL; - ptsrcRet = NULL; - } - - delete psegPrev; - delete ptsrcPrev; -} - -/*---------------------------------------------------------------------------------------------- - Run a single test case. -----------------------------------------------------------------------------------------------*/ -int RunOneTestCase(TestCase * ptcase, Segment * psegPrev, Segment ** ppsegRet, RtTextSrc ** pptsrcRet) -{ - if (ptcase->Skip()) - { - std::cout << "\nskipped\n"; - g_strmLog << "skipping\n"; - *ppsegRet = NULL; - return 0; - } - -#ifdef _WIN32 - // Break into the debugger if requested. - if (ptcase->RunDebugger() && ::IsDebuggerPresent()) - { - ::DebugBreak(); - } -#endif - - int errorCount = 0; - - gr::utf16 text[1024]; - CopyWstringToUtf16(ptcase->Text(), text, 1024); - - *ppsegRet = NULL; - SegmentPainter * ppainter = NULL; - std::pair iterPair; - GlyphIterator gitBegin; - GlyphIterator gitEnd; - - //LOGFONT lf; - //memset(&lf, '\0', sizeof(LOGFONT)); - //lf.lfCharSet = DEFAULT_CHARSET; - //lf.lfHeight = (signed(ptcase->FontSize()) * -96) / 72; // 96 = resolution, 72 = points per inch - //lf.lfWeight = 400; - //lf.lfItalic = FALSE; - //wcscpy(lf.lfFaceName, ptcase->FontName().data()); - //HDC hdc = CreateDC(TEXT("DISPLAY"), NULL, NULL, NULL); - //HFONT hfont = CreateFontIndirect(&lf); - //HFONT hfontOld = (HFONT)::SelectObject(hdc, hfont); // restore before destroying the DC. - //WinFont winfont(hdc); - - FileFont font(g_fontPath + PATH_SEP + ptcase->FontFile(), float(signed(ptcase->FontSize())), 96, 96); - - if (!font.isValid()) - { - OutputError(ptcase, std::string("ERROR: reading font file: \"") + ptcase->FontFile() + "\" at path \"" + g_fontPath + "\"; remaining tests skipped"); - *ppsegRet = NULL; - errorCount++; - return WriteLog(errorCount); - } - - // Set up the text source. - *pptsrcRet = new RtTextSrc(&(text[0])); - RtTextSrc * ptsrc = *pptsrcRet; - (*pptsrcRet)->setFeatures(ptcase->Features()); - (*pptsrcRet)->setRightToLeft(ptcase->Rtl()); - - // Generate a segment. - LayoutEnvironment layout; - layout.setDumbFallback(ptcase->DumbFallback()); - layout.setStartOfLine(true); - layout.setRightToLeft(ptcase->ParaRtl()); - if (ptcase->InitWithPrevSeg()) - layout.setPrevSegment(psegPrev); - - if (ptcase->TraceLog()) - { - g_strmTrace.open("tracelog.txt", std::ios::app); - g_strmTrace << "Test: " << ptcase->TestName() << "\n\n"; - layout.setLoggingStream(&g_strmTrace); - } - - try - { - if (ptcase->AvailWidth() < 10000) - { - layout.setBestBreak(ptcase->PrefBreak()); - layout.setWorstBreak(ptcase->WorstBreak()); - layout.setTrailingWs(ptcase->Twsh()); - *ppsegRet = new LineFillSegment(&font, ptsrc, &layout, - ptcase->FirstChar(), ptsrc->getLength(), - (float)ptcase->AvailWidth(), - ptcase->Backtrack()); - } - else - { - *ppsegRet = new RangeSegment(&font, ptsrc, &layout); - } - } - catch (...) - { - if (!ptcase->NoSegment()) - { - if (ptcase->BadFont() && !ptcase->DumbFallback()) - // Weird situation. - OutputError(ptcase, "ERROR: bad font with no fallback, yet a segment was expected???"); - else - OutputError(ptcase, "ERROR: generating segment; remaining tests skipped"); - errorCount++; - } - // else segment creation failed as expected - - // NB: failure to create a segment due to throwing an exception seems to result in a memory - // leak--the FontCache object FontFace::s_pFontCache does not get deleted. - - *ppsegRet = NULL; - return WriteLog(errorCount); - } - - if (ptcase->TraceLog()) - { - g_strmTrace << "\n\n*********************************************************************************************************************\n\n"; - g_strmTrace.close(); - } - - if ((*ppsegRet) && (*ppsegRet)->segmentTermination() == kestNothingFit) - { - delete *ppsegRet; - *ppsegRet = NULL; - } - - if ((*ppsegRet) == NULL && !ptcase->NoSegment()) - { - OutputError(ptcase, "ERROR: segment not created; remaining tests skipped"); - errorCount++; - return WriteLog(errorCount); - } - else if (ptcase->NoSegment()) - { - if (*ppsegRet) - { - OutputError(ptcase, "ERROR: segment created when none expected"); - errorCount++; - } - delete *ppsegRet; - *ppsegRet = NULL; - return WriteLog(errorCount); - } - - Segment * pseg = *ppsegRet; - - pseg->calculateMemoryUsage(g_smu); - - // Calculate and output font memory usage. - //g_fmu = Font::calculateMemoryUsage(); - //g_strmMemUsage.open("fontMemoryUsage.log"); - //g_fmu.prettyPrint(g_strmMemUsage); - //g_strmMemUsage.close(); - - // Test results. - int segMin = pseg->startCharacter(); - int segLim = pseg->stopCharacter(); - if ((segLim - segMin) != ptcase->CharCount()) - { - OutputErrorWithValues(ptcase, "ERROR: number of characters in segment", -1, - (segLim - segMin), ptcase->CharCount()); - errorCount++; - } - - int segWidth = (int)pseg->advanceWidth(); - if (segWidth != ptcase->SegWidth()) - { - OutputErrorWithValues(ptcase, "ERROR: width of segment", -1, - segWidth, ptcase->SegWidth()); - errorCount++; - } - - iterPair = pseg->glyphs(); - gitBegin = iterPair.first; - gitEnd = iterPair.second; - int cGlyphs = gitEnd - gitBegin; - if (cGlyphs != ptcase->GlyphCount()) - { - OutputErrorWithValues(ptcase, "ERROR: number of glyphs", -1, - cGlyphs, ptcase->GlyphCount()); - errorCount++; - } - else - { - GlyphIterator gitThis = gitBegin; - for (int iglyph = 0; gitThis != gitEnd; ++gitThis, iglyph++) - { - if ((*gitThis).glyphID() != ptcase->GlyphID(iglyph)) - { - OutputErrorWithValues(ptcase, "ERROR: glyph id ", iglyph, - (*gitThis).glyphID(), ptcase->GlyphID(iglyph)); - errorCount++; - } - if (int((*gitThis).origin()) != ptcase->XPos(iglyph)) - { - OutputErrorWithValues(ptcase, "ERROR: glyph x-position ", iglyph, - int((*gitThis).origin()), ptcase->XPos(iglyph)); - errorCount++; - } - if (int((*gitThis).yOffset()) != ptcase->YPos(iglyph)) - { - OutputErrorWithValues(ptcase, "ERROR: glyph y-position ", iglyph, - int((*gitThis).yOffset()), ptcase->YPos(iglyph)); - errorCount++; - } - if (int((*gitThis).advanceWidth()) != ptcase->AdvWidth(iglyph)) - { - OutputErrorWithValues(ptcase, "ERROR: advance width ", iglyph, - int((*gitThis).advanceWidth()), ptcase->AdvWidth(iglyph)); - errorCount++; - } - if (ptcase->BbTests()) - { - gr::Rect rectBb = (*gitThis).bb(); - if (int(rectBb.left) != ptcase->BbLeft(iglyph)) - { - OutputErrorWithValues(ptcase, "ERROR: bb left ", iglyph, - int(rectBb.left), ptcase->BbLeft(iglyph)); - errorCount++; - } - if (int(rectBb.right) != ptcase->BbRight(iglyph)) - { - OutputErrorWithValues(ptcase, "ERROR: bb right ", iglyph, - int(rectBb.right), ptcase->BbRight(iglyph)); - errorCount++; - } - if (int(rectBb.top) != ptcase->BbTop(iglyph)) - { - OutputErrorWithValues(ptcase, "ERROR: bb top ", iglyph, - int(rectBb.top), ptcase->BbTop(iglyph)); - errorCount++; - } - if (int(rectBb.bottom) != ptcase->BbBottom(iglyph)) - { - OutputErrorWithValues(ptcase, "ERROR: bb bottom ", iglyph, - int(rectBb.bottom), ptcase->BbBottom(iglyph)); - errorCount++; - } - } - } - } - - ppainter = new SegmentNonPainter(pseg); - - if (segLim == ptcase->CharCount()) - { - for (int ichar = 0; ichar < segLim; ichar++) - { - LgIpValidResult ipvr = ppainter->isValidInsertionPoint(ichar); - if ((ipvr == kipvrOK && !ptcase->InsPtFlag(ichar)) // TODO: handle kipvrUnknown - || (ipvr != kipvrOK && ptcase->InsPtFlag(ichar))) - { - OutputErrorWithValues(ptcase, "ERROR: valid insertion point ", ichar, - (ipvr == kipvrOK), ptcase->InsPtFlag(ichar)); - errorCount++; - } - } - } - - int c2gi = 0; - while (c2gi < ptcase->CharToGlyphCount()) - { - int ichar = ptcase->CharToGlyphItem(c2gi++); - int glyphCount = ptcase->CharToGlyphItem(c2gi++); - std::pair glyphSet = pseg->charToGlyphs(ichar); - gr::GlyphSetIterator gitStart = glyphSet.first; - gr::GlyphSetIterator gitStop = glyphSet.second; - if ((gitStop - gitStart) != glyphCount) - { - OutputErrorWithValues(ptcase, "ERROR: number of glyphs for char ", ichar, - gitStop - gitStart, glyphCount); - errorCount++; - c2gi += glyphCount; - } - else - { - GlyphSetIterator glyphLp = glyphSet.first; - for (int ig = 0; ig < glyphCount; ig++) - { - if (static_cast((*glyphLp).logicalIndex()) != ptcase->CharToGlyphItem(c2gi)) - { - OutputErrorWithValues(ptcase, "ERROR: glyph for char ", ichar, - (*glyphLp).logicalIndex(), ptcase->CharToGlyphItem(c2gi)); - errorCount++; - } - c2gi++; - glyphLp++; - } - } - } - - int att = 0; - while (att < ptcase->AttachedGlyphCount()) - { - int iglyph = ptcase->AttachedGlyphItem(att++); - if (iglyph > cGlyphs) - { - OutputError(ptcase, "ERROR: non-existent glyph in attachment test ", iglyph); - errorCount++; - att++; - att += ptcase->AttachedGlyphItem(att) + 1; - continue; - } - - GlyphIterator gitThis = gitBegin + iglyph; - GlyphIterator gitBase = gitThis->attachedClusterBase(); - int ibase = gitBase->logicalIndex(); - if (ibase != ptcase->AttachedGlyphItem(att)) - { - OutputErrorWithValues(ptcase, "ERROR: attachment base for glyph ", iglyph, - ibase, ptcase->AttachedGlyphItem(att)); - errorCount++; - } - att++; - std::pair glyphSet = gitThis->attachedClusterGlyphs(); - gr::GlyphSetIterator gitStart = glyphSet.first; - gr::GlyphSetIterator gitStop = glyphSet.second; - int glyphCount = ptcase->AttachedGlyphItem(att++); - if ((gitStop - gitStart) != glyphCount) - { - OutputErrorWithValues(ptcase, "ERROR: number of attachments for glyph ", iglyph, - gitStop - gitStart, glyphCount); - errorCount++; - att += glyphCount; - } - else - { - GlyphSetIterator glyphLp = glyphSet.first; - for (int ig = 0; ig < glyphCount; ig++) - { - if (static_cast((*glyphLp).logicalIndex()) != ptcase->AttachedGlyphItem(att)) - { - OutputErrorWithValues(ptcase, "ERROR: attachment for glyph ", iglyph, - (*glyphLp).logicalIndex(), ptcase->AttachedGlyphItem(att)); - errorCount++; - } - att++; - glyphLp++; - } - } - } - - for (int iclicktest = 0; iclicktest < ptcase->NumberOfClickTests(); iclicktest++) - { - gr::Point ptClick; - ptClick.x = static_cast(ptcase->XClick(iclicktest)); - ptClick.y = static_cast(ptcase->YClick(iclicktest)); - int charIndex; - bool assocPrev; - ppainter->pointToChar(ptClick, &charIndex, &assocPrev); - if (charIndex != ptcase->ClickCharIndex(iclicktest)) - { - OutputErrorWithValues(ptcase, "ERROR: char index from click ", iclicktest, - charIndex, ptcase->ClickCharIndex(iclicktest)); - errorCount++; - continue; - } - if (assocPrev != ptcase->ClickAssocPrev(iclicktest)) - { - OutputErrorWithValues(ptcase, "ERROR: assoc-prev from click ", iclicktest, - assocPrev, ptcase->ClickAssocPrev(iclicktest)); - errorCount++; - } - gr::Rect rect1, rect2; - ppainter->positionsOfIP(charIndex, assocPrev, - false, &rect1, &rect2); - if (ptcase->Sel1Top(iclicktest) == TestCase::kAbsent) - { - if (rect1.top != 0 || rect1.bottom != 0 || rect1.left != 0 || rect1.right != 0) - { - OutputError(ptcase, "ERROR: IP prim rect found ", iclicktest); - errorCount++; - } - } - else if (rect1.top == 0 && rect1.bottom == 0 && rect1.left == 0 && rect1.right == 0) - { - OutputError(ptcase, "ERROR: IP prim rect not found ", iclicktest); - errorCount++; - } - else - { - if ((int)rect1.top != ptcase->Sel1Top(iclicktest)) - { - OutputErrorWithValues(ptcase, "ERROR: IP prim rect top ", iclicktest, - int(rect1.top), ptcase->Sel1Top(iclicktest)); - errorCount++; - } - if ((int)rect1.bottom != ptcase->Sel1Bottom(iclicktest)) - { - OutputErrorWithValues(ptcase, "ERROR: IP prim rect bottom ", iclicktest, - int(rect1.bottom), ptcase->Sel1Bottom(iclicktest)); - errorCount++; - } - if ((int)rect1.left != ptcase->Sel1Left(iclicktest)) - { - OutputErrorWithValues(ptcase, "ERROR: IP prim rect left ", iclicktest, - int(rect1.left), ptcase->Sel1Left(iclicktest)); - errorCount++; - } - } - - if (ptcase->Sel2Top(iclicktest) == TestCase::kAbsent) - { - if (rect2.top != 0 || rect2.bottom != 0 || rect2.left != 0 || rect2.right != 0) - { - OutputError(ptcase, "ERROR: IP sec rect found when not expected ", iclicktest); - errorCount++; - } - } - else if (rect2.top == 0 && rect2.bottom == 0 && rect2.left == 0 && rect2.right == 0) - { - OutputError(ptcase, "ERROR: IP sec rect not found ", iclicktest); - errorCount++; - } - else - { - if ((int)rect2.top != ptcase->Sel2Top(iclicktest)) - { - OutputErrorWithValues(ptcase, "ERROR: IP sec rect top ", iclicktest, - int(rect2.top), ptcase->Sel2Top(iclicktest)); - errorCount++; - } - if ((int)rect2.bottom != ptcase->Sel2Bottom(iclicktest)) - { - OutputErrorWithValues(ptcase, "ERROR: IP sec rect bottom ", iclicktest, - int(rect2.bottom), ptcase->Sel2Bottom(iclicktest)); - errorCount++; - } - if ((int)rect2.left != ptcase->Sel2Left(iclicktest)) - { - OutputErrorWithValues(ptcase, "ERROR: IP sec rect left ", iclicktest, - int(rect2.left), ptcase->Sel2Left(iclicktest)); - errorCount++; - } - } - } - - ////if (contextBlockOut != ptcase->OutputContextBlockSize()) - ////{ - //// OutputErrorWithValues(ptcase, "ERROR: output context block size ", -1, - //// (int)contextBlockOut, (int)ptcase->OutputContextBlockSize()); - //// errorCount++; - ////} - ////else if (!ptcase->CompareContextBlock(pContextBlockOut)) - ////{ - //// OutputError(ptcase, "ERROR: output context block"); - //// errorCount++; - ////} - delete ppainter; - - return WriteLog(errorCount); -} - - -/*---------------------------------------------------------------------------------------------- - Write the error count to the log. -----------------------------------------------------------------------------------------------*/ -int WriteLog(int errorCount) -{ - WriteToLog("\nError count = "); - WriteToLog(errorCount); - WriteToLog("\n"); - - if (!g_silentMode) - { - if (errorCount == 0) - std::cout << "ok\n"; - else - std::cout << "FAILED\n"; - } - - - //delete pseg; // don't delete these; they are passed back to the calling method - //delete ptsrc; - - // Delete device context - //DeleteObject(SelectObject(hdc, hfontOld)); - //DeleteDC(hdc); - - g_errorCount += errorCount; - return errorCount; -} - -/*---------------------------------------------------------------------------------------------- - Copy a std::wstring (whose bytes can be of various sizes on different platforms) - to a buffer of UTF16. -----------------------------------------------------------------------------------------------*/ -void CopyWstringToUtf16(std::wstring textStr, gr::utf16 * utf16Buf, int bufSize) -{ - std::fill_n(utf16Buf, bufSize, 0); - int cc = textStr.length(); - for (int i = 0; i < cc; i++) - utf16Buf[i] = textStr[i]; -} - -/*---------------------------------------------------------------------------------------------- - Output information about an error. -----------------------------------------------------------------------------------------------*/ -void OutputError(TestCase * ptcase, std::string strErr, int i) -{ - OutputErrorAux(ptcase, strErr, i, false, 0, 0); -} - -void OutputErrorWithValues(TestCase * ptcase, std::string strErr, int i, - int valueFound, int valueExpected) -{ - OutputErrorAux(ptcase, strErr, i, true, valueFound, valueExpected); -} - -void OutputErrorAux(TestCase * ptcase, std::string strErr, int i, - bool showValues, int valueFound, int valueExpected) -{ -// if (g_debugMode) -// ::DebugBreak(); - - if (!g_silentMode) - { - //std::cout << ptcase->TestName() << ": "; - std::cout << strErr; - if (i > -1) - { - std::cout << "[" << i << "]"; - } - std::cout << "\n "; - } - - WriteToLog(strErr, i, showValues, valueFound, valueExpected); - - WriteToLog("\n"); -} - -/*---------------------------------------------------------------------------------------------- - Write some text to the log file. -----------------------------------------------------------------------------------------------*/ -bool WriteToLog(std::string str, int i) -{ - if (g_strmLog.fail()) - { - std::cout << "Error opening log file."; - return false; - } - g_strmLog << str; - if (i > -1) - g_strmLog << "[" << i << "]"; - g_strmLog.flush(); - return true; -} - -bool WriteToLog(std::string str, int i, - bool showValues, int valueFound, int valueExpected) -{ - if (g_strmLog.fail()) - { - std::cout << "Error opening log file."; - return false; - } - g_strmLog << str; - if (i > -1) - g_strmLog << "[" << i << "]"; - if (showValues) - { - g_strmLog << "; found " << valueFound << " not " << valueExpected; - } - g_strmLog.flush(); - return true; -} - - -bool WriteToLog(int n) -{ - if (g_strmLog.fail()) - { - std::cout << "Error opening log file."; - return false; - } - g_strmLog << n; - g_strmLog.flush(); - return true; -} - diff --git a/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/RtTextSrc.h b/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/RtTextSrc.h deleted file mode 100644 index d0ce76f64ac..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/RtTextSrc.h +++ /dev/null @@ -1,74 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 1999, 2001 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: RtTextSrc.h -Responsibility: Sharon Correll -Last reviewed: Not yet. - -Description: - --------------------------------------------------------------------------------*//*:End Ignore*/ -#pragma once -#ifndef RTTXTSRC_INCLUDED -#define RTTXTSRC_INCLUDED - -#include - -/*---------------------------------------------------------------------------------------------- - Class: RtTextSrc - This class extends the SimpleTextSource to allow setting of features. -----------------------------------------------------------------------------------------------*/ -class RtTextSrc : public SimpleTextSrc -{ -public: - RtTextSrc(gr::utf16 * pszText) : SimpleTextSrc(pszText) - { - m_fRtl = false; - memset(m_fset, 0, MAXFEAT * sizeof(FeatureSetting)); - } - - void setFeatures(FeatureSetting * fset) - { - m_cFeats = 0; - for (int i = 0; i < MAXFEAT; i++) - { - if (fset[i].id > 0) - { - m_fset[i].id = fset[i].id; - m_fset[i].value = fset[i].value; - m_cFeats++; - } - } - } - - virtual size_t getFontFeatures(toffset ich, FeatureSetting * prgfset) - { - // Note: size of prgfset buffer = gr::kMaxFeatures = 64 - std::copy(m_fset, m_fset + MAXFEAT, prgfset); - return m_cFeats; - } - - virtual bool getRightToLeft(toffset ich) - { - return m_fRtl; - } - virtual unsigned int getDirectionDepth(toffset ich) - { - return ((m_fRtl == 1) ? 1 : 0); - } - void setRightToLeft(bool f) - { - m_fRtl = f; - } - -protected: - bool m_fRtl; - int m_cFeats; - FeatureSetting m_fset[MAXFEAT]; -}; - - -#endif // !RTTXTSRC_INCLUDED diff --git a/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/SimpleTextSrc.cpp b/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/SimpleTextSrc.cpp deleted file mode 100644 index c50799c96bc..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/SimpleTextSrc.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 1999, 2001 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: SimpleTextSrc.cpp -Responsibility: Sharon Correll -Last reviewed: Not yet. - -Description: - A simple text source that shows how to use this interface within Graphite. --------------------------------------------------------------------------------*//*:End Ignore*/ - -//:>******************************************************************************************** -//:> Include files -//:>******************************************************************************************** -#pragma hdrstop -// any other headers (not precompiled) - -#include "GrClient.h" -#include "GrDebug.h" -#include "ITextSource.h" -#include "SimpleTextSrc.h" - -#undef THIS_FILE -DEFINE_THIS_FILE - -//:>******************************************************************************************** -//:> Initialization and destruction -//:>******************************************************************************************** - -/*---------------------------------------------------------------------------------------------- - Constructors. -----------------------------------------------------------------------------------------------*/ -SimpleTextSrc::SimpleTextSrc(gr::utf16 * pszText) -{ - m_cref = 1; // COM-like behavior - - //m_cchLength = wcslen(pszText); // don't use wcslen, it's not cross-platform - m_cchLength = 0; - for (gr::utf16 * pch = pszText; *pch != 0; pch++) - m_cchLength++; - m_prgchText = new gr::utf16[m_cchLength + 1]; - std::copy(pszText, pszText + m_cchLength, m_prgchText); - m_prgchText[m_cchLength] = 0; // zero-terminate -} - -/*---------------------------------------------------------------------------------------------- - Destructor. -----------------------------------------------------------------------------------------------*/ -SimpleTextSrc::~SimpleTextSrc() -{ - delete[] m_prgchText; -} - -//:>******************************************************************************************** -//:> Interface methods -//:>******************************************************************************************** -/*---------------------------------------------------------------------------------------------- - Get the specified range of text -----------------------------------------------------------------------------------------------*/ -size_t SimpleTextSrc::fetch(toffset ichMin, size_t cch, gr::utf16 * prgchwBuffer) -{ - size_t ichRet = min(cch, size_t(m_cchLength - ichMin)); - std::copy(m_prgchText + ichMin, m_prgchText+ichMin + ichRet, prgchwBuffer); - return ichRet; -} - -/*---------------------------------------------------------------------------------------------- - Return true if the text uses a right-to-left writing system. -----------------------------------------------------------------------------------------------*/ -bool SimpleTextSrc::getRightToLeft(toffset ich) -{ - return false; -} - -/*---------------------------------------------------------------------------------------------- - Return the depth of embedding of the writing system. -----------------------------------------------------------------------------------------------*/ -unsigned int SimpleTextSrc::getDirectionDepth(toffset ich) -{ - return 0; -} - -/*---------------------------------------------------------------------------------------------- - Return the vertical offset of the text. This simple implementation provides no - vertical offset. -----------------------------------------------------------------------------------------------*/ -float SimpleTextSrc::getVerticalOffset(toffset ich) -{ - return 0; -} diff --git a/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/SimpleTextSrc.h b/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/SimpleTextSrc.h deleted file mode 100644 index a5d191b4ac3..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/SimpleTextSrc.h +++ /dev/null @@ -1,113 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 1999, 2001 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: SimpleTextSrc.h -Responsibility: Sharon Correll -Last reviewed: Not yet. - -Description: - A simple text source that shows how to use this interface within Graphite. --------------------------------------------------------------------------------*//*:End Ignore*/ -#pragma once -#ifndef GRTXTSRC_INCLUDED -#define GRTXTSRC_INCLUDED - -using namespace gr; - -/*---------------------------------------------------------------------------------------------- - Class: SimpleTextSrc - This class provides a simple implementation for a text source for the Graphite engine. - There are no paragraph properties of interest and one set of character properties that - apply to the entire string. - - This class is a subclass of IColorTextSource so that it can be used by the - WinSegmentPainter class, which expects the getColors method to be defined. -----------------------------------------------------------------------------------------------*/ -class SimpleTextSrc : public IColorTextSource -{ -public: - // Constructor: - SimpleTextSrc(gr::utf16 * pszText); - ~SimpleTextSrc(); - -/* - virtual long IncRefCount(void) - { - return InterlockedIncrement(&m_cref); - } - virtual long DecRefCount(void) - { - long cref = InterlockedDecrement(&m_cref); - if (cref == 0) { - m_cref = 1; - delete this; - } - return cref; - } -*/ - // ------------------------------------------------------------------------------- - // Interface methods: - - virtual UtfType utfEncodingForm() - { - return kutf16; - } - virtual size_t getLength() - { - return m_cchLength; - } - virtual size_t fetch(toffset ichMin, size_t cch, utf32 * prgchBuffer) - { - throw; - } - virtual size_t fetch(toffset ichMin, size_t cch, gr::utf16 * prgchwBuffer); - virtual size_t fetch(toffset ichMin, size_t cch, utf8 * prgchsBuffer) - { - throw; - }; - - virtual bool getRightToLeft(toffset ich); - virtual unsigned int getDirectionDepth(toffset ich); - virtual float getVerticalOffset(toffset ich); - - virtual isocode getLanguage(toffset ich) - { - isocode ret; - ret.rgch[0] = 'e'; ret.rgch[1] = 'n'; ret.rgch[2] = 0; ret.rgch[3] = 0; - return ret; - } - - virtual std::pair propertyRange(toffset ich) - { - std::pair pairRet; - pairRet.first = 0; - pairRet.second = m_cchLength; - return pairRet; - } - - virtual size_t getFontFeatures(toffset ich, FeatureSetting * prgfset) - { - return 0; // no features in this simple implementation - } - virtual bool sameSegment(toffset ich1, toffset ich2) - { - return true; - } - - virtual void getColors(toffset ich, int * pclrFore, int * pclrBack) - { - *pclrFore = kclrBlack; - *pclrBack = kclrTransparent; - } - -protected: - long m_cref; - gr::utf16 * m_prgchText; - int m_cchLength; -}; - - -#endif // !GRTXTSRC_INCLUDED diff --git a/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/TestCase.cpp b/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/TestCase.cpp deleted file mode 100644 index d54c37a871b..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/TestCase.cpp +++ /dev/null @@ -1,1985 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 2004 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: TestCase.cpp -Responsibility: Sharon Correll -Last reviewed: Not yet. - -Description: - File to set up test cases for the Graphite regression test program. - -How to add a test: - 1. Add the name of your test method to the class declaration in TestCase.h. - 2. Increment the g_numberOfTests constant in this file. - 3. Add a call to your test method in the SetupTests method in this file. - 4. Copy one of the existing test methods such as SetupSimpleTest and change the name - and data. - -Things that still need testing: - Ligatures (there is one small test of this) - Justification - Fake italic --------------------------------------------------------------------------------*//*:End Ignore*/ - -#include "main.h" -#include - -//:>******************************************************************************************** -//:> Test constants and methods -//:>******************************************************************************************** - -const int g_numberOfTests = 25; // *** increment as tests are added *** - -TestCase * g_ptcaseList; // list of test cases - -namespace gr { // and it was SC who got rid of the byte defn in GrPlatform.h! -typedef unsigned char byte; -} - - -/*---------------------------------------------------------------------------------------------- - Create the list of tests. -----------------------------------------------------------------------------------------------*/ -int TestCase::SetupTests(TestCase ** pptcaseList) -{ - g_ptcaseList = new TestCase[g_numberOfTests]; - int cptcase = 0; - - // The number of methods called here should equal g_numberOfTests above. - g_ptcaseList[0].SetupSimpleTest(); cptcase++; - g_ptcaseList[1].SetupSimpleBacktrackTest(); cptcase++; - g_ptcaseList[2].SetupSurrogateTest(); cptcase++; - g_ptcaseList[3].SetupBurmese1(); cptcase++; - g_ptcaseList[4].SetupBurmese2(); cptcase++; - g_ptcaseList[5].SetupBurmese3(); cptcase++; - g_ptcaseList[6].SetupBurmese4(); cptcase++; - g_ptcaseList[7].SetupRoman(); cptcase++; - g_ptcaseList[8].SetupRomanFeatures(); cptcase++; - g_ptcaseList[9].SetupStackingAndBridging(); cptcase++; - g_ptcaseList[10].SetupNoWhiteSpace(); cptcase++; - g_ptcaseList[11].SetupNoWhiteSpaceNoSeg(); cptcase++; - g_ptcaseList[12].SetupOnlyWhiteSpace(); cptcase++; - g_ptcaseList[13].SetupCrossLine1(); cptcase++; - g_ptcaseList[14].SetupCrossLine2(); cptcase++; - g_ptcaseList[15].SetupCrossLine3(); cptcase++; - g_ptcaseList[16].SetupCrossLine4(); cptcase++; - g_ptcaseList[17].SetupArabic1(); cptcase++; - g_ptcaseList[18].SetupArabic2(); cptcase++; - g_ptcaseList[19].SetupTaiViet1(); cptcase++; - g_ptcaseList[20].SetupTaiViet2(); cptcase++; - g_ptcaseList[21].SetupDumbFallback1(); cptcase++; - g_ptcaseList[22].SetupDumbFallback2(); cptcase++; - g_ptcaseList[23].SetupBadFont(); cptcase++; - g_ptcaseList[24].SetupBugTest(); cptcase++; - // *** Add more method calls here. *** - - assert(cptcase == g_numberOfTests); - - *pptcaseList = g_ptcaseList; - - return g_numberOfTests; -} - -/*---------------------------------------------------------------------------------------------- - Set up a simple test. -----------------------------------------------------------------------------------------------*/ -void TestCase::SetupSimpleTest() -{ - m_testName = "Simple"; - //m_debug = true; - //m_traceLog = true; - //m_skip = true; - - // Input: - m_fontName = L"Graphite Test Roman"; - m_fontFile = "grtest_roman.ttf"; - m_text = L"This is a test."; // text to render - m_fontSize = 12; // font size in points - m_prefBreak = klbWordBreak; // preferred break-weight - m_availWidth = 500; // width available for segment - m_bold = false; - m_italic = false; - m_rtl = false; - m_backtrack = false; - - // Output: - m_segWidth = 86; // physical width of segment - - const int charCnt = 15; // number of characters in the segment - - // need charCnt elements in this array: - bool insPtFlags[] = { - true, true, true, true, true, true, true, true, true, true, - true, true, true, true, true - }; - - const int glyphCnt = 15; // number of glyphs in the segment - - // need glyphCnt elements in these arrays: - gid16 glyphList[] = {55, 75, 76, 86, 3, 76, 86, 3, 68, 3, 87, 72, 86, 87, 17}; - int xPositions[] = { 0, 9, 17, 22, 28, 33, 37, 43, 48, 55, 60, 64, 71, 77, 82}; - int yPositions[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - int advWidths[] = { 9, 8, 4, 6, 4, 4, 6, 4, 7, 4, 4, 7, 6, 4, 4}; - - int bbLefts[] = { 0, 9, 18, 22, 28, 33, 38, 43, 48, 55, 60, 65, 72, 78, 83}; - int bbRights[] = { 9, 17, 21, 27, 33, 37, 43, 48, 55, 60, 64, 71, 77, 82, 85}; - int bbTops[] = {10, 11, 10, 7, 0, 10, 7, 0, 7, 0, 9, 7, 7, 9, 1}; - int bbBottoms[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - - int charsToGlyphs[] = { - 1, 1, 1, 2, 1, 2, 3, 1, 3, 4, 1, 4, 5, 1, 5, 6, 1, 6, 7, 1, 7 - }; - int c2gCount = 21; - - // Each line in clickStuff represents one click test with the following items: - // click x-coord, click y-coord, char index, assoc-prev, - // prim sel Top, prim sel bottom, prim sel left, - // sec sel Top, sec sel bottom, sec sel left - // Y-coordinates are offsets from segment top; ie, (0,0) is segment top-left. - const int clickTestCnt = 3; - int clickStuff[] = { - 11, 25, 1, false, 0, 24, 8, kAbsent, kAbsent, kAbsent, // below baseline - 42, 5, 7, true, 0, 24, 42, kAbsent, kAbsent, kAbsent, // near top of text - 90, 16, 15, true, 0, 24, 85, kAbsent, kAbsent, kAbsent // near baseline - }; - - // Finish setting up test case. - SetCharCount(charCnt); - SetGlyphCount(glyphCnt); - SetGlyphList(glyphList); - SetXPositions(xPositions); - SetYPositions(yPositions); - SetAdvWidths(advWidths); - SetBBs(bbLefts, bbRights, bbTops, bbBottoms); - SetInsPtFlags(insPtFlags); - SetCharsToGlyphs(charsToGlyphs, c2gCount); - SetClickTests(clickTestCnt, clickStuff); -} - -/*---------------------------------------------------------------------------------------------- - Set up a simple test with backtracking. -----------------------------------------------------------------------------------------------*/ -void TestCase::SetupSimpleBacktrackTest() -{ - m_testName = "Simple Backtrack"; - //m_debug = true; - //m_traceLog = true; - //m_skip = true; - - // Input: - m_fontName = L"Graphite Test Roman"; - m_fontFile = "grtest_roman.ttf"; - m_text = L"This is a test."; // text to render - m_fontSize = 12; // font size in points - m_prefBreak = klbWordBreak; // preferred break-weight - m_availWidth = 500; // width available for segment - m_bold = false; - m_italic = false; - m_rtl = false; - m_backtrack = true; - - // Output: - m_segWidth = 55; // physical width of segment - - const int charCnt = 10; // number of characters in the segment - - // need charCnt elements in this array: - bool insPtFlags[] = { - true, true, true, true, true, true, true, true, true, true - }; - - const int glyphCnt = 10; // number of glyphs in the segment - - // need glyphCnt elements in these arrays: - gid16 glyphList[] = {55, 75, 76, 86, 3, 76, 86, 3, 68, 3}; - int xPositions[] = { 0, 9, 17, 22, 28, 33, 37, 43, 48, 55}; - int yPositions[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - int advWidths[] = { 9, 8, 4, 6, 4, 4, 6, 4, 7, 4}; - - const int contextBlockOutSize = 10; - gr::byte contextBlockOut[] = { 15, 1, 0, 0, 0, 0, 0, 0, 0, 0 }; - - // Finish setting up test case. - SetCharCount(charCnt); - SetGlyphCount(glyphCnt); - SetGlyphList(glyphList); - SetXPositions(xPositions); - SetYPositions(yPositions); - SetAdvWidths(advWidths); - SetBBs(NULL, NULL, NULL, NULL); - SetInsPtFlags(insPtFlags); - SetOutputContextBlock(contextBlockOutSize, contextBlockOut); -} - -/*---------------------------------------------------------------------------------------------- - Set up a test that includes surrogates. -----------------------------------------------------------------------------------------------*/ -void TestCase::SetupSurrogateTest() -{ - m_testName = "Surrogates"; - //m_debug = true; - //m_traceLog = true; - //m_skip = true; - - // Input: - m_fontName = L"Graphite Test Roman"; - m_fontFile = "grtest_roman.ttf"; - m_text = L"abXXcdYYe"; // text to render - m_text[2] = 0xD835; - m_text[3] = 0xDD13; - m_text[6] = 0xD835; - m_text[7] = 0xDD10; - m_fontSize = 12; // font size in points - m_prefBreak = klbWordBreak; // preferred break-weight - m_availWidth = 500; // width available for segment - m_bold = false; - m_italic = false; - m_rtl = false; - m_backtrack = false; - - // Output: - m_segWidth = 65; // physical width of segment - - const int charCnt = 9; // number of characters in the segment - - // need charCnt elements in this array: - bool insPtFlags[] = { - true, true, true, false, true, true, true, false, true - }; - - const int glyphCnt = 7; // number of glyphs in the segment - - // need glyphCnt elements in these arrays: - gid16 glyphList[] = {68, 69,1227, 70, 71,1015, 72}; - int xPositions[] = { 0, 7, 15, 27, 34, 42, 58}; - int yPositions[] = { 0, 0, 0, 0, 0, 0, 0}; - int advWidths[] = { 7, 8, 12, 7, 8, 15, 7}; - - int bbLefts[] = { 0, 7, 15, 28, 35, 43, 59}; - int bbRights[] = { 7, 14, 26, 34, 42, 57, 65}; - int bbTops[] = { 7, 11, 10, 7, 11, 10, 7}; - int bbBottoms[] = { 0, 0, -3, 0, 0, 0, 0}; - - int charsToGlyphs[] = { - 0, 1, 0, 1, 1, 1, 2, 1, 2, 3, 0, 4, 1, 3, 5, 1, 4, 6, 1, 5, 7, 0, - 8, 1, 6, - }; - int c2gCount = 25; - - // Each line in clickStuff represents one click test with the following items: - // click x-coord, click y-coord, char index, assoc-prev, - // prim sel Top, prim sel bottom, prim sel left, - // sec sel Top, sec sel bottom, sec sel left - // Y-coordinates are offsets from segment top; ie, (0,0) is segment top-left. - const int clickTestCnt = 3; - int clickStuff[] = { - 17, 25, 2, false, 0, 24, 14, kAbsent, kAbsent, kAbsent, // below baseline - 25, 5, 4, true, 0, 24, 26, kAbsent, kAbsent, kAbsent, // near top of text - 55, 16, 8, true, 0, 24, 57, kAbsent, kAbsent, kAbsent // near baseline - }; - - // Finish setting up test case. - SetCharCount(charCnt); - SetGlyphCount(glyphCnt); - SetGlyphList(glyphList); - SetXPositions(xPositions); - SetYPositions(yPositions); - SetAdvWidths(advWidths); - SetBBs(bbLefts, bbRights, bbTops, bbBottoms); - SetInsPtFlags(insPtFlags); - SetCharsToGlyphs(charsToGlyphs, c2gCount); - SetClickTests(clickTestCnt, clickStuff); -} - -/*---------------------------------------------------------------------------------------------- - A set of tests using Burmese, to test complex positioning and non-white-space - linebreaking. -----------------------------------------------------------------------------------------------*/ -void TestCase::SetupBurmese1() -{ - m_testName = "Burmese 1"; - //m_debug = true; - //m_traceLog = true; - //m_skip = true; - - // Input: - m_fontName = L"Graphite Test Burmese"; - m_fontFile = "grtest_burmese.ttf"; - m_text = BurmeseText(); - m_fontSize = 20; // font size in points - m_prefBreak = klbWordBreak; // preferred break-weight - m_availWidth = 300; // width available for segment - m_bold = false; - m_italic = false; - m_backtrack = false; - - // Output: - m_segWidth = 281; // physical width of segment - - SetupBurmeseAux( - 64, // character count - 45, // glyph count - 5); // number of click-tests - - // Each group = glyph-index, base, number of attached, glyphs, attached-glyph-indices - int attachments[] = { - 0,0,0, 1,1,0, 2,2,2,3,4, 3,2,0, 4,2,0, 5,5,1,6, 6,5,0, 7,7,3,8,9,10, - 8,7,0, 9,7,0, 10,7,0, 11,11,0, 12,12,0, 13,13,0, 14,14,0, 15,15,0, - 16,16,1,17, 17,16,0, 18,18,1,19, 19,18,0, 20,20,1,21, 21,20,0, 22,22,1,23, - 23,22,0, 24,24,0, 25,25,0 - }; - int attCount = sizeof(attachments) / sizeof(int); - SetAttachedClusters(attachments, attCount); - - const int contextBlockOutSize = 11; - gr::byte contextBlockOut[] = { 20, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - SetOutputContextBlock(contextBlockOutSize, contextBlockOut); -} - -void TestCase::SetupBurmese2() -{ - m_testName = "Burmese 2"; - //m_debug = true; - //m_traceLog = true; - //m_skip = true; - - // Input: - m_fontName = L"Graphite Test Burmese"; - m_fontFile = "grtest_burmese.ttf"; - - m_text = BurmeseText(); - m_fontSize = 20; // font size in points - m_prefBreak = klbWordBreak; // preferred break-weight - m_availWidth = 275; // width available for segment - m_bold = false; - m_italic = false; - m_backtrack = false; - - // Output: - m_segWidth = 215; // physical width of segment - - SetupBurmeseAux( - 47, // character count - 33, // glyph count - 3); // number of click-tests - - const int contextBlockOutSize = 11; - gr::byte contextBlockOut[] = { 20, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - SetOutputContextBlock(contextBlockOutSize, contextBlockOut); -} - -void TestCase::SetupBurmese3() -{ - m_testName = "Burmese 3"; - //m_debug = true; - //m_traceLog = true; - //m_skip = true; - - // Input: - m_fontName = L"Graphite Test Burmese"; - m_fontFile = "grtest_burmese.ttf"; - - m_text = BurmeseText(); - m_fontSize = 20; // font size in points - m_prefBreak = klbWordBreak; // preferred break-weight - m_availWidth = 75; // width available for segment - m_bold = false; - m_italic = false; - m_backtrack = false; - - // Output: - m_segWidth = 73; // physical width of segment - - SetupBurmeseAux( - 19, // character count - 13, // glyph count - 2); // number of click-tests - - const int contextBlockOutSize = 11; - gr::byte contextBlockOut[] = { 20, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - SetOutputContextBlock(contextBlockOutSize, contextBlockOut); -} - -void TestCase::SetupBurmese4() -{ - m_testName = "Burmese 4"; - //m_traceLog = true; - //m_debug = true; - //m_skip = true; - - // Input: - m_fontName = L"Graphite Test Burmese"; - m_fontFile = "grtest_burmese.ttf"; - - m_text = BurmeseText(); - m_fontSize = 20; // font size in points - m_prefBreak = klbWsBreak; // preferred break-weight - m_worstBreak = klbHyphenBreak; // worst-case break-weight - m_availWidth = 30; // width available for segment - m_bold = false; - m_italic = false; - m_backtrack = false; - - // Output: - m_noSegment = true; - m_segWidth = 0; // physical width of segment - - SetupBurmeseAux( - 0, // character count - 0, // glyph count - 0); // number of click-tests -} - -void TestCase::SetupBurmeseAux(int charCnt, int glyphCnt, int clickTestCnt) -{ - m_rtl = false; - - // need charCnt elements in this array: - bool insPtFlags[] = { - true, true, false, false, false, true, false, false, false, false, // 0 - 9 - true, false, false, true, false, false, false, true, true, true, // 10 - 19 - true, false, true, true, false, false, true, false, false, false, // 20 - 29 - false, true, false, false, true, false, false, false, true, true, // 30 - 39 - true, true, true, true, true, true, true, true, true, false, // 40 - 49 - true, true, true, false, false, false, true, false, false, true, // 50 - 59 - false, false, false, true - }; - - // need glyphCnt elements in these arrays: - // 0 10 20 30 40 - gid16 glyphList[] = {105,174,158,202,231,162,231,148,223,219,229,248, 3,226,162,173,216,231,177,195,115,231,170,204,243, 3,197,216,172,216, 3,233, 3,226,179,162,216,170,204,158,202,115,231,229, 3}; - int xPositions[] = { 0, 17, 20, 22, 28, 29, 38, 40, 50, 55, 56, 57, 73, 79, 89, 99,102,109,110,111,120,129,130,131,140,143,149,167,174,191,198,205,215,222,232,234,245,252,253,262,264,271,280,278,281}; - int yPositions[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - int advWidths[] = { 17, 2, 9, 4, 0, 10, 0, 17, 2, 0, 0, 15, 6, 10, 10, 2, 7, 0, 10, 9, 9, 0, 10, 7, 2, 6, 17, 7, 17, 7, 6, 10, 6, 10, 13, 10, 7, 10, 7, 9, 4, 9, 0, 0, 6}; - - int bbLefts[] = { 0, 10, 21, 23, 23, 30, 33, 41, 51, 49, 53, 58, 73, 80, 90, 96,100,103,111,109,121,123,131,132,141,143,150,165,175,189,198,206,215,223,233,235,243,253,254,263,265,272,275,275,281}; - int bbRights[] = { 16, 19, 28, 25, 28, 39, 38, 56, 54, 55, 56, 72, 79, 88, 98,101,109,109,119,119,129,129,139,138,142,149,166,173,190,197,205,214,222,231,244,244,251,261,260,271,267,280,280,278,288}; - int bbTops[] = { 7, 7, 7, -1, 15, 7, 15, 7, -1, 15, -2, 15, 0, 7, 7, 7, 7, 15, 7, -1, 7, 15, 7, -1, 7, 0, 7, 7, 7, 7, 0, 7, 0, 7, 16, 7, 7, 7, -1, 7, -1, 7, 15, -2, 0}; - int bbBottoms[] = { 0, -7, -1, -7, 9, 0, 9, 0, -7, 9, -5, 0, 0, 0, 0, -7, 0, 9, -4, -7, 0, 9, 0, -7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -7, 0, 0, 0, -7, -1, -7, 0, 9, -5, 0}; - - // Each group = char-index, number of glyphs, glyph-indices. - int charsToGlyphs[] = { - 0, 1, 0, 1, 1, 1, 2, 1, 1, 3, 1, 1, 4, 1, 1, 5, 1, 2, 6, 1, 3, 7, 1, 3, - 8, 1, 4, 9, 1, 4, 10, 1, 5, 11, 1, 6, 12, 1, 6, 13, 1, 7 - }; - int c2gCount = sizeof(charsToGlyphs) / sizeof(int); - - // Each line in clickStuff represents one click test with the following items: - // click x-coord, click y-coord, char index, assoc-prev, - // prim sel Top, prim sel bottom, prim sel left, - // sec sel Top, sec sel bottom, sec sel left - // Y-coordinates are offsets from segment top; ie, (0,0) is segment top-left. - int clickStuff[] = { - 10, 25, 1, true, 0, 25, 16, kAbsent, kAbsent, kAbsent, - 40, 5, 13, false, 0, 25, 39, kAbsent, kAbsent, kAbsent, - 93, 40, 19, false, 0, 25, 88, 0, 25, 77, - 251, 5, 52, true, 0, 25,251, kAbsent, kAbsent, kAbsent, - 235, 30, 48, false, -1, 27,230, 7, 19,243, - }; - - // Finish setting up test case. - SetCharCount(charCnt); - SetGlyphCount(glyphCnt); - SetGlyphList(glyphList); - SetXPositions(xPositions); - SetYPositions(yPositions); - SetAdvWidths(advWidths); - SetCharsToGlyphs(charsToGlyphs, c2gCount); - SetBBs(bbLefts, bbRights, bbTops, bbBottoms); - SetInsPtFlags(insPtFlags); - SetClickTests(clickTestCnt, clickStuff); -} - -std::wstring TestCase::BurmeseText() -{ - std::wstring strRet; - wchar_t charData[] = { - 0x1000, 0x1039, 0x101a, 0x1039, 0x101d, 0x1014, 0x1039, 0x101f, 0x1039, 0x200c, - 0x1015, 0x1039, 0x200c, 0x1010, 0x102f, 0x102d, 0x1037, 0x104f, 0x0020, 0x1015, - 0x1039, 0x101a, 0x1031, 0x102c, 0x1039, 0x200c, 0x101b, 0x1039, 0x101d, 0x1039, - 0x101f, 0x1004, 0x1039, 0x200c, 0x1019, 0x1039, 0x101f, 0x102f, 0x104a, 0x0020, - 0x101e, 0x102c, 0x101a, 0x102c, 0x0020, 0x1040, 0x0020, 0x1015, 0x1039, 0x101b, - 0x1031, 0x102c, 0x1019, 0x1039, 0x101f, 0x102f, 0x1014, 0x1039, 0x101f, 0x1004, - 0x1039, 0x200c, 0x1037, 0x0020, 0x1021, 0x1031, 0x102c, 0x1004, 0x1039, 0x200c, - 0x1019, 0x1039, 0x101b, 0x1004, 0x1039, 0x200c, 0x1019, 0x1039, 0x101f, 0x102f, - 0x1010, 0x102f, 0x102d, 0x1037, 0x101e, 0x100a, 0x1039, 0x200c, 0x0020, 0x1000, - 0x1039, 0x101a, 0x1039, 0x101d, 0x1014, 0x102f, 0x1039, 0x200c, 0x1015, 0x1039, - 0x200c, 0x1010, 0x102f, 0x102d, 0x1037, 0x104f, 0x0000 - }; - strRet.assign(charData); - return strRet; -} - -/*---------------------------------------------------------------------------------------------- - A set of tests using Roman script, which tests stacking diacritics, many-to-one glyphs, - and features. -----------------------------------------------------------------------------------------------*/ -void TestCase::SetupRoman() -{ - m_testName = "Roman"; - //m_debug = true; - //m_traceLog = true; - //m_skip = true; - - // Input: - m_fontName = L"Graphite Test Roman"; - m_fontFile = "grtest_roman.ttf"; - m_text = RomanText(); // text to render - m_fontSize = 36; // font size in points - m_prefBreak = klbWordBreak; // preferred break-weight - m_availWidth = 500; // width available for segment - m_bold = false; - m_italic = false; - m_rtl = false; - m_backtrack = false; - - // Output: - m_segWidth = 278; // physical width of segment - - const int charCnt = 26; // number of characters in the segment - - // need charCnt elements in this array: - bool insPtFlags[] = { - true, true, true, true, true, true, true, true, true, true, - true, true, true, true, true, true, true, true, true, true, - true, true, true, true, true, true - }; - - const int glyphCnt = 24; // number of glyphs in the segment - - // need glyphCnt elements in these arrays: - // 0 10 20 - gid16 glyphList[] = {72,1815,1768, 83,1789, 86, 74,1943,1956,1926,1061, 68,1777,1755,805,1815, 44,1815, 80,1833,1768,1855,1838,637}; - int xPositions[] = { 0, 23, 23, 21, 41, 45, 64, 88, 98, 112, 116,148, 171, 171,170, 188,183, 203, 199, 230, 230, 230, 230,236}; - int yPositions[] = { 0, 0, 10, 0, -6, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 10, 0, 0, 0, 10, 20, 0}; - int advWidths[] = {21, 0, 0, 24, 0, 18, 24, 13, 13, 4, 31, 21, 0, 0, 13, 0, 15, 0, 37, 0, 0, 0, 0, 41}; - - // Each group = glyph-index, base, number of attached, glyphs, attached-glyph-indices - int attachments[] = { - 0,0,2,1,2, 1,0,0, 2,0,0, 3,3,0, 4,4,0, 5,5,0, 6,6,0, 7,7,2,8,9, - 8,7,0, 9,7,0, 10,10,0, 11,11,2,12,13, 12,11,0, 13,11,0, 14,14,1,15, 15,14,0, - 16,16,1,17, 17,16,0, 18,18,4,19,20,21,22, 19,18,0, 20,18,0, 21,18,0, 22,18,0, - 23,23,0 - }; - int attCount = sizeof(attachments) / sizeof(int); - - // Each line in clickStuff represents one click test with the following items: - // click x-coord, click y-coord, char index, assoc-prev, - // prim sel Top, prim sel bottom, prim sel left, - // sec sel Top, sec sel bottom, sec sel left - // Y-coordinates are offsets from segment top; ie, (0,0) is segment top-left. - const int clickTestCnt = 5; - int clickStuff[] = { - 10, 15, 2, false, 9, 21, 1, 20, 30, 18, - 61, 50, 6, true, 0, 72, 63, kAbsent, kAbsent, kAbsent, - 90, 40, 7, false, 0, 72, 87, kAbsent, kAbsent, kAbsent, - 260, 40, 25, true, 0, 73,263, kAbsent, kAbsent, kAbsent, // ligature - 267, 40, 25, false, 0, 73,263, kAbsent, kAbsent, kAbsent, // ligature - }; - - // Finish setting up test case. - SetCharCount(charCnt); - SetGlyphCount(glyphCnt); - SetGlyphList(glyphList); - SetXPositions(xPositions); - SetYPositions(yPositions); - SetAdvWidths(advWidths); - SetBBs(NULL, NULL, NULL, NULL); - SetAttachedClusters(attachments, attCount); - SetInsPtFlags(insPtFlags); - SetClickTests(clickTestCnt, clickStuff); -} - -void TestCase::SetupRomanFeatures() -{ - m_testName = "Roman Features"; - //m_debug = true; - //m_traceLog = true; - //m_skip = true; - - // Input: - m_fontName = L"Graphite Test Roman"; - m_fontFile = "grtest_roman.ttf"; - m_text = RomanText(); // text to render - m_fontSize = 36; // font size in points - m_prefBreak = klbWordBreak; // preferred break-weight - m_availWidth = 500; // width available for segment - m_bold = false; - m_italic = false; - m_rtl = false; - m_backtrack = false; - - m_fset[0].id = 1024; m_fset[0].value = 2; // capital eng with tail - m_fset[1].id = 1026; m_fset[1].value = 1; // tone numbers - m_fset[2].id = 1029; m_fset[2].value = 1; // vietnamese diacritics - m_fset[3].id = 1032; m_fset[3].value = 1; // literacy alternates - m_fset[4].id = 1034; m_fset[4].value = 1; // y-hook alternate (default) - m_fset[5].id = 1051; m_fset[5].value = 0; // diacritic selection - m_fset[6].id = 0; - - // Output: - m_segWidth = 307; // physical width of segment - - const int charCnt = 26; // number of characters in the segment - - // need charCnt elements in this array: - bool insPtFlags[] = { - true, false, false, true, true, true, true, true, true, true, - true, true, false, false, true, false, true, false, true, false, - false, false, false, true, true, true - }; - - const int glyphCnt = 23; // number of glyphs in the segment - - // need glyphCnt elements in these arrays: - // 0 10 20 - gid16 glyphList[] = {72,1815,1768, 83,1789, 86,681,1659,1667,1662,1056,274,1778, 805,1815, 44,1815, 80,1833,1768,1855,1838,637}; - int xPositions[] = { 0, 23, 23, 21, 41, 45, 64, 87, 104, 121, 138,173, 174, 198, 217, 211, 231, 227, 258, 258, 258, 258,265}; - int yPositions[] = { 0, 0, 10, 0, -6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 10, 20, 0}; - int advWidths[] = {21, 0, 0, 24, 0, 18, 23, 17, 17, 17, 34, 24, 24, 13, 0, 15, 0, 37, 0, 0, 0, 0, 41}; - - // Each line in clickStuff represents one click test with the following items: - // click x-coord, click y-coord, char index, assoc-prev, - // prim sel Top, prim sel bottom, prim sel left, - // sec sel Top, sec sel bottom, sec sel left - // Y-coordinates are offsets from segment top; ie, (0,0) is segment top-left. - const int clickTestCnt = 3; - int clickStuff[] = { - 10, 15, 3, true, 0, 72, 20, kAbsent, kAbsent, kAbsent, - 116, 5, 9, true, 0, 72, 120, kAbsent, kAbsent, kAbsent, - 90, 40, 7, false, 0, 72, 86, kAbsent, kAbsent, kAbsent - }; - - // Finish setting up test case. - SetCharCount(charCnt); - SetGlyphCount(glyphCnt); - SetGlyphList(glyphList); - SetXPositions(xPositions); - SetYPositions(yPositions); - SetAdvWidths(advWidths); - SetBBs(NULL, NULL, NULL, NULL); - SetInsPtFlags(insPtFlags); - SetClickTests(clickTestCnt, clickStuff); -} - -std::wstring TestCase::RomanText() -{ - std::wstring strRet; - wchar_t charData[] = { - 0x0065, 0x0303, 0x0300, 0x0070, 0x0361, 0x0073, 0x0067, 0x02e8, 0x02e5, 0x02e7, - 0x014a, 0x0061, 0x0302, 0x0301, 0x0069, 0x0303, 0x0049, 0x0303, 0x006d, 0x033c, - 0x0300, 0x0308, 0x0304, 0x0066, 0x0066, 0x0069, 0x0000 - }; - strRet.assign(charData); - return strRet; -} - -/*---------------------------------------------------------------------------------------------- - A set of tests for handling complex diacritic stacking and bridging. -----------------------------------------------------------------------------------------------*/ -void TestCase::SetupStackingAndBridging() -{ - m_testName = "Roman Stacking and Bridging"; - //m_debug = true; - //m_traceLog = true; - //m_skip = true; - - // Input: - m_fontName = L"Graphite Test Roman"; - m_fontFile = "grtest_roman.ttf"; - m_fontSize = 36; // font size in points - m_prefBreak = klbWordBreak; // preferred break-weight - m_availWidth = 500; // width available for segment - m_bold = false; - m_italic = false; - m_rtl = false; - m_backtrack = false; - - // text to render - wchar_t charData[] = { - 0x0061,0x035d,0x0061,0x0020,0x0074,0x035d,0x0061,0x0020,0x0061,0x0300, - 0x0300,0x035d,0x0061,0x0020,0x0283,0x0300,0x0300,0x035d,0x0061,0x0020, - 0x0061,0x0316,0x0316,0xf176,0x0061,0x0020,0x0283,0x0300,0x0300,0xf176, - 0x0061,0x0020,0x0061,0x0316,0x0316,0xf176,0x0061,0x0020,0x0283,0x035d, - 0xf176,0x0061,0x0000 - }; - m_text.assign(charData); - - // Output: - m_segWidth = 414; // physical width of segment - - const int charCnt = 42; // number of characters in the segment - - // need charCnt elements in this array: - bool insPtFlags[] = { - true, true, true, true, true, true, true, true, true, true, - true, true, true, true, true, true, true, true, true, true, - true, true, true, true, true, true, true, true, true, true, - true, true, true, true, true, true, true, true, true, true, - true, true, - }; - - const int glyphCnt = 42; // number of glyphs in the segment - - // 68 = a, 97 = t, 1305 = esh, 1768 = upper grave, 1765 = lower grave, 1802 = upper bridge, - // 1801 = lower bridge - - // need glyphCnt elements in these arrays: - // 0 10 20 30 40 - gid16 glyphList[] = {68,1802, 68, 3, 87,1802, 68, 3, 68,1768,1768,1802, 68, 3,1305,1768,1768,1802, 68, 3, 68,1765,1765,1801, 68, 3,1305,1768,1768,1801, 68, 3, 68,1765,1765,1801, 68, 3,1305,1802,1801, 68}; - int xPositions[] = { 0, 21, 21, 42, 56, 73, 69, 91, 105, 127, 127, 126, 126,147, 161, 181, 181, 178,177,199,212, 235, 235, 234,234,255, 269, 289, 289, 286,285,307,320, 343, 343, 342,342,363, 377, 393, 393,393}; - int yPositions[] = { 0, -7, 0, 0, 0, -1, 0, 0, 0, 0, 10, 12, 0, 0, 0, 10, 20, 23, 0, 0, 0, 0, -9, -17, 0, 0, 0, 10, 20, -6, 0, 0, 0, 0, -9, -17, 0, 0, 0, 3, -6, 0}; - int advWidths[] = {21, 0, 21, 13, 13, 0, 21, 13, 21, 0, 0, 0, 21, 13, 16, 0, 0, 0, 21, 13, 21, 0, 0, 0, 21, 13, 16, 0, 0, 0, 21, 13, 21, 0, 0, 0, 21, 13, 16, 0, 0, 21}; - - int bbLefts[] = { 1, 0, 23, 42, 56, 52, 71, 91, 106, 108, 108, 105, 128,147, 159, 162, 162, 157,179,199,214, 217, 217, 213,235,255, 267, 270, 270, 265,287,307,322, 325, 325, 321,343,363, 375, 373, 373,395}; - int bbRights[] = {21, 41, 42, 56, 69, 93, 91,105, 126, 119, 119, 146, 147,161, 178, 173, 173, 198,199,212,234, 228, 228, 254,255,269, 286, 281, 281, 306,306,320,342, 336, 336, 362,363,377, 394, 413, 414,414}; - int bbTops [] = {22, 33, 22, 0, 28, 40, 22, 0, 22, 32, 42, 54, 22, 0, 33, 42, 53, 64, 22, 0, 22, -3, -13, -26, 22, 0, 33, 42, 53, -15, 22, 0, 22, -3, -13, -26, 22, 0, 33, 44, -15, 22}; - int bbBottoms [] = { 0, 26, 0, 0, 0, 33, 0, 0, 0, 24, 34, 47, 0, 0, -10, 34, 44, 57, 0, 0, 0, -11, -21, -32, 0, 0, -10, 34, 44, -21, 0, 0, 0, -11, -21, -32, 0, 0, -10, 38, -21, 0}; - - // Each group = glyph-index, base, number of attached, glyphs, attached-glyph-indices - int attachments[] = { - 0,0,0, 1,1,0, 2,2,0, 3,3,0, 4,4,0, 5,5,0, 6,6,0, 7,7,0, - 8,8,2,9,10, 9,8,0, 10,8,0, 11,11,0, 12,12,0, 13,13,0, 14,14,2,15,16, - 15,14,0, 16,14,0, 17,17,0, 18,18,0, 19,19,0, 20,20,2,21,22, 21,20,0, - 22,20,0, 23,23,0, 24,24,0, 25,25,0, 26,26,2,27,28, 27,26,0, 28,26,0, - 29,29,0, 30,30,0, 31,31,0, 32,32,2,33,34, 33,32,0, 34,32,0, 35,35,0, - 36,36,0, 37,37,0, 38,38,0, 39,39,0, 40,40,0, 41,41,0 - }; - int attCount = sizeof(attachments) / sizeof(int); - - // Each line in clickStuff represents one click test with the following items: - // click x-coord, click y-coord, char index, assoc-prev, - // prim sel Top, prim sel bottom, prim sel left, - // sec sel Top, sec sel bottom, sec sel left - // Y-coordinates are offsets from segment top; ie, (0,0) is segment top-left. - const int clickTestCnt = 6; - int clickStuff[] = { - 109, 25, 9, false, 19, 32, 105, 30, 56, 125, // first grave on 4th a - 178, 26, 15, true, 19, 66, 176, 9, 21, 159, // top of 1st esh, right side - 220, 84, 23, false, 78, 89, 210, 65, 77, 228, // first lower bridge diac - 271, 40, 26, false, 0, 72, 266, kAbsent, kAbsent, kAbsent, // second esh, left side - 271, 65, 26, false, 0, 72, 266, kAbsent, kAbsent, kAbsent, // just below second esh, left side - 271, 68, 29, false, 67, 78, 262, 0, 11, 280 // lower bridge diac under esh, left side - }; - - // Finish setting up test case. - SetCharCount(charCnt); - SetGlyphCount(glyphCnt); - SetGlyphList(glyphList); - SetXPositions(xPositions); - SetYPositions(yPositions); - SetAdvWidths(advWidths); - SetBBs(bbLefts, bbRights, bbTops, bbBottoms); - SetInsPtFlags(insPtFlags); - SetAttachedClusters(attachments, attCount); - SetClickTests(clickTestCnt, clickStuff); -} - -/*---------------------------------------------------------------------------------------------- - A set of tests for handling trailing whitespace. -----------------------------------------------------------------------------------------------*/ -void TestCase::SetupNoWhiteSpace() -{ - m_testName = "No white space"; - //m_debug = true; - //m_traceLog = true; - //m_skip = true; - - // Input: - m_fontName = L"Graphite Test Roman"; - m_fontFile = "grtest_roman.ttf"; - m_text = L"The quick brown fox."; // text to render - m_fontSize = 12; // font size in points - m_prefBreak = klbWordBreak; // preferred break-weight - m_availWidth = 150; // width available for segment - m_bold = false; - m_italic = false; - m_rtl = false; - m_backtrack = false; - m_twsh = ktwshNoWs; - m_paraRtl = true; - - // Output: - m_segWidth = 115; // physical width of segment - - const int charCnt = 16; // number of characters in the segment - - // need charCnt elements in this array: - bool insPtFlags[] = { - true, true, true, true, true, true, true, true, true, true, - true, true, true, true, true, true - }; - - const int glyphCnt = 16; // number of glyphs in the segment - - // need glyphCnt elements in these arrays: - gid16 glyphList[] = {55, 75, 72, 3, 3, 84, 88, 76, 70, 78, 3, 69, 85, 82, 90, 81}; - int xPositions[] = { 0, 9, 17, 24, 29, 34, 42, 50, 54, 61, 69, 74, 82, 87, 95,107}; - int yPositions[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - int advWidths[] = { 9, 8, 7, 4, 4, 8, 8, 4, 7, 8, 4, 8, 5, 8, 11, 8}; - - const int contextBlockOutSize = 10; - gr::byte contextBlockOut[] = { 15, 1, 0, 0, 0, 0, 0, 0, 0, 0 }; - - // Finish setting up test case. - SetCharCount(charCnt); - SetGlyphCount(glyphCnt); - SetGlyphList(glyphList); - SetXPositions(xPositions); - SetYPositions(yPositions); - SetAdvWidths(advWidths); - SetBBs(NULL, NULL, NULL, NULL); - SetInsPtFlags(insPtFlags); - SetClickTests(0, NULL); - SetOutputContextBlock(contextBlockOutSize, contextBlockOut); -} - -void TestCase::SetupNoWhiteSpaceNoSeg() -{ - m_testName = "No white space - no segment"; - //m_debug = true; - //m_traceLog = true; - //m_skip = true; - - // Input: - m_fontName = L"Graphite Test Roman"; - m_fontFile = "grtest_roman.ttf"; - m_text = L"The quick brown fox."; // text to render - m_firstChar = 15; // spaces after brown - m_fontSize = 12; // font size in points - m_prefBreak = klbWordBreak; // preferred break-weight - m_availWidth = 2; // width available for segment - m_bold = false; - m_italic = false; - m_rtl = false; - m_backtrack = false; - m_twsh = ktwshNoWs; - m_paraRtl = true; - - // Output: - m_noSegment = true; - m_segWidth = 0; // physical width of segment - - const int charCnt = 0; // number of characters in the segment - - const int glyphCnt = 0; // number of glyphs in the segment - - // Finish setting up test case. - SetCharCount(charCnt); - SetGlyphCount(glyphCnt); -} - -void TestCase::SetupOnlyWhiteSpace() -{ - m_testName = "Only white space"; - //m_debug = true; - //m_traceLog = true; - //m_skip = true; - - // Input: - m_fontName = L"Graphite Test Roman"; - m_fontFile = "grtest_roman.ttf"; - m_text = L" fox."; // text to render - m_fontSize = 12; // font size in points - m_prefBreak = klbWordBreak; // preferred break-weight - m_availWidth = 2; // width available for segment - m_bold = false; - m_italic = false; - m_rtl = false; - m_backtrack = false; - m_twsh = ktwshOnlyWs; - m_paraRtl = true; - - // Output: - m_segWidth = 0; // physical width of segment - visible - - const int charCnt = 3; // number of characters in the segment - // need charCnt elements in this array: - bool insPtFlags[] = { true, true, true }; - - const int glyphCnt = 3; // number of glyphs in the segment - // need glyphCnt elements in these arrays: - gid16 glyphList[] = { 3, 3, 3 }; - int xPositions[] = { -4, -9,-13 }; - int yPositions[] = { 0, 0, 0 }; - int advWidths[] = { 4, 4, 4 }; - - // TODO: add click tests when the bug fix with upstream tr white space is integrated. - // Each line in clickStuff represents one click test with the following items: - // click x-coord, click y-coord, char index, assoc-prev, - // prim sel Top, prim sel bottom, prim sel left, - // sec sel Top, sec sel bottom, sec sel left - // Y-coordinates are offsets from segment top; ie, (0,0) is segment top-left. - const int clickTestCnt = 6; - int clickStuff[] = { - 2, 25, 0, false, 0, 24, -1, kAbsent, kAbsent, kAbsent, - -1, 5, 0, false, 0, 24, -1, kAbsent, kAbsent, kAbsent, - -6, -3, 1, false, 0, 24, -5, kAbsent, kAbsent, kAbsent, - -8, -3, 2, true, 0, 24, -10, kAbsent, kAbsent, kAbsent, - -13, 40, 3, true, 0, 24, -14, kAbsent, kAbsent, kAbsent, - -18, 0, 3, true, 0, 24, -14, kAbsent, kAbsent, kAbsent - }; - - // Finish setting up test case. - SetCharCount(charCnt); - SetGlyphCount(glyphCnt); - SetGlyphList(glyphList); - SetXPositions(xPositions); - SetYPositions(yPositions); - SetAdvWidths(advWidths); - SetBBs(NULL, NULL, NULL, NULL); - SetInsPtFlags(insPtFlags); - SetClickTests(clickTestCnt, clickStuff); -} - -/*---------------------------------------------------------------------------------------------- - A set of tests of cross-line contextualization. -----------------------------------------------------------------------------------------------*/ -void TestCase::SetupCrossLine1() -{ - m_testName = "Cross-line 1"; - //m_debug = true; - //m_traceLog = true; - //m_skip = true; - - // Input: - m_fontName = L"Graphite Test CrossLine"; - m_fontFile = "grtest_xline.ttf"; - m_text = CrossLineText(); // "abcddddefx@ghijkmmmmn$yopppppqrsss$z@tttwwww"; - m_fontSize = 30; // font size in points - m_prefBreak = klbHyphenBreak; // preferred break-weight - m_availWidth = 350; // width available for segment - m_bold = false; - m_italic = false; - m_rtl = false; - m_backtrack = false; - - // Output: - m_segWidth = 312; // physical width of segment - - const int charCnt = 10; // number of characters in the segment - - // need charCnt elements in this array: - bool insPtFlags[] = { - true, true, true, true, true, true, true, true, true, true - }; - - const int glyphCnt = 13; // number of glyphs in the segment - - // need glyphCnt elements in these arrays: - gid16 glyphList[] = {30, 67, 68, 69, 70, 70, 70, 70, 71, 72, 34, 90, 32 }; - int xPositions[] = { 0, 40, 58, 79, 97,118,139,160,180,199,213,251,272 }; - int yPositions[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - int advWidths[] = {40, 18, 20, 18, 20, 20, 20, 20, 18, 13, 38, 20, 40 }; - - // TODO: add click tests - // Each line in clickStuff represents one click test with the following items: - // click x-coord, click y-coord, char index, assoc-prev, - // prim sel Top, prim sel bottom, prim sel left, - // sec sel Top, sec sel bottom, sec sel left - // Y-coordinates are offsets from segment top; ie, (0,0) is segment top-left. - const int clickTestCnt = 0; - int * clickStuff = NULL; - //int clickStuff[] = ; - //{ - // 10, 25, 1, false, 0, 24, 9, kAbsent, kAbsent, kAbsent, - //}; - - const int contextBlockOutSize = 9; - gr::byte contextBlockOut[] = { 20, 1, 0, 2, 0, 0, 4, 0, 0, 0 }; - - // Finish setting up test case. - SetCharCount(charCnt); - SetGlyphCount(glyphCnt); - SetGlyphList(glyphList); - SetXPositions(xPositions); - SetYPositions(yPositions); - SetAdvWidths(advWidths); - SetBBs(NULL, NULL, NULL, NULL); - SetInsPtFlags(insPtFlags); - SetClickTests(clickTestCnt, clickStuff); - SetOutputContextBlock(contextBlockOutSize, contextBlockOut); -} - -void TestCase::SetupCrossLine2() -{ - m_testName = "Cross-line 2"; - //m_debug = true; - //m_traceLog = true; - //m_skip = true; - - // Input: - m_fontName = L"Graphite Test CrossLine"; - m_fontFile = "grtest_xline.ttf"; - m_text = CrossLineText(); // "abcddddefx@ghijkmmmmn$yopppppqrsss$z@tttwwww"; - m_firstChar = 10; - m_fontSize = 30; // font size in points - m_prefBreak = klbHyphenBreak; // preferred break-weight - m_availWidth = 400; // width available for segment - m_bold = false; - m_italic = false; - m_rtl = false; - m_backtrack = false; - m_initWithPrev = true; - - const int contextBlockInSize = 9; // output from Cross-line 1 - gr::byte contextBlockIn[] = { 20, 1, 0, 2, 0, 0, 4, 0, 0, 0 }; - - // Output: - m_segWidth = 395; // physical width of segment - - const int charCnt = 13; // number of characters in the segment - - // need charCnt elements in this array: - bool insPtFlags[] = { - false, true, true, true, true, true, true, true, true, true, true, true, true - }; - - const int glyphCnt = 15; // number of glyphs in the segment - - // need glyphCnt elements in these arrays: - gid16 glyphList[] = {30, 34, 73, 74, 75, 76, 77, 79, 79, 79, 79, 80, 6, 91, 32 }; - int xPositions[] = { 0, 40, 78, 99,119,131,143,163,196,228,260,293,314,334,355 }; - int yPositions[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - int advWidths[] = {40, 38, 20, 20, 11, 11, 20, 32, 32, 32, 32, 20, 20, 20, 40 }; - - // TODO: add click tests - // Each line in clickStuff represents one click test with the following items: - // click x-coord, click y-coord, char index, assoc-prev, - // prim sel Top, prim sel bottom, prim sel left, - // sec sel Top, sec sel bottom, sec sel left - // Y-coordinates are offsets from segment top; ie, (0,0) is segment top-left. - const int clickTestCnt = 0; - int * clickStuff = NULL; - //int clickStuff[] = ; - //{ - // 10, 25, 1, false, 0, 24, 9, kAbsent, kAbsent, kAbsent, - //}; - - const int contextBlockOutSize = 9; - gr::byte contextBlockOut[] = { 20, 1, 0, 3, 0, 0, 4, 0, 0, 0 }; - - // Finish setting up test case. - SetCharCount(charCnt); - SetGlyphCount(glyphCnt); - SetGlyphList(glyphList); - SetXPositions(xPositions); - SetYPositions(yPositions); - SetAdvWidths(advWidths); - SetBBs(NULL, NULL, NULL, NULL); - SetInsPtFlags(insPtFlags); - SetClickTests(clickTestCnt, clickStuff); - SetInputContextBlock(contextBlockInSize, contextBlockIn); - SetOutputContextBlock(contextBlockOutSize, contextBlockOut); -} - -void TestCase::SetupCrossLine3() -{ - m_testName = "Cross-line 3"; - //m_debug = true; - //m_traceLog = true; - //m_skip = true; - - // Input: - m_fontName = L"Graphite Test CrossLine"; - m_fontFile = "grtest_xline.ttf"; - m_text = CrossLineText(); // "abcddddefx@ghijkmmmmn$yopppppqrsss$z@tttwwww"; - m_firstChar = 23; - m_fontSize = 30; // font size in points - m_prefBreak = klbHyphenBreak; // preferred break-weight - m_availWidth = 400; // width available for segment - m_bold = false; - m_italic = false; - m_rtl = false; - m_backtrack = false; - m_initWithPrev = true; - - const int contextBlockInSize = 9; // output from Cross-line 2 - gr::byte contextBlockIn[] = { 20, 1, 0, 3, 0, 0, 4, 0, 0, 0 }; - - // Output: - m_segWidth = 358; // physical width of segment - - const int charCnt = 13; // number of characters in the segment - - // need charCnt elements in this array: - bool insPtFlags[] = { - true, true, true, true, true, true, true, true, true, true, true, false, true - }; - - const int glyphCnt = 16; // number of glyphs in the segment - - // need glyphCnt elements in these arrays: - gid16 glyphList[] = {30, 81, 6, 82, 82, 82, 82, 82, 83, 84, 85, 85, 85, 34, 8, 92 }; - int xPositions[] = { 0, 40, 60, 81,102,123,144,164,185,206,220,236,253,269,307,339 }; - int yPositions[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - int advWidths[] = {40, 20, 20, 20, 20, 20, 20, 20, 20, 14, 16, 16, 16, 38, 32, 18 }; - - // TODO: add click tests - // Each line in clickStuff represents one click test with the following items: - // click x-coord, click y-coord, char index, assoc-prev, - // prim sel Top, prim sel bottom, prim sel left, - // sec sel Top, sec sel bottom, sec sel left - // Y-coordinates are offsets from segment top; ie, (0,0) is segment top-left. - const int clickTestCnt = 0; - int * clickStuff = NULL; - //int clickStuff[] = ; - //{ - // 10, 25, 1, false, 0, 24, 9, kAbsent, kAbsent, kAbsent, - //}; - - const int contextBlockOutSize = 9; - gr::byte contextBlockOut[] = { 20, 1, 0, 3, 0, 0, 4, 0, 0, 0 }; - - // Finish setting up test case. - SetCharCount(charCnt); - SetGlyphCount(glyphCnt); - SetGlyphList(glyphList); - SetXPositions(xPositions); - SetYPositions(yPositions); - SetAdvWidths(advWidths); - SetBBs(NULL, NULL, NULL, NULL); - SetInsPtFlags(insPtFlags); - SetClickTests(clickTestCnt, clickStuff); - SetInputContextBlock(contextBlockInSize, contextBlockIn); - SetOutputContextBlock(contextBlockOutSize, contextBlockOut); -} - -void TestCase::SetupCrossLine4() -{ - m_testName = "Cross-line 4"; - //m_debug = true; - //m_traceLog = true; - //m_skip = true; - - // Input: - m_fontName = L"Graphite Test CrossLine"; - m_fontFile = "grtest_xline.ttf"; - m_text = CrossLineText(); // "abcddddefx@ghijkmmmmn$yopppppqrsss$z@tttwwww"; - m_firstChar = 36; - m_fontSize = 30; // font size in points - m_prefBreak = klbHyphenBreak; // preferred break-weight - m_availWidth = 400; // width available for segment - m_bold = false; - m_italic = false; - m_rtl = false; - m_backtrack = false; - m_initWithPrev = true; - - const int contextBlockInSize = 9; // output from Cross-line 3 - gr::byte contextBlockIn[] = { 20, 1, 0, 3, 0, 0, 4, 0, 0, 0 }; - - // Output: - m_segWidth = 248; // physical width of segment - - const int charCnt = 8; // number of characters in the segment - - // need charCnt elements in this array: - bool insPtFlags[] = { - false, true, true, true, true, true, true, true - }; - - const int glyphCnt = 10; // number of glyphs in the segment - - // need glyphCnt elements in these arrays: - gid16 glyphList[] = { 8, 6, 86, 86, 86, 89, 89, 89, 89, 32 }; - int xPositions[] = { 0, 32, 53, 64, 76, 87,117,147,177,208 }; - int yPositions[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - int advWidths[] = {32, 20, 11, 11, 11, 30, 30, 30, 30, 40 }; - - // TODO: add click tests - // Each line in clickStuff represents one click test with the following items: - // click x-coord, click y-coord, char index, assoc-prev, - // prim sel Top, prim sel bottom, prim sel left, - // sec sel Top, sec sel bottom, sec sel left - // Y-coordinates are offsets from segment top; ie, (0,0) is segment top-left. - const int clickTestCnt = 0; - int * clickStuff = NULL; - //int clickStuff[] = ; - //{ - // 10, 25, 1, false, 0, 24, 9, kAbsent, kAbsent, kAbsent, - //}; - - const int contextBlockOutSize = 0; - gr::byte * contextBlockOut = NULL; - - // Finish setting up test case. - SetCharCount(charCnt); - SetGlyphCount(glyphCnt); - SetGlyphList(glyphList); - SetXPositions(xPositions); - SetYPositions(yPositions); - SetAdvWidths(advWidths); - SetBBs(NULL, NULL, NULL, NULL); - SetInsPtFlags(insPtFlags); - SetClickTests(clickTestCnt, clickStuff); - SetInputContextBlock(contextBlockInSize, contextBlockIn); - SetOutputContextBlock(contextBlockOutSize, contextBlockOut); -} - -std::wstring TestCase::CrossLineText() -{ - // The equivalent data is in the "xlineTest.wpx" file. - std::wstring strRet; - strRet.assign(L"abcddddefx@ghijkmmmmn$yopppppqrsss$z@tttwwww"); - return strRet; -} - -/*---------------------------------------------------------------------------------------------- - A set of tests using Arabic: RTL, bidi, and embedded direction codes. -----------------------------------------------------------------------------------------------*/ -void TestCase::SetupArabic1() -{ - m_testName = "Arabic 1"; - //m_debug = true; - //m_traceLog = true; - //m_skip = true; - - // Input: - m_fontName = L"Graphite Test Arabic"; - m_fontFile = "grtest_arabic.ttf"; - m_text = ArabicText(); - m_fontSize = 20; // font size in points - m_prefBreak = klbWordBreak; // preferred break-weight - m_availWidth = 1000; // width available for segment - m_bold = false; - m_italic = false; - m_backtrack = false; - - // Output: - m_segWidth = 409; // physical width of segment - - SetupArabicAux( - 61, // character count - 61); // glyph count - - // Each group = glyph-index, base, number of attached, glyphs, attached-glyph-indices - int attachments[] = { - 0,0,0, 1,1,1,2, 2,1,0, 3,3,4,4,5,6,7, 4,3,0, 5,3,0, 6,3,0, 7,3,0, - 8,8,0, 9,9,4,10,11,12,13, 10,9,0, 11,9,0, 12,9,0, 13,9,0, 14,14,0, - 15,15,0, 16,16,1,17, 17,16,0, 18,18,1,19, 19,18,0 // etc - }; - int attCount = sizeof(attachments) / sizeof(int); - SetAttachedClusters(attachments, attCount); - - // Each line in clickStuff represents one click test with the following items: - // click x-coord, click y-coord, char index, assoc-prev, - // prim sel Top, prim sel bottom, prim sel left, - // sec sel Top, sec sel bottom, sec sel left - // Y-coordinates are offsets from segment top; ie, (0,0) is segment top-left. - int clickStuff[] = { - 199, 13, 37, true, 0, 35,196, kAbsent, kAbsent, kAbsent, - 396, 13, 3, false, 8, 26,399, 10, 17, 397, - 396, 8, 6, true, 3, 11,391, 9, 22, 394, - 222, 5, 32, true, 0, 35,225, kAbsent, kAbsent, kAbsent, - 217, 5, 31, false, 0, 35,215, 0, 35, 246, - }; - SetClickTests(4, clickStuff); -} - -void TestCase::SetupArabic2() -{ - m_testName = "Arabic 2"; - //m_debug = true; - //m_traceLog = true; - //m_skip = true; - - // Input: - m_fontName = L"Graphite Test Arabic"; - m_fontFile = "grtest_arabic.ttf"; - m_text = ArabicText(); - m_fontSize = 20; // font size in points - m_prefBreak = klbWordBreak; // preferred break-weight - m_availWidth = 230; // width available for segment-break after number - m_bold = false; - m_italic = false; - m_backtrack = false; - - // Output: - m_segWidth = 193; // physical width of segment - - SetupArabicAux( - 35, // character count - 35); // glyph count - - // The x-positions are different for a shorter segment: - // 0 10 20 30 - int xPositions[] = {188,183,184,177,178,178,170,169,162,150,154,154,153,155,139,132,127,127,115,118,108,102, 84, 77, 77, 72, 65, 46, 46, 37, 31, 20, 10, 0, -6}; - SetXPositions(xPositions); -} - -void TestCase::SetupArabicAux(int charCnt, int glyphCnt) -{ - m_rtl = true; - - // need charCnt elements in this array: - bool insPtFlags[] = { - true, true, true, true, true, true, true, true, true, true, // 0 - 9 - true, true, true, true, true, true, true, true, true, true, // 10 - 19 - true, true, true, true, true, true, true, true, true, true, // 20 - 29 - true, true, true, true, true, true, true, true, true, true, // 30 - 39 - true, true, true, true, true, true, true, true, true, true, // 40 - 49 - true, true, true, true, true, true, true, true, true, true, // 50 - 59 - true - }; - - // need glyphCnt elements in these arrays: - // 0 10 20 30 40 50 60 - gid16 glyphList[] = {785,658,907,1182,913,907,1192,907, 3,811,914,909,911,934,592, 3,785,909,621,911, 12, 3,321, 3,236,659,731,555,925,961, 3,992,991,990, 3,821,924,712,474,882,527, 3,411,924,950, 3,236,990,991,992,993,995,236, 3,821,769,455,290,839,620,961}; - int xPositions[] = {404,400,401, 393,394,394, 386,385,379,366,370,370,370,371,355,348,343,343,331,334,324,318,300,293,293,289,281,263,262,254,247,237,226,216,209,197,197,189,179,172,154,147,135,139,127,120,120,110, 99, 89, 79, 68, 68, 62, 50, 41, 36, 29, 19, 8, 0}; - int yPositions[] = { 0, 0, -5, 0, 0, 4, 0, 0, 0, 0, -5, -3, -2, 4, 0, 0, 0, 1, 0, -3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - int advWidths[] = { 4, 4, 0, 6, 0, 0, 6, 0, 6, 12, 0, 0, 0, 0, 11, 6, 4, 0, 11, 0, 7, 6, 17, 6, 0, 4, 7, 18, 0, 8, 6, 10, 10, 10, 6, 11, 0, 7, 9, 7, 17, 6, 11, 0, 8, 6, 0, 10, 10, 10, 10, 10, 0, 6, 11, 9, 4, 6, 9, 11, 8}; - - // Finish setting up test case. - SetCharCount(charCnt); - SetGlyphCount(glyphCnt); - SetGlyphList(glyphList); - SetXPositions(xPositions); - SetYPositions(yPositions); - SetAdvWidths(advWidths); - SetBBs(NULL, NULL, NULL, NULL); - SetInsPtFlags(insPtFlags); -} - -std::wstring TestCase::ArabicText() -{ - std::wstring strRet; - wchar_t charData[] = { - 0x0628, 0x0628, 0x064e, 0x0644, 0x064e, 0x0654, 0x0627, 0x064e, 0x0020, 0x0686, - 0x0650, 0x0652, 0x0655, 0x06e0, 0x06a8, 0x0020, 0x0628, 0x0650, 0x06b9, 0x0652, - 0x0029, 0x0020, 0x0628, 0x0020, 0x200d, 0x062a, 0x06a8, 0x0633, 0x0670, 0x061b, - 0x0020, 0x06f1, 0x06f2, 0x06f3, 0x0020, 0x0633, 0x0670, 0x0639, 0x062f, 0x0645, - 0x067e, 0x0020, 0x0644, 0x0670, 0x060c, 0x0020, 0x202e, 0x06f1, 0x06f2, 0x06f3, - 0x06f4, 0x06f5, 0x202c, 0x0020, 0x0633, 0x0647, 0x0627, 0x0631, 0x0639, 0x0646, - 0x061b, 0x0000 - }; - strRet.assign(charData); - return strRet; -} - -/*---------------------------------------------------------------------------------------------- - A set of tests that uses Tai Viet script to test positioning. -----------------------------------------------------------------------------------------------*/ -void TestCase::SetupTaiViet1() -{ - m_testName = "Tai Viet Collisions"; - //m_debug = true; - //m_traceLog = true; - //m_skip = true; - - // Input: - m_fontName = L"Graphite Test TaiViet"; - m_fontFile = "grtest_taiviet.ttf"; - m_fontSize = 36; // font size in points - m_prefBreak = klbWordBreak; // preferred break-weight - m_availWidth = 2000; // width available for segment - m_bold = false; - m_italic = false; - m_rtl = false; - m_backtrack = false; - m_text = TaiVietText(); - - m_fset[0].id = 2001; m_fset[0].value = 2; // vowel position = final consonant - m_fset[1].id = 1051; m_fset[1].value = 0; // diacritic selection = off - m_fset[2].id = 2102; m_fset[2].value = 0; // collision avoidance = off - m_fset[3].id = 0; - - // Output: - m_segWidth = 946; // physical width of segment - - const int charCnt = 46; // number of characters in the segment - - // need charCnt elements in this array: - bool insPtFlags[] = { - true, true, false, true, true, true, false, true, true, true, - false, false, true, true, false, true, true, false, false, true, - true, false, false, true, true, false, false, true, true, false, - false, true, true, false, true, true, false, false, true, true, - false, true, true, true, false, false - }; - - const int glyphCnt = 46; // number of glyphs in the segment - - // need glyphCnt elements in these arrays: - // 0 10 20 30 40 - gid16 glyphList[] = {59, 70, 71, 65, 59, 70, 71, 23, 32, 175, 70, 65, 55, 70, 73, 55, 175, 184,185, 55, 76, 184,185, 55, 77, 70, 185, 41, 77, 70, 23, 56,175, 65, 27, 93, 70,185, 53, 69, 81, 50, 27,175, 70, 23}; - int xPositions[] = { 0, 72, 47, 72,101, 174,149,174, 206, 281, 283, 251, 283,352, 316, 352, 418, 425,386,425,493, 495,458, 495,556,559, 528, 559, 623, 623,591,623,706, 676, 706, 776,777,738, 777, 836, 816,843,880,944,946,912}; - int yPositions[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 0, 0, 5, 13, 0, 0, 5, 22, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 19, 0, 0, 8, 0, 0, 0, 5, 21, 0}; - int advWidths[] = {47, 0, 24, 29, 47, 0, 24, 32, 44, 0, 0, 29, 33, 0, 36, 33, 0, 0, 26, 33, 0, 0, 26, 33, 0, 0, 26, 32, 0, 0, 32, 52, 0, 29, 32, 0, 0, 26, 39, 0, 26, 36, 32, 0, 0, 32}; - - int bbLefts[] = { 5, 45, 52, 73,106, 147,154,177, 209, 254, 257, 252, 286,326, 322, 355, 391, 414,390,428,463, 484, 462,498,540,532, 532, 562, 607, 597,594,627,679, 677, 709, 744,751,742, 784, 825, 820,849,883,917,919,915}; - int bbRights[] = {72, 72, 63, 97,174, 174,165,211, 277, 281, 283, 276, 349,352, 355, 419, 418, 422,409,491,494, 491, 481,561,553,559, 551, 621, 620, 623,628,681,706, 701, 756, 776,777,761, 835, 833, 840,882,930,944,946,949}; - int bbTops [] = {60, 50, 25, 25, 60, 50, 25, 41, 60, 49, 66, 25, 60, 50, 40, 60, 55, 65, 36, 60, 56, 74, 36, 60, -5, 55, 36, 60, -5, 50, 41, 40, 49, 25, 55, 56, 69, 36, 55, 61, 41, 40, 55, 55, 71, 41}; - int bbBottoms [] = { 0, 35, 0, 0, 0, 35, 0, 0, 0, 34, 50, 0, 0, 35, 0, 0, 39, 51, 0, 0, 40, 60, 0, 0,-27, 40, 0, 0, -27, 35, 0, 0, 34, 0, 0, 40, 54, 0, 0, 45, 0, 0, 0, 39, 56, 0}; - - // Each group = glyph-index, base, number of attached, glyphs, attached-glyph-indices - int attachments[] = { - 0,0,0, 1,2,0, 2,2,1,1, 3,3,0, 4,4,0, 5,6,0, 6,6,1,5, 7,7,0, - 8,8,0, 9,11,0, 10,11,0, 11,11,2,9,10, 12,12,0, 13,14,0, 14,14,1,13, - 15,15,0, 16,18,0, 17,18,0, 18,18,2,16,17, 19,19,0, 20,22,0, 21,22,0, - 22,22,2,20,21, 23,23,0, 24,26,0, 25,26,0, 26,26,2,24,25, 27,27,0, 28,30,0, - 29,30,0, 30,30,2,28,29, 31,31,0, 32,33,0, 33,33,1,32, 34,34,0, 35,37,0, - 36,37,0, 37,37,2,35,36, 38,38,0, 39,40,0, 40,40,1,39, 41,41,0, 42,42,0, - 43,45,0, 44,45,0, 45,45,2,43,44 - }; - int attCount = sizeof(attachments) / sizeof(int); - - // Each line in clickStuff represents one click test with the following items: - // click x-coord, click y-coord, char index, assoc-prev, - // prim sel Top, prim sel bottom, prim sel left, - // sec sel Top, sec sel bottom, sec sel left - // Y-coordinates are offsets from segment top; ie, (0,0) is segment top-left. - const int clickTestCnt = 4; - int clickStuff[] = { - 55, 40, 1, true, 0,100, 46, kAbsent, kAbsent, kAbsent, - 65, 20, 1, false, 0,100, 46, kAbsent, kAbsent, kAbsent, // adjust to the left to get a valid IP? - 95, 84, 4, true, 0,100, 100, kAbsent, kAbsent, kAbsent, - 104, 40, 4, false, 0,100, 100, kAbsent, kAbsent, kAbsent - }; - - // Finish setting up test case. - SetCharCount(charCnt); - SetGlyphCount(glyphCnt); - SetGlyphList(glyphList); - SetXPositions(xPositions); - SetYPositions(yPositions); - SetAdvWidths(advWidths); - SetBBs(bbLefts, bbRights, bbTops, bbBottoms); - SetInsPtFlags(insPtFlags); - SetAttachedClusters(attachments, attCount); - SetClickTests(clickTestCnt, clickStuff); -} - -/*---------------------------------------------------------------------------------------------- - A set of tests that uses Tai Viet script to test positioning. -----------------------------------------------------------------------------------------------*/ -void TestCase::SetupTaiViet2() -{ - m_testName = "Tai Viet No Collisions"; - //m_debug = true; - //m_traceLog = true; - //m_skip = true; - - // Input: - m_fontName = L"Graphite Test TaiViet"; - m_fontFile = "grtest_taiviet.ttf"; - m_fontSize = 36; // font size in points - m_prefBreak = klbWordBreak; // preferred break-weight - m_availWidth = 2000; // width available for segment - m_bold = false; - m_italic = false; - m_rtl = false; - m_backtrack = false; - m_text = TaiVietText(); - - m_fset[0].id = 2001; m_fset[0].value = 2; // vowel position = final consonant - m_fset[1].id = 1051; m_fset[1].value = 1; // diacritic selection = on - m_fset[2].id = 2102; m_fset[2].value = 1; // collision avoidance = off - m_fset[3].id = 0; - - // Output: - m_segWidth = 947; // physical width of segment - - const int charCnt = 46; // number of characters in the segment - - // need charCnt elements in this array: - bool insPtFlags[] = { - true, true, true, true, true, true, true, true, true, true, - true, true, true, true, true, true, true, true, true, true, - true, true, true, true, true, true, true, true, true, true, - true, true, true, true, true, true, true, true, true, true, - true, true, true, true, true, true - }; - - const int glyphCnt = 46; // number of glyphs in the segment - - // need glyphCnt elements in these arrays: - // 0 10 20 30 40 - gid16 glyphList[] = {59, 70, 71, 65, 59, 70, 71, 23, 32, 175, 70, 65, 55, 70, 73, 55, 175, 184,185, 55, 76, 184,185, 55, 77, 70, 185, 41, 77, 70, 23, 56,175, 65, 27, 93, 70,185, 53, 69, 81, 50, 27,175, 70, 23}; - int xPositions[] = { 0, 82, 47, 72,101, 184,149,174, 206, 281, 283, 251, 283,359, 316, 352, 418, 431,386,425,496, 508,458, 497,559,578, 530, 561, 626, 635,593,626,709, 678, 708, 778,780,740, 780, 853, 819,846,882,942,947,914}; - int yPositions[] = { 0, -3, 0, 0, 0, -3, 0, 0, 0, 0, 22, 0, 0, 0, 0, 0, 0, 9, 0, 0, 2, 20, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, -4, 0, 0, 5, 25, 0, 0, 8, 0, 0, 0, 0, 23, 0}; - int advWidths[] = {47, 0, 24, 29, 47, 0, 24, 32, 44, 0, 0, 29, 33, 0, 36, 33, 0, 0, 26, 33, 0, 0, 26, 33, 0, 0, 26, 32, 0, 0, 32, 52, 0, 29, 32, 0, 0, 26, 39, 0, 26, 36, 32, 0, 0, 32}; - - int bbLefts[] = { 5, 56, 52, 73,106, 158,154,177, 209, 254, 257, 252, 286,333, 322, 355, 391, 420,390,428,466, 497, 462,500,542,552, 534, 564, 609, 609,597,629,682, 679, 711, 747,753,744, 786, 842, 823,851,885,916,921,918}; - int bbRights[] = {72, 82, 63, 97,174, 184,165,211, 277, 281, 283, 276, 349,359, 355, 419, 418, 427,409,491,496, 504, 481,564,555,578, 553, 624, 622, 635,630,684,709, 703, 758, 778,780,763, 837, 850, 842,885,932,942,947,951}; - int bbTops [] = {60, 46, 25, 25, 60, 46, 25, 41, 60, 49, 73, 25, 60, 50, 40, 60, 50, 60, 36, 60, 54, 72, 36, 60, -5, 52, 36, 60, -5, 50, 41, 40, 45, 25, 55, 56, 75, 36, 55, 61, 41, 40, 55, 50, 73, 41}; - int bbBottoms [] = { 0, 31, 0, 0, 0, 31, 0, 0, 0, 34, 57, 0, 0, 35, 0, 0, 34, 46, 0, 0, 37, 57, 0, 0,-27, 36, 0, 0, -27, 35, 0, 0, 29, 0, 0, 40, 60, 0, 0, 45, 0, 0, 0, 34, 58, 0}; - - // Each group = glyph-index, base, number of attached, glyphs, attached-glyph-indices - int attachments[] = { - 0,0,0, 1,2,0, 2,2,1,1, 3,3,0, 4,4,0, 5,6,0, 6,6,1,5, 7,7,0, - 8,8,0, 9,11,0, 10,11,0, 11,11,2,9,10, 12,12,0, 13,14,0, 14,14,1,13, - 15,15,0, 16,18,0, 17,18,0, 18,18,2,16,17, 19,19,0, 20,22,0, 21,22,0, - 22,22,2,20,21, 23,23,0, 24,26,0, 25,26,0, 26,26,2,24,25, 27,27,0, 28,30,0, - 29,30,0, 30,30,2,28,29, 31,31,0, 32,33,0, 33,33,1,32, 34,34,0, 35,37,0, - 36,37,0, 37,37,2,35,36, 38,38,0, 39,40,0, 40,40,1,39, 41,41,0, 42,42,0, - 43,45,0, 44,45,0, 45,45,2,43,44 - }; - int attCount = sizeof(attachments) / sizeof(int); - - // Each line in clickStuff represents one click test with the following items: - // click x-coord, click y-coord, char index, assoc-prev, - // prim sel top, prim sel bottom, prim sel left, - // sec sel top, sec sel bottom, sec sel left - // Y-coordinates are offsets from segment top; ie, (0,0) is segment top-left. - const int clickTestCnt = 4; - int clickStuff[] = { - 55, 40, 2, false, 35, 65, 49, 14, 33, 82, - 65, 20, 1, false, 0,100, 50, kAbsent, kAbsent, kAbsent, - 95, 84, 4, true, 0,100, 100, kAbsent, kAbsent, kAbsent, - 104, 40, 4, false, 0,100, 100, kAbsent, kAbsent, kAbsent - }; - - // Finish setting up test case. - SetCharCount(charCnt); - SetGlyphCount(glyphCnt); - SetGlyphList(glyphList); - SetXPositions(xPositions); - SetYPositions(yPositions); - SetAdvWidths(advWidths); - SetBBs(bbLefts, bbRights, bbTops, bbBottoms); - SetInsPtFlags(insPtFlags); - SetAttachedClusters(attachments, attCount); - SetClickTests(clickTestCnt, clickStuff); -} - -std::wstring TestCase::TaiVietText() -{ - std::wstring strRet; - wchar_t charData[] = { - 0xe00f,0xe042,0xe031,0xe02b,0xe00f,0xe042,0xe031,0xe025,0xe021,0xe033, - 0xe042,0xe02b,0xe01c,0xe042,0xe03e,0xe01c,0xe033,0xe040,0xe009,0xe01c, - 0xe039,0xe040,0xe009,0xe01c,0xe035,0xe042,0xe009,0xe024,0xe035,0xe042, - 0xe025,0xe01b,0xe033,0xe02b,0xe00a,0xe030,0xe042,0xe009,0xe01e,0xe040, - 0xe03b,0xe019,0xe00a,0xe033,0xe042,0xe025,0x0000 - }; - strRet.assign(charData); - return strRet; -} - -/*---------------------------------------------------------------------------------------------- - Set up a test where the font is bad and we revert to dumb rendering -----------------------------------------------------------------------------------------------*/ -void TestCase::SetupDumbFallback1() -{ - m_testName = "Dumb Fallback 1"; - //m_debug = true; - //m_traceLog = true; - //m_skip = true; - - // Input: - m_fontName = L"GrErr BadVersion"; - m_fontFile = "grtest_badVersion.ttf"; - m_text = RomanText(); // text to render - m_fontSize = 12; // font size in points - m_prefBreak = klbWordBreak; // preferred break-weight - m_availWidth = 500; // width available for segment - m_bold = false; - m_italic = false; - m_rtl = false; - m_backtrack = false; - m_dumbFallback = true; - - // Output: - m_badFont = true; - m_segWidth = 196; // physical width of segment - - const int charCnt = 26; // number of characters in the segment - - // need charCnt elements in this array: - bool insPtFlags[] = { - true, true, true, true, true, true, true, true, true, true, - true, true, true, true, true, true, true, true, true, true, - true, true, true, true, true, true - }; - - const int glyphCnt = 26; // number of glyphs in the segment - - // need glyphCnt elements in these arrays: - // 0 10 20 - gid16 glyphList[] = {71, 0, 0, 82, 0, 85, 73, 0, 0, 0, 0, 67, 0, 0, 75, 0, 43, 0, 79, 0, 0, 0, 0, 72, 72, 75}; - int xPositions[] = { 0, 7, 15, 23, 31, 39, 46, 54, 62, 70, 78, 86, 93,101,109,114,122,128,136,149,157,165,173,181,186,192}; - int yPositions[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - int advWidths[] = { 7, 8, 8, 8, 8, 6, 8, 8, 8, 8, 8, 7, 8, 8, 4, 8, 5, 8, 12, 8, 8, 8, 8, 5, 5, 4}; - - const int clickTestCnt = 0; - int * clickStuff = NULL; - - // Finish setting up test case. - SetCharCount(charCnt); - SetGlyphCount(glyphCnt); - SetGlyphList(glyphList); - SetXPositions(xPositions); - SetYPositions(yPositions); - SetAdvWidths(advWidths); - SetBBs(NULL, NULL, NULL, NULL); - SetInsPtFlags(insPtFlags); - SetClickTests(clickTestCnt, clickStuff); -} - -/*---------------------------------------------------------------------------------------------- - Now make sure we will get a crash when we turn dumb rendering off for the same font. -----------------------------------------------------------------------------------------------*/ -void TestCase::SetupDumbFallback2() -{ - m_testName = "Dumb Fallback 2"; - //m_debug = true; - //m_traceLog = true; - //m_skip = true; - - // Input: - m_fontName = L"GrErr BadVersion"; - m_fontFile = "grtest_badVersion.ttf"; - m_text = L"This is a test."; // text to render - m_fontSize = 12; // font size in points - m_prefBreak = klbWordBreak; // preferred break-weight - m_availWidth = 500; // width available for segment - m_bold = false; - m_italic = false; - m_rtl = false; - m_backtrack = false; - m_dumbFallback = false; - - // Output: - m_badFont = true; - m_noSegment = true; - m_segWidth = 0; // physical width of segment - - const int charCnt = 0; // number of characters in the segment - - const int glyphCnt = 0; // number of glyphs in the segment - - // Finish setting up test case. - SetCharCount(charCnt); - SetGlyphCount(glyphCnt); -} - -/*---------------------------------------------------------------------------------------------- - Now make sure we will get a crash when we turn dumb rendering off for the same font. -----------------------------------------------------------------------------------------------*/ -void TestCase::SetupBadFont() -{ - m_testName = "Bad Font"; - //m_debug = true; - //m_traceLog = true; - m_skip = true; - - // Input: - // The font has been corrupted so that the size of the cmap in the directory is invalid. - m_fontName = L"Graphite Test Roman"; - m_fontFile = "grtest_badCmap.ttf"; - m_text = L"This is a test."; // text to render - m_fontSize = 12; // font size in points - m_prefBreak = klbWordBreak; // preferred break-weight - m_availWidth = 500; // width available for segment - m_bold = false; - m_italic = false; - m_rtl = false; - m_backtrack = false; - m_dumbFallback = true; // wants to do dumb fall-back, but can't because the font is totally invalid - - // Output: - m_badFont = true; - m_noSegment = true; - m_segWidth = 0; // physical width of segment - - const int charCnt = 0; // number of characters in the segment - - const int glyphCnt = 0; // number of glyphs in the segment - - // Finish setting up test case. - SetCharCount(charCnt); - SetGlyphCount(glyphCnt); -} -// *** Add more methods here. *** - - -//:>******************************************************************************************** -//:> Utility methods. -//:>******************************************************************************************** - -/*---------------------------------------------------------------------------------------------- - Delete the list of tests. -----------------------------------------------------------------------------------------------*/ -void TestCase::DeleteTests() -{ - delete[] g_ptcaseList; -} - -/*---------------------------------------------------------------------------------------------- - Constructor: initialize test case with default values. -----------------------------------------------------------------------------------------------*/ -TestCase::TestCase() -{ - m_testName = "Unknown"; - m_debug = false; - m_traceLog = false; - m_skip = false; - - m_fontName.erase(); - m_fontFile.erase(); - m_text.erase(); // text to render - m_fontSize = 12; // font size in points - m_prefBreak = klbWordBreak; // preferred break-weight - m_worstBreak = klbClipBreak; // worst-case break-weight - m_availWidth = 500; // width available for segment - m_bold = false; - m_italic = false; - m_backtrack = false; - m_twsh = ktwshAll; - m_paraRtl = false; - m_firstChar = 0; - m_contextBlockInSize = 0; - m_contextBlockIn = NULL; - m_initWithPrev = false; - memset(m_fset, 0, MAXFEAT * sizeof(FeatureSetting)); - m_dumbFallback = true; - - m_badFont = false; - m_noSegment = false; // yes, a segment should be generated - m_charCount = 0; - m_glyphCount = 0; - m_glyphArray = NULL; - m_xPositions = NULL; - m_yPositions = NULL; - m_advWidths = NULL; - m_bbLefts = NULL; - m_bbRights = NULL; - m_bbTops = NULL; - m_bbBottoms = NULL; - m_insPointFlags = NULL; - m_charsToGlyphs = NULL; - m_c2gCount = 0; - m_attGlyphs = NULL; - m_attGCount = 0; - m_contextBlockOutSize = 0; - m_contextBlockOut = NULL; - - m_clickTestCount = 0; - m_clickTests = NULL; -} - -/*---------------------------------------------------------------------------------------------- - Destructor. -----------------------------------------------------------------------------------------------*/ -TestCase::~TestCase() -{ - delete[] m_glyphArray; - delete[] m_xPositions; - delete[] m_yPositions; - delete[] m_advWidths; - delete[] m_bbLefts; - delete[] m_bbRights; - delete[] m_bbTops; - delete[] m_bbBottoms; - delete[] m_insPointFlags; - delete[] m_charsToGlyphs; - delete[] m_attGlyphs; - delete[] m_clickTests; - delete[] m_contextBlockIn; - delete[] m_contextBlockOut; -} - -/*---------------------------------------------------------------------------------------------- - Setters. -----------------------------------------------------------------------------------------------*/ -void TestCase::SetCharCount(int charCount) -{ - m_charCount = charCount; - m_insPointFlags = new bool[charCount]; -} - -void TestCase::SetGlyphCount(int glyphCount) -{ - m_glyphCount = glyphCount; - m_glyphArray = new gid16[glyphCount]; - m_xPositions = new int[glyphCount]; - m_yPositions = new int[glyphCount]; - m_advWidths = new int[glyphCount]; - m_bbLefts = new int[glyphCount]; - m_bbRights = new int[glyphCount]; - m_bbTops = new int[glyphCount]; - m_bbBottoms = new int[glyphCount]; -} - -void TestCase::SetGlyphList(gid16 * glyphList) -{ - for (int i = 0; i < m_glyphCount; i++) - m_glyphArray[i] = glyphList[i]; -} - -void TestCase::SetXPositions(int * xPosList) -{ - for (int i = 0; i < m_glyphCount; i++) - m_xPositions[i] = xPosList[i]; -} - -void TestCase::SetYPositions(int * yPosList) -{ - for (int i = 0; i < m_glyphCount; i++) - m_yPositions[i] = yPosList[i]; -} - -void TestCase::SetAdvWidths(int * advWidths) -{ - for (int i = 0; i < m_glyphCount; i++) - m_advWidths[i] = advWidths[i]; -} - -void TestCase::SetBBs(int * bbLefts, int * bbRights, int * bbTops, int * bbBottoms) -{ - if (bbLefts == NULL) // no bb tests - { - delete[] m_bbLefts; - delete[] m_bbRights; - delete[] m_bbTops; - delete[] m_bbBottoms; - m_bbLefts = NULL; - m_bbRights = NULL; - m_bbTops = NULL; - m_bbBottoms = NULL; - return; - } - - for (int i = 0; i < m_glyphCount; i++) - { - m_bbLefts[i] = bbLefts[i]; - m_bbRights[i] = bbRights[i]; - m_bbTops[i] = bbTops[i]; - m_bbBottoms[i] = bbBottoms[i]; - } -} - -void TestCase::SetInsPtFlags(bool * flags) -{ - for (int i = 0; i < m_charCount; i++) - m_insPointFlags[i] = flags[i]; -} - -void TestCase::SetCharsToGlyphs(int * stuff, int count) -{ - m_c2gCount = count; - m_charsToGlyphs = new int[count]; - for (int i = 0; i < count; i++) - m_charsToGlyphs[i] = stuff[i]; -} - -void TestCase::SetAttachedClusters(int * stuff, int count) -{ - m_attGCount = count; - m_attGlyphs = new int[count]; - for (int i = 0; i < count; i++) - m_attGlyphs[i] = stuff[i]; -} - -const int ClickTest::fieldCnt; -void TestCase::SetClickTests(int clickTestCount, int * clickStuff) -{ - const int fc = ClickTest::fieldCnt; - - m_clickTestCount = clickTestCount; - m_clickTests = new ClickTest[clickTestCount]; - for (int i = 0; i < clickTestCount; i++) - { - m_clickTests[i].xClick = clickStuff[(i * fc) + 0]; - m_clickTests[i].yClick = clickStuff[(i * fc) + 1]; - m_clickTests[i].charIndex = clickStuff[(i * fc) + 2]; - m_clickTests[i].assocPrev = clickStuff[(i * fc) + 3]; - m_clickTests[i].sel1Top = clickStuff[(i * fc) + 4]; - m_clickTests[i].sel1Bottom = clickStuff[(i * fc) + 5]; - m_clickTests[i].sel1Left = clickStuff[(i * fc) + 6]; - m_clickTests[i].sel2Top = clickStuff[(i * fc) + 7]; - m_clickTests[i].sel2Bottom = clickStuff[(i * fc) + 8]; - m_clickTests[i].sel2Left = clickStuff[(i * fc) + 9]; - } -} - -void TestCase::SetInputContextBlock(int contextBlockInSize, gr::byte * pContextBlockIn) -{ - m_contextBlockInSize = contextBlockInSize; - if (contextBlockInSize == 0) - { - m_contextBlockIn = NULL; - } - else - { - m_contextBlockIn = new gr::byte[contextBlockInSize]; - std::copy(pContextBlockIn, pContextBlockIn + contextBlockInSize, m_contextBlockIn); - } -} - -void TestCase::SetOutputContextBlock(int contextBlockOutSize, gr::byte * pContextBlockOut) -{ - m_contextBlockOutSize = contextBlockOutSize; - m_contextBlockOut = new gr::byte[contextBlockOutSize]; - std::copy(pContextBlockOut, pContextBlockOut + contextBlockOutSize, m_contextBlockOut); -} - - - - -void TestCase::SetupBugTest() -{ - m_testName = "Bug Test"; - m_traceLog = true; - //m_debug = true; - m_skip = true; - - // Input: - m_fontName = L"Padauk"; - m_fontFile = "grtest_infinity.ttf"; - - wchar_t charData[] = { 0x101e, 0x1032, 0x1015, 0x103c, 0x103d, 0x103e, 0x102d, 0x1038, 0x0000 }; - m_text.assign(charData); - int charCnt = 8; - - m_fontSize = 20; // font size in points - m_prefBreak = klbWsBreak; // preferred break-weight - m_worstBreak = klbHyphenBreak; // worst-case break-weight - m_availWidth = 1000; // width available for segment - m_bold = false; - m_italic = false; - m_backtrack = false; - m_rtl = false; - - // Output: - m_noSegment = false; - m_segWidth = 52; // physical width of segment - - // need charCnt elements in this array: - bool insPtFlags[] = { - true, false, true, true, false, false, false, true - }; - - int glyphCnt = 7; - // need glyphCnt elements in these arrays: - gid16 glyphList[] = {105,174,158,202,231,162,231}; - int xPositions[] = { 0, 17, 20, 22, 28, 29, 38}; - int yPositions[] = { 0, 0, 0, 0, 0, 0, 0}; - int advWidths[] = { 17, 2, 9, 4, 0, 10, 0}; - - int bbLefts[] = { 0, 10, 21, 23, 23, 30, 33}; - int bbRights[] = { 16, 19, 28, 25, 28, 39, 38}; - int bbTops[] = { 7, 7, 7, -1, 15, 7, 15}; - int bbBottoms[] = { 0, -7, -1, -7, 9, 0, 9}; - - // Each group = char-index, number of glyphs, glyph-indices. - int charsToGlyphs[] = { - 0, 1, 0, 1, 1, 1, 2, 1, 3, 3, 1, 2, 4, 1, 4, 5, 0, 6, 1, 5, 7, 1, 6 - }; - int c2gCount = sizeof(charsToGlyphs) / sizeof(int); - - // Finish setting up test case. - SetCharCount(charCnt); - SetGlyphCount(glyphCnt); - SetGlyphList(glyphList); - SetXPositions(xPositions); - SetYPositions(yPositions); - SetAdvWidths(advWidths); - SetCharsToGlyphs(charsToGlyphs, c2gCount); - SetBBs(bbLefts, bbRights, bbTops, bbBottoms); - SetInsPtFlags(insPtFlags); -} diff --git a/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/TestCase.h b/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/TestCase.h deleted file mode 100644 index 68258929a1f..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/TestCase.h +++ /dev/null @@ -1,245 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 2004 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: TestCase.h -Responsibility: Sharon Correll -Last reviewed: Not yet. - -Description: - Definition of TestCase class for Graphite regression test program. --------------------------------------------------------------------------------*//*:End Ignore*/ - -#ifdef _MSC_VER -#pragma once -#endif -#ifndef TESTCASE_H -#define TESTCASE_H 1 - -#define NO_EXCEPTIONS 1 - -class TestCase -{ -public: - // Methods to set up test cases. - void SetupSimpleTest(); - void SetupSimpleBacktrackTest(); - void SetupSurrogateTest(); // TODO: add a test for UTF-8 - void SetupBurmese1(); - void SetupBurmese2(); - void SetupBurmese3(); - void SetupBurmese4(); - void SetupRoman(); - void SetupRomanFeatures(); - void SetupStackingAndBridging(); - void SetupNoWhiteSpace(); - void SetupNoWhiteSpaceNoSeg(); - void SetupOnlyWhiteSpace(); - void SetupCrossLine1(); - void SetupCrossLine2(); - void SetupCrossLine3(); - void SetupCrossLine4(); - void SetupArabic1(); - void SetupArabic2(); - void SetupTaiViet1(); - void SetupTaiViet2(); - void SetupDumbFallback1(); - void SetupDumbFallback2(); - void SetupBadFont(); - void SetupBugTest(); - // *** Add more methods here. *** - -protected: - // Auxiliary functions to set up test cases. - void SetupBurmeseAux(int charCount, int glyphCount, int clickTestCount); - void SetupArabicAux(int charCount, int glyphCount); - std::wstring BurmeseText(); - std::wstring RomanText(); - std::wstring CrossLineText(); - std::wstring ArabicText(); - std::wstring TaiVietText(); - -public: - const static int kAbsent = -100; // not present in data - -public: - // constructor: - TestCase(); - // destructor: - ~TestCase(); - - static int SetupTests(TestCase **); - static void DeleteTests(); - - // Getters: - std::string TestName() { return m_testName; } - bool RunDebugger() { return m_debug; } - bool TraceLog() { return m_traceLog; } - bool Skip() { return m_skip; } - - std::wstring Text() { return m_text; } - std::wstring FontName() { return m_fontName; } - std::string FontFile() { return m_fontFile; } - size_t FontSize() { return m_fontSize; } - LineBrk PrefBreak() { return m_prefBreak; } - LineBrk WorstBreak() { return m_worstBreak; } - int FeatureID(int i) { return m_fset[i].id; } - int FeatureValue(int i) { return m_fset[i].value; } - FeatureSetting * Features() { return m_fset; } - int AvailWidth() { return m_availWidth; } - bool Backtrack() { return m_backtrack; } - TrWsHandling Twsh() { return m_twsh; } - bool Rtl() { return m_rtl; } - bool ParaRtl() { return m_paraRtl; } - size_t FirstChar() { return m_firstChar; } - bool DumbFallback() { return m_dumbFallback; } - size_t InputContextBlock(gr::byte ** ppContextBlock) - { - *ppContextBlock = m_contextBlockIn; - return m_contextBlockInSize; - } - - bool InitWithPrevSeg() { return m_initWithPrev; } - bool BadFont() { return m_badFont; } - bool NoSegment() { return m_noSegment; } - int SegWidth() { return m_segWidth; } - int CharCount() { return m_charCount; } - int GlyphCount() { return m_glyphCount; } - - int GlyphID(int i) { return m_glyphArray[i]; } - int XPos(int i) { return m_xPositions[i]; } - int YPos(int i) { return m_yPositions[i]; } - int AdvWidth(int i) { return m_advWidths[i]; } - int BbLeft(int i) { return m_bbLefts[i]; } - int BbRight(int i) { return m_bbRights[i]; } - int BbTop(int i) { return m_bbTops[i]; } - int BbBottom(int i) { return m_bbBottoms[i]; } - bool BbTests() { return (m_bbLefts != NULL); } - - int InsPtFlag(int i) { return m_insPointFlags[i]; } - - int CharToGlyphCount() { return m_c2gCount; } - int CharToGlyphItem(int i) { return m_charsToGlyphs[i]; } - int AttachedGlyphCount() { return m_attGCount; } // that is, the lenght of the data - int AttachedGlyphItem(int i) { return m_attGlyphs[i]; } - - int NumberOfClickTests() { return m_clickTestCount; } - int XClick(int i) { return m_clickTests[i].xClick; } - int YClick(int i) { return m_clickTests[i].yClick; } - int ClickCharIndex(int i) { return m_clickTests[i].charIndex; } - bool ClickAssocPrev(int i) { return (bool)m_clickTests[i].assocPrev; } - int Sel1Top(int i) { return m_clickTests[i].sel1Top; } - int Sel1Bottom(int i) { return m_clickTests[i].sel1Bottom; } - int Sel1Left(int i) { return m_clickTests[i].sel1Left; } - int Sel2Top(int i) { return m_clickTests[i].sel2Top; } - int Sel2Bottom(int i) { return m_clickTests[i].sel2Bottom; } - int Sel2Left(int i) { return m_clickTests[i].sel2Left; } - size_t OutputContextBlockSize() { return m_contextBlockOutSize; } - bool CompareContextBlock(gr::byte * pResult) - { - for (size_t i = 0; i < m_contextBlockOutSize; i++) - { - if (m_contextBlockOut[i] != pResult[i]) - return false; - } - return true; - } - - struct ClickTest - { - int xClick; - int yClick; - int charIndex; - int assocPrev; // boolean: 0 or 1 - int sel1Top; - int sel1Bottom; - int sel1Left; // we only need left or right, not both - int sel2Top; - int sel2Bottom; - int sel2Left; - - const static int fieldCnt = 10; - }; - -protected: - std::string m_testName; - bool m_debug; // break into the debugger when running this test - bool m_traceLog; // generate a logging file (tracelog.txt) for this test; if this is turned on for - // more than one test, the tests will be appended - bool m_skip; - -#define MAXFEAT 10 - - // Input parameters: - std::wstring m_text; // default: none - std::wstring m_fontName; // default: empty - std::string m_fontFile; // default: empty - size_t m_fontSize; // default: 12 - LineBrk m_prefBreak; // default: word-break - LineBrk m_worstBreak; // default: clip-break - FeatureSetting m_fset[MAXFEAT]; // default: none - int m_availWidth; // default: 100 - bool m_bold; // default: false - bool m_italic; // default: false - bool m_rtl; // default: false - bool m_backtrack; // default: false - TrWsHandling m_twsh; // default: ktwshAll - bool m_paraRtl; // default: false - size_t m_firstChar; // default: 0 - size_t m_contextBlockInSize; // default: 0 - gr::byte * m_contextBlockIn; // default: NULL -- DELETE - bool m_initWithPrev; // default: false - bool m_dumbFallback; // default: true - // start of line flag - // resolution - // justification - - // Output: - bool m_badFont; // default: false - bool m_noSegment; // no segment should be generated - int m_segWidth; - int m_charCount; - int m_glyphCount; - gid16 * m_glyphArray; - int * m_xPositions; - int * m_yPositions; - int * m_advWidths; - int * m_bbLefts; - int * m_bbRights; - int * m_bbTops; - int * m_bbBottoms; - bool * m_insPointFlags; - int * m_charsToGlyphs; // char-to-glyph mappings - int m_c2gCount; - int * m_attGlyphs; // attachment clusters - int m_attGCount; - int m_clickTestCount; - ClickTest * m_clickTests; - size_t m_contextBlockOutSize; - gr::byte * m_contextBlockOut; - // glyphs-to-chars - // pdichwContext - // arrow key behavior - // etc. - - // Setters: - void SetCharCount(int charCount); - void SetGlyphCount(int glyphCount); - void SetGlyphList(gid16 * glyphList); - void SetXPositions(int * posList); - void SetYPositions(int * posList); - void SetAdvWidths(int * advWidths); - void SetBBs(int * bbLefts, int * bbRights, int * bbTops, int * bbBottoms); - void SetInsPtFlags(bool * flags); - void SetCharsToGlyphs(int * stuff, int count); - void SetAttachedClusters(int * stuff, int count); - void SetClickTests(int clickTestCount, int * clickStuff); - void SetInputContextBlock(int contextBlockInSize, gr::byte * contextBlockIn); - void SetOutputContextBlock(int contextBlockOutSize, gr::byte * contextBlockIn); -}; - - -#endif // !TESTCASE_H - diff --git a/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/burmeseText.wpx b/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/burmeseText.wpx deleted file mode 100644 index 94d699a2a1c..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/burmeseText.wpx +++ /dev/null @@ -1,138 +0,0 @@ - - - - - - - - Burmese - - - - - - - - - Padauk - Arial - Courier - my - keyman - Burmese Unicode 0.03 - - - - DefaultCollation - - - Latin1_General_CI_AI - - - - - - - - Normal - - - Normal - - - - - Bulleted List - - Normal - Bulleted List - - - - - - Heading 1 - - Normal - Heading 1 - - - - - - Heading 2 - - Normal - Heading 2 - - - - - - Heading 3 - - Normal - Heading 3 - - - - - - Numbered List - - Normal - Numbered List - - - - - - External Link - - Normal - External Link - - - - - - - - - - - - - - က္ယ္ဝန္ဟ္‌ပ္‌တုိ့၏ ပ္ယော္‌ရ္ဝ္ဟင္‌မ္ဟု၊ - - - - - - - - - - - - - - - - - - - - brumeseText.wpx - - - - - &[page],&[date] - - - - - - diff --git a/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/grtest_arabic.ttf b/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/grtest_arabic.ttf deleted file mode 100644 index df25e54b3f3..00000000000 Binary files a/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/grtest_arabic.ttf and /dev/null differ diff --git a/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/grtest_badCmap.ttf b/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/grtest_badCmap.ttf deleted file mode 100644 index d66c725f12e..00000000000 Binary files a/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/grtest_badCmap.ttf and /dev/null differ diff --git a/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/grtest_badVersion.ttf b/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/grtest_badVersion.ttf deleted file mode 100644 index babe42e5352..00000000000 Binary files a/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/grtest_badVersion.ttf and /dev/null differ diff --git a/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/grtest_burmese.ttf b/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/grtest_burmese.ttf deleted file mode 100644 index ab253fbbfd6..00000000000 Binary files a/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/grtest_burmese.ttf and /dev/null differ diff --git a/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/grtest_roman.ttf b/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/grtest_roman.ttf deleted file mode 100644 index 2001ff6b5ac..00000000000 Binary files a/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/grtest_roman.ttf and /dev/null differ diff --git a/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/grtest_taiviet.ttf b/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/grtest_taiviet.ttf deleted file mode 100644 index 3bf4a662b11..00000000000 Binary files a/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/grtest_taiviet.ttf and /dev/null differ diff --git a/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/grtest_xline.ttf b/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/grtest_xline.ttf deleted file mode 100644 index 537a4b9532a..00000000000 Binary files a/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/grtest_xline.ttf and /dev/null differ diff --git a/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/main.h b/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/main.h deleted file mode 100644 index bd92d0d5b30..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/main.h +++ /dev/null @@ -1,90 +0,0 @@ -/*--------------------------------------------------------------------*//*:Ignore this sentence. -Copyright (C) 2004 SIL International. All rights reserved. - -Distributable under the terms of either the Common Public License or the -GNU Lesser General Public License, as specified in the LICENSING.txt file. - -File: Main.h -Responsibility: Sharon Correll -Last reviewed: Not yet. - -Description: - Header files to include in the Graphite regression test program. --------------------------------------------------------------------------------*//*:End Ignore*/ - -#ifdef _MSC_VER -#pragma once -#endif -#ifndef GRCOMPILER_H -#define GRCOMPILER_H 1 - -#define NO_EXCEPTIONS 1 - -// To allow call to IsDebuggerPresent: -#define _WIN32_WINNT WINVER - -//:>******************************************************************************************** -//:> Include files -//:>******************************************************************************************** -// #include "windows.h" -#include "stdafx.h" -////#include "resource.h" -// #include -#include -#include -#include -////#include -#include -#include -#ifdef _WIN32 -#include -#endif // _WIN32 -#include - -////using std::max; -////using std::min; - -#include "GrCommon.h" -#include "GrPlatform.h" - -////////#include "LgCharPropsStub.h" - -#include "GrConstants.h" -///#include "TtfUtil.h" -///#include "Tt.h" - -#include "GrClient.h" -#include "ITextSource.h" -#include "SimpleTextSrc.h" -#include "IGrEngine.h" -#include "IGrJustifier.h" -#include "GrJustifier.h" -#include "SegmentAux.h" -#include "Font.h" -// #include "WinFont.h" -#include "FileFont.h" -#include "Segment.h" -#include "SegmentPainter.h" -// #include "WinSegmentPainter.h" - -#include "TestCase.h" -#include "RtTextSrc.h" - - -//:>******************************************************************************************** -//:> Functions -//:>******************************************************************************************** -void RunTests(int numberOfTests, TestCase * ptcaseList); -int RunOneTestCase(TestCase * ptcase, Segment * psegPrev, Segment ** ppsegRet, RtTextSrc ** pptsrcRet); -void OutputError(TestCase * ptcase, std::string strErr, int i = -1); -void OutputErrorWithValues(TestCase * ptcase, std::string strErr, int i, - int valueFound, int valueExpected); -void OutputErrorAux(TestCase * ptcase, std::string strErr, int i, - bool showValues, int valueFound, int valueExpected); -bool WriteToLog(std::string str, int i = -1); -bool WriteToLog(std::string str, int i, - bool showValues, int valueFound, int valueExpected); -bool WriteToLog(int n); - -#endif //!WRCOMPILER_H - diff --git a/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/makedebug.bat b/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/makedebug.bat deleted file mode 100644 index 94d09eb720a..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/makedebug.bat +++ /dev/null @@ -1,2 +0,0 @@ -cls -nmake CFG=DEBUG -f makefile.vc \ No newline at end of file diff --git a/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/readme.txt b/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/readme.txt deleted file mode 100644 index e9f7facad20..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/readme.txt +++ /dev/null @@ -1,19 +0,0 @@ -Graphite Regression Test - -COMPILING -Use makedebug.bat to build a debug version. Creating a release version is not supported. - -RUNNING -Extract the fonts from the fonts.zip file and install them. - -Options: -/d - breaks into the debugger (if any) when an error occurs -/s - silent mode; does not write to the standard output but only to the log file - -The program generates a file called grregtest.log with a list of errors. - -A file called tracelog.txt will be output for the tests for which tracing is turned on. - -ADDING TESTS -See TestCase.cpp. - diff --git a/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/romanText.wpx b/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/romanText.wpx deleted file mode 100644 index 594cc886a0f..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/romanText.wpx +++ /dev/null @@ -1,206 +0,0 @@ - - - - - - - - English - - - Eng - - - - The standard alphabetic representation of English (United States style). - - - - - Times New Roman - Arial - Charis SIL - Courier New - en - standard - - - - Default Collation - - - Latin1_General_CI_AI - - - - Case Sensitive - - - Latin1_General_CS_AI - - - - - - - - Normal - - - Normal - - - - - - - - Bulleted List - - Normal - Bulleted List - - - - - - Heading 1 - - Normal - Heading 1 - - - - - - Heading 2 - - Normal - Heading 2 - - - - - - Heading 3 - - Normal - Heading 3 - - - - - - Numbered List - - Normal - Numbered List - - - - - - External Link - - Normal - External Link - - - - - - - - - - - - - - ẽ̀p͡sg˨˥˧ŊấĩĨm̼̀̈̄ffi - - - - - - - - - - with features: - - - - - - - - - - ẽ̀p͡sg˨˥˧ŊấĩĨm̼̀̈̄ffi - - - - - - - - - - - - - - - - - - - - stacking and bridging: - - - - - - - - - - a͝a t͝a à̀͝a - ʃ̀̀͝a - a̖̖a - ʃ̀̀a - - a̖̖a - - - - - - - - - - - - - - - - - - - - romanText.wpx - - - - - &[page],&[date] - - - - - - diff --git a/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/stdafx.cpp b/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/stdafx.cpp deleted file mode 100644 index 7f699d258e2..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/stdafx.cpp +++ /dev/null @@ -1,8 +0,0 @@ -// stdafx.cpp : source file that includes just the standard includes -// RegressionTest.pch will be the pre-compiled header -// stdafx.obj will contain the pre-compiled type information - -#include "stdafx.h" - -// TODO: reference any additional headers you need in STDAFX.H -// and not in this file diff --git a/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/stdafx.h b/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/stdafx.h deleted file mode 100644 index c5e242de5cb..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/stdafx.h +++ /dev/null @@ -1,12 +0,0 @@ -// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, but -// are changed infrequently -// - -#pragma once - - -#include -// #include - -// TODO: reference additional headers your program requires here diff --git a/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/xline.gdl b/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/xline.gdl deleted file mode 100644 index 70bfa15902a..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/xline.gdl +++ /dev/null @@ -1,146 +0,0 @@ - -/********************************************************************************* - File: xline.gdl - - For testing cross-line contextualization. - - Compile with stddr.ttf - - To test, type something like these examples: - abc$x - abcx@ - abc$x@ - and force a line break after the x. -*********************************************************************************/ - -#include "stddef.gdh" - -Bidi = false; - -#define duplicated user1 - - -table(glyph) {MUnits = 1000 } - - g_A = codepoint("A"); - g_B = codepoint("B"); - g_C = codepoint("C"); - g_D = codepoint("D"); - g_E = codepoint("E"); - g_F = codepoint("F"); - g_G = codepoint("G"); - - g_a = codepoint("a"); - g_b = codepoint("b"); - g_c = codepoint("c"); - g_d = codepoint("d"); - g_e = codepoint("e"); - g_f = codepoint("f"); - g_g = codepoint("g"); - - g_x = codepoint("x"); - g_y = codepoint("y"); - g_z = codepoint("z"); - - g_asterisk = codepoint("*") { ptCenter = point(bb.width/2, bb.height/2) }; - g_dollar = codepoint("$") { xWid = aw }; - g_hash = codepoint("#"); - g_at = codepoint("@") { xWid = aw }; - g_amp = codepoint("&") {xWid = aw }; - g_percent = codepoint("%"); - - g_leftArrow = codepoint("<") { xWid = aw }; - g_rightArrow = codepoint(">") { xWid = aw }; - - clsUpper = codepoint("ABCDEFGHIJKLMNOPQRSTUVWXYZ") - { ptCenter = point(bb.width/2, ascent/2) }; - clsLower = codepoint("abcdefghijklmnopqrstuvwxyz"); - - clsMyAny = glyphid(2..216) { justify.stretch = 700m }; - - g_m = codepoint("m"); - g_Mlig = codepoint("M") { - component.one = box(0,0, bb.width/2, ascent); - component.two = box(bb.width/2,0, bb.width,ascent) }; - - gSpace = U+0020 { justify.stretch = 3000m }; - - clsXYZ = (g_x g_y g_z); - -endtable; // glyph - - -table(lb) - - // Allow non-optimal linebreaks after x, y, or z. - clsXYZ {break = BREAK_INTRA}; - -endtable; // lb - - -table(sub) - -pass(1) - - // Switch the $ and @ if they are both there, and insert & after the one on the first - // line and before the one on the second line. Note that these rules supercede the rule - // to insert the left- and right-arrows. - g_dollar _ _ g_at > @7 g_amp:7 g_amp:1 @1 - / _ _ ANY? # {break == BREAK_INTRA} ANY? _ _ ; - - g_dollar - clsXYZ {measure.endofline = g_at.aw - g_dollar.aw + g_amp.aw} - ANY {measure.startofline = g_dollar.aw - g_at.aw + g_amp.aw} - g_at; - g_dollar - clsXYZ {measure.endofline = g_at.aw - g_dollar.aw + g_amp.aw} - g_at {measure.startofline = g_dollar.aw - g_at.aw + g_amp.aw}; - - - // Just copy the $ to the following segment. - g_dollar _ > @1 {duplicated = true} g_dollar:1 - / _ {duplicated == false} ANY? ^ # {break == BREAK_INTRA} ANY? _ ; - - g_dollar - clsXYZ {measure.endofline = g_rightArrow.aw} - ANY {measure.startofline = g_dollar.aw + g_leftArrow.aw}; - - - // Just copy the @ to the previous segment. - _ g_at > g_at:5 @5 {duplicated = true} - / _ ANY? ^ # {break == BREAK_INTRA} ANY? _ {duplicated == false}; - - clsXYZ {measure.endofline = g_at.aw + g_rightArrow.aw} - ANY {measure.startofline = g_leftArrow.aw} - g_at; - - clsXYZ {measure.endofline = g_at.aw + g_rightArrow.aw} - g_at {measure.startofline = g_leftArrow.aw}; - - - // Insert a '<' at the beginning of the line and a '>' at the end. - _ > g_leftArrow / # _; - _ > g_rightArrow / clsMyAny _ # ^ ; - - clsMyAny {measure {startofline = g_leftArrow.aw; endofline = g_rightArrow.aw}}; - -endpass; - -pass(2) - - // Don't stretch trailing white space. - gSpace {justify.stretch = 0} / _ [gSpace [gSpace [gSpace gSpace?]? ]? ]? # ; - // In fact, don't stretch any line-boundary glyph. - clsMyAny {justify.stretch = 0} / _ #; - - -endpass; - -endtable; // sub - - -table(pos) - - clsMyAny {adv.x += justify.width}; - -endtable; // pos diff --git a/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/xlineText.wpx b/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/xlineText.wpx deleted file mode 100644 index a8d51fefda7..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/test/RegressionTest/xlineText.wpx +++ /dev/null @@ -1,132 +0,0 @@ - - - - - - - - English - - - - Times New Roman - Arial - Courier New - en - standard - - - - DefaultCollation - - - Latin1_General_CI_AI - - - - - - - - Normal - - - Normal - - - - - Bulleted List - - Normal - Bulleted List - - - - - - Heading 1 - - Normal - Heading 1 - - - - - - Heading 2 - - Normal - Heading 2 - - - - - - Heading 3 - - Normal - Heading 3 - - - - - - Numbered List - - Normal - Numbered List - - - - - - External Link - - Normal - External Link - - - - - - - - - - - - - - abcddddefx@ghijkmmmmn$yopppppqrsss$z@tttwwww - - - - - - - - - - - - - - - - - - - - xline_test.wpx - - - - - &[page],&[date] - - - - - - diff --git a/Build/source/libs/graphite/engine-2.3.1/test/fonterrors/errBadGloc.ttf b/Build/source/libs/graphite/engine-2.3.1/test/fonterrors/errBadGloc.ttf deleted file mode 100644 index 6cce2701493..00000000000 Binary files a/Build/source/libs/graphite/engine-2.3.1/test/fonterrors/errBadGloc.ttf and /dev/null differ diff --git a/Build/source/libs/graphite/engine-2.3.1/test/fonterrors/errBadGloc2.ttf b/Build/source/libs/graphite/engine-2.3.1/test/fonterrors/errBadGloc2.ttf deleted file mode 100644 index 89c54507f58..00000000000 Binary files a/Build/source/libs/graphite/engine-2.3.1/test/fonterrors/errBadGloc2.ttf and /dev/null differ diff --git a/Build/source/libs/graphite/engine-2.3.1/test/fonterrors/errBadPass.ttf b/Build/source/libs/graphite/engine-2.3.1/test/fonterrors/errBadPass.ttf deleted file mode 100644 index 82ae6b66c7a..00000000000 Binary files a/Build/source/libs/graphite/engine-2.3.1/test/fonterrors/errBadPass.ttf and /dev/null differ diff --git a/Build/source/libs/graphite/engine-2.3.1/test/fonterrors/errBadStackMachine.ttf b/Build/source/libs/graphite/engine-2.3.1/test/fonterrors/errBadStackMachine.ttf deleted file mode 100644 index 27350bef70c..00000000000 Binary files a/Build/source/libs/graphite/engine-2.3.1/test/fonterrors/errBadStackMachine.ttf and /dev/null differ diff --git a/Build/source/libs/graphite/engine-2.3.1/test/fonterrors/errBadSubs.ttf b/Build/source/libs/graphite/engine-2.3.1/test/fonterrors/errBadSubs.ttf deleted file mode 100644 index 8027c72b79a..00000000000 Binary files a/Build/source/libs/graphite/engine-2.3.1/test/fonterrors/errBadSubs.ttf and /dev/null differ diff --git a/Build/source/libs/graphite/engine-2.3.1/test/fonterrors/errBadVersion.ttf b/Build/source/libs/graphite/engine-2.3.1/test/fonterrors/errBadVersion.ttf deleted file mode 100644 index babe42e5352..00000000000 Binary files a/Build/source/libs/graphite/engine-2.3.1/test/fonterrors/errBadVersion.ttf and /dev/null differ diff --git a/Build/source/libs/graphite/engine-2.3.1/test/fonterrors/errGarbageFsm.ttf b/Build/source/libs/graphite/engine-2.3.1/test/fonterrors/errGarbageFsm.ttf deleted file mode 100644 index 7909e115949..00000000000 Binary files a/Build/source/libs/graphite/engine-2.3.1/test/fonterrors/errGarbageFsm.ttf and /dev/null differ diff --git a/Build/source/libs/graphite/engine-2.3.1/test/fonterrors/errGarbageGlat.ttf b/Build/source/libs/graphite/engine-2.3.1/test/fonterrors/errGarbageGlat.ttf deleted file mode 100644 index 012e6b5d5b2..00000000000 Binary files a/Build/source/libs/graphite/engine-2.3.1/test/fonterrors/errGarbageGlat.ttf and /dev/null differ diff --git a/Build/source/libs/graphite/engine-2.3.1/test/fonterrors/errGarbageSilf.ttf b/Build/source/libs/graphite/engine-2.3.1/test/fonterrors/errGarbageSilf.ttf deleted file mode 100644 index b540a0d4dd5..00000000000 Binary files a/Build/source/libs/graphite/engine-2.3.1/test/fonterrors/errGarbageSilf.ttf and /dev/null differ diff --git a/Build/source/libs/graphite/engine-2.3.1/test/fonterrors/errSilfVerMismatch.ttf b/Build/source/libs/graphite/engine-2.3.1/test/fonterrors/errSilfVerMismatch.ttf deleted file mode 100644 index 9088e11ea9a..00000000000 Binary files a/Build/source/libs/graphite/engine-2.3.1/test/fonterrors/errSilfVerMismatch.ttf and /dev/null differ diff --git a/Build/source/libs/graphite/engine-2.3.1/test/fonterrors/errSubsUnderflow.ttf b/Build/source/libs/graphite/engine-2.3.1/test/fonterrors/errSubsUnderflow.ttf deleted file mode 100644 index a7b04a1e146..00000000000 Binary files a/Build/source/libs/graphite/engine-2.3.1/test/fonterrors/errSubsUnderflow.ttf and /dev/null differ diff --git a/Build/source/libs/graphite/engine-2.3.1/test/fonterrors/errTooManyClasses.ttf b/Build/source/libs/graphite/engine-2.3.1/test/fonterrors/errTooManyClasses.ttf deleted file mode 100644 index 9c73c9a38a1..00000000000 Binary files a/Build/source/libs/graphite/engine-2.3.1/test/fonterrors/errTooManyClasses.ttf and /dev/null differ diff --git a/Build/source/libs/graphite/engine-2.3.1/test/fonterrors/fonterrors.gdl b/Build/source/libs/graphite/engine-2.3.1/test/fonterrors/fonterrors.gdl deleted file mode 100644 index 862284a2440..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/test/fonterrors/fonterrors.gdl +++ /dev/null @@ -1,43 +0,0 @@ - -/********************************************************************************* - File: fonterrors.gdl - - For seeing some basic Graphite behavior. This version is used to generate - fonts that can be deliberately corrupted to test error handling in the - engine. - - Compile with Std SILDoulos (stddr.ttf). -*********************************************************************************/ - -#include "stddef.gdh" - -Bidi = false; - - -table(glyph) - - clsUpperVowel = codepoint("AEIOU"); - clsLowerVowel = codepoint("aeiou"); - - clsUpperCons = codepoint("BCDFGHJKLMNPQRSTVWXYZ"); - clsLowerCons = codepoint("bcdfghjklmnpqrstvwxyz"); - - clsDigit = codepoint("0123456789") {tSuper = 400m}; - -endtable; // glyph - - -table(sub) - - clsUpperVowel > clsLowerVowel; - clsLowerCons > clsUpperCons; - -endtable; - - -table(pos) - - clsDigit {shift.y += tSuper}; - -endtable; - diff --git a/Build/source/libs/graphite/engine-2.3.1/test/fonterrors/readme.txt b/Build/source/libs/graphite/engine-2.3.1/test/fonterrors/readme.txt deleted file mode 100644 index 943b2853cf6..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/test/fonterrors/readme.txt +++ /dev/null @@ -1,43 +0,0 @@ -FONTS FOR TESTING ERROR HANDLING - -This directory constains a set of fonts that have been deliberately corrupted in order to test Graphite's error recovery capabilities. - -The "correct" behavior of the font is that vowels are rendered as lowercase, consonants as uppercase, and digits are raised vertically. For some of the fonts, recovery will be adequate to show some smart behaviors; for others the engine will revert to pure dumb rendering. - - -* GrErr BadGloc - errBadGloc.ttf - The stated number of attributes exceeds actual number. This actually should not cause any real error, since the attributes are never read. - -* GrErr BadGloc2 - errBadGloc2.ttf - The stated number of attributes is less than actual number. This causes attributes greater than the number specified to have the value zero. - -* GrErr BadPass - errBadPass.ttf - One of the offsets to the pass information points off to somewhere nonsensical. - -* GrErr BadStackMachine - errStackMachine.ttf - Extra bytes have been inserted into the stack machine commands for both of the substitution rules. The engine manages to recover and handle the rule correctly in this case. (Reproduce using lowercase consonants or uppercase vowels.) - -* GrErr BadSubs - errSubs.ttf - A PutSubs command references a non-existent replacement class. This causes the glyph to appear as a square box. (Reproduce using lowercase consonants or uppercase vowels.) - -* GrErr BadVersion - errBadVersion.ttf - Bad version numbers are recorded in the Silf, Gloc, Glat, and Feat tables. Reading the Silf table will trigger an error being thrown, and the font will fall back to dumb rendering. - -* GrErr GarbageFsm - errGarbageFsm.ttf - The state table portions of the FSMs have been overwritten with garbage. Font will fall back to dumb rendering when any rules are fired. - -* GrErr GarbageGlat - errGarbageGlat.ttf - A section of Glat is overwritten with garbage. The "normal" behavior of the font is to raise the digits by 400m. But the lower digits (1 and 2) have been corrupted so they should simply not show that behavior. - -* GrErr GarbageSilf - errGarbageSilf.ttf - A section of Silf table is overwritten with garbage. Font will fall back to dumb rendering. - -* GrErr SilfVersionMismatch - errSilfVerMismatch.ttf - The Silf table claims to be version 1.0, but is actually version 2.0. Font will fall back to dumb rendering. - -* GrErr SubsUnderflow - errSubsUnderflow.ttf - A bogus command is inserted into the stack machine commands for both the substitution rules, causing an underflow when running the rules. The engine manages to recover and handle the rule correctly in this case. (Reproduce using lowercase consonants or uppercase vowels.) - -* GrErr TooManyClasses - errTooManyClasses.ttf - Very large number of classes in the list of replacement classes, larger than are actually there. - diff --git a/Build/source/libs/graphite/engine-2.3.1/uninstalled-top.pc.in b/Build/source/libs/graphite/engine-2.3.1/uninstalled-top.pc.in deleted file mode 100644 index e6dff4bb12e..00000000000 --- a/Build/source/libs/graphite/engine-2.3.1/uninstalled-top.pc.in +++ /dev/null @@ -1,6 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -priv_includedir=@abs_srcdir@/src -includedir=@abs_srcdir@/include -libdir=@abs_builddir@/src/.libs -version=@VERSION@ diff --git a/Build/source/libs/graphite/engine-2.4-PATCHES/ChangeLog b/Build/source/libs/graphite/engine-2.4-PATCHES/ChangeLog new file mode 100644 index 00000000000..dd9abf9f591 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4-PATCHES/ChangeLog @@ -0,0 +1,55 @@ +2012-03-16 Peter Breitenlohner + + Imported engine-2.4 source tree (silgraphite/engine) from + http://scripts.sil.org/svn-public/graphite/graphite/trunk + (svn r1250 2012-03-1419:45:41 UTC). + + * patch-02-virtual, patch-04-math_h-WIN32 (removed): + Now in source tree. + * patch-03-SIZEOF_WCHAR_T (removed): Now done differently. + * patch-01-warnings, patch-05-copy-constr, + patch-06-static-const-members, patch-07-stdlib-workaround: + Adapted. + + * patch-08-case-sensitive (new): Need => + when sources are on a case sensitive filesystem, e.g., when + cross compiling for MinGW32 on Linux. + +2010-07-05 Peter Breitenlohner + + * patch-06-static-const-members (new): Add a definition for + initialized static const class members, required for AIX. + From Vladimir Volovich, Fri, 04 Jun 2010 19:46:38. + + * patch-07-stdlib-workaround (new): Work around stdlib problems, + requires -DUSE_STDLIB_WORKAROUNDS for AIX (and MinGW32?). + From Vladimir Volovich, Mon, 05 Jul 2010 14:05:18. + +2010-03-29 Peter Breitenlohner + + * patch-05-copy-constr (new): Declare copy constructor's source + as const. Required by g++-4.3.2 for OpenSolaris x86_64. + Reported by Apostolos Syropoulos . + Patch proposed by Jonathan Kew . + +2010-02-21 Peter Breitenlohner + + * patch-03-SIZEOF_WCHAR_T (new): MinGW32 fix. + * patch-04-math_h-WIN32 (new): #include also for WIN32. + +2009-10-20 Peter Breitenlohner + + * patch-02-virtual (new): Declare destructors as virtual to + avoid compiler warnings. + +2009-10-19 Peter Breitenlohner + + * TL-changes (new): Modifications applied to the distribution. + * patch-[0-9][0-9]-*: Patches applied to the distribution. + +2009-10-01 Peter Breitenlohner + + * patch-01-warnings (new): Avoid maximal compiler warnings. + * src/segment/GrEngine.{cpp,h}, src/segment/FileInput.{cpp,h}, + src/segment/FontFace.cpp, src/font/TtfUtil.cpp: Constify. + diff --git a/Build/source/libs/graphite/engine-2.4-PATCHES/TL-Changes b/Build/source/libs/graphite/engine-2.4-PATCHES/TL-Changes new file mode 100644 index 00000000000..a405345dc0e --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4-PATCHES/TL-Changes @@ -0,0 +1,24 @@ +Changes applied to the silgraphite-2.4/engine/ tree obtained from: + http://scripts.sil.org/svn-public/graphite/graphite/trunk + (svn r1250 2012-03-1419:45:41 UTC). + +Removed: + config/ + +Executed the command: + find -type f -perm /111 ! -name configure -exec chmod -c a-x {} \; +i.e., removed execute permissions from all files except configure. + +Converted Dos/Win line ends to native: + build_d_vc8.bat + build_vc8.bat + makefile.vc8 + test/RegressionTest/Makefile.vc8 + test/RegressionTest/RtTextSrc.h + +Added newline at end of file: + build.bat + build_d.bat + build_d_vc8.bat + build_vc8.bat + diff --git a/Build/source/libs/graphite/engine-2.4-PATCHES/patch-01-warnings b/Build/source/libs/graphite/engine-2.4-PATCHES/patch-01-warnings new file mode 100644 index 00000000000..a6e92463956 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4-PATCHES/patch-01-warnings @@ -0,0 +1,255 @@ +diff -ur engine-2.4.orig/src/font/TtfUtil.cpp engine-2.4/src/font/TtfUtil.cpp +--- engine-2.4.orig/src/font/TtfUtil.cpp 2010-05-22 20:35:07.000000000 +0200 ++++ engine-2.4/src/font/TtfUtil.cpp 2012-03-16 23:55:47.000000000 +0100 +@@ -1250,7 +1250,7 @@ + (&pGlyph->end_pts_of_contours[cContours]); + + // skip over hints & point to first flag +- int cbHints = read(*(uint16 *)pbGlyph); ++ int cbHints = read(*(const uint16 *)pbGlyph); + pbGlyph += sizeof(uint16); + pbGlyph += cbHints; + +@@ -1304,7 +1304,7 @@ + } + else + { +- prgnX[iFlag] = read(*(int16 *)pbGlyph); ++ prgnX[iFlag] = read(*(const int16 *)pbGlyph); + pbGlyph += sizeof(int16); + } + } +@@ -1333,7 +1333,7 @@ + } + else + { +- prgnY[iFlag] = read(*(int16 *)pbGlyph); ++ prgnY[iFlag] = read(*(const int16 *)pbGlyph); + pbGlyph += sizeof(int16); + } + } +@@ -1369,9 +1369,9 @@ + size_t iCurrentComp = 0; + do + { +- GlyphFlags = read(*((uint16 *)pbGlyph)); ++ GlyphFlags = read(*((const uint16 *)pbGlyph)); + pbGlyph += sizeof(uint16); +- prgnCompId[iCurrentComp++] = read(*((uint16 *)pbGlyph)); ++ prgnCompId[iCurrentComp++] = read(*((const uint16 *)pbGlyph)); + pbGlyph += sizeof(uint16); + if (iCurrentComp >= cnCompIdTotal) + return false; +@@ -1413,18 +1413,18 @@ + uint16 GlyphFlags; + do + { +- GlyphFlags = read(*((uint16 *)pbGlyph)); ++ GlyphFlags = read(*((const uint16 *)pbGlyph)); + pbGlyph += sizeof(uint16); +- if (read(*((uint16 *)pbGlyph)) == nCompId) ++ if (read(*((const uint16 *)pbGlyph)) == nCompId) + { + pbGlyph += sizeof(uint16); // skip over glyph id of component + fOffset = (GlyphFlags & CompoundGlyph::ArgsAreXYValues) == CompoundGlyph::ArgsAreXYValues; + + if (GlyphFlags & CompoundGlyph::Arg1Arg2Words ) + { +- a = read(*(int16 *)pbGlyph); ++ a = read(*(const int16 *)pbGlyph); + pbGlyph += sizeof(int16); +- b = read(*(int16 *)pbGlyph); ++ b = read(*(const int16 *)pbGlyph); + pbGlyph += sizeof(int16); + } + else +@@ -1478,9 +1478,9 @@ + uint16 GlyphFlags; + do + { +- GlyphFlags = read(*((uint16 *)pbGlyph)); ++ GlyphFlags = read(*((const uint16 *)pbGlyph)); + pbGlyph += sizeof(uint16); +- if (read(*((uint16 *)pbGlyph)) == nCompId) ++ if (read(*((const uint16 *)pbGlyph)) == nCompId) + { + pbGlyph += sizeof(uint16); // skip over glyph id of component + pbGlyph += GlyphFlags & CompoundGlyph::Arg1Arg2Words ? 4 : 2; // skip over placement data +@@ -1492,7 +1492,7 @@ + + if (GlyphFlags & CompoundGlyph::HaveScale) + { +- flt11 = fixed_to_float<14>(read(*(uint16 *)pbGlyph)); ++ flt11 = fixed_to_float<14>(read(*(const uint16 *)pbGlyph)); + pbGlyph += sizeof(uint16); + flt12 = 0; + flt21 = 0; +@@ -1500,22 +1500,22 @@ + } + else if (GlyphFlags & CompoundGlyph::HaveXAndYScale) + { +- flt11 = fixed_to_float<14>(read(*(uint16 *)pbGlyph)); ++ flt11 = fixed_to_float<14>(read(*(const uint16 *)pbGlyph)); + pbGlyph += sizeof(uint16); + flt12 = 0; + flt21 = 0; +- flt22 = fixed_to_float<14>(read(*(uint16 *)pbGlyph)); ++ flt22 = fixed_to_float<14>(read(*(const uint16 *)pbGlyph)); + pbGlyph += sizeof(uint16); + } + else if (GlyphFlags & CompoundGlyph::HaveTwoByTwo) + { +- flt11 = fixed_to_float<14>(read(*(uint16 *)pbGlyph)); ++ flt11 = fixed_to_float<14>(read(*(const uint16 *)pbGlyph)); + pbGlyph += sizeof(uint16); +- flt12 = fixed_to_float<14>(read(*(uint16 *)pbGlyph)); ++ flt12 = fixed_to_float<14>(read(*(const uint16 *)pbGlyph)); + pbGlyph += sizeof(uint16); +- flt21 = fixed_to_float<14>(read(*(uint16 *)pbGlyph)); ++ flt21 = fixed_to_float<14>(read(*(const uint16 *)pbGlyph)); + pbGlyph += sizeof(uint16); +- flt22 = fixed_to_float<14>(read(*(uint16 *)pbGlyph)); ++ flt22 = fixed_to_float<14>(read(*(const uint16 *)pbGlyph)); + pbGlyph += sizeof(uint16); + } + else +diff -ur engine-2.4.orig/src/segment/FileInput.cpp engine-2.4/src/segment/FileInput.cpp +--- engine-2.4.orig/src/segment/FileInput.cpp 2010-05-22 20:35:07.000000000 +0200 ++++ engine-2.4/src/segment/FileInput.cpp 2012-03-17 00:02:13.000000000 +0100 +@@ -88,7 +88,7 @@ + /*---------------------------------------------------------------------------------------------- + Initialize the stream to a buffer. + ----------------------------------------------------------------------------------------------*/ +-bool GrBufferIStream::OpenBuffer(byte * pbBuffer, int cb) ++bool GrBufferIStream::OpenBuffer(const byte * pbBuffer, int cb) + { + Assert(m_pbStart == NULL); + Assert(m_pbNext == NULL); +diff -ur engine-2.4.orig/src/segment/FileInput.h engine-2.4/src/segment/FileInput.h +--- engine-2.4.orig/src/segment/FileInput.h 2008-05-20 10:02:16.000000000 +0200 ++++ engine-2.4/src/segment/FileInput.h 2012-03-17 00:02:13.000000000 +0100 +@@ -54,7 +54,7 @@ + virtual void GetPositionInFont(long * plPos) = 0; + virtual void SetPositionInFont(long lPos) = 0; + +- virtual bool OpenBuffer(byte * pbBuffer, int cb) = 0; ++ virtual bool OpenBuffer(const byte * pbBuffer, int cb) = 0; + virtual void CloseBuffer() = 0; + + protected: +@@ -87,16 +87,16 @@ + virtual void GetPositionInFont(long * plPos); + virtual void SetPositionInFont(long lPos); + +- virtual bool OpenBuffer(byte * pbBuffer, int cb); ++ virtual bool OpenBuffer(const byte * pbBuffer, int cb); + virtual void CloseBuffer() + { + Close(); + } + + protected: +- byte * m_pbStart; +- byte * m_pbNext; +- byte * m_pbLim; ++ const byte * m_pbStart; ++ const byte * m_pbNext; ++ const byte * m_pbLim; + }; + + } // namespace gr +diff -ur engine-2.4.orig/src/segment/FontFace.cpp engine-2.4/src/segment/FontFace.cpp +--- engine-2.4.orig/src/segment/FontFace.cpp 2011-03-21 17:13:25.000000000 +0100 ++++ engine-2.4/src/segment/FontFace.cpp 2012-03-17 00:02:13.000000000 +0100 +@@ -338,9 +338,9 @@ + + // ibGlocStart = cbGlatTbl; + fOk = CheckTableVersions(&grstrm, +- (byte *)pSilfTbl, 0, +- (byte *)pGlocTbl, 0, +- (byte *)pFeatTbl, 0, ++ (const byte *)pSilfTbl, 0, ++ (const byte *)pGlocTbl, 0, ++ (const byte *)pFeatTbl, 0, + &m_fxdBadVersion); + if (!fOk) + { +@@ -374,7 +374,7 @@ + try + { + // Parse the "Silf" table. +- grstrm.OpenBuffer((byte*)pSilfTbl, cbSilfSz); ++ grstrm.OpenBuffer((const byte*)pSilfTbl, cbSilfSz); + int chwGlyphIDMax, fxdVersion; + bool f = ReadSilfTable(grstrm, 0, 0, cbSilfSz, &chwGlyphIDMax, &fxdVersion); + grstrm.Close(); +@@ -389,8 +389,8 @@ + { + GrBufferIStream grstrmGlat; + +- grstrm.OpenBuffer((byte *)pGlocTbl, cbGlocSz); +- grstrmGlat.OpenBuffer((byte *)pGlatTbl, cbGlatSz); ++ grstrm.OpenBuffer((const byte *)pGlocTbl, cbGlocSz); ++ grstrmGlat.OpenBuffer((const byte *)pGlatTbl, cbGlatSz); + f = ReadGlocAndGlatTables(grstrm, 0, grstrmGlat, 0, chwGlyphIDMax, fxdVersion); + grstrm.Close(); + grstrmGlat.Close(); +@@ -403,7 +403,7 @@ + } + + // Parse the "Feat" table. +- grstrm.OpenBuffer((byte *)pFeatTbl, cbFeatSz); ++ grstrm.OpenBuffer((const byte *)pFeatTbl, cbFeatSz); + f = ReadFeatTable(grstrm, 0); + grstrm.Close(); + if (!f) +@@ -416,7 +416,7 @@ + // Parse the "Sill" table. + if (pSillTbl) + { +- grstrm.OpenBuffer((byte *)pSillTbl, cbSillSz); ++ grstrm.OpenBuffer((const byte *)pSillTbl, cbSillSz); + f = ReadSillTable(grstrm, 0); + grstrm.Close(); + if (!f) +@@ -549,7 +549,7 @@ + + if (!m_fNameTblCopy) + { +- res = (pNameTbl = (byte *)pfont->getTable(TtfUtil::TableIdTag(ktiName), &cbNameSz)) ? kresOk : kresFail; ++ res = (pNameTbl = (const byte *)pfont->getTable(TtfUtil::TableIdTag(ktiName), &cbNameSz)) ? kresOk : kresFail; + fOk = pNameTbl && (cbNameSz == 0 || TtfUtil::CheckTable(ktiName, pNameTbl, cbNameSz)); + if (!fOk) + { +diff -ur engine-2.4.orig/src/segment/GrEngine.cpp engine-2.4/src/segment/GrEngine.cpp +--- engine-2.4.orig/src/segment/GrEngine.cpp 2010-06-09 23:35:22.000000000 +0200 ++++ engine-2.4/src/segment/GrEngine.cpp 2012-03-17 00:02:13.000000000 +0100 +@@ -889,9 +889,9 @@ + implementation of the engine can't handle. + ----------------------------------------------------------------------------------------------*/ + bool GrEngine::CheckTableVersions(GrIStream * pgrstrm, +- byte *pSilfTbl, int lSilfStart, +- byte *pGlobTbl, int lGlocStart, +- byte *pFeatTbl, int lFeatStart, ++ const byte *pSilfTbl, int lSilfStart, ++ const byte *pGlobTbl, int lGlocStart, ++ const byte *pFeatTbl, int lFeatStart, + int * pfxdBadVersion) + { + pgrstrm->OpenBuffer(pSilfTbl, sizeof(int)); +diff -ur engine-2.4.orig/src/segment/GrEngine.h engine-2.4/src/segment/GrEngine.h +--- engine-2.4.orig/src/segment/GrEngine.h 2010-06-09 23:35:22.000000000 +0200 ++++ engine-2.4/src/segment/GrEngine.h 2012-03-17 00:02:13.000000000 +0100 +@@ -541,9 +541,9 @@ + void DestroyEverything(); + + bool CheckTableVersions(GrIStream * pgrstrm, +- byte *silf_tbl, int lSilfStart, +- byte *gloc_tbl, int lGlocStart, +- byte *feat_tbl, int lFeatStart, ++ const byte *silf_tbl, int lSilfStart, ++ const byte *gloc_tbl, int lGlocStart, ++ const byte *feat_tbl, int lFeatStart, + int * pfxdBadVersion); + //bool ReadSileTable(GrIStream & grstrm, long lTableSTart, + // int * pmFontEmUnits, bool * pfMismatchedBase); diff --git a/Build/source/libs/graphite/engine-2.4-PATCHES/patch-05-copy-constr b/Build/source/libs/graphite/engine-2.4-PATCHES/patch-05-copy-constr new file mode 100644 index 00000000000..f17b4c913ff --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4-PATCHES/patch-05-copy-constr @@ -0,0 +1,29 @@ + Declare copy constructor's source as const. + Required by g++-4.3.2 for OpenSolaris x86_64. + Reported by Apostolos Syropoulos . + Patch proposed by Jonathan Kew . + +diff -ur engine-2.4.orig/include/graphite/Segment.h engine-2.4/include/graphite/Segment.h +--- engine-2.4.orig/include/graphite/Segment.h 2010-05-25 07:45:14.000000000 +0200 ++++ engine-2.4/include/graphite/Segment.h 2012-03-17 00:26:39.000000000 +0100 +@@ -64,7 +64,7 @@ + virtual ~Segment(); + + // Basic copy constructor: +- Segment(Segment & seg); ++ Segment(const Segment & seg); + + // For making modified copies of segments: + static Segment * LineContextSegment(Segment & seg, bool fStartLine, bool fEndLine); +diff -ur engine-2.4.orig/src/segment/Segment.cpp engine-2.4/src/segment/Segment.cpp +--- engine-2.4.orig/src/segment/Segment.cpp 2012-03-14 20:45:41.000000000 +0100 ++++ engine-2.4/src/segment/Segment.cpp 2012-03-17 00:27:49.000000000 +0100 +@@ -432,7 +432,7 @@ + /*---------------------------------------------------------------------------------------------- + Basic copy method. + ----------------------------------------------------------------------------------------------*/ +-Segment::Segment(Segment & seg) ++Segment::Segment(const Segment & seg) + { + int islout; + diff --git a/Build/source/libs/graphite/engine-2.4-PATCHES/patch-06-static-const-members b/Build/source/libs/graphite/engine-2.4-PATCHES/patch-06-static-const-members new file mode 100644 index 00000000000..348841cbcb8 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4-PATCHES/patch-06-static-const-members @@ -0,0 +1,25 @@ + Initialized static const class members may need to be defined + in the enclosing scope. + +diff -ur engine-2.4.orig/test/RegressionTest/RegressionTest.cpp engine-2.4/test/RegressionTest/RegressionTest.cpp +--- engine-2.4.orig/test/RegressionTest/RegressionTest.cpp 2010-06-09 23:26:29.000000000 +0200 ++++ engine-2.4/test/RegressionTest/RegressionTest.cpp 2012-03-17 00:34:34.000000000 +0100 +@@ -34,6 +34,7 @@ + + SegmentMemoryUsage g_smu; + FontMemoryUsage g_fmu; ++const int TestCase::kAbsent; + + std::string g_fontPath = "."; + #ifdef _WIN32 +diff -ur engine-2.4.orig/test/RegressionTest/TestCase.cpp engine-2.4/test/RegressionTest/TestCase.cpp +--- engine-2.4.orig/test/RegressionTest/TestCase.cpp 2011-02-28 19:20:51.000000000 +0100 ++++ engine-2.4/test/RegressionTest/TestCase.cpp 2012-03-17 00:34:34.000000000 +0100 +@@ -2451,6 +2451,7 @@ + m_attGlyphs[i] = stuff[i]; + } + ++const int ClickTest::fieldCnt; + void TestCase::SetClickTests(int clickTestCount, int * clickStuff) + { + const int fc = ClickTest::fieldCnt; diff --git a/Build/source/libs/graphite/engine-2.4-PATCHES/patch-07-stdlib-workaround b/Build/source/libs/graphite/engine-2.4-PATCHES/patch-07-stdlib-workaround new file mode 100644 index 00000000000..8aadf2edc62 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4-PATCHES/patch-07-stdlib-workaround @@ -0,0 +1,23 @@ +diff -ur engine-2.4.orig/src/font/TtfUtil.cpp engine-2.4/src/font/TtfUtil.cpp +--- engine-2.4.orig/src/font/TtfUtil.cpp 2012-03-16 23:55:47.000000000 +0100 ++++ engine-2.4/src/font/TtfUtil.cpp 2012-03-17 00:52:28.000000000 +0100 +@@ -806,12 +806,14 @@ + uint16 * pStr = reinterpret_cast(pWStr); + uint16 * const pStrEnd = pStr + (nSize == 0 ? gr::utf16len(pStr) : nSize); + ++#ifndef USE_STDLIB_WORKAROUNDS + std::transform(pStr, pStrEnd, pStr, read); +- +-// for (int i = 0; i < nSize; i++) +-// { // swap the wide characters in the string +-// pStr[i] = gr::utf16(read(uint16(pStr[i]))); +-// } ++#else ++ for (int i = 0; i < nSize; i++) ++ { // swap the wide characters in the string ++ pStr[i] = gr::utf16(read(uint16(pStr[i]))); ++ } ++#endif + } + + /*---------------------------------------------------------------------------------------------- diff --git a/Build/source/libs/graphite/engine-2.4-PATCHES/patch-08-case-sensitive b/Build/source/libs/graphite/engine-2.4-PATCHES/patch-08-case-sensitive new file mode 100644 index 00000000000..8685ecfe874 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4-PATCHES/patch-08-case-sensitive @@ -0,0 +1,12 @@ +diff -ur engine-2.4.orig/src/generic/Debug.cpp engine-2.4/src/generic/Debug.cpp +--- engine-2.4.orig/src/generic/Debug.cpp 2010-05-13 16:39:27.000000000 +0200 ++++ engine-2.4/src/generic/Debug.cpp 2012-03-17 01:42:00.000000000 +0100 +@@ -13,7 +13,7 @@ + ----------------------------------------------------------------------------------------------*/ + + #ifdef _WIN32 +-#include ++#include + #endif + //#include "common.h" + //#include "Main.h" diff --git a/Build/source/libs/graphite/engine-2.4/CMakeLists.txt b/Build/source/libs/graphite/engine-2.4/CMakeLists.txt new file mode 100644 index 00000000000..6721768746d --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/CMakeLists.txt @@ -0,0 +1,26 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0 FATAL_ERROR) + +project(graphite-engine) +enable_language(CXX C) + +include_directories(${PROJECT_SOURCE_DIR}/include) + +enable_testing() + +add_subdirectory(src) +# add_subdirectory(include) + +# using a binary directory prevents a name clash between the test target and test directory +add_subdirectory(test/ProfileHarness ${PROJECT_BINARY_DIR}/ProfileHarness) +add_subdirectory(test/RegressionTest ${PROJECT_BINARY_DIR}/RegressionTest) + +# This is the release version, there is also the API SOVERSION in engine/src/CMakeLists.txt +set(version 2.3.1) +set(libdir ${CMAKE_INSTALL_PREFIX}/lib) +set(includedir ${CMAKE_INSTALL_PREFIX}/include) +configure_file(silgraphite.pc.in silgraphite.pc) +install(FILES ${PROJECT_BINARY_DIR}/silgraphite.pc DESTINATION lib/pkgconfig) + +add_test(NAME gr-regression-test + COMMAND "$" -p ${PROJECT_SOURCE_DIR}/test/RegressionTest) + diff --git a/Build/source/libs/graphite/engine-2.4/COPYING b/Build/source/libs/graphite/engine-2.4/COPYING new file mode 100644 index 00000000000..2e009b10e5a --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/COPYING @@ -0,0 +1 @@ +see license/LICENSING.txt diff --git a/Build/source/libs/graphite/engine-2.4/INSTALL b/Build/source/libs/graphite/engine-2.4/INSTALL new file mode 100644 index 00000000000..23e5f25d0e5 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/INSTALL @@ -0,0 +1,236 @@ +Installation Instructions +************************* + +Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free +Software Foundation, Inc. + +This file is free documentation; the Free Software Foundation gives +unlimited permission to copy, distribute and modify it. + +Basic Installation +================== + +These are generic installation instructions. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, and a +file `config.log' containing compiler output (useful mainly for +debugging `configure'). + + It can also use an optional file (typically called `config.cache' +and enabled with `--cache-file=config.cache' or simply `-C') that saves +the results of its tests to speed up reconfiguring. (Caching is +disabled by default to prevent problems with accidental use of stale +cache files.) + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If you are using the cache, and at +some point `config.cache' contains results you don't want to keep, you +may remove or edit it. + + The file `configure.ac' (or `configure.in') is used to create +`configure' by a program called `autoconf'. You only need +`configure.ac' if you want to change it or regenerate `configure' using +a newer version of `autoconf'. + +The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. If you're + using `csh' on an old version of System V, you might need to type + `sh ./configure' instead to prevent `csh' from trying to execute + `configure' itself. + + Running `configure' takes awhile. While running, it prints some + messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Optionally, type `make check' to run any self-tests that come with + the package. + + 4. Type `make install' to install the programs and any data files and + documentation. + + 5. You can remove the program binaries and object files from the + source code directory by typing `make clean'. To also remove the + files that `configure' created (so you can compile the package for + a different kind of computer), type `make distclean'. There is + also a `make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + +Compilers and Options +===================== + +Some systems require unusual options for compilation or linking that the +`configure' script does not know about. Run `./configure --help' for +details on some of the pertinent environment variables. + + You can give `configure' initial values for configuration parameters +by setting variables in the command line or in the environment. Here +is an example: + + ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix + + *Note Defining Variables::, for more details. + +Compiling For Multiple Architectures +==================================== + +You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you must use a version of `make' that +supports the `VPATH' variable, such as GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. + + If you have to use a `make' that does not support the `VPATH' +variable, you have to compile the package for one architecture at a +time in the source code directory. After you have installed the +package for one architecture, use `make distclean' before reconfiguring +for another architecture. + +Installation Names +================== + +By default, `make install' installs the package's commands under +`/usr/local/bin', include files under `/usr/local/include', etc. You +can specify an installation prefix other than `/usr/local' by giving +`configure' the option `--prefix=PREFIX'. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +pass the option `--exec-prefix=PREFIX' to `configure', the package uses +PREFIX as the prefix for installing programs and libraries. +Documentation and other data files still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like `--bindir=DIR' to specify different values for particular +kinds of files. Run `configure --help' for a list of the directories +you can set and what kinds of files go in them. + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + +Optional Features +================= + +Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + +Specifying the System Type +========================== + +There may be some features `configure' cannot figure out automatically, +but needs to determine by the type of machine the package will run on. +Usually, assuming the package is built to be run on the _same_ +architectures, `configure' can figure that out, but if it prints a +message saying it cannot guess the machine type, give it the +`--build=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name which has the form: + + CPU-COMPANY-SYSTEM + +where SYSTEM can have one of these forms: + + OS KERNEL-OS + + See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the machine type. + + If you are _building_ compiler tools for cross-compiling, you should +use the option `--target=TYPE' to select the type of system they will +produce code for. + + If you want to _use_ a cross compiler, that generates code for a +platform different from the build platform, you should specify the +"host" platform (i.e., that on which the generated programs will +eventually be run) with `--host=TYPE'. + +Sharing Defaults +================ + +If you want to set default values for `configure' scripts to share, you +can create a site shell script called `config.site' that gives default +values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Defining Variables +================== + +Variables not defined in a site shell script can be set in the +environment passed to `configure'. However, some packages may run +configure again during the build, and the customized values of these +variables may be lost. In order to avoid this problem, you should set +them in the `configure' command line, using `VAR=value'. For example: + + ./configure CC=/usr/local2/bin/gcc + +causes the specified `gcc' to be used as the C compiler (unless it is +overridden in the site shell script). Here is a another example: + + /bin/bash ./configure CONFIG_SHELL=/bin/bash + +Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent +configuration-related scripts to be executed by `/bin/bash'. + +`configure' Invocation +====================== + +`configure' recognizes the following options to control how it operates. + +`--help' +`-h' + Print a summary of the options to `configure', and exit. + +`--version' +`-V' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`--cache-file=FILE' + Enable the cache: use and save the results of the tests in FILE, + traditionally `config.cache'. FILE defaults to `/dev/null' to + disable caching. + +`--config-cache' +`-C' + Alias for `--cache-file=config.cache'. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to `/dev/null' (any error + messages will still be shown). + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`configure' also accepts some other, not widely useful, options. Run +`configure --help' for more details. + diff --git a/Build/source/libs/graphite/engine-2.4/Makefile.am b/Build/source/libs/graphite/engine-2.4/Makefile.am new file mode 100644 index 00000000000..3df9221de05 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/Makefile.am @@ -0,0 +1,62 @@ +AUTOMAKE_OPTIONS = 1.6 + +SUBDIRS = src test + +EXTRA_DIST = doc license \ + build.bat build_d.bat makefile.vc7 makefile.vc8 \ + README + +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = silgraphite.pc + +$(pkgconfig_DATA): config.status + +dist-hook: + find $(distdir) -name .svn | xargs rm -rf + +# VC_VERSION is the last released version of the software +VC_VERSION = 2.4 +# D_VERSION gets the number of the current svn revision +D_VERSION = `svnversion ${top_srcdir}|sed -e "s/[0-9]*\://g"` +SVNDEB_VERSION = $(VC_VERSION)+0$(D_VERSION)svn +SVNDEBPACKAGE = silgraphite2.0-$(SVNDEB_VERSION) +SVNORIGTAR = silgraphite2.0_$(SVNDEB_VERSION).orig.tar.gz +SVNWITH_EPOCH = 1:$(SVNDEB_VERSION)-1 + +DEB_VERSION = $(VC_VERSION) +DEBPACKAGE = silgraphite2.0-$(DEB_VERSION) +ORIGTAR = silgraphite2.0_$(DEB_VERSION).orig.tar.gz +WITH_EPOCH = 1:$(DEB_VERSION)-1 + +DISTRIB_CODENAME ?= ${REL_CODENAME} + +showcodename: + echo "Codename: ${DISTRIB_CODENAME}" + +deb-base: dist + rm -rf silgraphite2.0* + mkdir -p ${SVNDEBPACKAGE} + cp ${PACKAGE}-${VERSION}.tar.gz $(SVNDEBPACKAGE) + tar cfz $(SVNORIGTAR) $(SVNDEBPACKAGE) + cp -a ${top_srcdir}/debian $(SVNDEBPACKAGE) + cd ${SVNDEBPACKAGE} && find . -name .svn | xargs rm -rf + +# make deb builds an interim deb from svn source for release +deb: deb-base + dch -D ${DISTRIB_CODENAME} -v ${SVNWITH_EPOCH} -m -c${SVNDEBPACKAGE}/debian/changelog + cd ${SVNDEBPACKAGE} && pdebuild + +# make deb-binary-only builds a binary only deb from svn source +deb-binary-only: deb-base + dch -D ${DISTRIB_CODENAME} -v ${SVNWITH_EPOCH} -m -c${SVNDEBPACKAGE}/debian/changelog "This is build direct from svn" + cd ${SVNDEBPACKAGE} && pdebuild --debbuildopts -i --debbuildopts -b + +# make deb-release builds a deb for a released version number +deb-release: deb-base + dch -D ${DISTRIB_CODENAME} -v ${WITH_EPOCH} -c${DEBPACKAGE}/debian/changelog + cd ${DEBPACKAGE} && pdebuild + +# make deb-local uses debuild to build a deb for local use only +deb-local: deb-base + dch -D ${DISTRIB_CODENAME} -v ${SVNWITH_EPOCH} -m -c${SVNDEBPACKAGE}/debian/changelog "This is a debuild direct from svn" + cd ${SVNDEBPACKAGE} && debuild -us -uc diff --git a/Build/source/libs/graphite/engine-2.4/README b/Build/source/libs/graphite/engine-2.4/README new file mode 100644 index 00000000000..41c9cc02b5e --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/README @@ -0,0 +1,32 @@ + GRAPHITE ENGINE + +The Graphite smart-font engine is the bit that takes a Unicode string, font +formatting information (features, size, etc.) and a font and returns a set +of positioned glyphs. Graphite also does more than this, in that it can +handle cursor tracking and interaction with the application for string +selection, etc. + +In order to interact with the application or system, Graphite is embedded in +an application. You may want to write a custom font and render backend or use one +of the provided backends in the wrappers project. + +The *nix build system uses autoconf and automake including all the +conventions of those tools. This includes extended support for debug, +maintenance mode, etc. See the GNU autotools info pages for the appropriate +tools for help. + +If you have checked this source out of the Graphite Subversion repository or +a similar version control system you will need to generate the autotools +scripts and files (configure, Makefile.in etc) to do this run: + + autoreconf --install + +Please see INSTALL for information on building + +NOTE: +If you modify any configure.in or Makefile.am file you will need rerun +autoreconf like so: + + autoreconf + +For those changes to affect the configure script and makefiles. diff --git a/Build/source/libs/graphite/engine-2.4/TODO b/Build/source/libs/graphite/engine-2.4/TODO new file mode 100644 index 00000000000..146eff85d26 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/TODO @@ -0,0 +1,4 @@ + +Unprioritised + + * NFD/NFC Pre-processing diff --git a/Build/source/libs/graphite/engine-2.4/build.bat b/Build/source/libs/graphite/engine-2.4/build.bat new file mode 100644 index 00000000000..6fdff42e7da --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/build.bat @@ -0,0 +1,2 @@ +call "c:\program files\microsoft visual studio 9.0\vc\bin\vcvars32.bat" +nmake -f makefile.vc9 %1 %2 %3 \ No newline at end of file diff --git a/Build/source/libs/graphite/engine-2.4/build_d.bat b/Build/source/libs/graphite/engine-2.4/build_d.bat new file mode 100644 index 00000000000..08cd2046bcc --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/build_d.bat @@ -0,0 +1,2 @@ +call "c:\program files\microsoft visual studio 9.0\vc\bin\vcvars32.bat" +nmake CFG=DEBUG -f makefile.vc9 %1 %2 %3 \ No newline at end of file diff --git a/Build/source/libs/graphite/engine-2.4/build_d_vc8.bat b/Build/source/libs/graphite/engine-2.4/build_d_vc8.bat new file mode 100755 index 00000000000..f7013e390a1 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/build_d_vc8.bat @@ -0,0 +1,2 @@ +call "c:\program files\microsoft visual studio 8\vc\bin\vcvars32.bat" +nmake CFG=DEBUG -f makefile.vc8 %1 %2 %3 \ No newline at end of file diff --git a/Build/source/libs/graphite/engine-2.4/build_vc8.bat b/Build/source/libs/graphite/engine-2.4/build_vc8.bat new file mode 100755 index 00000000000..788df9e1b80 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/build_vc8.bat @@ -0,0 +1,2 @@ +call "c:\program files\microsoft visual studio 8\vc\bin\vcvars32.bat" +nmake -f makefile.vc8 %1 %2 %3 \ No newline at end of file diff --git a/Build/source/libs/graphite/engine-2.4/configure.ac b/Build/source/libs/graphite/engine-2.4/configure.ac new file mode 100644 index 00000000000..00e564aca08 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/configure.ac @@ -0,0 +1,140 @@ +AC_PREREQ(2.54) + +AC_INIT(silgraphite, 2.4, silgraphite-devel@lists.sourceforge.net) +AC_CONFIG_MACRO_DIR([m4]) +AC_CONFIG_SRCDIR(src/segment/GrEngine.cpp) +AC_CONFIG_AUX_DIR(config) + +# setup automake +AM_INIT_AUTOMAKE(foreign) +AM_MAINTAINER_MODE + +# System checks. +AC_CANONICAL_HOST +AC_C_BIGENDIAN + +# Optional features +AC_ARG_ENABLE(tracing, + AC_HELP_STRING([--disable-tracing], + [build without support for trace Graphite logs])) + test "x$enable_tracing" != xno && enable_tracing=yes + +AC_ARG_ENABLE(debug, + AC_HELP_STRING([--enable-debug], + [build with debugging. (default=no)])) +AC_ARG_ENABLE(final, + AC_HELP_STRING([--disable-final], + [build without optimizations and no debugging.])) + test "x$enable_final" != xno && enable_final=yes +AC_ARG_ENABLE(strict, + AC_HELP_STRING([--enable-strict], + [treat warnings as errors, check for as much as we can])) + +AC_ARG_ENABLE(profile, + AC_HELP_STRING([--enable-profile], + [allow profiling (default=no)])) +AC_ARG_ENABLE(profilefn, + AC_HELP_STRING([--enable-profilefn], + [allow functioncheck profiling (default=no)])) + +# Checks for programs. +AC_PROG_INSTALL +AC_PROG_LIBTOOL +AC_PROG_CC +AC_PROG_CXX +AC_LANG_CPLUSPLUS + +AC_PATH_PROG(LSB_RELEASE, lsb_release, no) + +# Checks for libraries. + +# Checks for header files. +AC_HEADER_STDC + +# Checks for typedefs, structures, and compiler characteristics. +AC_TYPE_SIZE_T +AC_CHECK_SIZEOF(wchar_t) +AC_SUBST(SIZEOF_WCHAR_T) + +AC_CHECK_FUNCS(fabsf) + +# Checks for library functions. + +# Setup the build compiler flags and linker flags. +# Enable debug +# (note: the flags here are gcc-specific and may fail with other compilers) +build_flags="" +if test "$enable_debug" = yes; then + build_flags="$build_flags -D_DEBUG -O0 -g -Wall -Wno-unknown-pragmas -Wparentheses" +elif test "$enable_strict" = yes; then + build_flags="$build_flags -DNDEBUG -Wall -Wno-unknown-pragmas -Wparentheses -Wextra -Wendif-labels -Wshadow -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor -Werror" +else + build_flags="$build_flags -DNDEBUG" +fi + +# Enable Graphite Trace logs - these are only used if a +# LayoutEnvironment has a valid ostream pointer +if test "$enable_tracing" = yes; then + build_flags="$build_flags -DTRACING" +fi + +# Enable final +if test "$enable_final" = yes -a "$enable_debug" != yes; then + build_flags="$build_flags -O3 -DNDEBUG" +fi + +# Enable profile +if test "$enable_profile" = yes; then + build_flags="$build_flags -pg " +fi +if test "$enable_profilefn" = yes; then + build_flags="$build_flags -g -finstrument-functions " + LIBS="$LIBS -g -finstrument-functions -lfnccheck " +fi + +# Find distrib codename + +AC_MSG_CHECKING(if already have REL_CODENAME) +if test -z "${REL_CODENAME}"; then + AC_MSG_RESULT(no) + AC_MSG_CHECKING(if have lsb_release) + if test "${LSB_RELEASE}" = "no"; then + AC_MSG_RESULT(no) + REL_CODENAME="unstable" + else + AC_MSG_RESULT(yes) + AC_MSG_CHECKING(if LSB_RELEASE is empty) + if test -z ${LSB_RELEASE}; then + AC_MSG_RESULT(yes) + REL_CODENAME="unstable" + else + AC_MSG_RESULT(no) + CODENAME=`${LSB_RELEASE} -c | sed -e 's/^\S*\s*//'` + AC_MSG_CHECKING(if release is sid) + if test ${CODENAME} = 'sid'; then + AC_MSG_RESULT(yes) + REL_CODENAME="unstable" + else + AC_MSG_RESULT(no, ${CODENAME}) + REL_CODENAME=${CODENAME} + fi + fi + fi +else + AC_MSG_RESULT(yes) +fi + +AC_SUBST(REL_CODENAME) + +CFLAGS="$CFLAGS $build_flags" +CXXFLAGS="$CXXFLAGS $build_flags" + +AC_CONFIG_FILES(Makefile \ + silgraphite.pc:installed-top.pc.in:silgraphite.pc.in \ + silgraphite-uninstalled.pc:uninstalled-top.pc.in:silgraphite.pc.in \ + src/Makefile \ + test/Makefile \ + test/RegressionTest/Makefile \ + test/ProfileHarness/Makefile) + +AC_OUTPUT diff --git a/Build/source/libs/graphite/engine-2.4/debian/changelog b/Build/source/libs/graphite/engine-2.4/debian/changelog new file mode 100644 index 00000000000..88bad1b612d --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/debian/changelog @@ -0,0 +1,186 @@ +silgraphite2.0 (1:2.4-1) lucid; urgency=low + + * Upgrade to libgraphite4 + + -- Martin Hosken Thu, 27 May 2010 11:28:07 +0100 + +silgraphite2.0 (1:2.3.1~1ubuntu1) intrepid; urgency=low + + * Bug fix release + + -- Martin Hosken Wed, 28 Jan 2009 09:20:15 +0700 + +silgraphite2.0 (1:2.3-1) gutsy; urgency=low + + * Smaller segment and glyphinfo foot prints + * bug fixes + + -- Martin Hosken Wed, 16 Jan 2008 16:54:26 +0700 + +silgraphite2.0 (1:2.2.1-1) feisty; urgency=low + + * 30% speedup + * various bug fixes + + -- Martin Hosken Mon, 27 Aug 2007 16:47:26 +0100 + +silgraphite2.0 (1:2.2.0-1.1) unstable; urgency=low + + * Non-maintainer upload. + * Fix the broken graphite.pc file (Closes: #433225): + - debian/rules: + Added an include of cdbs's simple-patchsys.mk. + - debian/patches/fix_cflags_in_graphite.pc.diff + Added this patch to fix the graphite.pc file by appending the missing + ``graphite'' directory to the Cflags in graphite.pc.in. + + -- Cyril Brulebois Mon, 20 Aug 2007 01:20:35 +0000 + +silgraphite2.0 (1:2.2.0-1) unstable; urgency=low + + * Release 2.2.0 + + -- Daniel Glassey Thu, 28 Jun 2007 10:56:17 +0100 + +silgraphite2.0 (1:2.1+0447svn-1) unstable; urgency=low + + * Update svn + * Keep engine separate from wrappers + * debian/control So don't need build dep on fontconfig or freetype + * debian/docs Docs are not in odf format not rtf + + -- Daniel Glassey Fri, 25 May 2007 13:33:06 +0100 + +silgraphite2.0 (1:2.1+0361svn-1) unstable; urgency=low + + * Build freetype wrapper + * Update svn + * depend on libfreetype6-dev instead of X and Xft dependencies + * binary package is now libgraphite3 since library version has + changed + * so rename the debian/libgraphite2.* to libgraphite3.* + * libgraphite-dev.install: install libgraphite-ft.a + + -- Daniel Glassey Mon, 12 Mar 2007 20:25:30 +0000 + +silgraphite2.0 (1:2.1+0347svn-1) unstable; urgency=low + + * Package preparation for min-deps reorganisation + * allow build from svn + * debian/rules: not using tarball anymore + * debian/control standards version 3.7.2 (no changes) + * remove unneeded misc:Depends subsitution variable + + -- Daniel Glassey Fri, 9 Mar 2007 17:20:52 +0000 + +silgraphite2.0 (1:2.1-1) unstable; urgency=low + + * New upstream release + * debian/rules: fix shlibs + * Use an epoch as 2.1 < 221svn + if further svn releases are made they will be + e.g. 1:2.1+0250svn-1 + + -- Daniel Glassey Mon, 15 May 2006 19:48:23 -0500 + +silgraphite2.0 (221svn-3) unstable; urgency=low + + * er, try that again + + -- Daniel Glassey Mon, 17 Apr 2006 15:51:32 +0100 + +silgraphite2.0 (221svn-2) unstable; urgency=low + + * debian/libgraphite2.shlibs refer to new package name + + -- Daniel Glassey Mon, 17 Apr 2006 15:36:48 +0100 + +silgraphite2.0 (221svn-1) unstable; urgency=low + + [ Daniel Glassey ] + * update to current svn + * include fix to build with gcc 4.1, Closes: #357711 + Thanks to Martin Michlmayr for the report + and Michael Peters for the initial one + * fix shlibs to refer to libgraphite + * rename the lib packages because lib is now libgraphite + * now lintian and linda clean + * debian/copyright: get location of public svn repo right + * conflict with the old packages + * don't compress the rtf docs + + [ Martin Hosken ] + * build for dapper from trunk + * build for dapper from trunk - with right email + + -- Martin Hosken Fri, 16 Jun 2006 10:48:22 +0700 + +silgraphite2.0 (190svn-2) unstable; urgency=low + + * fix shlibs + * debian/copyright: update location of svn repo + + -- Daniel Glassey Fri, 10 Mar 2006 09:35:21 +0000 + +silgraphite2.0 (190svn-1) unstable; urgency=low + + * update to current svn - 2.1.0 prerelease snapshot + * not a native package - build it as such, Closes: #345154 + * Don't assume size_t is unsigned, Closes: #345155 + Thanks to Bastian Blank for the report and patch + * Take more care with void*, Closes: #345369 + * debian/libsilgraphite-dev.docs: new file GTF_3_0.rtf + build dir is now silgraphite-2.1.0 + * debian/control: compiler is grcompiler not gdlcomp + + -- Daniel Glassey Thu, 9 Mar 2006 12:49:53 +0000 + +silgraphite2.0 (102svn-1) unstable; urgency=low + + * update to current svn + * fix the build-deps line (rejection) + + -- Daniel Glassey Mon, 12 Dec 2005 09:39:31 +0000 + +silgraphite2.0 (87svn-1) unstable; urgency=low + + * update to more recent svn + * new naming scheme using svn revision + * Don't autogenerate debian/control using cdbs (rejection) + * Add section for source to debian/control + + -- Daniel Glassey Thu, 1 Dec 2005 11:24:13 +0000 + +silgraphite2.0 (20051010svn-1) unstable; urgency=low + + * new upstream v2 API + * this doesn't depend on libfont-ttf-perl as perl bindings are + separate now + * GDL font compiler will be a separate package + + -- Daniel Glassey Mon, 10 Oct 2005 05:32:32 +0100 + +silgraphite1.0 (20050813cvs-1) unstable; urgency=low + + * New sync with cvs + * Ready to upload to unstable + * not sure which arch #279655 is for (guessing amd64), so uploading + in case it has been fixed in cvs + * let cdbs control its build deps in control.in + + -- Daniel Glassey Sat, 13 Aug 2005 00:12:12 +0100 + +silgraphite1.0 (20041025cvs-1) experimental; urgency=low + + * update to current CVS + * remember to sign this time :/ + * name package libsilgraphite-1.2 as that is the upcoming version + * ITP completed, Closes: #205565 + + -- Daniel Glassey Mon, 25 Oct 2004 20:53:50 +0100 + +silgraphite1.0 (20041022cvs-1) experimental; urgency=low + + * Initial Release using current CVS. + + -- Daniel Glassey Fri, 22 Oct 2004 14:24:35 +0100 diff --git a/Build/source/libs/graphite/engine-2.4/debian/compat b/Build/source/libs/graphite/engine-2.4/debian/compat new file mode 100644 index 00000000000..b8626c4cff2 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/debian/compat @@ -0,0 +1 @@ +4 diff --git a/Build/source/libs/graphite/engine-2.4/debian/control b/Build/source/libs/graphite/engine-2.4/debian/control new file mode 100644 index 00000000000..3187dc7ca91 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/debian/control @@ -0,0 +1,83 @@ +Source: silgraphite2.0 +Priority: optional +Section: libs +Maintainer: Daniel Glassey +Build-Depends: cdbs (>= 0.4.23-1.1), autotools-dev, debhelper (>= 4.1.0) +Standards-Version: 3.7.2 + +Package: libgraphite-dev +Section: libdevel +Architecture: any +Depends: libgraphite4 (= ${Source-Version}) +Conflicts: libsilgraphite-dev, libsilgraphite-2.0 +Description: Development files for SILGraphite + SILGraphite is a system that can be used to create and use "smart fonts" + capable of displaying writing systems with various complex behaviors, such + as: contextual shaping, ligatures, reordering, split glyphs, + bidirectionality, stacking diacritics and complex positioning. + . + This library was designed and developed by the NRSI (Non-Roman Script + Initiative) within SIL International (www.sil.org) to act as a complement to + other smart font rendering technologies with limited practical local + extensability. Its purpose is to help meet the needs of a very large number + of "minority language" communities for local extensibility of complex script + behaviors. + . + The behavior of the SILGraphite rendering engine for a given writing system is + specified through extra tables added to a TrueType font. These tables are + generated by compiling a GDL (Graphite Description Language) source file into + a font using grcompiler. + . + This package contains the headers and development libraries. + +Package: libgraphite4 +Section: libs +Architecture: any +Depends: ${shlibs:Depends} +Conflicts: libsilgraphite-dev, libsilgraphite-2.0 +Description: SILGraphite - a "smart font" rendering engine + SILGraphite is a system that can be used to create and use "smart fonts" + capable of displaying writing systems with various complex behaviors, such + as: contextual shaping, ligatures, reordering, split glyphs, + bidirectionality, stacking diacritics and complex positioning. + . + This library was designed and developed by the NRSI (Non-Roman Script + Initiative) within SIL International (www.sil.org) to act as a complement to + other smart font rendering technologies with limited practical local + extensability. Its purpose is to help meet the needs of a very large number + of "minority language" communities for local extensibility of complex script + behaviors. + . + The behavior of the SILGraphite rendering engine for a given writing system is + specified through extra tables added to a TrueType font. These tables are + generated by compiling a GDL (Graphite Description Language) source file into + a font using grcompiler. + . + This package contains the shared library. + +Package: libgraphite4-dbg +Priority: extra +Section: libdevel +Architecture: any +Depends: libgraphite4 (= ${Source-Version}) +Conflicts: libsilgraphite-dev, libsilgraphite-2.0 +Description: debugging symbols for SILGraphite + SILGraphite is a system that can be used to create and use "smart fonts" + capable of displaying writing systems with various complex behaviors, such + as: contextual shaping, ligatures, reordering, split glyphs, + bidirectionality, stacking diacritics and complex positioning. + . + This library was designed and developed by the NRSI (Non-Roman Script + Initiative) within SIL International (www.sil.org) to act as a complement to + other smart font rendering technologies with limited practical local + extensability. Its purpose is to help meet the needs of a very large number + of "minority language" communities for local extensibility of complex script + behaviors. + . + The behavior of the SILGraphite rendering engine for a given writing system is + specified through extra tables added to a TrueType font. These tables are + generated by compiling a GDL (Graphite Description Language) source file into + a font using grcompiler. + . + This package contains the debug library. + diff --git a/Build/source/libs/graphite/engine-2.4/debian/copyright b/Build/source/libs/graphite/engine-2.4/debian/copyright new file mode 100644 index 00000000000..b1fe8899e1d --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/debian/copyright @@ -0,0 +1,259 @@ +This package was debianized by Daniel Glassey on +Fri, 22 Oct 2004 14:24:35 +0100. + +It was oringally downloaded from http://www.sourceforge.net/projects/silgraphite + SILGraphite cvs on sourceforge +It is now in the subversion repository at + http://scripts.sil.org/svn-public/graphite/graphite/trunk + +Upstream Authors: + SIL International + http://www.sil.org + +Copyright: +Copyright 1999-2006 SIL International + +Graphite is copyrighted under the SIL Dual License +This can be found on http://fieldworks.sil.org/License/SIL_open_source_license_frame.htm + +Graphite, Version .9 Copyright 2001, SIL International, Inc. All rights reserved. +This software is free; you can redistribute it and/or modify it under the terms of either: +a) the GNU "GNU Lesser General Public License version 2.1" as published by the Free Software +Foundation, or b) the "Common Public License Version 0.5". + +This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; +without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +See either the GNU Lesser General Public License or the Common Public License for more details. + + On Debian systems, the complete text of the GNU Lesser General Public + License, version 2.1, can be found in /usr/share/common-licenses/LGPL-2.1 + +The IBM Common Public License follows: +Common Public License Version 0.5 + +Common Public License Version 0.5 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS COMMON PUBLIC LICENSE +("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S +ACCEPTANCE OF THIS AGREEMENT. + + + +1. DEFINITIONS + +"Contribution" means: + + a) in the case of the initial Contributor, the initial code and documentation distributed +under this Agreement, and + + b) in the case of each subsequent Contributor: + + i) changes to the Program, and + + ii) additions to the Program; + + where such changes and/or additions to the Program originate from and are distributed by +that particular Contributor. A Contribution 'originates' from a Contributor if it was added to +the Program by such Contributor itself or anyone acting on such Contributor's behalf. +Contributions do not include additions to the Program which: (i) are separate modules of +software distributed in conjunction with the Program under their own license agreement, and +(ii) are not derivative works of the Program. + + + +"Contributor" means any person or entity that distributes the Program. + + + +"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily +infringed by the use or sale of its Contribution alone or when combined with the Program. + + + +"Program" means the Contributions distributed in accordance with this Agreement. + + + +"Recipient" means anyone who receives the Program under this Agreement, including all +Contributors. + + + +2. GRANT OF RIGHTS + + a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a +non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works +of, publicly display, publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and object code form. + + b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a +non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, +sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if +any, in source code and object code form. This patent license shall apply to the combination of +the Contribution and the Program if, at the time the Contribution is added by the Contributor, +such addition of the Contribution causes such combination to be covered by the Licensed +Patents. The patent license shall not apply to any other combinations which include the +Contribution. No hardware per se is licensed hereunder. + + c) Recipient understands that although each Contributor grants the licenses to its +Contributions set forth herein, no assurances are provided by any Contributor that the Program +does not infringe the patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by any other entity based +on infringement of intellectual property rights or otherwise. As a condition to exercising the +rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to +secure any other intellectual property rights needed, if any. For example, if a third party +patent license is required to allow Recipient to distribute the Program, it is Recipient's +responsibility to acquire that license before distributing the Program. + + d) Each Contributor represents that to its knowledge it has sufficient copyright rights +in its Contribution, if any, to grant the copyright license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form under its own license +agreement, provided that: + + a) it complies with the terms and conditions of this Agreement; and + + b) its license agreement: + + i) effectively disclaims on behalf of all Contributors all warranties and conditions, +express and implied, including warranties or conditions of title and non-infringement, and +implied warranties or conditions of merchantability and fitness for a particular purpose; + + ii) effectively excludes on behalf of all Contributors all liability for damages, +including direct, indirect, special, incidental and consequential damages, such as lost +profits; + + iii) states that any provisions which differ from this Agreement are offered by that +Contributor alone and not by any other party; and + + iv) states that source code for the Program is available from such Contributor, and +informs licensees how to obtain it in a reasonable manner on or through a medium customarily +used for software exchange. + +When the Program is made available in source code form: + + a) it must be made available under this Agreement; and + + b) a copy of this Agreement must be included with each copy of the Program. + + + +Contributors may not remove or alter any copyright notices contained within the Program. + + + + + +Each Contributor must identify itself as the originator of its Contribution, if any, in a +manner that reasonably allows subsequent Recipients to identify the originator of the +Contribution. + + + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain responsibilities with respect to end +users, business partners and the like. While this license is intended to facilitate the +commercial use of the Program, the Contributor who includes the Program in a commercial product +offering should do so in a manner which does not create potential liability for other +Contributors. Therefore, if a Contributor includes the Program in a commercial product +offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify +every other Contributor ("Indemnified Contributor") against any losses, damages and costs +(collectively "Losses") arising from claims, lawsuits and other legal actions brought by a +third party against the Indemnified Contributor to the extent caused by the acts or omissions +of such Commercial Contributor in connection with its distribution of the Program in a +commercial product offering. The obligations in this section do not apply to any claims or +Losses relating to any actual or alleged intellectual property infringement. In order to +qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in +writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with +the Commercial Contributor in, the defense and any related settlement negotiations. The +Indemnified Contributor may participate in any such claim at its own expense. + + + +For example, a Contributor might include the Program in a commercial product offering, Product +X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes +performance claims, or offers warranties related to Product X, those performance claims and +warranties are such Commercial Contributor's responsibility alone. Under this section, the +Commercial Contributor would have to defend claims against the other Contributors related to +those performance claims and warranties, and if a court requires any other Contributor to pay +any damages as a result, the Commercial Contributor must pay those damages. + + + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT +LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS +FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the +appropriateness of using and distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement, including but not limited to the risks and costs of +program errors, compliance with applicable laws, damage to or loss of data, programs or +equipment, and unavailability or interruption of operations. + + + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL +HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS +GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + + + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under applicable law, it shall +not affect the validity or enforceability of the remainder of the terms of this Agreement, and +without further action by the parties hereto, such provision shall be reformed to the minimum +extent necessary to make such provision valid and enforceable. + + + +If Recipient institutes patent litigation against a Contributor with respect to a patent +applicable to software (including a cross-claim or counterclaim in a lawsuit), then any patent +licenses granted by that Contributor to such Recipient under this Agreement shall terminate as +of the date such litigation is filed. In addition, If Recipient institutes patent litigation +against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the +Program itself (excluding combinations of the Program with other software or hardware) +infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) +shall terminate as of the date such litigation is filed. + + + +All Recipient's rights under this Agreement shall terminate if it fails to comply with any of +the material terms or conditions of this Agreement and does not cure such failure in a +reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights +under this Agreement terminate, Recipient agrees to cease use and distribution of the Program +as soon as reasonably practicable. However, Recipient's obligations under this Agreement and +any licenses granted by Recipient relating to the Program shall continue and survive. + + + +Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid +inconsistency the Agreement is copyrighted and may only be modified in the following manner. +The Agreement Steward reserves the right to publish new versions (including revisions) of this +Agreement from time to time. No one other than the Agreement Steward has the right to modify +this Agreement. IBM is the initial Agreement Steward. IBM may assign the responsibility to +serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement +will be given a distinguishing version number. The Program (including Contributions) may always +be distributed subject to the version of the Agreement under which it was received. In +addition, after a new version of the Agreement is published, Contributor may elect to +distribute the Program (including its Contributions) under the new version. Except as expressly +stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the +intellectual property of any Contributor under this Agreement, whether expressly, by +implication, estoppel or otherwise. All rights in the Program not expressly granted under this +Agreement are reserved. + + + +This Agreement is governed by the laws of the State of New York and the intellectual property +laws of the United States of America. No party to this Agreement will bring a legal action +under this Agreement more than one year after the cause of action arose. Each party waives its +rights to a jury trial in any resulting litigation. diff --git a/Build/source/libs/graphite/engine-2.4/debian/libgraphite-dev.dirs b/Build/source/libs/graphite/engine-2.4/debian/libgraphite-dev.dirs new file mode 100644 index 00000000000..c08dc81a2ef --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/debian/libgraphite-dev.dirs @@ -0,0 +1,4 @@ +usr/lib +usr/lib/pkgconfig +usr/include/silgraphite + diff --git a/Build/source/libs/graphite/engine-2.4/debian/libgraphite-dev.docs b/Build/source/libs/graphite/engine-2.4/debian/libgraphite-dev.docs new file mode 100644 index 00000000000..580e2eceefa --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/debian/libgraphite-dev.docs @@ -0,0 +1,5 @@ +build-tree/silgraphite-2.4/doc/GTF.odt +build-tree/silgraphite-2.4/doc/V2_Engine_Interface.odt +build-tree/silgraphite-2.4/doc/V2_Segment_Interface.odt +build-tree/silgraphite-2.4/doc/V2_TextSource_Interface.odt + diff --git a/Build/source/libs/graphite/engine-2.4/debian/libgraphite-dev.install b/Build/source/libs/graphite/engine-2.4/debian/libgraphite-dev.install new file mode 100644 index 00000000000..e1c2c58c292 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/debian/libgraphite-dev.install @@ -0,0 +1,4 @@ +debian/tmp/usr/include +debian/tmp/usr/lib/libgraphite.a +debian/tmp/usr/lib/lib*.so +debian/tmp/usr/lib/pkgconfig diff --git a/Build/source/libs/graphite/engine-2.4/debian/rules b/Build/source/libs/graphite/engine-2.4/debian/rules new file mode 100644 index 00000000000..837cc7e926b --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/debian/rules @@ -0,0 +1,12 @@ +#!/usr/bin/make -f +#DEB_AUTO_UPDATE_DEBIAN_CONTROL:=yes + +DEB_TAR_SRCDIR := silgraphite-2.4 +include /usr/share/cdbs/1/rules/tarball.mk + +include /usr/share/cdbs/1/rules/debhelper.mk +include /usr/share/cdbs/1/class/autotools.mk +#DEB_CONFIGURE_EXTRA_FLAGS := --enable-final +DEB_DH_MAKESHLIBS_ARGS_libgraphite4 := -V"libgraphite4 (>= 2.4)" +DEB_COMPRESS_EXCLUDE := .rtf +DEB_DH_STRIP_ARGS := --dbg-package=libgraphite4 diff --git a/Build/source/libs/graphite/engine-2.4/doc/GTF.odt b/Build/source/libs/graphite/engine-2.4/doc/GTF.odt new file mode 100644 index 00000000000..1699b656b84 Binary files /dev/null and b/Build/source/libs/graphite/engine-2.4/doc/GTF.odt differ diff --git a/Build/source/libs/graphite/engine-2.4/doc/GTF_1_0.pdf b/Build/source/libs/graphite/engine-2.4/doc/GTF_1_0.pdf new file mode 100644 index 00000000000..fa53d5738b8 Binary files /dev/null and b/Build/source/libs/graphite/engine-2.4/doc/GTF_1_0.pdf differ diff --git a/Build/source/libs/graphite/engine-2.4/doc/GTF_2_0.pdf b/Build/source/libs/graphite/engine-2.4/doc/GTF_2_0.pdf new file mode 100644 index 00000000000..89decf3d34e Binary files /dev/null and b/Build/source/libs/graphite/engine-2.4/doc/GTF_2_0.pdf differ diff --git a/Build/source/libs/graphite/engine-2.4/doc/GTF_3_0.pdf b/Build/source/libs/graphite/engine-2.4/doc/GTF_3_0.pdf new file mode 100644 index 00000000000..a643bf5da2f Binary files /dev/null and b/Build/source/libs/graphite/engine-2.4/doc/GTF_3_0.pdf differ diff --git a/Build/source/libs/graphite/engine-2.4/doc/GTF_4.0.pdf b/Build/source/libs/graphite/engine-2.4/doc/GTF_4.0.pdf new file mode 100644 index 00000000000..2f783fc9541 Binary files /dev/null and b/Build/source/libs/graphite/engine-2.4/doc/GTF_4.0.pdf differ diff --git a/Build/source/libs/graphite/engine-2.4/doc/Stack Machine Commands_3_0.pdf b/Build/source/libs/graphite/engine-2.4/doc/Stack Machine Commands_3_0.pdf new file mode 100644 index 00000000000..ed06aa027c5 Binary files /dev/null and b/Build/source/libs/graphite/engine-2.4/doc/Stack Machine Commands_3_0.pdf differ diff --git a/Build/source/libs/graphite/engine-2.4/doc/V2_Engine_Interface.odt b/Build/source/libs/graphite/engine-2.4/doc/V2_Engine_Interface.odt new file mode 100644 index 00000000000..877bb6c95cb Binary files /dev/null and b/Build/source/libs/graphite/engine-2.4/doc/V2_Engine_Interface.odt differ diff --git a/Build/source/libs/graphite/engine-2.4/doc/V2_Segment_Interface.odt b/Build/source/libs/graphite/engine-2.4/doc/V2_Segment_Interface.odt new file mode 100644 index 00000000000..d69f985bbc0 Binary files /dev/null and b/Build/source/libs/graphite/engine-2.4/doc/V2_Segment_Interface.odt differ diff --git a/Build/source/libs/graphite/engine-2.4/doc/V2_TextSource_Interface.odt b/Build/source/libs/graphite/engine-2.4/doc/V2_TextSource_Interface.odt new file mode 100644 index 00000000000..dc869c986c3 Binary files /dev/null and b/Build/source/libs/graphite/engine-2.4/doc/V2_TextSource_Interface.odt differ diff --git a/Build/source/libs/graphite/engine-2.4/doc/hungarian.txt b/Build/source/libs/graphite/engine-2.4/doc/hungarian.txt new file mode 100644 index 00000000000..946c9a4bc97 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/doc/hungarian.txt @@ -0,0 +1,126 @@ +GRAPHITE HUNGARIAN NOTATION + +General rules for variable names: + +* Syntax is: + scope indicator (if any) + combining prefix (zero or more) + type/class indicator (required) + usage labels (optional) + +* The only places underscores are used are after the scoping prefixes. Uppercase is used to separate the prefixes from the main label, if any; eg: strName, m_psegNew. + +* If you are creating a new class, make up a short indicator for it and use it consistently. Class indicators should be 3-6 characters long. + +* An appropriate way to indicate method arguments where necessary is with an "Arg" usage label, eg: nValueArg. Generally method arguments have no special indication. + +* Usage labels can be made up arbitrarily, but the ones listed below should be used if they apply. + + +*** Scope indicators: + +m_ member variable +s_ static (global) variable + + +*** Combining prefixes: + +i index +c counter +p pointer +pp double pointer +rg range (array, especially stack-allocated) +prg pointer to the start of an array (often used for method arguments) +v vector +d delta or difference +k constant (combines with an enumeration identifier: eg, klb, kest, kgmet, etc) + + +*** Basic type indicators: + +f boolean (flag) +n integer (simple numerical value--not a counter, index, glyph id, char, measurement, etc.) +b byte +l long integer (whatever that means) +ch character (width irrelevant) +chs short character (8-bit) +chw wide character (16-bit) +chl long (32-bit) character +str string (char-width irrelevant) +sta ANSI string (8-bit) +stu Unicode string (16-bit) +fxd fixed-field integer +v void (yes, this duplicates vector) + +Graphite specific integer types: + +gid glyph id +m em-units +xs logical units, x-coordinates (source) +ys logical units, y-coordinates (source) +xys logical units, x- or y-coordinates (source) +xd display units, x-coordinates +yd display units, y-coordinates +xyd display units, x- or y-coordinates + + +*** Common Graphite-specific class prefixes (not a complete list) + +seg Segment +font Font +txsrc TextSource +fface FontFace +pass GrPass +greng GrEngine +tman GrTableManager +sstrm GrSlotStream +slot GrSlotState +slout GrSlotOutput +chstrm GrCharStream +gbb glyph bounding box + + +*** Enumeration prefixes (see the GrConstants.h and GrData.h files for a more complete list) + +lb line break (breakweight) +twsh trailing whitespace handling +est end-segment type (why the segment was terminated) +dm draw mode (for insertion points) +dirc directionality code +slat slot attribute name +clr color +op operator in Graphite's stack machine + + +*** Usage labels (somewhat optional, depending on context) + +Min first in a sequence or array (used with Lim); minimum (used with Max) +Lim 1 + last in a sequence or array +Max maximum +First first in a sequence (used with Last) +Last last in a sequence +Prev previous +Next next +Ret return value +In input +Out output +New newly created object +Arg method argument + +----------------- + +EXAMPLES + +pf pointer to boolean +cch character count +ipassPrev index of previous pass +pppass pointer to a pointer to a pass +iislot index to an index to a GrSlotState +vich vector of character indices +prgchw pointer to the start of a wide-char buffer +dislot delta to apply to an index of a GrSlotState +m_ipass index of pass (member variable) +ppassNew pointer to a newly created pass +clrBack background color +m_igbbFirst index to the first glyph bounding box (member variable) +islotLim 1 + index of the last slot \ No newline at end of file diff --git a/Build/source/libs/graphite/engine-2.4/doc/policy.txt b/Build/source/libs/graphite/engine-2.4/doc/policy.txt new file mode 100644 index 00000000000..e3acbb4bcec --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/doc/policy.txt @@ -0,0 +1,19 @@ +POLICIES + +This document keeps a dated list of policy changes that we may come up with +or recind or generally do whatever we want with. There's no carefully worked +out framework in which these policies sit, they are just rules we intend +to keep and break when we need to! + +2007-04-02 + +API Changes Policy + +Any changes to the public API will be documented on the developers' list along +with a branch into which the corresponding code changes will be placed. +Following the announcement, the branch will not be merged into the trunk for +at least 1 week. After which, depending on how the development has gone and +the comments or otherwise, the merge may: take place unannounced, be delayed +unannounced or be dropped and not take place, in which case an announcement +will be made on the developers' list. + diff --git a/Build/source/libs/graphite/engine-2.4/include/Makefile.am b/Build/source/libs/graphite/engine-2.4/include/Makefile.am new file mode 100644 index 00000000000..83286118d8d --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/include/Makefile.am @@ -0,0 +1,29 @@ +graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/FileFont.h +graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/Font.h +graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/GraphiteProcess.h +graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/GrAppData.h +graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/GrClient.h +graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/GrCommon.h +graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/GrConstants.h +graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/GrData.h +graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/GrDebug.h +graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/GrExt.h +graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/GrFeature.h +graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/GrMstypes.h +graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/GrPlatform.h +graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/GrResult.h +graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/GrStructs.h +graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/GrWrappers.h +graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/IGraphiteProcess.h +graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/IGrEngine.h +graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/IGrJustifier.h +graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/ITextSource.h +graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/MemoryUsage.h +graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/SegmentAux.h +graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/Segment.h +graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/SegmentPainter.h + +EXTRA_DIST += $(top_srcdir)/include/graphite/BinTree.h +EXTRA_DIST += $(top_srcdir)/include/graphite/GenericResource.h +EXTRA_DIST += $(top_srcdir)/include/graphite/HashMap.h + diff --git a/Build/source/libs/graphite/engine-2.4/include/graphite/BinTree.h b/Build/source/libs/graphite/engine-2.4/include/graphite/BinTree.h new file mode 100644 index 00000000000..a487df03770 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/include/graphite/BinTree.h @@ -0,0 +1,71 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 1999, 2001 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: BinTree.h +Responsibility: Darrell Zook +Last reviewed: 9/8/99 + +Description: + This file provides declarations of binary tree class(es). +----------------------------------------------------------------------------------------------*/ +#ifdef _MSC_VER +#pragma once +#endif +#ifndef BINTREE_H_INCLUDED +#define BINTREE_H_INCLUDED + +/*---------------------------------------------------------------------------------------------- + This template class implements a balanced tree, which is a binary tree where the height of + the two children of any node in the tree can only be different by +/- 1 or 0. + + The class of objects to be stored in the tree should be derived from BalTreeBase, because + the constructor of BalTreeBase adds an object to the tree in sorted order without + allocating any memory. + + Classes that derive from BalTreeBase must have a CompareKey member function that compares + a given key with this->key to determine which should be first when sorting the tree. + The declaration of CompareKey should be as follows: + int CompareKey(const Key & key); + and it should return: + <0 if key is less than the key in the current node (this->key) + 0 if key is equal to the key in the current node (this->key) + >0 if key is greater than the key in the current node (this->key) + + CAUTION: Classes that use this template should never be dynamically instantiated (by using + local variables or new/NewObj). This class is meant to be used only for global + instances of a class. The reason for this restriction is that the tree is never + destroyed, so using dynamic instantiations of objects would result in stale pointers + in the tree. + + Hungarian: btb +----------------------------------------------------------------------------------------------*/ + +template class BalTreeBase +{ +protected: + // Pointers to the left and right subtrees. + Obj * m_rgpobj[2]; + + // The difference between the height of the right sub tree and the height of the left + // sub tree. This should be -1, 0, or +1. Insert may temporarily set it to -2 or +2. + short m_dht; + + // Which way we went from this node when inserting the new node. + short m_ipobj; + + // Inserts this in the balanced tree. + BalTreeBase(Obj ** ppobjRoot, const Key & key); + + // Returns a node with the given key from the tree rooted at pobjRoot. + static Obj * Find(Obj * pobjRoot, const Key & key); + +private: + // Inserts a node in the tree rooted at *ppobjRoot, sorting it based on key. + void Insert(Obj ** ppobjRoot, const Key & key); +}; + +#endif // !BINTREE_H_INCLUDED + diff --git a/Build/source/libs/graphite/engine-2.4/include/graphite/FileFont.h b/Build/source/libs/graphite/engine-2.4/include/graphite/FileFont.h new file mode 100644 index 00000000000..bbb26266c71 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/include/graphite/FileFont.h @@ -0,0 +1,260 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 1999, 2001, 2005 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: XftFont.h +Responsibility: Keith Stribley +Last reviewed: Not yet. + +Description: + A Font is an object that represents a font-family + bold + italic setting, that contains + Graphite tables. +----------------------------------------------------------------------------------------------*/ +#ifndef FILEFONT_INCLUDED +#define FILEFONT_INCLUDED +#include "Font.h" + + +//:End Ignore + + +namespace gr +{ + +class FontTableCache; +class GrEngine; +/*----------------------------------------------------------------------------- + Stock implementation of an Xft font class. +------------------------------------------------------------------------------*/ +/** +* An implementation of the Graphite gr::Font class for Xft fonts for use on +* systems using X. Freetype is used to retrieve font information. +* If you are using Freetype directly, without Xft, you can pass in a FT_Face +* directly. +*/ +class FileFont : public Font +{ +public: + /** + * The main user constructor. Constructs the font from the supplied FILE pointer. + * @param file the FILE pointer to initialise from (must not be null) + */ + FileFont(FILE * file, float pointSize, unsigned int DPIx, unsigned int DPIy = 0); + + /** + * Alternative user constructor. Constructs the font from the supplied filename. + * @param filename character array + */ + FileFont(char * filename, float pointSize, unsigned int DPIx, unsigned int DPIy = 0); + + /** + * Alternative user constructor. Constructs the font from the supplied filename. + * @param filename as a string + */ + FileFont(std::string filename, float pointSize, + unsigned int DPIx, unsigned int DPIy = 0); + + + /** + * Destructor - cleans up the tables that it has allocated if all other copies + * of this font have been deleted. + */ + virtual ~FileFont(); + + /** + * Returns a copy of the recipient. Specifically needed to store the Font + * in a segment. + * @internal + */ + virtual Font * copyThis(); + + /** + * Copy constructor - note the tables are shared between the copy and the + * original font for efficiency reasons. + * The last copy to be deleted will delete the tables. + * @param font the XftGrFont object to copy from. + * @internal + */ + FileFont(const FileFont & font, float pointSize = 0, unsigned int DPIx = 0, unsigned int DPIy = 0); + + //virtual FontErrorCode isValidForGraphite(int * pnVersion = NULL, int * pnSubVersion = NULL); + /** + * Returns a pointer to the start of a table in the font. The ftblid32 type + * is a 32-bit unsigned integer. + * If the Font class cannot easily determine the length of the table, it may + * set 0 as the length (while returning a non-NULL pointer to the table). This + * means that certain kinds of error checking cannot be done by the Graphite + * engine. + * Throws an exception if there is some other error in reading the table, or if + * the table asked for is not one of the expected ones (cmap, head, name, Sile, + * Silf, Feat, Gloc, Glat). [If we want to be able to read “non-standard” + * tables, then the caller needs to be responsible for freeing the memory.] + */ + virtual const void * getTable(fontTableId32 tableID, size_t * pcbSize); + + /** + * Returns the basic metrics of the font. It corresponds to the current + * GrGraphics::get_FontAscent, get_FontDescent and GetFontEmSquare methods. + * @param pAscent pointer to hold font ascent + * @param pDescent pointer to hold font descent + * @param pEmSquare pointer to hold font EM square + */ + virtual void getFontMetrics(float * pAscent, float * pDescent = NULL, + float * pEmSquare = NULL); + + /** + * Returns true if the given arguments specify a font that contains Graphite + * tables—specfically a “Silf” table. + * @param xftFont XftFont pointer + * @return true if this font has the silf table + */ + bool fontHasGraphiteTables(); + + /** + * Returns true if the given arguments specify a font that contains Graphite + * tables—specfically a “Silf” table. + * @param xftFont XftFont pointer + * @return true if this font has the silf table + */ + static bool FontHasGraphiteTables(FILE * file); + + /** + * Returns true if the given arguments specify a font that contains Graphite + * tables—specfically a “Silf” table. + * @param face FT_Face handle + * @return true if this font has the silf table + */ + static bool FontHasGraphiteTables(char * filename); + + // Temporary, until interface gets thoroughly reworked: + GrEngine * GraphiteEngine(); + + /** + * Returns the font ascent in pixels. Using floating point allows us to + * avoid rounding errors. + * Value is the same as that returned by getFontMetrics() + * @return the font ascent + */ + virtual float ascent() + { + float pixAscent; + getFontMetrics(&pixAscent); + return pixAscent; + } + /** + * Returns the font descent in pixels with a positive sign. + * Value is the same as that returned by getFontMetrics() + * @return the font descent in pixels. + */ + virtual float descent() + { + float pixDescent; + getFontMetrics(NULL, &pixDescent); + return pixDescent; + } + /** + * Returns the total height of the font. + * Equivalent to ascent() + descent(). + * @return font height + */ + virtual float height() + { + float pixAscent; + float pixDescent; + getFontMetrics(&pixAscent, &pixDescent); + return (pixAscent + pixDescent); + } + /** + * @return true if the font is a bold styled one. + */ + virtual bool bold() + { + return m_fBold; + } + /** + * @return true if the font is italic + */ + virtual bool italic() + { + return m_fItalic; + } + /** @return the DPI for the x-axis. + */ + virtual unsigned int getDPIx() + { + return m_dpiX; + } + /** @return Returns the DPI for the y-axis. + */ + virtual unsigned int getDPIy() + { + return m_dpiY; + } + // Specific to XftGrFont: + + /** @return set the DPI for the x-axis. + */ + virtual void setDPIx(unsigned int dpi) + { + m_dpiX = dpi; + m_xScale = scaleFromDpi(dpi); + } + /** @return set the DPI for the y-axis. + */ + virtual void setDPIy(unsigned int dpi) + { + m_dpiY = dpi; + m_yScale = scaleFromDpi(dpi); + } + + bool isValid() { return m_fIsValid; }; +protected: + /** Default constructor is not used */ + FileFont(); + /** + * Common initialisation between the XftFont and FT_Face constructors. + */ + void initializeFromFace(void); + // this uses an int to avoid having to include TtfUtil.h in the include + // directory + byte * readTable(int /*TableId*/ tableId, size_t & size); + + // pixels-per-em = dpi * point-size / 72 + // pixel-coord = design-coord * pixels-per-em / font-em-square + float scaleFromDpi(int dpi) + { + return (dpi * m_pointSize) / (72.0f * m_mEmSquare); + } + + // Member variables: + FILE * m_pfile; + + unsigned long m_clrFore; + unsigned long m_clrBack; + bool m_fBold; + bool m_fItalic; + // font table caches: + FontTableCache * m_pTableCache; + + // KRS: I think these should be cached otherwise Segment::LineContextSegment doesn't work + float m_mAscent; + float m_mDescent; + float m_mEmSquare; + float m_pointSize; + int m_dpiX; + int m_dpiY; + bool m_fIsValid; + std::wstring m_stuFaceName; + byte * m_pHeader; + byte * m_pTableDir; + float m_xScale; + float m_yScale; +}; + + +} // namespace gr + +#endif + diff --git a/Build/source/libs/graphite/engine-2.4/include/graphite/Font.h b/Build/source/libs/graphite/engine-2.4/include/graphite/Font.h new file mode 100644 index 00000000000..186757aa9df --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/include/graphite/Font.h @@ -0,0 +1,417 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 1999, 2001 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: Font.h +Responsibility: Sharon Correll +Last reviewed: Not yet. + +Description: + A Font is an object that represents a font-family + bold + italic setting, that contains + Graphite tables. This file also includes related iterators: FeatureIterator, + FeatureSettingIterator, FeatLabelLangIterator, LanguageIterator. +----------------------------------------------------------------------------------------------*/ +#ifdef _MSC_VER +#pragma once +#endif +#ifndef FONT_INCLUDED +#define FONT_INCLUDED + +//:End Ignore + +namespace gr +{ + +class Font; +class FontFace; +class FeatureSettingIterator; +class Segment; +class LayoutEnvironment; +class ITextSource; +class FontMemoryUsage; + +typedef struct tagFontProps +{ + unsigned long clrFore; + unsigned long clrBack; + bool fBold; + bool fItalic; + float pixHeight; + wchar_t szFaceName[ 32 ]; +} FontProps; + + +/*---------------------------------------------------------------------------------------------- + A FontError object is an exception that is thrown when there is an error in initializing + a Graphite font. +----------------------------------------------------------------------------------------------*/ +struct FontException +{ + FontErrorCode errorCode; + int version; + int subVersion; +}; + +/*---------------------------------------------------------------------------------------------- + Iterator to provide access to a font's features. +----------------------------------------------------------------------------------------------*/ +class FeatureIterator +{ + friend class Font; + friend class FeatureSettingIterator; + +public: + FeatureIterator() // needed for creating std::pair of these, and for default FSI + { + m_pfont = NULL; + m_ifeat = 0; + m_cfeat = 0; + } + +protected: + FeatureIterator(Font * pfont, int ifeat, size_t cfeat) + { + m_pfont = pfont; + m_ifeat = ifeat; + m_cfeat = cfeat; + } +public: + featid operator*(); + FeatureIterator operator++(); + FeatureIterator operator+=(int n); + bool operator==(FeatureIterator &); + bool operator!=(FeatureIterator &); + int operator-(FeatureIterator &); + +protected: + Font * m_pfont; + size_t m_ifeat; // feature being pointed at + size_t m_cfeat; // number of features for this font + + FeatureSettingIterator BeginSetting(); + FeatureSettingIterator EndSetting(); +}; + +/*---------------------------------------------------------------------------------------------- + Iterator to provide access to the defined values for a single font feature. +----------------------------------------------------------------------------------------------*/ +class FeatureSettingIterator +{ + friend class Font; + friend class FeatureIterator; + +public: + FeatureSettingIterator() // needed for creating std::pair of these, I think + { + m_ifset = 0; + m_cfset = 0; + } +protected: + FeatureSettingIterator(FeatureIterator fit, int ifset, size_t cfset) + { + m_fit = fit; + m_ifset = ifset; + m_cfset = cfset; + } +public: + int operator*(); + FeatureSettingIterator operator++(); + FeatureSettingIterator operator +=(int n); + bool operator==(FeatureSettingIterator &); + bool operator!=(FeatureSettingIterator &); + int operator-(FeatureSettingIterator); + +protected: + FeatureIterator m_fit; + size_t m_ifset; // which setting being pointed at + size_t m_cfset; // number of settings for this feature +}; + +/*---------------------------------------------------------------------------------------------- + Iterator to provide access to the languages available for the feature label strings. +----------------------------------------------------------------------------------------------*/ +class FeatLabelLangIterator +{ + friend class Font; + +public: + FeatLabelLangIterator() // needed for creating std::pair of these, and for default FSI + { + m_pfont = NULL; + m_ilang = 0; + m_clang = 0; + } + +protected: + FeatLabelLangIterator(Font * pfont, int ilang, size_t clang) + { + m_pfont = pfont; + m_ilang = ilang; + m_clang = clang; + } +public: + data16 operator*(); + FeatLabelLangIterator operator++(); + FeatLabelLangIterator operator+=(int n); + bool operator==(FeatLabelLangIterator &); + bool operator!=(FeatLabelLangIterator &); + int operator-(FeatLabelLangIterator &); + +protected: + Font * m_pfont; + size_t m_ilang; // language being pointed at + size_t m_clang; // number of languages for this font +}; + +/*---------------------------------------------------------------------------------------------- + Iterator to provide access to a font's defined languages--ie, those that have feature + settings associated with them. +----------------------------------------------------------------------------------------------*/ +class LanguageIterator +{ + friend class Font; + +public: + LanguageIterator() // needed for creating std::pair of these, and for default FSI + { + m_pfont = NULL; + m_ilang = 0; + m_clang = 0; + } + +protected: + LanguageIterator(Font * pfont, int ilang, size_t clang) + { + m_pfont = pfont; + m_ilang = ilang; + m_clang = clang; + } +public: + isocode operator*(); // returns a 4-char array + LanguageIterator operator++(); + LanguageIterator operator+=(int n); + bool operator==(LanguageIterator &); + bool operator!=(LanguageIterator &); + int operator-(LanguageIterator &); + +protected: + Font * m_pfont; + size_t m_ilang; // language being pointed at + size_t m_clang; // number of languages for this font +}; + +/*---------------------------------------------------------------------------------------------- + Abstract superclass for Graphite fonts. A font represents a face name, size, and bold and + italic styles. +----------------------------------------------------------------------------------------------*/ +class Font { + + friend class FeatureIterator; + friend class FeatureSettingIterator; + friend class FeatLabelLangIterator; + friend class LanguageIterator; + friend class FontMemoryUsage; + +public: + virtual ~Font(); + + /** + * Returns a copy of the recipient. Specifically needed to store the + * Font in a segment. + * @internal + * @return pointer to copy + */ + virtual Font * copyThis() = 0; + + /** + * Return wether the font is bold. + * @return true when bold + */ + virtual bool bold() = 0; + /** + * Return wether the font is italic. + * @return true when italic + */ + virtual bool italic() = 0; + + /** + * Returns the slope of the italic (if the font is italic) + * @return ratio of slope from the vertical + */ + virtual float fakeItalicRatio() { return 0; } // no support for fake italic + + /** + * Returns the font ascent. + * Value is the same as that returned by getFontMetrics() + * @return the font ascent in device co-ordinates + */ + virtual float ascent() = 0; + + /** + * Returns the font descent. + * Value is the same as that returned by getFontMetrics() + * @return the font descent in device co-ordinates + */ + virtual float descent() = 0; + + /** + * Returns the total height of the font. + * @return font height in device co-ordinates + */ + virtual float height() = 0; + + /** + * Returns the x and y resolution of the device co-ordinate space. + */ + virtual unsigned int getDPIx() = 0; + virtual unsigned int getDPIy() = 0; + + /** + * Returns a pointer to the start of a table in the font. + * If the Font class cannot easily determine the length of the table, + * it may set 0 as the length (while returning a non-NULL pointer to + * the table). This means that certain kinds of error checking cannot + * be done by the Graphite engine. + * Throws an exception if there is some other error in reading the + * table, or if the table asked for is not in the font. + * @param tableID the TTF ID of the table as a 32-bit long in native machine byte order + * @param pcbSize pointer to a size_t to hold the table size. + * @return address of the buffer containing the table or 0 + */ + virtual const void * getTable(fontTableId32 tableID, size_t * pcbSize) = 0; + /** + * Fetches the basic metrics of the font in device co-ordinates + * (normaly pixels). + * @param pAscent pointer to hold font ascent. + * @param pDescent pointer to hold font descent. + * @param pEmSquare pointer to hold font EM square. + */ + virtual void getFontMetrics(float * pAscent, float * pDescent = NULL, + float * pEmSquare = NULL) = 0; + /** + * Converts the point number of a glyph’s on-curve point to a pair of + * x/y coordinates in pixels. The default implementation will read the + * curve information directly from the font and perform a simple + * transformation to pixels. Some subclasses (e.g., WinFont) will use + * a system-level API call to return hinted metrics. + * Note that the coordinates returned are floating point values in the + * device co-ordinate space (normaly pixels). + * @param gid glyph id + * @param pointNum within glyph + * @param xyReturn reference to a Point object to hold the x,y result + */ + virtual void getGlyphPoint(gid16 glyphID, unsigned int pointNum, gr::Point & pointReturn); + + /** + * Returns the metrics of a glyph in the font. The default + * implementation will read the information directly from the font and + * perform a simple transformation to pixels. Some subclasses (e.g., + * WinFont) will use a system-level API call to return hinted metrics. + * Note that the coordinates returned are floating point values in the + * device co-ordinate space (normaly pixels). + * @param glyphID + * @param boundingBox reference to gr::Rect to hold bounding box of glyph + * @param advances refererence to gr::Point to hold the horizontal / vertical advances + */ + virtual void getGlyphMetrics(gid16 glyphID, gr::Rect & boundingBox, gr::Point & advances); + + static void SetFlushMode(int); + static int GetFlushMode(); + + // obsolete: + //virtual FontErrorCode isValidForGraphite(int * pnVersion = NULL, int * pnSubVersion = NULL) = 0; + + // Features: + std::pair getFeatures(); + FeatureIterator featureWithID(featid id); + bool getFeatureLabel(FeatureIterator, lgid language, utf16 * label); + FeatureSettingIterator getDefaultFeatureValue(FeatureIterator); + std::pair getFeatureSettings(FeatureIterator); + bool getFeatureSettingLabel(FeatureSettingIterator, lgid language, utf16 * label); + + std::pair getFeatureLabelLanguages(); + + // Languages: + std::pair getSupportedLanguages(); + + // Script directions, Verticle, LTR, RTL etc see enum ScriptDirCode + // the posibilities. This returns a bit set where more than one scripts may + // be set, it's up to the app to decide which is the prefered direction to use. + ScriptDirCode getSupportedScriptDirections() const throw(); + + // Debugging: + //static bool DbgCheckFontCache(); + + static FontMemoryUsage calculateMemoryUsage(); + ///FontMemoryUsage calculateMemoryUsage(bool fBold = false, bool fItalic = false); + +public: + // For use in segment creation: + void RenderLineFillSegment(Segment * pseg, ITextSource * pts, LayoutEnvironment & layout, + toffset ichStart, toffset ichStop, float xsMaxWidth, bool fBacktracking); + void RenderRangeSegment(Segment * pseg, ITextSource * pts, LayoutEnvironment & layout, + toffset ichStart, toffset ichEnd); + void RenderJustifiedSegment(Segment * pseg, ITextSource * pts, LayoutEnvironment & layout, + toffset ichStart, toffset ichEnd, float xsCurrentWidth, float xsDesiredWidth); + +protected: + Font(); + Font(const Font &); + + FontFace & fontFace(bool fDumbFallback = false); + + // Feature access: + FeatureIterator BeginFeature(); + FeatureIterator EndFeature(); + + size_t NumberOfFeatures(); + featid FeatureID(size_t ifeat); + size_t FeatureWithID(featid id); + bool GetFeatureLabel(size_t ifeat, lgid language, utf16 * label); + int GetFeatureDefault(size_t ifeat); + size_t NumberOfSettings(size_t ifeat); + int GetFeatureSettingValue(size_t ifeat, size_t ifset); + bool GetFeatureSettingLabel(size_t ifeat, size_t ifset, lgid language, utf16 * label); + + // Feature-label languages: + FeatLabelLangIterator BeginFeatLang(); + FeatLabelLangIterator EndFeatLang(); + + size_t NumberOfFeatLangs(); + short FeatLabelLang(size_t ilang); + + // Language access: + LanguageIterator BeginLanguage(); + LanguageIterator EndLanguage(); + + size_t NumberOfLanguages(); + isocode LanguageCode(size_t ilang); + + virtual void UniqueCacheInfo(std::wstring & stuFace, bool & fBold, bool & fItalic); + +private: + FontFace * m_pfface; // set up with Graphite tables + + // Cache of common tables: + const void * m_pHead; + const void * m_pHhea; + const void * m_pHmtx; + const void * m_pLoca; + const void * m_pGlyf; + size_t m_cbHmtxSize; + size_t m_cbLocaSize; + bool m_fTablesCached; + + void initialiseFontFace(bool fDumbFallback); + void EnsureTablesCached(); +}; + +inline Font::Font() : m_pfface(0), m_fTablesCached(false) +{ } + +} // namespace gr + + +#endif // !FONT_INCLUDED diff --git a/Build/source/libs/graphite/engine-2.4/include/graphite/GenericResource.h b/Build/source/libs/graphite/engine-2.4/include/graphite/GenericResource.h new file mode 100644 index 00000000000..119c6317bcd --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/include/graphite/GenericResource.h @@ -0,0 +1,86 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 1999, 2001 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: GenericResource.h +Responsibility: John Thomson +Last reviewed: + + Resources needed by certain generic components (but must be created in app's or AppCore's + resource file). +----------------------------------------------------------------------------------------------*/ +#ifdef _MSC_VER +#pragma once +#endif +#ifndef GenericResource_H +#define GenericResource_H 1 +// Create suitable resources for these if your app uses StackDumper. +// For example +// STRINGTABLE DISCARDABLE +// BEGIN +// "A programming error (%s) has been detected in module %s.\n Please report this to the developers", kstidInternalError +// "Out of memory. To attempt Save, close other apps and click OK. To quit without saving click Cancel", kstidOutOfMemory +// END + + +// Date qualifier string IDs: +#define kstidDateQualBefore 24200 +#define kstidDateQualOn 24201 +#define kstidDateQualAbout 24202 +#define kstidDateQualAfter 24203 +#define kstidDateQualAbt 24204 +#define kstidDateQualBC 24205 +#define kstidDateQualAD 24206 +#define kstidDateBlank 24207 +#define kstidDateBlankM 24208 +#define kstidDateBlankD 24209 + + +#define kstidInternalError 25900 +#define khcidHelpOutOfMemory 25901 +#define khcidNoHelpAvailable 25902 // default help module when there is no specific one. +#define kstidOutOfMemory 25903 +#define kstidUndoFrame 25904 +#define kstidRedoFrame 25905 + +#define kstidFileErrUnknown 25920 +#define kstidFileErrNotFound 25921 +#define kstidFileErrPathNotFound 25922 +#define kstidFileErrTooManyFiles 25923 +#define kstidFileErrAccDenied 25924 +#define kstidFileErrBadHandle 25925 +#define kstidFileErrBadDrive 25926 +#define kstidFileErrWriteProtect 25927 +#define kstidFileErrBadUnit 25928 +#define kstidFileErrNotReady 25929 +#define kstidFileErrSeek 25930 +#define kstidFileErrNotDosDisk 25931 +#define kstidFileErrBadSector 25932 +#define kstidFileErrWriteFault 25933 +#define kstidFileErrReadFault 25934 +#define kstidFileErrGeneral 25935 +#define kstidFileErrSharing 25936 +#define kstidFileErrLock 25937 +#define kstidFileErrEof 25938 +#define kstidFileErrHandleDiskFull 25939 +#define kstidFileErrBadNetPath 25940 +#define kstidFileErrNetworkBusy 25941 +#define kstidFileErrNoDevice 25942 +#define kstidFileErrNoNetAccess 25943 +#define kstidFileErrBadDevice 25944 +#define kstidFileErrBadNetName 25945 +#define kstidFileErrExists 25946 +#define kstidFileErrCantMake 25947 +#define kstidFileErrBadPassword 25948 +#define kstidFileErrNetWriteFault 25949 +#define kstidFileErrDriveLocked 25950 +#define kstidFileErrOpenFailed 25951 +#define kstidFileErrBufOverflow 25952 +#define kstidFileErrDiskFull 25953 +#define kstidFileErrBadName 25954 +#define kstidFileErrNoVolLabel 25955 +#define kstidFileErrAlreadyExists 25956 + +#endif // !GenericResource_H diff --git a/Build/source/libs/graphite/engine-2.4/include/graphite/GrAppData.h b/Build/source/libs/graphite/engine-2.4/include/graphite/GrAppData.h new file mode 100644 index 00000000000..3a2024b8a10 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/include/graphite/GrAppData.h @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 1999, 2001 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: GrAppData.h +Responsibility: Sharon Correll +Last reviewed: not yet + +Description: + Data structures need by applications that use the Graphite engine. +----------------------------------------------------------------------------------------------*/ + + +#ifndef GRAPPDATA_INCLUDED +#define GRAPPDATA_INCLUDED + +#include "GrData.h" + +namespace gr +{ + +typedef unsigned int featid; // font feature IDs +typedef unsigned int lgid; // language ID (for access feature UI strings) +typedef unsigned int toffset; // text-source index + +typedef struct { // ISO-639-3 language code (for mapping onto features) + char rgch[4]; +} isocode; + +} // namespace gr + +#if defined(GR_NO_NAMESPACE) +using namespace gr; +#endif + +#endif // GRAPPDATA_INCLUDED + diff --git a/Build/source/libs/graphite/engine-2.4/include/graphite/GrClient.h b/Build/source/libs/graphite/engine-2.4/include/graphite/GrClient.h new file mode 100644 index 00000000000..0ef5127c81a --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/include/graphite/GrClient.h @@ -0,0 +1,39 @@ +#ifndef GR_CLIENT_H +#define GR_CLIENT_H + +#include "GrCommon.h" +#include "GrConstants.h" + +#define __RPC_FAR + +namespace gr +{ + +// These are internal classes, whose forward declarations are needed to allow the public interfaces +// to compile but are not intended for client use. +class GrSlotState; +class GrSlotStream; +class GrGlyphTable; +class GrClassTable; +class GrTableManager; +class GrPseudoMap; +class GrFileIStream; +class GrSlotOutput; +class GrCharStream; +class GrIStream; + +// Forward declarations of client APIs and classes. +class Segment; +} + +#include "GrAppData.h" +#include "GrResult.h" +#include "GrFeature.h" + + +#if defined(GR_NO_NAMESPACE) +using namespace gr; +#endif + +#endif //GR_CLIENT_H + diff --git a/Build/source/libs/graphite/engine-2.4/include/graphite/GrCommon.h b/Build/source/libs/graphite/engine-2.4/include/graphite/GrCommon.h new file mode 100644 index 00000000000..87c1721b7a3 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/include/graphite/GrCommon.h @@ -0,0 +1,101 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 1999, 2001, 2003 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: GrCommon.h +Responsibility: Sharon Correll +Last reviewed: + + Common Graphite header file. +----------------------------------------------------------------------------------------------*/ + +#ifndef GRCOMMON_INCLUDED +#define GRCOMMON_INCLUDED + +// Standard Headers. + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +///#include -- possibly needed for std::string Xran and Xlen functions?? + +// Uncomment this to allow multiple versions of gr to coexist +// in the same program e.g. pangographite with gtk uses namespace gr +// mozilla graphite defines this to gr2moz incase the 2 libraries are +// incompatible. +// Provided the client includes GrClient.h first this #define is +// picked up by all files. + +//#define gr gr2 + +// Project headers +#include "GrPlatform.h" + +#ifndef GrAssert +#include +#define GrAssert(exp) assert(exp) +#endif + +using std::max; +using std::min; + +namespace gr +{ + + +/*********************************************************************************************** + Tests for valid strings and pointers. +***********************************************************************************************/ +inline bool ValidPsz(const data16 *pszw) +{ + return pszw != 0 && !GrIsBadStringPtrW(pszw, 0x10000000); +} + +inline bool ValidPsz(const char *pszs) +{ + return pszs != 0 && !GrIsBadStringPtrA(pszs, 0x10000000); +} + +template inline bool ValidReadPtr(T *pt) +{ + return pt != 0 && !GrIsBadReadPtr(pt, sizeof(T)); +} + +template inline bool ValidWritePtr(T *pt) +{ + return pt != 0 && !GrIsBadWritePtr(pt, sizeof(T)); +} + +inline bool ValidReadPtrSize(const void *pv, size_t cb) +{ + if (cb == 0) return true; + + return pv != 0 && !GrIsBadReadPtr(pv, cb); +} + +inline bool ValidWritePtrSize(void *pv, size_t cb) +{ + if (cb == 0) return true; + + return pv != 0 && !GrIsBadWritePtr(pv, cb); +} + + +} // namespace gr + +#if defined(GR_NO_NAMESPACE) +using namespace gr; +#endif + +#endif // !GRCOMMON_INCLUDED + diff --git a/Build/source/libs/graphite/engine-2.4/include/graphite/GrConstants.h b/Build/source/libs/graphite/engine-2.4/include/graphite/GrConstants.h new file mode 100644 index 00000000000..813cb3c4480 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/include/graphite/GrConstants.h @@ -0,0 +1,279 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 1999, 2001 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: constants.h +Responsibility: Sharon Correll +Last reviewed: Not yet. + +Description: + Various global constants. +----------------------------------------------------------------------------------------------*/ +#ifdef _MSC_VER +#pragma once +#endif +#ifndef GRCONSTANTS_INCLUDED +#define GRCONSTANTS_INCLUDED + +//:End Ignore + +#define GRAPHITE_VERSION_MAJOR 2 +#define GRAPHITE_VERSION_MINOR 4 +#define GRAPHITE_VERSION_BUGFIX 0 + +namespace gr +{ + +void EngineVersion(int * nMajor, int * nMinor, int * nBugFix); + + +// Maximum table versions handled by this engine: +enum { + + kSilfVersion = 0x00030001, + kRuleVersion = 0x00030001, + kGlatVersion = 0x00020000, + kGlocVersion = 0x00010000, + kFeatVersion = 0x00020000, + kSileVersion = 0x00010000, + kSillVersion = 0x00010000 + +}; + +enum { + + kMaxFeatures = 64, + kMaxComponentsPerGlyph = 32, + kFieldsPerComponent = 4, + kMaxSlotsPerRule = 64, + kMaxSubTablesInFont = 256, + kMaxUserDefinableSlotAttrs = 64, + kMaxJLevels = 4 + +}; + +// Maxima permitted by the binary format of the TrueType tables. +enum { + + kMaxSubTables = 256, + kMaxRenderingBehavior = 65536, // ie, the maximum value allowed for an ID + kMaxGlyphAttrs = 65536, // Gloc table + kMinGlyphAttrValue =-32768, + kMaxGlyphAttrValue = 32768, + kMaxPasses = 128, // Sil_sub table allows 256 + kMaxPseudos = 65536, + kMaxRendBehaviors = 256, + kMaxReplcmtClasses = 65536, // Class map + kMaxReplcmtClassesV1_2 = 256, + kMaxComponents = 16383 + +}; + + +enum { + + kPosInfinity = 0x3FFFFFF, + kNegInfinity = kPosInfinity * -1, + + kInvalid = kNegInfinity + +}; + +#define kPosInfFloat (float)kPosInfinity +#define kNegInfFloat (float)kNegInfinity + + +enum { + kGpointZero = -2 +}; + + +// for stream processing +enum { + kBacktrack = -2, + kNextPass = -1 +}; + + +// internal justification modes +enum { + kjmodiNormal = 0, + kjmodiMeasure, + kjmodiJustify, + kjmodiCanShrink // like normal, but shrinking is possible +}; + + +enum DirCode { // Hungarian: dirc + + kdircUnknown = -1, + kdircNeutral = 0, // other neutrals (default) - ON + kdircL = 1, // left-to-right, strong - L + kdircR = 2, // right-to-left, strong - R + kdircRArab = 3, // Arabic letter, right-to-left, strong, AR + kdircEuroNum = 4, // European number, left-to-right, weak - EN + kdircEuroSep = 5, // European separator, left-to-right, weak - ES + kdircEuroTerm = 6, // European number terminator, left-to-right, weak - ET + kdircArabNum = 7, // Arabic number, left-to-right, weak - AN + kdircComSep = 8, // Common number separator, left-to-right, weak - CS + kdircWhiteSpace = 9, // white space, neutral - WS + kdircBndNeutral = 10, // boundary neutral - BN + + kdircLRO = 11, // LTR override + kdircRLO = 12, // RTL override + kdircLRE = 13, // LTR embedding + kdircRLE = 14, // RTL embedding + kdircPDF = 15, // pop directional format + + // I think we need this too: + kdircNSM = 16, // non-space mark + + // Special values for internal use: + kdircLlb = 32, // left-to-right line-break + kdircRlb = 33, // right-to-left line-break + kdircPdfL = 34, // PDF marker matching an LRO or LRE + kdircPdfR = 35 // PDF marker matching an RLO or RLE + +}; + + +bool StrongDir(DirCode dirc); +bool WeakDir(DirCode dirc); +bool NeutralDir(DirCode dirc); +bool RightToLeftDir(DirCode dirc); + + +// Unicode characters with special treatments +enum DefinedChars { + + knSpace = 0x0020, // space + knHyphen = 0x002D, // hyphen + + knTab = 0x0009, // tab (horizontal) + knLF = 0x000A, // line feed + knCR = 0x000D, // carriage return + knLineSep = 0x2028, // line separator (soft return) + knParaSep = 0x2029, // paragraph separator + + knLRM = 0x200E, // left-to-right mark + knRLM = 0x200F, // right-to-left mark + knLRE = 0x202A, // left-to-right embedding + knRLE = 0x202B, // right-to-left embedding + knPDF = 0x202C, // pop directional format + knLRO = 0x202D, // left-to-right override + knRLO = 0x202E, // right-to-left override + + knORC = 0xFFFC // Object Replacement Character +}; + +bool BidiCode(int nUnicode); + + +typedef enum SpecialSlots { + + kspslNone = 0, + + kspslLbInitial = 1, + kspslLbFinal = 2, + + kspslLRM = 3, + kspslRLM = 4, + kspslLRO = 5, + kspslRLO = 6, + kspslLRE = 7, + kspslRLE = 8, + kspslPDF = 9 + +} SpecialSlots; + + +// version 1.0 breakweights +enum BreakWeightsV1 +{ + klbv1WordBreak = 1, + klbv1HyphenBreak = 2, + klbv1LetterBreak = 3, + klbv1ClipBreak = 4 +}; + + +typedef enum SlotAttrName { + + kslatAdvX = 0, kslatAdvY, + kslatAttTo, + kslatAttAtX, kslatAttAtY, kslatAttAtGpt, + kslatAttAtXoff, kslatAttAtYoff, + kslatAttWithX, kslatAttWithY, kslatAttWithGpt, + kslatAttWithXoff, kslatAttWithYoff, + kslatAttLevel, + kslatBreak, + kslatCompRef, + kslatDir, + kslatInsert, + kslatPosX, kslatPosY, + kslatShiftX, kslatShiftY, + kslatUserDefnV1, // version 1.0 of the font tables + kslatMeasureSol, kslatMeasureEol, + kslatJStretch, kslatJShrink, kslatJStep, kslatJWeight, kslatJWidth, + + kslatSegsplit = kslatJStretch + 29, // not used in this engine, but reserve for Graphite2 + + // this must be last: + kslatUserDefn = kslatJStretch + 30, + // I think 30 is somewhat arbitrary. We at least need to save 15 slots (5 attrs * 3 levels) + // for more levels of justification attributes. + + kslatMax, + + kslatNoEffect = kslatMax + 1 // for internal use + +} SlotAttrName; + + +typedef enum GlyphMetric { + kgmetLsb = 0, kgmetRsb, + kgmetBbTop, kgmetBbBottom, kgmetBbLeft, kgmetBbRight, + kgmetBbHeight, kgmetBbWidth, + kgmetAdvWidth, kgmetAdvHeight, + kgmetAscent, kgmetDescent +} GlyphMetric; + + +enum ProcessStates +{ + kpstatJustifyMode = 1, + kpstatJustifyLevel = 2 +}; + +// user justification modes: these must match the values in stddef.gdh +enum JustifyModes +{ + kjmoduNormal = 0, + kjmoduMeasure = 1, + kjmoduJustify = 2 +}; + +enum TruetypeTableId { + kttiCmap = 0x636D6170, + kttiFeat = 0x46656174, + kttiGlat = 0x476C6174, + kttiGloc = 0x476C6F63, + kttiGlyf = 0x676C7966, + kttiHead = 0x68656164, + kttiHhea = 0x68686561, + kttiHmtx = 0x686D7478, + kttiLoca = 0x6C6F6361, + kttiMaxp = 0x6D617870, + kttiName = 0x6E616D65, + kttiOs2 = 0x4F532F32, + kttiPost = 0x706F7374, + kttiSile = 0x53696C65, + kttiSilf = 0x53696C66, + kttiSill = 0x53696C6C +}; + +} // namespace gr + +#endif // CONSTANTS_INCLUDED diff --git a/Build/source/libs/graphite/engine-2.4/include/graphite/GrData.h b/Build/source/libs/graphite/engine-2.4/include/graphite/GrData.h new file mode 100644 index 00000000000..8f6285219d6 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/include/graphite/GrData.h @@ -0,0 +1,197 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 1999, 2001 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: GrData.h +Responsibility: Sharon Correll +Last reviewed: Not yet. + +Description: + Data structures needed by the Graphite engine, particularly for argument passing. + NOT to be used within FieldWorks. + +Special Note: + This file needs to be used by C files. Please do not use C++ style comments; use + ONLY C style comments in this file to make the C compiler happy. +----------------------------------------------------------------------------------------------*/ +#ifdef _MSC_VER +#pragma once +#endif +#ifndef GRDATA_INCLUDED +#define GRDATA_INCLUDED + +#include "GrCommon.h" + +/* +//:End Ignore + */ + +#include "GrStructs.h" + +namespace gr +{ + +struct Point +{ + float x; + float y; + + Point(float x_ = 0.0f, float y_ = 0.0f) + : x(x_), y(y_) + { + } + +#if defined(_WIN32) + Point(const POINT& p) + { + x = (float)p.x; + y = (float)p.y; + } +#endif +}; + +struct Rect +{ + float top; + float bottom; + float left; + float right; + + Rect(float l = 0.0f, float t = 0.0f, float r = 0.0f, float b = 0.0f) + : top(t), bottom(b), left(l), right(r) + { + } + +#if defined(_WIN32) + Rect(const RECT& r) + { + top = (float)r.top; + bottom = (float)r.bottom; + left = (float)r.left; + right = (float)r.right; + } +#endif +}; + +enum { + kttvOff = 0, + kttvForceOn = 1, + kttvInvert = 2 +}; + +typedef enum tagSegEnd +{ kestNoMore = 0, + kestMoreLines = kestNoMore + 1, + kestHardBreak = kestMoreLines + 1, + kestBadBreak = kestHardBreak + 1, + kestOkayBreak = kestBadBreak + 1, + kestWsBreak = kestOkayBreak + 1, + kestMoreWhtsp = kestWsBreak + 1, + kestNothingFit = kestMoreWhtsp + 1 +} SegEnd; + +typedef enum tagLgIPDrawMode // TODO: remove +{ kdmNormal = 0, + kdmSplitPrimary = kdmNormal + 1, + kdmSplitSecondary = kdmSplitPrimary + 1 +} LgIPDrawMode; + +typedef enum tagLgIpValidResult +{ kipvrOK = 0, + kipvrBad = kipvrOK + 1, + kipvrUnknown = kipvrBad + 1 +} LgIpValidResult; + +typedef enum tagLineBrk +{ klbNoBreak = 0, + klbWsBreak = 10, + klbWordBreak = 15, + klbHyphenBreak = 20, + klbLetterBreak = 30, + klbClipBreak = 40 +} LineBrk; + +typedef enum tagTrWsHandling +{ ktwshAll = 0, + ktwshNoWs = ktwshAll + 1, + ktwshOnlyWs = ktwshNoWs + 1 +} TrWsHandling; + +typedef enum tagUtfType +{ + kutf8 = 0, + kutf16 = kutf8 + 1, + kutf32 = kutf16 + 1 +} UtfType; + +enum tagFlushMode +{ + kflushAuto = 0, + kflushManual = kflushAuto + 1 +}; + +typedef enum ScriptDirCode +{ kfsdcNone = 0, + kfsdcHorizLtr = 1, + kfsdcHorizRtl = 2, + kfsdcVertFromLeft = 4, + kfsdcVertFromRight = 8 +} ScriptDirCode; + +typedef enum tagFwTextColor +{ kclrWhite = 0xffffff, + kclrBlack = 0, + kclrRed = 0x0000ff, + kclrGreen = 0x00ff00, + kclrBlue = 0xff0000, + kclrReserved1 = 0x80000000, + kclrReserved2 = 0x80000001, + kclrTransparent = 0xc0000000 +} FwTextColor; + + +typedef enum FwSuperscriptVal +{ kssvOff = 0, + kssvSuper = 1, + kssvSub = 2 +} FwSuperscriptVal; + + +// Glyph attributes for justification +typedef enum tagJustGlyphAttr +{ + kjgatStretch = 1, + kjgatShrink, + kjgatWeight, + kjgatStep, + kjgatChunk, + kjgatWidth, + kjgatBreak, + // pseudo-attributes for handling steps: + kjgatStretchInSteps, + kjgatWidthInSteps, + // also metrics: + kjgatAdvWidth, + kjgatAdvHeight, + kjgatBbLeft, + kjgatBbRight, + kjgatBbTop, + kjgatBbBottom +} JustGlyphAttr; // Hungarian: jgat + +class GrSlotState; +typedef union { + int nValue; + short smallint[2]; // min = smallint[0], max = smallint[1] + GrSlotState * pslot; +} u_intslot; + +} // namespace gr + +#if defined(GR_NO_NAMESPACE) +using namespace gr; +#endif + +#endif /* !GRDATA_INCLUDED */ diff --git a/Build/source/libs/graphite/engine-2.4/include/graphite/GrDebug.h b/Build/source/libs/graphite/engine-2.4/include/graphite/GrDebug.h new file mode 100644 index 00000000000..79ba1a4d5db --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/include/graphite/GrDebug.h @@ -0,0 +1,200 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 1999, 2001 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: debug.h +Responsibility: +Last reviewed: + +Description: + Assert and debug definitions. +----------------------------------------------------------------------------------------------*/ + +#ifndef __DEBUG_H__ +#define __DEBUG_H__ + +#include + +namespace gr +{ + +#ifdef _DEBUG + #undef DEBUG + #define DEBUG 1 + #undef NDEBUG + #define DEFINE_THIS_FILE static char THIS_FILE[] = __FILE__; + #undef THIS_FILE + #define THIS_FILE __FILE__ +#else //!_DEBUG + #undef DEBUG + #define DEFINE_THIS_FILE + + //#define Debug(foo) +#endif //!_DEBUG + +#if 0 +//#ifdef DEBUG + +//#include + + typedef void (WINAPI * Pfn_Assert)(const char * pszExp, const char * pszFile, int nLine, + HMODULE hmod); + typedef Pfn_Assert Pfn_Warn; + + /*__declspec(dllimport)*/ void WINAPI WarnProc(const char * pszExp, const char * pszFile, + int nLine, bool fCritical, HMODULE hmod); + /*__declspec(dllimport)*/ void WINAPI AssertProc(const char * pszExp, const char * pszFile, + int nLine, bool fCritical, HMODULE hmod); + + __declspec(dllimport) Pfn_Assert WINAPI SetAssertProc(Pfn_Assert pfnAssert); + __declspec(dllimport) Pfn_Warn WINAPI SetWarnProc(Pfn_Warn pfnWarn); + __declspec(dllimport) int WINAPI HideWarnings(bool f); + __declspec(dllimport) int WINAPI HideAsserts(bool f); + __declspec(dllimport) int WINAPI HideErrors(bool f); + + void WINAPI WarnHrProc(HRESULT hr, const char * pszFile, int nLine, bool fCritical); + void WINAPI WarnProcLocal(const char * pszExp, const char * pszFile, int nLine, + bool fCritical); + void WINAPI AssertProcLocal(const char * pszExp, const char * pszFile, int nLine, + bool fCritical); + + #define Assert(exp) ((exp) || (AssertProcLocal(#exp, THIS_FILE, __LINE__, false), 0)) + #define AssertC(exp) ((exp) || (AssertProcLocal(#exp, THIS_FILE, __LINE__, true), 0)) + #define AssertMsg(exp, msg) ((exp) || (AssertProcLocal(msg, THIS_FILE, __LINE__, false), 0)) + #define AssertMsgC(exp, msg) ((exp) || (AssertProcLocal(msg, THIS_FILE, __LINE__, true), 0)) + + #undef Warn + #define Warn(psz) (void)(WarnProcLocal(psz, THIS_FILE, __LINE__, false)) + #define WarnC(psz) (void)(WarnProcLocal(psz, THIS_FILE, __LINE__, true)) + + #undef WarnIf + #define WarnIf(exp) (void)(!(exp) || (WarnProcLocal("(" #exp ") is true", THIS_FILE, \ + __LINE__, false), 0)) + #define WarnIfC(exp) (void)(!(exp) || (WarnProcLocal("(" #exp ") is true", THIS_FILE, \ + __LINE__, true), 0)) + + #undef WarnUnless + #define WarnUnless(exp) (void)((exp) || (WarnProcLocal("(" #exp ") is false", \ + THIS_FILE, __LINE__, false), 0)) + #define WarnUnlessC(exp) (void)((exp) || (WarnProcLocal("(" #exp ") is false", \ + THIS_FILE, __LINE__, true), 0)) + + #undef WarnHr + #define WarnHr(hr) ((SUCCEEDED(hr) || (WarnHrProc(hr, THIS_FILE, __LINE__, false), 0)), \ + (hr)) + #define WarnHrC(hr) ((SUCCEEDED(hr) || (WarnHrProc(hr, THIS_FILE, __LINE__, true), 0)), \ + (hr)) + + class IgnoreWarnings + { + public: + IgnoreWarnings() + { HideWarnings(true); } + ~IgnoreWarnings() + { HideWarnings(false); } + }; + + class IgnoreAsserts + { + public: + IgnoreAsserts() + { HideAsserts(true); } + ~IgnoreAsserts() + { HideAsserts(false); } + }; + + class IgnoreErrors + { + private: + IgnoreWarnings iw; + IgnoreAsserts ia; + }; + + #define Debug(exp) exp + #define DoAssert(exp) Assert(exp) + #define DoAssertC(exp) AssertC(exp) + #define DoAssertHr(hr) Assert(SUCCEEDED(hr)) + #define DoAssertHrC(hr) AssertC(SUCCEEDED(hr)) +#else + #define Assert(exp) assert(exp) + #define AssertC(exp) + #define AssertMsg(exp, msg) + #define AssertMsgC(exp, msg) + #define Warn(psz) + #define WarnC(psz) + #define WarnIf(exp) + #define WarnIfC(exp) + #define WarnUnless(exp) + #define WarnUnlessC(exp) + #define WarnHr(hr) (hr) + #define WarnHrC(hr) (hr) + #define Debug(exp) + #define DoAssert(exp) (exp) + #define DoAssertC(exp) (exp) + #define DoAssertHr(hr) (hr) + #define DoAssertHrC(hr) (hr) +#endif //DEBUG + +#define AssertPtr(pv) Assert(ValidReadPtr(pv)) +#define AssertPtrN(pv) Assert(!(pv) || ValidReadPtr(pv)) +#define AssertArray(pv, cv) Assert((cv) >= 0 && ValidReadPtrSize((pv), sizeof(*(pv)) * (cv))) +#define AssertArrayN(pv, cv) Assert((cv) >= 0 && (!(pv) || ValidReadPtrSize((pv), sizeof(*(pv)) * (cv)))) +#define AssertPtrSize(pv, cb) Assert((cb) >= 0 && ValidReadPtrSize((pv), cb)) + +#define AssertPfn(pfn) Assert(!IsBadCodePtr((FARPROC)(pfn))) +#define AssertPfnN(pfn) Assert(!(pfn) || !IsBadCodePtr((FARPROC)(pfn))) + +#define AssertPsz(psz) Assert(ValidPsz(psz)) +#define AssertPszN(psz) Assert(!(psz) || ValidPsz(psz)) + +#define AssertBstr(bstr) Assert(ValidBstr(bstr)) +#define AssertBstrN(bstr) Assert(!(bstr) || ValidBstr(bstr)) + +#define AssertObj(pv) Assert(ValidReadPtr(pv) && (pv)->AssertValid()) +#define AssertObjN(pv) Assert(!(pv) || ValidReadPtr(pv) && (pv)->AssertValid()) + +/*---------------------------------------------------------------------------------------------- + This class implements custom output to the debugger. The results of Watch() can be + viewed on a line in the Watch window. Output() writes to the Debugger Output window. + Calls to Output() should be included in the Watch() function as needed. Watch() + is executed every time the debugger displays this class in the Watch window. + To use it: + + 1) Put the following line in: + \program files\Microsoft Visual Studio\Common\MSDev98\bin\AutoExp.dat + in the [AutoExpand] section: + DebugWatch= + + 2) In the class from which you want custom debug output, add the equivalent of: + #ifdef DEBUG + class Dbw1 : public DebugWatch { virtual OLECHAR * Watch(); ... }; + Dbw1 m_dbw1; + #endif //DEBUG + + 3) Implement the Watch() function to display the data you want to see, bracketed by + #ifdef DEBUG / #endif. Note that Output() is LIMITED to 10 pointer-sized arguments. + If you must have more, then call _CrtDbgReport() directly. Note also that + _CrtDbgReport() is not implemented for wide characters, so neither is Output(). +----------------------------------------------------------------------------------------------*/ +#if 0 +//#ifdef DEBUG +class DebugWatch +{ +public: + int m_nSerial; // increment and display this for positive affirmation of refresh + DebugWatch() { m_nSerial = 0; } + OLECHAR * WatchNV(); // debugger won't find it if it is virtual or inline. + virtual OLECHAR * Watch() { return L"No DebugWatch string implemented"; } + void Output (char *fmt, ...); // LIMITED to 10 pointer-sized arguments +}; +#endif //DEBUG + +} // namespace gr + +#if defined(GR_NO_NAMESPACE) +using namespace gr; +#endif + +#endif diff --git a/Build/source/libs/graphite/engine-2.4/include/graphite/GrExt.h b/Build/source/libs/graphite/engine-2.4/include/graphite/GrExt.h new file mode 100644 index 00000000000..518683db29e --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/include/graphite/GrExt.h @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 1999, 2001, 2003 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: GrHelperClases.h +Responsibility: Sharon Correll +Last reviewed: + + External helper classes to be included in the open-source version of the Graphite DLL. + Currently there are none. +----------------------------------------------------------------------------------------------*/ diff --git a/Build/source/libs/graphite/engine-2.4/include/graphite/GrFeature.h b/Build/source/libs/graphite/engine-2.4/include/graphite/GrFeature.h new file mode 100644 index 00000000000..5d510ffcd7c --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/include/graphite/GrFeature.h @@ -0,0 +1,203 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 1999, 2001 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: GrFeature.h +Responsibility: Sharon Correll +Last reviewed: Not yet. + +Description: + +Note: + The body of methods not complete contained in this file are located in GrEngine.cpp. +----------------------------------------------------------------------------------------------*/ +#ifdef _MSC_VER +#pragma once +#endif +#ifndef GR_FEATURE_INCLUDED +#define GR_FEATURE_INCLUDED + +//:End Ignore + +#include "GrAppData.h" + +namespace gr +{ + + +/*---------------------------------------------------------------------------------------------- + A valid setting and its UI labels in potentially various languages. + + Hungarian: fset +----------------------------------------------------------------------------------------------*/ +/**** +class GrFeatureSetting +{ + friend class GrFeature; +public: + GrFeatureSetting() + { + m_hmnstuLabels.Clear(); + } + GrFeatureSetting(GrFeatureSetting & fset) + { + m_hmnstuLabels.Clear(); + } +protected: + int m_nVal; + HashMap m_hmnstuLabels; +}; +****/ + +class GrEngine; + +/*---------------------------------------------------------------------------------------------- + Each Graphite feature defines a way to customize or parameterize the rendering processs. + + Hungarian: feat +----------------------------------------------------------------------------------------------*/ +class GrFeature +{ + //friend class GrFeatureSetting; +public: + enum { + knLangFeatV2 = 1 + }; + + GrFeature() + { + m_vnVal.clear(); + m_vnNameId.clear(); + } + + void Initialize(featid nID, int nNameId, int cfset, int nDefault = 0); + + featid ID() + { + return m_nID; + } + + int DefaultValue() + { + return m_nDefault; + } + + void SetDefault(int nDefault) + { + m_nDefault = nDefault; + } + + int NameId() + { + return m_nNameId; + } + + void SetNameId(int n) + { + m_nNameId = n; + } + + int NumberOfSettings() + { + return (int)m_vnVal.size(); + } + + int Settings(int cMax, int * prgnVal); + void AddSetting(int nVal, int nNameId); + bool IsValidSetting(int nVal); + std::wstring Label(GrEngine * pgreng, int nLang); + std::wstring SettingLabel(GrEngine * pgreng, int nVal, int nLang); + int NthSetting(int ifset); + std::wstring NthSettingLabel(GrEngine * pgreng, int ifset, int nLang); +// void SetSettingLabel(int nVal, std::wstring stuLabel, int nLang); + +protected: + featid m_nID; + int m_nDefault; + int m_nNameId; +// HashMap m_hmnstuLabels; + + // These are parallel arrays. The first gives the setting value for a given feature, + // the second gives the index into the name table that is used to read UI strings. + std::vector m_vnVal; + std::vector m_vnNameId; +}; + + +/*---------------------------------------------------------------------------------------------- + GrLangTable handles looking up language information. + GrEngine has one instance of this class. + Hungarian: langtbl +----------------------------------------------------------------------------------------------*/ +class GrIStream; + +class GrLangTable +{ + friend class FontMemoryUsage; + +public: + GrLangTable() + { + m_prglang = NULL; + m_clang = 0; + m_prgfset = NULL; + } + ~GrLangTable() + { + delete[] m_prglang; + delete[] m_prgfset; + } + + bool ReadFromFont(GrIStream * pgrstrm, int fxdVersion); + void CreateEmpty(); + + size_t NumberOfLanguages() + { + return m_clang; + } + void LanguageFeatureSettings(isocode lgcode, + std::vector & vnFeatId, std::vector & vnValues); + isocode LanguageCode(size_t ilang); + +protected: + size_t m_clang; + // constants for fast binary search of language list + data16 m_dilangInit; // (max power of 2 <= m_clang); + // size of initial range to consider + data16 m_cLoop; // log2(max power of 2 <= m_clang); + // indicates how many iterations are necessary + data16 m_ilangStart; // m_clang - m_dilangInit; + // where to start search + + struct LangEntry + { + char rgchCode[4]; + data16 cFeaturesBIG; // big endian + data16 cbOffsetBIG; // big endian + }; + LangEntry * m_prglang; + int m_cbOffset0; // offset of first entry + + struct FeatSet + { + featid featidBIG; // big endian + data16 valueBIG; // big endian + data16 padBIG; + }; + FeatSet * m_prgfset; + int m_cfset; // needed for memory instrumentation and sanity checks + + int FindIndex(isocode lgcode); +}; + +} // namespace gr + + +#if defined(GR_NO_NAMESPACE) +using namespace gr; +#endif + + +#endif // !GR_FEATURE_INCLUDED diff --git a/Build/source/libs/graphite/engine-2.4/include/graphite/GrMstypes.h b/Build/source/libs/graphite/engine-2.4/include/graphite/GrMstypes.h new file mode 100644 index 00000000000..79979dcd60b --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/include/graphite/GrMstypes.h @@ -0,0 +1,40 @@ +#ifndef _MSTYPES_H +#define _MSTYPES_H +/******** +This header contains the MS Win32 specific types that are still used +throughout the Graphite code. + +It is intended to allow Graphite to build on non-Win32 platforms. + + **Do NOT include this when building against WIN32** + + TSE - 15/07/2003 +********/ + +#if defined(_WIN32) + #error Do not include this header when building against Win32 APIs +#else + +#if defined(GR_NAMESPACE) +namespace gr +{ +#endif + +typedef wchar_t OLECHAR; + +typedef signed long HRESULT; + +inline long InterlockedIncrement(long *const intr_lck) { + return ++*intr_lck; +} + +inline long InterlockedDecrement(long *const intr_lck) { + return --*intr_lck; +} + +#if defined(GR_NAMESPACE) +} +#endif + +#endif // defined(_WIN32) +#endif // include guard diff --git a/Build/source/libs/graphite/engine-2.4/include/graphite/GrPlatform.h b/Build/source/libs/graphite/engine-2.4/include/graphite/GrPlatform.h new file mode 100644 index 00000000000..6a6f149fe03 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/include/graphite/GrPlatform.h @@ -0,0 +1,192 @@ +#ifndef _GR_PLATFORM_H +#define _GR_PLATFORM_H + +/*********************************************************************************************** + Turn off the goofy warnings for MS VisualStudio. +***********************************************************************************************/ +#ifdef _MSC_VER +#pragma warning(disable: 4065) // Switch statement contains default but no case. +#pragma warning(disable: 4097) // typedef-name 'xxx' used as synonym for class-name 'yyy'. +#pragma warning(disable: 4100) // unreferenced formal parameter. +#pragma warning(disable: 4127) // conditional expression is constant +#pragma warning(disable: 4192) // automatically excluding while importing. +#pragma warning(disable: 4201) // nonstandard extension used : nameless struct/union. +#pragma warning(disable: 4290) // exception specification ignored. +#pragma warning(disable: 4310) // cast truncates constant value. +#pragma warning(disable: 4355) // 'this' used in base member initializer list. +#pragma warning(disable: 4505) // unreferenced local function has been removed. +#pragma warning(disable: 4510) // default constructor could not be generated - caused by + // applying ComSmartPtr to a non-interface class. +#pragma warning(disable: 4511) // copy constructor could not be generated. +#pragma warning(disable: 4512) // assignment operator could not be generated. +#pragma warning(disable: 4610) // class 'xxx' can never be instantiated - user defined + // constructor required - caused by applying ComSmartPtr to a non-interface class. +//#pragma warning(disable: 4660) // template-class specialization is already instantiated. - no longer used +#pragma warning(disable: 4701) // local variable 'xxx' may be used without being initialized. + // We would like to keep this warning (4701) enabled but the compiler applies it in + // places that are obviously OK. +#pragma warning(disable: 4702) // unreachable code. We would like to keep this warning (4702) + // enabled but the compiler applies it in places that are obviously OK. +#pragma warning(disable: 4706) // assignment in conditional expression +#pragma warning(disable: 4710) // not inlined. +#pragma warning(disable: 4786) // identifier truncated in debug info. +#pragma warning(disable: 4800) // forcing value to bool 'true' or 'false' (performance warning). + +#pragma warning(disable: 4996) // std::copy unsafe + +#endif + + +// Standard headers +#include + +// Platform headers +// +#if defined(_WIN32) +#include +#include + +#ifdef SIZEOF_WCHAR_T +#define SIZEOF_WCHAR_T 2 +#endif + +#endif + +// Project headers +#if defined(_WIN32) +#include +#endif +#include + + +#if defined(_WIN32) +// TSE: We need to define std::max and std::min, because VC6.0 seems to omit +// these from their version of and rely on the macro versions +// to silently take their place. This breaks the use of the name max in any +// other scope e.g. as in std::numeric_limits<..>::max(). + +#undef min +#undef max + +// SJC: Only do this for version 6, otherwise the definitions conflict with the +// built-in STL definitions, and the compiler really struggles. +#if _MSC_VER == 1200 // VC version 6 +namespace std +{ + template inline T max(const T a, const T b) { return a < b ? b : a; } + template inline T min(const T a, const T b) { return a > b ? b : a; } +} +#endif // _MSC_VER == 1200 +//////using std::max; // SJC moved to GrCommon.h +//////using std::min; +#endif // _WIN32 + + +namespace gr +{ + +// Typedefs +// These are correct for the x86_64 architecture too. +typedef unsigned char byte; +typedef unsigned int utf32; // UTF32 encoded Unicode codepoints +typedef unsigned short int utf16; // UTF16 encoded Unicode codepoints +typedef unsigned char utf8; // UTF-8 encoded Unicode codepoints +typedef unsigned short int gid16; // glyph ID +typedef unsigned int fontTableId32; // ID to pass to getTable() + +typedef unsigned char data8; +typedef unsigned short int data16; // generic 16-bit data +typedef unsigned int data32; // generic 32-bit data +typedef signed char sdata8; +typedef signed short int sdata16; // generic 16-bit data +typedef signed int sdata32; // generic 32-bit data + +#ifndef NO_ASM +#define NO_ASM +#endif + +#ifndef NULL +#define NULL 0 +#endif +// std::_Ios_Openmode isn't defined in the Windows compiler +#if !defined(_WIN32) + typedef std::ios_base::openmode openmode_t; +#else + typedef int openmode_t; +#endif + +/************************************************************************************* + Offsets and addresses. AddrOf is useful for taking the address of an object + that overloads the & operator. +*************************************************************************************/ +#if defined(_WIN32) +#undef offsetof +#define offsetof(cls,fld) ((int)&((cls *)0)->fld) +#endif + +// #ifndef NO_ASM +// #define addrsafe_offsetof(cls,fld) reinterpret_cast(AddrOf(((cls *)0)->fld)) +// +// template inline T * AddrOf(T & x) { +// T * pt; +// __asm +// { +// mov eax,x +// mov pt,eax +// } +// return pt; +// } +// #endif + + +inline bool GrIsBadStringPtrW(const utf16 *const pszw, const long) +{ + return !pszw; +} + +inline bool GrIsBadStringPtrA(const char *const psza, const long) +{ + return !psza; +} + +inline bool GrIsBadReadPtr(const void *const, const unsigned int) +{ + return false; +} + +inline bool GrIsBadWritePtr(const void *const, const unsigned int) +{ + return false; +} + + +size_t Platform_UnicodeToANSI(const utf16 * prgchwSrc, size_t cchwSrc, char * prgchsDst, size_t cchsDst); +size_t Platform_AnsiToUnicode(const char * prgchsSrc, size_t cchsSrc, utf16 * prgchwDst, size_t cchwDst); +//size_t Platform_UnicodeToANSI(const wchar * prgchwSrc, size_t cchwSrc, char * prgchsDst, size_t cchsDst); +//size_t Platform_AnsiToUnicode(const char * prgchsSrc, size_t cchsSrc, wchar * prgchwDst, size_t cchwDst); +size_t Platform_8bitToUnicode(int nCodePage, const char * prgchsSrc, int cchsSrc, utf16 * prgchwDst, int cchwDst); + +utf16 *utf16cpy(utf16 *dest, const utf16 *src); +utf16 *utf16cpy(utf16 *dest, const char *src); +utf16 *utf16cpy(utf16 *dest, const utf32 *src); + +utf16 *utf16ncpy(utf16 *dest, const utf16 *src, size_t n); +utf16 *utf16ncpy(utf16 *dest, const char *src, size_t n); + +#ifdef UTF16DEBUG +void utf16Output(const utf16 *input); +#endif + +size_t utf16len(const utf16 *s); + +int utf16cmp(const utf16 *s1, const utf16 *s2); +int utf16ncmp(const utf16 *s1, const utf16 *s2, size_t n); +int utf16cmp(const utf16 *s1, const char *s2); + +} // namespace gr + +#if defined(GR_NO_NAMESPACE) +using namespace gr; +#endif + +#endif diff --git a/Build/source/libs/graphite/engine-2.4/include/graphite/GrResult.h b/Build/source/libs/graphite/engine-2.4/include/graphite/GrResult.h new file mode 100644 index 00000000000..d2c418dc9df --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/include/graphite/GrResult.h @@ -0,0 +1,171 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 1999, 2001 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: GrResult.h +Responsibility: Sharon Correll +Last reviewed: Not yet. + +Description: + Support for the GrResult and error handling in the Graphite engine. Also argument + checking. Much of this is set up to parallel standard COM behavior. + +Special Note: + This file needs to be used by C files. Please do not use C++ style comments; use + ONLY C style comments in this file to make the C compiler happy. +----------------------------------------------------------------------------------------------*/ +#ifdef _MSC_VER +#pragma once +#endif +#ifndef GRRESULT_INCLUDED +#define GRRESULT_INCLUDED + +/* +//:End Ignore + */ + + +namespace gr +{ + + + +/*:>********************************************************************************************/ +/*:> Result flags */ +/*:>********************************************************************************************/ + +/* These are return values for the main interface methods to indicate various kinds of */ +/* error conditions. To facilitate COM compatibiliy, they match the standard COM HRESULT codes. */ +enum GrResult +{ + kresOk = 0, // S_OK + kresFalse = 1, // S_FALSE + kresFail = 0x80004005L, // E_FAIL + kresOutOfMemory = 0x8007000EL, // E_OUTOFMEMORY + kresInvalidArg = 0x80000002L, // E_INVALIDARG + kresReadFault = 0x80000001L, // STG_E_READFAULT + kresUnexpected = 0x80000003L, // E_UNEXPECTED + kresNotImpl = 0x80000004L, // E_NOTIMPL + kresPointer = 0x80004003L//, // E_POINTER +}; + +#define ResultFailed(res) (res != kresOk) /* && res != kresFalse */ + +#define ResultSucceeded(res) (res == kresOk) /* || res == kresFalse */ + +enum FontErrorCode +{ + kferrOkay, + kferrUninitialized, + kferrUnknown, + kferrFindHeadTable, + kferrReadDesignUnits, + kferrFindCmapTable, + kferrLoadCmapSubtable, + kferrCheckCmapSubtable, + kferrFindNameTable, + kferrLoadSilfTable, + kferrLoadFeatTable, + kferrLoadGlatTable, + kferrLoadGlocTable, + kferrReadSilfTable, + kferrReadGlocGlatTable, + kferrReadFeatTable, + kferrBadVersion, + kferrSileTableMismatch, + kferrReadSillTable +}; + +/*:>********************************************************************************************/ +/*:> Error handling */ +/*:>********************************************************************************************/ +/* These are set up as #defines so we can easily adjust them once we know how errors should */ +/* be handled. */ + +#define ReturnResult(res) return res + +#ifdef GR_FW +#define THROW(res) ThrowInternalError(res) +#else +#define THROW(res) throw res +#endif /* GR_FW */ + + +// #if !defined(NDEBUG) + +#if (0) // can't get E_POINTER to work so no debugging this way for now + +} // namespace gr + +#include + +namespace gr +{ + +#define WARN(warning) (std::cerr << __FILE__ << ':' << __LINE__ << ": WARN: " << #warning, warning) + +/*:>********************************************************************************************/ +/*:> Argument checking */ +/*:>********************************************************************************************/ + +#define ChkGrArgPtr(p) \ +{ \ + AssertPtrN(p); \ + if (!p) \ + THROW(E_POINTER); \ +} \ + +#define ChkGrOutPtr(p) \ +{ \ + AssertPtrN(p); \ + if (!p) \ + THROW(E_POINTER); \ +} \ + +#define ChkGrArgPtrN(p) \ + AssertPtrN(p); \ + +#define ChkGrArrayArg(prgv, cv) \ +{ \ + AssertArray(prgv, cv); \ + if (cv && !prgv) \ + THROW(E_POINTER); \ +} \ + +#define ChkGrBstrArg(bstr) \ + AssertBstr(bstr); \ + +#define ChkGrBstrArgN(bstr) \ + AssertBstrN(bstr); \ + +#else // debugging is off + +#define WARN(warning) (warning) + +/*:>********************************************************************************************/ +/*:> Argument checking */ +/*:>********************************************************************************************/ + +#define ChkGrArgPtr(p) (static_cast(0)) + +#define ChkGrOutPtr(p) (static_cast(0)) + +#define ChkGrArgPtrN(p) (static_cast(0)) + +#define ChkGrArrayArg(prgv, cv) (static_cast(0)) + +#define ChkGrBstrArg(bstr) (static_cast(0)) + +#define ChkGrBstrArgN(bstr) (static_cast(0)) + +#endif // !defined(NDEBUG) + +} // namespace gr + +#if defined(GR_NO_NAMESPACE) +using namespace gr; +#endif + +#endif /* !GRRESULT_INCLUDED */ diff --git a/Build/source/libs/graphite/engine-2.4/include/graphite/GrStructs.h b/Build/source/libs/graphite/engine-2.4/include/graphite/GrStructs.h new file mode 100644 index 00000000000..a1c9debe238 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/include/graphite/GrStructs.h @@ -0,0 +1,97 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 1999, 2001 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: GrStructs.h +Responsibility: Sharon Correll +Last reviewed: Not yet. + +Copyright (C) 1999 by SIL International. All rights reserved. + +Description: + Cross-platform structure definitions. +----------------------------------------------------------------------------------------------*/ +#ifdef _MSC_VER +#pragma once +#endif +#ifndef GRSTRUCTS_INCLUDED +#define GRSTRUCTS_INCLUDED +#include "GrPlatform.h" + +namespace gr +{ + +//:End Ignore + +typedef struct tagGrCharProps +{ + unsigned long clrFore; + unsigned long clrBack; + int dympOffset; + int ws; + int ows; + byte fWsRtl; + int nDirDepth; + byte ssv; + byte ttvBold; + byte ttvItalic; + int dympHeight; + wchar_t szFaceName[ 32 ]; + wchar_t szFontVar[ 64 ]; +} GrCharProps; + +// Used to pass feature information among the Graphite engine and the application. +typedef struct tagFeatureSetting +{ + int id; + int value; +} FeatureSetting; + +/***** +struct Point +{ + float x; + float y; + + Point() + { + x = y = 0; + } + + Point(POINT & p) + { + x = (float)p.x; + y = (float)p.y; + } +}; + + +struct Rect +{ + float top; + float bottom; + float left; + float right; + + Rect() + { + top = bottom = left = right = 0; + }; + + Rect(RECT & r) + { + top = (float)r.top; + bottom = (float)r.bottom; + left = (float)r.left; + right = (float)r.right; + }; +}; +****/ + +} // namespace gr + + +#endif // !STRUCTS_INCLUDED + diff --git a/Build/source/libs/graphite/engine-2.4/include/graphite/GrWrappers.h b/Build/source/libs/graphite/engine-2.4/include/graphite/GrWrappers.h new file mode 100644 index 00000000000..077b4695d80 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/include/graphite/GrWrappers.h @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 1999, 2001, 2003 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: GrWrapperClases.h +Responsibility: Sharon Correll +Last reviewed: + + Wrapper classes to be included in the open-source version of the Graphite DLL. + Currently there are none. +----------------------------------------------------------------------------------------------*/ diff --git a/Build/source/libs/graphite/engine-2.4/include/graphite/GraphiteProcess.h b/Build/source/libs/graphite/engine-2.4/include/graphite/GraphiteProcess.h new file mode 100644 index 00000000000..60f81860c2e --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/include/graphite/GraphiteProcess.h @@ -0,0 +1,45 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 1999, 2001 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: GraphiteProcess.h +Responsibility: Sharon Correll +Last reviewed: Not yet. + +Description: + The interface that is needed for the Justifier object to call back to the Graphite engine. +----------------------------------------------------------------------------------------------*/ +#ifdef _MSC_VER +#pragma once +#endif +#ifndef GRAPHITEPROCESS_INCLUDED +#define GRAPHITEPROCESS_INCLUDED + +#include "GrResult.h" +//:End Ignore +namespace gr +{ + +/*---------------------------------------------------------------------------------------------- + + Hungarian: fgje +----------------------------------------------------------------------------------------------*/ +class GraphiteProcess +{ +public: + virtual ~GraphiteProcess() {}; + virtual GrResult getGlyphAttribute(int iGlyph, int jgat, int nLevel, float * pValueRet) = 0; + virtual GrResult getGlyphAttribute(int iGlyph, int jgat, int nLevel, int * pValueRet) = 0; + virtual GrResult setGlyphAttribute(int iGlyph, int jgat, int nLevel, float value) = 0; + virtual GrResult setGlyphAttribute(int iGlyph, int jgat, int nLevel, int value) = 0; +}; + +} // namespace gr + +#if defined(GR_NO_NAMESPACE) +using namespace gr; +#endif + +#endif // !IGR_JENGINE_INCLUDED diff --git a/Build/source/libs/graphite/engine-2.4/include/graphite/HashMap.h b/Build/source/libs/graphite/engine-2.4/include/graphite/HashMap.h new file mode 100644 index 00000000000..aa925ac608d --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/include/graphite/HashMap.h @@ -0,0 +1,328 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 2001 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: HashMap.h +Responsibility: Steve McConnel +Last reviewed: Not yet. + +Description: + This provides a set of template collection classes to replace std::map. Their primary + reason to exist is to allow explicit checking for internal memory allocation failures. +----------------------------------------------------------------------------------------------*/ +#pragma once +#ifndef HASHMAP_H_INCLUDED +#define HASHMAP_H_INCLUDED +//:End Ignore + +/*---------------------------------------------------------------------------------------------- + Functor class for computing a hash value from an arbitrary object. + + Hungarian: hsho +----------------------------------------------------------------------------------------------*/ +class HashObj +{ +public: + int operator () (void * pKey, int cbKey); +}; + +/*---------------------------------------------------------------------------------------------- + Functor class for comparing two arbitrary objects (of the same class) for equality. + + Hungarian: eqlo +----------------------------------------------------------------------------------------------*/ +class EqlObj +{ +public: + bool operator () (void * pKey1, void * pKey2, int cbKey); +}; + +/*---------------------------------------------------------------------------------------------- + Hash map template collection class whose keys are objects of an arbitrary class. + + Hungarian: hm[K][T] +----------------------------------------------------------------------------------------------*/ +template class HashMap +{ +public: + //:> Member classes + + /*------------------------------------------------------------------------------------------ + This is the basic data structure for storing one key-value pair in a hash map. In + order to handle hash collisions, this structure is a member of a linked list. + Hungarian: hsnd + ------------------------------------------------------------------------------------------*/ + class HashNode + { + public: + //:> Constructors/destructors/etc. + + HashNode(void) + : m_key(K()), m_value(T()), m_nHash(0), m_ihsndNext(0) + { + } + HashNode(K & key, T & value, int nHash, int ihsndNext = -1) + : m_key(key), m_value(value), m_nHash(nHash), m_ihsndNext(ihsndNext) + { + } + ~HashNode() + { + } + + //:> Member variable access + + void PutKey(K & key) + { + m_key = key; + } + K & GetKey() + { + return m_key; + } + void PutValue(T & value) + { + m_value = value; + } + T & GetValue() + { + return m_value; + } + void PutHash(int nHash) + { + m_nHash = nHash; + } + int GetHash() + { + return m_nHash; + } + void PutNext(int ihsndNext) + { + m_ihsndNext = ihsndNext; + } + int GetNext() + { + return m_ihsndNext; + } + + /*-------------------------------------------------------------------------------------- + Check whether the given HashNode is being used. + --------------------------------------------------------------------------------------*/ + bool InUse() + { + return m_ihsndNext >= -1; + } + + protected: + //:> Member variables + + K m_key; + T m_value; + int m_nHash; + int m_ihsndNext; // -1 means end of list, -(ihsnd + 3) for free list members + }; + + /*------------------------------------------------------------------------------------------ + This provides an iterator for stepping through all HashNodes stored in the hash map. + This is useful primarily for saving the contents of a hash map to a file. + + Hungarian: ithm[K][T] + ------------------------------------------------------------------------------------------*/ + class iterator + { + public: + // Constructors/destructors/etc. + + iterator() : m_phmParent(0), m_ihsnd(0) + { + } + iterator(HashMap * phm, int ihsnd) : m_phmParent(phm), m_ihsnd(ihsnd) + { + } + iterator(const iterator & v) : m_phmParent(v.m_phmParent), m_ihsnd(v.m_ihsnd) + { + } + ~iterator() + { + } + + // Other public methods + + iterator & operator = (const iterator & ithm) + { + m_phmParent = ithm.m_phmParent; + m_ihsnd = ithm.m_ihsnd; + return *this; + } + T & operator * (void) + { + Assert(m_phmParent); + Assert(m_phmParent->m_prghsnd); + Assert(m_ihsnd < m_phmParent->m_ihsndLim); + return m_phmParent->m_prghsnd[m_ihsnd].GetValue(); + } + HashNode * operator -> (void) + { + Assert(m_phmParent); + Assert(m_phmParent->m_prghsnd); + Assert(m_ihsnd < m_phmParent->m_ihsndLim); + return &m_phmParent->m_prghsnd[m_ihsnd]; + } + iterator & operator ++ (void) + { + Assert(m_phmParent); + ++m_ihsnd; + // make sure that this new HashNode is actually in use + while (m_ihsnd < m_phmParent->m_ihsndLim) + { + if (m_phmParent->m_prghsnd[m_ihsnd].InUse()) + return *this; + // skip to the next one and check it + ++m_ihsnd; + } + if (m_ihsnd > m_phmParent->m_ihsndLim) + m_ihsnd = m_phmParent->m_ihsndLim; + return *this; + } + bool operator == (const iterator & ithm) + { + return (m_phmParent == ithm.m_phmParent) && (m_ihsnd == ithm.m_ihsnd); + } + bool operator != (const iterator & ithm) + { + return (m_phmParent != ithm.m_phmParent) || (m_ihsnd != ithm.m_ihsnd); + } + T & GetValue(void) + { + Assert(m_phmParent); + Assert(m_phmParent->m_prghsnd); + Assert(m_ihsnd < m_phmParent->m_ihsndLim); + Assert(m_phmParent->m_prghsnd[m_ihsnd].InUse()); + return m_phmParent->m_prghsnd[m_ihsnd].GetValue(); + } + K & GetKey(void) + { + Assert(m_phmParent); + Assert(m_phmParent->m_prghsnd); + Assert(m_ihsnd < m_phmParent->m_ihsndLim); + Assert(m_phmParent->m_prghsnd[m_ihsnd].InUse()); + return m_phmParent->m_prghsnd[m_ihsnd].GetKey(); + } + int GetHash() + { + Assert(m_phmParent); + Assert(m_phmParent->m_prghsnd); + Assert(m_ihsnd < m_phmParent->m_ihsndLim); + Assert(m_phmParent->m_prghsnd[m_ihsnd].InUse()); + return m_phmParent->m_prghsnd[m_ihsnd].GetHash(); + } + int GetIndex() + { + Assert(m_phmParent); + Assert(m_phmParent->m_prghsnd); + Assert(m_ihsnd < m_phmParent->m_ihsndLim); + Assert(m_phmParent->m_prghsnd[m_ihsnd].InUse()); + return m_ihsnd; + } + + protected: + //:> Member variables + + HashMap * m_phmParent; + int m_ihsnd; + }; + friend class iterator; + + //:> Constructors/destructors/etc. + + HashMap(); + ~HashMap(); + HashMap(HashMap & hm); + + //:> Other public methods + + iterator Begin(); + iterator End(); + void Insert(K & key, T & value, bool fOverwrite = false, int * pihsndOut = 0); + bool Retrieve(K & key, T * pvalueRet); + bool Delete(K & key); + void Clear(); + void CopyTo(HashMap & hmKT); + void CopyTo(HashMap * phmKT); + + bool GetIndex(K & key, int * pihsndRet); + bool IndexKey(int ihsnd, K * pkeyRet); + bool IndexValue(int ihsnd, T * pvalueRet); + + int Size(); + + /*------------------------------------------------------------------------------------------ + The assignment operator allows an entire hashmap to be assigned as the value of another + hashmap. It throws an error if it runs out of memory. + + @return a reference to this hashmap. (That is how the assignment operator is defined!) + + @param hm is a reference to the other hashmap. + ------------------------------------------------------------------------------------------*/ + HashMap & operator = (HashMap & hm) + { + hm.CopyTo(this); + return *this; + } + + //:Ignore +#ifdef DEBUG + int _BucketCount(); + int _EmptyBuckets(); + int _BucketsUsed(); + int _FullestBucket(); + bool AssertValid() + { + AssertPtrN(m_prgihsndBuckets); + Assert(m_prgihsndBuckets || !m_cBuckets); + Assert(!m_prgihsndBuckets || m_cBuckets); + AssertArray(m_prgihsndBuckets, m_cBuckets); + AssertPtrN(m_prghsnd); + Assert(m_prghsnd || !m_ihsndMax); + Assert(!m_prghsnd || m_ihsndMax); + AssertArray(m_prghsnd, m_ihsndMax); + Assert(0 <= m_ihsndLim && m_ihsndLim <= m_ihsndMax); + Assert(-1 <= FreeListIdx(m_ihsndFirstFree)); + Assert(FreeListIdx(m_ihsndFirstFree) < m_ihsndLim); + return true; + } +#endif + //:End Ignore + +protected: + //:> Member variables + + int * m_prgihsndBuckets; + int m_cBuckets; + HashNode * m_prghsnd; + int m_ihsndLim; + int m_ihsndMax; + int m_ihsndFirstFree; // stores -(ihsnd + 3) + + //:> Protected methods + //:Ignore + + /*------------------------------------------------------------------------------------------ + Map between real index and "free list" index. Note that this mapping is bidirectional. + ------------------------------------------------------------------------------------------*/ + int FreeListIdx(int ihsnd) + { + return -(ihsnd + 3); + } + //:End Ignore +}; + + +// Local Variables: +// mode:C++ +// c-file-style:"cellar" +// tab-width:4 +// End: + +#endif /*HASHMAP_H_INCLUDED*/ diff --git a/Build/source/libs/graphite/engine-2.4/include/graphite/IGrEngine.h b/Build/source/libs/graphite/engine-2.4/include/graphite/IGrEngine.h new file mode 100644 index 00000000000..481cb534b46 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/include/graphite/IGrEngine.h @@ -0,0 +1,36 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 2003 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +NU Lesser General Public License, as specified in the LICENSING.txt file. + +File: IGrEngine.h +Responsibility: Sharon Correll +Last reviewed: Not yet. + +Description: + A very minimal interface representing the Graphite engine, for passing to the + GrJustifier. +-------------------------------------------------------------------------------*//*:End Ignore*/ +#ifdef _MSC_VER +#pragma once +#endif +#ifndef IGRENG_INCLUDED +#define IGRENG_INCLUDED + +namespace gr +{ +/*---------------------------------------------------------------------------------------------- + Class: IGrEngine +----------------------------------------------------------------------------------------------*/ +class IGrEngine +{ +}; + +} // namespace gr + +#if defined(GR_NO_NAMESPACE) +using namespace gr; +#endif + +#endif // !IGRENG_INCLUDED diff --git a/Build/source/libs/graphite/engine-2.4/include/graphite/IGrJustifier.h b/Build/source/libs/graphite/engine-2.4/include/graphite/IGrJustifier.h new file mode 100644 index 00000000000..a9ba6e51c07 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/include/graphite/IGrJustifier.h @@ -0,0 +1,58 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 2003 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: IGrJustifier.h +Responsibility: Sharon Correll +Last reviewed: Not yet. + +Description: + An interface for a justification agent that is used by the Graphite engine. +-------------------------------------------------------------------------------*//*:End Ignore*/ +#ifdef _MSC_VER +#pragma once +#endif +#ifndef IGRJUSTIFIER_INCLUDED +#define IGRJUSTIFIER_INCLUDED + +#include "GrResult.h" + +namespace gr +{ + +class GraphiteProcess; + +/*---------------------------------------------------------------------------------------------- + Class: IGrJustifier + This class provides an interface for a justification agent for the Graphite engine. +----------------------------------------------------------------------------------------------*/ +class IGrJustifier +{ +public: + virtual ~IGrJustifier() {}; + virtual GrResult adjustGlyphWidths(GraphiteProcess * pgje, int iGlyphMin, int iGlyphLim, + float dxCurrWidth, float dxDesiredWidth) = 0; + + //virtual GrResult suggestShrinkAndBreak(GraphiteProcess * pfgjwe, + // int iGlyphMin, int iGlyphLim, float dxsWidth, LgLineBreak lbPref, LgLineBreak lbMax, + // float * pdxShrink, LgLineBreak * plbToTry) = 0; + + // Return a Graphite-compatible justifier that can be stored in a Graphite segment. + // TODO: remove + //virtual void JustifierObject(IGrJustifier ** ppgjus) = 0; + + // When a segment is being destroyed, delete this object, which is the wrapper for the + // text source inside of it. + // TODO: remove + //virtual void DeleteJustifierPtr() = 0; +}; + +} // namespace gr + +#if defined(GR_NO_NAMESPACE) +using namespace gr; +#endif + +#endif // !IGRJUSTIFIER_INCLUDED diff --git a/Build/source/libs/graphite/engine-2.4/include/graphite/IGraphiteProcess.h b/Build/source/libs/graphite/engine-2.4/include/graphite/IGraphiteProcess.h new file mode 100644 index 00000000000..ee84a94cdb1 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/include/graphite/IGraphiteProcess.h @@ -0,0 +1,44 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 1999, 2001 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: GraphiteProcess.h +Responsibility: Sharon Correll +Last reviewed: Not yet. + +Description: + The interface that is needed for the Justifier object to call back to the Graphite engine. +----------------------------------------------------------------------------------------------*/ +#ifdef _MSC_VER +#pragma once +#endif +#ifndef IGRAPHITEPROCESS_INCLUDED +#define IGRAPHITEPROCESS_INCLUDED + +#include "GrResult.h" +//:End Ignore +namespace gr +{ + +/*---------------------------------------------------------------------------------------------- + + Hungarian: fgje +----------------------------------------------------------------------------------------------*/ +class GraphiteProcess +{ +public: + virtual GrResult GetGlyphAttribute(int iGlyph, int jgat, int nLevel, float * pValueRet) = 0; + virtual GrResult GetGlyphAttribute(int iGlyph, int jgat, int nLevel, int * pValueRet) = 0; + virtual GrResult SetGlyphAttribute(int iGlyph, int jgat, int nLevel, float value) = 0; + virtual GrResult SetGlyphAttribute(int iGlyph, int jgat, int nLevel, int value) = 0; +}; + +} // namespace gr + +#if defined(GR_NO_NAMESPACE) +using namespace gr; +#endif + +#endif // !IGR_JENGINE_INCLUDED diff --git a/Build/source/libs/graphite/engine-2.4/include/graphite/ITextSource.h b/Build/source/libs/graphite/engine-2.4/include/graphite/ITextSource.h new file mode 100644 index 00000000000..f988750eb9c --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/include/graphite/ITextSource.h @@ -0,0 +1,70 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 1999, 2001 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: ITextSource.h +Responsibility: Sharon Correll +Last reviewed: Not yet. + +Description: + An interface for a text source that is used by the Graphite engine. +-------------------------------------------------------------------------------*//*:End Ignore*/ +#ifdef _MSC_VER +#pragma once +#endif +#ifndef IGRTXTSRC_INCLUDED +#define IGRTXTSRC_INCLUDED + + +#include "GrAppData.h" +#include "GrStructs.h" +#include "GrResult.h" + +namespace gr +{ + +/*---------------------------------------------------------------------------------------------- + Class: ITextSource + This class provides an interface for a text source for the Graphite engine. +----------------------------------------------------------------------------------------------*/ +class ITextSource +{ +public: + virtual ~ITextSource() {}; + virtual UtfType utfEncodingForm() = 0; + virtual size_t getLength() = 0; + virtual size_t fetch(toffset ichMin, size_t cch, utf32 * prgchBuffer) = 0; + virtual size_t fetch(toffset ichMin, size_t cch, utf16 * prgchwBuffer) = 0; + virtual size_t fetch(toffset ichMin, size_t cch, utf8 * prgchsBuffer) = 0; + virtual bool getRightToLeft(toffset ich) = 0; + virtual unsigned int getDirectionDepth(toffset ich) = 0; + virtual float getVerticalOffset(toffset ich) = 0; + virtual isocode getLanguage(toffset ich) = 0; + + virtual std::pair propertyRange(toffset ich) = 0; + virtual size_t getFontFeatures(toffset ich, FeatureSetting * prgfset) = 0; + virtual bool sameSegment(toffset ich1, toffset ich2) = 0; + virtual bool featureVariations() = 0; +}; + + +/*---------------------------------------------------------------------------------------------- + Class: IColorTextSource + Defines a method to get the color informtion from the text source. + It is needed for SegmentPainters that want to handle color. +----------------------------------------------------------------------------------------------*/ +class IColorTextSource : public ITextSource +{ +public: + virtual void getColors(toffset ich, int * pclrFore, int * pclrBack) = 0; +}; + +} // namespace gr + +#if defined(GR_NO_NAMESPACE) +using namespace gr; +#endif + +#endif // !IGRTXTSRC_INCLUDED diff --git a/Build/source/libs/graphite/engine-2.4/include/graphite/MemoryUsage.h b/Build/source/libs/graphite/engine-2.4/include/graphite/MemoryUsage.h new file mode 100644 index 00000000000..d59ff165f75 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/include/graphite/MemoryUsage.h @@ -0,0 +1,156 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 2007 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: MemoryUsage.h +Responsibility: Sharon Correll +Last reviewed: not yet + +Description: + Data structures to hold the calculations for memory usage. +----------------------------------------------------------------------------------------------*/ + +#ifdef _MSC_VER +#pragma once +#endif +#ifndef MEMORYUSAGE_INCLUDED +#define MEMORYUSAGE_INCLUDED + +//:End Ignore + + +namespace gr +{ + +/*---------------------------------------------------------------------------------------------- + A data structure that holds information about the memory usage for font/engine objects +----------------------------------------------------------------------------------------------*/ +class FontMemoryUsage +{ + friend class FontCache; + friend class FontFace; + +public: + FontMemoryUsage() + { + initialize(); + } + void addEngine(GrEngine * pgreng); + void prettyPrint(std::ostream & strm); + +protected: + // member variables: + std::vector vFontTotalsReg; + std::vector vFontTotalsBold; + std::vector vFontTotalsItalic; + std::vector vFontTotalsBI; + std::vector vstrFontNames; + std::vector vFaceCount; + + size_t font; + size_t fontCache; + size_t fontFace; + + size_t eng_count; + size_t eng_overhead; + size_t eng_scalars; + size_t eng_strings; + size_t eng_pointers; + size_t eng_cmap; + size_t eng_nameTable; + + size_t pseudoMap; + + size_t clstbl_counters; + size_t clstbl_offsets; + size_t clstbl_glyphList; + + size_t glftbl_general; + size_t glftbl_compDefns; + size_t glftbl_attrTable; + size_t glftbl_attrOffsets; + + size_t lngtbl_general; + size_t lngtbl_entries; + size_t lngtbl_featureSets; + + size_t tman_general; + + size_t pass_count; + size_t pass_general; + size_t pass_fsm; + size_t pass_ruleExtras; + size_t pass_constraintOffsets; + size_t pass_constraintCode; + size_t pass_actionOffsets; + size_t pass_actionCode; + + size_t engst_general; + size_t engst_passState; + + size_t sstrm_count; + size_t sstrm_general; + size_t sstrm_chunkMapsUsed; + size_t sstrm_chunkMapsAlloc; + size_t sstrm_reprocBuf; + + size_t slot_count; + size_t slot_general; + size_t slot_abstract; + size_t slot_varLenBuf; + size_t slot_assocsUsed; + size_t slot_assocsAlloc; + size_t slot_attachUsed; + size_t slot_attachAlloc; + + // methods: + void initialize(); + int total(); + void add(FontMemoryUsage & fmu); +}; + +/*---------------------------------------------------------------------------------------------- + A data structure that holds information about the memory usage for segment objects. +----------------------------------------------------------------------------------------------*/ +class SegmentMemoryUsage +{ +public: + SegmentMemoryUsage() + { + initialize(); + } + void addSegment(Segment & seg); + void prettyPrint(std::ostream & strm); + +protected: + // member variables: + size_t seg_count; + size_t overhead; + size_t pointers; + size_t scalars; + size_t strings; + size_t metrics; + size_t associations; + size_t init; + size_t obsolete; + + size_t slot_count; + size_t slot_abstract; + size_t slot_varLenBuf; + size_t slot_scalars; + size_t slot_clusterMembers; + + size_t glyphInfo_count; + size_t glyphInfo; + + size_t wastedVector; // allocated space that is not used in vectors + + // methods: + void initialize(); +}; + +} // namespace gr + +#endif // !MEMORYUSAGE_INCLUDED diff --git a/Build/source/libs/graphite/engine-2.4/include/graphite/Segment.h b/Build/source/libs/graphite/engine-2.4/include/graphite/Segment.h new file mode 100644 index 00000000000..d790e6fdfb5 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/include/graphite/Segment.h @@ -0,0 +1,623 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 1999, 2001 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: Segment.h +Responsibility: Sharon Correll +Last reviewed: Not yet. + +Description: + Defines the class for a Graphite text segment. +----------------------------------------------------------------------------------------------*/ +#ifdef _MSC_VER +#pragma once +#endif +#ifndef GR_SEGMENT_INCLUDED +#define GR_SEGMENT_INCLUDED + +#include "Font.h" +#include "GrConstants.h" +#include "SegmentAux.h" + +// undo automagic DrawTextA DrawTextW stuff +// #undef DrawText + +//:End Ignore + +namespace gr +{ +class GrEngine; +class SegmentMemoryUsage; + +class IGrJustifier; +class GrTableManager; +class GrSlotStream; +class GrSlotOutput; + +/*---------------------------------------------------------------------------------------------- + A Graphite segment consists of a sequence of well-positioned glyphs all on one line, + Each glyph understands its relationship to the underlying text that was used to generate + the segment. + + Hungarian: seg +----------------------------------------------------------------------------------------------*/ +class Segment +{ + friend class GrEngine; + friend class SegmentPainter; + friend class GlyphInfo; + friend class GlyphIterator; + friend class GlyphSetIterator; + friend class SegmentMemoryUsage; + +public: + // Static methods + + // Constructors, destructors, etc. + Segment(); +// Segment(ITextSource * pgts, int ichMin, int ichLim, +// LineBrk lbStart, LineBrk lbEnd, +// bool fStartLine, bool fEndLine, bool fWsRtl); + + virtual ~Segment(); + + // Basic copy constructor: + Segment(const Segment & seg); + + // For making modified copies of segments: + static Segment * LineContextSegment(Segment & seg, bool fStartLine, bool fEndLine); + static Segment * JustifiedSegment(Segment & seg, float xsNewWidth); + static Segment * WhiteSpaceSegment(Segment & seg, int newDirDepth); + + static int GetSegmentCount(); + +public: + + long IncRefCount(); + long DecRefCount(); + + Font & getFont(); + ITextSource & getText(); + float advanceWidth(); + Rect boundingRect(); + + bool rightToLeft(); + bool paraRightToLeft() { return m_fParaRtl; } + int directionDepth(bool * pfWeak = NULL); + bool setDirectionDepth(int nNewDepth); + int startCharacter(); + int stopCharacter(); + bool startOfLine(); + bool endOfLine(); + bool hasLineBoundaryContext(); + SegEnd segmentTermination(); + LineBrk startBreakWeight(); + LineBrk endBreakWeight(); + float stretch(); + float maxStretch(); + float maxShrink(); + void setTextSourceOffset(int ichMin) + { + m_ichwMin = ichMin; + } + + //GrResult changeLineEnds(bool fNewStart, bool fNewEnd); + + std::pair glyphs(); + std::pair charToGlyphs(toffset ich); + + // OBSOLETE: + GrResult GetCharData(int cchMax, utf16 * prgch, int * pcchRet); + GrResult GlyphToChar(int iginf, bool fFirst, int * pich); + GrResult GlyphToAllChars(int iginf, int cichMax, int * prgich, int *pcichRet); + GrResult CharToGlyph(int ich, bool fFirst, int * pigbb); + + // Not part of FW interface: + + float getRangeWidth(int ichMin, int ichLim, + bool fStartLine = true, bool fEndLine = true, bool fSkipSpace = true); + int findNextBreakPoint(int ichStart, + LineBrk lbPref, LineBrk lbWorst, float dxMaxWidth, + float * pdxBreakWidth, bool fStartLine = true, bool fEndLine = true); + + GrResult getUniscribeClusters( + int * prgigbb1stOfCluster, int cchMax, int * pcch, + bool * pfClusterStart, int cfMax, int * pcf); + + //GrResult GetGlyphsAndPositions( + // Rect rsArg, Rect rdArg, int cgidMax, int * pcgidRet, utf16 * prggid, + // float * prgxd, float * prgyd, float * prgdxdAdv); + //GrResult GetUniscribePositions( + // Rect rs, Rect rd, int cgidMax, int * pcgidRet, + // float * prgxd, float * prgyd, float * prgdxdAdv); + //GrResult GetUniscribeGlyphsAndPositions( + // Rect rsArg, Rect rdArg, int cgidMax, int * pcchRet, utf16 * prgchGlyphs, + // float * prgxd, float * prgyd, float * prgdxdAdv); + + // Other public methods: + + void Initialize(ITextSource * pgts, int ichMin, int ichLim, + LineBrk lbStart, LineBrk lbEnd, SegEnd est, + bool fStartLine, bool fEndLine, bool fWsRtl); + void DestroyContents(); + void SwapWith(Segment * pgrseg); + void ClearAltEndLineSeg(); + + ITextSource * GetString(); // client is responsible to Release() + + // The following three functions handle storing and retrieving information that + // allows us to restart a new segment following a line break. This is necessary + // in case there is some sort of contextualization across the line break. + void StoreRestartInfo(int cslotRestartBackup, std::vector& vnSkipOffsets) + { + m_cslotRestartBackup = cslotRestartBackup; + m_vnSkipOffsets.resize(vnSkipOffsets.size()); + for (size_t i = 0; i < vnSkipOffsets.size(); i++) + m_vnSkipOffsets[i] = sdata8(vnSkipOffsets[i]); + } + int NextRestartBackup() + { + return m_cslotRestartBackup; + } + int RestartBackup() + { + //return (m_psegPrev)? m_psegPrev->NextRestartBackup(): 0; + return 0; + } + int SkipOffset(int ipass) + { + return int(m_vnSkipOffsets[ipass]); + } + DirCode PreviousStrongDir() + { + return m_dircPrevStrong; + } + void SetPreviousStrongDir(DirCode dirc) + { + m_dircPrevStrong = dirc; + } + DirCode PreviousTermDir() + { + return m_dircPrevTerm; + } + void SetPreviousTermDir(DirCode dirc) + { + m_dircPrevTerm = dirc; + } + + int NextSegInitBuffer(byte ** ppbDat) + { + *ppbDat = m_prgbNextSegDat; + return m_cbNextSegDat; + } + int ThisSegInitBuffer(byte ** ppbDat) + { + *ppbDat = m_prgInitDat; + return m_cbInitDat; + } + +// void SetNextSeg(Segment * psegNext) +// { +// m_psegNext = psegNext; +// } + + void SetFaceName(std::wstring /*stu*/, std::wstring /*stuBase*/) + { +// m_stuFaceName = stu; +// m_stuBaseFaceName = stuBase; +// m_fUseSepBase = (m_stuBaseFaceName.size() > 0); + } + + void SetEngine(GrEngine * pgreng); + void SetFont(Font * pfont); + void SwitchFont(Font * pfont); + GrEngine * EngineImpl(); + + void SetJustifier(IGrJustifier * pgjus); + IGrJustifier * Justifier() + { + return m_pgjus; + } + + void SetPreContext(int dich) + { + m_dichPreContext = dich; + } + + //void SetToBaseFont(IGrGraphics * pgg); + //void RestoreFont(IGrGraphics * pgg); + + void SetUpOutputArrays(Font * pfont, GrTableManager * ptm, + GrSlotStream * psstrmFinal, + int cchwUnderlying, int csloutSurface, gid16 chwLB, + TrWsHandling twsh, bool fParaRtl, int nDirDepth, + bool fEmpty = false); + void RecordSurfaceAssoc(int ichw, int islot, int nDir); + void RecordLigature(int ichwUnder, int islotSurface, int iComponent); + void AdjustForOverlapsWithPrevSeg(); + void MarkSlotInPrevSeg(int ichw, int islot); + void MarkSlotInNextSeg(int ichw, int islot); + + void CleanUpAssocsVectors() + { + for (int iv = 0; iv < m_ichwAssocsLim - m_ichwAssocsMin; iv++) + { + std::vector * pvislout = m_prgpvisloutAssocs[iv]; + if (pvislout->size() <= 1) + { + delete pvislout; + *(m_prgpvisloutAssocs + iv) = NULL; + } + } + } + + GrSlotOutput * OutputSlot(int islout); + + void RecordInitializationForNextSeg(int cbNextSegDat, byte * pbNextSegDat) + { + m_cbNextSegDat = cbNextSegDat; + m_prgbNextSegDat = new byte[m_cbNextSegDat]; + std::copy(pbNextSegDat, pbNextSegDat + cbNextSegDat, m_prgbNextSegDat); + } + void RecordInitializationForThisSeg(int cbDat, byte * pbDat) + { + m_cbInitDat = cbDat; + if (cbDat == 0) + m_prgInitDat = NULL; + else + { + m_prgInitDat = new byte[m_cbInitDat]; + std::copy(pbDat, pbDat + cbDat, m_prgInitDat); + } + } + + void SetWidths(float dxsVisWidth, float dxsTotalWidth) + { + m_dxsVisibleWidth = dxsVisWidth; + m_dxsTotalWidth = dxsTotalWidth; + } + + void SetLayout(LayoutEnvironment & layout) + { + m_layout.setStartOfLine(layout.startOfLine()); + m_layout.setEndOfLine(layout.endOfLine()); + m_layout.setBestBreak(layout.bestBreak()); + m_layout.setWorstBreak(layout.worstBreak()); + m_layout.setRightToLeft(layout.rightToLeft()); + m_layout.setTrailingWs(layout.trailingWs()); + m_layout.setPrevSegment(layout.prevSegment()); + m_layout.setJustifier(layout.justifier()); + m_layout.setLoggingStream(layout.loggingStream()); + m_layout.setDumbFallback(layout.dumbFallback()); + } + LayoutEnvironment & Layout() + { + return m_layout; + } + + bool Erroneous() + { + return m_fErroneous; + } + void SetErroneous(bool f) + { + m_fErroneous = f; + } + + void FixTermination(SegEnd est) + { + m_est = est; + } + + // Convert from em-units to logical units. + float EmToLogUnits(int m); + + Rect ComponentRect(GrSlotOutput * pslout, int icomp); + + void ClusterMembersForGlyph(int islout, int disloutCluster, std::vector & visloutRet); + + // for transduction logging: + // implementations are empty unless TRACING is defined + void LogUnderlyingToSurface(GrTableManager * ptman, std::ostream & strmOut, + GrCharStream * pchstrm); + void LogSurfaceToUnderlying(GrTableManager * ptman, std::ostream & strmOut); + + // calculate memory usage + void calculateMemoryUsage(SegmentMemoryUsage & smu); + +protected: + // Member variables: + long m_cref; // standard COM ref count + + ITextSource * m_pgts; // the string we are a segment of + int m_dichwLim; // number of characters officially in this segment + int m_ichwMin; // first character relative to the text-source + + Font * m_pfont; + GrEngine * m_preneng; + + bool m_fErroneous; // an error occurred in generating this segment + + IGrJustifier * m_pgjus; + + LayoutEnvironment m_layout; + + bool m_fWsRtl; // writing system direction + bool m_fParaRtl; // paragraph direction; redundant with layout? + + TrWsHandling m_twsh; // // redundant with layout? + int m_nDirDepth; // segment direction (white-space-only segments can switch) + + byte * m_prgbNextSegDat; // for initializing the following segment + int m_cbNextSegDat; // length of above buffer + + byte * m_prgInitDat; // what was used to initialize this segment + int m_cbInitDat; + + int m_dichPreContext; // what part of this segment affects the previous; + // not really used for anything right now + +// Segment * m_psegPrev; // OBSOLETE +// Segment * m_psegNext; + + // Font information: +// std::wstring m_stuFaceName; +// std::wstring m_stuBaseFaceName; +// bool m_fUseSepBase; + +// float m_pixHeight; // character height of font in pixels (NOT = ascent + descent) +// bool m_fBold; +// bool m_fItalic; + + LineBrk m_lbStart; + LineBrk m_lbEnd; + + bool m_fStartLine; // redundant with layout? + bool m_fEndLine; // redundant with layout? + + SegEnd m_est; + + //Segment * m_psegAltEndLine; // segment having the alternate m_fEndLine value + + int m_mFontEmUnits; + float m_dysFontAscent; + float m_dysFontDescent; + float m_xysEmSquare; // em-square of the font in display units +// float m_xsDPI; // DPI of device on which segment was measured +// float m_ysDPI; + + float m_dxsStretch; // difference between actual and natural width + float m_dxsWidth; // width in absence of any stretch. -1 if not computed. + float m_dysHeight; + float m_dysAscent; // distance from common baseline to top of this segment, + // including extra ascent + + float m_dysXAscent; // extra for this renderer, beyond what is standard for the font + float m_dysXDescent; + + float m_dysAscentOverhang; // extra height above official top of segment; >= 0 + float m_dysDescentOverhang; // extra height below bottom of segment; <= 0; + float m_dxsLeftOverhang; // <= 0 + float m_dxsRightOverhang; + + float m_dxsVisibleWidth; // not including trailing white space + float m_dxsTotalWidth; // including trailing white space + + int m_isloutVisLim; // lim of visible stuff (to handle trailing ws underlines) + + float m_dysOffset; + + // Index of the first item in the before/after arrays and the ligature/component arrays, + // relative to the start of the segment. Normally == 0, but will be some negative number + // if there are slots "borrowed" from the previous segment (officially located in the + // previous segment but rendered in this one). + int m_ichwAssocsMin; + + // 1 + index of last item in the before/after arrays and the ligature/component arrays, + // relative to the start of the segment. Normally == m_dichwLim, but will be + // larger if there are slots "borrowed" from the following segment. + int m_ichwAssocsLim; + + // Underlying-to-surface associations: + int * m_prgisloutBefore; // logical first + int * m_prgisloutAfter; // logical last + std::vector ** m_prgpvisloutAssocs; // all; used by range selections + + int * m_prgisloutLigature; // similar to above, index of associated ligature, or kNegInfinity + + sdata8 * m_prgiComponent; // component of the ligature that the corresponding character + // represents; only meaningful if corresponding item in + // m_prgisloutLigature is set + +// GrSlotStream * m_psstrm; // TODO: rework to remove this + int m_cslout; + GrSlotOutput * m_prgslout; // final output slots + u_intslot * m_prgnSlotVarLenBuf; // var-length buffer for slots--one big buffer managed by the + // segment, but pointed to by the slots + +// int m_cnUserDefn; // this information is not stored in the segment itself + int m_cnCompPerLig; +// int m_cnFeat; // this information is not stored in the segment itself + + int m_cginf; + int m_isloutGinf0; // islout index for m_prgginf[0]; + GlyphInfo * m_prgginf; + + // Data structures to hold glyphs for rendering: +////#include "GrSegmentPlatform.h" + + // For initializing the following segment: + int m_cslotRestartBackup; // the number of slots in the underlying + // input that need to be reprocessed when starting + // the next segment + + std::vector m_vnSkipOffsets; // skip offset for each pass when restarting + + DirCode m_dircPrevStrong; // previous strong directionality code + DirCode m_dircPrevTerm; // previous terminator code, if any + + + // Other protected methods: + + void InitLineContextSegment(bool fStartLine, bool fEndLine); + void InitWhiteSpaceSegment(int nNewDepth); + + void ComputeDimensions(); + + void SetUpGlyphInfo(GrTableManager * ptman, GrSlotStream * psstrmFinal, + gid16 chwLB, int nDirDepth, int islotMin, int cslot); + void SetUpLigInfo(GrTableManager * ptman, GlyphInfo & ginf, GrSlotOutput * pslout); + + void InitBeforeArrayFromPrevSeg(); // obsolete + void AdjustBeforeArrayFromPrevSeg(); + void AdjustAfterArrayFromNextSeg(); + void EnsureSpaceAtLineBoundaries(int ichwUnder); + + int LogicalSurfaceToUnderlying(int islout, + float xsOffset, float ysOffset, + float dxsGlyphWidth = 0, float dysGlyphHeight = 0, bool * pfAfter = NULL); + int LogicalSurfaceToUnderlying(int islout, bool fBefore); + int PhysicalSurfaceToUnderlying(int iginf, + float xsOffset, float xyOffset, + float dxsGlyphWidth = 0, float dysGlyphHeight = 0, bool * pfAfter = NULL); + int PhysicalSurfaceToUnderlying(int iginf, bool fBefore); + int UnderlyingToLogicalSurface(int ichw, bool fBefore); + int UnderlyingToPhysicalSurface(int ichw, bool fBefore); + int LogicalToPhysicalSurface(int islout); + void UnderlyingToPhysicalAssocs(int ichw, std::vector & viginf); + std::vector UnderlyingToLogicalAssocs(int ichw); + int UnderlyingToLogicalInThisSeg(int ichw); + bool SameSurfaceGlyphs(int ichw1, int ichw2); + + void ShiftGlyphs(float dxsShift); + + float GlyphLeftEdge(int iginf); + + int DirLevelOfChar(int ichw, bool fBefore); + bool CharIsRightToLeft(int ichw, bool fBefore); + bool SlotIsRightToLeft(GrSlotOutput * pslout); + int TopDirLevel() + { + if (m_fWsRtl) + return 1; + else + return 0; + } + + void AssertValidClusters(GrSlotStream * psstrm); + + void MergeUniscribeCluster( + std::vector & visloutBefore, std::vector & visloutAfter, + int ich1, int ich2); + + int GlyphHit(float xsClick, float ysClick); + int SelectBb(std::vector & viginf, bool fRTL); + + int RightMostGlyph(); + int LeftMostGlyph(); + + void ComputeOverhangs(float * pdysVisAscent, float * pdysNegVisDescent, + float * pdxsVisLeft, float * pdxsVisRight); + +public: + LineBrk getBreakWeight(int ich, bool fBreakBefore = false); + + // Platform-specific routines: +protected: + //void ShiftGlyphsPlatform(float dxsShift); + //bool SetDirectionDepthPlatform(int nNewDepth); + + //void InitializePlatform(); + //void DestroyContentsPlatform(); + //GrResult GetGlyphsAndPositionsPlatform(float xs, float ys, + // Rect rsArg, Rect rdArg, + // utf16 * prgchGlyphs, float * prgxd, float * prgyd, float * prgdxdAdv); + //void SetUpOutputArraysPlatform(GrTableManager * ptman, gid16 chwLB, int nDirDepth, + // int islotMin, int cslot); + + // Temporary - for WinSegmentPainter +public: + int CSlout() + { + return m_cslout; + } + gid16 LBGlyphID(); + float AscentOffset() + { + if (m_dysAscent == -1) + ComputeDimensions(); + return m_dysAscent - m_dysFontAscent; + } +}; + + +//:>******************************************************************************************** +//:> The purpose of these subclasses is simply to provide meaningful names for the +//:> constructors. Instances of these classes are in every way equivalent to Segment. +//:>******************************************************************************************** + +/*---------------------------------------------------------------------------------------------- + Creating a LineFillSegment fits as much of the text on the line as possible, + finding a reasonable break point if necessary. +----------------------------------------------------------------------------------------------*/ +class LineFillSegment : public Segment +{ +public: + LineFillSegment( + Font * pfont, + ITextSource * pts, + LayoutEnvironment * playout, + toffset ichStart, + toffset ichStop, + float maxWidth, + bool fBacktracking = false); +protected: + // Default constructor: + LineFillSegment() : Segment() + { + } +}; + +/*---------------------------------------------------------------------------------------------- + Creating a RangeSegment makes a segment representing the given range of characters, or + the entire text-source. +----------------------------------------------------------------------------------------------*/ +class RangeSegment : public Segment +{ +public: + RangeSegment( + Font * pfont, + ITextSource * pts, + LayoutEnvironment * playout, + toffset ichStart = 0, + toffset ichStop = kPosInfinity, + Segment * psegInitLike = NULL); +}; + +/*---------------------------------------------------------------------------------------------- + The JustSegmentAux class is used by the factory method that creates a justified segment. + It is called JustSegmentAux to avoid conflicting with the factory method. +----------------------------------------------------------------------------------------------*/ +class JustSegmentAux : public Segment +{ +public: + JustSegmentAux( + Font * pfont, + ITextSource * pts, + LayoutEnvironment * playout, + toffset ichStart, + toffset ichStop, + float xsNaturalWidth, + float xsJustifiedWidth, + Segment * psegInitLike = NULL); +}; + +} // namespace gr + +#if defined(GR_NO_NAMESPACE) +using namespace gr; +#endif + +#endif // !GR_SEGMENT_INCLUDED diff --git a/Build/source/libs/graphite/engine-2.4/include/graphite/SegmentAux.h b/Build/source/libs/graphite/engine-2.4/include/graphite/SegmentAux.h new file mode 100644 index 00000000000..1904aab62af --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/include/graphite/SegmentAux.h @@ -0,0 +1,419 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 2005 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: SegmentAux.h +Responsibility: Sharon Correll +Last reviewed: Not yet. + +Description: + Auxiliary classes for the Segment class: + - GlyphInfo + - GlyphIterator + - LayoutEnvironment +----------------------------------------------------------------------------------------------*/ +#ifdef _MSC_VER +#pragma once +#endif +#ifndef SEGMENTAUX_INCLUDED +#define SEGMENTAUX_INCLUDED + +//:End Ignore + +namespace gr +{ + +class Segment; +class GrSlotOutput; +class IGrJustifier; +class GlyphInfo; +class GlyphIterator; +class GlyphSetIterator; + + +/*---------------------------------------------------------------------------------------------- + The GlyphInfo class provides access to details about a single glyph within a segment. +----------------------------------------------------------------------------------------------*/ +class GlyphInfo // hungarian: ginf +{ + friend class Segment; + +public: + // Default constructor: + GlyphInfo() + { + m_pseg = NULL; + m_pslout = NULL; + m_islout = kInvalid; + } + + gid16 glyphID(); + gid16 pseudoGlyphID(); + + // Index of this glyph in the logical sequence; zero-based. + size_t logicalIndex(); + + // glyph's position relative to the left of the segment + float origin(); + float advanceWidth(); // logical units + float advanceHeight(); // logical units; zero for horizontal fonts + float yOffset(); + gr::Rect bb(); // logical units + bool isSpace(); + + // first char associated with this glyph, relative to start of seg + toffset firstChar(); + // last char associated with this glyph, relative to start of seg + toffset lastChar(); + + // Unicode bidi value + unsigned int directionality(); + // Embedding depth + unsigned int directionLevel(); + bool insertBefore(); + int breakweight(); + + bool isAttached() const throw(); + gr::GlyphIterator attachedClusterBase() const throw(); + float attachedClusterAdvance() const throw(); + std::pair attachedClusterGlyphs() const; + + float maxStretch(size_t level); + float maxShrink(size_t level); + float stretchStep(size_t level); + byte justWeight(size_t level); + float justWidth(size_t level); + float measureStartOfLine(); + float measureEndOfLine(); + + size_t numberOfComponents(); + gr::Rect componentBox(size_t icomp); + toffset componentFirstChar(size_t icomp); + toffset componentLastChar(size_t icomp); + + bool erroneous(); + + const Segment & segment() const throw(); + Segment & segment() throw(); + +protected: + Segment * m_pseg; + GrSlotOutput * m_pslout; + int m_islout; // signed, so it can return kInvalid +}; + +inline Segment & GlyphInfo::segment() throw () { + return * m_pseg; +} + +inline const Segment & GlyphInfo::segment() const throw () { + return * m_pseg; +} + + +/*---------------------------------------------------------------------------------------------- + The GlyphIterator class allows the Graphite client to iterate over a contiguous + range of glyphs for the segment. +----------------------------------------------------------------------------------------------*/ +class GlyphIterator +: public std::iterator +{ + friend class GlyphInfo; + friend class Segment; + + // Pointers into the glyph info store + GlyphInfo * m_pginf; + +protected: + // Constructor + GlyphIterator(Segment & seg, size_t iginf); + +public: + // Default constructor. + GlyphIterator() throw (): m_pginf(0) {} + + explicit GlyphIterator(const GlyphSetIterator &); + + // Forward iterator requirements. + reference operator*() const { assert(m_pginf != 0); return *m_pginf; } + pointer operator->() const { return m_pginf; } + GlyphIterator & operator++() throw() { ++m_pginf; return *this; } + GlyphIterator operator++(int) throw() { GlyphIterator tmp = *this; operator++(); return tmp; } + + // Bidirectional iterator requirements + GlyphIterator & operator--() throw() { --m_pginf; return *this; } + GlyphIterator operator--(int) throw() { GlyphIterator tmp = *this; operator--(); return tmp; } + + // Random access iterator requirements + reference operator[](difference_type n) const { return m_pginf[n]; } + GlyphIterator & operator+=(difference_type n) throw() { m_pginf += n; return *this; } + GlyphIterator operator+(difference_type n) const throw() { GlyphIterator r = *this; return r += n; } + GlyphIterator & operator-=(difference_type n) throw() { m_pginf -= n; return *this; } + GlyphIterator operator-(difference_type n) const throw() { GlyphIterator r = *this; return r += -n; } + + // Relational operators. + // Forward iterator requirements + bool operator==(const GlyphIterator & rhs) const throw() { return m_pginf == rhs.m_pginf; } + bool operator!=(const GlyphIterator & rhs) const throw() { return !(*this == rhs); } + + // Random access iterator requirements + bool operator<(const GlyphIterator & rhs) const throw() { return m_pginf < rhs.m_pginf; } + bool operator>(const GlyphIterator & rhs) const throw() { return m_pginf > rhs.m_pginf; } + bool operator<=(const GlyphIterator & rhs) const throw() { return !(*this > rhs); } + bool operator>=(const GlyphIterator & rhs) const throw() { return !(*this < rhs); } + + difference_type operator-(const GlyphIterator & rhs) const throw() { return m_pginf - rhs.m_pginf; } +}; + +inline GlyphIterator operator+(const GlyphIterator::difference_type n, const GlyphIterator & rhs) +{ + return rhs + n; +} + + +/*---------------------------------------------------------------------------------------------- + This reference-counted vector is used as the basis of GlyphSetIterator. This is because + multiple iterators are based on the same vector, so it needs to hang around appropriately. +----------------------------------------------------------------------------------------------*/ +class RcVector +{ + friend class GlyphSetIterator; + +public: + RcVector(std::vector & vn) + { + m_vn = vn; + m_cref = 0; + } + +protected: + void IncRefCount() const + { + m_cref++; + } + void DecRefCount() const + { + m_cref--; + if (m_cref <= 0) + delete this; + } + + const std::vector & Vector() const { return m_vn; }; + + // member variables: + mutable int m_cref; + std::vector m_vn; +}; + +/*---------------------------------------------------------------------------------------------- + The GlyphSetIterator class allows the Graphite client to iterate over a non-contiguous + set of glyphs for the segment, this is almost always the set of glyphs for a character. +----------------------------------------------------------------------------------------------*/ +class GlyphSetIterator +: public std::iterator +{ + friend class GlyphInfo; + friend class Segment; + + // Segment containing the glyphs being iterated over. + const Segment * m_pseg; + + // Sometimes, in the case of character-to-glyph look-ups or attached + // children, we need to represent a non-contiguous list; in these cases + // we first map through a vector of output-slot objects into the actual + // glyph-info store. + std::vector::const_iterator m_vit; + + // Store a reliable copy of the vector we are iterating over: + const RcVector * m_qvislout; + +protected: + // Constructor that includes output-slot mapping list, used for non-contiguous lists: + GlyphSetIterator(Segment & seg, size_t islout, RcVector * qvislout) + : m_pseg(&seg), m_vit(qvislout->Vector().begin() + islout) + { + m_qvislout = qvislout; + m_qvislout->IncRefCount(); + } +public: + // Default constructor--no output-slot mapping: + GlyphSetIterator() throw() : m_pseg(0), m_vit(std::vector::const_iterator()) + { + m_qvislout = NULL; + } + + // Copy constructor: + GlyphSetIterator(const GlyphSetIterator & sit) throw() + { + m_pseg = sit.m_pseg; + m_vit = sit.m_vit; + m_qvislout = sit.m_qvislout; + if (m_qvislout) + m_qvislout->IncRefCount(); + } + // Assignment operator: + GlyphSetIterator & operator=(const GlyphSetIterator & sit) throw() + { + m_pseg = sit.m_pseg; + m_vit = sit.m_vit; + m_qvislout = sit.m_qvislout; + if (m_qvislout) + m_qvislout->IncRefCount(); + return *this; + } + // Destructor: + ~GlyphSetIterator() + { + if (m_qvislout) + m_qvislout->DecRefCount(); + } + + // Forward iterator requirements. + reference operator*() const; + pointer operator->() const { return &(operator*()); } + GlyphSetIterator & operator++() throw() { assert(m_pseg); assert(m_qvislout); ++m_vit; return *this; } + GlyphSetIterator operator++(int) throw() { GlyphSetIterator tmp = *this; operator++(); return tmp; } + + // Bidirectional iterator requirements + GlyphSetIterator & operator--() throw() { assert(m_pseg); assert(m_qvislout); --m_vit; return *this; } + GlyphSetIterator operator--(int) throw() { GlyphSetIterator tmp = *this; operator--(); return tmp; } + + // Random access iterator requirements + reference operator[](difference_type n) const { return *operator+(n); } + GlyphSetIterator & operator+=(difference_type n) throw() { assert(m_pseg); assert(m_qvislout); m_vit += n; return *this; } + GlyphSetIterator operator+(difference_type n) const throw() { GlyphSetIterator r = *this; return r += n; } + GlyphSetIterator & operator-=(difference_type n) throw() { operator+=(-n); return *this; } + GlyphSetIterator operator-(difference_type n) const throw() { GlyphSetIterator r = *this; return r += -n; } + + // Relational operators. + // Forward iterator requirements + bool operator==(const GlyphSetIterator & rhs) const throw() + { + assert(m_pseg == rhs.m_pseg); + if (!m_pseg || !rhs.m_pseg) + { + // For an empty set, the range will be empty so any two iterators will be equal. + return true; + } + assert(m_qvislout == rhs.m_qvislout); + return (m_vit == rhs.m_vit); + } + bool operator!=(const GlyphSetIterator & rhs) const throw() { return !(*this == rhs); } + + // Random access iterator requirements + bool operator<(const GlyphSetIterator & rhs) const throw() + { + assert(m_pseg == rhs.m_pseg); + if (!m_pseg || !rhs.m_pseg) + { + // For an empty set, the range will be empty so any two iterators will be equal. + return false; + } + assert(m_qvislout == rhs.m_qvislout); + return (m_vit < rhs.m_vit); + } + bool operator>(const GlyphSetIterator & rhs) const throw() { return rhs < *this; } + bool operator<=(const GlyphSetIterator & rhs) const throw() { return !(*this > rhs); } + bool operator>=(const GlyphSetIterator & rhs) const throw() { return !(*this < rhs); } + + difference_type operator-(const GlyphSetIterator & rhs) const throw() + { + assert(m_pseg == rhs.m_pseg); + if (!m_pseg || !rhs.m_pseg) + return 0; // empty set + assert(m_qvislout == rhs.m_qvislout); + return (m_vit - rhs.m_vit); + } +}; + +inline GlyphSetIterator operator+(const GlyphSetIterator::difference_type n, const GlyphSetIterator & rhs) +{ + return rhs + n; +} + + +/*---------------------------------------------------------------------------------------------- + The GlyphInfo class provides access to details about a single glyph within a segment. +----------------------------------------------------------------------------------------------*/ +class LayoutEnvironment +{ +public: + LayoutEnvironment() + { + // Defaults: + m_fStartOfLine = true; + m_fEndOfLine = true; + m_lbBest = klbWordBreak; + m_lbWorst = klbClipBreak; + m_fRightToLeft = false; + m_twsh = ktwshAll; + m_pstrmLog = NULL; + m_fDumbFallback = false; + m_psegPrev = NULL; + m_psegInit = NULL; + m_pjust = NULL; + } + LayoutEnvironment(LayoutEnvironment & layout) + { + m_fStartOfLine = layout.m_fStartOfLine; + m_fEndOfLine = layout.m_fEndOfLine; + m_lbBest = layout.m_lbBest; + m_lbWorst = layout.m_lbWorst; + m_fRightToLeft = layout.m_fRightToLeft; + m_twsh = layout.m_twsh; + m_pstrmLog = layout.m_pstrmLog; + m_fDumbFallback = layout.m_fDumbFallback; + m_psegPrev = layout.m_psegPrev; + m_psegInit = layout.m_psegInit; + m_pjust = layout.m_pjust; + } + + // Setters: + inline void setStartOfLine(bool f) { m_fStartOfLine = f; } + inline void setEndOfLine(bool f) { m_fEndOfLine = f; } + inline void setBestBreak(LineBrk lb) { m_lbBest = lb; } + inline void setWorstBreak(LineBrk lb) { m_lbWorst = lb; } + inline void setRightToLeft(bool f) { m_fRightToLeft = f; } + inline void setTrailingWs(TrWsHandling twsh) { m_twsh = twsh; } + inline void setLoggingStream(std::ostream * pstrm) { m_pstrmLog = pstrm; } + inline void setDumbFallback(bool f) { m_fDumbFallback = f; } + inline void setPrevSegment(Segment * pseg) { m_psegPrev = pseg; } + inline void setSegmentForInit(Segment * pseg) { m_psegInit = pseg; } + inline void setJustifier(IGrJustifier * pjust) { m_pjust = pjust; } + + // Getters: + inline bool startOfLine() { return m_fStartOfLine; } + inline bool endOfLine() { return m_fEndOfLine; } + inline LineBrk bestBreak() { return m_lbBest; } + inline LineBrk worstBreak() { return m_lbWorst; } + inline bool rightToLeft() { return m_fRightToLeft; } + inline TrWsHandling trailingWs() { return m_twsh; } + inline std::ostream * loggingStream() { return m_pstrmLog; } + inline bool dumbFallback() { return m_fDumbFallback; } + inline Segment * prevSegment() { return m_psegPrev; } + inline Segment * segmentForInit() { return m_psegInit; } + inline IGrJustifier * justifier() { return m_pjust; } + +protected: + bool m_fStartOfLine; + bool m_fEndOfLine; + LineBrk m_lbBest; + LineBrk m_lbWorst; + bool m_fRightToLeft; + TrWsHandling m_twsh; + std::ostream * m_pstrmLog; + bool m_fDumbFallback; + Segment * m_psegPrev; + Segment * m_psegInit; + IGrJustifier * m_pjust; +}; + +} // namespace gr + +#if defined(GR_NO_NAMESPACE) +using namespace gr; +#endif + +#endif // !SEGMENTAUX_INCLUDED diff --git a/Build/source/libs/graphite/engine-2.4/include/graphite/SegmentPainter.h b/Build/source/libs/graphite/engine-2.4/include/graphite/SegmentPainter.h new file mode 100644 index 00000000000..c1e0231bf08 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/include/graphite/SegmentPainter.h @@ -0,0 +1,234 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 1999, 2001 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: SegmentPainter.h +Responsibility: Sharon Correll +Last reviewed: Not yet. + +Description: + Defines the class for a Graphite text segment. +----------------------------------------------------------------------------------------------*/ +#ifdef _MSC_VER +#pragma once +#endif +#ifndef GR_SEGPAINTER_INCLUDED +#define GR_SEGPAINTER_INCLUDED + +// undo automagic DrawTextA DrawTextW stuff +// #undef DrawText + +//:End Ignore + + +namespace gr +{ + +class Segment; + +/*---------------------------------------------------------------------------------------------- + A SegmentPainter handles the UI-related operations on for segment. + + This superclass does not know how to do any actual drawing, because it has no access + to a device. Subclasses are needed to handle drawing on the various platforms. In addition, + it is legitimate to make a subclass to override the behavior of a specific piece of + functionality. + + Hungarian: segp +----------------------------------------------------------------------------------------------*/ +class SegmentPainter +{ +public: + // Static methods + + // Constructors/destructors/etc. + SegmentPainter(Segment * pseg, float xOrigin = 0, float yOrigin = 0); + //SegmentPainter(Segment * pseg, float xOrigin, float yOrigin); + + virtual ~SegmentPainter(); + + virtual void setOrigin(float xsOrigin, float ysOrigin); + virtual void setPosition(float xdPosition, float ydPosition); + virtual void setScalingFactors(float xFactor, float yFactor); + + virtual void setBuggyDisplayFormat(int /*strategy*/, long /*textColor*/, long /*backColor*/, + long /*underlineColor*/) + { + // Currently not implemented to do anything useful. + } + + // The paint method must be implemented by a concrete subclass: + virtual void paint() = 0; + + virtual void drawInsertionPoint(int ichwIP, bool fAssocPrev, bool bOn, bool fForceSplit); + virtual void positionsOfIP(int ichwIP, bool fAssocPrev, bool fForceSplit, + Rect * prdPrimary, Rect * prdSecondary); + virtual bool drawSelectionRange(int ichwMin, int ichwLim, + float ydTop, float ydBottom, bool bOn); + virtual bool positionsOfRange(int ichwMin, int ichwLim, + float ydTop, float ydBottom, Rect * prsBounds); + virtual size_t getUnderlinePlacement(int ichwMin, int ichwLim, + bool fSkipSpace, + size_t crgMax, // number of ranges allowed + float * prgxdLefts, float * prgxdRights, float * prgydUnderline); + + virtual void pointToChar(Point zptdClickPosition, int * pichw, bool * pfAssocPrev); + virtual LgIpValidResult isValidInsertionPoint(int ichwIP); + virtual bool doBoundariesCoincide(bool fBoundaryEnd, bool fBoundaryRight); + virtual int arrowKeyPosition(int ichwIP, bool * pfAssocPrev, + bool fRight, bool * pfInThisSeg); + virtual int extendSelectionPosition( + int charIndex, bool assocPrevMatch, bool assocPrevNeeded, + int anchorIndex, bool movingRight, bool * inThisSeg); + + // For calculating underlines: + struct LineSeg { // hungarian: ls + float left; + float right; + }; + + static float ScaleX(float xs, Rect rs, Rect rd); + static float ScaleY(float ys, Rect rs, Rect rd); + + float ScaleXToDest(float xs) + { + float xd = ((xs + m_xsOrigin) * m_xFactor) + m_xdPosition; + return xd; + } + //int ScaleXToDest(int xs) + //{ + // int xd = (((xs + m_xsOriginInt) * m_xFactor64) >> 6) + m_xdPositionInt; + // return xd; // >> 6 means div by 64 + //} + float ScaleYToDest(float ys) + { + float yd = ((ys + m_ysOrigin) * m_yFactor) + m_ydPosition; + return yd; + } + + float ScaleXToSource(float xd) + { + float xs = ((xd - m_xdPosition) / m_xFactor) - m_xsOrigin; + return xs; + } + float ScaleYToSource(float yd) + { + float ys = ((yd - m_ydPosition) / m_yFactor) - m_ysOrigin; + return ys; + } + +protected: + // Member variables: + + Segment * m_pseg; + + // transformation factors: + float m_xsOrigin; + float m_ysOrigin; + float m_xdPosition; + float m_ydPosition; + float m_xFactor; // destination / source + float m_yFactor; // destination / source + + // optimizations for when we need integer arithmetic (converting between int and float is + // very slow) - DELETE these. + //int m_xsOriginInt; + //int m_xdPositionInt; + //int m_xFactor64; + + //gr::Rect m_rectSrc; + + // Other methods: + + void CalcOrDrawInsertionPoint( + int ich, bool fAssocPrev, bool bOn, bool fForceSplit, + Rect * prectPrimary, Rect * prectSecondary); + void InvertIBeam(float xs, float ysTop, float ysBottom, bool fAssocPrev, + Rect * prdRet); + void InvertSplitIP(float xs, float ysTop, float ysBottom, + bool fTop, bool fAssocRight, bool fSecondary, float ysMinSplitHt, + Rect * prdRet); + void CalcIP(int ichw, bool fBefore, + float * pxs, float * pysTop, float * pysBottom, bool * pfRtl); + bool CloseIPPositions( + float * pxsBefore, float ysBeforeTop, float ysBeforeBottom, + float * pxsAfter, float ysAfterTop, float ysAfterBottom); + bool AtEdgeOfCluster(GrSlotOutput * pslout, int islout, bool fBefore); + bool AtEdgeOfCluster(GrSlotOutput * psloutBase, int isloutBase, + GrSlotOutput * pslout, int islout, bool fBefore); + bool CanInsertIntoCluster(GrSlotOutput * pslout, int islout); + + void CalcPartialLigatures(bool * prgfAllSelected, + int ichwMinSeg, int ichwLimSeg, + int ichwMinSel, int ichwLimSel); + void CalcHighlightRect(int ichw, + std::vector & vrs, std::vector & vfEntireLineHt, + bool fJustComponent, bool * rgfHighlighted, bool fSkipTrSpace); + void CalcCompleteCluster(int islout, + std::vector & vrs, std::vector & vfEntireLineHt, bool * prgfHighlighted); + void AddRectWithoutOverlaps(std::vector & vrect, Rect rectToAdd); + bool AnyArea(Rect * prect); + bool AdjustRectsToNotOverlap(std::vector & vrect, int irect, Rect * prect2, + std::vector & vrectMoreToAdd); + void AssertNoOverlaps(std::vector & vrect); + + void AddLineSegWithoutOverlaps(std::vector & vls, LineSeg lsToAdd); + bool AnyLength(LineSeg * pls); + bool AdjustLineSegsToNotOverlap(std::vector & vls, int ils, LineSeg * pls2, + std::vector & vlsMoreToAdd); + void AssertNoOverlaps(std::vector & vls); + + GrResult ArrowKeyPositionAux(int * pichwIP, bool * pfAssocPrev, + bool fRight, bool fMovingIn, + bool fAssocPrevMatch, bool fAssocPrevNeeded, + bool * pfResult); + bool ArrowKeyPositionInternal(int * pichw, bool * pfAssocPrev, + bool fRight, bool fAssocPrevMatch, bool fAssocPrevNeeded, int * nNextOrPrevSeg); + bool AdjacentLigComponent(int * pichw, bool * pfAssocPrev, bool fRight, bool fMove); + + int PointToCharAux(float xsTry, float ysTry, + float * pxsGlyphOffset, float * pxsGlyphWidth); + + // Platform-specific routines: + + GrResult DrawSegmentPlatform(float xs, float ys); + + // Low-level routines--these must be implemented appropriate by subclasses: + + virtual void InvertRect(float /*xLeft*/, float /*yTop*/, float /*xRight*/, float /*yBottom*/) + { + GrAssert(false); // no device context + } + + //void SetFontProps(); + virtual void SetFontProps(unsigned long clrFore, unsigned long clrBack); + +}; + +/*---------------------------------------------------------------------------------------------- + This is a subclass of SegmentPainter for which the paint operation is unnecessary. +----------------------------------------------------------------------------------------------*/ +class SegmentNonPainter : public SegmentPainter +{ +public: + SegmentNonPainter(Segment * pseg) + : SegmentPainter(pseg) + { + } + + void paint() + { + GrAssert(false); + throw; + } +}; + +} // namespace gr + +#if defined(GR_NO_NAMESPACE) +using namespace gr; +#endif + +#endif // !GR_SEGPAINTER_INCLUDED diff --git a/Build/source/libs/graphite/engine-2.4/installed-top.pc.in b/Build/source/libs/graphite/engine-2.4/installed-top.pc.in new file mode 100644 index 00000000000..7609afda4e4 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/installed-top.pc.in @@ -0,0 +1,5 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ +version=@VERSION@ diff --git a/Build/source/libs/graphite/engine-2.4/license/LICENSING.txt b/Build/source/libs/graphite/engine-2.4/license/LICENSING.txt new file mode 100644 index 00000000000..33a150a94d6 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/license/LICENSING.txt @@ -0,0 +1,43 @@ + Graphite 2.1 Licensing + + Copyright 1999-2006, SIL International + All rights reserved. + + This library is free software; you can redistribute it and/or modify + it under the terms of either: + + a) the Common Public License as published by the "Agreement + Steward" for that license (currently IBM); either version 0.5 + of the License, or (at your option) any later version, + + or + + b) the GNU Lesser General Public License as published by the + Free Software Foundation; either version 2.1 of License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See either + the Common Public License or the GNU Lesser General Public License + for more details. + + You should have received a plain text copy of the Common Public License + Version 0.5 with this distribution in the file named "License_CPLv05.txt". + That text came from http://www.opensource.org/licenses/cpl.html. The + initial "Agreement Steward" for the CPL displays currently the license at + http://www-124.ibm.com/developerworks/oss/license-cpl.html. + + You should also have received a copy of the GNU Lesser General Public + License along with this library in the file named "License_LGPLv21.txt". + If not, write to the Free Software Foundation, Inc., 59 Temple Place, + Suite 330, Boston, MA 02111-1307, USA or visit their web page on the + internet at http://www.fsf.org/licenses/lgpl.html. + + The GNU General Public License to which the GNU Lesser General Public + License refers can be found at http://www.gnu.org/copyleft/gpl.html. + For convenient reference, a text version has been included with this + distribution in the file named "License_GPLv2.txt". All of the licenses + mentioned above can also be found at http://www.opensource.org/licenses/. + +-------------------------------------------------------------------------- diff --git a/Build/source/libs/graphite/engine-2.4/license/License_CPLv05.txt b/Build/source/libs/graphite/engine-2.4/license/License_CPLv05.txt new file mode 100644 index 00000000000..4cac5dfe069 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/license/License_CPLv05.txt @@ -0,0 +1,86 @@ +Common Public License Version 0.5 +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS COMMON PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and + +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this Agreement. + +"Recipient" means anyone who receives the Program under this Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder. + +c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the Program. + +Contributors may not remove or alter any copyright notices contained within the Program. + +Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense. + +For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against a Contributor with respect to a patent applicable to software (including a cross-claim or counterclaim in a lawsuit), then any patent licenses granted by that Contributor to such Recipient under this Agreement shall terminate as of the date such litigation is filed. In addition, If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive. + +Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. IBM is the initial Agreement Steward. IBM may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation. diff --git a/Build/source/libs/graphite/engine-2.4/license/License_GPLv2.txt b/Build/source/libs/graphite/engine-2.4/license/License_GPLv2.txt new file mode 100644 index 00000000000..1bcc46f53a6 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/license/License_GPLv2.txt @@ -0,0 +1,342 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. + + diff --git a/Build/source/libs/graphite/engine-2.4/license/License_LGPLv21.txt b/Build/source/libs/graphite/engine-2.4/license/License_LGPLv21.txt new file mode 100644 index 00000000000..807db791666 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/license/License_LGPLv21.txt @@ -0,0 +1,506 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + + + + diff --git a/Build/source/libs/graphite/engine-2.4/makefile.vc7 b/Build/source/libs/graphite/engine-2.4/makefile.vc7 new file mode 100644 index 00000000000..11afd901df3 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/makefile.vc7 @@ -0,0 +1,814 @@ + +TARGET=graphite + +CPP=cl.exe +CPPFLAGS=/nologo /W4 /GR /GX /I "./src/font" /I "./src/painter" /I "./src/segment" /I "./src/textsource" /I "./src/generic" /I "./include/graphite" /I "../wrappers/win32" /D "GR_NAMESPACE" /D "WIN32" /D "_WINDOWS" /D "_UNICODE" /D "UNICODE" /D "TRACING" /Fp"$(INTDIR)\graphite.pch" /YX /Fd"$(INTDIR)\\" /FD /c +# /Wp62 + +LINK=link.exe +LINK_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /dll /pdb:"$(OUTDIR)\\graphite.pdb" /machine:I386 /out:"$(OUTDIR)\\$(TARGET).dll" /implib:"$(OUTDIR)\\$(TARGET).lib" + +BSC32=bscmake.exe +BSC32_FLAGS=/nologo /o"$(OUTDIR)\\$(TARGET).bsc" + +AR=lib +AR_FLAGS=/OUT:$@ + +!IF "$(MLIB)" == "MD" +MLIB=MD +!ELSE +MLIB=MT +!ENDIF + +OBJEXT = .obj +SBREXT = .sbr + +!IF "$(CFG)" == "DEBUG" +CPP_DEBUG=/D "DEBUG" /Gm /GR /ZI /Od /GZ /FR"$(INTDIR)\\" /$(MLIB)d +# CPP_DEBUG=/D "DEBUG" /Gm /GR /ZI /Od /GZ /FR"$(INTDIR)\\" /MDd + +OUTDIR=.\debug_vc7 +INTDIR=.\debug_temp +LINK_DEBUG= MSVCRTD.lib /debug /incremental:yes #/pdbtype:sept + +all : lib lib_dll bsc + +!ELSE +CPP_DEBUG=/D "NDEBUG" /O2 /$(MLIB) +# CPP_DEBUG=/D "NDEBUG" /O2 /MD +OUTDIR=.\release_vc7 +INTDIR=.\release_temp +LINK_DEBUG= MSVCRT.lib /incremental:no /NODEFAULTLIB:libc + +all : lib lib_dll + +!ENDIF + +!IF "$(TRACING)" == "1" +CPP_DEBUG=/D "TRACING" $(CPP_DEBUG) +!ENDIF + +!IF "$(OS)" == "Windows_NT" +NULL= +!ELSE +NULL=nul +!ENDIF + +clean : + @- rd /s/q .\release_temp + @- rd /s/q .\debug_temp + +realclean : clean + @- rd /s/q .\release_vc7 + @- rd /s/q .\debug_vc7 + +LINK_OBJS=\ +# "$(INTDIR)\BinTree_i$(OBJEXT)"\ +# "$(INTDIR)\HashMap_i$(OBJEXT)"\ + "$(INTDIR)\Debug$(OBJEXT)"\ + "$(INTDIR)\Util$(OBJEXT)"\ + "$(INTDIR)\Font$(OBJEXT)"\ + "$(INTDIR)\FileFont$(OBJEXT)"\ + "$(INTDIR)\FontCache$(OBJEXT)"\ + "$(INTDIR)\FontFace$(OBJEXT)"\ + "$(INTDIR)\FileInput$(OBJEXT)"\ + "$(INTDIR)\GrCharStream$(OBJEXT)"\ + "$(INTDIR)\GrClassTable$(OBJEXT)"\ + "$(INTDIR)\GrEngine$(OBJEXT)"\ + "$(INTDIR)\GrFeature$(OBJEXT)"\ + "$(INTDIR)\GrFSM$(OBJEXT)"\ + "$(INTDIR)\GrGlyphTable$(OBJEXT)"\ + "$(INTDIR)\GrPass$(OBJEXT)"\ + "$(INTDIR)\GrPassActionCode$(OBJEXT)"\ + "$(INTDIR)\GrSlotState$(OBJEXT)"\ + "$(INTDIR)\GrSlotStream$(OBJEXT)"\ + "$(INTDIR)\GrTableManager$(OBJEXT)"\ + "$(INTDIR)\MemoryUsage$(OBJEXT)"\ + "$(INTDIR)\Segment$(OBJEXT)"\ + "$(INTDIR)\SegmentAux$(OBJEXT)"\ + "$(INTDIR)\SegmentPainter$(OBJEXT)"\ +# "$(INTDIR)\TestFSM$(OBJEXT)"\ +# "$(INTDIR)\TestPasses$(OBJEXT)"\ + "$(INTDIR)\TransductionLog$(OBJEXT)"\ +### "$(INTDIR)\XmlTransductionLog$(OBJEXT)"\ + "$(INTDIR)\Platform$(OBJEXT)"\ + "$(INTDIR)\TtfUtil$(OBJEXT)"\ + "$(INTDIR)\WinFont$(OBJEXT)"\ + "$(INTDIR)\WinSegmentPainter$(OBJEXT)" + +LINK_DLL_OBJS=\ +# "$(INTDIR)\BinTree_i_dll$(OBJEXT)"\ +# "$(INTDIR)\HashMap_i_dll$(OBJEXT)"\ + "$(INTDIR)\Debug_dll$(OBJEXT)"\ + "$(INTDIR)\Util_dll$(OBJEXT)"\ + "$(INTDIR)\Font_dll$(OBJEXT)"\ + "$(INTDIR)\WinFont_dll$(OBJEXT)"\ + "$(INTDIR)\FileFont_dll$(OBJEXT)"\ + "$(INTDIR)\FontCache_dll$(OBJEXT)"\ + "$(INTDIR)\FontFace_dll$(OBJEXT)"\ + "$(INTDIR)\FileInput_dll$(OBJEXT)"\ + "$(INTDIR)\GrCharStream_dll$(OBJEXT)"\ + "$(INTDIR)\GrClassTable_dll$(OBJEXT)"\ + "$(INTDIR)\GrEngine_dll$(OBJEXT)"\ + "$(INTDIR)\GrFeature_dll$(OBJEXT)"\ + "$(INTDIR)\GrFSM_dll$(OBJEXT)"\ + "$(INTDIR)\GrGlyphTable_dll$(OBJEXT)"\ + "$(INTDIR)\GrPass_dll$(OBJEXT)"\ + "$(INTDIR)\GrPassActionCode_dll$(OBJEXT)"\ + "$(INTDIR)\GrSlotState_dll$(OBJEXT)"\ + "$(INTDIR)\GrSlotStream_dll$(OBJEXT)"\ + "$(INTDIR)\GrTableManager_dll$(OBJEXT)"\ + "$(INTDIR)\MemoryUsage_dll$(OBJEXT)"\ + "$(INTDIR)\Segment_dll$(OBJEXT)"\ + "$(INTDIR)\SegmentAux_dll$(OBJEXT)"\ + "$(INTDIR)\SegmentPainter_dll$(OBJEXT)"\ +# "$(INTDIR)\TestFSM_dll$(OBJEXT)"\ +# "$(INTDIR)\TestPasses_dll$(OBJEXT)"\ + "$(INTDIR)\TransductionLog_dll$(OBJEXT)"\ +### "$(INTDIR)\XmlTransductionLog_dll$(OBJEXT)"\ + "$(INTDIR)\WinSegmentPainter_dll$(OBJEXT)"\ + "$(INTDIR)\Platform_dll$(OBJEXT)"\ + "$(INTDIR)\TtfUtil_dll$(OBJEXT)" + +DLL_LINK_OBJS=\ + "$(INTDIR)\win32_dll_dll$(OBJEXT)" + +BSC32_SBRS=\ +# "$(INTDIR)\BinTree_i$(SBREXT)"\ +# "$(INTDIR)\HashMap_i$(SBREXT)"\ + "$(INTDIR)\Debug$(SBREXT)"\ + "$(INTDIR)\Util$(SBREXT)"\ + "$(INTDIR)\Font$(SBREXT)"\ + "$(INTDIR)\WinFont$(SBREXT)"\ + "$(INTDIR)\FileFont$(SBREXT)"\ + "$(INTDIR)\FontCache$(SBREXT)"\ + "$(INTDIR)\FontFace$(SBREXT)"\ + "$(INTDIR)\FileInput$(SBREXT)"\ + "$(INTDIR)\GrCharStream$(SBREXT)"\ + "$(INTDIR)\GrClassTable$(SBREXT)"\ + "$(INTDIR)\GrEngine$(SBREXT)"\ + "$(INTDIR)\GrFeature$(SBREXT)"\ + "$(INTDIR)\GrFSM$(SBREXT)"\ + "$(INTDIR)\GrGlyphTable$(SBREXT)"\ + "$(INTDIR)\GrPass$(SBREXT)"\ + "$(INTDIR)\GrPassActionCode$(SBREXT)"\ + "$(INTDIR)\GrSlotState$(SBREXT)"\ + "$(INTDIR)\GrSlotStream$(SBREXT)"\ + "$(INTDIR)\GrTableManager$(SBREXT)"\ + "$(INTDIR)\MemoryUsage$(SBREXT)"\ + "$(INTDIR)\Segment$(SBREXT)"\ + "$(INTDIR)\SegmentAux$(SBREXT)"\ + "$(INTDIR)\SegmentPainter$(SBREXT)"\ +# "$(INTDIR)\TestFSM$(SBREXT)"\ +# "$(INTDIR)\TestPasses$(SBREXT)"\ + "$(INTDIR)\TransductionLog$(SBREXT)"\ +### "$(INTDIR)\XmlTransductionLog$(SBREXT)"\ + "$(INTDIR)\WinSegmentPainter$(SBREXT)"\ + "$(INTDIR)\Platform$(SBREXT)"\ + "$(INTDIR)\TtfUtil$(SBREXT)"\ + "$(INTDIR)\win32_dll$(SBREXT)" + +$(OUTDIR) : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +$(INTDIR) : + if not exist "$(INTDIR)/$(NULL)" mkdir "$(INTDIR)" + +lib : "$(OUTDIR)/$(TARGET).lib" + +lib_dll : "$(OUTDIR)/$(TARGET)_dll.lib" + +"$(OUTDIR)/$(TARGET).lib" : "$(OUTDIR)" "$(INTDIR)" $(LINK_OBJS) + $(AR) @<< + $(AR_FLAGS) $(LINK_OBJS) +<< + +"$(OUTDIR)/$(TARGET)_dll.lib" : "$(OUTDIR)" "$(INTDIR)" $(LINK_DLL_OBJS) + $(AR) @<< + $(AR_FLAGS) $(LINK_DLL_OBJS) +<< + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\BinTree_i$(OBJEXT)" "$(INTDIR)\BinTree_i$(SBREXT)" : "src/generic/BinTree_i.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\BinTree_i$(OBJEXT)" $? + +"$(INTDIR)\BinTree_i_dll$(OBJEXT)" "$(INTDIR)\BinTree_i_dll$(SBREXT)" : "src/generic/BinTree_i.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\BinTree_i_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\BinTree_i$(OBJEXT)" : "src/generic/BinTree_i.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\BinTree_i$(OBJEXT)" $? + +"$(INTDIR)\BinTree_i_dll$(OBJEXT)" : "src/generic/BinTree_i.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /D "_DLL" /Fo"$(INTDIR)\BinTree_i_dll$(OBJEXT)" $? + +!ENDIF + + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\Debug$(OBJEXT)" "$(INTDIR)\Debug$(SBREXT)" : "src/generic/Debug.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\Debug$(OBJEXT)" $? + +"$(INTDIR)\Debug_dll$(OBJEXT)" "$(INTDIR)\Debug_dll$(SBREXT)" : "src/generic/Debug.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\Debug_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\Debug$(OBJEXT)" : "src/generic/Debug.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\Debug$(OBJEXT)" $? + +"$(INTDIR)\Debug_dll$(OBJEXT)" : "src/generic/Debug.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\Debug_dll$(OBJEXT)" $? + +!ENDIF + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\HashMap$(OBJEXT)" "$(INTDIR)\HashMap$(SBREXT)" : "src/generic/HashMap.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\HashMap$(OBJEXT)" $? + +"$(INTDIR)\HashMap_dll$(OBJEXT)" "$(INTDIR)\HashMap_dll$(SBREXT)" : "src/generic/HashMap.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\HashMap_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\HashMap$(OBJEXT)" : "src/generic/HashMap.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\HashMap$(OBJEXT)" $? + +"$(INTDIR)\HashMap_dll$(OBJEXT)" : "src/generic/HashMap.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\HashMap_dll$(OBJEXT)" $? + +!ENDIF + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\HashMap_i$(OBJEXT)" "$(INTDIR)\HashMap_i$(SBREXT)" : "src/generic/HashMap_i.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\HashMap_i$(OBJEXT)" $? + +"$(INTDIR)\HashMap_i_dll$(OBJEXT)" "$(INTDIR)\HashMap_i_dll$(SBREXT)" : "src/generic/HashMap_i.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\HashMap_i_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\HashMap_i$(OBJEXT)" : "src/generic/HashMap_i.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\HashMap_i$(OBJEXT)" $? + +"$(INTDIR)\HashMap_i_dll$(OBJEXT)" : "src/generic/HashMap_i.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\HashMap_i_dll$(OBJEXT)" $? + +!ENDIF + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\Set_i$(OBJEXT)" "$(INTDIR)\Set_i$(SBREXT)" : "src/generic/Set_i.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\Set_i$(OBJEXT)" $? + +"$(INTDIR)\Set_i_dll$(OBJEXT)" "$(INTDIR)\Set_i_dll$(SBREXT)" : "src/generic/Set_i.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\Set_i_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\Set_i$(OBJEXT)" : "src/generic/Set_i.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\Set_i$(OBJEXT)" $? + +"$(INTDIR)\Set_i_dll$(OBJEXT)" : "src/generic/Set_i.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\Set_i_dll$(OBJEXT)" $? + +!ENDIF + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\Util$(OBJEXT)" "$(INTDIR)\Util$(SBREXT)" : "src/generic/Util.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\Util$(OBJEXT)" $? + +"$(INTDIR)\Util_dll$(OBJEXT)" "$(INTDIR)\Util_dll$(SBREXT)" : "src/generic/Util.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\Util_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\Util$(OBJEXT)" : "src/generic/Util.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\Util$(OBJEXT)" $? + +"$(INTDIR)\Util_dll$(OBJEXT)" : "src/generic/Util.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\Util_dll$(OBJEXT)" $? + +!ENDIF + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\UtilString$(OBJEXT)" "$(INTDIR)\UtilString$(SBREXT)" : "src/generic/UtilString.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\UtilString$(OBJEXT)" $? + +"$(INTDIR)\UtilString_dll$(OBJEXT)" "$(INTDIR)\UtilString_dll$(SBREXT)" : "src/generic/UtilString.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\UtilString_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\UtilString$(OBJEXT)" : "src/generic/UtilString.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\UtilString$(OBJEXT)" $? + +"$(INTDIR)\UtilString_dll$(OBJEXT)" : "src/generic/UtilString.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\UtilString_dll$(OBJEXT)" $? + +!ENDIF + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\Vector_i$(OBJEXT)" "$(INTDIR)\Vector_i$(SBREXT)" : "src/generic/Vector_i.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\Vector_i$(OBJEXT)" $? + +"$(INTDIR)\Vector_i_dll$(OBJEXT)" "$(INTDIR)\Vector_i_dll$(SBREXT)" : "src/generic/Vector_i.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\Vector_i_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\Vector_i$(OBJEXT)" : "src/generic/Vector_i.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\Vector_i$(OBJEXT)" $? + +"$(INTDIR)\Vector_i_dll$(OBJEXT)" : "src/generic/Vector_i.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\Vector_i_dll$(OBJEXT)" $? + +!ENDIF + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\Font$(OBJEXT)" "$(INTDIR)\Font$(SBREXT)" : "src/font/Font.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\Font$(OBJEXT)" $? + +"$(INTDIR)\Font_dll$(OBJEXT)" "$(INTDIR)\Font_dll$(SBREXT)" : "src/font/Font.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\Font_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\Font$(OBJEXT)" : "src/font/Font.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\Font$(OBJEXT)" $? + +"$(INTDIR)\Font_dll$(OBJEXT)" : "src/font/Font.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\Font_dll$(OBJEXT)" $? + +!ENDIF + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\GrUtil$(OBJEXT)" "$(INTDIR)\GrUtil$(SBREXT)" : "src/font/GrUtil.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrUtil$(OBJEXT)" $? + +"$(INTDIR)\GrUtil_dll$(OBJEXT)" "$(INTDIR)\GrUtil_dll$(SBREXT)" : "src/font/GrUtil.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\GrUtil_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\GrUtil$(OBJEXT)" : "src/font/GrUtil.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrUtil$(OBJEXT)" $? + +"$(INTDIR)\GrUtil_dll$(OBJEXT)" : "src/font/GrUtil.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\GrUtil_dll$(OBJEXT)" $? + +!ENDIF + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\TtfUtil$(OBJEXT)" "$(INTDIR)\TtfUtil$(SBREXT)" : "src/font/TtfUtil.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\TtfUtil$(OBJEXT)" $? + +"$(INTDIR)\TtfUtil_dll$(OBJEXT)" "$(INTDIR)\TtfUtil_dll$(SBREXT)" : "src/font/TtfUtil.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\TtfUtil_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\TtfUtil$(OBJEXT)" : "src/font/TtfUtil.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\TtfUtil$(OBJEXT)" $? + +"$(INTDIR)\TtfUtil_dll$(OBJEXT)" : "src/font/TtfUtil.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\TtfUtil_dll$(OBJEXT)" $? + +!ENDIF + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\FontCache$(OBJEXT)" "$(INTDIR)\FontCache$(SBREXT)" : "src/segment/FontCache.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\FontCache$(OBJEXT)" $? + +"$(INTDIR)\FontCache_dll$(OBJEXT)" "$(INTDIR)\FontCache_dll$(SBREXT)" : "src/segment/FontCache.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\FontCache_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\FontCache$(OBJEXT)" : "src/segment/FontCache.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\FontCache$(OBJEXT)" $? + +"$(INTDIR)\FontCache_dll$(OBJEXT)" : "src/segment/FontCache.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\FontCache_dll$(OBJEXT)" $? + +!ENDIF + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\FontFace$(OBJEXT)" "$(INTDIR)\FontFace$(SBREXT)" : "src/segment/FontFace.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\FontFace$(OBJEXT)" $? + +"$(INTDIR)\FontFace_dll$(OBJEXT)" "$(INTDIR)\FontFace_dll$(SBREXT)" : "src/segment/FontFace.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\FontFace_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\FontFace$(OBJEXT)" : "src/segment/FontFace.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\FontFace$(OBJEXT)" $? + +"$(INTDIR)\FontFace_dll$(OBJEXT)" : "src/segment/FontFace.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\FontFace_dll$(OBJEXT)" $? + +!ENDIF + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\FileInput$(OBJEXT)" "$(INTDIR)\FileInput$(SBREXT)" : "src/segment/FileInput.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\FileInput$(OBJEXT)" $? + +"$(INTDIR)\FileInput_dll$(OBJEXT)" "$(INTDIR)\FileInput_dll$(SBREXT)" : "src/segment/FileInput.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\FileInput_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\FileInput$(OBJEXT)" : "src/segment/FileInput.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\FileInput$(OBJEXT)" $? + +"$(INTDIR)\FileInput_dll$(OBJEXT)" : "src/segment/FileInput.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\FileInput_dll$(OBJEXT)" $? + +!ENDIF + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\GrCharStream$(OBJEXT)" "$(INTDIR)\GrCharStream$(SBREXT)" : "src/segment/GrCharStream.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrCharStream$(OBJEXT)" $? + +"$(INTDIR)\GrCharStream_dll$(OBJEXT)" "$(INTDIR)\GrCharStream_dll$(SBREXT)" : "src/segment/GrCharStream.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\GrCharStream_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\GrCharStream$(OBJEXT)" : "src/segment/GrCharStream.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrCharStream$(OBJEXT)" $? + +"$(INTDIR)\GrCharStream_dll$(OBJEXT)" : "src/segment/GrCharStream.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\GrCharStream_dll$(OBJEXT)" $? + +!ENDIF + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\GrClassTable$(OBJEXT)" "$(INTDIR)\GrClassTable$(SBREXT)" : "src/segment/GrClassTable.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrClassTable$(OBJEXT)" $? + +"$(INTDIR)\GrClassTable_dll$(OBJEXT)" "$(INTDIR)\GrClassTable_dll$(SBREXT)" : "src/segment/GrClassTable.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\GrClassTable_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\GrClassTable$(OBJEXT)" : "src/segment/GrClassTable.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrClassTable$(OBJEXT)" $? + +"$(INTDIR)\GrClassTable_dll$(OBJEXT)" : "src/segment/GrClassTable.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\GrClassTable_dll$(OBJEXT)" $? + +!ENDIF + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\GrEngine$(OBJEXT)" "$(INTDIR)\GrEngine$(SBREXT)" : "src/segment/GrEngine.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrEngine$(OBJEXT)" $? + +"$(INTDIR)\GrEngine_dll$(OBJEXT)" "$(INTDIR)\GrEngine_dll$(SBREXT)" : "src/segment/GrEngine.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\GrEngine_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\GrEngine$(OBJEXT)" : "src/segment/GrEngine.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrEngine$(OBJEXT)" $? + +"$(INTDIR)\GrEngine_dll$(OBJEXT)" : "src/segment/GrEngine.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\GrEngine_dll$(OBJEXT)" $? + +!ENDIF + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\GrFeature$(OBJEXT)" "$(INTDIR)\GrFeature$(SBREXT)" : "src/segment/GrFeature.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrFeature$(OBJEXT)" $? + +"$(INTDIR)\GrFeature_dll$(OBJEXT)" "$(INTDIR)\GrFeature_dll$(SBREXT)" : "src/segment/GrFeature.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\GrFeature_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\GrFeature$(OBJEXT)" : "src/segment/GrFeature.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrFeature$(OBJEXT)" $? + +"$(INTDIR)\GrFeature_dll$(OBJEXT)" : "src/segment/GrFeature.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\GrFeature_dll$(OBJEXT)" $? + +!ENDIF + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\GrFSM$(OBJEXT)" "$(INTDIR)\GrFSM$(SBREXT)" : "src/segment/GrFSM.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrFSM$(OBJEXT)" $? + +"$(INTDIR)\GrFSM_dll$(OBJEXT)" "$(INTDIR)\GrFSM_dll$(SBREXT)" : "src/segment/GrFSM.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\GrFSM_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\GrFSM$(OBJEXT)" : "src/segment/GrFSM.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrFSM$(OBJEXT)" $? + +"$(INTDIR)\GrFSM_dll$(OBJEXT)" : "src/segment/GrFSM.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\GrFSM_dll$(OBJEXT)" $? + +!ENDIF + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\GrGlyphTable$(OBJEXT)" "$(INTDIR)\GrGlyphTable$(SBREXT)" : "src/segment/GrGlyphTable.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrGlyphTable$(OBJEXT)" $? + +"$(INTDIR)\GrGlyphTable_dll$(OBJEXT)" "$(INTDIR)\GrGlyphTable_dll$(SBREXT)" : "src/segment/GrGlyphTable.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\GrGlyphTable_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\GrGlyphTable$(OBJEXT)" : "src/segment/GrGlyphTable.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrGlyphTable$(OBJEXT)" $? + +"$(INTDIR)\GrGlyphTable_dll$(OBJEXT)" : "src/segment/GrGlyphTable.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\GrGlyphTable_dll$(OBJEXT)" $? + +!ENDIF + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\GrPass$(OBJEXT)" "$(INTDIR)\GrPass$(SBREXT)" : "src/segment/GrPass.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrPass$(OBJEXT)" $? + +"$(INTDIR)\GrPass_dll$(OBJEXT)" "$(INTDIR)\GrPass_dll$(SBREXT)" : "src/segment/GrPass.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\GrPass_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\GrPass$(OBJEXT)" : "src/segment/GrPass.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrPass$(OBJEXT)" $? + +"$(INTDIR)\GrPass_dll$(OBJEXT)" : "src/segment/GrPass.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\GrPass_dll$(OBJEXT)" $? + +!ENDIF + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\GrPassActionCode$(OBJEXT)" "$(INTDIR)\GrPassActionCode$(SBREXT)" : "src/segment/GrPassActionCode.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrPassActionCode$(OBJEXT)" $? + +"$(INTDIR)\GrPassActionCode_dll$(OBJEXT)" "$(INTDIR)\GrPassActionCode_dll$(SBREXT)" : "src/segment/GrPassActionCode.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\GrPassActionCode_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\GrPassActionCode$(OBJEXT)" : "src/segment/GrPassActionCode.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrPassActionCode$(OBJEXT)" $? + +"$(INTDIR)\GrPassActionCode_dll$(OBJEXT)" : "src/segment/GrPassActionCode.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\GrPassActionCode_dll$(OBJEXT)" $? + +!ENDIF + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\GrSlotState$(OBJEXT)" "$(INTDIR)\GrSlotState$(SBREXT)" : "src/segment/GrSlotState.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrSlotState$(OBJEXT)" $? + +"$(INTDIR)\GrSlotState_dll$(OBJEXT)" "$(INTDIR)\GrSlotState_dll$(SBREXT)" : "src/segment/GrSlotState.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\GrSlotState_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\GrSlotState$(OBJEXT)" : "src/segment/GrSlotState.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrSlotState$(OBJEXT)" $? + +"$(INTDIR)\GrSlotState_dll$(OBJEXT)" : "src/segment/GrSlotState.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\GrSlotState_dll$(OBJEXT)" $? + +!ENDIF + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\GrSlotStream$(OBJEXT)" "$(INTDIR)\GrSlotStream$(SBREXT)" : "src/segment/GrSlotStream.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrSlotStream$(OBJEXT)" $? + +"$(INTDIR)\GrSlotStream_dll$(OBJEXT)" "$(INTDIR)\GrSlotStream_dll$(SBREXT)" : "src/segment/GrSlotStream.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\GrSlotStream_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\GrSlotStream$(OBJEXT)" : "src/segment/GrSlotStream.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrSlotStream$(OBJEXT)" $? + +"$(INTDIR)\GrSlotStream_dll$(OBJEXT)" : "src/segment/GrSlotStream.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\GrSlotStream_dll$(OBJEXT)" $? + +!ENDIF + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\GrTableManager$(OBJEXT)" "$(INTDIR)\GrTableManager$(SBREXT)" : "src/segment/GrTableManager.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrTableManager$(OBJEXT)" $? + +"$(INTDIR)\GrTableManager_dll$(OBJEXT)" "$(INTDIR)\GrTableManager_dll$(SBREXT)" : "src/segment/GrTableManager.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\GrTableManager_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\GrTableManager$(OBJEXT)" : "src/segment/GrTableManager.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrTableManager$(OBJEXT)" $? + +"$(INTDIR)\GrTableManager_dll$(OBJEXT)" : "src/segment/GrTableManager.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\GrTableManager_dll$(OBJEXT)" $? + +!ENDIF + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\MemoryUsage$(OBJEXT)" "$(INTDIR)\MemoryUsage$(SBREXT)" : "src/segment/MemoryUsage.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\MemoryUsage$(OBJEXT)" $? + +"$(INTDIR)\MemoryUsage_dll$(OBJEXT)" "$(INTDIR)\MemoryUsage_dll$(SBREXT)" : "src/segment/MemoryUsage.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\MemoryUsage_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\MemoryUsage$(OBJEXT)" : "src/segment/MemoryUsage.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\MemoryUsage$(OBJEXT)" $? + +"$(INTDIR)\MemoryUsage_dll$(OBJEXT)" : "src/segment/MemoryUsage.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\MemoryUsage_dll$(OBJEXT)" $? + +!ENDIF + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\Segment$(OBJEXT)" "$(INTDIR)\Segment$(SBREXT)" : "src/segment/Segment.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\Segment$(OBJEXT)" $? + +"$(INTDIR)\Segment_dll$(OBJEXT)" "$(INTDIR)\Segment_dll$(SBREXT)" : "src/segment/Segment.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\Segment_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\Segment$(OBJEXT)" : "src/segment/Segment.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\Segment$(OBJEXT)" $? + +"$(INTDIR)\Segment_dll$(OBJEXT)" : "src/segment/Segment.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\Segment_dll$(OBJEXT)" $? + +!ENDIF + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\SegmentAux$(OBJEXT)" "$(INTDIR)\SegmentAux$(SBREXT)" : "src/segment/SegmentAux.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\SegmentAux$(OBJEXT)" $? + +"$(INTDIR)\SegmentAux_dll$(OBJEXT)" "$(INTDIR)\SegmentAux_dll$(SBREXT)" : "src/segment/SegmentAux.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\SegmentAux_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\SegmentAux$(OBJEXT)" : "src/segment/SegmentAux.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\SegmentAux$(OBJEXT)" $? + +"$(INTDIR)\SegmentAux_dll$(OBJEXT)" : "src/segment/SegmentAux.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\SegmentAux_dll$(OBJEXT)" $? + +!ENDIF + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\TestFSM$(OBJEXT)" "$(INTDIR)\TestFSM$(SBREXT)" : "src/segment/TestFSM.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\TestFSM$(OBJEXT)" $? + +"$(INTDIR)\TestFSM_dll$(OBJEXT)" "$(INTDIR)\TestFSM_dll$(SBREXT)" : "src/segment/TestFSM.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\TestFSM_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\TestFSM$(OBJEXT)" : "src/segment/TestFSM.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\TestFSM$(OBJEXT)" $? + +"$(INTDIR)\TestFSM_dll$(OBJEXT)" : "src/segment/TestFSM.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\TestFSM_dll$(OBJEXT)" $? + +!ENDIF + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\TestPasses$(OBJEXT)" "$(INTDIR)\TestPasses$(SBREXT)" : "src/segment/TestPasses.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\TestPasses$(OBJEXT)" $? + +"$(INTDIR)\TestPasses_dll$(OBJEXT)" "$(INTDIR)\TestPasses_dll$(SBREXT)" : "src/segment/TestPasses.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\TestPasses_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\TestPasses$(OBJEXT)" : "src/segment/TestPasses.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\TestPasses$(OBJEXT)" $? + +"$(INTDIR)\TestPasses_dll$(OBJEXT)" : "src/segment/TestPasses.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\TestPasses_dll$(OBJEXT)" $? + +!ENDIF + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\TransductionLog$(OBJEXT)" "$(INTDIR)\TransductionLog$(SBREXT)" : "src/segment/TransductionLog.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\TransductionLog$(OBJEXT)" $? + +"$(INTDIR)\TransductionLog_dll$(OBJEXT)" "$(INTDIR)\TransductionLog_dll$(SBREXT)" : "src/segment/TransductionLog.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\TransductionLog_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\TransductionLog$(OBJEXT)" : "src/segment/TransductionLog.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\TransductionLog$(OBJEXT)" $? + +"$(INTDIR)\TransductionLog_dll$(OBJEXT)" : "src/segment/TransductionLog.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\TransductionLog_dll$(OBJEXT)" $? + +!ENDIF + +#!IF "$(CFG)" == "DEBUG" +#"$(INTDIR)\XmlTransductionLog$(OBJEXT)" "$(INTDIR)\XmlTransductionLog$(SBREXT)" : "src/segment/XmlTransductionLog.cpp" +# @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\XmlTransductionLog$(OBJEXT)" $? +# +#"$(INTDIR)\XmlTransductionLog_dll$(OBJEXT)" "$(INTDIR)\XmlTransductionLog_dll$(SBREXT)" : "src/segment/XmlTransductionLog.cpp" +# @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\XmlTransductionLog_dll$(OBJEXT)" $? +# +#!ELSE +#"$(INTDIR)\XmlTransductionLog$(OBJEXT)" : "src/segment/XmlTransductionLog.cpp" +# @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\XmlTransductionLog$(OBJEXT)" $? +# +#"$(INTDIR)\XmlTransductionLog_dll$(OBJEXT)" : "src/segment/XmlTransductionLog.cpp" +# @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\XmlTransductionLog_dll$(OBJEXT)" $? +# +#!ENDIF + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\Platform$(OBJEXT)" "$(INTDIR)\Platform$(SBREXT)" : "src/segment/Platform.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\Platform$(OBJEXT)" $? + +"$(INTDIR)\Platform_dll$(OBJEXT)" "$(INTDIR)\Platform_dll$(SBREXT)" : "src/segment/Platform.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\Platform_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\Platform$(OBJEXT)" : "src/segment/Platform.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\Platform$(OBJEXT)" $? + +"$(INTDIR)\Platform_dll$(OBJEXT)" : "src/segment/Platform.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\Platform_dll$(OBJEXT)" $? + +!ENDIF + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\SegmentPainter$(OBJEXT)" "$(INTDIR)\SegmentPainter$(SBREXT)" : "src/painter/SegmentPainter.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\SegmentPainter$(OBJEXT)" $? + +"$(INTDIR)\SegmentPainter_dll$(OBJEXT)" "$(INTDIR)\SegmentPainter_dll$(SBREXT)" : "src/painter/SegmentPainter.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\SegmentPainter_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\SegmentPainter$(OBJEXT)" : "src/painter/SegmentPainter.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\SegmentPainter$(OBJEXT)" $? + +"$(INTDIR)\SegmentPainter_dll$(OBJEXT)" : "src/painter/SegmentPainter.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\SegmentPainter_dll$(OBJEXT)" $? + +!ENDIF + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\WinSegmentPainter$(OBJEXT)" "$(INTDIR)\WinSegmentPainter$(SBREXT)" : "..\wrappers\win32\WinSegmentPainter.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\WinSegmentPainter$(OBJEXT)" $? + +"$(INTDIR)\WinSegmentPainter_dll$(OBJEXT)" "$(INTDIR)\WinSegmentPainter_dll$(SBREXT)" : "..\wrappers\win32\WinSegmentPainter.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\WinSegmentPainter_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\WinSegmentPainter$(OBJEXT)" : "..\wrappers\win32\WinSegmentPainter.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\WinSegmentPainter$(OBJEXT)" $? + +"$(INTDIR)\WinSegmentPainter_dll$(OBJEXT)" : "..\wrappers\win32\WinSegmentPainter.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\WinSegmentPainter_dll$(OBJEXT)" $? + +!ENDIF + + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\WinFont$(OBJEXT)" "$(INTDIR)\WinFont$(SBREXT)" : "../wrappers/win32/WinFont.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\WinFont$(OBJEXT)" $? + +"$(INTDIR)\WinFont_dll$(OBJEXT)" "$(INTDIR)\WinFont_dll$(SBREXT)" : "../wrappers/win32/WinFont.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\WinFont_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\WinFont$(OBJEXT)" : "../wrappers/win32/WinFont.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\WinFont$(OBJEXT)" $? + +"$(INTDIR)\WinFont_dll$(OBJEXT)" : "../wrappers/win32/WinFont.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\WinFont_dll$(OBJEXT)" $? + +!ENDIF + + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\FileFont$(OBJEXT)" "$(INTDIR)\FileFont$(SBREXT)" : "src/font/FileFont.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\FileFont$(OBJEXT)" $? + +"$(INTDIR)\FileFont_dll$(OBJEXT)" "$(INTDIR)\FileFont_dll$(SBREXT)" : "src/font/FileFont.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\FileFont_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\FileFont$(OBJEXT)" : "src/font/FileFont.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\FileFont$(OBJEXT)" $? + +"$(INTDIR)\FileFont_dll$(OBJEXT)" : "src/font/FileFont.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\FileFont_dll$(OBJEXT)" $? + +!ENDIF + + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\..\wrappers\win32\win32_dll$(OBJEXT)" "$(INTDIR)\win32_dll$(SBREXT)" : "..\wrappers\win32\win32_dll.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\win32_dll$(OBJEXT)" $? + +"$(INTDIR)\win32_dll_dll$(OBJEXT)" "$(INTDIR)\win32_dll_dll$(SBREXT)" : "..\wrappers\win32\win32_dll.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\win32_dll_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\win32_dll$(OBJEXT)" : "..\wrappers\win32\win32_dll.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\win32_dll$(OBJEXT)" $? + +"$(INTDIR)\win32_dll_dll$(OBJEXT)" : "..\wrappers\win32\win32_dll.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\win32_dll_dll$(OBJEXT)" $? + +!ENDIF + +bsc : "$(OUTDIR)/$(TARGET).bsc" + +"$(OUTDIR)/$(TARGET).bsc" : "$(OUTDIR)" $(BSC32_SBRS) + $(BSC32) @<< + $(BSC32_FLAGS) $(BSC32_SBRS) +<< + +dll : $(OUTDIR)/$(TARGET).dll + +"$(OUTDIR)/$(TARGET).dll" : "$(OUTDIR)" $(DEF_FILE) lib_dll $(DLL_LINK_OBJS) + $(LINK) $(LINK_FLAGS) $(LINK_DEBUG) $(OUTDIR)/$(TARGET)_dll.lib $(DLL_LINK_OBJS) + diff --git a/Build/source/libs/graphite/engine-2.4/makefile.vc8 b/Build/source/libs/graphite/engine-2.4/makefile.vc8 new file mode 100644 index 00000000000..b9fcebf2eab --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/makefile.vc8 @@ -0,0 +1,814 @@ + +TARGET=graphite + +CPP=cl.exe +CPPFLAGS=/Zc:wchar_t- /nologo /W4 /GR /EHsc /I "./src/font" /I "./src/painter" /I "./src/segment" /I "./src/textsource" /I "./src/generic" /I "./include/graphite" /I "../wrappers/win32" /D "GR_NAMESPACE" /D "WIN32" /D "_WINDOWS" /D "_UNICODE" /D "UNICODE" /D "TRACING" /D_SCL_SECURE_NO_WARNINGS /D_CRT_SECURE_NO_WARNINGS /Fp"$(INTDIR)\graphite.pch" /Fd"$(INTDIR)\\" /FD /c +# /Wp62 + +LINK=link.exe +LINK_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /dll /pdb:"$(OUTDIR)\\graphite.pdb" /machine:I386 /out:"$(OUTDIR)\\$(TARGET).dll" /implib:"$(OUTDIR)\\$(TARGET).lib" + +BSC32=bscmake.exe +BSC32_FLAGS=/nologo /o"$(OUTDIR)\\$(TARGET).bsc" + +AR=lib +AR_FLAGS=/OUT:$@ + +!IF "$(MLIB)" == "MD" +MLIB=MD +!ELSE +MLIB=MT +!ENDIF + +OBJEXT = .obj +SBREXT = .sbr + +!IF "$(CFG)" == "DEBUG" +CPP_DEBUG=/D "DEBUG" /Gm /GR /ZI /Od /RTC1 /FR"$(INTDIR)\\" /$(MLIB)d +# CPP_DEBUG=/D "DEBUG" /Gm /GR /ZI /Od /RTC1 /FR"$(INTDIR)\\" /MDd + +OUTDIR=.\debug_vc8 +INTDIR=.\debug_temp +LINK_DEBUG= MSVCRTD.lib /debug /incremental:yes #/pdbtype:sept + +all : lib lib_dll bsc + +!ELSE +CPP_DEBUG=/D "NDEBUG" /O2 /$(MLIB) +# CPP_DEBUG=/D "NDEBUG" /O2 /MD +OUTDIR=.\release_vc8 +INTDIR=.\release_temp +LINK_DEBUG= MSVCRT.lib /incremental:no /NODEFAULTLIB:libc + +all : lib lib_dll + +!ENDIF + +!IF "$(TRACING)" == "1" +CPP_DEBUG=/D "TRACING" $(CPP_DEBUG) +!ENDIF + +!IF "$(OS)" == "Windows_NT" +NULL= +!ELSE +NULL=nul +!ENDIF + +clean : + @- rd /s/q .\release_temp + @- rd /s/q .\debug_temp + +realclean : clean + @- rd /s/q .\release_vc8 + @- rd /s/q .\debug_vc8 + +LINK_OBJS=\ +# "$(INTDIR)\BinTree_i$(OBJEXT)"\ +# "$(INTDIR)\HashMap_i$(OBJEXT)"\ + "$(INTDIR)\Debug$(OBJEXT)"\ + "$(INTDIR)\Util$(OBJEXT)"\ + "$(INTDIR)\Font$(OBJEXT)"\ + "$(INTDIR)\FileFont$(OBJEXT)"\ + "$(INTDIR)\FontCache$(OBJEXT)"\ + "$(INTDIR)\FontFace$(OBJEXT)"\ + "$(INTDIR)\FileInput$(OBJEXT)"\ + "$(INTDIR)\GrCharStream$(OBJEXT)"\ + "$(INTDIR)\GrClassTable$(OBJEXT)"\ + "$(INTDIR)\GrEngine$(OBJEXT)"\ + "$(INTDIR)\GrFeature$(OBJEXT)"\ + "$(INTDIR)\GrFSM$(OBJEXT)"\ + "$(INTDIR)\GrGlyphTable$(OBJEXT)"\ + "$(INTDIR)\GrPass$(OBJEXT)"\ + "$(INTDIR)\GrPassActionCode$(OBJEXT)"\ + "$(INTDIR)\GrSlotState$(OBJEXT)"\ + "$(INTDIR)\GrSlotStream$(OBJEXT)"\ + "$(INTDIR)\GrTableManager$(OBJEXT)"\ + "$(INTDIR)\MemoryUsage$(OBJEXT)"\ + "$(INTDIR)\Segment$(OBJEXT)"\ + "$(INTDIR)\SegmentAux$(OBJEXT)"\ + "$(INTDIR)\SegmentPainter$(OBJEXT)"\ +# "$(INTDIR)\TestFSM$(OBJEXT)"\ +# "$(INTDIR)\TestPasses$(OBJEXT)"\ + "$(INTDIR)\TransductionLog$(OBJEXT)"\ +### "$(INTDIR)\XmlTransductionLog$(OBJEXT)"\ + "$(INTDIR)\Platform$(OBJEXT)"\ + "$(INTDIR)\TtfUtil$(OBJEXT)"\ + "$(INTDIR)\WinFont$(OBJEXT)"\ + "$(INTDIR)\WinSegmentPainter$(OBJEXT)" + +LINK_DLL_OBJS=\ +# "$(INTDIR)\BinTree_i_dll$(OBJEXT)"\ +# "$(INTDIR)\HashMap_i_dll$(OBJEXT)"\ + "$(INTDIR)\Debug_dll$(OBJEXT)"\ + "$(INTDIR)\Util_dll$(OBJEXT)"\ + "$(INTDIR)\Font_dll$(OBJEXT)"\ + "$(INTDIR)\WinFont_dll$(OBJEXT)"\ + "$(INTDIR)\FileFont_dll$(OBJEXT)"\ + "$(INTDIR)\FontCache_dll$(OBJEXT)"\ + "$(INTDIR)\FontFace_dll$(OBJEXT)"\ + "$(INTDIR)\FileInput_dll$(OBJEXT)"\ + "$(INTDIR)\GrCharStream_dll$(OBJEXT)"\ + "$(INTDIR)\GrClassTable_dll$(OBJEXT)"\ + "$(INTDIR)\GrEngine_dll$(OBJEXT)"\ + "$(INTDIR)\GrFeature_dll$(OBJEXT)"\ + "$(INTDIR)\GrFSM_dll$(OBJEXT)"\ + "$(INTDIR)\GrGlyphTable_dll$(OBJEXT)"\ + "$(INTDIR)\GrPass_dll$(OBJEXT)"\ + "$(INTDIR)\GrPassActionCode_dll$(OBJEXT)"\ + "$(INTDIR)\GrSlotState_dll$(OBJEXT)"\ + "$(INTDIR)\GrSlotStream_dll$(OBJEXT)"\ + "$(INTDIR)\GrTableManager_dll$(OBJEXT)"\ + "$(INTDIR)\MemoryUsage_dll$(OBJEXT)"\ + "$(INTDIR)\Segment_dll$(OBJEXT)"\ + "$(INTDIR)\SegmentAux_dll$(OBJEXT)"\ + "$(INTDIR)\SegmentPainter_dll$(OBJEXT)"\ +# "$(INTDIR)\TestFSM_dll$(OBJEXT)"\ +# "$(INTDIR)\TestPasses_dll$(OBJEXT)"\ + "$(INTDIR)\TransductionLog_dll$(OBJEXT)"\ +### "$(INTDIR)\XmlTransductionLog_dll$(OBJEXT)"\ + "$(INTDIR)\WinSegmentPainter_dll$(OBJEXT)"\ + "$(INTDIR)\Platform_dll$(OBJEXT)"\ + "$(INTDIR)\TtfUtil_dll$(OBJEXT)" + +DLL_LINK_OBJS=\ + "$(INTDIR)\win32_dll_dll$(OBJEXT)" + +BSC32_SBRS=\ +# "$(INTDIR)\BinTree_i$(SBREXT)"\ +# "$(INTDIR)\HashMap_i$(SBREXT)"\ + "$(INTDIR)\Debug$(SBREXT)"\ + "$(INTDIR)\Util$(SBREXT)"\ + "$(INTDIR)\Font$(SBREXT)"\ + "$(INTDIR)\WinFont$(SBREXT)"\ + "$(INTDIR)\FileFont$(SBREXT)"\ + "$(INTDIR)\FontCache$(SBREXT)"\ + "$(INTDIR)\FontFace$(SBREXT)"\ + "$(INTDIR)\FileInput$(SBREXT)"\ + "$(INTDIR)\GrCharStream$(SBREXT)"\ + "$(INTDIR)\GrClassTable$(SBREXT)"\ + "$(INTDIR)\GrEngine$(SBREXT)"\ + "$(INTDIR)\GrFeature$(SBREXT)"\ + "$(INTDIR)\GrFSM$(SBREXT)"\ + "$(INTDIR)\GrGlyphTable$(SBREXT)"\ + "$(INTDIR)\GrPass$(SBREXT)"\ + "$(INTDIR)\GrPassActionCode$(SBREXT)"\ + "$(INTDIR)\GrSlotState$(SBREXT)"\ + "$(INTDIR)\GrSlotStream$(SBREXT)"\ + "$(INTDIR)\GrTableManager$(SBREXT)"\ + "$(INTDIR)\MemoryUsage$(SBREXT)"\ + "$(INTDIR)\Segment$(SBREXT)"\ + "$(INTDIR)\SegmentAux$(SBREXT)"\ + "$(INTDIR)\SegmentPainter$(SBREXT)"\ +# "$(INTDIR)\TestFSM$(SBREXT)"\ +# "$(INTDIR)\TestPasses$(SBREXT)"\ + "$(INTDIR)\TransductionLog$(SBREXT)"\ +### "$(INTDIR)\XmlTransductionLog$(SBREXT)"\ + "$(INTDIR)\WinSegmentPainter$(SBREXT)"\ + "$(INTDIR)\Platform$(SBREXT)"\ + "$(INTDIR)\TtfUtil$(SBREXT)"\ + "$(INTDIR)\win32_dll$(SBREXT)" + +$(OUTDIR) : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +$(INTDIR) : + if not exist "$(INTDIR)/$(NULL)" mkdir "$(INTDIR)" + +lib : "$(OUTDIR)/$(TARGET).lib" + +lib_dll : "$(OUTDIR)/$(TARGET)_dll.lib" + +"$(OUTDIR)/$(TARGET).lib" : "$(OUTDIR)" "$(INTDIR)" $(LINK_OBJS) + $(AR) @<< + $(AR_FLAGS) $(LINK_OBJS) +<< + +"$(OUTDIR)/$(TARGET)_dll.lib" : "$(OUTDIR)" "$(INTDIR)" $(LINK_DLL_OBJS) + $(AR) @<< + $(AR_FLAGS) $(LINK_DLL_OBJS) +<< + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\BinTree_i$(OBJEXT)" "$(INTDIR)\BinTree_i$(SBREXT)" : "src/generic/BinTree_i.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\BinTree_i$(OBJEXT)" $? + +"$(INTDIR)\BinTree_i_dll$(OBJEXT)" "$(INTDIR)\BinTree_i_dll$(SBREXT)" : "src/generic/BinTree_i.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\BinTree_i_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\BinTree_i$(OBJEXT)" : "src/generic/BinTree_i.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\BinTree_i$(OBJEXT)" $? + +"$(INTDIR)\BinTree_i_dll$(OBJEXT)" : "src/generic/BinTree_i.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /D "_DLL" /Fo"$(INTDIR)\BinTree_i_dll$(OBJEXT)" $? + +!ENDIF + + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\Debug$(OBJEXT)" "$(INTDIR)\Debug$(SBREXT)" : "src/generic/Debug.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\Debug$(OBJEXT)" $? + +"$(INTDIR)\Debug_dll$(OBJEXT)" "$(INTDIR)\Debug_dll$(SBREXT)" : "src/generic/Debug.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\Debug_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\Debug$(OBJEXT)" : "src/generic/Debug.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\Debug$(OBJEXT)" $? + +"$(INTDIR)\Debug_dll$(OBJEXT)" : "src/generic/Debug.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\Debug_dll$(OBJEXT)" $? + +!ENDIF + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\HashMap$(OBJEXT)" "$(INTDIR)\HashMap$(SBREXT)" : "src/generic/HashMap.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\HashMap$(OBJEXT)" $? + +"$(INTDIR)\HashMap_dll$(OBJEXT)" "$(INTDIR)\HashMap_dll$(SBREXT)" : "src/generic/HashMap.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\HashMap_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\HashMap$(OBJEXT)" : "src/generic/HashMap.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\HashMap$(OBJEXT)" $? + +"$(INTDIR)\HashMap_dll$(OBJEXT)" : "src/generic/HashMap.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\HashMap_dll$(OBJEXT)" $? + +!ENDIF + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\HashMap_i$(OBJEXT)" "$(INTDIR)\HashMap_i$(SBREXT)" : "src/generic/HashMap_i.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\HashMap_i$(OBJEXT)" $? + +"$(INTDIR)\HashMap_i_dll$(OBJEXT)" "$(INTDIR)\HashMap_i_dll$(SBREXT)" : "src/generic/HashMap_i.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\HashMap_i_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\HashMap_i$(OBJEXT)" : "src/generic/HashMap_i.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\HashMap_i$(OBJEXT)" $? + +"$(INTDIR)\HashMap_i_dll$(OBJEXT)" : "src/generic/HashMap_i.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\HashMap_i_dll$(OBJEXT)" $? + +!ENDIF + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\Set_i$(OBJEXT)" "$(INTDIR)\Set_i$(SBREXT)" : "src/generic/Set_i.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\Set_i$(OBJEXT)" $? + +"$(INTDIR)\Set_i_dll$(OBJEXT)" "$(INTDIR)\Set_i_dll$(SBREXT)" : "src/generic/Set_i.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\Set_i_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\Set_i$(OBJEXT)" : "src/generic/Set_i.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\Set_i$(OBJEXT)" $? + +"$(INTDIR)\Set_i_dll$(OBJEXT)" : "src/generic/Set_i.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\Set_i_dll$(OBJEXT)" $? + +!ENDIF + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\Util$(OBJEXT)" "$(INTDIR)\Util$(SBREXT)" : "src/generic/Util.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\Util$(OBJEXT)" $? + +"$(INTDIR)\Util_dll$(OBJEXT)" "$(INTDIR)\Util_dll$(SBREXT)" : "src/generic/Util.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\Util_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\Util$(OBJEXT)" : "src/generic/Util.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\Util$(OBJEXT)" $? + +"$(INTDIR)\Util_dll$(OBJEXT)" : "src/generic/Util.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\Util_dll$(OBJEXT)" $? + +!ENDIF + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\UtilString$(OBJEXT)" "$(INTDIR)\UtilString$(SBREXT)" : "src/generic/UtilString.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\UtilString$(OBJEXT)" $? + +"$(INTDIR)\UtilString_dll$(OBJEXT)" "$(INTDIR)\UtilString_dll$(SBREXT)" : "src/generic/UtilString.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\UtilString_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\UtilString$(OBJEXT)" : "src/generic/UtilString.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\UtilString$(OBJEXT)" $? + +"$(INTDIR)\UtilString_dll$(OBJEXT)" : "src/generic/UtilString.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\UtilString_dll$(OBJEXT)" $? + +!ENDIF + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\Vector_i$(OBJEXT)" "$(INTDIR)\Vector_i$(SBREXT)" : "src/generic/Vector_i.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\Vector_i$(OBJEXT)" $? + +"$(INTDIR)\Vector_i_dll$(OBJEXT)" "$(INTDIR)\Vector_i_dll$(SBREXT)" : "src/generic/Vector_i.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\Vector_i_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\Vector_i$(OBJEXT)" : "src/generic/Vector_i.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\Vector_i$(OBJEXT)" $? + +"$(INTDIR)\Vector_i_dll$(OBJEXT)" : "src/generic/Vector_i.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\Vector_i_dll$(OBJEXT)" $? + +!ENDIF + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\Font$(OBJEXT)" "$(INTDIR)\Font$(SBREXT)" : "src/font/Font.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\Font$(OBJEXT)" $? + +"$(INTDIR)\Font_dll$(OBJEXT)" "$(INTDIR)\Font_dll$(SBREXT)" : "src/font/Font.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\Font_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\Font$(OBJEXT)" : "src/font/Font.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\Font$(OBJEXT)" $? + +"$(INTDIR)\Font_dll$(OBJEXT)" : "src/font/Font.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\Font_dll$(OBJEXT)" $? + +!ENDIF + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\GrUtil$(OBJEXT)" "$(INTDIR)\GrUtil$(SBREXT)" : "src/font/GrUtil.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrUtil$(OBJEXT)" $? + +"$(INTDIR)\GrUtil_dll$(OBJEXT)" "$(INTDIR)\GrUtil_dll$(SBREXT)" : "src/font/GrUtil.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\GrUtil_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\GrUtil$(OBJEXT)" : "src/font/GrUtil.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrUtil$(OBJEXT)" $? + +"$(INTDIR)\GrUtil_dll$(OBJEXT)" : "src/font/GrUtil.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\GrUtil_dll$(OBJEXT)" $? + +!ENDIF + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\TtfUtil$(OBJEXT)" "$(INTDIR)\TtfUtil$(SBREXT)" : "src/font/TtfUtil.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\TtfUtil$(OBJEXT)" $? + +"$(INTDIR)\TtfUtil_dll$(OBJEXT)" "$(INTDIR)\TtfUtil_dll$(SBREXT)" : "src/font/TtfUtil.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\TtfUtil_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\TtfUtil$(OBJEXT)" : "src/font/TtfUtil.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\TtfUtil$(OBJEXT)" $? + +"$(INTDIR)\TtfUtil_dll$(OBJEXT)" : "src/font/TtfUtil.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\TtfUtil_dll$(OBJEXT)" $? + +!ENDIF + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\FontCache$(OBJEXT)" "$(INTDIR)\FontCache$(SBREXT)" : "src/segment/FontCache.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\FontCache$(OBJEXT)" $? + +"$(INTDIR)\FontCache_dll$(OBJEXT)" "$(INTDIR)\FontCache_dll$(SBREXT)" : "src/segment/FontCache.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\FontCache_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\FontCache$(OBJEXT)" : "src/segment/FontCache.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\FontCache$(OBJEXT)" $? + +"$(INTDIR)\FontCache_dll$(OBJEXT)" : "src/segment/FontCache.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\FontCache_dll$(OBJEXT)" $? + +!ENDIF + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\FontFace$(OBJEXT)" "$(INTDIR)\FontFace$(SBREXT)" : "src/segment/FontFace.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\FontFace$(OBJEXT)" $? + +"$(INTDIR)\FontFace_dll$(OBJEXT)" "$(INTDIR)\FontFace_dll$(SBREXT)" : "src/segment/FontFace.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\FontFace_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\FontFace$(OBJEXT)" : "src/segment/FontFace.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\FontFace$(OBJEXT)" $? + +"$(INTDIR)\FontFace_dll$(OBJEXT)" : "src/segment/FontFace.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\FontFace_dll$(OBJEXT)" $? + +!ENDIF + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\FileInput$(OBJEXT)" "$(INTDIR)\FileInput$(SBREXT)" : "src/segment/FileInput.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\FileInput$(OBJEXT)" $? + +"$(INTDIR)\FileInput_dll$(OBJEXT)" "$(INTDIR)\FileInput_dll$(SBREXT)" : "src/segment/FileInput.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\FileInput_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\FileInput$(OBJEXT)" : "src/segment/FileInput.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\FileInput$(OBJEXT)" $? + +"$(INTDIR)\FileInput_dll$(OBJEXT)" : "src/segment/FileInput.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\FileInput_dll$(OBJEXT)" $? + +!ENDIF + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\GrCharStream$(OBJEXT)" "$(INTDIR)\GrCharStream$(SBREXT)" : "src/segment/GrCharStream.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrCharStream$(OBJEXT)" $? + +"$(INTDIR)\GrCharStream_dll$(OBJEXT)" "$(INTDIR)\GrCharStream_dll$(SBREXT)" : "src/segment/GrCharStream.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\GrCharStream_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\GrCharStream$(OBJEXT)" : "src/segment/GrCharStream.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrCharStream$(OBJEXT)" $? + +"$(INTDIR)\GrCharStream_dll$(OBJEXT)" : "src/segment/GrCharStream.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\GrCharStream_dll$(OBJEXT)" $? + +!ENDIF + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\GrClassTable$(OBJEXT)" "$(INTDIR)\GrClassTable$(SBREXT)" : "src/segment/GrClassTable.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrClassTable$(OBJEXT)" $? + +"$(INTDIR)\GrClassTable_dll$(OBJEXT)" "$(INTDIR)\GrClassTable_dll$(SBREXT)" : "src/segment/GrClassTable.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\GrClassTable_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\GrClassTable$(OBJEXT)" : "src/segment/GrClassTable.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrClassTable$(OBJEXT)" $? + +"$(INTDIR)\GrClassTable_dll$(OBJEXT)" : "src/segment/GrClassTable.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\GrClassTable_dll$(OBJEXT)" $? + +!ENDIF + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\GrEngine$(OBJEXT)" "$(INTDIR)\GrEngine$(SBREXT)" : "src/segment/GrEngine.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrEngine$(OBJEXT)" $? + +"$(INTDIR)\GrEngine_dll$(OBJEXT)" "$(INTDIR)\GrEngine_dll$(SBREXT)" : "src/segment/GrEngine.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\GrEngine_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\GrEngine$(OBJEXT)" : "src/segment/GrEngine.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrEngine$(OBJEXT)" $? + +"$(INTDIR)\GrEngine_dll$(OBJEXT)" : "src/segment/GrEngine.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\GrEngine_dll$(OBJEXT)" $? + +!ENDIF + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\GrFeature$(OBJEXT)" "$(INTDIR)\GrFeature$(SBREXT)" : "src/segment/GrFeature.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrFeature$(OBJEXT)" $? + +"$(INTDIR)\GrFeature_dll$(OBJEXT)" "$(INTDIR)\GrFeature_dll$(SBREXT)" : "src/segment/GrFeature.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\GrFeature_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\GrFeature$(OBJEXT)" : "src/segment/GrFeature.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrFeature$(OBJEXT)" $? + +"$(INTDIR)\GrFeature_dll$(OBJEXT)" : "src/segment/GrFeature.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\GrFeature_dll$(OBJEXT)" $? + +!ENDIF + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\GrFSM$(OBJEXT)" "$(INTDIR)\GrFSM$(SBREXT)" : "src/segment/GrFSM.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrFSM$(OBJEXT)" $? + +"$(INTDIR)\GrFSM_dll$(OBJEXT)" "$(INTDIR)\GrFSM_dll$(SBREXT)" : "src/segment/GrFSM.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\GrFSM_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\GrFSM$(OBJEXT)" : "src/segment/GrFSM.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrFSM$(OBJEXT)" $? + +"$(INTDIR)\GrFSM_dll$(OBJEXT)" : "src/segment/GrFSM.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\GrFSM_dll$(OBJEXT)" $? + +!ENDIF + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\GrGlyphTable$(OBJEXT)" "$(INTDIR)\GrGlyphTable$(SBREXT)" : "src/segment/GrGlyphTable.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrGlyphTable$(OBJEXT)" $? + +"$(INTDIR)\GrGlyphTable_dll$(OBJEXT)" "$(INTDIR)\GrGlyphTable_dll$(SBREXT)" : "src/segment/GrGlyphTable.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\GrGlyphTable_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\GrGlyphTable$(OBJEXT)" : "src/segment/GrGlyphTable.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrGlyphTable$(OBJEXT)" $? + +"$(INTDIR)\GrGlyphTable_dll$(OBJEXT)" : "src/segment/GrGlyphTable.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\GrGlyphTable_dll$(OBJEXT)" $? + +!ENDIF + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\GrPass$(OBJEXT)" "$(INTDIR)\GrPass$(SBREXT)" : "src/segment/GrPass.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrPass$(OBJEXT)" $? + +"$(INTDIR)\GrPass_dll$(OBJEXT)" "$(INTDIR)\GrPass_dll$(SBREXT)" : "src/segment/GrPass.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\GrPass_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\GrPass$(OBJEXT)" : "src/segment/GrPass.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrPass$(OBJEXT)" $? + +"$(INTDIR)\GrPass_dll$(OBJEXT)" : "src/segment/GrPass.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\GrPass_dll$(OBJEXT)" $? + +!ENDIF + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\GrPassActionCode$(OBJEXT)" "$(INTDIR)\GrPassActionCode$(SBREXT)" : "src/segment/GrPassActionCode.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrPassActionCode$(OBJEXT)" $? + +"$(INTDIR)\GrPassActionCode_dll$(OBJEXT)" "$(INTDIR)\GrPassActionCode_dll$(SBREXT)" : "src/segment/GrPassActionCode.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\GrPassActionCode_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\GrPassActionCode$(OBJEXT)" : "src/segment/GrPassActionCode.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrPassActionCode$(OBJEXT)" $? + +"$(INTDIR)\GrPassActionCode_dll$(OBJEXT)" : "src/segment/GrPassActionCode.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\GrPassActionCode_dll$(OBJEXT)" $? + +!ENDIF + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\GrSlotState$(OBJEXT)" "$(INTDIR)\GrSlotState$(SBREXT)" : "src/segment/GrSlotState.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrSlotState$(OBJEXT)" $? + +"$(INTDIR)\GrSlotState_dll$(OBJEXT)" "$(INTDIR)\GrSlotState_dll$(SBREXT)" : "src/segment/GrSlotState.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\GrSlotState_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\GrSlotState$(OBJEXT)" : "src/segment/GrSlotState.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrSlotState$(OBJEXT)" $? + +"$(INTDIR)\GrSlotState_dll$(OBJEXT)" : "src/segment/GrSlotState.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\GrSlotState_dll$(OBJEXT)" $? + +!ENDIF + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\GrSlotStream$(OBJEXT)" "$(INTDIR)\GrSlotStream$(SBREXT)" : "src/segment/GrSlotStream.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrSlotStream$(OBJEXT)" $? + +"$(INTDIR)\GrSlotStream_dll$(OBJEXT)" "$(INTDIR)\GrSlotStream_dll$(SBREXT)" : "src/segment/GrSlotStream.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\GrSlotStream_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\GrSlotStream$(OBJEXT)" : "src/segment/GrSlotStream.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrSlotStream$(OBJEXT)" $? + +"$(INTDIR)\GrSlotStream_dll$(OBJEXT)" : "src/segment/GrSlotStream.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\GrSlotStream_dll$(OBJEXT)" $? + +!ENDIF + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\GrTableManager$(OBJEXT)" "$(INTDIR)\GrTableManager$(SBREXT)" : "src/segment/GrTableManager.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrTableManager$(OBJEXT)" $? + +"$(INTDIR)\GrTableManager_dll$(OBJEXT)" "$(INTDIR)\GrTableManager_dll$(SBREXT)" : "src/segment/GrTableManager.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\GrTableManager_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\GrTableManager$(OBJEXT)" : "src/segment/GrTableManager.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrTableManager$(OBJEXT)" $? + +"$(INTDIR)\GrTableManager_dll$(OBJEXT)" : "src/segment/GrTableManager.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\GrTableManager_dll$(OBJEXT)" $? + +!ENDIF + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\MemoryUsage$(OBJEXT)" "$(INTDIR)\MemoryUsage$(SBREXT)" : "src/segment/MemoryUsage.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\MemoryUsage$(OBJEXT)" $? + +"$(INTDIR)\MemoryUsage_dll$(OBJEXT)" "$(INTDIR)\MemoryUsage_dll$(SBREXT)" : "src/segment/MemoryUsage.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\MemoryUsage_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\MemoryUsage$(OBJEXT)" : "src/segment/MemoryUsage.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\MemoryUsage$(OBJEXT)" $? + +"$(INTDIR)\MemoryUsage_dll$(OBJEXT)" : "src/segment/MemoryUsage.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\MemoryUsage_dll$(OBJEXT)" $? + +!ENDIF + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\Segment$(OBJEXT)" "$(INTDIR)\Segment$(SBREXT)" : "src/segment/Segment.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\Segment$(OBJEXT)" $? + +"$(INTDIR)\Segment_dll$(OBJEXT)" "$(INTDIR)\Segment_dll$(SBREXT)" : "src/segment/Segment.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\Segment_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\Segment$(OBJEXT)" : "src/segment/Segment.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\Segment$(OBJEXT)" $? + +"$(INTDIR)\Segment_dll$(OBJEXT)" : "src/segment/Segment.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\Segment_dll$(OBJEXT)" $? + +!ENDIF + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\SegmentAux$(OBJEXT)" "$(INTDIR)\SegmentAux$(SBREXT)" : "src/segment/SegmentAux.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\SegmentAux$(OBJEXT)" $? + +"$(INTDIR)\SegmentAux_dll$(OBJEXT)" "$(INTDIR)\SegmentAux_dll$(SBREXT)" : "src/segment/SegmentAux.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\SegmentAux_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\SegmentAux$(OBJEXT)" : "src/segment/SegmentAux.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\SegmentAux$(OBJEXT)" $? + +"$(INTDIR)\SegmentAux_dll$(OBJEXT)" : "src/segment/SegmentAux.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\SegmentAux_dll$(OBJEXT)" $? + +!ENDIF + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\TestFSM$(OBJEXT)" "$(INTDIR)\TestFSM$(SBREXT)" : "src/segment/TestFSM.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\TestFSM$(OBJEXT)" $? + +"$(INTDIR)\TestFSM_dll$(OBJEXT)" "$(INTDIR)\TestFSM_dll$(SBREXT)" : "src/segment/TestFSM.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\TestFSM_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\TestFSM$(OBJEXT)" : "src/segment/TestFSM.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\TestFSM$(OBJEXT)" $? + +"$(INTDIR)\TestFSM_dll$(OBJEXT)" : "src/segment/TestFSM.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\TestFSM_dll$(OBJEXT)" $? + +!ENDIF + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\TestPasses$(OBJEXT)" "$(INTDIR)\TestPasses$(SBREXT)" : "src/segment/TestPasses.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\TestPasses$(OBJEXT)" $? + +"$(INTDIR)\TestPasses_dll$(OBJEXT)" "$(INTDIR)\TestPasses_dll$(SBREXT)" : "src/segment/TestPasses.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\TestPasses_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\TestPasses$(OBJEXT)" : "src/segment/TestPasses.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\TestPasses$(OBJEXT)" $? + +"$(INTDIR)\TestPasses_dll$(OBJEXT)" : "src/segment/TestPasses.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\TestPasses_dll$(OBJEXT)" $? + +!ENDIF + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\TransductionLog$(OBJEXT)" "$(INTDIR)\TransductionLog$(SBREXT)" : "src/segment/TransductionLog.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\TransductionLog$(OBJEXT)" $? + +"$(INTDIR)\TransductionLog_dll$(OBJEXT)" "$(INTDIR)\TransductionLog_dll$(SBREXT)" : "src/segment/TransductionLog.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\TransductionLog_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\TransductionLog$(OBJEXT)" : "src/segment/TransductionLog.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\TransductionLog$(OBJEXT)" $? + +"$(INTDIR)\TransductionLog_dll$(OBJEXT)" : "src/segment/TransductionLog.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\TransductionLog_dll$(OBJEXT)" $? + +!ENDIF + +#!IF "$(CFG)" == "DEBUG" +#"$(INTDIR)\XmlTransductionLog$(OBJEXT)" "$(INTDIR)\XmlTransductionLog$(SBREXT)" : "src/segment/XmlTransductionLog.cpp" +# @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\XmlTransductionLog$(OBJEXT)" $? +# +#"$(INTDIR)\XmlTransductionLog_dll$(OBJEXT)" "$(INTDIR)\XmlTransductionLog_dll$(SBREXT)" : "src/segment/XmlTransductionLog.cpp" +# @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\XmlTransductionLog_dll$(OBJEXT)" $? +# +#!ELSE +#"$(INTDIR)\XmlTransductionLog$(OBJEXT)" : "src/segment/XmlTransductionLog.cpp" +# @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\XmlTransductionLog$(OBJEXT)" $? +# +#"$(INTDIR)\XmlTransductionLog_dll$(OBJEXT)" : "src/segment/XmlTransductionLog.cpp" +# @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\XmlTransductionLog_dll$(OBJEXT)" $? +# +#!ENDIF + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\Platform$(OBJEXT)" "$(INTDIR)\Platform$(SBREXT)" : "src/segment/Platform.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\Platform$(OBJEXT)" $? + +"$(INTDIR)\Platform_dll$(OBJEXT)" "$(INTDIR)\Platform_dll$(SBREXT)" : "src/segment/Platform.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\Platform_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\Platform$(OBJEXT)" : "src/segment/Platform.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\Platform$(OBJEXT)" $? + +"$(INTDIR)\Platform_dll$(OBJEXT)" : "src/segment/Platform.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\Platform_dll$(OBJEXT)" $? + +!ENDIF + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\SegmentPainter$(OBJEXT)" "$(INTDIR)\SegmentPainter$(SBREXT)" : "src/painter/SegmentPainter.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\SegmentPainter$(OBJEXT)" $? + +"$(INTDIR)\SegmentPainter_dll$(OBJEXT)" "$(INTDIR)\SegmentPainter_dll$(SBREXT)" : "src/painter/SegmentPainter.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\SegmentPainter_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\SegmentPainter$(OBJEXT)" : "src/painter/SegmentPainter.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\SegmentPainter$(OBJEXT)" $? + +"$(INTDIR)\SegmentPainter_dll$(OBJEXT)" : "src/painter/SegmentPainter.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\SegmentPainter_dll$(OBJEXT)" $? + +!ENDIF + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\WinSegmentPainter$(OBJEXT)" "$(INTDIR)\WinSegmentPainter$(SBREXT)" : "..\wrappers\win32\WinSegmentPainter.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\WinSegmentPainter$(OBJEXT)" $? + +"$(INTDIR)\WinSegmentPainter_dll$(OBJEXT)" "$(INTDIR)\WinSegmentPainter_dll$(SBREXT)" : "..\wrappers\win32\WinSegmentPainter.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\WinSegmentPainter_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\WinSegmentPainter$(OBJEXT)" : "..\wrappers\win32\WinSegmentPainter.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\WinSegmentPainter$(OBJEXT)" $? + +"$(INTDIR)\WinSegmentPainter_dll$(OBJEXT)" : "..\wrappers\win32\WinSegmentPainter.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\WinSegmentPainter_dll$(OBJEXT)" $? + +!ENDIF + + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\WinFont$(OBJEXT)" "$(INTDIR)\WinFont$(SBREXT)" : "../wrappers/win32/WinFont.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\WinFont$(OBJEXT)" $? + +"$(INTDIR)\WinFont_dll$(OBJEXT)" "$(INTDIR)\WinFont_dll$(SBREXT)" : "../wrappers/win32/WinFont.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\WinFont_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\WinFont$(OBJEXT)" : "../wrappers/win32/WinFont.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\WinFont$(OBJEXT)" $? + +"$(INTDIR)\WinFont_dll$(OBJEXT)" : "../wrappers/win32/WinFont.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\WinFont_dll$(OBJEXT)" $? + +!ENDIF + + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\FileFont$(OBJEXT)" "$(INTDIR)\FileFont$(SBREXT)" : "src/font/FileFont.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\FileFont$(OBJEXT)" $? + +"$(INTDIR)\FileFont_dll$(OBJEXT)" "$(INTDIR)\FileFont_dll$(SBREXT)" : "src/font/FileFont.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\FileFont_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\FileFont$(OBJEXT)" : "src/font/FileFont.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\FileFont$(OBJEXT)" $? + +"$(INTDIR)\FileFont_dll$(OBJEXT)" : "src/font/FileFont.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\FileFont_dll$(OBJEXT)" $? + +!ENDIF + + +!IF "$(CFG)" == "DEBUG" +"$(INTDIR)\..\wrappers\win32\win32_dll$(OBJEXT)" "$(INTDIR)\win32_dll$(SBREXT)" : "..\wrappers\win32\win32_dll.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\win32_dll$(OBJEXT)" $? + +"$(INTDIR)\win32_dll_dll$(OBJEXT)" "$(INTDIR)\win32_dll_dll$(SBREXT)" : "..\wrappers\win32\win32_dll.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\win32_dll_dll$(OBJEXT)" $? + +!ELSE +"$(INTDIR)\win32_dll$(OBJEXT)" : "..\wrappers\win32\win32_dll.cpp" + @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\win32_dll$(OBJEXT)" $? + +"$(INTDIR)\win32_dll_dll$(OBJEXT)" : "..\wrappers\win32\win32_dll.cpp" + @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\win32_dll_dll$(OBJEXT)" $? + +!ENDIF + +bsc : "$(OUTDIR)/$(TARGET).bsc" + +"$(OUTDIR)/$(TARGET).bsc" : "$(OUTDIR)" $(BSC32_SBRS) + $(BSC32) @<< + $(BSC32_FLAGS) $(BSC32_SBRS) +<< + +dll : $(OUTDIR)/$(TARGET).dll + +"$(OUTDIR)/$(TARGET).dll" : "$(OUTDIR)" $(DEF_FILE) lib_dll $(DLL_LINK_OBJS) + $(LINK) $(LINK_FLAGS) $(LINK_DEBUG) $(OUTDIR)/$(TARGET)_dll.lib $(DLL_LINK_OBJS) + diff --git a/Build/source/libs/graphite/engine-2.4/silgraphite.pc.in b/Build/source/libs/graphite/engine-2.4/silgraphite.pc.in new file mode 100644 index 00000000000..6a57ab7838b --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/silgraphite.pc.in @@ -0,0 +1,7 @@ + +Name: SILGraphite +Description: Script rendering engine +Version: ${version} +Libs: -L${libdir} -lgraphite +Cflags: -I${includedir} + diff --git a/Build/source/libs/graphite/engine-2.4/src/CMakeLists.txt b/Build/source/libs/graphite/engine-2.4/src/CMakeLists.txt new file mode 100644 index 00000000000..05ac9429bb3 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/src/CMakeLists.txt @@ -0,0 +1,94 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0 FATAL_ERROR) +project(graphite) +INCLUDE(CheckTypeSize) +INCLUDE(CheckCXXSourceCompiles) + +set(GRAPHITE_API_MAJOR 3) +set(GRAPHITE_API_MINOR 0) +set(GRAPHITE_API_PATCH 0) +set(GRAPHITE_SO_VERSION ${GRAPHITE_API_MAJOR}.${GRAPHITE_API_MINOR}.${GRAPHITE_API_PATCH}) + +include_directories(${PROJECT_SOURCE_DIR}/../include/graphite) +include_directories( ${PROJECT_SOURCE_DIR}/font ${PROJECT_SOURCE_DIR}/segment) + +# check for fabsf definition +set(FABSF_TEST_SRC "#include \nint main() { fabsf(1.2); }") +CHECK_CXX_SOURCE_COMPILES("${FABSF_TEST_SRC}" HAVE_FABSF) +if (HAVE_FABSF) +add_definitions(-DHAVE_FABSF -DTRACING) +endif (HAVE_FABSF) + +#check sizeof wchar_t +CHECK_TYPE_SIZE(wchar_t SIZEOF_WCHAR_T) +add_definitions(-DSIZEOF_WCHAR_T=${SIZEOF_WCHAR_T}) + +set(GRAPHITE_HEADERS + ../include/graphite/BinTree.h + ../include/graphite/FileFont.h + ../include/graphite/Font.h + ../include/graphite/GenericResource.h + ../include/graphite/GraphiteProcess.h + ../include/graphite/GrAppData.h + ../include/graphite/GrClient.h + ../include/graphite/GrCommon.h + ../include/graphite/GrConstants.h + ../include/graphite/GrData.h + ../include/graphite/GrDebug.h + ../include/graphite/GrExt.h + ../include/graphite/GrFeature.h + ../include/graphite/GrMstypes.h + ../include/graphite/GrPlatform.h + ../include/graphite/GrResult.h + ../include/graphite/GrStructs.h + ../include/graphite/GrWrappers.h + ../include/graphite/HashMap.h + ../include/graphite/IGraphiteProcess.h + ../include/graphite/IGrEngine.h + ../include/graphite/IGrJustifier.h + ../include/graphite/ITextSource.h + ../include/graphite/MemoryUsage.h + ../include/graphite/SegmentAux.h + ../include/graphite/Segment.h + ../include/graphite/SegmentPainter.h) + +add_library(graphite + font/FileFont.cpp + font/Font.cpp + font/TtfUtil.cpp +# generic/BinTree_i.cpp + generic/Debug.cpp +# generic/HashMap_i.cpp + generic/Util.cpp + painter/SegmentPainter.cpp + segment/FileInput.cpp + segment/FontCache.cpp + segment/FontFace.cpp + segment/GrCharStream.cpp + segment/GrClassTable.cpp + segment/GrEngine.cpp + segment/GrFSM.cpp + segment/GrFeature.cpp + segment/GrGlyphTable.cpp + segment/GrPass.cpp + segment/GrPassActionCode.cpp + segment/GrSlotState.cpp + segment/GrSlotStream.cpp + segment/GrTableManager.cpp + segment/MemoryUsage.cpp + segment/Platform.cpp + segment/Segment.cpp + segment/SegmentAux.cpp +# segment/TestFSM.cpp +# segment/TestPasses.cpp + segment/TransductionLog.cpp + ${GRAPHITE_HEADERS} + ) + + + +set_target_properties(graphite PROPERTIES PUBLIC_HEADER "${GRAPHITE_HEADERS}") + +set_target_properties(graphite PROPERTIES SOVERSION ${GRAPHITE_SO_VERSION}) + +install(TARGETS graphite EXPORT graphite LIBRARY DESTINATION lib ARCHIVE DESTINATION lib PUBLIC_HEADER DESTINATION include/graphite) +install(EXPORT graphite DESTINATION lib/graphite NAMESPACE gr_) diff --git a/Build/source/libs/graphite/engine-2.4/src/Makefile.am b/Build/source/libs/graphite/engine-2.4/src/Makefile.am new file mode 100644 index 00000000000..ebaab730478 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/src/Makefile.am @@ -0,0 +1,22 @@ +AUTOMAKE_OPTIONS = 1.6 + +AM_CPPFLAGS = -I$(top_srcdir)/include/graphite -I$(top_srcdir)/src/generic +AM_CPPFLAGS += -I$(top_srcdir)/src/font -I$(top_srcdir)/src/segment +#AM_CPPFLAGS += $(FT_CFLAGS) $(XFT_CFLAGS) +#AM_CPPFLAGS += -D_UNICODE -DUNICODE -DNO_ASM + +lib_LTLIBRARIES = libgraphite.la + +libgraphite_la_LDFLAGS = -version-info 4:0:0 + +#EXTRA_DIST=textsource +EXTRA_DIST= +graphiteinclude_HEADERS = +graphiteincludedir = $(includedir)/graphite +include ../include/Makefile.am + +libgraphite_la_SOURCES = +include generic/Makefile.am +include font/Makefile.am +include segment/Makefile.am +include painter/Makefile.am diff --git a/Build/source/libs/graphite/engine-2.4/src/font/FileFont.cpp b/Build/source/libs/graphite/engine-2.4/src/font/FileFont.cpp new file mode 100644 index 00000000000..422687eba73 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/src/font/FileFont.cpp @@ -0,0 +1,429 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 1999 - 2008 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: FileFont.cpp +Responsibility: Keith Stribley +Last reviewed: Not yet. + +Description: + A Font is an object that represents a font-family + bold + italic setting, that contains + Graphite tables. +----------------------------------------------------------------------------------------------*/ + +#include "Main.h" + +#include "FontTableCache.h" +#include "FileFont.h" +#ifndef _MSC_VER +#include +#endif + +// TBD do this properly +#define FUDGE_FACTOR 72 +#define fix26_6(x) (x >> 6) + (x & 32 ? (x > 0 ? 1 : 0) : (x < 0 ? -1 : 0)) + +namespace gr +{ + + +FileFont::FileFont() + : Font(), + m_pfile(NULL), + m_pTableCache(NULL), + m_mAscent(0), + m_mDescent(0), + m_mEmSquare(0), + m_pointSize(0), + m_dpiX(FUDGE_FACTOR), + m_dpiY(FUDGE_FACTOR), + m_fIsValid(false), + m_pHeader(NULL), + m_pTableDir(NULL), + m_xScale(1.0f), + m_yScale(1.0f) +{ + m_fItalic = false; + m_fBold = false; + // colors are not used + m_clrFore = (unsigned long)kclrBlack; + m_clrBack = (unsigned long)kclrTransparent; +} + +FileFont::FileFont(FILE * pfile, float pointSize, + unsigned int dpiX, unsigned int dpiY) + : Font(), + m_pfile(pfile), + m_pTableCache(NULL), + m_mAscent(0), + m_mDescent(0), + m_mEmSquare(0), + m_pointSize(pointSize), + m_dpiX(dpiX), + m_dpiY(dpiY), + m_fIsValid(false), + m_pHeader(NULL), + m_pTableDir(NULL), + m_xScale(1.0f), + m_yScale(1.0f) +{ + Assert(m_pfile); // shouldn't be null + initializeFromFace(); + +} + +FileFont::FileFont(char * fileName, float pointSize, + unsigned int dpiX, unsigned int dpiY) + : Font(), + m_pfile(NULL), + m_pTableCache(NULL), + m_mAscent(0), + m_mDescent(0), + m_mEmSquare(0), + m_pointSize(pointSize), + m_dpiX(dpiX), + m_dpiY(dpiY), + m_fIsValid(false), + m_pHeader(NULL), + m_pTableDir(NULL), + m_xScale(1.0f), + m_yScale(1.0f) +{ + Assert(fileName); // shouldn't be null but we play safe anyway + m_pfile = fopen(fileName, "rb"); + + initializeFromFace(); +} + +FileFont::FileFont(std::string fileName, float pointSize, + unsigned int dpiX, unsigned int dpiY) + : Font(), + m_pfile(NULL), + m_pTableCache(NULL), + m_mAscent(0), + m_mDescent(0), + m_mEmSquare(0), + m_pointSize(pointSize), + m_dpiX(dpiX), + m_dpiY(dpiY), + m_fIsValid(false), + m_pHeader(NULL), + m_pTableDir(NULL), + m_xScale(1.0f), + m_yScale(1.0f) +{ + Assert(fileName.length()); // shouldn't be null but we play safe anyway + m_pfile = fopen(fileName.c_str(), "rb"); + + initializeFromFace(); +} + + +void +FileFont::initializeFromFace() +{ + if (m_dpiY == 0) m_dpiY = m_dpiX; + m_fItalic = false; + m_fBold = false; + // colors are not used + m_clrFore = (unsigned long)kclrBlack; + m_clrBack = (unsigned long)kclrTransparent; + + if (m_pfile) + { + size_t lOffset, lSize; + TtfUtil::GetHeaderInfo(lOffset, lSize); + m_pHeader = new byte [lSize]; + m_fIsValid = true; + if (!m_pHeader) + { + m_fIsValid = false; + return; + } + m_fIsValid = (fseek(m_pfile, lOffset, SEEK_SET) == 0); + size_t bytesRead = fread(m_pHeader, 1, lSize, m_pfile); + Assert(bytesRead == lSize); + m_fIsValid = TtfUtil::CheckHeader(m_pHeader); + + if (!m_fIsValid) return; + m_fIsValid = TtfUtil::GetTableDirInfo(m_pHeader, lOffset, lSize); + m_pTableDir = new byte[lSize]; + if (!m_pTableDir) + { + m_fIsValid = false; + return; + } + // if lOffset hasn't changed this isn't needed + fseek(m_pfile, lOffset, SEEK_SET); + bytesRead = fread(m_pTableDir, 1, lSize, m_pfile); + Assert(bytesRead == lSize); + + // now read head tables + m_fIsValid = TtfUtil::GetTableInfo(ktiOs2, m_pHeader, m_pTableDir, + lOffset, lSize); + if (!m_fIsValid) + { + return; + } + byte * pTable = readTable(ktiOs2, lSize); + // get ascent, descent, style while we have the OS2 table loaded + if (!m_fIsValid || !pTable) + { + return; + } + m_fIsValid = TtfUtil::FontOs2Style(pTable, m_fBold, m_fItalic); + m_mAscent = static_cast(TtfUtil::FontAscent(pTable)); + m_mDescent = static_cast(TtfUtil::FontDescent(pTable)); + + pTable = readTable(ktiName, lSize); + if (!m_fIsValid || !pTable) + { + return; + } + if (!TtfUtil::Get31EngFamilyInfo(pTable, lOffset, lSize)) + { + // not English name + m_fIsValid = false; + return; + } + Assert(lSize %2 == 0);// should be utf16 + utf16 rgchwFace[128]; + int cchw = (lSize / sizeof(utf16)) + 1; + cchw = min(cchw, 128); + utf16 * pTable16 = reinterpret_cast(pTable + lOffset); + std::copy(pTable16, pTable16 + cchw - 1, rgchwFace); + rgchwFace[cchw - 1] = 0; // zero terminate + TtfUtil::SwapWString(rgchwFace, cchw - 1); +// We could use something like "if (sizeof(std::wstring::value_type) == 4)" here, +// but a compile-time switch is preferable. +#if SIZEOF_WCHAR_T == 4 + for (int cch16 = 0; cch16 < cchw; ) + { + int cch16Used = 0; + utf32 ch32 = GrCharStream::Utf16ToUtf32(&(rgchwFace[cch16]), + cchw - cch16, &cch16Used); + m_stuFaceName.push_back(ch32); + cch16 += cch16Used; + } +// } +#else + // could utf16 and wchar_t ever have different endianness? + Assert(sizeof(utf16) == sizeof(wchar_t)); + m_stuFaceName.assign(reinterpret_cast(rgchwFace)); +#endif + pTable = readTable(ktiHead, lSize); + if (!m_fIsValid || !pTable) + { + return; + } + m_mEmSquare = static_cast(TtfUtil::DesignUnits(pTable)); + // can now set the scale + m_xScale = scaleFromDpi(m_dpiX); + m_yScale = scaleFromDpi(m_dpiY); + } + else + { + m_fIsValid = false; + } +} + +byte * +FileFont::readTable(int /*TableId*/ tid, size_t & size) +{ + const TableId tableId = TableId(tid); + bool isTableValid = true; + size_t lOffset = 0, lSize = 0; + if (!m_pTableCache) + { + m_pTableCache = new FontTableCache(); + } + if (!m_pTableCache) return NULL; + + byte * pTable = m_pTableCache->getTable(tableId); + size = m_pTableCache->getTableSize(tableId); + // check whether it is already in the cache + if (pTable) return pTable; + isTableValid &= TtfUtil::GetTableInfo(tableId, m_pHeader, m_pTableDir, + lOffset, lSize); + if (!isTableValid) + return NULL; + fseek(m_pfile, lOffset, SEEK_SET); + // only allocate if needed + pTable = m_pTableCache->allocateTable(tableId, lSize); + + if (!pTable) + { + isTableValid = false; + return NULL; + } + size_t bytesRead = fread(pTable, 1, lSize, m_pfile); + isTableValid = bytesRead == lSize; + if (isTableValid) + { + isTableValid &= TtfUtil::CheckTable(tableId, pTable, lSize); + } + if (!isTableValid) + { + return 0; + } + size = lSize; + return pTable; +} + + +FileFont::~FileFont() +{ + + // if this is the last copy of the font sharing these tables + // delete them + if (m_pTableCache) + { + m_pTableCache->decrementFontCount(); + if (m_pTableCache->getFontCount() == 0) + { + delete [] m_pHeader; + delete [] m_pTableDir; + delete m_pTableCache; + m_pTableCache = NULL; + if (m_pfile) + fclose(m_pfile); + } + } + else + { + delete [] m_pHeader; + delete [] m_pTableDir; + if (m_pfile) + fclose(m_pfile); + } + // note the DecFontCount(); is done in the Font base class +} + +Font * FileFont::copyThis() +{ + FileFont * copy = new FileFont(*this); + return copy; +} + +/** +* A copy constructor that allows a change of point size or dpi +* The underlying table cache will be shared between the fonts, so +* this should have a low overhead. +*/ +FileFont::FileFont(const FileFont & font, float pointSize, + unsigned int dpiX, unsigned int dpiY) +: Font(font), + m_pfile(font.m_pfile), + m_mAscent(font.m_mAscent), + m_mDescent(font.m_mDescent), + m_mEmSquare(font.m_mEmSquare), + m_pointSize(font.m_pointSize), + m_dpiX(font.m_dpiX), + m_dpiY(font.m_dpiY), + m_fIsValid(font.m_fIsValid), + m_pHeader(font.m_pHeader), + m_pTableDir(font.m_pTableDir), + m_xScale(font.m_xScale), + m_yScale(font.m_yScale) +{ + if (pointSize > 0) + { + m_pointSize = pointSize; + if (dpiX > 0) + { + m_dpiX = dpiX; + if (dpiY > 0) m_dpiY = dpiY; + else dpiY = dpiX; + } + m_xScale = scaleFromDpi(m_dpiX); + m_yScale = scaleFromDpi(m_dpiY); + } + m_fItalic = font.m_fItalic; + m_fBold = font.m_fBold; + // colors are not used + m_clrFore = font.m_clrFore; + m_clrBack = font.m_clrBack; + m_stuFaceName.assign(font.m_stuFaceName); + + m_pTableCache = font.m_pTableCache; + // use the same table cache between instances + if (m_pTableCache) + m_pTableCache->incrementFontCount(); + + + // I dont' see why we need to reget the face, but WinFont does + //m_pfface = FontFace::GetFontFace(this, m_fpropDef.szFaceName, + // m_fpropDef.fBold, m_fpropDef.fItalic); +} + + + + //virtual FontErrorCode isValidForGraphite(int * pnVersion = NULL, int * pnSubVersion = NULL); + +/*---------------------------------------------------------------------------------------------- + Read a table from the font. +----------------------------------------------------------------------------------------------*/ +const void * +FileFont::getTable(fontTableId32 tableID, size_t * pcbSize) +{ + *pcbSize = 0; + // use a cache to reduce the number of times tables have to be reloaded + if (m_pTableCache == NULL) + { + // constructor automatically sets the font count to 1 + m_pTableCache = new FontTableCache(); + } + TableId tid = ktiCmap;// to prevent uninitialized warning + for (int i = 0; i(i); + if (tableID == TtfUtil::TableIdTag(tid)) + { + if (m_pTableCache->getTable(tid)) + { + *pcbSize = m_pTableCache->getTableSize(tid); + return m_pTableCache->getTable(tid); + } + break; + } + } + Assert(tid < ktiLast); + size_t tableSize = 0; + void * pTable = readTable(tid, tableSize); + *pcbSize = static_cast(tableSize); + return pTable; +} + + +void FileFont::getFontMetrics(float * pAscent, float * pDescent, + float * pEmSquare) +{ + if (pEmSquare) *pEmSquare = m_mEmSquare * m_xScale; + if (pAscent) *pAscent = m_mAscent * m_yScale; + if (pDescent) *pDescent = m_mDescent * m_yScale; +} + + +bool FileFont::FontHasGraphiteTables(FILE * file) +{ + FileFont testFont(file, 1.0f, FUDGE_FACTOR); + return testFont.fontHasGraphiteTables(); +} + +bool FileFont::FontHasGraphiteTables(char * fileName) +{ + FileFont testFont(fileName, 1.0f, FUDGE_FACTOR); + return testFont.fontHasGraphiteTables(); +} + +bool FileFont::fontHasGraphiteTables() +{ + size_t tableSize; + bool isGraphiteFont = m_fIsValid; + isGraphiteFont &= (readTable(ktiSilf, tableSize) != NULL); + return isGraphiteFont; +} + +} // namespace gr diff --git a/Build/source/libs/graphite/engine-2.4/src/font/Font.cpp b/Build/source/libs/graphite/engine-2.4/src/font/Font.cpp new file mode 100644 index 00000000000..bfeed78605f --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/src/font/Font.cpp @@ -0,0 +1,942 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 1999 - 2008 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: Font.cpp +Responsibility: Sharon Correll +Last reviewed: Not yet. + +Description: + A font is an object that knows how to read tables from a (platform-specific) font resource. +----------------------------------------------------------------------------------------------*/ + +//:>******************************************************************************************** +//:> Include files +//:>******************************************************************************************** +#include "Main.h" +#ifdef _MSC_VER +#pragma hdrstop +#endif +// any other headers (not precompiled) + +//:End Ignore + +//:>******************************************************************************************** +//:> Forward declarations +//:>******************************************************************************************** + +//:>******************************************************************************************** +//:> Local Constants and static variables +//:>******************************************************************************************** + + +namespace gr +{ + +//:>******************************************************************************************** +//:> Font methods +//:>******************************************************************************************** + +/*---------------------------------------------------------------------------------------------- + Constructor. +----------------------------------------------------------------------------------------------*/ +Font::Font(const Font & fontSrc) : m_pfface(fontSrc.m_pfface), m_fTablesCached(false) +{ + if (m_pfface) + m_pfface->IncFontCount(); +} + +/*---------------------------------------------------------------------------------------------- + Destructor. +----------------------------------------------------------------------------------------------*/ +Font::~Font() +{ + if (m_pfface) + m_pfface->DecFontCount(); +} + +/*---------------------------------------------------------------------------------------------- + Mark the font-cache as to whether it should be deleted when all the font instances go away. +----------------------------------------------------------------------------------------------*/ +void Font::SetFlushMode(int flush) +{ + FontFace::SetFlushMode(flush); +} + +/*---------------------------------------------------------------------------------------------- + Cache the common tables if necessary. +----------------------------------------------------------------------------------------------*/ +void Font::EnsureTablesCached() +{ + if (m_fTablesCached) + return; + + size_t cbBogus; + m_pHead = getTable(TtfUtil::TableIdTag(ktiHead), &cbBogus); + m_pHhea = getTable(TtfUtil::TableIdTag(ktiHhea), &cbBogus); + m_pHmtx = getTable(TtfUtil::TableIdTag(ktiHmtx), &m_cbHmtxSize); + m_pGlyf = getTable(TtfUtil::TableIdTag(ktiGlyf), &cbBogus); + m_pLoca = getTable(TtfUtil::TableIdTag(ktiLoca), &m_cbLocaSize); + + // getTable can return 0 for the lengths if it is hard to calculate them, but it should + // never do that for hmtx or loca. + Assert(m_cbHmtxSize > 0); + Assert(m_cbLocaSize > 0); + + m_fTablesCached = true; +} + +/*---------------------------------------------------------------------------------------------- + Return the flush mode of the font-cache. +----------------------------------------------------------------------------------------------*/ +int Font::GetFlushMode() +{ + return FontFace::GetFlushMode(); +} + +/*---------------------------------------------------------------------------------------------- + Return the internal object representing the font-face. This is the object that is stored + in Graphite's internal cache. +----------------------------------------------------------------------------------------------*/ +inline FontFace & Font::fontFace(bool fDumbFallback) +{ + if (m_pfface == 0) + initialiseFontFace(fDumbFallback); + return *m_pfface; +} + +void Font::initialiseFontFace(bool fDumbFallback) +{ + std::wstring stuFaceName; + bool fBold, fItalic; + + UniqueCacheInfo(stuFaceName, fBold, fItalic); + + m_pfface = FontFace::GetFontFace(this, stuFaceName, fBold, fItalic, fDumbFallback); + + Assert(m_pfface != 0); + + m_pfface->IncFontCount(); + + FontException fexptn; + fexptn.version = -1; + fexptn.subVersion = -1; + if (m_pfface->BadFont(&fexptn.errorCode) + || (!fDumbFallback && m_pfface->DumbFallback(&fexptn.errorCode))) + { + throw fexptn; + } +} + +/*---------------------------------------------------------------------------------------------- + Return uniquely identifying information that will be used as the key for this font + in the font cache. This includes the font face name and the bold and italic flags. +----------------------------------------------------------------------------------------------*/ +void Font::UniqueCacheInfo(std::wstring & stuFace, bool & fBold, bool & fItalic) +{ + size_t cbSize; + const byte * pNameTbl = static_cast(getTable(TtfUtil::TableIdTag(ktiName), &cbSize)); + size_t lOffset, lSize; + if (!TtfUtil::Get31EngFamilyInfo(pNameTbl, lOffset, lSize)) + { + // TODO: try to find any name in any arbitrary language. + Assert(false); + return; + } + + size_t cchw = long(lSize / sizeof(utf16)); + const byte *src_start = pNameTbl + lOffset; + for ( ; cchw > 0; cchw--, src_start += 2) // to handle situation where wchar_t is 4 bytes + stuFace.push_back((*src_start << 8) + src_start[1]); + + const void * pOs2Tbl = getTable(TtfUtil::TableIdTag(ktiOs2), &cbSize); + TtfUtil::FontOs2Style(pOs2Tbl, fBold, fItalic); + // Do we need to compare the results from the OS2 table with the italic flag in the + // head table? (There is no requirement that they be consistent!) +} + + +/*---------------------------------------------------------------------------------------------- + A default unhinted implmentation of getGlyphPoint(..) +----------------------------------------------------------------------------------------------*/ +void Font::getGlyphPoint(gid16 glyphID, unsigned int pointNum, Point & pointReturn) +{ + EnsureTablesCached(); + + // Default values + pointReturn.x = 0; + pointReturn.y = 0; + + if (m_pGlyf == 0) return; + if (m_pHead == 0) return; + if (m_pLoca == 0) return; + + size_t cContours; + size_t cPoints; + + const size_t CONTOUR_BUF_SIZE = 16; + const size_t POINT_BUF_SIZE = 64; + // Fixed-size buffers that will be used in most cases: + bool rgfOnCurveFixedBuf[POINT_BUF_SIZE], *rgfOnCurveHeapBuf=0; + int rgnEndPtFixedBuf[CONTOUR_BUF_SIZE], *rgnEndPtHeapBuf=0, + rgnXFixedBuf[POINT_BUF_SIZE], *rgnXHeapBuf=0, + rgnYFixedBuf[POINT_BUF_SIZE], *rgnYHeapBuf=0; + + if (!TtfUtil::GlyfContourCount(glyphID, m_pGlyf, m_pLoca, m_cbLocaSize, m_pHead, cContours)) + return; // can't figure it out + + int * prgnEndPt = (cContours > CONTOUR_BUF_SIZE) ? + rgnEndPtHeapBuf = new int[cContours] : + rgnEndPtFixedBuf; + + if (!TtfUtil::GlyfContourEndPoints(glyphID, m_pGlyf, m_pLoca, m_cbLocaSize, m_pHead, + prgnEndPt, cContours)) + { + return; // should have been caught above + } + cPoints = prgnEndPt[cContours - 1] + 1; + + bool* prgfOnCurve = (cPoints > POINT_BUF_SIZE) ? rgfOnCurveHeapBuf= new bool[cPoints] : rgfOnCurveFixedBuf; + int * prgnX = (cPoints > POINT_BUF_SIZE) ? rgnXHeapBuf= new int[cPoints] : rgnXFixedBuf; + int * prgnY = (cPoints > POINT_BUF_SIZE) ? rgnYHeapBuf= new int[cPoints] : rgnYFixedBuf; + + if (TtfUtil::GlyfPoints(glyphID, m_pGlyf, m_pLoca, m_cbLocaSize, m_pHead, 0, 0, + prgnX, prgnY, prgfOnCurve, cPoints)) + { + float nPixEmSquare; + getFontMetrics(0, 0, &nPixEmSquare); + + const float nDesignUnitsPerPixel = float(TtfUtil::DesignUnits(m_pHead)) / nPixEmSquare; + pointReturn.x = prgnX[pointNum] / nDesignUnitsPerPixel; + pointReturn.y = prgnY[pointNum] / nDesignUnitsPerPixel; + } + + delete[] rgnEndPtHeapBuf; + delete[] rgfOnCurveHeapBuf; + delete[] rgnXHeapBuf; + delete[] rgnYHeapBuf; +} + + +/*---------------------------------------------------------------------------------------------- + A default unhinted implmentation of getGlyphMetrics(..) +----------------------------------------------------------------------------------------------*/ +void Font::getGlyphMetrics(gid16 glyphID, gr::Rect & boundingBox, gr::Point & advances) +{ + EnsureTablesCached(); + + // Setup default return values in case of failiure. + boundingBox.left = 0; + boundingBox.right = 0; + boundingBox.bottom = 0; + boundingBox.top = 0; + advances.x = 0; + advances.y = 0; + + if (m_pHhea == 0) return; + + // Calculate the number of design units per pixel. + float pixelEmSquare; + getFontMetrics(0, 0, &pixelEmSquare); + const float pixelsPerDesignUnit = + pixelEmSquare / float(TtfUtil::DesignUnits(m_pHead)); + + // getTable can return 0 for the lengths if it is hard to calculate them, but it should + // never do that for hmtx or loca. + Assert(m_cbHmtxSize > 0); + + // Use the Hmtx and Head tables to find the glyph advances. + int lsb; + unsigned int advance = 0; + if (TtfUtil::HorMetrics(glyphID, m_pHmtx, m_cbHmtxSize, m_pHhea, + lsb, advance)) + { + advances.x = (advance * pixelsPerDesignUnit); + advances.y = 0.0f; + } + + if (m_pGlyf == 0) return; + if (m_pLoca == 0) return; + Assert(m_cbLocaSize > 0); + + // Fetch the glyph bounding box. GlyphBox may return false for a whitespace glyph. + // Note that using GlyfBox here allows attachment points (ie, points lying outside + // the glyph's outline) to affect the bounding box, which might not be what we want. + int xMin, xMax, yMin, yMax; + if (TtfUtil::GlyfBox(glyphID, m_pGlyf, m_pLoca, m_cbLocaSize, m_pHead, + xMin, yMin, xMax, yMax)) + { + boundingBox.left = (xMin * pixelsPerDesignUnit); + boundingBox.bottom = (yMin * pixelsPerDesignUnit); + boundingBox.right = (xMax * pixelsPerDesignUnit); + boundingBox.top = (yMax * pixelsPerDesignUnit); + } +} + + +/*---------------------------------------------------------------------------------------------- + Return a pair of iterators over a sequence of features defined for the font. +----------------------------------------------------------------------------------------------*/ +std::pair Font::getFeatures() +{ + std::pair pairRet; + pairRet.first = BeginFeature(); + pairRet.second = EndFeature(); + return pairRet; +} + +/*---------------------------------------------------------------------------------------------- + Returns an iterator indicating the feature with the given ID. If no such feature, + returns the end iterator. +----------------------------------------------------------------------------------------------*/ +FeatureIterator Font::featureWithID(featid id) +{ + FeatureIterator fit = BeginFeature(); + FeatureIterator fitEnd = EndFeature(); + for ( ; fit != fitEnd ; ++fit) + { + if (*fit == id) + return fit; + } + return fitEnd; // invalid +} + +/*---------------------------------------------------------------------------------------------- + Returns the UI label for the indicated feature. Return false if there is no label for the + language, or it is empty. +----------------------------------------------------------------------------------------------*/ +bool Font::getFeatureLabel(FeatureIterator fit, lgid nLanguage, utf16 * label) +{ + return GetFeatureLabel(fit.m_ifeat, nLanguage, label); +} + +/*---------------------------------------------------------------------------------------------- + Returns an iterator pointing at the default value for the feature. +----------------------------------------------------------------------------------------------*/ +FeatureSettingIterator Font::getDefaultFeatureValue(FeatureIterator fit) +{ + size_t ifset = GetFeatureDefault(fit.m_ifeat); + FeatureSettingIterator fsit = fit.BeginSetting(); + fsit += ifset; + return fsit; +} + +/*---------------------------------------------------------------------------------------------- + Returns a pair of iterators spanning the defined settings for the feature. +----------------------------------------------------------------------------------------------*/ +std::pair + Font::getFeatureSettings(FeatureIterator fit) +{ + std::pair pairRet; + pairRet.first = fit.BeginSetting(); + pairRet.second = fit.EndSetting(); + return pairRet; +} + +/*---------------------------------------------------------------------------------------------- + Returns the UI label for the indicated feature. Return false if there is no label for the + language, or it is empty. +----------------------------------------------------------------------------------------------*/ +bool Font::getFeatureSettingLabel(FeatureSettingIterator fsit, lgid nLanguage, utf16 * label) +{ + //FeatureIterator * pfit = static_cast(fsit.m_pfit); + return GetFeatureSettingLabel(fsit.m_fit.m_ifeat, fsit.m_ifset, nLanguage, label); +} + +/*---------------------------------------------------------------------------------------------- + Private methods for feature and language access. +----------------------------------------------------------------------------------------------*/ +size_t Font::NumberOfFeatures() +{ + try { + return fontFace().NumberOfFeatures(); + } + catch (...) { return 0; } +} +featid Font::FeatureID(size_t ifeat) +{ + try { + return fontFace().FeatureID(ifeat); + } + catch (...) { return 0; } +} +size_t Font::FeatureWithID(featid id) +{ + try { + return fontFace().FeatureWithID(id); + } + catch (...) { return 0; } +} +bool Font::GetFeatureLabel(size_t ifeat, lgid language, utf16 * label) +{ + try { + return fontFace().GetFeatureLabel(ifeat, language, label); + } + catch (...) + { + *label = 0; + return false; + } +} +int Font::GetFeatureDefault(size_t ifeat) // index of default setting +{ + try { + return fontFace().GetFeatureDefault(ifeat); + } + catch (...) { return 0; } +} +size_t Font::NumberOfSettings(size_t ifeat) +{ + try { + return fontFace().NumberOfSettings(ifeat); + } + catch (...) { return 0; } +} +int Font::GetFeatureSettingValue(size_t ifeat, size_t ifset) +{ + try { + return fontFace().GetFeatureSettingValue(ifeat, ifset); + } + catch (...) { return 0; } +} +bool Font::GetFeatureSettingLabel(size_t ifeat, size_t ifset, lgid language, utf16 * label) +{ + try { + return fontFace().GetFeatureSettingLabel(ifeat, ifset, language, label); + } + catch (...) + { + *label = 0; + return false; + } +} +size_t Font::NumberOfFeatLangs() +{ + try { + return fontFace().NumberOfFeatLangs(); + } + catch (...) { return 0; } +} +short Font::FeatLabelLang(size_t ilang) +{ + try { + return fontFace().FeatLabelLang(ilang); + } + catch (...) { return 0; } +} +size_t Font::NumberOfLanguages() +{ + try { + return fontFace().NumberOfLanguages(); + } + catch (...) { return 0; } +} +isocode Font::LanguageCode(size_t ilang) +{ + try { + return fontFace().LanguageCode(ilang); + } + catch (...) + { + isocode ret; + std::fill_n(ret.rgch, sizeof(ret.rgch), '\0'); + return ret; + } +} + +/*---------------------------------------------------------------------------------------------- + Return a pair of iterators over a sequence of feature-label languages for this font. +----------------------------------------------------------------------------------------------*/ +std::pair Font::getFeatureLabelLanguages() +{ + std::pair pairRet; + pairRet.first = BeginFeatLang(); + pairRet.second = EndFeatLang(); + return pairRet; +} + +/*---------------------------------------------------------------------------------------------- + Return a pair of iterators over a sequence of languages defined for the font, that is, + those that have features specified for them. +----------------------------------------------------------------------------------------------*/ +std::pair Font::getSupportedLanguages() +{ + std::pair pairRet; + pairRet.first = BeginLanguage(); + pairRet.second = EndLanguage(); + return pairRet; +} + +/*---------------------------------------------------------------------------------------------- + Return a bitmap indicating which directions are supported by the font. +----------------------------------------------------------------------------------------------*/ +ScriptDirCode Font::getSupportedScriptDirections() const throw() +{ + try { + Font * pfontThis = const_cast(this); + FontFace & fface = pfontThis->fontFace(); + return fface.ScriptDirection(); + } + catch (...) { + return kfsdcHorizLtr; + } +} + +/*---------------------------------------------------------------------------------------------- + For segment creation. +----------------------------------------------------------------------------------------------*/ +void Font::RenderLineFillSegment(Segment * pseg, ITextSource * pts, LayoutEnvironment & layout, + toffset ichStart, toffset ichStop, float xsMaxWidth, bool fBacktracking) +{ + fontFace(layout.dumbFallback()).RenderLineFillSegment(pseg, this, pts, layout, + ichStart, ichStop, xsMaxWidth, fBacktracking); +} + +void Font::RenderRangeSegment(Segment * pseg, ITextSource * pts, LayoutEnvironment & layout, + toffset ichStart, toffset ichStop) +{ + fontFace(layout.dumbFallback()).RenderRangeSegment(pseg, this, pts, layout, ichStart, ichStop); +} + +void Font::RenderJustifiedSegment(Segment * pseg, ITextSource * pts, + LayoutEnvironment & layout, toffset ichStart, toffset ichStop, + float xsCurrentWidth, float xsDesiredWidth) +{ + fontFace(layout.dumbFallback()).RenderJustifiedSegment(pseg, this, pts, layout, + ichStart, ichStop, xsCurrentWidth, xsDesiredWidth); +} + +/*---------------------------------------------------------------------------------------------- + Feature iterators. +----------------------------------------------------------------------------------------------*/ +FeatureIterator Font::BeginFeature() +{ + FeatureIterator fit(this, 0, NumberOfFeatures()); + return fit; +} + +FeatureIterator Font::EndFeature() +{ + int cfeat = NumberOfFeatures(); + FeatureIterator fit (this, cfeat, cfeat); + return fit; +} + +/*---------------------------------------------------------------------------------------------- + Feature-label language iterators. +----------------------------------------------------------------------------------------------*/ +FeatLabelLangIterator Font::BeginFeatLang() +{ + FeatLabelLangIterator lgit(this, 0, NumberOfFeatLangs()); + return lgit; +} + +FeatLabelLangIterator Font::EndFeatLang() +{ + int clang = NumberOfFeatLangs(); + FeatLabelLangIterator lgit(this, clang, clang); + return lgit; +} + + +/*---------------------------------------------------------------------------------------------- + Language iterators. +----------------------------------------------------------------------------------------------*/ +LanguageIterator Font::BeginLanguage() +{ + LanguageIterator lgit(this, 0, NumberOfLanguages()); + return lgit; +} + +LanguageIterator Font::EndLanguage() +{ + int clang = NumberOfLanguages(); + LanguageIterator lgit(this, clang, clang); + return lgit; +} + + +/*---------------------------------------------------------------------------------------------- + Debugging. +----------------------------------------------------------------------------------------------*/ +//bool Font::DbgCheckFontCache() +//{ +// return FontFace::DbgCheckFontCache(); +//} + + +//:>******************************************************************************************** +//:> FeatureIterator methods +//:>******************************************************************************************** + +//FeatureIterator::FeatureIterator(FeatureIterator & fitToCopy) +//{ +// m_pfont = fitToCopy.m_pfont; +// m_ifeat = fitToCopy.m_ifeat; +// m_cfeat = fitToCopy.m_cfeat; +//} + +/*---------------------------------------------------------------------------------------------- + Dereference the iterator, returning a feature ID. +----------------------------------------------------------------------------------------------*/ +featid FeatureIterator::operator*() +{ + if (m_ifeat >= m_cfeat) + { + Assert(false); + return (unsigned int)kInvalid; + } + + return m_pfont->FeatureID(m_ifeat); +} + +/*---------------------------------------------------------------------------------------------- + Increment the iterator. +----------------------------------------------------------------------------------------------*/ +FeatureIterator FeatureIterator::operator++() +{ + if (m_ifeat >= m_cfeat) + { + // Can't increment. + Assert(false); + } + else + m_ifeat++; + + return *this; +} + +/*---------------------------------------------------------------------------------------------- + Increment the iterator by the given value. +----------------------------------------------------------------------------------------------*/ +FeatureIterator FeatureIterator::operator+=(int n) +{ + if (m_ifeat + n >= m_cfeat) + { + // Can't increment. + Assert(false); + m_ifeat = m_cfeat; + } + else if (static_cast(m_ifeat) + n < 0) + { + // Can't decrement. + Assert(false); + m_ifeat = 0; + } + else + m_ifeat += n; + + return *this; +} + +/*---------------------------------------------------------------------------------------------- + Test whether the two iterators are equal. +----------------------------------------------------------------------------------------------*/ +bool FeatureIterator::operator==(FeatureIterator & fit) +{ + return (fit.m_ifeat == m_ifeat && fit.m_pfont == m_pfont); +} + +bool FeatureIterator::operator!=(FeatureIterator & fit) +{ + return (fit.m_ifeat != m_ifeat || fit.m_pfont != m_pfont); +} + +/*---------------------------------------------------------------------------------------------- + Return the number of items represented by the range of the two iterators. +----------------------------------------------------------------------------------------------*/ +int FeatureIterator::operator-(FeatureIterator & fit) +{ + if (m_pfont != fit.m_pfont) + { + throw; + } + return (m_ifeat - fit.m_ifeat); +} + + +/*---------------------------------------------------------------------------------------------- + Iterators. +----------------------------------------------------------------------------------------------*/ +FeatureSettingIterator FeatureIterator::BeginSetting() +{ + int cfset = m_pfont->NumberOfSettings(m_ifeat); + FeatureSettingIterator fsit(*this, 0, cfset); + return fsit; +} + +FeatureSettingIterator FeatureIterator::EndSetting() +{ + int cfset = m_pfont->NumberOfSettings(m_ifeat); + FeatureSettingIterator fsit(*this, cfset, cfset); + return fsit; +} + + +//:>******************************************************************************************** +//:> FeatureSettingIterator methods +//:>******************************************************************************************** + +/*---------------------------------------------------------------------------------------------- + Dereference the iterator, returning a feature value. +----------------------------------------------------------------------------------------------*/ +int FeatureSettingIterator::operator*() +{ + if (m_ifset >= m_cfset) + { + Assert(false); + return kInvalid; + } + + return m_fit.m_pfont->GetFeatureSettingValue(m_fit.m_ifeat, m_ifset); +} + +/*---------------------------------------------------------------------------------------------- + Increment the iterator. +----------------------------------------------------------------------------------------------*/ +FeatureSettingIterator FeatureSettingIterator::operator++() +{ + if (m_ifset >= m_cfset) + { + // Can't increment. + Assert(false); + } + else + m_ifset++; + + return *this; +} + +/*---------------------------------------------------------------------------------------------- + Increment the iterator by the given value. +----------------------------------------------------------------------------------------------*/ +FeatureSettingIterator FeatureSettingIterator::operator+=(int n) +{ + if (m_ifset + n >= m_cfset) + { + // Can't increment. + Assert(false); + m_ifset = m_cfset; + } + if (static_cast(m_ifset) + n < 0) + { + // Can't decrement. + Assert(false); + m_ifset = 0; + } + else + m_ifset += n; + + return *this; +} + +/*---------------------------------------------------------------------------------------------- + Test whether the two iterators are equal. +----------------------------------------------------------------------------------------------*/ +bool FeatureSettingIterator::operator==(FeatureSettingIterator & fsit) +{ + //FeatureIterator * pfit = static_cast(m_pfit); + //FeatureIterator * pfitOther = static_cast(fsit.m_pfit); + //return (m_ifset == fsit.m_ifset && pfit == pfitOther); + return (m_ifset == fsit.m_ifset && m_fit == fsit.m_fit); +} + +bool FeatureSettingIterator::operator!=(FeatureSettingIterator & fsit) +{ + //FeatureIterator * pfit = static_cast(m_pfit); + //FeatureIterator * pfitOther = static_cast(fsit.m_pfit); + //return (m_ifset != fsit.m_ifset || pfit != pfitOther); + + return (m_ifset != fsit.m_ifset || m_fit != fsit.m_fit); +} + +/*---------------------------------------------------------------------------------------------- + Return the number of items represented by the range of the two iterators. +----------------------------------------------------------------------------------------------*/ +int FeatureSettingIterator::operator-(FeatureSettingIterator fsit) +{ + //FeatureIterator * pfit = static_cast(m_pfit); + //FeatureIterator * pfitOther = static_cast(fsit.m_pfit); + //if (pfit != pfitOther) + + if (m_fit != fsit.m_fit) + { + throw; + } + return (m_ifset - fsit.m_ifset); +} + +//:>******************************************************************************************** +//:> FeatLabelLangIterator methods +//:>******************************************************************************************** + +/*---------------------------------------------------------------------------------------------- + Dereference the iterator, returning a language LCID. +----------------------------------------------------------------------------------------------*/ +data16 FeatLabelLangIterator::operator*() +{ + if (m_ilang >= m_clang) + { + Assert(false); + return 0; + } + + return m_pfont->FeatLabelLang(m_ilang); +} + +/*---------------------------------------------------------------------------------------------- + Increment the iterator. +----------------------------------------------------------------------------------------------*/ +FeatLabelLangIterator FeatLabelLangIterator::operator++() +{ + if (m_ilang >= m_clang) + { + // Can't increment. + Assert(false); + } + else + m_ilang++; + + return *this; +} + +/*---------------------------------------------------------------------------------------------- + Increment the iterator by the given value. +----------------------------------------------------------------------------------------------*/ +FeatLabelLangIterator FeatLabelLangIterator::operator+=(int n) +{ + if (m_ilang + n >= m_clang) + { + // Can't increment. + Assert(false); + m_ilang = m_clang; + } + else if (static_cast(m_ilang) + n < 0) + { + // Can't decrement. + Assert(false); + m_ilang = 0; + } + else + m_ilang += n; + + return *this; +} + +/*---------------------------------------------------------------------------------------------- + Test whether the two iterators are equal. +----------------------------------------------------------------------------------------------*/ +bool FeatLabelLangIterator::operator==(FeatLabelLangIterator & fllit) +{ + return (fllit.m_ilang == m_ilang && fllit.m_pfont == m_pfont); +} + +bool FeatLabelLangIterator::operator!=(FeatLabelLangIterator & fllit) +{ + return (fllit.m_ilang != m_ilang || fllit.m_pfont != m_pfont); +} + +/*---------------------------------------------------------------------------------------------- + Return the number of items represented by the range of the two iterators. +----------------------------------------------------------------------------------------------*/ +int FeatLabelLangIterator::operator-(FeatLabelLangIterator & fllit) +{ + if (m_pfont != fllit.m_pfont) + { + throw; + } + return (m_ilang - fllit.m_ilang); +} + + +//:>******************************************************************************************** +//:> LanguageIterator methods +//:>******************************************************************************************** + +/*---------------------------------------------------------------------------------------------- + Dereference the iterator, returning a language code. +----------------------------------------------------------------------------------------------*/ +isocode LanguageIterator::operator*() +{ + if (m_ilang >= m_clang) + { + Assert(false); + isocode codeRet; + codeRet.rgch[0] = '?'; codeRet.rgch[1] = '?'; + codeRet.rgch[2] = '?'; codeRet.rgch[3] = 0; + return codeRet; + } + + return m_pfont->LanguageCode(m_ilang); +} + +/*---------------------------------------------------------------------------------------------- + Increment the iterator. +----------------------------------------------------------------------------------------------*/ +LanguageIterator LanguageIterator::operator++() +{ + if (m_ilang >= m_clang) + { + // Can't increment. + Assert(false); + } + else + m_ilang++; + + return *this; +} + +/*---------------------------------------------------------------------------------------------- + Increment the iterator by the given value. +----------------------------------------------------------------------------------------------*/ +LanguageIterator LanguageIterator::operator+=(int n) +{ + if (m_ilang + n >= m_clang) + { + // Can't increment. + Assert(false); + m_ilang = m_clang; + } + else if (static_cast(m_ilang) + n < 0) + { + // Can't decrement. + Assert(false); + m_ilang = 0; + } + else + m_ilang += n; + + return *this; +} + +/*---------------------------------------------------------------------------------------------- + Test whether the two iterators are equal. +----------------------------------------------------------------------------------------------*/ +bool LanguageIterator::operator==(LanguageIterator & lgit) +{ + return (lgit.m_ilang == m_ilang && lgit.m_pfont == m_pfont); +} + +bool LanguageIterator::operator!=(LanguageIterator & lgit) +{ + return (lgit.m_ilang != m_ilang || lgit.m_pfont != m_pfont); +} + +/*---------------------------------------------------------------------------------------------- + Return the number of items represented by the range of the two iterators. +----------------------------------------------------------------------------------------------*/ +int LanguageIterator::operator-(LanguageIterator & lgit) +{ + if (m_pfont != lgit.m_pfont) + { + throw; + } + return (m_ilang - lgit.m_ilang); +} + + +} // namespace gr + + diff --git a/Build/source/libs/graphite/engine-2.4/src/font/FontTableCache.h b/Build/source/libs/graphite/engine-2.4/src/font/FontTableCache.h new file mode 100644 index 00000000000..461b00d745f --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/src/font/FontTableCache.h @@ -0,0 +1,52 @@ + +#include "TtfUtil.h" + +namespace gr +{ + + +// used to allow table sharing among font copies +// TBD: should this be a real class or is it acceptable to +// make the attributes public +class FontTableCache +{ +public: + FontTableCache() + : m_fontCount(1) + { + for (int i = 0; i -1); } + byte * getTable(TableId id) const { Assert(id < ktiLast); return m_pTable[id]; } + const long & getTableSize(TableId id) const + { + Assert(id < ktiLast); + return m_tableSize[id]; + } + byte * allocateTable(TableId id, long size) + { + m_pTable[id] = new byte[size]; + m_tableSize[id] = size; + return m_pTable[id]; + } + +private: + int m_fontCount; + byte * m_pTable[ktiLast]; + long m_tableSize[ktiLast]; +}; + +} diff --git a/Build/source/libs/graphite/engine-2.4/src/font/Makefile.am b/Build/source/libs/graphite/engine-2.4/src/font/Makefile.am new file mode 100644 index 00000000000..461af621b49 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/src/font/Makefile.am @@ -0,0 +1,7 @@ +fontdir = $(top_srcdir)/src/font + +libgraphite_la_SOURCES += $(fontdir)/Font.cpp +libgraphite_la_SOURCES += $(fontdir)/TtfUtil.cpp +libgraphite_la_SOURCES += $(fontdir)/FileFont.cpp + +EXTRA_DIST += $(fontdir)/*.h diff --git a/Build/source/libs/graphite/engine-2.4/src/font/TtfTypes.h b/Build/source/libs/graphite/engine-2.4/src/font/TtfTypes.h new file mode 100644 index 00000000000..da8d90f1f26 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/src/font/TtfTypes.h @@ -0,0 +1,388 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 2007 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: TtfTypes.h +Responsibility: Tim Eves +Last reviewed: Not yet. + +Description: +Provides types required to represent the TTF basic types. +-------------------------------------------------------------------------------*//*:End Ignore*/ + + +//********************************************************************************************** +// Include files +//********************************************************************************************** +#include "GrPlatform.h" + +namespace TtfUtil +{ +//********************************************************************************************** +// Forward declarations +//********************************************************************************************** + + +//********************************************************************************************** +// Type declarations +//********************************************************************************************** +typedef gr::data8 uint8; +typedef gr::sdata8 int8; +typedef gr::data16 uint16; +typedef gr::sdata16 int16; +typedef gr::data32 uint32; +typedef gr::sdata32 int32; + +typedef int16 short_frac; +typedef int32 fixed; +typedef int16 fword; +typedef uint16 ufword; +typedef int16 f2dot14; +typedef uint32 long_date_time[2]; + +//********************************************************************************************** +// Constants and enum types +//**********************************************************************************************/ +enum +{ + OneFix = 1<<16 +}; + +//********************************************************************************************** +// Table declarations +//********************************************************************************************** +namespace Sfnt +{ +#pragma pack(1) // We need this or the structure members aren't alligned + // correctly. Fortunately this form of pragma is supposed + // to be recongnised by VS C++ too (at least according to + // MSDN). + + struct OffsetSubTable + { + uint32 scaler_type; + uint16 num_tables, + search_range, + entry_selector, + range_shift; + struct Entry + { + uint32 tag, + checksum, + offset, + length; + } table_directory[1]; + + enum ScalerType + { + TrueTypeMac = 0x74727565U, + TrueTypeWin = 0x00010000U, + Type1 = 0x74797031U + }; + }; + + + + + struct CharacterCodeMap + { + uint16 version, + num_subtables; + struct + { + uint16 platform_id, + platform_specific_id; + uint32 offset; + } encoding[1]; + }; + + struct CmapSubTable + { + uint16 format, + length, + language; + }; + + struct CmapSubTableFormat4 : CmapSubTable + { + uint16 seg_count_x2, + search_range, + entry_selector, + range_shift, + end_code[1]; + // There are arrarys after this which need their + // start positions calculated since end_code is + // seg_count uint16s long. + }; + + struct CmapSubTableFormat12 + { + fixed format; + uint32 length, + language, + num_groups; + struct + { + uint32 start_char_code, + end_char_code, + start_glyph_id; + } group[1]; + }; + + + + struct FontHeader + { + fixed version, + font_revision; + uint32 check_sum_adjustment, + magic_number; + uint16 flags, + units_per_em; + long_date_time created, + modified; + fword x_min, + y_min, + x_max, + y_max; + uint16 mac_style, + lowest_rec_ppem; + int16 font_direction_hint, + index_to_loc_format, + glyph_data_format; + enum + { + MagicNumber = 0x5F0F3CF5, + GlypDataFormat = 0 + }; + enum {ShortIndexLocFormat, LongIndexLocFormat}; + }; + + + + + struct PostScriptGlyphName + { + fixed format, + italic_angle; + fword underline_position, + underline_thickness; + uint32 is_fixed_pitch, + min_mem_type42, + max_mem_type42, + min_mem_type1, + max_mem_type1; + enum + { + Format1 = 0x10000, + Format2 = 0x20000, + Format25 = 0x28000, + Format3 = 0x30000, + Format4 = 0x40000 + }; + }; + + struct PostScriptGlyphName2 : PostScriptGlyphName + { + uint16 number_of_glyphs, + glyph_name_index[1]; + }; + + struct PostScriptGlyphName25 : PostScriptGlyphName + { + uint16 number_of_glyphs; + int8 offset[1]; + }; + + struct PostScriptGlyphName3 : PostScriptGlyphName {}; + + struct PostScriptGlyphName4 : PostScriptGlyphName + { + uint16 glyph_to_char_map[1]; + }; + + + struct HorizontalHeader + { + fixed version; + fword ascent, + descent, + line_gap; + ufword advance_width_max; + fword min_left_side_bearing, + max_left_side_bearing, + x_max_element; + int16 caret_slope_rise, + caret_slope_run; + fword caret_offset; + int16 reserved[4], + metric_data_format; + uint16 num_long_hor_metrics; + }; + + struct MaximumProfile + { + fixed version; + uint16 num_glyphs, + max_points, + max_contours, + max_component_points, + max_component_contours, + max_zones, + max_twilight_points, + max_storage, + max_function_defs, + max_instruction_defs, + max_stack_elements, + max_size_of_instructions, + max_component_elements, + max_component_depth; + }; + + + typedef gr::byte Panose[10]; + + struct Compatibility0 + { + uint16 version; + int16 x_avg_char_width; + uint16 weight_class, + width_class; + int16 fs_type, + y_subscript_x_size, + y_subscript_y_size, + y_subscript_x_offset, + y_subscript_y_offset, + y_superscript_x_size, + y_superscript_y_size, + y_superscript_x_offset, + y_superscript_y_offset, + y_strikeout_size, + y_strikeout_position, + family_class; + Panose panose; + uint32 unicode_range[4]; + int8 ach_vend_id[4]; + uint16 fs_selection, + fs_first_char_index, + fs_last_char_index, // Acording to Apple's spec this is where v0 should end + typo_ascender, + typo_descender, + type_linegap, + win_ascent, + win_descent; + + enum + { + Italic =0x01, + Underscore=0x02, + Negative =0x04, + Outlined =0x08, + StrikeOut =0x10, + Bold =0x20 + }; + }; + + struct Compatibility1 : Compatibility0 + { + uint32 codepage_range[2]; + }; + + struct Compatibility2 : Compatibility1 + { + int16 x_height, + cap_height; + uint16 default_char, + break_char, + max_context; + }; + + struct Compatibility3 : Compatibility2 {}; + + typedef Compatibility3 Compatibility; + + + struct NameRecord + { + uint16 platform_id, + platform_specific_id, + language_id, + name_id, + length, + offset; + enum {Unicode, Mactintosh, Reserved, Microsoft}; + enum + { + Copyright, Family, Subfamily, UniqueSubfamily, + Fullname, Version, PostScript + }; + }; + + struct FontNames + { + uint16 format, + count, + string_offset; + NameRecord name_record[1]; + }; + + + struct HorizontalMetric + { + uint16 advance_width; + int16 left_side_bearing; + }; + + + struct Glyph + { + int16 number_of_contours; + fword x_min, + y_min, + x_max, + y_max; + }; + + struct SimpleGlyph : Glyph + { + uint16 end_pts_of_contours[1]; + enum + { + OnCurve = 0x01, + XShort = 0x02, + YShort = 0x04, + Repeat = 0x08, + XIsSame = 0x10, + XIsPos = 0x10, + YIsSame = 0x20, + YIsPos = 0x20 + }; + }; + + struct CompoundGlyph : Glyph + { + uint16 flags, + glyph_index; + enum + { + Arg1Arg2Words = 0x01, + ArgsAreXYValues = 0x02, + RoundXYToGrid = 0x04, + HaveScale = 0x08, + MoreComponents = 0x20, + HaveXAndYScale = 0x40, + HaveTwoByTwo = 0x80, + HaveInstructions = 0x100, + UseMyMetrics = 0x200, + OverlapCompund = 0x400, + ScaledOffset = 0x800, + UnscaledOffset = 0x1000 + }; + }; + +#pragma pack() +} // end of namespace Sfnt + +} // end of namespace TtfUtil diff --git a/Build/source/libs/graphite/engine-2.4/src/font/TtfUtil.cpp b/Build/source/libs/graphite/engine-2.4/src/font/TtfUtil.cpp new file mode 100644 index 00000000000..195156e9c23 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/src/font/TtfUtil.cpp @@ -0,0 +1,1964 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 2000, 2001 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: TtfUtil.cpp +Responsibility: Alan Ward +Last reviewed: Not yet. + +Description: + Implements the methods for TtfUtil class. This file should remain portable to any C++ + environment by only using standard C++ and the TTF structurs defined in Tt.h. +-------------------------------------------------------------------------------*//*:End Ignore*/ + + +/*********************************************************************************************** + Include files +***********************************************************************************************/ +// Language headers +#include +#include +#include +#include +#include +#include +// Platform headers +// Module headers +#include "TtfUtil.h" +#include "TtfTypes.h" + +/*********************************************************************************************** + Forward declarations +***********************************************************************************************/ + +/*********************************************************************************************** + Local Constants and static variables +***********************************************************************************************/ +namespace +{ + // max number of components allowed in composite glyphs + const int kMaxGlyphComponents = 8; + + // These are basic byte order swapping functions + template inline T rev16(const T d) { + T r = (d & 0xff) << 8; r |= (d & 0xff00) >> 8; + return r; + } + + template inline T rev32(const T d) { + T r = (d & 0xff) << 24; r |= (d & 0xff00) << 8; + r |= (d & 0xff0000) >> 8; r |= (d & 0xff000000) >> 24; + return r; + } + + // This is the generic read function which does the swapping + template inline T read(const T d) { + return d; + } + +#if !defined WORDS_BIGENDIAN || defined PC_OS + template<> inline TtfUtil::uint16 read(const TtfUtil::uint16 d) { + return rev16(d); + } + + template<> inline TtfUtil::int16 read(const TtfUtil::int16 d) { + return rev16(d); + } + + template<> inline TtfUtil::uint32 read(const TtfUtil::uint32 d) { + return rev32(d); + } + + template<> inline TtfUtil::int32 read(const TtfUtil::int32 d) { + return rev32(d); + } +#endif + + template + inline float fixed_to_float(const T f) { + return float(f)/float(2^R); + } + +#define MAKE_TAG(a,b,c,d) ((a << 24UL) + (b << 16UL) + (c << 8UL) + (d)) + const gr::fontTableId32 mapIdToTag[] = { + MAKE_TAG('c','m','a','p'), + MAKE_TAG('c','v','t',' '), + MAKE_TAG('c','r','y','p'), + MAKE_TAG('h','e','a','d'), + MAKE_TAG('f','p','g','m'), + MAKE_TAG('g','d','i','r'), + MAKE_TAG('g','l','y','f'), + MAKE_TAG('h','d','m','x'), + MAKE_TAG('h','h','e','a'), + MAKE_TAG('h','m','t','x'), + MAKE_TAG('l','o','c','a'), + MAKE_TAG('k','e','r','n'), + MAKE_TAG('L','T','S','H'), + MAKE_TAG('m','a','x','p'), + MAKE_TAG('n','a','m','e'), + MAKE_TAG('O','S','/','2'), + MAKE_TAG('p','o','s','t'), + MAKE_TAG('p','r','e','p'), + MAKE_TAG('F','e','a','t'), + MAKE_TAG('G','l','a','t'), + MAKE_TAG('G','l','o','c'), + MAKE_TAG('S','i','l','f'), + MAKE_TAG('S','i','l','e'), + MAKE_TAG('S','i','l','l') + }; + + +/*---------------------------------------------------------------------------------------------- + Table of standard Postscript glyph names. From Martin Hosken. Disagress with ttfdump.exe +---------------------------------------------------------------------------------------------*/ + const int kcPostNames = 258; + + const char * rgPostName[kcPostNames] = { + ".notdef", ".null", "nonmarkingreturn", "space", "exclam", "quotedbl", "numbersign", + "dollar", "percent", "ampersand", "quotesingle", "parenleft", + "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", + "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", + "nine", "colon", "semicolon", "less", "equal", "greater", "question", + "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", + "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", + "bracketleft", "backslash", "bracketright", "asciicircum", + "underscore", "grave", "a", "b", "c", "d", "e", "f", "g", "h", "i", + "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", + "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", + "Adieresis", "Aring", "Ccedilla", "Eacute", "Ntilde", "Odieresis", + "Udieresis", "aacute", "agrave", "acircumflex", "adieresis", "atilde", + "aring", "ccedilla", "eacute", "egrave", "ecircumflex", "edieresis", + "iacute", "igrave", "icircumflex", "idieresis", "ntilde", "oacute", + "ograve", "ocircumflex", "odieresis", "otilde", "uacute", "ugrave", + "ucircumflex", "udieresis", "dagger", "degree", "cent", "sterling", + "section", "bullet", "paragraph", "germandbls", "registered", + "copyright", "trademark", "acute", "dieresis", "notequal", "AE", + "Oslash", "infinity", "plusminus", "lessequal", "greaterequal", "yen", + "mu", "partialdiff", "summation", "product", "pi", "integral", + "ordfeminine", "ordmasculine", "Omega", "ae", "oslash", "questiondown", + "exclamdown", "logicalnot", "radical", "florin", "approxequal", + "Delta", "guillemotleft", "guillemotright", "ellipsis", "nonbreakingspace", + "Agrave", "Atilde", "Otilde", "OE", "oe", "endash", "emdash", + "quotedblleft", "quotedblright", "quoteleft", "quoteright", "divide", + "lozenge", "ydieresis", "Ydieresis", "fraction", "currency", + "guilsinglleft", "guilsinglright", "fi", "fl", "daggerdbl", "periodcentered", + "quotesinglbase", "quotedblbase", "perthousand", "Acircumflex", + "Ecircumflex", "Aacute", "Edieresis", "Egrave", "Iacute", + "Icircumflex", "Idieresis", "Igrave", "Oacute", "Ocircumflex", + "apple", "Ograve", "Uacute", "Ucircumflex", "Ugrave", "dotlessi", + "circumflex", "tilde", "macron", "breve", "dotaccent", "ring", + "cedilla", "hungarumlaut", "ogonek", "caron", "Lslash", "lslash", + "Scaron", "scaron", "Zcaron", "zcaron", "brokenbar", "Eth", "eth", + "Yacute", "yacute", "Thorn", "thorn", "minus", "multiply", + "onesuperior", "twosuperior", "threesuperior", "onehalf", "onequarter", + "threequarters", "franc", "Gbreve", "gbreve", "Idotaccent", "Scedilla", + "scedilla", "Cacute", "cacute", "Ccaron", "ccaron", + "dcroat" }; + +} // end of namespace + +/*********************************************************************************************** + Methods +***********************************************************************************************/ + +/* Note on error processing: The code guards against bad glyph ids being used to look up data +in open ended tables (loca, hmtx). If the glyph id comes from a cmap this shouldn't happen +but it seems prudent to check for user errors here. The code does assume that data obtained +from the TTF file is valid otherwise (though the CheckTable method seeks to check for +obvious problems that might accompany a change in table versions). For example an invalid +offset in the loca table which could exceed the size of the glyf table is NOT trapped. +Likewise if numberOf_LongHorMetrics in the hhea table is wrong, this will NOT be trapped, +which could cause a lookup in the hmtx table to exceed the table length. Of course, TTF tables +that are completely corrupt will cause unpredictable results. */ + +/* Note on composite glyphs: Glyphs that have components that are themselves composites +are not supported. IsDeepComposite can be used to test for this. False is returned from many +of the methods in this cases. It is unclear how to build composite glyphs in some cases, +so this code represents my best guess until test cases can be found. See notes on the high- +level GlyfPoints method. */ + +namespace TtfUtil +{ + + +/*---------------------------------------------------------------------------------------------- + Get offset and size of the offset table needed to find table directory. + Return true if success, false otherwise. + lSize excludes any table directory entries. +----------------------------------------------------------------------------------------------*/ +bool GetHeaderInfo(size_t & lOffset, size_t & lSize) +{ + lOffset = 0; + lSize = offsetof(Sfnt::OffsetSubTable, table_directory); + assert(sizeof(uint32) + 4*sizeof (uint16) == lSize); + return true; +} + +/*---------------------------------------------------------------------------------------------- + Check the offset table for expected data. + Return true if success, false otherwise. +----------------------------------------------------------------------------------------------*/ +bool CheckHeader(const void * pHdr) +{ + const Sfnt::OffsetSubTable * pOffsetTable + = reinterpret_cast(pHdr); + + return read(pOffsetTable->scaler_type) == Sfnt::OffsetSubTable::TrueTypeWin; +} + +/*---------------------------------------------------------------------------------------------- + Get offset and size of the table directory. + Return true if successful, false otherwise. +----------------------------------------------------------------------------------------------*/ +bool GetTableDirInfo(const void * pHdr, size_t & lOffset, size_t & lSize) +{ + const Sfnt::OffsetSubTable * pOffsetTable + = reinterpret_cast(pHdr); + + lOffset = offsetof(Sfnt::OffsetSubTable, table_directory); + lSize = read(pOffsetTable->num_tables) + * sizeof(Sfnt::OffsetSubTable::Entry); + + return true; +} + + +/*---------------------------------------------------------------------------------------------- + Get offset and size of the specified table. + Return true if successful, false otherwise. On false, offset and size will be 0. +----------------------------------------------------------------------------------------------*/ +bool GetTableInfo(TableId ktiTableId, const void * pHdr, const void * pTableDir, + size_t & lOffset, size_t & lSize) +{ + gr::fontTableId32 lTableTag = TableIdTag(ktiTableId); + if (!lTableTag) + { + lOffset = 0; + lSize = 0; + return false; + } + + const Sfnt::OffsetSubTable * pOffsetTable + = reinterpret_cast(pHdr); + const Sfnt::OffsetSubTable::Entry + * entry_itr = reinterpret_cast( + pTableDir), + * const dir_end = entry_itr + read(pOffsetTable->num_tables); + + assert(read(pOffsetTable->num_tables) < 40); + if (read(pOffsetTable->num_tables) > 40) + return false; + + for (;entry_itr != dir_end; ++entry_itr) // 40 - safe guard + { + if (read(entry_itr->tag) == lTableTag) + { + lOffset = read(entry_itr->offset); + lSize = read(entry_itr->length); + return true; + } + } + + return false; +} + +/*---------------------------------------------------------------------------------------------- + Check the specified table. Tests depend on the table type. + Return true if successful, false otherwise. +----------------------------------------------------------------------------------------------*/ +bool CheckTable(TableId ktiTableId, const void * pTable, size_t lTableSize) +{ + using namespace Sfnt; + + switch(ktiTableId) + { + case ktiCmap: // cmap + { + const Sfnt::CharacterCodeMap * const pCmap + = reinterpret_cast(pTable); + assert(read(pCmap->version) == 0); + return read(pCmap->version) == 0; + } + + case ktiHead: // head + { + const Sfnt::FontHeader * const pHead + = reinterpret_cast(pTable); + bool r = read(pHead->version) == OneFix + && read(pHead->magic_number) == FontHeader::MagicNumber + && read(pHead->glyph_data_format) + == FontHeader::GlypDataFormat + && (read(pHead->index_to_loc_format) + == FontHeader::ShortIndexLocFormat + || read(pHead->index_to_loc_format) + == FontHeader::LongIndexLocFormat) + && sizeof(FontHeader) <= lTableSize; + assert(r); return r; + } + + case ktiPost: // post + { + const Sfnt::PostScriptGlyphName * const pPost + = reinterpret_cast(pTable); + const fixed format = read(pPost->format); + bool r = format == PostScriptGlyphName::Format1 + || format == PostScriptGlyphName::Format2 + || format == PostScriptGlyphName::Format3 + || format == PostScriptGlyphName::Format25; + assert(r); return r; + } + + case ktiHhea: // hhea + { + const Sfnt::HorizontalHeader * pHhea = + reinterpret_cast(pTable); + bool r = read(pHhea->version) == OneFix + && read(pHhea->metric_data_format) == 0 + && sizeof (Sfnt::HorizontalHeader) <= lTableSize; + assert(r); return r; + } + + case ktiMaxp: // maxp + { + const Sfnt::MaximumProfile * pMaxp = + reinterpret_cast(pTable); + bool r = read(pMaxp->version) == OneFix + && sizeof(Sfnt::MaximumProfile) <= lTableSize; + assert(r); return r; + } + + case ktiOs2: // OS/2 + { + const Sfnt::Compatibility * pOs2 + = reinterpret_cast(pTable); + if (read(pOs2->version) == 0) + { // OS/2 table version 1 size +// if (sizeof(Sfnt::Compatibility) +// - sizeof(uint32)*2 - sizeof(int16)*2 +// - sizeof(uint16)*3 <= lTableSize) + if (sizeof(Sfnt::Compatibility0) <= lTableSize) + return true; + } + else if (read(pOs2->version) == 1) + { // OS/2 table version 2 size +// if (sizeof(Sfnt::Compatibility) +// - sizeof(int16) *2 +// - sizeof(uint16)*3 <= lTableSize) + if (sizeof(Sfnt::Compatibility1) <= lTableSize) + return true; + } + else if (read(pOs2->version) == 2) + { // OS/2 table version 3 size + if (sizeof(Sfnt::Compatibility2) <= lTableSize) + return true; + } + else if (read(pOs2->version) == 3) + { // OS/2 table version 4 size - version 4 changed the meaning of some fields which we don't use + if (sizeof(Sfnt::Compatibility3) <= lTableSize) + return true; + } + else + return false; + } + + case ktiName: + { + const Sfnt::FontNames * pName + = reinterpret_cast(pTable); + assert(read(pName->format) == 0); + return read(pName->format) == 0; + } + + default: + break; + } + + return true; +} + +/*---------------------------------------------------------------------------------------------- + Return the number of glyphs in the font. Should never be less than zero. + + Note: this method is not currently used by the Graphite engine. +----------------------------------------------------------------------------------------------*/ +size_t GlyphCount(const void * pMaxp) +{ + const Sfnt::MaximumProfile * pTable = + reinterpret_cast(pMaxp); + return read(pTable->num_glyphs); +} + +/*---------------------------------------------------------------------------------------------- + Return the maximum number of components for any composite glyph in the font. + + Note: this method is not currently used by the Graphite engine. +----------------------------------------------------------------------------------------------*/ +size_t MaxCompositeComponentCount(const void * pMaxp) +{ + const Sfnt::MaximumProfile * pTable = + reinterpret_cast(pMaxp); + return read(pTable->max_component_elements); +} + +/*---------------------------------------------------------------------------------------------- + Composite glyphs can be composed of glyphs that are themselves composites. + This method returns the maximum number of levels like this for any glyph in the font. + A non-composite glyph has a level of 1. + + Note: this method is not currently used by the Graphite engine. +----------------------------------------------------------------------------------------------*/ +size_t MaxCompositeLevelCount(const void * pMaxp) +{ + const Sfnt::MaximumProfile * pTable = + reinterpret_cast(pMaxp); + return read(pTable->max_component_depth); +} + +/*---------------------------------------------------------------------------------------------- + Return the number of glyphs in the font according to a differt source. + Should never be less than zero. Return -1 on failure. + + Note: this method is not currently used by the Graphite engine. +----------------------------------------------------------------------------------------------*/ +size_t LocaGlyphCount(size_t lLocaSize, const void * pHead) throw(std::domain_error) +{ + + const Sfnt::FontHeader * pTable + = reinterpret_cast(pHead); + + if (read(pTable->index_to_loc_format) + == Sfnt::FontHeader::ShortIndexLocFormat) + // loca entries are two bytes and have been divided by two + return (lLocaSize >> 1) - 1; + + if (read(pTable->index_to_loc_format) + == Sfnt::FontHeader::LongIndexLocFormat) + // loca entries are four bytes + return (lLocaSize >> 2) - 1; + + //return -1; + throw std::domain_error("head table in inconsistent state. The font may be corrupted"); +} + +/*---------------------------------------------------------------------------------------------- + Return the design units the font is designed with +----------------------------------------------------------------------------------------------*/ +int DesignUnits(const void * pHead) +{ + const Sfnt::FontHeader * pTable = + reinterpret_cast(pHead); + + return read(pTable->units_per_em); +} + +/*---------------------------------------------------------------------------------------------- + Return the checksum from the head table, which serves as a unique identifer for the font. +----------------------------------------------------------------------------------------------*/ +int HeadTableCheckSum(const void * pHead) +{ + const Sfnt::FontHeader * pTable = + reinterpret_cast(pHead); + + return read(pTable->check_sum_adjustment); +} + +/*---------------------------------------------------------------------------------------------- + Return the create time from the head table. This consists of a 64-bit integer, which + we return here as two 32-bit integers. + + Note: this method is not currently used by the Graphite engine. +----------------------------------------------------------------------------------------------*/ +void HeadTableCreateTime(const void * pHead, + unsigned int * pnDateBC, unsigned int * pnDateAD) +{ + const Sfnt::FontHeader * pTable = + reinterpret_cast(pHead); + + *pnDateBC = read(pTable->created[0]); + *pnDateAD = read(pTable->created[1]); +} + +/*---------------------------------------------------------------------------------------------- + Return the modify time from the head table.This consists of a 64-bit integer, which + we return here as two 32-bit integers. + + Note: this method is not currently used by the Graphite engine. +----------------------------------------------------------------------------------------------*/ +void HeadTableModifyTime(const void * pHead, + unsigned int * pnDateBC, unsigned int *pnDateAD) +{ + const Sfnt::FontHeader * pTable = + reinterpret_cast(pHead); + + *pnDateBC = read(pTable->modified[0]); + *pnDateAD = read(pTable->modified[1]); +} + +/*---------------------------------------------------------------------------------------------- + Return true if the font is italic. +----------------------------------------------------------------------------------------------*/ +bool IsItalic(const void * pHead) +{ + const Sfnt::FontHeader * pTable = + reinterpret_cast(pHead); + + return ((read(pTable->mac_style) & 0x00000002) != 0); +} + +/*---------------------------------------------------------------------------------------------- + Return the ascent for the font +----------------------------------------------------------------------------------------------*/ +int FontAscent(const void * pOs2) +{ + const Sfnt::Compatibility * pTable = reinterpret_cast(pOs2); + + return read(pTable->win_ascent); +} + +/*---------------------------------------------------------------------------------------------- + Return the descent for the font +----------------------------------------------------------------------------------------------*/ +int FontDescent(const void * pOs2) +{ + const Sfnt::Compatibility * pTable = reinterpret_cast(pOs2); + + return read(pTable->win_descent); +} + +/*---------------------------------------------------------------------------------------------- + Get the bold and italic style bits. + Return true if successful. false otherwise. + In addition to checking the OS/2 table, one could also check + the head table's macStyle field (overridden by the OS/2 table on Win) + the sub-family name in the name table (though this can contain oblique, dark, etc too) +----------------------------------------------------------------------------------------------*/ +bool FontOs2Style(const void *pOs2, bool & fBold, bool & fItalic) +{ + const Sfnt::Compatibility * pTable = reinterpret_cast(pOs2); + + fBold = (read(pTable->fs_selection) & Sfnt::Compatibility::Bold) != 0; + fItalic = (read(pTable->fs_selection) & Sfnt::Compatibility::Italic) != 0; + + return true; +} + +/*---------------------------------------------------------------------------------------------- + Method for searching name table. +----------------------------------------------------------------------------------------------*/ +bool GetNameInfo(const void * pName, int nPlatformId, int nEncodingId, + int nLangId, int nNameId, size_t & lOffset, size_t & lSize) +{ + lOffset = 0; + lSize = 0; + + const Sfnt::FontNames * pTable = reinterpret_cast(pName); + uint16 cRecord = read(pTable->count); + uint16 nRecordOffset = read(pTable->string_offset); + const Sfnt::NameRecord * pRecord = reinterpret_cast(pTable + 1); + + for (int i = 0; i < cRecord; ++i) + { + if (read(pRecord->platform_id) == nPlatformId && + read(pRecord->platform_specific_id) == nEncodingId && + read(pRecord->language_id) == nLangId && + read(pRecord->name_id) == nNameId) + { + lOffset = read(pRecord->offset) + nRecordOffset; + lSize = read(pRecord->length); + return true; + } + pRecord++; + } + + return false; +} + +/*---------------------------------------------------------------------------------------------- + Return all the lang-IDs that have data for the given name-IDs. Assume that there is room + in the return array (langIdList) for 128 items. The purpose of this method is to return + a list of all possible lang-IDs. +----------------------------------------------------------------------------------------------*/ +int GetLangsForNames(const void * pName, int nPlatformId, int nEncodingId, + int * nameIdList, int cNameIds, short * langIdList) +{ + const Sfnt::FontNames * pTable = reinterpret_cast(pName); + uint16 cRecord = read(pTable->count); + //uint16 nRecordOffset = swapw(pTable->stringOffset); + const Sfnt::NameRecord * pRecord = reinterpret_cast(pTable + 1); + + int cLangIds = 0; + for (int i = 0; i < cRecord; ++i) + { + if (read(pRecord->platform_id) == nPlatformId && + read(pRecord->platform_specific_id) == nEncodingId) + { + bool fNameFound = false; + int nLangId = read(pRecord->language_id); + int nNameId = read(pRecord->name_id); + for (int j = 0; j < cNameIds; j++) + { + if (nNameId == nameIdList[j]) + { + fNameFound = true; + break; + } + } + if (fNameFound) + { + // Add it if it's not there. + int ilang; + for (ilang = 0; ilang < cLangIds; ilang++) + if (langIdList[ilang] == nLangId) + break; + if (ilang >= cLangIds) + { + langIdList[cLangIds] = short(nLangId); + cLangIds++; + } + if (cLangIds == 128) + return cLangIds; + } + } + pRecord++; + } + + return cLangIds; +} + +/*---------------------------------------------------------------------------------------------- + Get the offset and size of the font family name in English for the MS Platform with Unicode + writing system. The offset is within the pName data. The string is double byte with MSB + first. +----------------------------------------------------------------------------------------------*/ +bool Get31EngFamilyInfo(const void * pName, size_t & lOffset, size_t & lSize) +{ + return GetNameInfo(pName, Sfnt::NameRecord::Microsoft, 1, 1033, + Sfnt::NameRecord::Family, lOffset, lSize); +} + +/*---------------------------------------------------------------------------------------------- + Get the offset and size of the full font name in English for the MS Platform with Unicode + writing system. The offset is within the pName data. The string is double byte with MSB + first. + + Note: this method is not currently used by the Graphite engine. +----------------------------------------------------------------------------------------------*/ +bool Get31EngFullFontInfo(const void * pName, size_t & lOffset, size_t & lSize) +{ + return GetNameInfo(pName, Sfnt::NameRecord::Microsoft, 1, 1033, + Sfnt::NameRecord::Fullname, lOffset, lSize); +} + +/*---------------------------------------------------------------------------------------------- + Get the offset and size of the font family name in English for the MS Platform with Symbol + writing system. The offset is within the pName data. The string is double byte with MSB + first. +----------------------------------------------------------------------------------------------*/ +bool Get30EngFamilyInfo(const void * pName, size_t & lOffset, size_t & lSize) +{ + return GetNameInfo(pName, Sfnt::NameRecord::Microsoft, 0, 1033, + Sfnt::NameRecord::Family, lOffset, lSize); +} + +/*---------------------------------------------------------------------------------------------- + Get the offset and size of the full font name in English for the MS Platform with Symbol + writing system. The offset is within the pName data. The string is double byte with MSB + first. + + Note: this method is not currently used by the Graphite engine. +----------------------------------------------------------------------------------------------*/ +bool Get30EngFullFontInfo(const void * pName, size_t & lOffset, size_t & lSize) +{ + return GetNameInfo(pName, Sfnt::NameRecord::Microsoft, 0, 1033, + Sfnt::NameRecord::Fullname, lOffset, lSize); +} + +/*---------------------------------------------------------------------------------------------- + Return the Glyph ID for a given Postscript name. This method finds the first glyph which + matches the requested Postscript name. Ideally every glyph should have a unique Postscript + name (except for special names such as .notdef), but this is not always true. + On failure return value less than zero. + -1 - table search failed + -2 - format 3 table (no Postscript glyph info) + -3 - other failures + + Note: this method is not currently used by the Graphite engine. +----------------------------------------------------------------------------------------------*/ +int PostLookup(const void * pPost, size_t lPostSize, const void * pMaxp, + const char * pPostName) +{ + using namespace Sfnt; + + const Sfnt::PostScriptGlyphName * pTable + = reinterpret_cast(pPost); + fixed format = read(pTable->format); + + if (format == PostScriptGlyphName::Format3) + { // format 3 - no Postscript glyph info in font + return -2; + } + + // search for given Postscript name among the standard names + int iPostName = -1; // index in standard names + for (int i = 0; i < kcPostNames; i++) + { + if (!strcmp(pPostName, rgPostName[i])) + { + iPostName = i; + break; + } + } + + if (format == PostScriptGlyphName::Format1) + { // format 1 - use standard Postscript names + return iPostName; + } + + if (format == PostScriptGlyphName::Format25) + { + if (iPostName == -1) + return -1; + + const PostScriptGlyphName25 * pTable25 + = static_cast(pTable); + int cnGlyphs = GlyphCount(pMaxp); + for (gr::gid16 nGlyphId = 0; nGlyphId < cnGlyphs && nGlyphId < kcPostNames; + nGlyphId++) + { // glyph_name_index25 contains bytes so no byte swapping needed + // search for first glyph id that uses the standard name + if (nGlyphId + pTable25->offset[nGlyphId] == iPostName) + return nGlyphId; + } + } + + if (format == PostScriptGlyphName::Format2) + { // format 2 + const PostScriptGlyphName2 * pTable2 + = static_cast(pTable); + + int cnGlyphs = read(pTable2->number_of_glyphs); + + if (iPostName != -1) + { // did match a standard name, look for first glyph id mapped to that name + for (gr::gid16 nGlyphId = 0; nGlyphId < cnGlyphs; nGlyphId++) + { + if (read(pTable2->glyph_name_index[nGlyphId]) == iPostName) + return nGlyphId; + } + return -1; // no glyph with this standard name + } + + else + { // did not match a standard name, search font specific names + size_t nStrSizeGoal = strlen(pPostName); + const char * pFirstGlyphName = reinterpret_cast( + &pTable2->glyph_name_index[0] + cnGlyphs); + const char * pGlyphName = pFirstGlyphName; + int iInNames = 0; // index in font specific names + bool fFound = false; + const char * const endOfTable + = reinterpret_cast(pTable2) + lPostSize; + while (pGlyphName < endOfTable && !fFound) + { // search Pascal strings for first matching name + size_t nStringSize = size_t(*pGlyphName); + if (nStrSizeGoal != nStringSize || + strncmp(pGlyphName + 1, pPostName, nStringSize)) + { // did not match + ++iInNames; + pGlyphName += nStringSize + 1; + } + else + { // did match + fFound = true; + } + } + if (!fFound) + return -1; // no font specific name matches request + + iInNames += kcPostNames; + for (gr::gid16 nGlyphId = 0; nGlyphId < cnGlyphs; nGlyphId++) + { // search for first glyph id that maps to the found string index + if (read(pTable2->glyph_name_index[nGlyphId]) == iInNames) + return nGlyphId; + } + return -1; // no glyph mapped to this index (very strange) + } + } + + return -3; +} + +/*---------------------------------------------------------------------------------------------- + Convert a Unicode character string from big endian (MSB first, Motorola) format to little + endian (LSB first, Intel) format. + nSize is the number of Unicode characters in the string. It should not include any + terminating null. If nSize is 0, it is assumed the string is null terminated. nSize + defaults to 0. + Return true if successful, false otherwise. +----------------------------------------------------------------------------------------------*/ +void SwapWString(void * pWStr, size_t nSize /* = 0 */) throw (std::invalid_argument) +{ + if (pWStr == 0) + throw std::invalid_argument("null pointer given"); + + uint16 * pStr = reinterpret_cast(pWStr); + uint16 * const pStrEnd = pStr + (nSize == 0 ? gr::utf16len(pStr) : nSize); + +#ifndef USE_STDLIB_WORKAROUNDS + std::transform(pStr, pStrEnd, pStr, read); +#else + for (int i = 0; i < nSize; i++) + { // swap the wide characters in the string + pStr[i] = gr::utf16(read(uint16(pStr[i]))); + } +#endif +} + +/*---------------------------------------------------------------------------------------------- + Get the left-side bearing and and advance width based on the given tables and Glyph ID + Return true if successful, false otherwise. On false, one or both value could be INT_MIN +----------------------------------------------------------------------------------------------*/ +bool HorMetrics(gr::gid16 nGlyphId, const void * pHmtx, size_t lHmtxSize, const void * pHhea, + int & nLsb, unsigned int & nAdvWid) +{ + const Sfnt::HorizontalMetric * phmtx = + reinterpret_cast(pHmtx); + + const Sfnt::HorizontalHeader * phhea = + reinterpret_cast(pHhea); + + size_t cLongHorMetrics = read(phhea->num_long_hor_metrics); + if (nGlyphId < cLongHorMetrics) + { // glyph id is acceptable + nAdvWid = read(phmtx[nGlyphId].advance_width); + nLsb = read(phmtx[nGlyphId].left_side_bearing); + } + else + { + nAdvWid = read(phmtx[cLongHorMetrics - 1].advance_width); + + // guard against bad glyph id + size_t lLsbOffset = sizeof(Sfnt::HorizontalMetric) * cLongHorMetrics + + sizeof(int16) * (nGlyphId - cLongHorMetrics); // offset in bytes + if (lLsbOffset + 1 >= lHmtxSize) // + 1 because entries are two bytes wide + { + nLsb = 0; + return false; + } + const int16 * pLsb = reinterpret_cast(phmtx) + + lLsbOffset / sizeof(int16); + nLsb = read(*pLsb); + } + + return true; +} + +/*---------------------------------------------------------------------------------------------- + Return a pointer to the requested cmap subtable. By default find the Microsoft Unicode + subtable. Pass nEncoding as -1 to find first table that matches only nPlatformId. + Return NULL if the subtable cannot be found. +----------------------------------------------------------------------------------------------*/ +void * FindCmapSubtable(const void * pCmap, + int nPlatformId, /* =3 */ + int nEncodingId) /* = 1 */ +{ + const Sfnt::CharacterCodeMap * pTable = + reinterpret_cast(pCmap); + + uint16 csuPlatforms = read(pTable->num_subtables); + for (int i = 0; i < csuPlatforms; i++) + { + if (read(pTable->encoding[i].platform_id) == nPlatformId && + (nEncodingId == -1 || read(pTable->encoding[i].platform_specific_id) == nEncodingId)) + { + const void * pRtn = reinterpret_cast(pCmap) + + read(pTable->encoding[i].offset); + return const_cast(pRtn); + } + } + + return 0; +} + +/*---------------------------------------------------------------------------------------------- + Check the Microsoft Unicode subtable for expected values +----------------------------------------------------------------------------------------------*/ +bool CheckCmap31Subtable(const void * pCmap31) +{ + const Sfnt::CmapSubTable * pTable = reinterpret_cast(pCmap31); + // Bob H says ome freeware TT fonts have version 1 (eg, CALIGULA.TTF) + // so don't check subtable version. 21 Mar 2002 spec changes version to language. + + return read(pTable->format) == 4; +} + +/*---------------------------------------------------------------------------------------------- + Return the Glyph ID for the given Unicode ID in the Microsoft Unicode subtable. + (Actually this code only depends on subtable being format 4.) + Return 0 if the Unicode ID is not in the subtable. +----------------------------------------------------------------------------------------------*/ +gr::gid16 Cmap31Lookup(const void * pCmap31, int nUnicodeId) +{ + const Sfnt::CmapSubTableFormat4 * pTable = reinterpret_cast(pCmap31); + + uint16 nSeg = read(pTable->seg_count_x2) >> 1; + + uint16 n; + const uint16 * pLeft, * pMid; + uint16 cMid, chStart, chEnd; + + // Binary search of the endCode[] array + pLeft = &(pTable->end_code[0]); + n = nSeg; + while (n > 0) + { + cMid = n >> 1; // Pick an element in the middle + pMid = pLeft + cMid; + chEnd = read(*pMid); + if (nUnicodeId <= chEnd) + { + if (cMid == 0 || nUnicodeId > read(pMid[-1])) + break; // Must be this seg or none! + n = cMid; // Continue on left side, omitting mid point + } + else + { + pLeft = pMid + 1; // Continue on right side, omitting mid point + n -= (cMid + 1); + } + } + + if (!n) + return 0; + + // Ok, we're down to one segment and pMid points to the endCode element + // Either this is it or none is. + + chStart = read(*(pMid += nSeg + 1)); + if (chEnd >= nUnicodeId && nUnicodeId >= chStart) + { + // Found correct segment. Find Glyph Id + int16 idDelta = read(*(pMid += nSeg)); + uint16 idRangeOffset = read(*(pMid += nSeg)); + + if (idRangeOffset == 0) + return (uint16)(idDelta + nUnicodeId); // must use modulus 2^16 + + // Look up value in glyphIdArray + gr::gid16 nGlyphId = read(*(pMid + (nUnicodeId - chStart) + (idRangeOffset >> 1))); + // If this value is 0, return 0. Else add the idDelta + return nGlyphId ? nGlyphId + idDelta : 0; + } + + return 0; +} + +/*---------------------------------------------------------------------------------------------- + Return the next Unicode value in the cmap. Pass 0 to obtain the first item. + Returns 0xFFFF as the last item. + pRangeKey is an optional key that is used to optimize the search; its value is the range + in which the character is found. + + Note: this method is not currently used by the Graphite engine. +----------------------------------------------------------------------------------------------*/ +unsigned int Cmap31NextCodepoint(const void *pCmap31, unsigned int nUnicodeId, int * pRangeKey) +{ + const Sfnt::CmapSubTableFormat4 * pTable = reinterpret_cast(pCmap31); + + uint16 nRange = read(pTable->seg_count_x2) >> 1; + + uint32 nUnicodePrev = (uint32)nUnicodeId; + + const uint16 * pStartCode = &(pTable->end_code[0]) + + nRange // length of end code array + + 1; // reserved word + + if (nUnicodePrev == 0) + { + // return the first codepoint. + if (pRangeKey) + *pRangeKey = 0; + return read(pStartCode[0]); + } + else if (nUnicodePrev >= 0xFFFF) + { + if (pRangeKey) + *pRangeKey = nRange - 1; + return 0xFFFF; + } + + int iRange = (pRangeKey) ? *pRangeKey : 0; + // Just in case we have a bad key: + while (iRange > 0 && read(pStartCode[iRange]) > nUnicodePrev) + iRange--; + while (read(pTable->end_code[iRange]) < nUnicodePrev) + iRange++; + + // Now iRange is the range containing nUnicodePrev. + unsigned int nStartCode = read(pStartCode[iRange]); + unsigned int nEndCode = read(pTable->end_code[iRange]); + + if (nStartCode > nUnicodePrev) + // Oops, nUnicodePrev is not in the cmap! Adjust so we get a reasonable + // answer this time around. + nUnicodePrev = nStartCode - 1; + + if (nEndCode > nUnicodePrev) + { + // Next is in the same range; it is the next successive codepoint. + if (pRangeKey) + *pRangeKey = iRange; + return nUnicodePrev + 1; + } + + // Otherwise the next codepoint is the first one in the next range. + // There is guaranteed to be a next range because there must be one that + // ends with 0xFFFF. + if (pRangeKey) + *pRangeKey = iRange + 1; + return read(pStartCode[iRange + 1]); +} + +/*---------------------------------------------------------------------------------------------- + Check the Microsoft UCS-4 subtable for expected values. + + Note: this method is not currently used by the Graphite engine. +----------------------------------------------------------------------------------------------*/ +bool CheckCmap310Subtable(const void *pCmap310) +{ + const Sfnt::CmapSubTable * pTable = reinterpret_cast(pCmap310); + return read(pTable->format) == 12; +} + +/*---------------------------------------------------------------------------------------------- + Return the Glyph ID for the given Unicode ID in the Microsoft UCS-4 subtable. + (Actually this code only depends on subtable being format 12.) + Return 0 if the Unicode ID is not in the subtable. +----------------------------------------------------------------------------------------------*/ +gr::gid16 Cmap310Lookup(const void * pCmap310, unsigned int uUnicodeId) +{ + const Sfnt::CmapSubTableFormat12 * pTable = reinterpret_cast(pCmap310); + + //uint32 uLength = read(pTable->length); //could use to test for premature end of table + uint32 ucGroups = read(pTable->num_groups); + + for (unsigned int i = 0; i < ucGroups; i++) + { + uint32 uStartCode = read(pTable->group[i].start_char_code); + uint32 uEndCode = read(pTable->group[i].end_char_code); + if (uUnicodeId >= uStartCode && uUnicodeId <= uEndCode) + { + uint32 uDiff = uUnicodeId - uStartCode; + uint32 uStartGid = read(pTable->group[i].start_glyph_id); + return static_cast(uStartGid + uDiff); + } + } + + return 0; +} + +/*---------------------------------------------------------------------------------------------- + Return the next Unicode value in the cmap. Pass 0 to obtain the first item. + Returns 0x10FFFF as the last item. + pRangeKey is an optional key that is used to optimize the search; its value is the range + in which the character is found. + + Note: this method is not currently used by the Graphite engine. +----------------------------------------------------------------------------------------------*/ +unsigned int Cmap310NextCodepoint(const void *pCmap310, unsigned int nUnicodeId, int * pRangeKey) +{ + const Sfnt::CmapSubTableFormat12 * pTable = reinterpret_cast(pCmap310); + + int nRange = read(pTable->num_groups); + + uint32 nUnicodePrev = (uint32)nUnicodeId; + + if (nUnicodePrev == 0) + { + // return the first codepoint. + if (pRangeKey) + *pRangeKey = 0; + return read(pTable->group[0].start_char_code); + } + else if (nUnicodePrev >= 0x10FFFF) + { + if (pRangeKey) + *pRangeKey = nRange; + return 0x10FFFF; + } + + int iRange = (pRangeKey) ? *pRangeKey : 0; + // Just in case we have a bad key: + while (iRange > 0 && read(pTable->group[iRange].start_char_code) > nUnicodePrev) + iRange--; + while (read(pTable->group[iRange].end_char_code) < nUnicodePrev) + iRange++; + + // Now iRange is the range containing nUnicodePrev. + + unsigned int nStartCode = read(pTable->group[iRange].start_char_code); + unsigned int nEndCode = read(pTable->group[iRange].end_char_code); + + if (nStartCode > nUnicodePrev) + // Oops, nUnicodePrev is not in the cmap! Adjust so we get a reasonable + // answer this time around. + nUnicodePrev = nStartCode - 1; + + if (nEndCode > nUnicodePrev) + { + // Next is in the same range; it is the next successive codepoint. + if (pRangeKey) + *pRangeKey = iRange; + return nUnicodePrev + 1; + } + + // Otherwise the next codepoint is the first one in the next range, or 10FFFF if we're done. + if (pRangeKey) + *pRangeKey = iRange + 1; + return (iRange + 1 >= nRange) ? 0x10FFFF : read(pTable->group[iRange + 1].start_char_code); +} + +/*---------------------------------------------------------------------------------------------- + Return the offset stored in the loca table for the given Glyph ID. + (This offset is into the glyf table.) + Return -1 if the lookup failed. + Technically this method should return an unsigned long but it is unlikely the offset will + exceed 2^31. +----------------------------------------------------------------------------------------------*/ +size_t LocaLookup(gr::gid16 nGlyphId, + const void * pLoca, size_t lLocaSize, + const void * pHead) throw (std::out_of_range) +{ + const Sfnt::FontHeader * pTable = reinterpret_cast(pHead); + + // CheckTable verifies the index_to_loc_format is valid + if (read(pTable->index_to_loc_format) == Sfnt::FontHeader::ShortIndexLocFormat) + { // loca entries are two bytes and have been divided by two + if (nGlyphId <= (lLocaSize >> 1) - 1) // allow sentinel value to be accessed + { + const uint16 * pShortTable = reinterpret_cast(pLoca); + return (read(pShortTable[nGlyphId]) << 1); + } + } + + if (read(pTable->index_to_loc_format) == Sfnt::FontHeader::LongIndexLocFormat) + { // loca entries are four bytes + if (nGlyphId <= (lLocaSize >> 2) - 1) + { + const uint32 * pLongTable = reinterpret_cast(pLoca); + return read(pLongTable[nGlyphId]); + } + } + + // only get here if glyph id was bad + //return -1; + throw std::out_of_range("glyph id out of range for font"); +} + +/*---------------------------------------------------------------------------------------------- + Return a pointer into the glyf table based on the given offset (from LocaLookup). + Return NULL on error. +----------------------------------------------------------------------------------------------*/ +void * GlyfLookup(const void * pGlyf, size_t nGlyfOffset) +{ + const uint8 * pByte = reinterpret_cast(pGlyf); + return const_cast(pByte + nGlyfOffset); +} + +/*---------------------------------------------------------------------------------------------- + Get the bounding box coordinates for a simple glyf entry (non-composite). + Return true if successful, false otherwise. +----------------------------------------------------------------------------------------------*/ +bool GlyfBox(const void * pSimpleGlyf, int & xMin, int & yMin, + int & xMax, int & yMax) +{ + const Sfnt::Glyph * pGlyph = reinterpret_cast(pSimpleGlyf); + + xMin = read(pGlyph->x_min); + yMin = read(pGlyph->y_min); + xMax = read(pGlyph->x_max); + yMax = read(pGlyph->y_max); + + return true; +} + +/*---------------------------------------------------------------------------------------------- + Return the number of contours for a simple glyf entry (non-composite) + Returning -1 means this is a composite glyph +----------------------------------------------------------------------------------------------*/ +int GlyfContourCount(const void * pSimpleGlyf) +{ + const Sfnt::Glyph * pGlyph = reinterpret_cast(pSimpleGlyf); + return read(pGlyph->number_of_contours); // -1 means composite glyph +} + +/*---------------------------------------------------------------------------------------------- + Get the point numbers for the end points of the glyph contours for a simple + glyf entry (non-composite). + cnPointsTotal - count of contours from GlyfContourCount(); (same as number of end points) + prgnContourEndPoints - should point to a buffer large enough to hold cnPoints integers + cnPoints - count of points placed in above range + Return true if successful, false otherwise. + False could indicate a multi-level composite glyphs. +----------------------------------------------------------------------------------------------*/ +bool GlyfContourEndPoints(const void * pSimpleGlyf, int * prgnContourEndPoint, + int cnPointsTotal, int & cnPoints) +{ + const Sfnt::SimpleGlyph * pGlyph = reinterpret_cast(pSimpleGlyf); + + int cContours = read(pGlyph->number_of_contours); + if (cContours < 0) + return false; // this method isn't supposed handle composite glyphs + + for (int i = 0; i < cContours && i < cnPointsTotal; i++) + { + prgnContourEndPoint[i] = read(pGlyph->end_pts_of_contours[i]); + } + + cnPoints = cContours; + return true; +} + +/*---------------------------------------------------------------------------------------------- + Get the points for a simple glyf entry (non-composite) + cnPointsTotal - count of points from largest end point obtained from GlyfContourEndPoints + prgnX & prgnY - should point to buffers large enough to hold cnPointsTotal integers + The ranges are parallel so that coordinates for point(n) are found at offset n in both + ranges. This is raw point data with relative coordinates. + prgbFlag - should point to a buffer a large enough to hold cnPointsTotal bytes + This range is parallel to the prgnX & prgnY + cnPoints - count of points placed in above ranges + Return true if successful, false otherwise. + False could indicate a composite glyph +----------------------------------------------------------------------------------------------*/ +bool GlyfPoints(const void * pSimpleGlyf, int * prgnX, int * prgnY, + char * prgbFlag, int cnPointsTotal, int & cnPoints) +{ + using namespace Sfnt; + + const Sfnt::SimpleGlyph * pGlyph = reinterpret_cast(pSimpleGlyf); + int cContours = read(pGlyph->number_of_contours); + // return false for composite glyph + if (cContours <= 0) + return false; + int cPts = read(pGlyph->end_pts_of_contours[cContours - 1]) + 1; + if (cPts > cnPointsTotal) + return false; + + // skip over bounding box data & point to byte count of instructions (hints) + const uint8 * pbGlyph = reinterpret_cast + (&pGlyph->end_pts_of_contours[cContours]); + + // skip over hints & point to first flag + int cbHints = read(*(const uint16 *)pbGlyph); + pbGlyph += sizeof(uint16); + pbGlyph += cbHints; + + // load flags & point to first x coordinate + int iFlag = 0; + while (iFlag < cPts) + { + if (!(*pbGlyph & SimpleGlyph::Repeat)) + { // flag isn't repeated + prgbFlag[iFlag] = (char)*pbGlyph; + pbGlyph++; + iFlag++; + } + else + { // flag is repeated; count specified by next byte + char chFlag = (char)*pbGlyph; + pbGlyph++; + int cFlags = (int)*pbGlyph; + pbGlyph++; + prgbFlag[iFlag] = chFlag; + iFlag++; + for (int i = 0; i < cFlags; i++) + { + prgbFlag[iFlag + i] = chFlag; + } + iFlag += cFlags; + } + } + if (iFlag != cPts) + return false; + + // load x coordinates + iFlag = 0; + while (iFlag < cPts) + { + if (prgbFlag[iFlag] & SimpleGlyph::XShort) + { + prgnX[iFlag] = *pbGlyph; + if (!(prgbFlag[iFlag] & SimpleGlyph::XIsPos)) + { + prgnX[iFlag] = -prgnX[iFlag]; + } + pbGlyph++; + } + else + { + if (prgbFlag[iFlag] & SimpleGlyph::XIsSame) + { + prgnX[iFlag] = 0; + // do NOT increment pbGlyph + } + else + { + prgnX[iFlag] = read(*(const int16 *)pbGlyph); + pbGlyph += sizeof(int16); + } + } + iFlag++; + } + + // load y coordinates + iFlag = 0; + while (iFlag < cPts) + { + if (prgbFlag[iFlag] & SimpleGlyph::YShort) + { + prgnY[iFlag] = *pbGlyph; + if (!(prgbFlag[iFlag] & SimpleGlyph::YIsPos)) + { + prgnY[iFlag] = -prgnY[iFlag]; + } + pbGlyph++; + } + else + { + if (prgbFlag[iFlag] & SimpleGlyph::YIsSame) + { + prgnY[iFlag] = 0; + // do NOT increment pbGlyph + } + else + { + prgnY[iFlag] = read(*(const int16 *)pbGlyph); + pbGlyph += sizeof(int16); + } + } + iFlag++; + } + + cnPoints = cPts; + return true; +} + +/*---------------------------------------------------------------------------------------------- + Fill prgnCompId with the component Glyph IDs from pSimpleGlyf. + Client must allocate space before calling. + pSimpleGlyf - assumed to point to a composite glyph + cCompIdTotal - the number of elements in prgnCompId + cCompId - the total number of Glyph IDs stored in prgnCompId + Return true if successful, false otherwise + False could indicate a non-composite glyph or the input array was not big enough +----------------------------------------------------------------------------------------------*/ +bool GetComponentGlyphIds(const void * pSimpleGlyf, int * prgnCompId, + size_t cnCompIdTotal, size_t & cnCompId) +{ + using namespace Sfnt; + + if (GlyfContourCount(pSimpleGlyf) >= 0) + return false; + + const Sfnt::SimpleGlyph * pGlyph = reinterpret_cast(pSimpleGlyf); + // for a composite glyph, the special data begins here + const uint8 * pbGlyph = reinterpret_cast(&pGlyph->end_pts_of_contours[0]); + + uint16 GlyphFlags; + size_t iCurrentComp = 0; + do + { + GlyphFlags = read(*((const uint16 *)pbGlyph)); + pbGlyph += sizeof(uint16); + prgnCompId[iCurrentComp++] = read(*((const uint16 *)pbGlyph)); + pbGlyph += sizeof(uint16); + if (iCurrentComp >= cnCompIdTotal) + return false; + int nOffset = 0; + nOffset += GlyphFlags & CompoundGlyph::Arg1Arg2Words ? 4 : 2; + nOffset += GlyphFlags & CompoundGlyph::HaveScale ? 2 : 0; + nOffset += GlyphFlags & CompoundGlyph::HaveXAndYScale ? 4 : 0; + nOffset += GlyphFlags & CompoundGlyph::HaveTwoByTwo ? 8 : 0; + pbGlyph += nOffset; + } while (GlyphFlags & CompoundGlyph::MoreComponents); + + cnCompId = iCurrentComp; + + return true; +} + +/*---------------------------------------------------------------------------------------------- + Return info on how a component glyph is to be placed + pSimpleGlyph - assumed to point to a composite glyph + nCompId - glyph id for component of interest + bOffset - if true, a & b are the x & y offsets for this component + if false, b is the point on this component that is attaching to point a on the + preceding glyph + Return true if successful, false otherwise + False could indicate a non-composite glyph or that component wasn't found +----------------------------------------------------------------------------------------------*/ +bool GetComponentPlacement(const void * pSimpleGlyf, int nCompId, + bool fOffset, int & a, int & b) +{ + using namespace Sfnt; + + if (GlyfContourCount(pSimpleGlyf) >= 0) + return false; + + const Sfnt::SimpleGlyph * pGlyph = reinterpret_cast(pSimpleGlyf); + // for a composite glyph, the special data begins here + const uint8 * pbGlyph = reinterpret_cast(&pGlyph->end_pts_of_contours[0]); + + uint16 GlyphFlags; + do + { + GlyphFlags = read(*((const uint16 *)pbGlyph)); + pbGlyph += sizeof(uint16); + if (read(*((const uint16 *)pbGlyph)) == nCompId) + { + pbGlyph += sizeof(uint16); // skip over glyph id of component + fOffset = (GlyphFlags & CompoundGlyph::ArgsAreXYValues) == CompoundGlyph::ArgsAreXYValues; + + if (GlyphFlags & CompoundGlyph::Arg1Arg2Words ) + { + a = read(*(const int16 *)pbGlyph); + pbGlyph += sizeof(int16); + b = read(*(const int16 *)pbGlyph); + pbGlyph += sizeof(int16); + } + else + { // args are signed bytes + a = *pbGlyph++; + b = *pbGlyph++; + } + return true; + } + pbGlyph += sizeof(uint16); // skip over glyph id of component + int nOffset = 0; + nOffset += GlyphFlags & CompoundGlyph::Arg1Arg2Words ? 4 : 2; + nOffset += GlyphFlags & CompoundGlyph::HaveScale ? 2 : 0; + nOffset += GlyphFlags & CompoundGlyph::HaveXAndYScale ? 4 : 0; + nOffset += GlyphFlags & CompoundGlyph::HaveTwoByTwo ? 8 : 0; + pbGlyph += nOffset; + } while (GlyphFlags & CompoundGlyph::MoreComponents); + + // didn't find requested component + fOffset = true; + a = 0; + b = 0; + return false; +} + +/*---------------------------------------------------------------------------------------------- + Return info on how a component glyph is to be transformed + pSimpleGlyph - assumed to point to a composite glyph + nCompId - glyph id for component of interest + flt11, flt11, flt11, flt11 - a 2x2 matrix giving the transform + bTransOffset - whether to transform the offset from above method + The spec is unclear about the meaning of this flag + Currently - initialize to true for MS rasterizer and false for Mac rasterizer, then + on return it will indicate whether transform should apply to offset (MSDN CD 10/99) + Return true if successful, false otherwise + False could indicate a non-composite glyph or that component wasn't found +----------------------------------------------------------------------------------------------*/ +bool GetComponentTransform(const void * pSimpleGlyf, int nCompId, + float & flt11, float & flt12, float & flt21, float & flt22, + bool & fTransOffset) +{ + using namespace Sfnt; + + if (GlyfContourCount(pSimpleGlyf) >= 0) + return false; + + const Sfnt::SimpleGlyph * pGlyph = reinterpret_cast(pSimpleGlyf); + // for a composite glyph, the special data begins here + const uint8 * pbGlyph = reinterpret_cast(&pGlyph->end_pts_of_contours[0]); + + uint16 GlyphFlags; + do + { + GlyphFlags = read(*((const uint16 *)pbGlyph)); + pbGlyph += sizeof(uint16); + if (read(*((const uint16 *)pbGlyph)) == nCompId) + { + pbGlyph += sizeof(uint16); // skip over glyph id of component + pbGlyph += GlyphFlags & CompoundGlyph::Arg1Arg2Words ? 4 : 2; // skip over placement data + + if (fTransOffset) // MS rasterizer + fTransOffset = !(GlyphFlags & CompoundGlyph::UnscaledOffset); + else // Apple rasterizer + fTransOffset = (GlyphFlags & CompoundGlyph::ScaledOffset) != 0; + + if (GlyphFlags & CompoundGlyph::HaveScale) + { + flt11 = fixed_to_float<14>(read(*(const uint16 *)pbGlyph)); + pbGlyph += sizeof(uint16); + flt12 = 0; + flt21 = 0; + flt22 = flt11; + } + else if (GlyphFlags & CompoundGlyph::HaveXAndYScale) + { + flt11 = fixed_to_float<14>(read(*(const uint16 *)pbGlyph)); + pbGlyph += sizeof(uint16); + flt12 = 0; + flt21 = 0; + flt22 = fixed_to_float<14>(read(*(const uint16 *)pbGlyph)); + pbGlyph += sizeof(uint16); + } + else if (GlyphFlags & CompoundGlyph::HaveTwoByTwo) + { + flt11 = fixed_to_float<14>(read(*(const uint16 *)pbGlyph)); + pbGlyph += sizeof(uint16); + flt12 = fixed_to_float<14>(read(*(const uint16 *)pbGlyph)); + pbGlyph += sizeof(uint16); + flt21 = fixed_to_float<14>(read(*(const uint16 *)pbGlyph)); + pbGlyph += sizeof(uint16); + flt22 = fixed_to_float<14>(read(*(const uint16 *)pbGlyph)); + pbGlyph += sizeof(uint16); + } + else + { // identity transform + flt11 = 1.0; + flt12 = 0.0; + flt21 = 0.0; + flt22 = 1.0; + } + return true; + } + pbGlyph += sizeof(uint16); // skip over glyph id of component + int nOffset = 0; + nOffset += GlyphFlags & CompoundGlyph::Arg1Arg2Words ? 4 : 2; + nOffset += GlyphFlags & CompoundGlyph::HaveScale ? 2 : 0; + nOffset += GlyphFlags & CompoundGlyph::HaveXAndYScale ? 4 : 0; + nOffset += GlyphFlags & CompoundGlyph::HaveTwoByTwo ? 8 : 0; + pbGlyph += nOffset; + } while (GlyphFlags & CompoundGlyph::MoreComponents); + + // didn't find requested component + fTransOffset = false; + flt11 = 1; + flt12 = 0; + flt21 = 0; + flt22 = 1; + return false; +} + +/*---------------------------------------------------------------------------------------------- + Return a pointer into the glyf table based on the given tables and Glyph ID + Since this method doesn't check for spaces, it is good to call IsSpace before using it. + Return NULL on error. +----------------------------------------------------------------------------------------------*/ +void * GlyfLookup(gr::gid16 nGlyphId, const void * pGlyf, const void * pLoca, + size_t lLocaSize, const void * pHead) +{ + // test for valid glyph id + // CheckTable verifies the index_to_loc_format is valid + + const Sfnt::FontHeader * pTable + = reinterpret_cast(pHead); + + if (read(pTable->index_to_loc_format) == Sfnt::FontHeader::ShortIndexLocFormat) + { // loca entries are two bytes (and have been divided by two) + if (nGlyphId >= (lLocaSize >> 1) - 1) // don't allow nGlyphId to access sentinel + throw std::out_of_range("glyph id out of range for font"); + } + if (read(pTable->index_to_loc_format) == Sfnt::FontHeader::LongIndexLocFormat) + { // loca entries are four bytes + if (nGlyphId >= (lLocaSize >> 2) - 1) + throw std::out_of_range("glyph id out of range for font"); + } + + long lGlyfOffset = LocaLookup(nGlyphId, pLoca, lLocaSize, pHead); + void * pSimpleGlyf = GlyfLookup(pGlyf, lGlyfOffset); // invalid loca offset returns null + return pSimpleGlyf; +} + +/*---------------------------------------------------------------------------------------------- + Determine if a particular Glyph ID has any data in the glyf table. If it is white space, + there will be no glyf data, though there will be metric data in hmtx, etc. +----------------------------------------------------------------------------------------------*/ +bool IsSpace(gr::gid16 nGlyphId, const void * pLoca, size_t lLocaSize, const void * pHead) +{ + size_t lGlyfOffset = LocaLookup(nGlyphId, pLoca, lLocaSize, pHead); + + // the +1 should always work because there is a sentinel value at the end of the loca table + size_t lNextGlyfOffset = LocaLookup(nGlyphId + 1, pLoca, lLocaSize, pHead); + + return (lNextGlyfOffset - lGlyfOffset) == 0; +} + +/*---------------------------------------------------------------------------------------------- + Determine if a particular Glyph ID is a multi-level composite. +----------------------------------------------------------------------------------------------*/ +bool IsDeepComposite(gr::gid16 nGlyphId, const void * pGlyf, const void * pLoca, + long lLocaSize, const void * pHead) +{ + if (IsSpace(nGlyphId, pLoca, lLocaSize, pHead)) {return false;} + + void * pSimpleGlyf = GlyfLookup(nGlyphId, pGlyf, pLoca, lLocaSize, pHead); + if (pSimpleGlyf == NULL) + return false; // no way to really indicate an error occured here + + if (GlyfContourCount(pSimpleGlyf) >= 0) + return false; + + int rgnCompId[kMaxGlyphComponents]; // assumes only a limited number of glyph components + size_t cCompIdTotal = kMaxGlyphComponents; + size_t cCompId = 0; + + if (!GetComponentGlyphIds(pSimpleGlyf, rgnCompId, cCompIdTotal, cCompId)) + return false; + + for (size_t i = 0; i < cCompId; i++) + { + pSimpleGlyf = GlyfLookup(static_cast(rgnCompId[i]), + pGlyf, pLoca, lLocaSize, pHead); + if (pSimpleGlyf == NULL) {return false;} + + if (GlyfContourCount(pSimpleGlyf) < 0) + return true; + } + + return false; +} + +/*---------------------------------------------------------------------------------------------- + Get the bounding box coordinates based on the given tables and Glyph ID + Handles both simple and composite glyphs. + Return true if successful, false otherwise. On false, all point values will be INT_MIN + False may indicate a white space glyph +----------------------------------------------------------------------------------------------*/ +bool GlyfBox(gr::gid16 nGlyphId, const void * pGlyf, const void * pLoca, + size_t lLocaSize, const void * pHead, int & xMin, int & yMin, int & xMax, int & yMax) +{ + xMin = yMin = xMax = yMax = INT_MIN; + + if (IsSpace(nGlyphId, pLoca, lLocaSize, pHead)) {return false;} + + void * pSimpleGlyf = GlyfLookup(nGlyphId, pGlyf, pLoca, lLocaSize, pHead); + if (pSimpleGlyf == NULL) {return false;} + + return GlyfBox(pSimpleGlyf, xMin, yMin, xMax, yMax); +} + +/*---------------------------------------------------------------------------------------------- + Get the number of contours based on the given tables and Glyph ID + Handles both simple and composite glyphs. + Return true if successful, false otherwise. On false, cnContours will be INT_MIN + False may indicate a white space glyph or a multi-level composite glyph. +----------------------------------------------------------------------------------------------*/ +bool GlyfContourCount(gr::gid16 nGlyphId, const void * pGlyf, const void * pLoca, + size_t lLocaSize, const void * pHead, size_t & cnContours) +{ + cnContours = static_cast(INT_MIN); + + if (IsSpace(nGlyphId, pLoca, lLocaSize, pHead)) {return false;} + + void * pSimpleGlyf = GlyfLookup(nGlyphId, pGlyf, pLoca, lLocaSize, pHead); + if (pSimpleGlyf == NULL) {return false;} + + int cRtnContours = GlyfContourCount(pSimpleGlyf); + if (cRtnContours >= 0) + { + cnContours = size_t(cRtnContours); + return true; + } + + //handle composite glyphs + + int rgnCompId[kMaxGlyphComponents]; // assumes no glyph will be made of more than 8 components + size_t cCompIdTotal = kMaxGlyphComponents; + size_t cCompId = 0; + + if (!GetComponentGlyphIds(pSimpleGlyf, rgnCompId, cCompIdTotal, cCompId)) + return false; + + cRtnContours = 0; + int cTmp = 0; + for (size_t i = 0; i < cCompId; i++) + { + if (IsSpace(static_cast(rgnCompId[i]), pLoca, lLocaSize, pHead)) {return false;} + pSimpleGlyf = GlyfLookup(static_cast(rgnCompId[i]), + pGlyf, pLoca, lLocaSize, pHead); + if (pSimpleGlyf == 0) {return false;} + // return false on multi-level composite + if ((cTmp = GlyfContourCount(pSimpleGlyf)) < 0) + return false; + cRtnContours += cTmp; + } + + cnContours = size_t(cRtnContours); + return true; +} + +/*---------------------------------------------------------------------------------------------- + Get the point numbers for the end points of the glyph contours based on the given tables + and Glyph ID + Handles both simple and composite glyphs. + cnPoints - count of contours from GlyfContourCount (same as number of end points) + prgnContourEndPoints - should point to a buffer large enough to hold cnPoints integers + Return true if successful, false otherwise. On false, all end points are INT_MIN + False may indicate a white space glyph or a multi-level composite glyph. +----------------------------------------------------------------------------------------------*/ +bool GlyfContourEndPoints(gr::gid16 nGlyphId, const void * pGlyf, const void * pLoca, + size_t lLocaSize, const void * pHead, + int * prgnContourEndPoint, size_t cnPoints) +{ + std::fill_n(prgnContourEndPoint, cnPoints, INT_MIN); + + if (IsSpace(nGlyphId, pLoca, lLocaSize, pHead)) {return false;} + + void * pSimpleGlyf = GlyfLookup(nGlyphId, pGlyf, pLoca, lLocaSize, pHead); + if (pSimpleGlyf == NULL) {return false;} + + int cContours = GlyfContourCount(pSimpleGlyf); + int cActualPts = 0; + if (cContours > 0) + return GlyfContourEndPoints(pSimpleGlyf, prgnContourEndPoint, cnPoints, cActualPts); + + // handle composite glyphs + + int rgnCompId[kMaxGlyphComponents]; // assumes no glyph will be made of more than 8 components + size_t cCompIdTotal = kMaxGlyphComponents; + size_t cCompId = 0; + + if (!GetComponentGlyphIds(pSimpleGlyf, rgnCompId, cCompIdTotal, cCompId)) + return false; + + int * prgnCurrentEndPoint = prgnContourEndPoint; + int cCurrentPoints = cnPoints; + int nPrevPt = 0; + for (size_t i = 0; i < cCompId; i++) + { + if (IsSpace(static_cast(rgnCompId[i]), pLoca, lLocaSize, pHead)) {return false;} + pSimpleGlyf = GlyfLookup(static_cast(rgnCompId[i]), pGlyf, pLoca, lLocaSize, pHead); + if (pSimpleGlyf == NULL) {return false;} + // returns false on multi-level composite + if (!GlyfContourEndPoints(pSimpleGlyf, prgnCurrentEndPoint, cCurrentPoints, cActualPts)) + return false; + // points in composite are numbered sequentially as components are added + // must adjust end point numbers for new point numbers + for (int j = 0; j < cActualPts; j++) + prgnCurrentEndPoint[j] += nPrevPt; + nPrevPt = prgnCurrentEndPoint[cActualPts - 1] + 1; + + prgnCurrentEndPoint += cActualPts; + cCurrentPoints -= cActualPts; + } + + return true; +} + +/*---------------------------------------------------------------------------------------------- + Get the points for a glyph based on the given tables and Glyph ID + Handles both simple and composite glyphs. + cnPoints - count of points from largest end point obtained from GlyfContourEndPoints + prgnX & prgnY - should point to buffers large enough to hold cnPoints integers + The ranges are parallel so that coordinates for point(n) are found at offset n in + both ranges. These points are in absolute coordinates. + prgfOnCurve - should point to a buffer a large enough to hold cnPoints bytes (bool) + This range is parallel to the prgnX & prgnY + Return true if successful, false otherwise. On false, all points may be INT_MIN + False may indicate a white space glyph, a multi-level composite, or a corrupt font + // TODO: doesn't support composite glyphs whose components are themselves components + It's not clear from the TTF spec when the transforms should be applied. Should the + transform be done before or after attachment point calcs? (current code - before) + Should the transform be applied to other offsets? (currently - no; however commented + out code is in place so that if CompoundGlyph::UnscaledOffset on the MS rasterizer is + clear (typical) then yes, and if CompoundGlyph::ScaledOffset on the Apple rasterizer is + clear (typical?) then no). See GetComponentTransform. + It's also unclear where point numbering with attachment poinst starts + (currently - first point number is relative to whole glyph, second point number is + relative to current glyph). +----------------------------------------------------------------------------------------------*/ +bool GlyfPoints(gr::gid16 nGlyphId, const void * pGlyf, + const void * pLoca, size_t lLocaSize, const void * pHead, + const int * /*prgnContourEndPoint*/, size_t /*cnEndPoints*/, + int * prgnX, int * prgnY, bool * prgfOnCurve, size_t cnPoints) +{ + std::fill_n(prgnX, cnPoints, INT_MAX); + std::fill_n(prgnY, cnPoints, INT_MAX); + + if (IsSpace(nGlyphId, pLoca, lLocaSize, pHead)) + return false; + + void * pSimpleGlyf = GlyfLookup(nGlyphId, pGlyf, pLoca, lLocaSize, pHead); + if (pSimpleGlyf == NULL) + return false; + + int cContours = GlyfContourCount(pSimpleGlyf); + int cActualPts; + if (cContours > 0) + { + if (!GlyfPoints(pSimpleGlyf, prgnX, prgnY, (char *)prgfOnCurve, cnPoints, cActualPts)) + return false; + CalcAbsolutePoints(prgnX, prgnY, cnPoints); + SimplifyFlags((char *)prgfOnCurve, cnPoints); + return true; + } + + // handle composite glyphs + int rgnCompId[kMaxGlyphComponents]; // assumes no glyph will be made of more than 8 components + size_t cCompIdTotal = kMaxGlyphComponents; + size_t cCompId = 0; + + // this will fail if there are more components than there is room for + if (!GetComponentGlyphIds(pSimpleGlyf, rgnCompId, cCompIdTotal, cCompId)) + return false; + + int * prgnCurrentX = prgnX; + int * prgnCurrentY = prgnY; + char * prgbCurrentFlag = (char *)prgfOnCurve; // converting bool to char should be safe + int cCurrentPoints = cnPoints; + bool fOffset = true, fTransOff = true; + int a, b; + float flt11, flt12, flt21, flt22; + // int * prgnPrevX = prgnX; // in case first att pt number relative to preceding glyph + // int * prgnPrevY = prgnY; + for (size_t i = 0; i < cCompId; i++) + { + if (IsSpace(static_cast(rgnCompId[i]), pLoca, lLocaSize, pHead)) {return false;} + void * pCompGlyf = GlyfLookup(static_cast(rgnCompId[i]), pGlyf, pLoca, lLocaSize, pHead); + if (pCompGlyf == NULL) {return false;} + // returns false on multi-level composite + if (!GlyfPoints(pCompGlyf, prgnCurrentX, prgnCurrentY, prgbCurrentFlag, + cCurrentPoints, cActualPts)) + return false; + if (!GetComponentPlacement(pSimpleGlyf, rgnCompId[i], fOffset, a, b)) + return false; + if (!GetComponentTransform(pSimpleGlyf, rgnCompId[i], + flt11, flt12, flt21, flt22, fTransOff)) + return false; + bool fIdTrans = flt11 == 1.0 && flt12 == 0.0 && flt21 == 0.0 && flt22 == 1.0; + + // convert points to absolute coordinates + // do before transform and attachment point placement are applied + CalcAbsolutePoints(prgnCurrentX, prgnCurrentY, cActualPts); + + // apply transform - see main method note above + // do before attachment point calcs + if (!fIdTrans) + for (int j = 0; j < cActualPts; j++) + { + int x = prgnCurrentX[j]; // store before transform applied + int y = prgnCurrentY[j]; + prgnCurrentX[j] = (int)(x * flt11 + y * flt12); + prgnCurrentY[j] = (int)(x * flt21 + y * flt22); + } + + // apply placement - see main method note above + int nXOff, nYOff; + if (fOffset) // explicit x & y offsets + { + /* ignore fTransOff for now + if (fTransOff && !fIdTrans) + { // transform x & y offsets + nXOff = (int)(a * flt11 + b * flt12); + nYOff = (int)(a * flt21 + b * flt22); + } + else */ + { // don't transform offset + nXOff = a; + nYOff = b; + } + } + else // attachment points + { // in case first point is relative to preceding glyph and second relative to current + // nXOff = prgnPrevX[a] - prgnCurrentX[b]; + // nYOff = prgnPrevY[a] - prgnCurrentY[b]; + // first point number relative to whole composite, second relative to current glyph + nXOff = prgnX[a] - prgnCurrentX[b]; + nYOff = prgnY[a] - prgnCurrentY[b]; + } + for (int j = 0; j < cActualPts; j++) + { + prgnCurrentX[j] += nXOff; + prgnCurrentY[j] += nYOff; + } + + // prgnPrevX = prgnCurrentX; + // prgnPrevY = prgnCurrentY; + prgnCurrentX += cActualPts; + prgnCurrentY += cActualPts; + prgbCurrentFlag += cActualPts; + cCurrentPoints -= cActualPts; + } + + SimplifyFlags((char *)prgfOnCurve, cnPoints); + + return true; +} + +/*---------------------------------------------------------------------------------------------- + Simplify the meaning of flags to just indicate whether point is on-curve or off-curve. +---------------------------------------------------------------------------------------------*/ +bool SimplifyFlags(char * prgbFlags, int cnPoints) +{ + for (int i = 0; i < cnPoints; i++) + prgbFlags[i] = static_cast(prgbFlags[i] & Sfnt::SimpleGlyph::OnCurve); + return true; +} + +/*---------------------------------------------------------------------------------------------- + Convert relative point coordinates to absolute coordinates + Points are stored in the font such that they are offsets from one another except for the + first point of a glyph. +---------------------------------------------------------------------------------------------*/ +bool CalcAbsolutePoints(int * prgnX, int * prgnY, int cnPoints) +{ + int nX = prgnX[0]; + int nY = prgnY[0]; + for (int i = 1; i < cnPoints; i++) + { + prgnX[i] += nX; + nX = prgnX[i]; + prgnY[i] += nY; + nY = prgnY[i]; + } + + return true; +} + +/*---------------------------------------------------------------------------------------------- + Convert a numerical table ID to a string containing the actual name of the table. + Returns native order unsigned long. +---------------------------------------------------------------------------------------------*/ +gr::fontTableId32 TableIdTag(const TableId tid) +{ + assert(sizeof(mapIdToTag) == sizeof(gr::fontTableId32) * ktiLast); + assert(tid < ktiLast); + + return mapIdToTag[tid]; +} + +/*---------------------------------------------------------------------------------------------- + Return the length of the 'name' table in bytes. + Currently used. +---------------------------------------------------------------------------------------------*/ +#if 0 +size_t NameTableLength(const gr::byte * pTable) +{ + gr::byte * pb = (const_cast(pTable)) + 2; // skip format + size_t cRecords = *pb++ << 8; cRecords += *pb++; + int dbStringOffset0 = (*pb++) << 8; dbStringOffset0 += *pb++; + int dbMaxStringOffset = 0; + for (size_t irec = 0; irec < cRecords; irec++) + { + int nPlatform = (*pb++) << 8; nPlatform += *pb++; + int nEncoding = (*pb++) << 8; nEncoding += *pb++; + int nLanguage = (*pb++) << 8; nLanguage += *pb++; + int nName = (*pb++) << 8; nName += *pb++; + int cbStringLen = (*pb++) << 8; cbStringLen += *pb++; + int dbStringOffset = (*pb++) << 8; dbStringOffset += *pb++; + if (dbMaxStringOffset < dbStringOffset + cbStringLen) + dbMaxStringOffset = dbStringOffset + cbStringLen; + } + return dbStringOffset0 + dbMaxStringOffset; +} +#endif + +} // end of namespace TtfUtil diff --git a/Build/source/libs/graphite/engine-2.4/src/font/TtfUtil.h b/Build/source/libs/graphite/engine-2.4/src/font/TtfUtil.h new file mode 100644 index 00000000000..2e8023f4a18 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/src/font/TtfUtil.h @@ -0,0 +1,153 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 2000, 2001 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: TtfUtil.h +Responsibility: Alan Ward +Last reviewed: Not yet. + +Description: + Utility class for handling TrueType font files. +----------------------------------------------------------------------------------------------*/ + +#ifdef _MSC_VER +#pragma once +#endif +#ifndef TTFUTIL_H +#define TTFUTIL_H + +// I don't know why I need to duplicate these there when they are in GrPlatform.h: +#ifdef _MSC_VER +#pragma warning(disable: 4127) // conditional expression is constant +#pragma warning(disable: 4290) // exception specification ignored. +#endif + +#include +#include +#include "GrPlatform.h" + +// Enumeration used to specify a table in a TTF file +enum TableId +{ + ktiCmap, ktiCvt, ktiCryp, ktiHead, ktiFpgm, ktiGdir, ktiGlyf, + ktiHdmx, ktiHhea, ktiHmtx, ktiLoca, ktiKern, ktiLtsh, ktiMaxp, + ktiName, ktiOs2, ktiPost, ktiPrep, ktiFeat, ktiGlat, ktiGloc, + ktiSilf, ktiSile, ktiSill, + ktiLast /*This gives the enum length - it is not a real table*/ +}; + +/*---------------------------------------------------------------------------------------------- + Class providing utility methods to parse a TrueType font file (TTF). + Callling application handles all file input and memory allocation. + Assumes minimal knowledge of TTF file format. +----------------------------------------------------------------------------------------------*/ +namespace TtfUtil +{ + ////////////////////////////////// tools to find & check TTF tables + bool GetHeaderInfo(size_t & lOffset, size_t & lSize); + bool CheckHeader(const void * pHdr); + bool GetTableDirInfo(const void * pHdr, size_t & lOffset, size_t & lSize); + bool GetTableInfo(TableId ktiTableId, const void * pHdr, const void * pTableDir, + size_t & lOffset, size_t & lSize); + bool CheckTable(TableId ktiTableId, const void * pTable, size_t lTableSize); + + ////////////////////////////////// simple font wide info + size_t GlyphCount(const void * pMaxp); + size_t MaxCompositeComponentCount(const void * pMaxp); + size_t MaxCompositeLevelCount(const void * pMaxp); + size_t LocaGlyphCount(size_t lLocaSize, const void * pHead) throw (std::domain_error); + int DesignUnits(const void * pHead); + int HeadTableCheckSum(const void * pHead); + void HeadTableCreateTime(const void * pHead, unsigned int * pnDateBC, unsigned int * pnDateAD); + void HeadTableModifyTime(const void * pHead, unsigned int * pnDateBC, unsigned int * pnDateAD); + bool IsItalic(const void * pHead); + int FontAscent(const void * pOs2); + int FontDescent(const void * pOs2); + bool FontOs2Style(const void *pOs2, bool & fBold, bool & fItalic); + bool Get31EngFamilyInfo(const void * pName, size_t & lOffset, size_t & lSize); + bool Get31EngFullFontInfo(const void * pName, size_t & lOffset, size_t & lSize); + bool Get30EngFamilyInfo(const void * pName, size_t & lOffset, size_t & lSize); + bool Get30EngFullFontInfo(const void * pName, size_t & lOffset, size_t & lSize); + int PostLookup(const void * pPost, size_t lPostSize, const void * pMaxp, + const char * pPostName); + + ////////////////////////////////// utility methods helpful for name table + bool GetNameInfo(const void * pName, int nPlatformId, int nEncodingId, + int nLangId, int nNameId, size_t & lOffset, size_t & lSize); + //size_t NameTableLength(const gr::byte * pTable); + int GetLangsForNames(const void * pName, int nPlatformId, int nEncodingId, + int *nameIdList, int cNameIds, short *langIdList); + void SwapWString(void * pWStr, size_t nSize = 0) throw (std::invalid_argument); + + ////////////////////////////////// cmap lookup tools + void * FindCmapSubtable(const void * pCmap, int nPlatformId = 3, + int nEncodingId = 1); + bool CheckCmap31Subtable(const void * pCmap31); + gr::gid16 Cmap31Lookup(const void * pCmap31, int nUnicodeId); + unsigned int Cmap31NextCodepoint(const void *pCmap31, unsigned int nUnicodeId, + int * pRangeKey = 0); + bool CheckCmap310Subtable(const void *pCmap310); + gr::gid16 Cmap310Lookup(const void * pCmap310, unsigned int uUnicodeId); + unsigned int Cmap310NextCodepoint(const void *pCmap310, unsigned int nUnicodeId, + int * pRangeKey = 0); + + ///////////////////////////////// horizontal metric data for a glyph + bool HorMetrics(gr::gid16 nGlyphId, const void * pHmtx, size_t lHmtxSize, + const void * pHhea, int & nLsb, unsigned int & nAdvWid); + + ///////////////////////////////// convert our TableId enum to standard TTF tags + gr::fontTableId32 TableIdTag(const TableId); + + ////////////////////////////////// primitives for loca and glyf lookup + size_t LocaLookup(gr::gid16 nGlyphId, const void * pLoca, size_t lLocaSize, + const void * pHead) throw (std::out_of_range); + void * GlyfLookup(const void * pGlyf, size_t lGlyfOffset); + + ////////////////////////////////// primitves for simple glyph data + bool GlyfBox(const void * pSimpleGlyf, int & xMin, int & yMin, + int & xMax, int & yMax); + + int GlyfContourCount(const void * pSimpleGlyf); + bool GlyfContourEndPoints(const void * pSimpleGlyf, int * prgnContourEndPoint, + int cnPointsTotal, size_t & cnPoints); + bool GlyfPoints(const void * pSimpleGlyf, int * prgnX, int * prgnY, + char * prgbFlag, int cnPointsTotal, int & cnPoints); + + // primitive to find the glyph ids in a composite glyph + bool GetComponentGlyphIds(const void * pSimpleGlyf, int * prgnCompId, + size_t cnCompIdTotal, size_t & cnCompId); + // primitive to find the placement data for a component in a composite glyph + bool GetComponentPlacement(const void * pSimpleGlyf, int nCompId, + bool fOffset, int & a, int & b); + // primitive to find the transform data for a component in a composite glyph + bool GetComponentTransform(const void * pSimpleGlyf, int nCompId, + float & flt11, float & flt12, float & flt21, float & flt22, bool & fTransOffset); + + ////////////////////////////////// operate on composite or simple glyph (auto glyf lookup) + void * GlyfLookup(gr::gid16 nGlyphId, const void * pGlyf, const void * pLoca, + size_t lLocaSize, const void * pHead); // primitive used by below methods + + // below are primary user methods for handling glyf data + bool IsSpace(gr::gid16 nGlyphId, const void * pLoca, size_t lLocaSize, const void * pHead); + bool IsDeepComposite(gr::gid16 nGlyphId, const void * pGlyf, const void * pLoca, + size_t lLocaSize, const void * pHead); + + bool GlyfBox(gr::gid16 nGlyphId, const void * pGlyf, const void * pLoca, size_t lLocaSize, + const void * pHead, int & xMin, int & yMin, int & xMax, int & yMax); + bool GlyfContourCount(gr::gid16 nGlyphId, const void * pGlyf, const void * pLoca, + size_t lLocaSize, const void *pHead, size_t & cnContours); + bool GlyfContourEndPoints(gr::gid16 nGlyphId, const void * pGlyf, const void * pLoca, + size_t lLocaSize, const void * pHead, int * prgnContourEndPoint, size_t cnPoints); + bool GlyfPoints(gr::gid16 nGlyphId, const void * pGlyf, const void * pLoca, + size_t lLocaSize, const void * pHead, const int * prgnContourEndPoint, size_t cnEndPoints, + int * prgnX, int * prgnY, bool * prgfOnCurve, size_t cnPoints); + + // utitily method used by high-level GlyfPoints + bool SimplifyFlags(char * prgbFlags, int cnPoints); + bool CalcAbsolutePoints(int * prgnX, int * prgnY, int cnPoints); + +} // end of namespace TtfUtil + +#endif diff --git a/Build/source/libs/graphite/engine-2.4/src/generic/BinTree.h b/Build/source/libs/graphite/engine-2.4/src/generic/BinTree.h new file mode 100644 index 00000000000..a487df03770 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/src/generic/BinTree.h @@ -0,0 +1,71 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 1999, 2001 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: BinTree.h +Responsibility: Darrell Zook +Last reviewed: 9/8/99 + +Description: + This file provides declarations of binary tree class(es). +----------------------------------------------------------------------------------------------*/ +#ifdef _MSC_VER +#pragma once +#endif +#ifndef BINTREE_H_INCLUDED +#define BINTREE_H_INCLUDED + +/*---------------------------------------------------------------------------------------------- + This template class implements a balanced tree, which is a binary tree where the height of + the two children of any node in the tree can only be different by +/- 1 or 0. + + The class of objects to be stored in the tree should be derived from BalTreeBase, because + the constructor of BalTreeBase adds an object to the tree in sorted order without + allocating any memory. + + Classes that derive from BalTreeBase must have a CompareKey member function that compares + a given key with this->key to determine which should be first when sorting the tree. + The declaration of CompareKey should be as follows: + int CompareKey(const Key & key); + and it should return: + <0 if key is less than the key in the current node (this->key) + 0 if key is equal to the key in the current node (this->key) + >0 if key is greater than the key in the current node (this->key) + + CAUTION: Classes that use this template should never be dynamically instantiated (by using + local variables or new/NewObj). This class is meant to be used only for global + instances of a class. The reason for this restriction is that the tree is never + destroyed, so using dynamic instantiations of objects would result in stale pointers + in the tree. + + Hungarian: btb +----------------------------------------------------------------------------------------------*/ + +template class BalTreeBase +{ +protected: + // Pointers to the left and right subtrees. + Obj * m_rgpobj[2]; + + // The difference between the height of the right sub tree and the height of the left + // sub tree. This should be -1, 0, or +1. Insert may temporarily set it to -2 or +2. + short m_dht; + + // Which way we went from this node when inserting the new node. + short m_ipobj; + + // Inserts this in the balanced tree. + BalTreeBase(Obj ** ppobjRoot, const Key & key); + + // Returns a node with the given key from the tree rooted at pobjRoot. + static Obj * Find(Obj * pobjRoot, const Key & key); + +private: + // Inserts a node in the tree rooted at *ppobjRoot, sorting it based on key. + void Insert(Obj ** ppobjRoot, const Key & key); +}; + +#endif // !BINTREE_H_INCLUDED + diff --git a/Build/source/libs/graphite/engine-2.4/src/generic/BinTree_i.cpp b/Build/source/libs/graphite/engine-2.4/src/generic/BinTree_i.cpp new file mode 100644 index 00000000000..5929bf0bab1 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/src/generic/BinTree_i.cpp @@ -0,0 +1,225 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 1999, 2001 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: BinTree_i.cpp +Responsibility: Darrell Zook +Last reviewed: 9/8/99 + +Description: + This file provides implementations of binary tree class(es). + It is used as an #include file in any file which derives from one of the classes. +----------------------------------------------------------------------------------------------*/ +#ifdef _MSC_VER +#pragma once +#endif +#ifndef BINTREE_I_CPP_INCLUDED +#define BINTREE_I_CPP_INCLUDED + +#include "BinTree.h" +////#include +////#include "GrPlatform.h" +#include "GrCommon.h" + + +//using namespace gr; + +/*********************************************************************************************** + BalTreeBase methods +***********************************************************************************************/ + +/*---------------------------------------------------------------------------------------------- + Constructor. + This calls Insert to add this node to the tree in the correct (sorted) position. + + Arguments: + [in] ppobjRoot -> The address of the pointer to the root node of the tree. + [in] key -> References the key of the node to insert. +----------------------------------------------------------------------------------------------*/ +template + BalTreeBase::BalTreeBase(Obj ** ppobjRoot, const Key & key) +{ + AssertPtr(ppobjRoot); + AssertPtrN(*ppobjRoot); + + m_rgpobj[0] = NULL; + m_rgpobj[1] = NULL; + m_dht = 0; + + Insert(ppobjRoot, key); +} + +/*---------------------------------------------------------------------------------------------- + This method finds a node with the given key within the tree. If the key is not found in + the tree, NULL is returned. + + Arguments: + [in] pobjRoot -> Points to the root node of the tree. + [in] key -> References the key of the node to search for. +----------------------------------------------------------------------------------------------*/ +template + Obj * BalTreeBase::Find(Obj * pobjRoot, const Key & key) +{ + AssertPtrN(pobjRoot); + + for (Obj * pobj = pobjRoot; pobj; ) + { + int nT = pobj->CompareKey(key); + if (0 == nT) + return pobj; + pobj = pobj->m_rgpobj[nT > 0]; + } + return NULL; +} + +/*---------------------------------------------------------------------------------------------- + This method inserts a node within the tree, sorting it based on key. It does not allocate + any memory. + + Arguments: + [in] ppobjRoot -> The address of the pointer to the root node of the tree. + [in] key -> References the key of the node to insert into the tree. + Note: "this" is the node that is being inserted into the tree. +----------------------------------------------------------------------------------------------*/ +template + void BalTreeBase::Insert(Obj ** ppobjRoot, const Key & key) +{ + AssertPtr(ppobjRoot); + AssertPtrN(*ppobjRoot); + + Assert(m_dht == 0); + Assert(!m_rgpobj[0]); + Assert(!m_rgpobj[1]); + + Obj * pobjThis = static_cast(this); + + // If the tree is empty, set the root of the tree to this and return. + if (!*ppobjRoot) + { + *ppobjRoot = pobjThis; + return; + } + + Obj ** ppobjRebal = ppobjRoot; + Obj * pobjCur; + + // Place this in the tree. Mark each node indicating which branch we took. + // Remember the lowest node with non-zero m_dht in ppobjRebal. If we have to do + // rebalancing, this is where we'll do it. + for (pobjCur = *ppobjRoot; ; ) + { + AssertPtr(pobjCur); + + int nT = pobjCur->CompareKey(key); + Assert(nT != 0); + + // if nT is positive go right, otherwise go left. + pobjCur->m_ipobj = nT > 0; + + Obj ** ppobjNext = &pobjCur->m_rgpobj[pobjCur->m_ipobj]; + if (!*ppobjNext) + { + // Place the node and break. + *ppobjNext = pobjThis; + break; + } + + // Remember this location if m_dht is non-zero. + if ((*ppobjNext)->m_dht != 0) + ppobjRebal = ppobjNext; + + // Move on down. + pobjCur = *ppobjNext; + } + + // Adjust m_dht from *ppobjRebal to pobjThis. + for (pobjCur = *ppobjRebal; pobjCur != pobjThis; ) + { + AssertPtr(pobjCur); + Assert((unsigned int)pobjCur->m_ipobj < (unsigned int)2); + + // Recall that ppobjRebal is the lowest node on the path which has non-zero m_dht. + Assert(pobjCur->m_dht == 0 || pobjCur == *ppobjRebal); + + // If we went left (m_ipobj == 0) we need to subtract one. If we went right + // (m_ipobj == 1) we need to add one. + pobjCur->m_dht = (short)(pobjCur->m_dht + (pobjCur->m_ipobj << 1) - 1); + pobjCur = pobjCur->m_rgpobj[pobjCur->m_ipobj]; + } + + if ((unsigned int)((*ppobjRebal)->m_dht + 1) <= (unsigned int)2) + { + // No need to rebalance since the new m_dht for *ppobjRebal is within -1 to 1. + return; + } + + // We need to rebalance. + Obj * pobjRebal = *ppobjRebal; + Assert(pobjRebal->m_dht == -2 || pobjRebal->m_dht == 2); + + // Get the direction from pobjRebal and the next lower node. + int ipobj = pobjRebal->m_ipobj; + Obj * pobjChd = pobjRebal->m_rgpobj[ipobj]; + + if (pobjChd->m_ipobj == ipobj) + { + // We branched the same way at pobjRebal and pobjChd. + // Do a single rotation: make pobjChd the parent of pobjRebal. + Assert(pobjChd->m_dht << 1 == pobjRebal->m_dht); + pobjRebal->m_rgpobj[ipobj] = pobjChd->m_rgpobj[1 - ipobj]; + pobjChd->m_rgpobj[1 - ipobj] = pobjRebal; + *ppobjRebal = pobjChd; + + // Fix the m_dht values. + pobjChd->m_dht = 0; + pobjRebal->m_dht = 0; + return; + } + + // We branched opposite ways at pobjRebal and pobjChd. + // Do a double rotation. + Assert(pobjChd->m_ipobj == 1 - ipobj); + pobjCur = pobjChd->m_rgpobj[1 - ipobj]; + AssertPtr(pobjCur); + + // Let (A own[ipobj] B) mean that A->m_rgpobj[ipobj] == B. + // Currently, (pobjRebal own[ipobj] pobjChd) and (pobjChd own[1 - ipobj] pobjCur). + // Make (pobjCur own[ipobj] pobjChd) and (pobjCur own[1 - ipobj] pobjRebal). + + // Rotate pobjChd and pobjCur. + Assert(pobjCur == pobjChd->m_rgpobj[1 - ipobj]); + pobjChd->m_rgpobj[1 - ipobj] = pobjCur->m_rgpobj[ipobj]; + pobjCur->m_rgpobj[ipobj] = pobjChd; + + // Rotate pobjRebal and pobjCur. + Assert(pobjRebal->m_rgpobj[ipobj] == pobjChd); + pobjRebal->m_rgpobj[ipobj] = pobjCur->m_rgpobj[1 - ipobj]; + pobjCur->m_rgpobj[1 - ipobj] = pobjRebal; + + // Fix *ppobjRebal. + *ppobjRebal = pobjCur; + + // Fix the m_dht values. Note that we don't compare with pobjRebal->m_dht since it + // currently has absolute value 2. + Assert(pobjChd->m_dht); + if (pobjCur->m_dht == pobjChd->m_dht) + { + pobjRebal->m_dht = 0; + pobjChd->m_dht = (short)-pobjChd->m_dht; + } + else if (pobjCur->m_dht == -pobjChd->m_dht) + { + pobjRebal->m_dht = pobjChd->m_dht; + pobjChd->m_dht = 0; + } + else + { + pobjRebal->m_dht = 0; + pobjChd->m_dht = 0; + } + pobjCur->m_dht = 0; +} + +#endif // !BINTREE_I_CPP_INCLUDED diff --git a/Build/source/libs/graphite/engine-2.4/src/generic/Debug.cpp b/Build/source/libs/graphite/engine-2.4/src/generic/Debug.cpp new file mode 100644 index 00000000000..3583a4228af --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/src/generic/Debug.cpp @@ -0,0 +1,81 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 1999, 2001 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: Debug.cpp +Responsibility: Darrell Zook +Last reviewed: Not yet. + +Description: + This file provides the standard debug error functions. +----------------------------------------------------------------------------------------------*/ + +#ifdef _WIN32 +#include +#endif +//#include "common.h" +//#include "Main.h" +#include "GrDebug.h" +#ifdef _MSC_VER +#pragma hdrstop +#endif + +//#include "ModuleEntry.h" +#include +#ifdef _MSC_VER +#include +#endif + + +#if 0 +//#ifdef DEBUG + +extern HMODULE Win32DllGetModuleHandle(); + +void WINAPI AssertProcLocal(const char * pszExp, const char * pszFile, int nLine, + bool fCritical) +{ + AssertProc(pszExp, pszFile, nLine, fCritical, Win32DllGetModuleHandle()); +} + +void WINAPI WarnProcLocal(const char * pszExp, const char * pszFile, int nLine, + bool fCritical) +{ + WarnProc(pszExp, pszFile, nLine, fCritical, Win32DllGetModuleHandle()); +} + +void WINAPI WarnHrProc(HRESULT hr, const char * pszFile, int nLine, bool fCritical) +{ + char szBuffer[MAX_PATH + 25]; + sprintf(szBuffer, "HRESULT[0x%08x]--", hr); + int cch = lstrlen(szBuffer); + FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, hr, 0, szBuffer + cch, + sizeof(szBuffer) - cch, NULL); + szBuffer[max(lstrlen(szBuffer) - 2, 0)] = 0; + WarnProcLocal(szBuffer, pszFile, nLine, fCritical); +} + + +OLECHAR * DebugWatch::WatchNV() +{ + // JT: we need this, otherwise if dealing with a deleted object or null pointer + // we may try to call a virtual function where there is no valid VTABLE pointer. + // In the debugger we can't be sure of not dereferencing a bad pointer. + if (!::_CrtIsValidPointer(this, sizeof(this), TRUE )) + return L"A very bad object pointer"; + // We could also be referencing memory that is trashed (e.g., the object has + // been deleted, or deleted and replaced by something else). + if (!dynamic_cast(this)) + return L"A bad object pointer"; + return Watch(); +} + +void DebugWatch::Output (char *fmt, ...) // LIMITED to 10 pointer-sized arguments +{ + struct args { void * pv[10]; }; + _CrtDbgReport (_CRT_WARN, NULL, NULL, __FILE__, fmt, *(args*)(&fmt+1)); +} + +#endif // DEBUG diff --git a/Build/source/libs/graphite/engine-2.4/src/generic/GenericResource.h b/Build/source/libs/graphite/engine-2.4/src/generic/GenericResource.h new file mode 100644 index 00000000000..119c6317bcd --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/src/generic/GenericResource.h @@ -0,0 +1,86 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 1999, 2001 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: GenericResource.h +Responsibility: John Thomson +Last reviewed: + + Resources needed by certain generic components (but must be created in app's or AppCore's + resource file). +----------------------------------------------------------------------------------------------*/ +#ifdef _MSC_VER +#pragma once +#endif +#ifndef GenericResource_H +#define GenericResource_H 1 +// Create suitable resources for these if your app uses StackDumper. +// For example +// STRINGTABLE DISCARDABLE +// BEGIN +// "A programming error (%s) has been detected in module %s.\n Please report this to the developers", kstidInternalError +// "Out of memory. To attempt Save, close other apps and click OK. To quit without saving click Cancel", kstidOutOfMemory +// END + + +// Date qualifier string IDs: +#define kstidDateQualBefore 24200 +#define kstidDateQualOn 24201 +#define kstidDateQualAbout 24202 +#define kstidDateQualAfter 24203 +#define kstidDateQualAbt 24204 +#define kstidDateQualBC 24205 +#define kstidDateQualAD 24206 +#define kstidDateBlank 24207 +#define kstidDateBlankM 24208 +#define kstidDateBlankD 24209 + + +#define kstidInternalError 25900 +#define khcidHelpOutOfMemory 25901 +#define khcidNoHelpAvailable 25902 // default help module when there is no specific one. +#define kstidOutOfMemory 25903 +#define kstidUndoFrame 25904 +#define kstidRedoFrame 25905 + +#define kstidFileErrUnknown 25920 +#define kstidFileErrNotFound 25921 +#define kstidFileErrPathNotFound 25922 +#define kstidFileErrTooManyFiles 25923 +#define kstidFileErrAccDenied 25924 +#define kstidFileErrBadHandle 25925 +#define kstidFileErrBadDrive 25926 +#define kstidFileErrWriteProtect 25927 +#define kstidFileErrBadUnit 25928 +#define kstidFileErrNotReady 25929 +#define kstidFileErrSeek 25930 +#define kstidFileErrNotDosDisk 25931 +#define kstidFileErrBadSector 25932 +#define kstidFileErrWriteFault 25933 +#define kstidFileErrReadFault 25934 +#define kstidFileErrGeneral 25935 +#define kstidFileErrSharing 25936 +#define kstidFileErrLock 25937 +#define kstidFileErrEof 25938 +#define kstidFileErrHandleDiskFull 25939 +#define kstidFileErrBadNetPath 25940 +#define kstidFileErrNetworkBusy 25941 +#define kstidFileErrNoDevice 25942 +#define kstidFileErrNoNetAccess 25943 +#define kstidFileErrBadDevice 25944 +#define kstidFileErrBadNetName 25945 +#define kstidFileErrExists 25946 +#define kstidFileErrCantMake 25947 +#define kstidFileErrBadPassword 25948 +#define kstidFileErrNetWriteFault 25949 +#define kstidFileErrDriveLocked 25950 +#define kstidFileErrOpenFailed 25951 +#define kstidFileErrBufOverflow 25952 +#define kstidFileErrDiskFull 25953 +#define kstidFileErrBadName 25954 +#define kstidFileErrNoVolLabel 25955 +#define kstidFileErrAlreadyExists 25956 + +#endif // !GenericResource_H diff --git a/Build/source/libs/graphite/engine-2.4/src/generic/HashMap.h b/Build/source/libs/graphite/engine-2.4/src/generic/HashMap.h new file mode 100644 index 00000000000..dc2de9d0af7 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/src/generic/HashMap.h @@ -0,0 +1,328 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 2001 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: HashMap.h +Responsibility: Steve McConnel +Last reviewed: Not yet. + +Description: + This provides a set of template collection classes to replace std::map. Their primary + reason to exist is to allow explicit checking for internal memory allocation failures. +----------------------------------------------------------------------------------------------*/ +#pragma once +#ifndef HASHMAP_H_INCLUDED +#define HASHMAP_H_INCLUDED +//:End Ignore + +/*---------------------------------------------------------------------------------------------- + Functor class for computing a hash value from an arbitrary object. + + Hungarian: hsho +----------------------------------------------------------------------------------------------*/ +class HashObj +{ +public: + int operator () (void * pKey, int cbKey); +}; + +/*---------------------------------------------------------------------------------------------- + Functor class for comparing two arbitrary objects (of the same class) for equality. + + Hungarian: eqlo +----------------------------------------------------------------------------------------------*/ +class EqlObj +{ +public: + bool operator () (void * pKey1, void * pKey2, int cbKey); +}; + +/*---------------------------------------------------------------------------------------------- + Hash map template collection class whose keys are objects of an arbitrary class. + + Hungarian: hm[K][T] +----------------------------------------------------------------------------------------------*/ +template class HashMap +{ +public: + //:> Member classes + + /*------------------------------------------------------------------------------------------ + This is the basic data structure for storing one key-value pair in a hash map. In + order to handle hash collisions, this structure is a member of a linked list. + Hungarian: hsnd + ------------------------------------------------------------------------------------------*/ + class HashNode + { + public: + //:> Constructors/destructors/etc. + + HashNode(void) + : m_key(K()), m_value(T()), m_nHash(0), m_ihsndNext(0) + { + } + HashNode(K & key, T & value, int nHash, int ihsndNext = -1) + : m_key(key), m_value(value), m_nHash(nHash), m_ihsndNext(ihsndNext) + { + } + ~HashNode() + { + } + + //:> Member variable access + + void PutKey(K & key) + { + m_key = key; + } + K & GetKey() + { + return m_key; + } + void PutValue(T & value) + { + m_value = value; + } + T & GetValue() + { + return m_value; + } + void PutHash(int nHash) + { + m_nHash = nHash; + } + int GetHash() + { + return m_nHash; + } + void PutNext(int ihsndNext) + { + m_ihsndNext = ihsndNext; + } + int GetNext() + { + return m_ihsndNext; + } + + /*-------------------------------------------------------------------------------------- + Check whether the given HashNode is being used. + --------------------------------------------------------------------------------------*/ + bool InUse() + { + return m_ihsndNext >= -1; + } + + protected: + //:> Member variables + + K m_key; + T m_value; + int m_nHash; + int m_ihsndNext; // -1 means end of list, -(ihsnd + 3) for free list members + }; + + /*------------------------------------------------------------------------------------------ + This provides an iterator for stepping through all HashNodes stored in the hash map. + This is useful primarily for saving the contents of a hash map to a file. + + Hungarian: ithm[K][T] + ------------------------------------------------------------------------------------------*/ + class iterator + { + public: + // Constructors/destructors/etc. + + iterator() : m_phmParent(NULL), m_ihsnd(0) + { + } + iterator(HashMap * phm, int ihsnd) : m_phmParent(phm), m_ihsnd(ihsnd) + { + } + iterator(const iterator & v) : m_phmParent(v.m_phmParent), m_ihsnd(v.m_ihsnd) + { + } + ~iterator() + { + } + + // Other public methods + + iterator & operator = (const iterator & ithm) + { + m_phmParent = ithm.m_phmParent; + m_ihsnd = ithm.m_ihsnd; + return *this; + } + T & operator * (void) + { + Assert(m_phmParent); + Assert(m_phmParent->m_prghsnd); + Assert(m_ihsnd < m_phmParent->m_ihsndLim); + return m_phmParent->m_prghsnd[m_ihsnd].GetValue(); + } + HashNode * operator -> (void) + { + Assert(m_phmParent); + Assert(m_phmParent->m_prghsnd); + Assert(m_ihsnd < m_phmParent->m_ihsndLim); + return &m_phmParent->m_prghsnd[m_ihsnd]; + } + iterator & operator ++ (void) + { + Assert(m_phmParent); + ++m_ihsnd; + // make sure that this new HashNode is actually in use + while (m_ihsnd < m_phmParent->m_ihsndLim) + { + if (m_phmParent->m_prghsnd[m_ihsnd].InUse()) + return *this; + // skip to the next one and check it + ++m_ihsnd; + } + if (m_ihsnd > m_phmParent->m_ihsndLim) + m_ihsnd = m_phmParent->m_ihsndLim; + return *this; + } + bool operator == (const iterator & ithm) + { + return (m_phmParent == ithm.m_phmParent) && (m_ihsnd == ithm.m_ihsnd); + } + bool operator != (const iterator & ithm) + { + return (m_phmParent != ithm.m_phmParent) || (m_ihsnd != ithm.m_ihsnd); + } + T & GetValue(void) + { + Assert(m_phmParent); + Assert(m_phmParent->m_prghsnd); + Assert(m_ihsnd < m_phmParent->m_ihsndLim); + Assert(m_phmParent->m_prghsnd[m_ihsnd].InUse()); + return m_phmParent->m_prghsnd[m_ihsnd].GetValue(); + } + K & GetKey(void) + { + Assert(m_phmParent); + Assert(m_phmParent->m_prghsnd); + Assert(m_ihsnd < m_phmParent->m_ihsndLim); + Assert(m_phmParent->m_prghsnd[m_ihsnd].InUse()); + return m_phmParent->m_prghsnd[m_ihsnd].GetKey(); + } + int GetHash() + { + Assert(m_phmParent); + Assert(m_phmParent->m_prghsnd); + Assert(m_ihsnd < m_phmParent->m_ihsndLim); + Assert(m_phmParent->m_prghsnd[m_ihsnd].InUse()); + return m_phmParent->m_prghsnd[m_ihsnd].GetHash(); + } + int GetIndex() + { + Assert(m_phmParent); + Assert(m_phmParent->m_prghsnd); + Assert(m_ihsnd < m_phmParent->m_ihsndLim); + Assert(m_phmParent->m_prghsnd[m_ihsnd].InUse()); + return m_ihsnd; + } + + protected: + //:> Member variables + + HashMap * m_phmParent; + int m_ihsnd; + }; + friend class iterator; + + //:> Constructors/destructors/etc. + + HashMap(); + ~HashMap(); + HashMap(HashMap & hm); + + //:> Other public methods + + iterator Begin(); + iterator End(); + void Insert(K & key, T & value, bool fOverwrite = false, int * pihsndOut = NULL); + bool Retrieve(K & key, T * pvalueRet); + bool Delete(K & key); + void Clear(); + void CopyTo(HashMap & hmKT); + void CopyTo(HashMap * phmKT); + + bool GetIndex(K & key, int * pihsndRet); + bool IndexKey(int ihsnd, K * pkeyRet); + bool IndexValue(int ihsnd, T * pvalueRet); + + int Size(); + + /*------------------------------------------------------------------------------------------ + The assignment operator allows an entire hashmap to be assigned as the value of another + hashmap. It throws an error if it runs out of memory. + + @return a reference to this hashmap. (That is how the assignment operator is defined!) + + @param hm is a reference to the other hashmap. + ------------------------------------------------------------------------------------------*/ + HashMap & operator = (HashMap & hm) + { + hm.CopyTo(this); + return *this; + } + + //:Ignore +#ifdef DEBUG + int _BucketCount(); + int _EmptyBuckets(); + int _BucketsUsed(); + int _FullestBucket(); + bool AssertValid() + { + AssertPtrN(m_prgihsndBuckets); + Assert(m_prgihsndBuckets || !m_cBuckets); + Assert(!m_prgihsndBuckets || m_cBuckets); + AssertArray(m_prgihsndBuckets, m_cBuckets); + AssertPtrN(m_prghsnd); + Assert(m_prghsnd || !m_ihsndMax); + Assert(!m_prghsnd || m_ihsndMax); + AssertArray(m_prghsnd, m_ihsndMax); + Assert(0 <= m_ihsndLim && m_ihsndLim <= m_ihsndMax); + Assert(-1 <= FreeListIdx(m_ihsndFirstFree)); + Assert(FreeListIdx(m_ihsndFirstFree) < m_ihsndLim); + return true; + } +#endif + //:End Ignore + +protected: + //:> Member variables + + int * m_prgihsndBuckets; + int m_cBuckets; + HashNode * m_prghsnd; + int m_ihsndLim; + int m_ihsndMax; + int m_ihsndFirstFree; // stores -(ihsnd + 3) + + //:> Protected methods + //:Ignore + + /*------------------------------------------------------------------------------------------ + Map between real index and "free list" index. Note that this mapping is bidirectional. + ------------------------------------------------------------------------------------------*/ + int FreeListIdx(int ihsnd) + { + return -(ihsnd + 3); + } + //:End Ignore +}; + + +// Local Variables: +// mode:C++ +// c-file-style:"cellar" +// tab-width:4 +// End: + +#endif /*HASHMAP_H_INCLUDED*/ diff --git a/Build/source/libs/graphite/engine-2.4/src/generic/HashMap_i.cpp b/Build/source/libs/graphite/engine-2.4/src/generic/HashMap_i.cpp new file mode 100644 index 00000000000..883a55b7c66 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/src/generic/HashMap_i.cpp @@ -0,0 +1,561 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 2001 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: HashMap_i.cpp +Responsibility: Steve McConnel +Last reviewed: Not yet. + +Description: + This file provides the implementations of methods for the HashMap template collection + classes. It is used as an #include file in any file which explicitly instantiates any + particular type of HashMap, HashMapStrUni, or HashMapChars. +----------------------------------------------------------------------------------------------*/ +#pragma once +#ifndef HASHMAP_I_C_INCLUDED +#define HASHMAP_I_C_INCLUDED + +#include "HashMap.h" +////#include +////#include "GrPlatform.h" +#include "GrCommon.h" + +/*********************************************************************************************** + Methods +***********************************************************************************************/ +//:End Ignore + +/*---------------------------------------------------------------------------------------------- + Constructor. +----------------------------------------------------------------------------------------------*/ +template + HashMap::HashMap() +{ + m_prgihsndBuckets = NULL; + m_cBuckets = 0; + m_prghsnd = NULL; + m_ihsndLim = 0; + m_ihsndMax = 0; + m_ihsndFirstFree = FreeListIdx(-1); +} + +/*---------------------------------------------------------------------------------------------- + Copy constructor. It throws an error if it runs out of memory. +----------------------------------------------------------------------------------------------*/ +template + HashMap::HashMap(HashMap & hm) +{ + m_prgihsndBuckets = NULL; + m_cBuckets= 0; + m_prghsnd = NULL; + m_ihsndLim = 0; + m_ihsndMax = 0; + m_ihsndFirstFree = FreeListIdx(-1); + hm.CopyTo(this); +} + +/*---------------------------------------------------------------------------------------------- + Destructor. +----------------------------------------------------------------------------------------------*/ +template + HashMap::~HashMap() +{ + Clear(); +} + +/*---------------------------------------------------------------------------------------------- + Return an iterator that references the first key and value stored in the HashMap. + If the hash map is empty, Begin returns the same value as End. +----------------------------------------------------------------------------------------------*/ +template + typename HashMap::iterator HashMap::Begin() +{ + AssertObj(this); + int ihsnd; + for (ihsnd = 0; ihsnd < m_ihsndLim; ++ihsnd) + { + if (m_prghsnd[ihsnd].InUse()) + { + iterator ithm(this, ihsnd); + return ithm; + } + } + return End(); +} + +/*---------------------------------------------------------------------------------------------- + Return an iterator that marks the end of the set of keys and values stored in the HashMap. + If the HashMap is empty, End returns the same value as Begin. +----------------------------------------------------------------------------------------------*/ +template + typename HashMap::iterator HashMap::End() +{ + AssertObj(this); + iterator ithm(this, m_ihsndLim); + return ithm; +} + +/*---------------------------------------------------------------------------------------------- + Add one key and value to the HashMap. Insert potentially invalidates existing iterators + for this HashMap. An exception is thrown if there are any errors. + + @param key Reference to the key object. An internal copy is made of this object. + @param value Reference to the object associated with the key. An internal copy is + made of this object. + @param fOverwrite Optional flag (defaults to false) to allow a value already associated + with this key to be replaced by this value. + @param pihsndOut Optional pointer to an integer for returning the internal index where the + key-value pair is stored. + + @exception E_INVALIDARG if fOverwrite is not true and the key already is stored with a value + in this HashMap. +----------------------------------------------------------------------------------------------*/ +template + void HashMap::Insert(K & key, T & value, bool fOverwrite, int * pihsndOut) +{ + AssertObj(this); + // Check for initial allocation of memory. + if (!m_cBuckets) + { + int cBuckets = GetPrimeNear(10); + m_prgihsndBuckets = (int *)malloc(cBuckets * sizeof(int)); + if (!m_prgihsndBuckets) + ThrowHr(WarnHr(E_OUTOFMEMORY)); + std::fill_n(m_prgihsndBuckets, cBuckets, -1); + m_cBuckets = cBuckets; + } + if (!m_ihsndMax) + { + int iMax = 32; + m_prghsnd = (HashNode *)malloc(iMax * sizeof(HashNode)); + if (!m_prghsnd) + ThrowHr(WarnHr(E_OUTOFMEMORY)); + std::fill_n(m_prghsnd, iMax, 0); + m_ihsndLim = 0; + m_ihsndMax = iMax; + m_ihsndFirstFree = FreeListIdx(-1); + } + // Check whether this key is already used. + // If it is, store the value if overwriting is allowed, otherwise return an error value. + H hasher; + Eq equal; + int ihsnd; + int nHash = hasher(&key, sizeof(K)); + int ie = (unsigned)nHash % m_cBuckets; + for (ihsnd = m_prgihsndBuckets[ie]; ihsnd != -1; ihsnd = m_prghsnd[ihsnd].GetNext()) + { + if ((nHash == m_prghsnd[ihsnd].GetHash()) && + equal(&key, &m_prghsnd[ihsnd].GetKey(), sizeof(K))) + { + if (fOverwrite) + { + m_prghsnd[ihsnd].PutValue(value); + if (pihsndOut) + *pihsndOut = ihsnd; + AssertObj(this); + return; + } + else + { + ThrowHr(WarnHr(E_INVALIDARG)); + } + } + } + // Check whether to increase the number of buckets to redistribute the wealth. + // Calculate the average depth of hash collection chains. + // If greater than or equal to two, increase the number of buckets. + int chsndFree = 0; + int i; + for (i = m_ihsndFirstFree; i != FreeListIdx(-1); i = m_prghsnd[FreeListIdx(i)].GetNext()) + ++chsndFree; + int chsndAvgDepth = (m_ihsndLim - chsndFree) / m_cBuckets; + if (chsndAvgDepth > 2) + { + int cNewBuckets = GetPrimeNear(4 * m_cBuckets); + if (cNewBuckets && cNewBuckets > m_cBuckets) + { + int * pNewBuckets = (int *)realloc(m_prgihsndBuckets, cNewBuckets * sizeof(int)); + if (pNewBuckets) + { + std::fill_n(pNewBuckets, cNewBuckets, -1); + m_cBuckets = cNewBuckets; + m_prgihsndBuckets = pNewBuckets; + for (ihsnd = 0; ihsnd < m_ihsndLim; ++ihsnd) + { + if (m_prghsnd[ihsnd].InUse()) + { + ie = (unsigned)m_prghsnd[ihsnd].GetHash() % m_cBuckets; + m_prghsnd[ihsnd].PutNext(m_prgihsndBuckets[ie]); + m_prgihsndBuckets[ie] = ihsnd; + } + } + // Recompute the new entry's slot so that it can be stored properly. + ie = (unsigned)nHash % m_cBuckets; + } + } + } + if (m_ihsndLim < m_ihsndMax) + { + ihsnd = m_ihsndLim; + ++m_ihsndLim; + } + else if (m_ihsndFirstFree != FreeListIdx(-1)) + { + ihsnd = FreeListIdx(m_ihsndFirstFree); + m_ihsndFirstFree = m_prghsnd[ihsnd].GetNext(); + } + else + { + int iNewMax = (!m_ihsndMax) ? 32 : 2 * m_ihsndMax; + HashNode * pNewNodes = (HashNode *)realloc(m_prghsnd, iNewMax * sizeof(HashNode)); + if (!pNewNodes && iNewMax > 32) + { + iNewMax = m_ihsndMax + (m_ihsndMax / 2); + pNewNodes = (HashNode *)realloc(m_prghsnd, iNewMax * sizeof(HashNode)); + if (!pNewNodes) + ThrowHr(WarnHr(E_OUTOFMEMORY)); + } + m_prghsnd = pNewNodes; + m_ihsndMax = iNewMax; + Assert(m_ihsndLim < m_ihsndMax); + ihsnd = m_ihsndLim; + ++m_ihsndLim; + } + // Call constructor on previously allocated memory. + new((void *)&m_prghsnd[ihsnd]) HashNode(key, value, nHash, m_prgihsndBuckets[ie]); + m_prgihsndBuckets[ie] = ihsnd; + if (pihsndOut) + *pihsndOut = ihsnd; + AssertObj(this); +} + +/*---------------------------------------------------------------------------------------------- + Search the HashMap for the given key, and return true if the key is found or false if the + key is not found. If the key is found and the given pointer is not NULL, copy the + associated value to that memory location. + + @param key Reference to a key object. + @param pvalueRet Pointer to an empty object for storing a copy of the value associated with + the key, if one exists. +----------------------------------------------------------------------------------------------*/ +template + bool HashMap::Retrieve(K & key, T * pvalueRet) +{ + AssertObj(this); + if (!m_prgihsndBuckets) + return false; + H hasher; + Eq equal; + int nHash = hasher(&key, sizeof(K)); + int ie = (unsigned)nHash % m_cBuckets; + int ihsnd; + for (ihsnd = m_prgihsndBuckets[ie]; ihsnd != -1; ihsnd = m_prghsnd[ihsnd].GetNext()) + { + if ((nHash == m_prghsnd[ihsnd].GetHash()) && + equal(&key, &m_prghsnd[ihsnd].GetKey(), sizeof(K))) + { + if (pvalueRet) + *pvalueRet = m_prghsnd[ihsnd].GetValue(); + return true; + } + } + return false; +} + +/*---------------------------------------------------------------------------------------------- + Remove the element with the given key from the stored HashMap. This potentially + invalidates existing iterators for this HashMap. If the key is not found in the + HashMap, then nothing is deleted. + + @param key Reference to a key object. + + @return True if the key is found, and something is actually deleted; otherwise, false. +----------------------------------------------------------------------------------------------*/ +template + bool HashMap::Delete(K & key) +{ + AssertObj(this); + if (!m_prgihsndBuckets) + return false; + H hasher; + Eq equal; + int nHash = hasher(&key, sizeof(K)); + int ie = (unsigned)nHash % m_cBuckets; + int ihsnd; + int ihsndPrev = -1; + for (ihsnd = m_prgihsndBuckets[ie]; ihsnd != -1; ihsnd = m_prghsnd[ihsnd].GetNext()) + { + if ((nHash == m_prghsnd[ihsnd].GetHash()) && + equal(&key, &m_prghsnd[ihsnd].GetKey(), sizeof(K))) + { + if (ihsndPrev == -1) + m_prgihsndBuckets[ie] = m_prghsnd[ihsnd].GetNext(); + else + m_prghsnd[ihsndPrev].PutNext(m_prghsnd[ihsnd].GetNext()); + m_prghsnd[ihsnd].~HashNode(); // Ensure member destructors are called. + memset(&m_prghsnd[ihsnd], 0, sizeof(HashNode)); + m_prghsnd[ihsnd].PutNext(m_ihsndFirstFree); + m_ihsndFirstFree = FreeListIdx(ihsnd); + AssertObj(this); + return true; + } + ihsndPrev = ihsnd; + } + return false; +} + +/*---------------------------------------------------------------------------------------------- + Free all the memory used by the HashMap. When done, only the minimum amount of + bookkeeping memory is still taking up space, and any internal pointers all been set + to NULL. The appropriate destructor is called for all key and value objects stored + in the HashMap before the memory space is freed. +----------------------------------------------------------------------------------------------*/ +template + void HashMap::Clear() +{ + AssertObj(this); + if (!m_prgihsndBuckets) + return; + int ihsnd; + for (ihsnd = 0; ihsnd < m_ihsndLim; ++ihsnd) + { + if (m_prghsnd[ihsnd].InUse()) + m_prghsnd[ihsnd].~HashNode(); // Ensure member destructors are called. + } + free(m_prgihsndBuckets); + free(m_prghsnd); + m_prgihsndBuckets = NULL; + m_cBuckets = 0; + m_prghsnd = NULL; + m_ihsndLim = 0; + m_ihsndMax = 0; + m_ihsndFirstFree = FreeListIdx(-1); + AssertObj(this); +} + +/*---------------------------------------------------------------------------------------------- + Copy the content of one HashMap to another. An exception is thrown if there are any errors. + + @param hmKT Reference to the other HashMap. +----------------------------------------------------------------------------------------------*/ +template + void HashMap::CopyTo(HashMap & hmKT) +{ + AssertObj(this); + AssertObj(&hmKT); + hmKT.Clear(); + iterator itmm; + for (itmm = Begin(); itmm != End(); ++itmm) + hmKT.Insert(itmm->GetKey(), itmm->GetValue()); +} + +/*---------------------------------------------------------------------------------------------- + Copy the content of one HashMap to another. An exception is thrown if there are any errors. + + @param phmKT Pointer to the other HashMap. + + @exception E_POINTER if phmKT is NULL. +----------------------------------------------------------------------------------------------*/ +template + void HashMap::CopyTo(HashMap * phmKT) +{ + if (!phmKT) + ThrowHr(WarnHr(E_POINTER)); + CopyTo(*phmKT); +} + +/*---------------------------------------------------------------------------------------------- + If the given key is found in the HashMap, return true, and if the provided index pointer + is not NULL, also store the internal index value in the indicated memory location. + If the given key is NOT found in the HashMap, return false and ignore the provided index + pointer. + + @param key Reference to a key object. + @param pihsndRet Pointer to an integer for returning the internal index where the + key-value pair is stored. +----------------------------------------------------------------------------------------------*/ +template + bool HashMap::GetIndex(K & key, int * pihsndRet) +{ + AssertObj(this); + if (!m_prgihsndBuckets) + return false; + H hasher; + Eq equal; + int nHash = hasher(&key, sizeof(K)); + int ie = (unsigned)nHash % m_cBuckets; + int ihsnd; + for (ihsnd = m_prgihsndBuckets[ie]; ihsnd != -1; ihsnd = m_prghsnd[ihsnd].GetNext()) + { + if ((nHash == m_prghsnd[ihsnd].GetHash()) && + equal(&key, &m_prghsnd[ihsnd].GetKey(), sizeof(K))) + { + if (pihsndRet) + *pihsndRet = ihsnd; + return true; + } + } + return false; +} + +/*---------------------------------------------------------------------------------------------- + If the given internal HashMap index is valid, return true, and if the provided pointer to a + key object is not NULL, also copy the indexed key to the indicated memory location. + If the given internal index is NOT valid, return false, and ignore the provided key + object pointer. + + @param ihsnd Internal index value returned earlier by GetIndex or Insert. + @param pkeyRet Pointer to an empty key object for storing a copy of the key found at the + indexed location. +----------------------------------------------------------------------------------------------*/ +template + bool HashMap::IndexKey(int ihsnd, K * pkeyRet) +{ + AssertObj(this); + if ((ihsnd < 0) || (ihsnd >= m_ihsndLim)) + return false; + if (m_prghsnd[ihsnd].InUse()) + { + if (pkeyRet) + *pkeyRet = m_prghsnd[ihsnd].GetKey(); + return true; + } + else + { + return false; + } +} + +/*---------------------------------------------------------------------------------------------- + If the given internal HashMap index is valid, return true, and if the provided pointer to an + object is not NULL, also copy the indexed value to the indicated memory location. + If the given internal index is NOT valid, return false, and ignore the provided + object pointer. + + @param ihsnd Internal index value returned earlier by GetIndex or Insert. + @param pvalueRet Pointer to an empty object for storing a copy of the value found at the + indexed location. +----------------------------------------------------------------------------------------------*/ +template + bool HashMap::IndexValue(int ihsnd, T * pvalueRet) +{ + AssertObj(this); + if (ihsnd < 0 || ihsnd >= m_ihsndLim) + return false; + if (m_prghsnd[ihsnd].InUse()) + { + if (pvalueRet) + *pvalueRet = m_prghsnd[ihsnd].GetValue(); + return true; + } + else + { + return false; + } +} + +/*---------------------------------------------------------------------------------------------- + Return the number of items (key-value pairs) stored in the HashMap. +----------------------------------------------------------------------------------------------*/ +template + int HashMap::Size() +{ + AssertObj(this); + if (!m_prgihsndBuckets) + return 0; + int chsndFree = 0; + int ihsnd; + for (ihsnd = m_ihsndFirstFree; + ihsnd != FreeListIdx(-1); + ihsnd = m_prghsnd[FreeListIdx(ihsnd)].GetNext()) + { + ++chsndFree; + } + return m_ihsndLim - chsndFree; +} + +//:Ignore +#ifdef DEBUG +/*---------------------------------------------------------------------------------------------- + Return the number of buckets (hash slots) currently allocated for the hash map. This is + useful only for debugging the hash map mechanism itself. +----------------------------------------------------------------------------------------------*/ +template + int HashMap::_BucketCount() +{ + AssertObj(this); + return m_cBuckets; +} + +/*---------------------------------------------------------------------------------------------- + Return the number of buckets (hash slots) that do not point to a list of HashNode objects. + This is useful only for debugging the hash map mechanism itself. +----------------------------------------------------------------------------------------------*/ +template + int HashMap::_EmptyBuckets() +{ + AssertObj(this); + int ceUnused = 0; + int ie; + for (ie = 0; ie < m_cBuckets; ++ie) + { + if (m_prgihsndBuckets[ie] == -1) + ++ceUnused; + } + return ceUnused; +} + +/*---------------------------------------------------------------------------------------------- + Return the number of buckets (hash slots) that currently point to a list of HashNode + objects in the hash map. This is useful only for debugging the hash map mechanism itself. +----------------------------------------------------------------------------------------------*/ +template + int HashMap::_BucketsUsed() +{ + AssertObj(this); + int ceUsed = 0; + int ie; + for (ie = 0; ie < m_cBuckets; ++ie) + { + if (m_prgihsndBuckets[ie] != -1) + ++ceUsed; + } + return ceUsed; +} + +/*---------------------------------------------------------------------------------------------- + Return the length of the longest list of HashNode objects stored in any bucket (hash slot) + of the hash map. This is useful only for debugging the hash map mechanism itself. +----------------------------------------------------------------------------------------------*/ +template + int HashMap::_FullestBucket() +{ + AssertObj(this); + int chsndMax = 0; + int chsnd; + int ie; + int ihsnd; + for (ie = 0; ie < m_cBuckets; ++ie) + { + chsnd = 0; + for (ihsnd = m_prgihsndBuckets[ie]; ihsnd != -1; ihsnd = m_prghsnd[ihsnd].GetNext()) + ++chsnd; + if (chsndMax < chsnd) + chsndMax = chsnd; + } + return chsndMax; +} +#endif +//:End Ignore + + + +// Local Variables: +// mode:C++ +// c-file-style:"cellar" +// tab-width:4 +// End: + +#endif /*HASHMAP_I_C_INCLUDED*/ diff --git a/Build/source/libs/graphite/engine-2.4/src/generic/Makefile.am b/Build/source/libs/graphite/engine-2.4/src/generic/Makefile.am new file mode 100644 index 00000000000..ec60b09be3a --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/src/generic/Makefile.am @@ -0,0 +1,8 @@ +genericdir = $(top_srcdir)/src/generic + +libgraphite_la_SOURCES += $(genericdir)/Debug.cpp +libgraphite_la_SOURCES += $(genericdir)/Util.cpp + +EXTRA_DIST += $(genericdir)/*.h +EXTRA_DIST += $(genericdir)/BinTree_i.cpp +EXTRA_DIST += $(genericdir)/HashMap_i.cpp diff --git a/Build/source/libs/graphite/engine-2.4/src/generic/Util.cpp b/Build/source/libs/graphite/engine-2.4/src/generic/Util.cpp new file mode 100644 index 00000000000..05789856286 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/src/generic/Util.cpp @@ -0,0 +1,261 @@ + +#include "GrCommon.h" +#include "GrDebug.h" + + +namespace gr +{ + +/*---------------------------------------------------------------------------------------------- + Swap two blocks of size cb starting at pv1 and pv2. Doesn't handle overlapping blocks. +----------------------------------------------------------------------------------------------*/ +void SwapBytes(void * pv1, void * pv2, int cb) +{ + Assert((byte *)pv1 + cb <= (byte *)pv2 || (byte *)pv2 + cb <= (byte *)pv1); + AssertPtrSize(pv1, cb); + AssertPtrSize(pv2, cb); + +#ifdef NO_ASM + + byte *pb1 = (byte *)pv1; + byte *pb2 = (byte *)pv2; + byte b; + + while (--cb >= 0) + { + b = *pb1; + *pb1++ = *pb2; + *pb2++ = b; + } + +#else // !NO_ASM + + __asm + { + // edi -> memory to swap, first pointer + // esi -> memory to swap, second pointer + + mov edi,pv1 + mov esi,pv2 + + mov ecx,cb + shr ecx,2 + jz LBytes + +LIntLoop: + mov eax,[edi] + mov ebx,[esi] + mov [edi],ebx + mov [esi],eax + + add edi,4 + add esi,4 + dec ecx + jnz LIntLoop; + +LBytes: + mov ecx,cb + and ecx,3 + jz LDone + +LByteLoop: + mov al,[edi] + mov bl,[esi] + mov [edi],bl + mov [esi],al + inc edi + inc esi + dec ecx + jnz LByteLoop + +LDone: + } + +#endif //!NO_ASM +} + +/*---------------------------------------------------------------------------------------------- + Fills a block of memory with the given short value. +----------------------------------------------------------------------------------------------*/ +void FillShorts(void * pv, short sn, int csn) +{ + AssertPtrSize(pv, csn * static_cast(sizeof(short))); + +#ifdef NO_ASM + + short * psn = (short *)pv; + short * psnLim = psn + csn; + + while (psn < psnLim) + *psn++ = sn; + +#else // !NO_ASM + + __asm + { + // Setup the registers for using REP STOS instruction to set memory. + // NOTE: Alignment does not effect the speed of STOS. + // + // edi -> memory to set + // eax = value to store in destination + // direction flag is clear for auto-increment + + mov edi,pv + mov ax,sn + mov ecx,csn + + mov edx,ecx + and edx,1 + jz LInts + + // set 1 short + stosw + +LInts: + shr ecx,1 + jz LDone + + mov ebx,eax + shl eax,16 + mov ax,bx + + rep stosd +LDone: + } + +#endif //!NO_ASM +} + +/*********************************************************************************************** + Integer utilities. +***********************************************************************************************/ + +/* + * table of powers of 2, and largest prime smaller than each power of 2 + * n 2**n prime diff + * --- ---------- ---------- ---- + * 2: 4 3 ( -1) + * 3: 8 7 ( -1) + * 4: 16 13 ( -3) + * 5: 32 31 ( -1) + * 6: 64 61 ( -3) + * 7: 128 127 ( -1) + * 8: 256 251 ( -5) + * 9: 512 509 ( -3) + * 10: 1024 1021 ( -3) + * 11: 2048 2039 ( -9) + * 12: 4096 4093 ( -3) + * 13: 8192 8191 ( -1) + * 14: 16384 16381 ( -3) + * 15: 32768 32749 (-19) + * 16: 65536 65521 (-15) + * 17: 131072 131071 ( -1) + * 18: 262144 262139 ( -5) + * 19: 524288 524287 ( -1) + * 20: 1048576 1048573 ( -3) + * 21: 2097152 2097143 ( -9) + * 22: 4194304 4194301 ( -3) + * 23: 8388608 8388593 (-15) + * 24: 16777216 16777213 ( -3) + * 25: 33554432 33554393 (-39) + * 26: 67108864 67108859 ( -5) + * 27: 134217728 134217689 (-39) + * 28: 268435456 268435399 (-57) + * 29: 536870912 536870909 ( -3) + * 30: 1073741824 1073741789 (-35) + * 31: 2147483648 2147483647 ( -1) + * 32: 4294967296 4294967291 ( -5) + */ +const static unsigned int g_rguPrimes[] = { + 3, 7, 13, 31, 61, 127, 251, 509, 1021, 2039, 4093, 8191, 16381, 32749, 65521, 131071, + 262139, 524287, 1048573, 2097143, 4194301, 8388593, 16777213, 33554393, 67108859, + 134217689, 268435399, 536870909, 1073741789, 2147483647, 4294967291U +}; + + +/*---------------------------------------------------------------------------------------------- + Returns the prime in g_rguPrimes that is closest to u. +----------------------------------------------------------------------------------------------*/ +unsigned int GetPrimeNear(unsigned int u) +{ + int cu = sizeof(g_rguPrimes) / sizeof(unsigned int); + int iuMin; + int iuLim; + int iu; + + for (iuMin = 0, iuLim = cu; iuMin < iuLim; ) + { + iu = (iuMin + iuLim) / 2; + if (u > g_rguPrimes[iu]) + iuMin = iu + 1; + else + iuLim = iu; + } + Assert(iuMin == cu || (iuMin < cu && u <= g_rguPrimes[iuMin])); + Assert(iuMin == 0 || (iuMin > 0 && u > g_rguPrimes[iuMin - 1])); + + if (!iuMin) + return g_rguPrimes[0]; + if (iuMin == cu) + return g_rguPrimes[cu - 1]; + if (g_rguPrimes[iuMin] - u < u - g_rguPrimes[iuMin - 1]) + return g_rguPrimes[iuMin]; + return g_rguPrimes[iuMin - 1]; +} + + +/*---------------------------------------------------------------------------------------------- + Returns the prime in g_rguPrimes that is larger than u or is the largest in the list. +----------------------------------------------------------------------------------------------*/ +unsigned int GetLargerPrime(unsigned int u) +{ + int cu = sizeof(g_rguPrimes) / sizeof(unsigned int); + int iuMin; + int iuLim; + int iu; + + for (iuMin = 0, iuLim = cu; iuMin < iuLim; ) + { + iu = (iuMin + iuLim) / 2; + if (u >= g_rguPrimes[iu]) + iuMin = iu + 1; + else + iuLim = iu; + } + Assert(iuMin == cu || (iuMin < cu && u < g_rguPrimes[iuMin])); + Assert(iuMin == 0 || (iuMin > 0 && u >= g_rguPrimes[iuMin - 1])); + + if (iuMin == cu) + return g_rguPrimes[cu - 1]; + return g_rguPrimes[iuMin]; +} + + +/*---------------------------------------------------------------------------------------------- + Returns the prime in g_rguPrimes that is smaller than u or is the smallest in the list. +----------------------------------------------------------------------------------------------*/ +unsigned int GetSmallerPrime(unsigned int u) +{ + int cu = sizeof(g_rguPrimes) / sizeof(unsigned int); + int iuMin; + int iuLim; + int iu; + + for (iuMin = 0, iuLim = cu; iuMin < iuLim; ) + { + iu = (iuMin + iuLim) / 2; + if (u > g_rguPrimes[iu]) + iuMin = iu + 1; + else + iuLim = iu; + } + Assert(iuMin == cu || (iuMin < cu && u <= g_rguPrimes[iuMin])); + Assert(iuMin == 0 || (iuMin > 0 && u > g_rguPrimes[iuMin - 1])); + + if (!iuMin) + return g_rguPrimes[0]; + return g_rguPrimes[iuMin - 1]; +} + +} + diff --git a/Build/source/libs/graphite/engine-2.4/src/painter/Makefile.am b/Build/source/libs/graphite/engine-2.4/src/painter/Makefile.am new file mode 100644 index 00000000000..497d31bd018 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/src/painter/Makefile.am @@ -0,0 +1,5 @@ +painterdir = $(top_srcdir)/src/painter + +libgraphite_la_SOURCES += $(painterdir)/SegmentPainter.cpp + +#EXTRA_DIST += $(painterdir)/*.h diff --git a/Build/source/libs/graphite/engine-2.4/src/painter/SegmentPainter.cpp b/Build/source/libs/graphite/engine-2.4/src/painter/SegmentPainter.cpp new file mode 100644 index 00000000000..dcfdda32908 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/src/painter/SegmentPainter.cpp @@ -0,0 +1,3011 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 1999, 2001 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: SegmentPainter.cpp +Responsibility: Sharon Correll +Last reviewed: Not yet. + +Description: + Implements the object that handles drawing, mouse clicks, and other UI-related behavior + for a Graphite segment. +-------------------------------------------------------------------------------*//*:End Ignore*/ + +//:>******************************************************************************************** +//:> Include files +//:>******************************************************************************************** +#include "Main.h" +#ifdef _MSC_VER +#pragma hdrstop +#endif +// any other headers (not precompiled) +#include +#ifndef _WIN32 +#include +#endif + +//:>******************************************************************************************** +//:> Forward declarations +//:>******************************************************************************************** + +//:>******************************************************************************************** +//:> Local Constants and static variables +//:>******************************************************************************************** +namespace +{ + +static bool g_fDrawing; + +} // namespace + + +namespace gr +{ + +//:>******************************************************************************************** +//:> Methods +//:>******************************************************************************************** + +/*---------------------------------------------------------------------------------------------- + Constructors. +----------------------------------------------------------------------------------------------*/ +//SegmentPainter::SegmentPainter(Segment * pseg) +//{ +// m_pseg = pseg; +// +// m_xsOrigin = 0; +// m_ysOrigin = 0; +// m_xdPosition = 0; +// m_ydPosition = 0; +// m_xFactor = 1.0; +// m_yFactor = 1.0; +//} + +SegmentPainter::SegmentPainter(Segment * pseg, float xsOrigin, float ysOrigin) +{ + m_pseg = pseg; + + m_xsOrigin = xsOrigin; + m_ysOrigin = ysOrigin; + m_xdPosition = m_xsOrigin; + m_ydPosition = m_ysOrigin; + m_xFactor = 1.0; + m_yFactor = 1.0; + + //m_xsOriginInt = GrEngine::RoundFloat(xsOrigin); + //m_xdPositionInt = m_xsOriginInt; + //m_xFactor64 = 64; +} + +/*---------------------------------------------------------------------------------------------- + Destructor. +----------------------------------------------------------------------------------------------*/ +SegmentPainter::~SegmentPainter() +{ +} + +/*---------------------------------------------------------------------------------------------- + Initialization. + + The correspondence with the old rectangle approach is: + m_xsOrigin = sourceRect.left; + m_ysOrigin = sourceRect.top; + m_xdPosition = destRect.left; + m_ydPosition = destRect.top; + + m_xFactor = (destRect.right - destRect.left) / (sourceRect.right - sourceRect.left); + m_yFactor = (destRect.top - destRect.bottom) / (sourceRect.top - sourceRect.bottom); + +----------------------------------------------------------------------------------------------*/ +void SegmentPainter::setOrigin(float xsOrigin, float ysOrigin) +{ + m_xsOrigin = xsOrigin; + m_ysOrigin = ysOrigin; + + //m_xsOriginInt = GrEngine::RoundFloat(xsOrigin); +} + +void SegmentPainter::setPosition(float xdPosition, float ydPosition) +{ + m_xdPosition = xdPosition; + m_ydPosition = ydPosition; + + //m_xdPositionInt = GrEngine::RoundFloat(xdPosition); +} + +void SegmentPainter::setScalingFactors(float xFactor, float yFactor) +{ + m_xFactor = xFactor; + m_yFactor = yFactor; + + //int temp = GrEngine::RoundFloat(xFactor); + //m_xFactor64 = GrEngine::RoundFloat(xFactor * 64); +} + + +//:>******************************************************************************************** +//:> SegmentPainter interface methods +//:>******************************************************************************************** + +/*---------------------------------------------------------------------------------------------- + Draw the text of the segment at the specified point in the graphics context. + This method must be implemented by a concrete subclass for painters that really need + to paint. +----------------------------------------------------------------------------------------------*/ +//void SegmentPainter::paint() +//{ +// Assert(false); +//} + +/*---------------------------------------------------------------------------------------------- + Indicate if the character position is a valid place for an insertion point. + + @oaram ich - position to test + @param pipvr - answer: kipvrOK = IP here is valid; + kipvrBad = IP here no good; + kipvrUnknown = this seg can't decide, ask the next +----------------------------------------------------------------------------------------------*/ +LgIpValidResult SegmentPainter::isValidInsertionPoint(int ichw) +{ + Assert(m_pseg->m_dxsWidth >= 0); + Assert(m_pseg->m_dysAscent >= 0); + + int ichwSegOffset = ichw - m_pseg->m_ichwMin; + if (ichwSegOffset < m_pseg->m_ichwAssocsMin || ichwSegOffset >= m_pseg->m_ichwAssocsLim) + { + // If we're pointing at a hard line break character (Unicode 2028), then we know + // that it's a good insertion point in spite of missing the other conditions. + utf16 ch; + m_pseg->m_pgts->fetch(ichw, 1, &ch); + if (ch != knLineSep) + return kipvrUnknown; // Definitely in a different segment of the paragraph. + return kipvrOK; + } + + int isloutLig = m_pseg->m_prgisloutLigature[ichwSegOffset - m_pseg->m_ichwAssocsMin]; + if (isloutLig != kNegInfinity) + { + // Ligature. + int isloutLigAfter = m_pseg->m_prgisloutLigature[ichwSegOffset - 1 - m_pseg->m_ichwAssocsMin]; + if (isloutLig == isloutLigAfter) + { + int icompBefore = m_pseg->m_prgiComponent[ichwSegOffset - m_pseg->m_ichwAssocsMin]; + int icompAfter = m_pseg->m_prgiComponent[ichwSegOffset - 1 - m_pseg->m_ichwAssocsMin]; + if (icompBefore == icompAfter) + // If inserting before this character yields the same visible component + // as inserting after the previous, then this character is invisible, or has + // been merged with the previous, and it doesn't make sense to put an insertion + // point here. + return kipvrBad; + } + return kipvrOK; + } + + // TODO: do we need to test ALL the associated glyphs? Here we just test the first. + + LgIpValidResult ipvrRet; + + int isloutBefore = m_pseg->UnderlyingToLogicalSurface(ichw, true); // leading edge + int isloutAfter = m_pseg->UnderlyingToLogicalSurface(ichw - 1, false); // trailing edge of previous + int isloutTest = m_pseg->UnderlyingToLogicalInThisSeg(ichw); + if (isloutBefore == isloutAfter) + // If inserting before this character yields the same visible glyph as + // inserting after the previous, then this character is invisible, or has + // been merged with the previous, and it doesn't make sense to put an insertion + // point here. + ipvrRet = kipvrBad; + else if (isloutTest == kNegInfinity || isloutTest == kPosInfinity) + ipvrRet = kipvrBad; // can't figure it out + else if (!m_pseg->OutputSlot(isloutTest)->InsertBefore()) + ipvrRet = kipvrBad; + else if (m_pseg->SameSurfaceGlyphs(ichw - 1, ichw)) + // The insertion point would be between two characters that map to the same + // set of glyphs. Not a good place. + ipvrRet = kipvrBad; + else + ipvrRet = kipvrOK; + + return ipvrRet; +} + +/*---------------------------------------------------------------------------------------------- + Answer whether the logical and physical boundaries of the string coincide. + This method is called by the application to handle writing system boundaries, and by + other segments in a writing-system chain to handle line-breaks. + + @param fBoundaryEnd - asking about the logical end boundary? + @param fBoundaryRight - asking about the physical right boundary? + @param pfResult - return value +----------------------------------------------------------------------------------------------*/ +bool SegmentPainter::doBoundariesCoincide(bool fBoundaryEnd, bool fBoundaryRight) +{ + float xsBefore, ysBeforeTop, ysBeforeBottom; + float xsAfter, ysAfterTop, ysAfterBottom; + bool fRtlBefore, fRtlAfter; + + if (m_pseg->m_cginf == 0) + { + // Empty segment. + return true; + } + + //SetUpGraphics(ichwBase, pgg, true); + + Assert(m_pseg->m_dxsWidth >= 0); + Assert(m_pseg->m_dysAscent >= 0); + + if (fBoundaryEnd) + { + CalcIP(m_pseg->m_ichwMin + m_pseg->m_dichwLim, true, + &xsBefore, &ysBeforeTop, &ysBeforeBottom, &fRtlBefore); + CalcIP(m_pseg->m_ichwMin + m_pseg->m_dichwLim, false, + &xsAfter, &ysAfterTop, &ysAfterBottom, &fRtlAfter); + } + else + { + CalcIP(m_pseg->m_ichwMin, true, + &xsBefore, &ysBeforeTop, &ysBeforeBottom, &fRtlBefore); + CalcIP(m_pseg->m_ichwMin, false, + &xsAfter, &ysAfterTop, &ysAfterBottom, &fRtlAfter); + } + + // We allow for rounding errors which might cause differences between the expected + // and the actual values, hence the test for a difference of <= 1. + bool fRet; + if (fBoundaryRight) + { + // right edge + if (fBoundaryEnd) // logical end + fRet = (!fRtlAfter && fabsf(xsAfter - (m_pseg->m_dxsTotalWidth + m_pseg->m_dxsStretch)) <= 1); + else // logical start + fRet = (fRtlBefore && fabsf(xsBefore - (m_pseg->m_dxsTotalWidth + m_pseg->m_dxsStretch)) <= 1); + } + else + { + // left edge + if (fBoundaryEnd) // logical end + fRet = (fRtlAfter && fabsf(xsAfter) <= 1); + else // logical start + fRet = (!fRtlBefore && fabsf(xsBefore) <= 1); + } + + return fRet; +} + +/*---------------------------------------------------------------------------------------------- + Draw an insertion point at an appropriate position. + + @param twx, twy - same origin used to Draw segment + @param ich - character position; must be valid + @param fAssocPrev - associated with previous character? + @param bOn - turning on or off? Caller should alternate, first turning on + (ignored in this implementation) + @param dm - draw mode: + kdmNormal = draw complete insertion pt (I-beam or split cursor); + kdmPrimary = only draw primary half of split cursor; + kdmSecondary = only draw secondary half of split cursor +----------------------------------------------------------------------------------------------*/ +void SegmentPainter::drawInsertionPoint(int ichwIP, bool fAssocPrev, + bool bOn, bool fForceSplit) // LgIPDrawMode dm) +{ + if (g_fDrawing) + return; + + g_fDrawing = true; + + //SetUpGraphics(ichwBase, pgg, true); + + Assert(m_pseg->m_dxsWidth >= 0); + Assert(m_pseg->m_dysAscent >= 0); + + CalcOrDrawInsertionPoint(ichwIP, + fAssocPrev, bOn, fForceSplit, + NULL, NULL); // passing NULLs here means we want to draw + + //RestoreFont(pgg); + + g_fDrawing = false; +} + +/*---------------------------------------------------------------------------------------------- + Fill in bounding rectangles for the (possibly 2-part) IP, in destination device coordinates. + Return flags indicating which of the 2 parts where rendered here. + + @param rs,rd - source/destination coordinates, for scaling + @param ichwIP - insertion point + @param fAssocPrev - is the IP "leaning" backward? + @param dm - draw mode: + kdmNormal = draw complete insertion pt (I-beam or split cursor); + kdmPrimary = only draw primary half of split cursor; + kdmSecondary = only draw secondary half of split cursor + @param prdPrimary - return location of primary selection, in dest coords + @param prdSecondary - return location of secondary selection, in dest coords +----------------------------------------------------------------------------------------------*/ +void SegmentPainter::positionsOfIP( + int ichwIP, bool fAssocPrev, bool fForceSplit, + Rect * prdPrimary, Rect * prdSecondary) +{ + ChkGrArgPtr(prdPrimary); + ChkGrArgPtr(prdSecondary); + + //SetUpGraphics(ichwBase, pgg, true); + + Assert(m_pseg->m_dxsWidth >= 0); + Assert(m_pseg->m_dysAscent >= 0); + + CalcOrDrawInsertionPoint(ichwIP, fAssocPrev, true, fForceSplit, + prdPrimary, prdSecondary); + + //RestoreFont(pgg); +} + +/*---------------------------------------------------------------------------------------------- + Highlight a range of text. + + @param ichwAnchor/End - selected range + @param ydLineTop/Bottom - top/bottom of area to highlight if whole line height; + includes half of inter-line spacing. + @param bOn - true if we are turning on (ignored in this implementation) +----------------------------------------------------------------------------------------------*/ +bool SegmentPainter::drawSelectionRange(int ichwAnchor, int ichwEnd, + float ydLineTop, float ydLineBottom, bool /*bOn*/) +{ + if (g_fDrawing) + return true; + + g_fDrawing = true; + + //SetUpGraphics(ichwBase, pgg, true); + + Assert(m_pseg->m_dxsWidth >= 0); + Assert(m_pseg->m_dysAscent >= 0); + + float xsSegLeft = 0; + float ysSegTop = 0; + + float xdSegRight = ScaleXToDest(m_pseg->m_dxsTotalWidth); + + int ichwMinSel = min(ichwAnchor, ichwEnd); + int ichwLimSel = max(ichwAnchor, ichwEnd); + + int ichwMinSeg = max(ichwMinSel, m_pseg->m_ichwMin + m_pseg->m_ichwAssocsMin); + int ichwLimSeg = min(ichwLimSel, m_pseg->m_ichwMin + m_pseg->m_ichwAssocsLim); + + std::vector vrs; + std::vector vfEntireHt; + + bool * prgfAllCompsSelected = new bool[m_pseg->m_dichwLim]; + std::fill_n(prgfAllCompsSelected, m_pseg->m_dichwLim, false); + CalcPartialLigatures(prgfAllCompsSelected, ichwMinSeg, ichwLimSeg, + ichwMinSel, ichwLimSel); + + // Array to keep track of which glyphs were highlighted. + int cginf = m_pseg->m_cginf; + bool * prgfHighlighted = new bool[cginf]; + std::fill_n(prgfHighlighted, cginf, false); + + for (int ichwLp = ichwMinSeg; ichwLp < ichwLimSeg; ichwLp++) + { + CalcHighlightRect(ichwLp, vrs, vfEntireHt, + !prgfAllCompsSelected[ichwLp - m_pseg->m_ichwMin], prgfHighlighted, false); + } + + // If all the glyphs of a given cluster were highlighted, highlight the whole cluster + // as a unit. + for (int islout = 0; islout < m_pseg->m_cslout; islout++) + { + CalcCompleteCluster(islout, vrs, vfEntireHt, prgfHighlighted); + } + + // Convert to destination coordinates; also extend full-line rectangles to the top + // and bottom of the line height. + std::vector vrd; + for (size_t irs = 0; irs < vrs.size(); irs++) + { + Rect rsTmp = vrs[irs]; + Rect rdTmp; + if (vfEntireHt[irs]) + { + rdTmp.top = ydLineTop; + rdTmp.bottom = ydLineBottom; + } + else + { + float ydTmp = ScaleYToDest(rsTmp.top + ysSegTop); + rdTmp.top = min(ydLineBottom, max(ydLineTop, ydTmp)); + ydTmp = ScaleYToDest(rsTmp.bottom + ysSegTop); + rdTmp.bottom = max(ydLineTop, min(ydLineBottom, ydTmp)); + } + float xdTmp = ScaleXToDest(rsTmp.left + xsSegLeft); + rdTmp.left = min(xdSegRight, max(float(0), xdTmp)); + xdTmp = ScaleXToDest(rsTmp.right + xsSegLeft); + rdTmp.right = max(float(0), min(xdSegRight, xdTmp)); + if (rdTmp.left > rdTmp.right) + { + // I think this can happen due to rounding errors. + float tmp = rdTmp.left; + rdTmp.left = rdTmp.right; + rdTmp.right = tmp; + } + vrd.push_back(rdTmp); + } + + // Create a list of rectangles with no overlaps, so the selection draws cleanly. + std::vector vrdNoOverlaps; + size_t irect; + for (irect = 0; irect < vrd.size(); irect++) + AddRectWithoutOverlaps(vrdNoOverlaps, vrd[irect]); + + AssertNoOverlaps(vrdNoOverlaps); + + // Draw the highlight. + for (irect = 0; irect < vrdNoOverlaps.size(); irect++) + { + Rect rdTmp = vrdNoOverlaps[irect]; + InvertRect(rdTmp.left, rdTmp.top, rdTmp.right, rdTmp.bottom); + } + + delete[] prgfAllCompsSelected; + delete[] prgfHighlighted; + + //RestoreFont(pgg); + + g_fDrawing = false; + + return (vrdNoOverlaps.size() > 0); +} + +/*---------------------------------------------------------------------------------------------- + Get a bounding rectangle that will contain the area highlighted by this segment + when drawing the specified range. + + @param ichwAnchor/End - selected range + @param ydLineTop/Bottom - top/bottom of area to highlight if whole line height; + includes half of inter-line spacing. + @param prdBounds - return location of range + @return - true if the return rectange has a meaningful value +----------------------------------------------------------------------------------------------*/ +bool SegmentPainter::positionsOfRange(int ichwAnchor, int ichwEnd, + float ydLineTop, float ydLineBottom, Rect * prdBounds) +{ + ChkGrArgPtr(prdBounds); + + std::vector vrs; + std::vector vfEntireHt; + + //SetUpGraphics(ichwBase, pgg, true); + + Assert(m_pseg->m_dxsWidth >= 0); + Assert(m_pseg->m_dysAscent >= 0); + + int ichwMin = min(ichwAnchor, ichwEnd); + int ichwLim = max(ichwAnchor, ichwEnd); + + for (int ichwLp = ichwMin; ichwLp < ichwLim; ichwLp++) + { + CalcHighlightRect(ichwLp, vrs, vfEntireHt, true, NULL, false); + } + + if (vrs.size() == 0) + { + return false; + } + + Rect * prsBounds = &(vrs[0]); + for (size_t irect = 1; irect < vrs.size(); irect++) + { + Rect * prs = &(vrs[irect]); + prsBounds->left = min(prsBounds->left, prs->left); + prsBounds->right = max(prsBounds->right, prs->right); + } + + prdBounds->top = ydLineTop; + prdBounds->bottom = ydLineBottom; + prdBounds->left = ScaleXToDest(prsBounds->left); + prdBounds->right = ScaleXToDest(prsBounds->right); + + return true; +} + +/*---------------------------------------------------------------------------------------------- + Convert a click position to a character position. + + @param zptdClickPosition - relative to the segment draw origin + @param pichw - return character clicked before + @param pfAssocPrev - return true if they clicked on the trailing half of + the previous char, false if click was on the + leading half of the following +----------------------------------------------------------------------------------------------*/ +void SegmentPainter::pointToChar(Point zptdClickPosition, int * pichw, bool * pfAssocPrev) +{ + ChkGrOutPtr(pichw); + ChkGrOutPtr(pfAssocPrev); + + //SetUpGraphics(ichwBase, pgg, true); + + bool fRtl = m_pseg->rightToLeft(); + + if (m_pseg->m_dysAscent < 0 || m_pseg->m_dxsWidth < 0) + m_pseg->ComputeDimensions(); + + if (m_pseg->m_dichwLim == 0 || m_pseg->m_cginf == 0) + { + *pichw = m_pseg->m_ichwMin; + *pfAssocPrev = false; + //RestoreFont(pgg); + return; + } + + float xsClick = ScaleXToSource(zptdClickPosition.x); + float ysClick = ScaleYToSource(zptdClickPosition.y); + ysClick = m_pseg->m_dysAscent - ysClick; // make relative to common base line + + float xsTry = xsClick; + float ysTry = ysClick; + + float xysInc = 1.0; + //res = pgg->LogUnitsFromXPixels(1, &xysInc); + //if (ResultFailed(res)) xysInc = 20; + int cTries = 1; + int nAdjustDir = 0; + + while (true) + { + float xsGlyphOffset; + float xsGlyphWidth; + int iginfLoc = PointToCharAux(xsTry, ysTry, &xsGlyphOffset, &xsGlyphWidth); + + bool fClickedAfter; + int ichwCharClicked; + if (xsTry < m_pseg->m_prgginf[m_pseg->LeftMostGlyph()].bb().left) + { + fClickedAfter = fRtl; + ichwCharClicked = (fClickedAfter) ? + m_pseg->m_ichwMin + m_pseg->m_ichwAssocsLim - 1 : + m_pseg->m_ichwMin + m_pseg->m_ichwAssocsMin; + } + else if (xsTry > m_pseg->m_prgginf[m_pseg->RightMostGlyph()].bb().right) + { + fClickedAfter = !fRtl; + ichwCharClicked = (fClickedAfter) ? + m_pseg->m_ichwMin + m_pseg->m_ichwAssocsLim - 1 : + m_pseg->m_ichwMin + m_pseg->m_ichwAssocsMin; + } + else + { + ichwCharClicked = m_pseg->PhysicalSurfaceToUnderlying(iginfLoc, + xsTry - xsGlyphOffset, m_pseg->m_dysAscent - ysClick, + xsGlyphWidth, m_pseg->m_dysHeight, &fClickedAfter); // handles ligature components + } + + if (fClickedAfter) + { + *pichw = ichwCharClicked + 1; + while (!GrCharStream::AtUnicodeCharBoundary(m_pseg->GetString(), *pichw)) + *pichw = *pichw + 1; + *pfAssocPrev = true; + } + else + { + *pichw = ichwCharClicked; + *pfAssocPrev = false; + } + + if (*pichw < m_pseg->m_ichwMin + m_pseg->m_ichwAssocsMin) + { + //RestoreFont(pgg); + return; + } + else if (*pichw >= m_pseg->m_ichwMin + m_pseg->m_ichwAssocsLim) + { + //RestoreFont(pgg); + return; + } + + //int islout = UnderlyingToLogicalInThisSeg(ichwBase, ichwCharClicked); + int isloutBefore = m_pseg->UnderlyingToLogicalInThisSeg(*pichw); + if (isloutBefore == kNegInfinity || isloutBefore == kPosInfinity) + { } + else + { + Assert(0 <= isloutBefore && isloutBefore < m_pseg->m_cslout); + if (m_pseg->OutputSlot(isloutBefore)->InsertBefore()) + { + // Legal insertion point + //RestoreFont(pgg); + return; + } + } + + // Gradually adjust the click position in various directions and try again + // until we find a legal insertion point. + switch (nAdjustDir) + { + case 0: // Adjust to the left + case 4: + xsTry = xsClick - (xysInc * cTries); + ysTry = ysClick; + nAdjustDir = 0; + break; + case 1: // Adjust to the right + xsTry = xsClick + (xysInc * cTries); + ysTry = ysClick; + break; + case 2: // Adjust up + xsTry = xsClick; + ysTry = ysClick - (xysInc * cTries); + break; + case 3: // Adjust down + xsTry = xsClick; + ysTry = ysClick + (xysInc * cTries); + cTries++; + break; + default: + Assert(false); + nAdjustDir = 0; + cTries++; + } + nAdjustDir++; + + if (cTries > 50) + { // Safety net + *pichw = 0; + *pfAssocPrev = false; + THROW(kresFail); + } + else if (cTries > 20) + xysInc = xysInc * 2; + } + + //RestoreFont(pgg); +} + +/*---------------------------------------------------------------------------------------------- + Convert a click position to a glyph bounding-box position. +----------------------------------------------------------------------------------------------*/ +int SegmentPainter::PointToCharAux(float xsTry, float ysTry, + float * pxsGlyphOffset, float * pxsGlyphWidth) +{ + int iginfLoc = m_pseg->GlyphHit(xsTry, ysTry); + + GlyphInfo * pginf = m_pseg->m_prgginf + iginfLoc; + *pxsGlyphOffset = pginf->bb().left; + *pxsGlyphWidth = pginf->bb().right - *pxsGlyphOffset; + + return iginfLoc; +} + +// Review: may need a way to do this and subsequent methods with one result per method? +/*---------------------------------------------------------------------------------------------- + Returns a value what logical position an arrow key should move the IP to. + + @param ichwIP - initial position + @param pfAssocPrev - is the IP "leaning" backwards? input and output + @param fRight - direction of desired movement (physical or logical?) + @param pfInThisSeg - initially true if ichwIP is in the current segment; + return value is true if there is a legitimate output +----------------------------------------------------------------------------------------------*/ +int SegmentPainter::arrowKeyPosition(int ichwIP, bool * pfAssocPrev, + bool fRight, bool * pfInThisSeg) +//GrResult SegmentPainter::arrowKeyPosition( +// int * pichwIP, bool * pfAssocPrev, +// bool fRight, bool fMovingIn, +// bool * pfResult) +{ + ChkGrArgPtr(pfAssocPrev); + //ChkGrOutPtr(pfInThisSeg); + + bool fMovingIn = !*pfInThisSeg; + int ichwTmp = ichwIP; + bool fResult; + ArrowKeyPositionAux(&ichwTmp, pfAssocPrev, fRight, fMovingIn, false, false, &fResult); + *pfInThisSeg = fResult; + return ichwTmp; + + //return ArrowKeyPositionAux(pichwIP, pfAssocPrev, + // fRight, fMovingIn, false, false, pfResult); +} + +/*---------------------------------------------------------------------------------------------- + Indicate what logical position a shift-arrow-key combination should move the + end of the selection to. + + @param pichw - initial endpoint and also adjusted result + @param fAssocPrevMatch - true if we need a certain orientation for the result; + should be false when *pichw = 0 and we are moving within the + same segment + @param fAssocPrevNeeded - association of the end-point, ie, true if it follows the anchor + @param ichAnchor - -1 if anchor is in a different segment + @param fRight - direction of desired movement + @param fMovingIn - true if we are moving in to this segment; + if so, initial pichw meaningless + @param pfRet - if false try next seg or string +----------------------------------------------------------------------------------------------*/ +int SegmentPainter::extendSelectionPosition(int ichwEnd, bool fAssocPrevMatch, bool fAssocPrevNeeded, + int ichwAnchor, bool fRight, bool * pfInThisSeg) +//GrResult SegmentPainter::extendSelectionPosition( +// int * pichw, bool fAssocPrevMatch, bool fAssocPrevNeeded, int ichwAnchor, +// bool fRight, bool fMovingIn, +// bool* pfRet) +{ + //ChkGrArgPtr(pichw); + //ChkGrOutPtr(pfRet); + + // Make the same adjustment as for an insertion point. + bool fAssocPrevCopy = fAssocPrevMatch; + bool fMovingIn = !*pfInThisSeg; + int ichwOld = ichwEnd; + int ichwNew = ichwEnd; + bool fResult; + ArrowKeyPositionAux(&ichwNew, &fAssocPrevCopy, + fRight, fMovingIn, fAssocPrevMatch, fAssocPrevNeeded, &fResult); + *pfInThisSeg = fResult; + + //int ichwNew = *pichw; + //bool fAssocPrevCopy = fAssocPrevMatch; + //// TODO: adjust fAssocPrevCopy based on assoc-prev value of IP + //*pfRet = false; + //int ichwOld = *pichw; + //GrResult res = ArrowKeyPositionAux(&ichwNew, &fAssocPrevCopy, + // fRight, fMovingIn, + // fAssocPrevMatch, fAssocPrevNeeded, + // pfRet); + +// if (*pfRet && ichwNew == *pichw) +// { +// // The selection wasn't actually moved, just switched the direction it leans. +// // Try one more time. +// res = ArrowKeyPositionAux(&ichwNew, &fAssocPrevCopy, +// fRight, fMovingIn, +// (ichwAnchor != *pichw && fAssocPrevNeeded), fAssocPrevNeeded, +// pfRet); +// } + if (ichwAnchor != -1 && fResult && + ((ichwNew < ichwAnchor && ichwAnchor < ichwOld) || + (ichwOld < ichwAnchor && ichwAnchor < ichwNew))) + { + // Don't switch directions in one operation--force to an insertion point. + ichwNew = ichwAnchor; + } + return ichwNew; + //*pichw = ichwNew; + //ReturnResult(res); +} + +/*---------------------------------------------------------------------------------------------- + Handle arrow key movement for both plain and shifted arrows. + + @param pichw - initial endpoint and also adjusted result + @param pfAssocPrev - association of the end-point, ie, true if it follows the anchor + @param fRight - direction of desired movement + @param fMovingIn - true if we are moving in to this segment; + if so, initial pichw meaningless + @param fAssocPrevMatch - true if the direction of the result should + match the requested orientation, to avoid flipping around and + infinite loops + @param fAssocPrevNeeded - what is needed for the result, if fAssocPrevMatch == true + @param pfRet - if false try next segment or string +----------------------------------------------------------------------------------------------*/ +GrResult SegmentPainter::ArrowKeyPositionAux( + int * pichwIP, bool * pfAssocPrev, + bool fRight, bool fMovingIn, + bool fAssocPrevMatch, bool fAssocPrevNeeded, + bool * pfResult) +{ + ChkGrArgPtr(pfResult); + + //bool fAssocPrevTmp = *pfAssocPrev; + + Assert(m_pseg->m_dxsWidth >= 0); + Assert(m_pseg->m_dysAscent >= 0); + + int nNextOrPrevSeg; + if (!fMovingIn) + { + *pfResult = ArrowKeyPositionInternal(pichwIP, pfAssocPrev, fRight, + fAssocPrevMatch, fAssocPrevNeeded, &nNextOrPrevSeg); + ReturnResult(kresOk); + } + else + { + int ichw; + bool fAssocPrevNew; + if (fRight) + { + // Moving right: make selection at left edge. + int iginf = m_pseg->LeftMostGlyph(); + bool fBefore = !m_pseg->rightToLeft(); + ichw = m_pseg->PhysicalSurfaceToUnderlying(iginf, fBefore) + + ((fBefore) ? 0 : 1); + fAssocPrevNew = !fBefore; // Review: should it be based on the char dir? + } + else + { + // Moving left: make selection at right edge; + int iginf = m_pseg->RightMostGlyph(); + bool fBefore = m_pseg->rightToLeft(); + ichw = m_pseg->PhysicalSurfaceToUnderlying(iginf, fBefore) + + ((fBefore) ? 0 : 1); + fAssocPrevNew = !fBefore; // Review: should it be based on the char dir? + } + + // Okay, now we have a selection at the edge of the segment. Try moving inside by + // one glyph. + *pfResult = ArrowKeyPositionInternal(&ichw, &fAssocPrevNew, fRight, + fAssocPrevMatch, fAssocPrevNeeded, &nNextOrPrevSeg); + if (*pfResult) + { + *pichwIP = ichw; + *pfAssocPrev = fAssocPrevNew; + } + + } + + ReturnResult(kresOk); +} + +/*---------------------------------------------------------------------------------------------- + Used to find out where underlines should be drawn. + + @param ichwMin/Lim - range of text of interest + @param rs, rd - source/destination coordinates, for scaling + @param fSkipSpace - true if white space should not be underlined; some renderers may + ignore this + @param cxdMax - number of ranges allowed + @param prgxdLefts/Rights/UnderTops + - arrays of corresponding values indicating where an underline + should be drawn, in logical order + + TODO: fix the bug where if you have trailing spaces in different segments (eg, + at different sizes), the spaces all but the last segment will be erroneously included + in the underline result. +----------------------------------------------------------------------------------------------*/ +size_t SegmentPainter::getUnderlinePlacement(int ichwMin, int ichwLim, + bool fSkipSpace, size_t cxdMax, + float * prgxdLefts, float * prgxdRights, float * prgydUnderTops) +{ + ChkGrArrayArg(prgxdLefts, cxdMax); + ChkGrArrayArg(prgxdRights, cxdMax); + //ChkGrArrayArg(prgydUnderTops, cxdMax); + + GrResult res = kresOk; + + //SetUpGraphics(ichwBase, pgg, true); + + Assert(m_pseg->m_dxsWidth >= 0); + Assert(m_pseg->m_dysAscent >= 0); + + float xsSegLeft = m_pseg->m_dxsTotalWidth; + for (int iginf = 0; iginf < m_pseg->m_cginf; iginf++) + { + xsSegLeft = min(xsSegLeft, m_pseg->GlyphLeftEdge(iginf)); + } + + float xdSegLeft = this->ScaleXToDest(xsSegLeft); + float xdSegRight = xdSegLeft + m_pseg->m_dxsTotalWidth; + + int ichwMinSel = min(ichwMin, ichwLim); + int ichwLimSel = max(ichwMin, ichwLim); + + int ichwMinSeg = max(ichwMinSel, m_pseg->m_ichwMin + m_pseg->m_ichwAssocsMin); + int ichwLimSeg = min(ichwLimSel, m_pseg->m_ichwMin + m_pseg->m_ichwAssocsLim); + + std::vector vrs; + std::vector vfEntireHt; + + bool * prgfAllCompsSelected = new bool[m_pseg->m_dichwLim]; + std::fill_n(prgfAllCompsSelected, m_pseg->m_dichwLim, false); + CalcPartialLigatures(prgfAllCompsSelected, ichwMinSeg, ichwLimSeg, + ichwMinSel, ichwLimSel); + + // Array to keep track of which glyphs were highlighted: + int cginf = m_pseg->m_cginf; + bool * prgfHighlighted = new bool[cginf]; + std::fill_n(prgfHighlighted, cginf, false); + + for (int ichwLp = ichwMinSeg; ichwLp < ichwLimSeg; ichwLp++) + { + CalcHighlightRect(ichwLp, vrs, vfEntireHt, + !prgfAllCompsSelected[ichwLp - m_pseg->m_ichwMin], prgfHighlighted, + (m_pseg->m_fEndLine && fSkipSpace)); + } + + // If all the glyphs of a given cluster were highlighted, highlight the whole cluster + // as a unit. + for (int islout = 0; islout < m_pseg->m_cslout; islout++) + { + CalcCompleteCluster(islout, vrs, vfEntireHt, prgfHighlighted); + } + + // Convert rectangles in source coordinates to line segments in destination + // coordinates. + std::vector vlsd; + for (size_t irs = 0; irs < vrs.size(); irs++) + { + Rect rsTmp = vrs[irs]; + LineSeg lsdTmp; + lsdTmp.left = min(xdSegRight, max(xdSegLeft, ScaleXToDest(rsTmp.left))); + lsdTmp.right = max(xdSegLeft, min(xdSegRight, ScaleXToDest(rsTmp.right))); + vlsd.push_back(lsdTmp); + } + + // Create a list of line segments with no overlaps. + std::vector vlsdNoOverlaps; + size_t ils; + for (ils = 0; ils < vlsd.size(); ils++) + AddLineSegWithoutOverlaps(vlsdNoOverlaps, vlsd[ils]); + + AssertNoOverlaps(vlsdNoOverlaps); + + // The gap between the baseline and underlining is one pixel, on a normal screen + // at standard magnification, and as near as we can get to the equivalent in any + // special case. + //float dydGap = rdHeight / 96; + //float dydSubscript = max(float(0), (-1 * GrEngine::GrFloatMulDiv(m_pseg->m_dysOffset, rsHeight, rdHeight))); + float dydGap = 1; + float dydSubscript = max(float(0), (-1 * (m_pseg->m_dysOffset * m_yFactor))); + float ydBottom = ScaleYToDest(m_pseg->m_dysAscent) + dydGap + dydSubscript; + + // Put the results in the output buffers. + size_t cxdRet = vlsdNoOverlaps.size(); + for (ils = 0; ils < min(cxdRet, size_t(cxdMax)); ils++) + { + prgxdLefts[ils] = vlsdNoOverlaps[ils].left; + prgxdRights[ils] = vlsdNoOverlaps[ils].right; + if (prgydUnderTops) + prgydUnderTops[ils] = ydBottom; + } + delete[] prgfAllCompsSelected; + delete[] prgfHighlighted; + + //RestoreFont(pgg); + + if (vlsdNoOverlaps.size() > cxdMax) + res = kresFail; + + return cxdRet; +} + + +//:>******************************************************************************************** +//:> Other methods +//:>******************************************************************************************** + +/*---------------------------------------------------------------------------------------------- + Handle either drawing an insertion point or returning the position at which it + would be drawn. + + @param ichwIP - character position + @param fAssocPrev - true if selection is associated with previous character + @param bOn - turning on or off? (ignored in this implementation) + @param fForceSplit - force a split insertion point + @param prdPrimary - if NULL, do drawing; otherwise, return location of primary IP + in destination device coordinates + @param prdSecondary - return location of secondary IP in dest device coordinates + @param pfPrimaryHere - true if primary selection is rendered in this segment + @param pfSecHere - true if (distinct) secondary selection is rendered in this segment; + false if it is in a different segment, or we are rendering + an I-beam (std selection) +----------------------------------------------------------------------------------------------*/ +void SegmentPainter::CalcOrDrawInsertionPoint( + int ichwIP, bool fAssocPrev, bool /*bOn*/, bool fForceSplit, + Rect * prdPrimary, Rect * prdSecondary) +{ + GrResult res = kresOk; + + float xsSegLeft = 0; + float ysSegTop = 0; + + if (prdPrimary) + { + prdPrimary->top = 0; + prdPrimary->bottom = 0; + prdPrimary->left = 0; + prdPrimary->right = 0; + } + if (prdSecondary) + { + prdSecondary->top = 0; + prdSecondary->bottom = 0; + prdSecondary->left = 0; + prdSecondary->right = 0; + } + + int ichwLim = m_pseg->m_ichwMin + m_pseg->m_dichwLim; + bool fRtl = m_pseg->rightToLeft(); + + if (m_pseg->m_dxsWidth < 0) + m_pseg->ComputeDimensions(); + + // Get the locations for the before and after selections. + + float xsBefore, ysBeforeTop, ysBeforeBottom; + float xsAfter, ysAfterTop, ysAfterBottom; + bool fRtlBefore, fRtlAfter; + CalcIP(ichwIP, true, &xsBefore, &ysBeforeTop, &ysBeforeBottom, &fRtlBefore); + CalcIP(ichwIP, false, &xsAfter, &ysAfterTop, &ysAfterBottom, &fRtlAfter); + + if (m_pseg->m_cginf == 0 && ichwIP == ichwLim) + { + Assert(kPosInfFloat == xsBefore && kPosInfFloat == xsAfter); + xsBefore = 0; + xsAfter = 0; + } + else if ((kPosInfFloat == xsBefore || kNegInfFloat == xsBefore) && + (kPosInfFloat == xsAfter || kNegInfFloat == xsAfter)) + { + return; // quick exit for nothing-to-draw case + } + + bool fPrimary = true; + if (fForceSplit) + { + // Supposedly we can't find both halves of the IP in this segment. + Assert(xsBefore == kPosInfFloat || xsBefore == kNegInfFloat + || xsAfter == kPosInfFloat || xsAfter == kNegInfFloat); + if (xsBefore == kPosInfFloat || xsBefore == kNegInfFloat) + { + // Can't find the char the IP is before. + fPrimary = fAssocPrev; + } + else // if (xsAfter == kPosInfinity || xsAfter == kNegInfinity) + { + // Can't find the char the IP is after. + fPrimary = !fAssocPrev; + } + ////Assert((dm == kdmSplitPrimary) == fPrimary); + } + + if (xsBefore == kPosInfinity || xsBefore == kNegInfinity) + { + ysBeforeTop = ysSegTop; + ysBeforeBottom = ysSegTop + m_pseg->m_dysHeight; + } + else + { + xsBefore += xsSegLeft; + ysBeforeTop += ysSegTop; + ysBeforeBottom += ysSegTop; + } + if (xsAfter == kNegInfinity || xsAfter == kPosInfinity) + { + ysAfterTop = ysSegTop; + ysAfterBottom = ysSegTop + m_pseg->m_dysHeight; + } + else + { + xsAfter += xsSegLeft; + ysAfterTop += ysSegTop; + ysAfterBottom += ysSegTop; + } + + float xsLeft = xsSegLeft + + ((fRtl && m_pseg->m_fEndLine) ? (m_pseg->m_dxsVisibleWidth - m_pseg->m_dxsTotalWidth) :0); + float xsRight = xsSegLeft + + ((fRtl && m_pseg->m_fEndLine) ? m_pseg->m_dxsVisibleWidth : m_pseg->m_dxsTotalWidth) + + m_pseg->m_dxsStretch; + float dysMinSplitHeight = m_pseg->m_dysHeight / 4; + + if (!fForceSplit) // kdmNormal == dm) + { + // Standard I-beam, or both halves of split IP. + + bool fIBeam = false; + + if (xsBefore == xsAfter) + // Positions coincide within this segment: make an I-beam. + fIBeam = true; + + else if (fabsf(xsBefore - xsLeft) <= 1 && ichwIP == m_pseg->m_ichwMin) + { + // Logical start is at a left edge: allow I-beam if previous segment has one + // at the end (or there is no previous segment). + //Assert(!fRtlBefore); + //if (m_pseg->m_psegPrev) + //{ + // SegmentPainter segpPrev(m_pseg->m_psegPrev); + // fIBeam = segpPrev.doBoundariesCoincide(true, true); + //} + //else + + fIBeam = true; + } + else if (fabsf(xsBefore - xsRight) <= 1 && ichwIP == m_pseg->m_ichwMin) + { + // Logical start is at a right edge: allow I-beam if previous segment has one + // at the end (or there is no previous segment). + //Assert(fRtlBefore); + //if (m_pseg->m_psegPrev) + //{ + // SegmentPainter segpPrev(m_pseg->m_psegPrev); + // fIBeam = segpPrev.doBoundariesCoincide(true, false); + //} + //else + + fIBeam = true; + } + else if (fabsf(xsAfter - xsLeft) <= 1 && ichwIP == ichwLim) + { + // Logical end is at a left edge: allow I-beam if next segment has one + // at the beginning (or there is no next segment). + //Assert(fRtlAfter); + //if (m_pseg->m_psegNext == NULL) + //{ + // SegmentPainter segpPrev(m_pseg->m_psegPrev); + // fIBeam = segpPrev.doBoundariesCoincide(false, true); + //} + //else + + fIBeam = true; + } + else if (fabsf(xsAfter - xsRight) <= 1 && ichwIP == ichwLim) + { + // Logical end is at a right edge: allow I-beam if next segment has one + // at the beginning (or there is no next segment). + //Assert(!fRtlAfter); + //if (m_pseg->m_psegNext == NULL) + //{ + // SegmentPainter segpPrev(m_pseg->m_psegPrev); + // fIBeam = segpPrev.doBoundariesCoincide(false, false); + //} + //else + + fIBeam = true; + } + else + { + // If the horizontal positions of the two halves are sufficiently close, + // make an I-beam. + fIBeam = CloseIPPositions( + &xsBefore, ysBeforeTop, ysBeforeBottom, + &xsAfter, ysAfterTop, ysAfterBottom); + } + if (ResultFailed(res)) + THROW(WARN(res)); + + if (fIBeam && + ((ichwIP == m_pseg->m_ichwMin && fAssocPrev) || (ichwIP == ichwLim && !fAssocPrev))) + { + // Adjacent segment will show the I-beam, so don't show it here. + if (m_pseg->m_cginf == 0) + { + // Empty segment--assume no adjacent segment. + } + else + return; + } + + if (fIBeam) + { // I-beam caret + + float ysTop = min(ysBeforeTop, ysAfterTop); + float ysBottom = max(ysBeforeBottom, ysAfterBottom); + float xsMid = (xsBefore == kPosInfFloat) ? xsAfter : xsBefore; + InvertIBeam(xsMid, ysTop, ysBottom, fAssocPrev, prdPrimary); + } + else + { // split caret + if (fAssocPrev) + { // xsAfter is primary, xsBefore is secondary + if (xsAfter != kNegInfinity) + { + InvertSplitIP(xsAfter, ysAfterTop, ysAfterBottom, + true, fRtlAfter, false, dysMinSplitHeight, prdPrimary); + } + if (xsBefore != kPosInfFloat) + { + InvertSplitIP(xsBefore, ysBeforeTop, ysBeforeBottom, + false, !fRtlBefore, true, dysMinSplitHeight, prdSecondary); + } + } + else + { // xsBefore is primary, xsAfter is secondary + if (xsBefore != kPosInfinity) + { + InvertSplitIP(xsBefore, ysBeforeTop, ysBeforeBottom, + false, !fRtlBefore, false, dysMinSplitHeight, prdPrimary); + } + if (xsAfter != kNegInfinity) + { + InvertSplitIP(xsAfter, ysAfterTop, ysAfterBottom, + true, fRtlAfter, true, dysMinSplitHeight, prdSecondary); + } + } + //*pfSecHere = true; + } + //*pfPrimaryHere = true; + } + else if (fForceSplit && fPrimary) // kdmSplitPrimary == dm) + { + // Draw just the primary caret. + if (fAssocPrev) + { // xsAfter is primary + if (xsAfter == kNegInfinity) + {} // no primary + else + InvertSplitIP(xsAfter, ysAfterTop, ysAfterBottom, + true, fRtlAfter, false, dysMinSplitHeight, prdPrimary); + } + else + { // xsBefore is primary + if (xsBefore == kPosInfinity) + {} // no primary + else + InvertSplitIP(xsBefore, ysBeforeTop, ysBeforeBottom, + false, !fRtlBefore, false, dysMinSplitHeight, prdPrimary); + } + } + else // fForceSplit && !fPrimary + { + // Draw just the secondary caret. + //Assert(kdmSplitSecondary == dm); + if (fAssocPrev) + { // xsBefore is secondary + if (xsBefore == kPosInfinity) + {} // no secondary + else + InvertSplitIP(xsBefore, ysBeforeTop, ysBeforeBottom, + false, !fRtlBefore, true, dysMinSplitHeight, prdSecondary); + } + else + { // xsAfter is secondary + if (xsAfter == kNegInfinity) + {} // no secondary + else + InvertSplitIP(xsAfter, ysAfterTop, ysAfterBottom, + true, fRtlAfter, true, dysMinSplitHeight, prdSecondary); + } + } +} + +/*---------------------------------------------------------------------------------------------- + Draw an I-beam cursor, or return the location at which it would be drawn. + + Note that currently we do not draw a true I-beam, but rather just a vertical line. + + @param xs - horizontal center of IP + @param ysTop - top of glyph (or ligature component) box + @param ysBottom - bottom of glyph (or ligature component) box + @param fAssocRight - true if the IP is associated with the text to the right + @param rs, rd - source/destination device coordinates + @param prdRet - return location to be drawn in dest device coords; + if NULL, do the drawing +----------------------------------------------------------------------------------------------*/ +void SegmentPainter::InvertIBeam(float xs, float ysTop, float ysBottom, + bool /*fAssocPrev*/, Rect * prdRet) +{ + float xd = ScaleXToDest(xs); + float ydTop = ScaleYToDest(ysTop); + float ydBottom = ScaleYToDest(ysBottom); + + // For now, assume that destination coordinates are in terms of pixels. + float dxdTwoXPixels = 2; + + float dxdLeftAdjust = dxdTwoXPixels / 2; + float dxdRightAdjust = dxdTwoXPixels - dxdLeftAdjust; + +// int dysFontAscent; +// pgg->GetFontAscentSourceUnits(pgg, &dysFontAscent); +// dysFontAscent += m_dysXAscent; +// if (dysFontAscent < 20) +// { +// dxdRightAdjust--; +// dxdRightHook = 1; +// } + + if (prdRet) + { + prdRet->left = xd - dxdLeftAdjust; + prdRet->right = xd + dxdRightAdjust; + prdRet->top = ydTop; + prdRet->bottom = ydBottom; + } + else + { + InvertRect(xd - dxdLeftAdjust, ydTop, + xd + dxdRightAdjust, ydBottom); + + // To make a true I-beam: +// InvertRect(xd-dxdTwoXPixels, ydTop-dydOneYPixel, +// xd+dxdRightHook, ydTop); +// InvertRect(xd-dxdTwoXPixels, ydBottom, +// xd+dxdRightHook, ydBottom+dydOneYPixel); + } +} + +/*---------------------------------------------------------------------------------------------- + Draw a split insertion point, or return the location at which it would be drawn. + + @param xs - horizontal center of IP + @param ysTop - top of glyph (or ligature component) box + @param ysBottom - bottom of glyph (or ligature component) box + @param fTop - true if the IP is to be drawn at the top of the line of text + @param fAssocRight - true if the IP is associated with the text to the right + @param fSecondary - true if the IP is secondary, false if it is primary + @param dysMinSplitHeight + - minimum split cursor height + @param rs, rd - source/destination device coordinates + @param prdRet - return location to be drawn in dest device coords; + if NULL, do the drawing +----------------------------------------------------------------------------------------------*/ +void SegmentPainter::InvertSplitIP(float xs, float ysTop, float ysBottom, + bool fTop, bool fAssocRight, bool fSecondary, float dysMinSplitHeight, + Rect * prdRet) +{ + if (prdRet == NULL && ysTop == ysBottom) + return; // invisible IP + + float xd = ScaleXToDest(xs); + float ydTop = ScaleYToDest(ysTop); + float ydBottom = ScaleYToDest(ysBottom); + float dydMinSplitHeight = dysMinSplitHeight * m_yFactor; + + float ydMid = (ydTop + ydBottom) / 2; + + // For now, assume that destination coordinates are in terms of pixels. + float dxdOneXPixel = 1; + float dydOneYPixel = 1; + float dxdTwoXPixels = 2; + + float xdLeft, xdRight, dxdHookLen; + if (fSecondary) + { + xdLeft = xd - (dxdOneXPixel / 2); + xdRight = xdLeft + 1; + dxdHookLen = 2; + } + else + { + xdLeft = xd - (dxdTwoXPixels / 2); + xdRight = xdLeft + 2; + dxdHookLen = 3; + } + + float yd1, yd2; + if (fTop) + { + yd1 = ydTop; + if (ydMid - ydTop < dydMinSplitHeight) + ydMid = ydTop + dydMinSplitHeight; + yd2 = (fSecondary) ? ydMid : ydMid + 3; + } + else + { + yd2 = ydBottom; + if (ydBottom - ydMid < dydMinSplitHeight) + ydMid = ydBottom - dydMinSplitHeight; + yd1 = (fSecondary) ? ydMid : ydMid - 3; + } + + // Draw the vertical bar. + if (prdRet) + { + prdRet->left = xdLeft; + prdRet->right = xdRight; + // The most common reason for returning the positions of the IP is to scroll it into + // view, in which case we want to return the entire line height, not just the + // height of the IP itself. + prdRet->top = min(ydTop, yd1); + prdRet->bottom = max(ydBottom, yd2); + } + else + { + InvertRect(xdLeft, yd1, xdRight, yd2); + } + + // Draw the horizontal hook. + if (fAssocRight) + { + if (prdRet) + prdRet->right = xdRight + dxdHookLen; + else + { + if (fTop) + InvertRect(xdRight, ydTop, + xdRight + dxdHookLen, ydTop + dydOneYPixel); + else + InvertRect(xdRight, ydBottom - dydOneYPixel, + xdRight + dxdHookLen, ydBottom); + } + } + else + { + if (prdRet) + prdRet->left = xdLeft - dxdHookLen; + else + { + if (fTop) + InvertRect(xdLeft - dxdHookLen, ydTop, + xdLeft, ydTop + dydOneYPixel); + else + InvertRect(xdLeft - dxdHookLen, ydBottom - dydOneYPixel, + xdLeft, ydBottom); + } + } +} + +/*---------------------------------------------------------------------------------------------- + Given a character position (relative to the beginning of the string), return the + position for the insertion point, relative to the top-left of the segment. + Notice that these are before/after positions, not left/right positions. + Return an infinity value to indicate no appropriate IP. + + @param ichwSel - selection position, relative to beginning of string + @param fBefore - true if we are interested in the character the IP is before. + @param pxs, pysTop, pysBottom + - return locations for drawing the IP (top and bottom are not + adjusted for half-selections) + @param pfRtl - return true if the character is right-to-left + + Review: it might be useful to figure out if the two surface glyphs are physically adjacent + in such a way that their IPs can be combined into one I-beam. For now we use a simple + rule that assumes that any glyph or ligature component is at least 10% as wide as the + height of the font (see CloseIPPositions). +----------------------------------------------------------------------------------------------*/ +void SegmentPainter::CalcIP(int ichwSel, bool fBefore, + float * pxs, float * pysTop, float * pysBottom, bool * pfRtl) +{ + Font & font = this->m_pseg->getFont(); + + int ichw = (fBefore) ? ichwSel : ichwSel - 1; + + int iginfOutput; + + *pfRtl = m_pseg->CharIsRightToLeft(ichw, fBefore); + + GrEngine * pgreng = m_pseg->EngineImpl(); + GrGlyphTable * pgtbl = (pgreng) ? pgreng->GlyphTable() : NULL; + + float dysFontAscent = m_pseg->m_dysFontAscent; + ////GrResult res = GetFontAscentSourceUnits(pgg, &dysFontAscent); + ////if (ResultFailed(res)) + //// THROW(WARN(res)); + dysFontAscent += m_pseg->m_dysXAscent; + + *pysTop = 0; + *pysBottom = m_pseg->m_dysHeight; + + int ichwSegOffset = ichw - m_pseg->m_ichwMin; + int isloutLig; + if (ichwSegOffset < m_pseg->m_ichwAssocsMin || ichwSegOffset >= m_pseg->m_ichwAssocsLim) + isloutLig = kNegInfinity; + else + isloutLig = m_pseg->m_prgisloutLigature[ichwSegOffset - m_pseg->m_ichwAssocsMin]; + bool fOkLig = (isloutLig != kNegInfinity); + if (pgtbl && fOkLig) + { + // Ligature component; place the IP at the boundary + // of the component box. + + GrSlotOutput * pslout = m_pseg->OutputSlot(isloutLig); + int icomp = m_pseg->m_prgiComponent[ichwSegOffset - m_pseg->m_ichwAssocsMin]; + + iginfOutput = m_pseg->LogicalToPhysicalSurface(isloutLig); + + float xsGlyphOffset = m_pseg->GlyphLeftEdge(iginfOutput); + + float xsLeft, xsRight, ysTop, ysBottom; + + // TODO: Rework ComponentIndexForGlyph to take slati rather than iForGlyph. + int slati = pslout->ComponentId(icomp); + int iForGlyph = pgtbl->ComponentIndexForGlyph(pslout->GlyphID(), slati); + fOkLig = pgtbl->ComponentBoxLogUnits(m_pseg->m_xysEmSquare, pslout->GlyphID(), iForGlyph, + m_pseg->m_mFontEmUnits, m_pseg->m_dysAscent, + &xsLeft, &ysTop, &xsRight, &ysBottom); + if (fOkLig) + { + if (fBefore == *pfRtl) + // Position of interest is to the right. + *pxs = xsGlyphOffset + xsRight; + else + // Position of interest is to the left. + *pxs = xsGlyphOffset + xsLeft; + + GlyphInfo * pginf = m_pseg->m_prgginf + iginfOutput; + float ysGlyph = pginf->yOffset(); + + *pysTop = ysTop + (m_pseg->m_dysAscent - dysFontAscent) - ysGlyph; + *pysBottom = ysBottom + (m_pseg->m_dysAscent - dysFontAscent) - ysGlyph; + } + } + + if (!fOkLig) + { + // Not a ligature component. + + int islout = m_pseg->UnderlyingToLogicalSurface(ichw, fBefore); + GrSlotOutput * psloutTmp = m_pseg->OutputSlot(islout); + iginfOutput = m_pseg->LogicalToPhysicalSurface(islout); + + if (kPosInfinity == iginfOutput || kNegInfinity == iginfOutput) + *pxs = kPosInfFloat; + + else + { + bool fCluster = (psloutTmp->IsPartOfCluster()); + bool fHighlightBB = fCluster; + // Test below should match the one in CalcHighlightRect: + if ((psloutTmp->ClusterAdvance() == 0 + || psloutTmp->GlyphMetricLogUnits(&font, kgmetAdvWidth) == 0) + && !psloutTmp->IsSpace()) + { + fHighlightBB = true; // use bounding box for zero-advance glyph + } + if (fHighlightBB) + { + // Cluster member or zero-width glyph. + + if (fCluster && AtEdgeOfCluster(psloutTmp, islout, fBefore) && + !CanInsertIntoCluster(psloutTmp, islout)) + { + // Place the IP at the edge of the whole cluster. + + int isloutBase = psloutTmp->ClusterBase(); + GrSlotOutput * psloutBase = m_pseg->OutputSlot(isloutBase); + //int igbbBase = psloutBase->GlyphBbIndex(); + int iginfBase = m_pseg->LogicalToPhysicalSurface(isloutBase); + + float xsBase = m_pseg->GlyphLeftEdge(iginfBase); + + float xsLeft = xsBase + psloutBase->ClusterXOffset(); + float xsRight = xsBase + psloutBase->ClusterAdvance(); + + if (fBefore == *pfRtl) + // Position of interest is to the right + *pxs = xsRight; + else + // Position of interest is to the left. + *pxs = xsLeft; + } + else + { + // Place the IP on the perimeter of the bounding box of the cluster member. + + float xsGlyphStart = m_pseg->GlyphLeftEdge(iginfOutput); + +// float dysFontAscent; +// res = GetFontAscentSourceUnits(pgg, &dysFontAscent); +// if (ResultFailed(res)) THROW(WARN(res)); +// dysFontAscent += m_dysXAscent; + + float ysBbTop = psloutTmp->GlyphMetricLogUnits(&font, kgmetBbTop); + float ysBbBottom = psloutTmp->GlyphMetricLogUnits(&font, kgmetBbBottom); + float xsBbLeft = psloutTmp->GlyphMetricLogUnits(&font, kgmetBbLeft); + float xsBbRight = psloutTmp->GlyphMetricLogUnits(&font, kgmetBbRight); + + int twoPixels = 2; // assume dest coords are in pixels + + if (fBefore == *pfRtl) + // Position of interest is to the right + *pxs = xsGlyphStart + xsBbRight + twoPixels; + else + // Position of interest is to the left. + *pxs = xsGlyphStart + xsBbLeft - twoPixels; + + GlyphInfo * pginf = m_pseg->m_prgginf + iginfOutput; + float ysGlyph = pginf->yOffset(); + float ysGlyphBaseline = m_pseg->m_dysAscent - ysGlyph; // relative to top + + *pysTop = ysGlyphBaseline - ysBbTop - twoPixels; + *pysBottom = ysGlyphBaseline - ysBbBottom + twoPixels; + } + } + else + { + // Insertion point goes at origin or advance width of glyph. + + *pxs = m_pseg->GlyphLeftEdge(iginfOutput); + if (fBefore == *pfRtl) + { + // Position of interest is to the right + //*pxs += psloutTmp->GlyphMetricLogUnits(&font, kgmetAdvWidth); + *pxs += psloutTmp->ClusterAdvance(); + } + // else position of interest is to the left + } + } + } +} + +/*---------------------------------------------------------------------------------------------- + If the two positions for the insertion point are close enough, merge them into + one insertion point, and return true to indicate that we want an I-beam. + + @param pxsBefore, pxsAfter - for comparing, and also adjusted results + @param ysBeforeTop/Bottom, ysAfterTop/Bottom - for comparing +----------------------------------------------------------------------------------------------*/ +bool SegmentPainter::CloseIPPositions(float * pxsBefore, float ysBeforeTop, float ysBeforeBottom, + float * pxsAfter, float ysAfterTop, float ysAfterBottom) +{ + // No adjustment if vertical positions are disjoint. + if (ysBeforeBottom <= ysAfterTop) + return false; + if (ysAfterBottom <= ysBeforeTop) + return false; + + float dysHt = max(ysBeforeBottom, ysAfterBottom) - min(ysBeforeTop, ysAfterTop); + float dxsDiff = fabsf(*pxsBefore - *pxsAfter); + + // If the difference in the x positions is less than 10% of the height, + // we want an I-beam--use the average. + if (dxsDiff * 10 < dysHt) + { + *pxsBefore = (*pxsBefore + *pxsAfter) / 2; + *pxsAfter = *pxsBefore; + return true; + } + + return false; +} + +/*---------------------------------------------------------------------------------------------- + Return true if the slot in question is the first or last slot of its cluster, + or if it is not part of a cluster at all. Return false if the specified side + of the slot is interior to a cluster. + + @param fBefore - if true, we are examining the slot the insertion point is before, + so we are interested in whether this slot is at the + leading edge of the cluster. +----------------------------------------------------------------------------------------------*/ +bool SegmentPainter::AtEdgeOfCluster(GrSlotOutput * pslout, int islout, bool fBefore) +{ + if (!pslout->IsPartOfCluster()) + return true; + + if (fBefore && (islout == 0)) + return true; + if (!fBefore && (m_pseg->m_cslout == islout + 1)) + return true; + + // If the adjacent slot in whatever direction we're interested in has the same + // cluster base, this slot is not on the edge of the cluster. + // -- NO, because you could have an intervening glyph that is not part of the + // cluster. + //int isloutAdjacentBase = (fBefore) ? + // m_pseg->OutputSlot(islout - 1)->ClusterBase() : + // m_pseg->OutputSlot(islout + 1)->ClusterBase(); + //return (isloutAdjacentBase != m_pseg->OutputSlot(islout)->ClusterBase()); + + // Ask the cluster base. + return AtEdgeOfCluster(m_pseg->OutputSlot(pslout->ClusterBase()), pslout->ClusterBase(), + pslout, islout, fBefore); +} + +bool SegmentPainter::AtEdgeOfCluster(GrSlotOutput * psloutBase, int isloutBase, + GrSlotOutput * /*pslout*/, int islout, bool fBefore) +{ + // Compare pslout to all the members of the cluster. If it is the minimum or maximum, it + // is at an edge. + if (fBefore && isloutBase < islout) + return false; + if (!fBefore && isloutBase > islout) + return false; + + std::vector visloutCluster; + m_pseg->ClusterMembersForGlyph(isloutBase, psloutBase->ClusterRange(), visloutCluster); + + for (size_t iislout = 0; iislout < visloutCluster.size(); iislout++) + { + int isloutMember = visloutCluster[iislout]; + if (fBefore && isloutMember < islout) + return false; + if (!fBefore && isloutMember > islout) + return false; + } + return true; +} + +/*---------------------------------------------------------------------------------------------- + Return true if it is permitted to put an insertion point somewhere in the middle of + the given slot's cluster. +----------------------------------------------------------------------------------------------*/ +bool SegmentPainter::CanInsertIntoCluster(GrSlotOutput * pslout, int islout) +{ + if (!pslout->IsPartOfCluster()) + return false; + + int isloutBase = pslout->ClusterBase(); + if (islout != isloutBase) + { + // Ask the cluster base. + Assert(pslout->ClusterRange() == 0); + return CanInsertIntoCluster(m_pseg->OutputSlot(isloutBase), isloutBase); + } + + if (!AtEdgeOfCluster(pslout, islout, true) && pslout->InsertBefore()) + return true; + + std::vector visloutCluster; + m_pseg->ClusterMembersForGlyph(isloutBase, pslout->ClusterRange(), visloutCluster); + + for (size_t iislout = 0; iislout < visloutCluster.size(); iislout++) + { + int isloutMember = visloutCluster[iislout]; + if (AtEdgeOfCluster(m_pseg->OutputSlot(isloutMember), isloutMember, true)) + // Inserting before the first member of the cluster doesn't count. + continue; + + if (m_pseg->OutputSlot(isloutMember)->InsertBefore()) + return true; + } + + return false; +} + +/*---------------------------------------------------------------------------------------------- + Determine which characters in the selected range are part of ligatures that are fully + selected vs. those that are only partially selected. Those that are only partially selected + must have their components highlighted individually, but those that are fully selected + should be highlighted fully, to avoid blank spots in the case that the components do not + fully cover the surface of the glyph. + + @param prgfAllSelected - array of flags to fill in with results + @param ichwMin/LimSeg - range of characters to examine + @param ichwMin/LimSel - range of characters that are selected +----------------------------------------------------------------------------------------------*/ +void SegmentPainter::CalcPartialLigatures(bool * prgfAllSelected, + int ichwMinSeg, int ichwLimSeg, + int ichwMinSel, int ichwLimSel) +{ + GrEngine * pgreng = m_pseg->EngineImpl(); + GrGlyphTable * pgtbl = (pgreng) ? pgreng->GlyphTable() : NULL; + + for (int ichw = ichwMinSeg; ichw < ichwLimSeg; ichw++) + { + int ichwSegOffset = ichw - m_pseg->m_ichwMin; + int isloutLig; + if (ichwSegOffset < m_pseg->m_ichwAssocsMin || ichwSegOffset >= m_pseg->m_ichwAssocsLim) + isloutLig = kNegInfinity; + else + isloutLig = m_pseg->m_prgisloutLigature[ichwSegOffset - m_pseg->m_ichwAssocsMin]; + bool fLigComp = (pgtbl && isloutLig != kNegInfinity); + if (fLigComp && !prgfAllSelected[ichwSegOffset]) + { + GrSlotOutput * pslout = m_pseg->OutputSlot(isloutLig); + bool fAll = true; + int icomp; + for (icomp = 0; icomp < pslout->NumberOfComponents(); icomp++) + { + int ichwUnderlying = pslout->FirstUnderlyingComponent(icomp); // is it possible to select one char of a component and not another? + if (ichwUnderlying < ichwMinSel - m_pseg->m_ichwMin || + ichwUnderlying >= ichwLimSel - m_pseg->m_ichwMin) + { + fAll = false; // found a component that is not selected + } + } + for (icomp = 0; icomp < pslout->NumberOfComponents(); icomp++) + { + for (int ichw2 = pslout->FirstUnderlyingComponent(icomp) ; + ichw2 <= pslout->LastUnderlyingComponent(icomp) ; + ichw2++) + { + if (m_pseg->m_prgiComponent[ichw2 - m_pseg->m_ichwAssocsMin] == icomp) + prgfAllSelected[ichw2] = fAll; + } + } + } + } +} + +/*---------------------------------------------------------------------------------------------- + The given character is part of the selected range. Add to the vector a rectangle (or + eventually, several) indicating the corresponding screen area(s) of the character. + The rectangle is relative to the top left of the segment. + + @param ichw - selected char, relative to beginning of string + @param vrs - list of rectangles to highlight, in source coords, relative to + segment draw position (top-left) + @param vfEntireHt - for each of the above rectangles, true if the rect should be + extended to include the entire line + @param fJustComponent - true if we want to highlight just the single ligature component + this character maps to; false if the entire ligature is selected + @param rgfHighlighted - for each glyph in this segment, whether it is being highlighted + by this operation + @param fSkipTrSpace - should we skip trailing white space? +----------------------------------------------------------------------------------------------*/ +void SegmentPainter::CalcHighlightRect(int ichw, + std::vector & vrs, std::vector & vfEntireHt, + bool fJustComponent, bool * rgfHighlighted, bool fSkipTrSpace) +{ + GrResult res; + + GrEngine * pgreng = m_pseg->EngineImpl(); + GrGlyphTable * pgtbl = (pgreng) ? pgreng->GlyphTable() : NULL; + //bool fRtl = m_pseg->rightToLeft(); + + Font & font = m_pseg->getFont(); + + if (!GrCharStream::AtUnicodeCharBoundary(m_pseg->GetString(), ichw)) + // Second half of a surrogate pair, or UTF-8: ignore. + return; + + // Calculate the location for the glyph that this IP is before. + + int ichwSegOffset = ichw - m_pseg->m_ichwMin; + int isloutLig; + if (ichwSegOffset < m_pseg->m_ichwAssocsMin || ichwSegOffset >= m_pseg->m_ichwAssocsLim) + isloutLig = kNegInfinity; + else + isloutLig = m_pseg->m_prgisloutLigature[ichwSegOffset - m_pseg->m_ichwAssocsMin]; + bool fLigComp = (pgtbl && isloutLig != kNegInfinity); + if (fLigComp && fJustComponent) + { + // Character is a ligature component. + + GrSlotOutput * pslout = m_pseg->OutputSlot(isloutLig); + int icomp = m_pseg->m_prgiComponent[ichwSegOffset - m_pseg->m_ichwAssocsMin]; + int iginfOutput = m_pseg->LogicalToPhysicalSurface(isloutLig); + + float xsGlyphStart = m_pseg->GlyphLeftEdge(iginfOutput); + + float xsLeft, xsRight, ysTop, ysBottom; + + // TODO: Rework ComponentIndexForGlyph to take slati rather than iForGlyph. + int slati = pslout->ComponentId(icomp); + int iForGlyph = pgtbl->ComponentIndexForGlyph(pslout->GlyphID(), slati); + pgtbl->ComponentBoxLogUnits(m_pseg->m_xysEmSquare, pslout->GlyphID(), iForGlyph, + m_pseg->m_mFontEmUnits, m_pseg->m_dysAscent, + &xsLeft, &ysTop, &xsRight, &ysBottom); + + float dysFontAscent = m_pseg->m_dysFontAscent; + ////GetFontAscentSourceUnits(pgg, &dysFontAscent); + dysFontAscent += m_pseg->m_dysXAscent; + GlyphInfo * pginf = m_pseg->m_prgginf + iginfOutput; + float ysForGlyph = pginf->yOffset(); + float dysGlyphTop = (m_pseg->m_dysAscent - dysFontAscent) - ysForGlyph; // rel. to common baseline + + Rect rsNew; + rsNew.top = ysTop + dysGlyphTop; + rsNew.bottom = ysBottom + dysGlyphTop; + rsNew.left = xsGlyphStart + xsLeft; + rsNew.right = xsGlyphStart + xsRight; + vrs.push_back(rsNew); + + vfEntireHt.push_back(false); + } + else + { + std::vector vislout = m_pseg->UnderlyingToLogicalAssocs(ichw); + if (vislout.size() == 0) + return; + + float xsGlyphLeft, xsGlyphRight; + + res = kresOk; + + for (size_t iislout = 0; iislout < vislout.size(); iislout++) + { + int islout = vislout[iislout]; + if (islout == kNegInfinity || islout == kPosInfinity) + continue; + int iginfTmp = m_pseg->LogicalToPhysicalSurface(islout); + Assert(iginfTmp != kNegInfinity); + Assert(iginfTmp != kPosInfinity); + + if (fSkipTrSpace && islout >= m_pseg->m_isloutVisLim) + continue; + + Rect rsNew; + GrSlotOutput * psloutTmp = m_pseg->OutputSlot(islout); + bool fHighlightBB = psloutTmp->IsPartOfCluster(); + // Test below should match the one in CalcIP-- + // If the glyph has no advance width but does have a real bounding box, + // highlight the bounding box. Review: do we want this??? + if ((psloutTmp->ClusterAdvance() == 0 + || psloutTmp->GlyphMetricLogUnits(&font, kgmetAdvWidth) == 0) + && !psloutTmp->IsSpace()) + { + fHighlightBB = true; + } + xsGlyphLeft = m_pseg->GlyphLeftEdge(iginfTmp); + if (fHighlightBB) + { + // For now, highlight just the bounding box of this glyph. After we finish + // highlighting all glyphs individually, we'll go back and highlight + // as one unit any clusters that are completely selected. + +// int dysFontAscent; +// res = GetFontAscentSourceUnits(pgg, &dysFontAscent); // if we restore this code, add in ExtraAscent +// if (ResultFailed(res)) THROW(WARN(res)); +// dysFontAscent += m_dysXAscent; + + GlyphInfo * pginf = m_pseg->m_prgginf + iginfTmp; + float ysForGlyph = pginf->yOffset(); + float ysGlyphBaseline = m_pseg->m_dysAscent - ysForGlyph; // relative to top + + float ysBbTop = psloutTmp->GlyphMetricLogUnits(&font, kgmetBbTop); + float ysBbBottom = psloutTmp->GlyphMetricLogUnits(&font, kgmetBbBottom); + float xsBbLeft = psloutTmp->GlyphMetricLogUnits(&font, kgmetBbLeft); + float xsBbRight = psloutTmp->GlyphMetricLogUnits(&font, kgmetBbRight); + + rsNew.top = ysGlyphBaseline - ysBbTop - 2; + rsNew.bottom = ysGlyphBaseline - ysBbBottom + 2; + rsNew.left = xsGlyphLeft + xsBbLeft - 2; + rsNew.right = xsGlyphLeft + xsBbRight + 2; + + vfEntireHt.push_back(false); + } + else + { + // Highlight entire width of the glyph from the top of the line to the bottom. + // Horizontally, highlight from the origin of the glyph to the advance width. + + //xsGlyphRight = xsGlyphLeft + psloutTmp->GlyphMetricLogUnits(&font, kgmetAdvWidth); + xsGlyphRight = xsGlyphLeft + psloutTmp->ClusterAdvance(); + + if (xsGlyphLeft > xsGlyphRight) + std::swap(xsGlyphLeft, xsGlyphRight); + + rsNew.top = 0; + rsNew.bottom = m_pseg->m_dysHeight; + rsNew.left = xsGlyphLeft; + rsNew.right = xsGlyphRight; + + vfEntireHt.push_back(true); + } + vrs.push_back(rsNew); + + if (rgfHighlighted) + rgfHighlighted[iginfTmp] = true; + } + } +} + +/*---------------------------------------------------------------------------------------------- + If the output slot is a cluster base and all the members of the cluster are highlighted, + simply highlight the cluster as a single rectangle, to avoid unslightly gaps + between glyphs. (Note that this does not remove the rectangles that were already included + to handle the individual members.) + The rectangles are relative to the top left of the segment. + + @param islout - output slot index + @param vrect - list of rectangles to highlight; add result here + @param prgfHighlighted - flags indicating which glyphs have been highlighted, indexed by + physical surface position +----------------------------------------------------------------------------------------------*/ +void SegmentPainter::CalcCompleteCluster(int islout, + std::vector & vrs, std::vector & vfEntireHt, bool * prgfHighlighted) +{ + //GrEngine * pgreng = m_pseg->EngineImpl(); + + GrSlotOutput * pslout = m_pseg->OutputSlot(islout); + if (pslout->ClusterRange() == 0) + return; + + int iginfDraw = m_pseg->LogicalToPhysicalSurface(islout); + if (!prgfHighlighted[iginfDraw]) + return; + + bool fAllHighlighted = true; + + std::vector visloutCluster; + m_pseg->ClusterMembersForGlyph(islout, pslout->ClusterRange(), visloutCluster); + for (size_t i = 0; i < visloutCluster.size(); i++) + { + int iginfMemberDraw = m_pseg->LogicalToPhysicalSurface(visloutCluster[i]); + if (!prgfHighlighted[iginfMemberDraw]) + { + fAllHighlighted = false; + break; + } + } + + if (!fAllHighlighted) + return; + + // All the members of this cluster are highlighted. + + float xsGlyphStart = m_pseg->GlyphLeftEdge(iginfDraw); + + Rect rsNew; + rsNew.top = 0; + rsNew.bottom = m_pseg->m_dysHeight; + rsNew.left = xsGlyphStart + pslout->ClusterXOffset(); + rsNew.right = xsGlyphStart + pslout->ClusterAdvance(); + vrs.push_back(rsNew); + + vfEntireHt.push_back(true); +} + +/*---------------------------------------------------------------------------------------------- + Add the given rectangle to the vector, eliminating any overlapping areas. + + Note this method can be recursive: if we have to break the current rectangle into + two, we'll call the method again the for new +----------------------------------------------------------------------------------------------*/ +void SegmentPainter::AddRectWithoutOverlaps(std::vector & vrect, Rect rectToAdd) +{ + std::vector vrectMoreToAdd; + + bool fAnythingToAdd = AnyArea(&rectToAdd); + + size_t irect; + for (irect = 0; irect < vrect.size(); irect++) + { + bool f = AdjustRectsToNotOverlap(vrect, irect, &rectToAdd, vrectMoreToAdd); + if (!AnyArea(&vrect[irect])) + { + vrect.erase(vrect.begin() + irect); + irect--; + } + if (!f) + { + fAnythingToAdd = false; + break; + } + } + + // Now rectToAdd is in a state that it does not intersect with any other rectangles + // in the list. + + if (fAnythingToAdd) + vrect.push_back(rectToAdd); + + // Add in any extra rectangles that are needed to handle overlaps. + + for (irect = 0; irect < vrectMoreToAdd.size(); irect++) + AddRectWithoutOverlaps(vrect, vrectMoreToAdd[irect]); +} + +/*---------------------------------------------------------------------------------------------- + Return true if the rectangle has an area greater than 0. +----------------------------------------------------------------------------------------------*/ +bool SegmentPainter::AnyArea(Rect * prect) +{ + Assert(prect->left <= prect->right); + Assert(prect->top <= prect->bottom); + + return (prect->left < prect->right && prect->top < prect->bottom); +} + +/*---------------------------------------------------------------------------------------------- + Adjust the rectangle prect2 to avoid overlaps with the given one in the vector. + Return false if the rectangle does not need to be added after all. + + If we have to split this rectangle into two, add the second one to vrectMoreToAdd, so + we can do the same process on it. + + If we can merge the two rectangles, add the result to vrectMoreToAdd (so it can be properly + checked for further overlaps), and adjust the rectangle in the vector so it will be + deleted. + + @param vrect - current list of valid rectangles + @param irect - item in vrect we're comparing with prect2 + @param prect2 - rectangle to add + @param vrectMoreToAdd - list of accumulated rectangles that need to be added + (caused by splitting one into two) + + @return True if we want to add prect2 (possibly adjusted) to the list; + false it it is completely subsumed by vrect[irect], or has been merged with it, + or has no area. +----------------------------------------------------------------------------------------------*/ +bool SegmentPainter::AdjustRectsToNotOverlap(std::vector & vrect, int irect, Rect * prect2, + std::vector & vrectMoreToAdd) +{ + Rect * prect1 = &(vrect[irect]); + + float xLeft1 = prect1->left; + float xRight1 = prect1->right; + float yTop1 = prect1->top; + float yBottom1 = prect1->bottom; + Assert(xLeft1 < xRight1); + Assert(yTop1 < yBottom1); + + float xLeft2 = prect2->left; + float xRight2 = prect2->right; + float yTop2 = prect2->top; + float yBottom2 = prect2->bottom; + Assert(xLeft2 <= xRight2); + Assert(yTop2 <= yBottom2); + + if (!AnyArea(prect2)) + return false; + + // No overlap: keep both as they are. + if (yBottom2 < yTop1 || yBottom1 < yTop2) + return true; + if (xRight2 < xLeft1 || xRight1 < xLeft2) + return true; + + // Present rect subsumes new: ignore new + if (xLeft1 <= xLeft2 && xRight2 <= xRight1 && yTop1 <= yTop2 && yBottom2 <= yBottom1) + return false; + + // New rect subsumes present: replace. + if (xLeft2 <= xLeft1 && xRight1 <= xRight2 && yTop2 <= yTop1 && yBottom1 <= yBottom2) + { + prect1->bottom = prect1->top; // delete + return true; // keep this one + } + + // Abutting rectangles of same height or width: merge. + if (yTop1 == yTop2 && yBottom1 == yBottom2) + { + if (xRight1 == xLeft2) + { + // prect2 is to the right + prect2->left = prect1->left; + vrectMoreToAdd.push_back(*prect2); + prect1->bottom = prect1->top; // delete previous + return false; + } + else if (xRight2 == xLeft1) + { + // prect2 is to the left + prect2->right = prect1->right; + vrectMoreToAdd.push_back(*prect2); + prect1->bottom = prect1->top; // delete + return false; + } + } + if (xLeft1 == xLeft2 && xRight1 == xRight2) + { + if (yBottom1 == yTop2) + { + // prect2 is below + prect2->top = prect1->top; + vrectMoreToAdd.push_back(*prect2); + prect1->bottom = prect1->top; // delete + return false; + } + else if (yBottom2 == yTop1) + { + // prect2 is above + prect2->bottom = prect1->bottom; + vrectMoreToAdd.push_back(*prect2); + prect1->bottom = prect1->top; // delete + return false; + } + } + + // Abutting rectangles of different heights or widths: leave as they are. + if (xRight1 == xLeft2 || xRight2 == xLeft1) + return true; + if (yBottom1 == yTop2 || yBottom2 == yTop1) + return true; + + // Overlapping on one axis: adjust smaller rectangle + if (yTop1 <= yTop2 && yBottom2 <= yBottom1) + { + if (xLeft1 <= xLeft2 && xLeft2 < xRight1) + { + Assert(xRight1 < xRight2); // otherwise rect2 is subsumed + prect2->left = prect1->right; + return true; + } + else if (xLeft1 < xRight2 && xRight2 <= xRight1) + { + Assert(xLeft2 < xLeft1); // otherwise rect2 is subsumed + prect2->right = prect1->left; + return true; + } + } + else if (yTop2 <= yTop1 && yBottom1 <= yBottom2) + { + if (xLeft2 <= xLeft1 && xLeft1 < xRight2) + { + Assert(xRight2 < xRight1); // otherwise rect1 is subsumed + prect1->left = prect2->right; + return true; + } + else if (xLeft2 < xRight1 && xRight1 <= xRight2) + { + Assert(xLeft1 < xLeft2); // otherwise rect1 is subsumed + prect1->right = prect2->left; + return true; + } + } + + if (xLeft1 <= xLeft2 && xRight2 <= xRight1) + { + if (yTop1 <= yTop2 && yTop2 < yBottom1) + { + Assert(yBottom1 < yBottom2); // otherwise rect2 is subsumed + prect2->top = prect1->bottom; + return true; + } + else if (yTop1 < yBottom2 && yBottom2 <= yBottom1) + { + Assert(yTop2 < yTop1); // otherwise rect2 is subsumed + prect2->bottom = prect1->top; + return true; + } + } + else if (xLeft2 <= xLeft1 && xRight1 <= xRight2) + { + if (yTop2 <= yTop1 && yTop1 < yBottom2) + { + Assert(yBottom2 < yBottom1); // otherwise rect1 is subsumed + prect1->top = prect2->bottom; + return true; + } + else if (yTop2 < yBottom1 && yBottom1 <= yBottom2) + { + Assert(yTop1 < yTop2); // otherwise rect1 is subsumed + prect1->bottom = prect2->top; + return true; + } + } + + // Centers overlap: break prect2 into two disjoint rectangles. + if (xLeft1 < xLeft2 && xRight2 < xRight1 && yTop2 < yTop1 && yBottom1 < yBottom2) + { + // create a new rectangle for the bottom of prect2 that is below prect1 + Rect rectNew = *prect2; + rectNew.top = prect1->bottom; + prect2->bottom = prect1->top; + vrectMoreToAdd.push_back(rectNew); + return true; + } + else if (xLeft2 < xLeft1 && xRight1 < xRight2 && yTop1 < yTop2 && yBottom2 < yBottom1) + { + // create a new rectangle for the right of prect2 that is to the right of prect1 + Rect rectNew = *prect2; + rectNew.left = prect1->right; + prect2->right = prect1->left; + vrectMoreToAdd.push_back(rectNew); + return true; + } + + // Corners overlap: break prect2 into two adjacent rectangles. + if (xLeft1 < xLeft2 && xRight1 < xRight2) + { + // prect2 is partially to the right + if (yTop1 < yTop2 && yBottom1 < yBottom2) + { + // prect2 is partially below + Rect rectNew = *prect2; + rectNew.left = prect1->right; + prect2->top = prect1->bottom; + vrectMoreToAdd.push_back(rectNew); + return true; + } + else if (yTop2 < yTop1 && yBottom2 < yBottom1) + { + // prect2 is partially above + Rect rectNew = *prect2; + rectNew.left = prect1->right; + prect2->bottom = prect1->top; + vrectMoreToAdd.push_back(rectNew); + return true; + } + } + else if (xLeft2 < xLeft1 && xRight2 < xRight1) + { + // prect2 is partially to the left + if (yTop1 < yTop2 && yBottom1 < yBottom2) + { + // prect2 is partially below + Rect rectNew = *prect2; + rectNew.right = prect1->left; + prect2->top = prect1->bottom; + vrectMoreToAdd.push_back(rectNew); + return true; + } + else if (yTop2 < yTop1 && yBottom2 < yBottom1) + { + // prect2 is partially above + Rect rectNew = *prect2; + rectNew.right = prect1->left; + prect2->bottom = prect1->top; + vrectMoreToAdd.push_back(rectNew); + return true; + } + } + + // No overlap. + return true; +} + +/*---------------------------------------------------------------------------------------------- + Assert that there are no overlaps among all the rectangles in the array, which should + be the case if AdjustRectsToNotOverlap is working properly. +----------------------------------------------------------------------------------------------*/ +#ifdef _DEBUG +void SegmentPainter::AssertNoOverlaps(std::vector & vrect) +#else +void SegmentPainter::AssertNoOverlaps(std::vector &) +#endif +{ +#ifdef _DEBUG + for (int irect1 = 0; irect1 < signed(vrect.size() - 1); irect1++) + { + for (int irect2 = irect1 + 1; irect2 < signed(vrect.size()); irect2++) + { + float xLeft1 = vrect[irect1].left; + float xRight1 = vrect[irect1].right; + float yTop1 = vrect[irect1].top; + float yBottom1 = vrect[irect1].bottom; + Assert(xLeft1 < xRight1); + Assert(yTop1 < yBottom1); + + float xLeft2 = vrect[irect2].left; + float xRight2 = vrect[irect2].right; + float yTop2 = vrect[irect2].top; + float yBottom2 = vrect[irect2].bottom; + Assert(xLeft2 <= xRight2); + Assert(yTop2 <= yBottom2); + + Assert(xRight1 <= xLeft2 || xRight2 <= xLeft1 || + yBottom1 <= yTop2 || yBottom2 <= yTop1); + } + } +#endif +} + +/*---------------------------------------------------------------------------------------------- + Add the given line segment to the vector, eliminating any overlapping areas. +----------------------------------------------------------------------------------------------*/ +void SegmentPainter::AddLineSegWithoutOverlaps(std::vector & vls, LineSeg lsToAdd) +{ + std::vector vlsMoreToAdd; + + bool fAnythingToAdd = AnyLength(&lsToAdd); + + size_t ils; + for (ils = 0; ils < vls.size(); ils++) + { + bool f = AdjustLineSegsToNotOverlap(vls, ils, &lsToAdd, vlsMoreToAdd); + if (!AnyLength(&vls[ils])) + { + vls.erase(vls.begin() + ils); + ils--; + } + if (!f) + { + fAnythingToAdd = false; + break; + } + } + + // Now lsToAdd is in a state that it does not overlap with any other line segments + // in the list. + + if (fAnythingToAdd) + vls.push_back(lsToAdd); + + // Add in any extra line segments that are needed to handle overlaps. + + for (ils = 0; ils < vlsMoreToAdd.size(); ils++) + AddLineSegWithoutOverlaps(vls, vlsMoreToAdd[ils]); +} + +/*---------------------------------------------------------------------------------------------- + Return true if the rectangle has an area greater than 0. +----------------------------------------------------------------------------------------------*/ +bool SegmentPainter::AnyLength(LineSeg * pls) +{ + Assert(pls->left <= pls->right); + return (pls->left < pls->right); +} + +/*---------------------------------------------------------------------------------------------- + Adjust the line segment pls2 to avoid overlaps with the given one in the vector. + Return false if the line segment does not need to be added after all. + + If we can merge the two line segments, add the result to vrectMoreToAdd (so it can be properly + checked for further overlaps), and adjust the rectangle in the vector so it will be + deleted. + + @param vls - current list of valid line segments + @param ils - item in vrect we're comparing with pls2 + @param pls2 - line segment to add + @param vlsMoreToAdd - list of accumulated line segments that need to be added + (caused by splitting one into two) + + @return True if we want to add pls2 (possibly adjusted) to the list; + false it it is completely subsumed by vls[ils], or has been merged with it, + or has no length. +----------------------------------------------------------------------------------------------*/ +bool SegmentPainter::AdjustLineSegsToNotOverlap(std::vector & vls, int ils, LineSeg * pls2, + std::vector & vlsMoreToAdd) +{ + LineSeg * pls1 = &(vls[ils]); + + float xLeft1 = pls1->left; + float xRight1 = pls1->right; + Assert(xLeft1 < xRight1); + + float xLeft2 = pls2->left; + float xRight2 = pls2->right; + Assert(xLeft2 <= xRight2); + + if (!AnyLength(pls2)) + return false; + + // No overlap: keep both as they are. + if (xRight2 < xLeft1 || xRight1 < xLeft2) + return true; + + // Present line segment subsumes new: ignore new + if (xLeft1 <= xLeft2 && xRight2 <= xRight1) + return false; + + // New line segment subsumes present: replace. + if (xLeft2 <= xLeft1 && xRight1 <= xRight2) + { + pls1->left = pls1->right; // delete previous + return true; // keep this one + } + + // Adjacent or partially overlapping line segments: merge. + if (xLeft1 <= xLeft2 && xLeft2 <= xRight1 && xRight1 <= xRight2) + { + pls2->left = xLeft1; + vlsMoreToAdd.push_back(*pls2); + pls1->left = pls1->right; // delete previous + return false; + } + else if (xLeft2 <= xLeft1 && xLeft1 <= xRight2 && xRight2 <= xRight1) + { + pls2->right = xRight1; + vlsMoreToAdd.push_back(*pls2); + pls1->left = pls1->right; // delete previous + return false; + } + else + Assert(false); + + return true; +} + +/*---------------------------------------------------------------------------------------------- + Assert that there are no overlaps among all the rectangles in the array, which should + be the case if AdjustRectsToNotOverlap is working properly. +----------------------------------------------------------------------------------------------*/ +#ifdef _DEBUG +void SegmentPainter::AssertNoOverlaps(std::vector & vls) +#else +void SegmentPainter::AssertNoOverlaps(std::vector &) +#endif +{ +#ifdef _DEBUG + for (int ils1 = 0; ils1 < (int)vls.size() - 1; ils1++) + { + for (int ils2 = ils1 + 1; ils2 < (int)vls.size(); ils2++) + { + float xLeft1 = vls[ils1].left; + float xRight1 = vls[ils1].right; + Assert(xLeft1 < xRight1); + + float xLeft2 = vls[ils2].left; + float xRight2 = vls[ils2].right; + Assert(xLeft2 <= xRight2); + + Assert(xRight1 <= xLeft2 || xRight2 <= xLeft1); + } + } +#endif +} + +/*---------------------------------------------------------------------------------------------- + Find the next physical location for the IP. Return true if we found one. + + @param pichw - current insertion point, and adjusted result to return + @param pfAssocPrev - is the IP "leaning" backwards? adjust to return + @param fRight - true if we are moving right + @param fAssocPrevMatch - the assoc-prev of the result must match the original selection. + This is used when extending range selections; the orientation + of the resulting end-point must be the same as previously. + This helps avoids circular loops when dealing with reordering. + @param fAssocPrevNeeded - value needed for result; ignored if fAssocPrevMatch == false + @param pnNextOrPrevSeg - return 1 if we need to try the following segment, -1 if we + need to try the previous - CURRENTLY NOT USED for anything + practical +----------------------------------------------------------------------------------------------*/ +bool SegmentPainter::ArrowKeyPositionInternal( + int * pichw, bool * pfAssocPrev, + bool fRight, bool fAssocPrevMatch, bool fAssocPrevNeeded, int * pnNextOrPrevSeg) +{ + const bool kBefore = true; + const bool kAfter = false; + + bool fResult = false; + + // Handle ligatures. + + fResult = AdjacentLigComponent(pichw, pfAssocPrev, fRight, true); + if (fResult) + return true; + + // Not within a ligature, or on the outside edge of one. + + int iginfStart; + bool fCharRtl; + if (*pfAssocPrev) + { + iginfStart = m_pseg->UnderlyingToPhysicalSurface(*pichw - 1, kAfter); + fCharRtl = m_pseg->CharIsRightToLeft(*pichw - 1, kAfter); + } + else + { + iginfStart = m_pseg->UnderlyingToPhysicalSurface(*pichw, kBefore); + fCharRtl = m_pseg->CharIsRightToLeft(*pichw, kBefore); + } + if (kNegInfinity == iginfStart || kPosInfinity == iginfStart) + { + *pnNextOrPrevSeg = 0; + return false; + } + + //if (*pfAssocPrev) + // fCharRtl ? iginfStart : iginfStart++; + //else + // fCharRtl ? iginfStart++ : iginfStart; + + if (*pfAssocPrev) + iginfStart++; + + // At this point iginfStart indicates the index of the glyph we are before. + + int ichwNewIndex; + bool fAPNew; + + bool fRtl = m_pseg->rightToLeft(); + bool fForward = (fRtl) ? !fRight : fRight; + int dir = (fForward) ? 1 : -1; + int diginf = 0; + + // When moving forward, we first move to the opposite side of the current glyph, + // so initially diginf should be zero. + if (fForward) + diginf = -1; + + while (true) + { + diginf++; + int iginfTry = iginfStart + (dir * diginf); + + if (iginfTry < 0) + { + *pnNextOrPrevSeg = -1; + return false; + } + if (iginfTry > m_pseg->m_cginf) + { + *pnNextOrPrevSeg = 1; + return false; + } + if (iginfTry == m_pseg->m_cginf && fForward) + { + *pnNextOrPrevSeg = 1; + return false; + } + + bool fAfter; + int ichwTryChar; + if (iginfTry == m_pseg->m_cginf) + { + ichwTryChar = m_pseg->PhysicalSurfaceToUnderlying(iginfTry - 1, + kPosInfFloat, kPosInfFloat, 0, 0, &fAfter); + } + else + { + ichwTryChar = m_pseg->PhysicalSurfaceToUnderlying(iginfTry, + (fRight) ? kPosInfFloat : kNegInfFloat, + (fRight) ? kPosInfFloat : kNegInfFloat, + 0, 0, &fAfter); + } + + if (fAfter) + { + ichwNewIndex = ichwTryChar + 1; + fAPNew = true; + } + else + { + ichwNewIndex = ichwTryChar; + fAPNew = false; + } + + if (ichwNewIndex == *pichw) + continue; // didn't make any progress + + LgIpValidResult ipvr = isValidInsertionPoint(ichwNewIndex); + if (ipvr == kipvrBad) + continue; // bad insertion point + + if (fAssocPrevMatch && (fAssocPrevNeeded != fAPNew)) + { + // Try switching fAPNew and see if that gives the right result + bool fAPAlt = !fAPNew; + int iginfAlt = m_pseg->UnderlyingToPhysicalSurface( + fAPAlt ? ichwTryChar - 1 : ichwTryChar + 1, + fAPAlt ? kAfter : kBefore); + fCharRtl = m_pseg->CharIsRightToLeft( + fAPAlt ? ichwTryChar - 1 : ichwTryChar + 1, + fAPAlt ? kAfter : kBefore); + + if (fAPAlt) + fCharRtl ? iginfAlt : iginfAlt++; + else + fCharRtl ? iginfAlt++ : iginfAlt; + + if ((fForward && iginfAlt <= iginfStart) + || (!fForward && iginfAlt >= iginfStart)) + { + // Switching fAPNew would cause us to move in the opposite direction, so + // that's not a good solution. Keep going. + if ((iginfStart == 0 && !fForward) || (iginfStart == m_pseg->m_cginf && fForward)) + { + // Can't go any further, so go with this even though AP is wrong. + } + else + continue; + } + fAPNew = fAPAlt; + } + break; + } + + // If we have a selection within a ligature, adjust to either the right-most or the + // left-most. + AdjacentLigComponent(&ichwNewIndex, &fAPNew, fRight, false); + + *pichw = ichwNewIndex; + *pfAssocPrev = fAPNew; + return true; +} + +/****** OLD VERSION +bool Segment::ArrowKeyPositionInternal( + int * pichw, bool * pfAssocPrev, + bool fRight, bool fAssocPrevMatch, bool fAssocPrevNeeded, int * pnNextOrPrevSeg) +{ + int kBefore = true; + int kAfter = false; + + bool fResult = false; + + // Handle ligatures. + + fResult = AdjacentLigComponent(pichw, pfAssocPrev, fRight, true); + if (fResult) + return true; + + // Not within a ligature, or on the outside edge of one. + + int igbbOutput; + bool fCharRtl; + if (*pfAssocPrev) + { + igbbOutput = UnderlyingToPhysicalSurface(*pichw - 1, kAfter); + fCharRtl = CharIsRightToLeft(*pichw - 1, kAfter); + } + else + { + igbbOutput = UnderlyingToPhysicalSurface(*pichw, kBefore); + fCharRtl = CharIsRightToLeft(*pichw, kBefore); + } + if (kNegInfinity == igbbOutput || kPosInfinity == igbbOutput) + { + *pnNextOrPrevSeg = 0; + return false; + } + + if (*pfAssocPrev) + fCharRtl ? igbbOutput : igbbOutput++; + else + fCharRtl ? igbbOutput++ : igbbOutput; + + bool fBackward = (fRight == m_fWsRtl); + + // Try to find an underlying position that would produce an IP in the expected place. + // First look in the same direction in the underlying text, then, if necessary, try the + // opposite direction (which may be necessary when reordering occurred). + + int igbbNeed = (fRight) ? igbbOutput + 1 : igbbOutput - 1; + int ichwNew; + bool fAssocPrevNew; + + while (0 <= igbbNeed && igbbNeed <= NumGbb()) // include end-points--we may need to + // be before or after them. + { + int dichwInc = fBackward ? -1 : 1; + int dichwLim = m_ichwMin + (fBackward ? 0 : m_dichwLim); + + int nDirectionsTried = 0; +// while (nDirectionsTried < 2) -- Nope, for now we are being very strict above moving + while (nDirectionsTried < 1) // only in the desired direction + { + for (int ichwTry = *pichw; + ((dichwInc == 1 && ichwTry <= dichwLim) || + (dichwInc == -1 && ichwTry >= dichwLim)); + ichwTry += dichwInc) + { + int igbbTry = UnderlyingToPhysicalSurface(ichwTry, kBefore); + fCharRtl = CharIsRightToLeft(ichwTry, kBefore); + igbbTry = fCharRtl ? igbbTry + 1 : igbbTry; + if (igbbTry == igbbNeed && + (ichwTry != *pichw || *pfAssocPrev) && + (!fAssocPrevMatch || !fAssocPrevNeeded)) + { + ichwNew = ichwTry; + fAssocPrevNew = false; + goto LFixLigatures; + } + + igbbTry = UnderlyingToPhysicalSurface(ichwTry - 1, kAfter); + fCharRtl = CharIsRightToLeft(ichwTry - 1, kAfter); + igbbTry = fCharRtl ? igbbTry : igbbTry + 1; + if (igbbTry == igbbNeed && + (ichwTry != *pichw || !*pfAssocPrev) && + (!fAssocPrevMatch || fAssocPrevNeeded)) + { + ichwNew = ichwTry; + fAssocPrevNew = true; + goto LFixLigatures; + } + } + + nDirectionsTried++; + + // Didn't find an answer going the expected way; try the opposite direction. + dichwInc = (fRight) ? -1 : 1; + dichwLim = m_ichwMin + ((fRight) ? 0 : m_dichwLim); + } + + // Didn't find an underlying position that would produce an IP in the next glyph; + // try the glyph after that. + + igbbNeed = (fRight) ? igbbNeed + 1 : igbbNeed - 1; + } + + if (igbbNeed >= NumGbb()) + *pnNextOrPrevSeg = 1; // try next segment + else if (igbbNeed < 0) + *pnNextOrPrevSeg = -1; // try previous segment + else + { + Assert(false); + *pnNextOrPrevSeg = 0; + } + + return false; + +LFixLigatures: + + // If we have a selection within a ligature, adjust to either the right-most or the + // left-most. + AdjacentLigComponent(&ichwNew, &fAssocPrevNew, fRight, false); + + *pichw = ichwNew; + *pfAssocPrev = fAssocPrevNew; + return true; +} +******************/ + +/*---------------------------------------------------------------------------------------------- + Return position for the physically next or previous ligature component, or the right-most + or left-most. Return true if this routine handled it. + + @param pichw - starting underlying position + @param pfAssocPrev - is selection leaning backwards? + @param fMovingRight - true if right arrow key was pressed, false if left + @param fMove - if true, we want to find the next one over from *pichw; + if false, we want to find either the right-most + (fMovingRight = false) + or the left-most (fMovingRight = true) +----------------------------------------------------------------------------------------------*/ +bool SegmentPainter::AdjacentLigComponent(int * pichw, bool * pfAssocPrev, + bool fMovingRight, bool fMove) +{ + const bool kBefore = true; + const bool kAfter = false; + + GrEngine * pgreng = m_pseg->EngineImpl(); + GrGlyphTable * pgtbl = (pgreng) ? pgreng->GlyphTable() : NULL; + + if (!pgtbl) + { + return false; + } + + // Find the slot containing the ligature glyph. + + int ichwSegOffset = *pichw - m_pseg->m_ichwMin; + int isloutLig = kNegInfinity; + if (*pfAssocPrev) + { + if (ichwSegOffset - 1 >= m_pseg->m_ichwAssocsMin && ichwSegOffset - 1 < m_pseg->m_ichwAssocsLim) + isloutLig = m_pseg->m_prgisloutLigature[ichwSegOffset - 1 - m_pseg->m_ichwAssocsMin]; + } + else + { + if (ichwSegOffset >= m_pseg->m_ichwAssocsMin && ichwSegOffset < m_pseg->m_ichwAssocsLim) + isloutLig = m_pseg->m_prgisloutLigature[ichwSegOffset - m_pseg->m_ichwAssocsMin]; + } + + if (isloutLig == kNegInfinity) + { + return false; + } + + if (*pfAssocPrev) + ichwSegOffset--; + + bool fGlyphRtl = (*pfAssocPrev) ? + m_pseg->CharIsRightToLeft(*pichw - 1, kAfter) : + m_pseg->CharIsRightToLeft(*pichw, kBefore); + + // Comparing right-sides. + bool fIPOnRight = (fGlyphRtl != *pfAssocPrev); + + // When two ligatures are horizontally equal, take vertical position into account. + // In left-to-right writing systems, moving right means moving down. + bool fMovingDown = (fMovingRight != m_pseg->m_fWsRtl); + + // Get the coordinates for all the ligatures. + + std::vector vysTops; + std::vector vysBottoms; + std::vector vxsLefts; + std::vector vxsRights; + + float ysTopCurr, ysBottomCurr, xsLeftCurr, xsRightCurr; + int icompCurr = -1; + if (fMovingRight) + ysTopCurr = ysBottomCurr = xsLeftCurr = xsRightCurr = kNegInfFloat; + else + ysTopCurr = ysBottomCurr = xsLeftCurr = xsRightCurr = kPosInfFloat; + + GrSlotOutput * pslout = m_pseg->OutputSlot(isloutLig); + //int iginfOutput = m_pseg->LogicalToPhysicalSurface(isloutLig); + + int icomp; + for (icomp = 0; icomp < pslout->NumberOfComponents(); icomp++) + { + float xsLeft, ysTop, xsRight, ysBottom; + + // TODO: Rework ComponentIndexForGlyph to take slati rather than iForGlyph. + int slati = pslout->ComponentId(icomp); + int iForGlyph = pgtbl->ComponentIndexForGlyph(pslout->GlyphID(), slati); + pgtbl->ComponentBoxLogUnits(m_pseg->m_xysEmSquare, pslout->GlyphID(), iForGlyph, + m_pseg->m_mFontEmUnits, m_pseg->m_dysAscent, + &xsLeft, &ysTop, &xsRight, &ysBottom); + + vysTops.push_back(ysTop); + vysBottoms.push_back(ysBottom); + vxsLefts.push_back(xsLeft); + vxsRights.push_back(xsRight); + + // If we're moving, record this component as the one we're moving relative to. + if (fMove && icomp == m_pseg->m_prgiComponent[ichwSegOffset - m_pseg->m_ichwAssocsMin]) + { + icompCurr = icomp; + ysTopCurr = ysTop; + ysBottomCurr = ysBottom; + xsLeftCurr = xsLeft; + xsRightCurr = xsRight; + } + } + + float xsHorizCurr = (fIPOnRight) ? xsRightCurr : xsLeftCurr; + float xsHorizNext; + + // Find the first ligature that is in the proper direction. + int icompNext; + for (icompNext = 0; icompNext < pslout->NumberOfComponents(); icompNext++) + { + if (icompNext != icompCurr) + { + xsHorizNext = (fIPOnRight) ? vxsRights[icompNext] : vxsLefts[icompNext]; + if (fMovingRight && xsHorizNext > xsHorizCurr) + break; + else if (!fMovingRight && xsHorizNext < xsHorizCurr) + break; + } + } + if (icompNext == pslout->NumberOfComponents()) + { + bool fResult; + // No component in the proper direction. Can we switch to the opposite edge of the + // current component? + if (fMovingRight && !fIPOnRight) + { + if (fGlyphRtl) + --(*pichw); + else + ++(*pichw); + *pfAssocPrev = !*pfAssocPrev; + fResult = true; + } + else if (!fMovingRight && fIPOnRight) + { + if (fGlyphRtl) + ++(*pichw); + else + --(*pichw); + + *pfAssocPrev = !*pfAssocPrev; + fResult = true; + } + else + fResult = false; + return fResult; + } + + xsHorizNext = (fIPOnRight) ? vxsRights[icompNext] : vxsLefts[icompNext]; + + // Now find the closest one in the proper direction. + for (icomp = icompNext + 1; icomp < pslout->NumberOfComponents(); icomp++) + { + if (icomp != icompCurr) + { + float xsHorizTry = (fIPOnRight) ? vxsRights[icomp] : vxsLefts[icomp]; + + if (fMovingRight && xsHorizTry > xsHorizCurr && + (xsHorizTry < xsHorizNext || + (xsHorizTry == xsHorizNext && + (vysTops[icomp] > vysTops[icompNext]) == fMovingDown))) + { + icompNext = icomp; + xsHorizNext = xsHorizTry; + } + else if (!fMovingRight && xsHorizTry < xsHorizCurr && + (xsHorizTry > xsHorizNext || + (xsHorizTry == xsHorizNext && + (vysTops[icomp] > vysTops[icompNext]) == fMovingDown))) + { + icompNext = icomp; + xsHorizNext = xsHorizTry; + } + } + } + + *pichw = pslout->FirstUnderlyingComponent(icompNext) + m_pseg->m_ichwMin; // TODO: handle multiple components per ligature + if (*pfAssocPrev) + ++(*pichw); + + return true; +} + +/*---------------------------------------------------------------------------------------------- + Scale the x-coordinate by the scaling factors for this painter. +----------------------------------------------------------------------------------------------*/ +float SegmentPainter::ScaleX(float xs, Rect rs, Rect rd) +{ + //return rs.MapXTo(xs, rd); + + float dxs = rs.right - rs.left; + float dxd = rd.right - rd.left; + Assert(dxs > 0); + if (dxs == dxd) + return xs + rd.left - rs.left; + + float xd = rd.left + GrEngine::GrFloatMulDiv((xs - rs.left), dxd, dxs); + return xd; +} + +/*---------------------------------------------------------------------------------------------- + Scale the y-coordinate by the scaling factors for this painter. +----------------------------------------------------------------------------------------------*/ +float SegmentPainter::ScaleY(float ys, Rect rs, Rect rd) +{ + //return rs.MapYTo(ys, rd); + + float dys = rs.bottom - rs.top; + float dyd = rd.bottom - rd.top; + Assert(dys > 0); + if (dys == dyd) + return ys + rd.top - rs.top; + float yd = rd.top + GrEngine::GrFloatMulDiv((ys - rs.top), dyd, dys); + return yd; +} + + +//:>******************************************************************************************** +//:> Low-level platform-specific drawing methods +//:>******************************************************************************************** + +/*---------------------------------------------------------------------------------------------- + Make sure the font is set to use the character properties required by this segment. +----------------------------------------------------------------------------------------------*/ +void SegmentPainter::SetFontProps(unsigned long /*clrFore*/, unsigned long /*clrBack*/) +{ + return; +} + +} // namespace gr diff --git a/Build/source/libs/graphite/engine-2.4/src/segment/FileInput.cpp b/Build/source/libs/graphite/engine-2.4/src/segment/FileInput.cpp new file mode 100644 index 00000000000..9b646c07513 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/src/segment/FileInput.cpp @@ -0,0 +1,269 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 1999, 2001 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: FileInput.cpp +Responsibility: Sharon Correll +Last reviewed: Not yet. + +Description: + Contains the functions for reading from a TT file. (These are functions, not methods + associated with a class.) +----------------------------------------------------------------------------------------------*/ + +//:>******************************************************************************************** +//:> Include files +//:>******************************************************************************************** + +#include "GrCommon.h" +#include "GrData.h" +#ifndef _WIN32 +#include "GrMstypes.h" +#endif +#include "GrDebug.h" +#include +#include +#include +#include "FileInput.h" +#include "GrResult.h" + +//#ifndef _MSC_VER +//#include "config.h" +//#endif + +#ifdef _MSC_VER +#pragma hdrstop +#endif + +//:End Ignore + +//:>******************************************************************************************** +//:> Forward declarations +//:>******************************************************************************************** + +//:>******************************************************************************************** +//:> Local Constants and static variables +//:>******************************************************************************************** + +namespace gr +{ + +//:>******************************************************************************************** +//:> Methods of GrBufferIStream +//:>******************************************************************************************** + +/*---------------------------------------------------------------------------------------------- + Constructor. +----------------------------------------------------------------------------------------------*/ +GrBufferIStream::GrBufferIStream() +{ + m_pbStart = NULL; + m_pbNext = NULL; + m_pbLim = NULL; +} + +/*---------------------------------------------------------------------------------------------- + Destructor. +----------------------------------------------------------------------------------------------*/ +GrBufferIStream::~GrBufferIStream() +{ + Close(); +} + +/*---------------------------------------------------------------------------------------------- + Initialize the stream. +----------------------------------------------------------------------------------------------*/ +#ifdef GR_FW +bool GrBufferIStream::Open(std::wstring stuFileName, int kMode) +#else +bool GrBufferIStream::Open(const char * /*pcFileName*/, std::ios::openmode /*kMode*/) +#endif +{ + Assert(false); // use OpenBuffer + return false; +} + +/*---------------------------------------------------------------------------------------------- + Initialize the stream to a buffer. +----------------------------------------------------------------------------------------------*/ +bool GrBufferIStream::OpenBuffer(const byte * pbBuffer, int cb) +{ + Assert(m_pbStart == NULL); + Assert(m_pbNext == NULL); + Assert(m_pbLim == NULL); + + m_pbStart = pbBuffer; + m_pbNext = pbBuffer; + if (cb > 0) + m_pbLim = m_pbStart + cb; + // otherwise we don't know the length + + return true; +} + +/*---------------------------------------------------------------------------------------------- + Close the stream. +----------------------------------------------------------------------------------------------*/ +void GrBufferIStream::Close() +{ + m_pbStart = NULL; + m_pbNext = NULL; + m_pbLim = NULL; +} + +/*---------------------------------------------------------------------------------------------- + Read a byte from the stream. +----------------------------------------------------------------------------------------------*/ +byte GrBufferIStream::ReadByteFromFont() +{ + if (m_pbLim && m_pbNext >= m_pbLim) + THROW(kresReadFault); + + return *m_pbNext++; +} + +/*---------------------------------------------------------------------------------------------- + Read a short (signed 16-bit) word from the stream. Switch the bytes from big-endian + to little-endian format. +----------------------------------------------------------------------------------------------*/ +short GrBufferIStream::ReadShortFromFont() +{ + short snInput; + + if (m_pbLim && 2 > m_pbLim - m_pbNext) + THROW(kresReadFault); + + snInput = (m_pbNext[0] << 8) + m_pbNext[1]; + m_pbNext += 2; + return snInput; +} + +/*---------------------------------------------------------------------------------------------- + Read a wide character (unsigned 16-bit word) from the stream. + Switch the bytes from big-endian to little-endian format. +----------------------------------------------------------------------------------------------*/ +utf16 GrBufferIStream::ReadUShortFromFont() +{ + utf16 chwInput; + + if (m_pbLim && 2 > m_pbLim - m_pbNext) + THROW(kresReadFault); + + chwInput = (m_pbNext[0] << 8) + m_pbNext[1]; + m_pbNext += 2; + return chwInput; +} + +/*---------------------------------------------------------------------------------------------- + Read a standard (32-bit) word from the stream. Switch the bytes from big-endian + to little-endian format. +----------------------------------------------------------------------------------------------*/ +int GrBufferIStream::ReadIntFromFont() +{ + sdata32 nInput = 0; + + if (m_pbLim && 4 > m_pbLim - m_pbNext) + THROW(kresReadFault); + + nInput = (m_pbNext[0] << 24) + (m_pbNext[1] << 16) + (m_pbNext[2] << 8) + m_pbNext[3]; + m_pbNext += 4; + return nInput; +} + +/*---------------------------------------------------------------------------------------------- + Read a block of data from the stream. DON'T switch the bytes from big-endian + to little-endian format. +----------------------------------------------------------------------------------------------*/ +void GrBufferIStream::ReadBlockFromFont(void * pvInput, int cb) +{ + if (m_pbLim && (cb < 0 || cb > m_pbLim - m_pbNext)) + THROW(kresReadFault); + std::copy(m_pbNext, m_pbNext + cb, reinterpret_cast(pvInput)); + m_pbNext += cb; +} + +/*---------------------------------------------------------------------------------------------- + Get the absolute position of the font-file stream (relative to the beginning of + the file). For buffers, we just return the byte position in the buffer. +----------------------------------------------------------------------------------------------*/ +void GrBufferIStream::GetPositionInFont(long * plPos) +{ + *plPos = (m_pbNext - m_pbStart); +} + +/*---------------------------------------------------------------------------------------------- + Set the position of the font-file stream to the given absolute position (relative + to the beginning of the file). For buffers, assume the position is relative to the + beginning of the buffer. +----------------------------------------------------------------------------------------------*/ +void GrBufferIStream::SetPositionInFont(long lPos) +{ + if (m_pbLim && (lPos < 0 || lPos > m_pbLim - m_pbStart)) + THROW(kresReadFault); + m_pbNext = m_pbStart + lPos; +} + + +//:>******************************************************************************************** +//:> Swap byte order. +//:>******************************************************************************************** +int swapb(int nArg) +{ +#if WORDS_BIGENDIAN +return nArg; +#else + int b1, b2, b3, b4; + b1 = ((nArg & 0xFF000000) >> 24) & 0x000000FF; // remove sign extension + b2 = ((nArg & 0x00FF0000) >> 8); // & 0x0000FF00; + b3 = ((nArg & 0x0000FF00) << 8); // & 0x00FF0000; + b4 = ((nArg & 0x000000FF) << 24); // & 0xFF000000; + int nRet = b1 | b2 | b3 | b4; + return nRet; +#endif +} + +unsigned int swapb(unsigned int nArg) +{ +#if WORDS_BIGENDIAN +return nArg; +#else + int b1, b2, b3, b4; + b1 = ((nArg & 0xFF000000) >> 24) & 0x000000FF; // remove sign extension + b2 = ((nArg & 0x00FF0000) >> 8); // & 0x0000FF00; + b3 = ((nArg & 0x0000FF00) << 8); // & 0x00FF0000; + b4 = ((nArg & 0x000000FF) << 24); // & 0xFF000000; + int nRet = b1 | b2 | b3 | b4; + return nRet; +#endif +} + +utf16 swapb(utf16 chwArg) +{ +#if WORDS_BIGENDIAN +return chwArg; +#else + utf16 b1, b2; + b1 = ((chwArg & 0xFF00) >> 8) & 0x00FF; // remove sign extension + b2 = ((chwArg & 0x00FF) << 8); // & 0xFF00; + utf16 chwRet = b1 | b2; + return chwRet; +#endif +} + +short swapb(short snArg) +{ +#if WORDS_BIGENDIAN +return snArg; +#else + short b1, b2; + b1 = ((snArg & 0xFF00) >> 8) & 0x00FF; // remove sign extension + b2 = ((snArg & 0x00FF) << 8); // & 0xFF00; + short snRet = b1 | b2; + return snRet; +#endif +} + +} //namespace gr + diff --git a/Build/source/libs/graphite/engine-2.4/src/segment/FileInput.h b/Build/source/libs/graphite/engine-2.4/src/segment/FileInput.h new file mode 100644 index 00000000000..022206b06a4 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/src/segment/FileInput.h @@ -0,0 +1,104 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 1999, 2001 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: FileInput.h +Responsibility: Sharon Correll +Last reviewed: not yet + +Description: + Defines utility functions for reading from a font file. +----------------------------------------------------------------------------------------------*/ + +#ifdef _MSC_VER +#pragma once +#endif +#ifndef FILEINPUT_INCLUDED +#define FILEINPUT_INCLUDED + +//:End Ignore + +namespace gr +{ + +int swapb(int nArg); +unsigned int swapb(unsigned int nArg); +utf16 swapb(utf16 chwArg); +short swapb(short snArg); + +// Most significant byte first (converting from least-sig-first): +inline int msbf(int nArg) { return swapb(nArg); } +inline unsigned int msbf(unsigned int nArg) { return swapb(nArg); } +inline utf16 msbf(utf16 chwArg) { return swapb(chwArg); } +inline short msbf(short chwArg) { return swapb(chwArg); } + +// Least significant byte first (converting from most-sig first): +inline int lsbf(int nArg) { return swapb(nArg); } +inline unsigned int lsbf(unsigned int nArg) { return swapb(nArg); }; +inline utf16 lsbf(utf16 chwArg) { return swapb(chwArg); } +inline short lsbf(short chwArg) { return swapb(chwArg); } + +class GrIStream +{ +public: + virtual void Close() = 0; + + virtual byte ReadByteFromFont() = 0; + virtual short ReadShortFromFont() = 0; + virtual utf16 ReadUShortFromFont() = 0; + virtual int ReadIntFromFont() = 0; + virtual void ReadBlockFromFont(void * pvInput, int cb) = 0; + + virtual void GetPositionInFont(long * plPos) = 0; + virtual void SetPositionInFont(long lPos) = 0; + + virtual bool OpenBuffer(const byte * pbBuffer, int cb) = 0; + virtual void CloseBuffer() = 0; + +protected: + virtual ~GrIStream() {} +}; + + +/*---------------------------------------------------------------------------------------------- + A stream that reads from a buffer rather than a file. +----------------------------------------------------------------------------------------------*/ +class GrBufferIStream : public GrIStream +{ +public: + GrBufferIStream(); + ~GrBufferIStream(); + + #ifdef GR_FW + virtual bool Open(std::wstring stuFileName, std::ios::openmode kMode); + #else + virtual bool Open(const char * pcFileName, std::ios::openmode kMode); + #endif + virtual void Close(); + + virtual byte ReadByteFromFont(); + virtual short ReadShortFromFont(); + virtual utf16 ReadUShortFromFont(); + virtual int ReadIntFromFont(); + virtual void ReadBlockFromFont(void * pvInput, int cb); + + virtual void GetPositionInFont(long * plPos); + virtual void SetPositionInFont(long lPos); + + virtual bool OpenBuffer(const byte * pbBuffer, int cb); + virtual void CloseBuffer() + { + Close(); + } + +protected: + const byte * m_pbStart; + const byte * m_pbNext; + const byte * m_pbLim; +}; + +} // namespace gr + +#endif // !FILEINPUT_INCLUDED diff --git a/Build/source/libs/graphite/engine-2.4/src/segment/FontCache.cpp b/Build/source/libs/graphite/engine-2.4/src/segment/FontCache.cpp new file mode 100644 index 00000000000..d69a842f29c --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/src/segment/FontCache.cpp @@ -0,0 +1,305 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 1999, 2001 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: FontCache.cpp +Responsibility: Sharon Correll +Last reviewed: Not yet. + +Description: + A cache of all the font-face objects. +----------------------------------------------------------------------------------------------*/ + +//:>******************************************************************************************** +//:> Include files +//:>******************************************************************************************** +#include "Main.h" +#ifdef _MSC_VER +#pragma hdrstop +#endif +// any other headers (not precompiled) + +//:End Ignore + +//:>******************************************************************************************** +//:> Forward declarations +//:>******************************************************************************************** + +//:>******************************************************************************************** +//:> Local Constants and static variables +//:>******************************************************************************************** + +//:>******************************************************************************************** +//:> Methods +//:>******************************************************************************************** + +namespace gr +{ + +/*---------------------------------------------------------------------------------------------- + Store the given font-face in the cache. Overwrite whatever was there before. + Return NULL if there is nothing appropriate there. +----------------------------------------------------------------------------------------------*/ +void FontCache::GetFontFace(std::wstring strFaceName, bool fBold, bool fItalic, + FontFace ** ppfface) +{ + int ifci = FindCacheItem(strFaceName); + if (ifci < 0) // no fonts of that family present + { + *ppfface = NULL; + return; + } + + CacheItem * pfci = m_prgfci + ifci; + if (fBold) + { + if (fItalic) + *ppfface = pfci->pffaceBI; + else + *ppfface = pfci->pffaceBold; + } + else + { + if (fItalic) + *ppfface = pfci->pffaceItalic; + else + *ppfface = pfci->pffaceRegular; + } +} + +/*---------------------------------------------------------------------------------------------- + Store the given font-face in the cache. Overwrite whatever was there before. +----------------------------------------------------------------------------------------------*/ +void FontCache::CacheFontFace(std::wstring strFaceName, bool fBold, bool fItalic, + FontFace * pfface) +{ + if (m_prgfci == NULL) + Initialize(); + + int ifciIns = FindCacheItem(strFaceName); + int ifci = ifciIns; + if (ifciIns < 0) + { + ifci = (ifciIns + 1) * -1; + InsertCacheItem(ifci); + std::copy(strFaceName.c_str(), strFaceName.c_str() + + (strFaceName.size() + 1), m_prgfci[ifci].szFaceName); + } + + CacheItem * pfci = m_prgfci + ifci; + + bool fPrevNull; + if (fBold) + { + if (fItalic) + { + fPrevNull = (pfci->pffaceBI == NULL); + pfci->pffaceBI = pfface; + } + else + { + fPrevNull = (pfci->pffaceBold == NULL); + pfci->pffaceBold = pfface; + } + } + else + { + if (fItalic) + { + fPrevNull = (pfci->pffaceItalic == NULL); + pfci->pffaceItalic = pfface; + } + else + { + fPrevNull = (pfci->pffaceRegular == NULL); + pfci->pffaceRegular = pfface; + } + } + + if (fPrevNull && (pfface != NULL)) + m_cfface++; +} + +/*---------------------------------------------------------------------------------------------- + Remove the given font-face from the cache. Return false if it couldn't be found. +----------------------------------------------------------------------------------------------*/ +bool FontCache::RemoveFontFace(std::wstring strFaceName, bool fBold, bool fItalic, + bool fZapCache) +{ + int ifci = FindCacheItem(strFaceName); + if (ifci < 0) + { + return false; + } + + bool fPrevVal; + CacheItem * pfci = m_prgfci + ifci; + if (fBold) + { + if (fItalic) + { + fPrevVal = (pfci->pffaceBI != NULL); + pfci->pffaceBI = NULL; + } + else + { + fPrevVal = (pfci->pffaceBold != NULL); + pfci->pffaceBold = NULL; + } + } + else + { + if (fItalic) + { + fPrevVal = (pfci->pffaceItalic != NULL); + pfci->pffaceItalic = NULL; + } + else + { + fPrevVal = (pfci->pffaceRegular != NULL); + pfci->pffaceRegular = NULL; + } + } + + if (fPrevVal) + m_cfface--; + + Assert(m_cfface >= 0); + + if (m_flush == kflushAuto && fZapCache) + { + DeleteIfEmpty(); + } + + return fPrevVal; +} + +/*---------------------------------------------------------------------------------------------- + Search for the font-family in the cache and return its index. + If not present, return a negative number indicating where it was expected. +----------------------------------------------------------------------------------------------*/ +int FontCache::FindCacheItem(std::wstring strFaceName) +{ + if (m_cfci == 0) + return -1; + + Assert(m_prgfci); + + // Use a binary-chop search. + + int ifciLow = 0; + int ifciHigh = m_cfci; + while (true) + { + int ifciMid = (ifciHigh + ifciLow) >> 1; // divide by 2 + CacheItem * pfci = m_prgfci + ifciMid; + int tst = wcscmp(strFaceName.c_str(), (const wchar_t *)pfci->szFaceName); + if (tst == 0) + return ifciMid; // found it + if (ifciLow + 1 == ifciHigh) + { + // not there; return where expected: 0 -> -1, 1 -> -2 + Assert(ifciMid == ifciLow); + if (tst < 0) + return (ifciLow * -1) - 1; + else + return (ifciHigh * -1) - 1; + } + + // Keep looking. + if (tst < 0) + ifciHigh = ifciMid; + else + ifciLow = ifciMid; + } +} + +/*---------------------------------------------------------------------------------------------- + Insert space in the cache at location ifci. +----------------------------------------------------------------------------------------------*/ +void FontCache::InsertCacheItem(int ifci) +{ + if (m_cfci == m_cfciMax) + { + // Cache is full; double the space. + CacheItem * m_prgfciOld = m_prgfci; + m_prgfci = new CacheItem[m_cfciMax * 2]; + std::copy(m_prgfciOld, m_prgfciOld + m_cfciMax, m_prgfci); + delete[] m_prgfciOld; + m_cfciMax *= 2; + } + + // This copy involves overlapping ranges, so we need copy_backward not copy + // to satisfy the preconditions + std::copy_backward(m_prgfci + ifci, m_prgfci + m_cfci, m_prgfci + m_cfci + 1); + m_cfci++; + + // Initialize inserted item. + CacheItem * pfci = m_prgfci + ifci; + pfci->pffaceRegular = NULL; + pfci->pffaceBold = NULL; + pfci->pffaceItalic = NULL; + pfci->pffaceBI = NULL; +} + +/*---------------------------------------------------------------------------------------------- + Delete the cache if it is empty. +----------------------------------------------------------------------------------------------*/ +void FontCache::DeleteIfEmpty() +{ + if (m_cfface <= 0) + // All items are NULL; delete this cache. Probably this is because + // the program is exiting. + FontFace::ZapFontCache(); +} + +/*---------------------------------------------------------------------------------------------- + Check that the cache is indeed empty. +----------------------------------------------------------------------------------------------*/ +void FontCache::AssertEmpty() +{ +#ifdef _DEBUG + for (int ifci = 0; ifci < m_cfci; ifci++) + { + CacheItem * pfci = m_prgfci + ifci; + Assert(pfci->pffaceRegular == NULL); + Assert(pfci->pffaceBold == NULL); + Assert(pfci->pffaceItalic == NULL); + Assert(pfci->pffaceBI == NULL); + } +#endif // _DEBUG +} + +/*---------------------------------------------------------------------------------------------- + Set the flush mode on the cache to indicate whether or not it should be deleted when + it becomes empty. +----------------------------------------------------------------------------------------------*/ +void FontCache::SetFlushMode(int flush) +{ + m_flush = flush; + + if (m_flush == kflushAuto) + { + // Delete any font faces that have no remaining corresponding fonts. + // Work backwards so as we remove items the loop still works. + for (int ifci = m_cfci; --ifci >= 0; ) + { + CacheItem * pfci = m_prgfci + ifci; + if (pfci->pffaceRegular && pfci->pffaceRegular->NoFonts()) + RemoveFontFace(pfci->szFaceName, false, false, false); + if (pfci->pffaceBold && pfci->pffaceBold->NoFonts()) + RemoveFontFace(pfci->szFaceName, true, false, false); + if (pfci->pffaceItalic && pfci->pffaceItalic->NoFonts()) + RemoveFontFace(pfci->szFaceName, false, true, false); + if (pfci->pffaceBI && pfci->pffaceBI->NoFonts()) + RemoveFontFace(pfci->szFaceName, true, true, false); + } + + if (m_cfface <= 0) + FontFace::ZapFontCache(); + } +} + +} // namespace gr diff --git a/Build/source/libs/graphite/engine-2.4/src/segment/FontCache.h b/Build/source/libs/graphite/engine-2.4/src/segment/FontCache.h new file mode 100644 index 00000000000..56da5ab26b8 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/src/segment/FontCache.h @@ -0,0 +1,105 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 1999, 2001 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: FontCache.h +Responsibility: Sharon Correll +Last reviewed: Not yet. + +Description: + A cache of all the font-face objects known to mankind. There is exactly one instance + of a FontCache. +----------------------------------------------------------------------------------------------*/ +#ifdef _MSC_VER +#pragma once +#endif +#ifndef FONTCACHE_INCLUDED +#define FONTCACHE_INCLUDED + +//:End Ignore + +namespace gr +{ + +class FontFace; +class FontMemoryUsage; + +/*---------------------------------------------------------------------------------------------- + TODO: change from a sorted list to a hash table, if performance so requires. +----------------------------------------------------------------------------------------------*/ +class FontCache { + friend class FontMemoryUsage; + +public: + FontCache() + { + m_cfci = 0; + m_prgfci = NULL; + m_cfciMax = 0; + m_cfface = 0; + m_flush = kflushAuto; + } + + ~FontCache() + { + delete[] m_prgfci; + m_prgfci = NULL; + m_cfci = 0; + m_cfciMax = 0; + m_cfface = 0; + } + + void Initialize() + { + m_cfci = 0; + m_prgfci = new CacheItem[12]; + m_cfciMax = 12; + m_cfface = 0; + } + + struct CacheItem + { + wchar_t szFaceName[32]; // type should match std::wstring + FontFace * pffaceRegular; + FontFace * pffaceBold; + FontFace * pffaceItalic; + FontFace * pffaceBI; + }; + + void GetFontFace(std::wstring strFaceName, bool fBold, bool fItalic, FontFace ** ppfface); + void CacheFontFace(std::wstring strFaceName, bool fBold, bool fItalic, FontFace * pfface); + bool RemoveFontFace(std::wstring strFaceName, bool fBold, bool fItalic, bool fZapCache = true); + void DeleteIfEmpty(); + void AssertEmpty(); + + int GetFlushMode() + { + return m_flush; + } + void SetFlushMode(int); + + // Debugging: + //bool DbgCheckFontCache(); + + void calculateMemoryUsage(FontMemoryUsage & fmu); + +protected: + int FindCacheItem(std::wstring strFaceName); + void InsertCacheItem(int ifci); + +protected: + // member variables; + int m_cfci; // number of items (font-families) + int m_cfciMax; // amount of space available + int m_cfface; // number of font-faces + CacheItem * m_prgfci; + + int m_flush; +}; + +} // namespace gr + + +#endif // !FONTCACHE_INCLUDED diff --git a/Build/source/libs/graphite/engine-2.4/src/segment/FontFace.cpp b/Build/source/libs/graphite/engine-2.4/src/segment/FontFace.cpp new file mode 100644 index 00000000000..e16e15237e6 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/src/segment/FontFace.cpp @@ -0,0 +1,596 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 1999, 2001 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: GrEngine.cpp +Responsibility: Sharon Correll +Last reviewed: Not yet. + +Description: Contains the implementation of the FontFace class. +----------------------------------------------------------------------------------------------*/ + +//:>******************************************************************************************** +//:> Include files +//:>******************************************************************************************** +#include "Main.h" +#include +#ifdef _MSC_VER +#pragma hdrstop +#pragma warning (disable: 4706) // assignment within conditional expression +#endif +// any other headers (not precompiled) + +//:End Ignore + +namespace gr +{ + +//:>******************************************************************************************** +//:> Forward declarations +//:>******************************************************************************************** + +//:>******************************************************************************************** +//:> Local Constants and static variables +//:>******************************************************************************************** + +FontCache * FontFace::s_pFontCache = 0; + +//:>******************************************************************************************** +//:> New interface +//:>******************************************************************************************** +/*---------------------------------------------------------------------------------------------- + Return the appropriate FontFace, initialized with Graphite tables. + Called from the font constructor. +----------------------------------------------------------------------------------------------*/ +FontFace * FontFace::GetFontFace(Font * pfont, + std::wstring strFaceName, bool fBold, bool fItalic, + bool fDumbFallback) +{ + if (s_pFontCache == NULL) + s_pFontCache = new FontCache; + + FontFace * pfface; + s_pFontCache->GetFontFace(strFaceName, fBold, fItalic, &pfface); + if (pfface) + return pfface; + + // Create a new font face. + pfface = new FontFace(); + pfface->InitFontFace(pfont, strFaceName, fBold, fItalic, fDumbFallback); + return pfface; +} + +/*---------------------------------------------------------------------------------------------- + Initialize the engine using the given Graphite font. +----------------------------------------------------------------------------------------------*/ +GrResult FontFace::InitFontFace(Font * pfont, + std::wstring stuFaceName, bool fBold, bool fItalic, + bool fDumbFallback) +{ + AssertPtrN(pfont); + + m_pgreng = new GrEngine; + m_pgreng->m_pfface = this; + + m_pgreng->m_nScriptTag = 0; // not currently used, but set it to something + + std::wstring stuFeatures; + + //stuFeatures = stuFeaturesArg; + + if (wcscmp(stuFaceName.c_str(), m_pgreng->m_stuFaceName.c_str()) != 0) + { + s_pFontCache->RemoveFontFace(m_pgreng->FaceName(), m_pgreng->Bold(), m_pgreng->Italic()); + + m_pgreng->DestroyEverything(); // nothing we've cached is safe or useful. + m_pgreng->m_stuFaceName = stuFaceName; // if this is buggy, using assign might fix it + } + + //GrResult res = kresFail; +//#ifdef GR_FW +// // Read from the control file indicated by the registry, if any. +// std::wstring stuFaceNameTmp; +// stuFaceNameTmp.assign(rgchFaceName, wcslen(rgchFaceName)); +// res = InitFromControlFile(pfont, stuFaceName.c_str(), fBold, fItalic); +//#endif // GR_FW + + // Read directly from the font. + m_pgreng->DestroyContents(); + GrResult res = kresUnexpected; + try { + res = m_pgreng->ReadFontTables(pfont, fItalic); + } + catch (...) + { + if (fDumbFallback && m_pgreng->DumbFallback() && !m_pgreng->BadFont()) + { + // If we have a basically good font but can't do Graphite, + // just go with empty tables, which should be set up. + res = m_pgreng->m_resFontRead; + } + else + { + if (m_cfonts == 0) + { + //s_pFontCache->DeleteIfEmpty(); + //Assert(s_pFontCache == 0); + delete this; // will also delete GrEngine + } + else + { + delete m_pgreng; + } + m_pgreng = NULL; + throw; // throw original exception + } + } + + m_pgreng->m_resFontValid = res; + + m_pgreng->m_fBold = fBold; + m_pgreng->m_fItalic = fItalic; + + s_pFontCache->CacheFontFace(m_pgreng->FaceName(), fBold, fItalic, this); + + return m_pgreng->m_resFontValid; +} + +/*---------------------------------------------------------------------------------------------- + Read the cmap and Graphite tables from the font that is selected into the graphics + device. + + @return A GrResult indicating whether we were successful in loading the Graphite font: + - kresOk means success + - kresFail means the Graphite font could not be found or the basic font tables + (head, name, cmap) could not be loaded + - kresUnexpected means the Graphite tables could not be loaded + - kresFalse means it is not a Graphite font at all (has no Silf table). +----------------------------------------------------------------------------------------------*/ +GrResult GrEngine::ReadFontTables(Font * pfont, bool fItalic) +{ + GrResult res = kresOk; + m_ferr = kferrOkay; + GrBufferIStream grstrm; + + FontException fexptn; + fexptn.version = -1; + fexptn.subVersion = -1; + + bool fOk = false; + + const void * pHeadTbl; const void * pSileTbl; const void * pSilfTbl; + const void * pFeatTbl; const void * pGlatTbl; const void * pGlocTbl; const void * pSillTbl; + //const void * pCmapTbl; const void * pNameTbl; + size_t cbHeadSz, cbSilfSz, cbFeatSz, cbGlatSz, cbGlocSz, cbSillSz; + //size_t cbCmapSz, cbSileSz, cbNameSz; + + m_fFakeItalic = false; + + bool fBasicTables = false; + bool fSilf = false; // does the font have some sort of Silf table? + int nCheckSum = 0; + + bool fBadBase = false, + fMismatchedBase = false, + fFontIsItalic = false; + + // First read the head table. This gives us the checksum that we are using as a + // unique identifer. If it is the same as the one stored, and things appear set up, + // don't reload the tables. + res = (pHeadTbl = pfont->getTable(TtfUtil::TableIdTag(ktiHead), &cbHeadSz)) ? kresOk : kresFail; + fOk = pHeadTbl && (cbHeadSz == 0 || TtfUtil::CheckTable(ktiHead, pHeadTbl, cbHeadSz)); + if (res == kresFail) + { + m_stuInitError = L"could not locate head table for Graphite rendering"; + m_ferr = kferrFindHeadTable; + goto LUnexpected; + } + if (!fOk) + { + m_stuInitError = L"could not read design units for Graphite rendering"; + m_ferr = kferrReadDesignUnits; + goto LUnexpected; + } + m_mFontEmUnits = TtfUtil::DesignUnits(pHeadTbl); + nCheckSum = TtfUtil::HeadTableCheckSum(pHeadTbl); + fFontIsItalic = TtfUtil::IsItalic(pHeadTbl); + + if (m_nFontCheckSum == nCheckSum && m_ptman) + return m_resFontRead; // already initialized in some form + + DestroyContents(); + + Assert(!m_ptman); + Assert(!m_pctbl); + Assert(!m_pgtbl); + Assert(!m_prgpsd); + m_prgpsd = NULL; + m_cpsd = 0; + + m_ptman = new GrTableManager(this); + + m_fFakeItalic = (fItalic && !fFontIsItalic); + + // Look for an Sile table. If there is one, this is an extension font containing only + // the Graphite tables. Read the base font name out of the Sile table, and use it to + // read the cmap. Then replace the original font name to read the Graphite tables. + + m_fUseSepBase = false; + m_stuBaseFaceName.erase(); + + // TODO: rework the handling of the Sile table. + pSileTbl = NULL; + //pSileTbl = pfont->getTable(TtfUtil::TableIdTag(ktiSile)); + //if (pSileTbl) + //{ + // pgg->get_FontCharProperties(&chrpOriginal); + // grstrm.OpenBuffer(pSileTbl, sile_tbl.size()); + // m_fUseSepBase = ReadSileTable(pgg, grstrm, 0, &m_mFontEmUnits, &fMismatchedBase); + // grstrm.Close(); + + // if (!m_fUseSepBase) + // { + // SwitchGraphicsFont(pgg, false); // back to Graphite table font + // m_stuBaseFaceName.erase(); + // fBadBase = true; + // m_fUseSepBase = false; + // } + // // Otherwise leave the GrGraphics in a state to read from the base font. + //} + + // We don't need the offset table, and there's no way to get it anyway + // without a font file. + + // cmap and name + Assert(!m_fCmapTblCopy); + Assert(!m_fNameTblCopy); + fOk = SetCmapAndNameTables(pfont); + if (!fOk) + { + goto LUnexpected; + } + + fBasicTables = true; + + // If we have a bad base file, don't do Graphite stuff. + if (fBadBase || fMismatchedBase) + goto LUnexpected; + + /**** + Obtain font name from InitNew() now instead of reading from font file. InitNew should + should have a correct font name passed to it since it should come from a font registered + by GrFontInst.exe. This commented code could be use to verify name in font file matches. + NOTE: if we ever use this code again, make sure we're using the base font name table, + not the Graphite wrapper font name table. + // find the font family name + if (!TtfUtil::Get31EngFamilyInfo(vbName.Begin(), lnNameOff, lnNameSz)) + { // use Name table which is Symbol encode instead + // this could cause problems if a real Symbol writing system is used in the name table + // however normally real Unicode values are used instead a Symbol writing system + if (!TtfUtil::Get30EngFamilyInfo(vbName.Begin(), lnNameOff, lnNameSz)) + { + ReturnResult(kresFail); + } + // test for Symbol writing system. first byte of Unicode id should be 0xF0 + if (vbName[lnNameOff + 1] == (unsigned char)0xF0) // 1 - Unicode id is big endian + ReturnResult(kresFail); + } + if (!TtfUtil::SwapWString(vbName.Begin() + lnNameOff, lnNameSz / sizeof(utf16))) + ReturnResult(kresFail); + + m_stuFaceName = std::wstring((utf16 *)(vbName.begin() + lnNameOff), lnNameSz / sizeof(utf16)); + ****/ + + // Silf + res = (pSilfTbl = pfont->getTable(TtfUtil::TableIdTag(ktiSilf), &cbSilfSz)) ? kresOk : kresFail; + fOk = pSilfTbl && (cbSilfSz == 0 || TtfUtil::CheckTable(ktiSilf, pSilfTbl, cbSilfSz)); + if (!fOk) + { + m_stuInitError = L"could not load Silf table for Graphite rendering"; + m_ferr = kferrLoadSilfTable; + goto LUnexpected; + } + + // Feat + res = (pFeatTbl = pfont->getTable(TtfUtil::TableIdTag(ktiFeat), &cbFeatSz)) ? kresOk : kresFail; + fOk = pFeatTbl && (cbFeatSz == 0 || TtfUtil::CheckTable(ktiFeat, pFeatTbl, cbFeatSz)); + if (!fOk) + { + // TODO: just create an empty set of features, since this is not disastrous. + m_stuInitError = L"could not load Feat table for Graphite rendering"; + m_ferr = kferrLoadFeatTable; + goto LUnexpected; + } + + // Glat + res = (pGlatTbl = pfont->getTable(TtfUtil::TableIdTag(ktiGlat), &cbGlatSz)) ? kresOk : kresFail; + fOk = pGlatTbl && (cbGlatSz == 0 || TtfUtil::CheckTable(ktiGlat, pGlatTbl, cbGlatSz)); + if (!fOk) + { + m_stuInitError = L"could not load Glat table for Graphite rendering"; + m_ferr = kferrLoadGlatTable; + goto LUnexpected; + } + + // Gloc + res = (pGlocTbl = pfont->getTable(TtfUtil::TableIdTag(ktiGloc), &cbGlocSz)) ? kresOk : kresFail; + fOk = pGlocTbl && (cbGlocSz == 0 || TtfUtil::CheckTable(ktiGloc, pGlocTbl, cbGlocSz)); + if (!fOk) + { + m_stuInitError = L"could not load Gloc table for Graphite rendering"; + m_ferr = kferrLoadGlocTable; + goto LUnexpected; + } + + // Sill + try { + res = (pSillTbl = pfont->getTable(TtfUtil::TableIdTag(ktiSill), &cbSillSz)) ? kresOk : kresFail; + fOk = pSillTbl && (cbSillSz == 0 || TtfUtil::CheckTable(ktiSill, pSillTbl, cbSillSz)); + } + catch (...) + { + fOk = true; + pSillTbl = NULL; + } + // if table couldn't be loaded, this is not disastrous. + +// ibGlocStart = cbGlatTbl; + fOk = CheckTableVersions(&grstrm, + (const byte *)pSilfTbl, 0, + (const byte *)pGlocTbl, 0, + (const byte *)pFeatTbl, 0, + &m_fxdBadVersion); + if (!fOk) + { +// wchar_t rgch1[50]; +// wchar_t rgch2[50]; +//#if defined(_WIN32) +// // This version does not work in Windows, in spite of being documented: +// // swprintf(rgch, 50, L"%d", (m_fxdBadVersion >> 16)); +// // Removing the size argument make it work. +// swprintf(rgch1, L"%d", (m_fxdBadVersion >> 16)); +// swprintf(rgch2, L"%d", (m_fxdBadVersion & 0x0000FFFF)); +//#else +// swprintf(rgch1, 50, L"%d", (m_fxdBadVersion >> 16)); +// swprintf(rgch2, 50, L"%d", (m_fxdBadVersion & 0x0000FFFF)); +//#endif + char rgch[50]; // more than enough space to print two 16-bit ints + char *pch = &rgch[0]; + sprintf(rgch, "%d.%d", (m_fxdBadVersion >> 16), (m_fxdBadVersion & 0x0000FFFF)); + std::wstring stu = L"unsupported version ("; + //stu.append(rgch1); + //stu.append(L"."); + //stu.append(rgch2); + while (*pch != 0) + stu.push_back((wchar_t)*pch++); + stu.append(L") of Graphite tables"); + m_stuInitError.assign(stu.c_str()); + m_ferr = kferrBadVersion; + goto LUnexpected; + } + + try + { + // Parse the "Silf" table. + grstrm.OpenBuffer((const byte*)pSilfTbl, cbSilfSz); + int chwGlyphIDMax, fxdVersion; + bool f = ReadSilfTable(grstrm, 0, 0, cbSilfSz, &chwGlyphIDMax, &fxdVersion); + grstrm.Close(); + if (!f) + { + m_ferr = kferrReadSilfTable; + fexptn.errorCode = m_ferr; + throw fexptn; + } + + // Parse the "Gloc" and "Glat" tables. + { + GrBufferIStream grstrmGlat; + + grstrm.OpenBuffer((const byte *)pGlocTbl, cbGlocSz); + grstrmGlat.OpenBuffer((const byte *)pGlatTbl, cbGlatSz); + f = ReadGlocAndGlatTables(grstrm, 0, grstrmGlat, 0, chwGlyphIDMax, fxdVersion); + grstrm.Close(); + grstrmGlat.Close(); + if (!f) + { + m_ferr = kferrReadGlocGlatTable; + fexptn.errorCode = m_ferr; + throw fexptn; + } + } + + // Parse the "Feat" table. + grstrm.OpenBuffer((const byte *)pFeatTbl, cbFeatSz); + f = ReadFeatTable(grstrm, 0); + grstrm.Close(); + if (!f) + { + m_ferr = kferrReadFeatTable; + fexptn.errorCode = m_ferr; + throw fexptn; + } + + // Parse the "Sill" table. + if (pSillTbl) + { + grstrm.OpenBuffer((const byte *)pSillTbl, cbSillSz); + f = ReadSillTable(grstrm, 0); + grstrm.Close(); + if (!f) + { + m_ferr = kferrReadSillTable; + fexptn.errorCode = m_ferr; + throw fexptn; + } + } + else + m_langtbl.CreateEmpty(); + } + catch (...) + { + fSilf = false; + m_resFontRead = kresUnexpected; + try { + DestroyContents(false); + } + catch (...) + {} + goto LUnexpected; + } + + m_stuErrCtrlFile.erase(); + m_nFontCheckSum = nCheckSum; + m_resFontRead = kresOk; + m_ferr = kferrOkay; + ReturnResult(kresOk); + +LUnexpected: + // Don't do this, because it is possible to use a base font with an empty Graphite + // engine: + //if (m_fUseSepBase || m_stuBaseFaceName.Length() > 0) + //{ + // SwitchGraphicsFont(pgg, false); // back to Graphite table font + // m_stuBaseFaceName.erase(); + // m_fUseSepBase = false; + //} + + CreateEmpty(); + m_nFontCheckSum = nCheckSum; + if (!fBasicTables) + m_resFontRead = kresFail; // bad font + else if (!fSilf) + m_resFontRead = kresFalse; // no Silf table--not a Graphite font + else + m_resFontRead = kresUnexpected; // couldn't read the Graphite tables + + fexptn.errorCode = m_ferr; + fexptn.version = m_fxdBadVersion >> 16; + fexptn.subVersion = m_fxdBadVersion & 0x0000FFFF; + throw fexptn; + + ReturnResult(m_resFontRead); +} + +/*---------------------------------------------------------------------------------------------- + Read the cmap and name tables. + + This is called from two places. One is when we first initialize the engine. Also, if the + font tables have not been actually copied from the font, they may have been deleted + when the font was deleted. So when reusing the engine, set them to something valid based + on the current font. +----------------------------------------------------------------------------------------------*/ +bool GrEngine::SetCmapAndNameTables(Font * pfont) +{ + GrResult res = kresOk; + bool fOk; + const void * pCmapTbl; + const void * pNameTbl; + size_t cbCmapSz, cbNameSz; + + // cmap + if (!m_fCmapTblCopy) + { + res = (pCmapTbl = pfont->getTable(TtfUtil::TableIdTag(ktiCmap), &cbCmapSz)) ? kresOk : kresFail; + fOk = pCmapTbl && (cbCmapSz == 0 || TtfUtil::CheckTable(ktiCmap, pCmapTbl, cbCmapSz)); + if (!fOk) + { + m_stuInitError = L"could not locate cmap table"; + m_ferr = kferrFindCmapTable; + return false; + } + + if (pCmapTbl && cbCmapSz > 0) + { + // Make a private copy of the cmap for the engine's use. + m_pCmapTbl = new byte[cbCmapSz]; + std::copy(reinterpret_cast(pCmapTbl), + reinterpret_cast(pCmapTbl) + cbCmapSz, m_pCmapTbl); + m_fCmapTblCopy = true; + m_cbCmapTbl = cbCmapSz; + } + else + { + m_pCmapTbl = const_cast(reinterpret_cast(pCmapTbl)); + m_fCmapTblCopy = false; + } + + // MS Unicode cmap + m_pCmap_3_1 = TtfUtil::FindCmapSubtable(m_pCmapTbl, 3, 1); + m_pCmap_3_10 = TtfUtil::FindCmapSubtable(m_pCmapTbl, 3, 10); + if (!m_pCmap_3_1) + m_pCmap_3_1 = TtfUtil::FindCmapSubtable(m_pCmapTbl, 3, 0); + if (!m_pCmap_3_1) + { + m_stuInitError = L"failure to load cmap subtable"; + m_ferr = kferrLoadCmapSubtable; + return false; + } + if (!TtfUtil::CheckCmap31Subtable(m_pCmap_3_1)) + { + m_stuInitError = L"checking cmap subtable failed"; + m_ferr = kferrCheckCmapSubtable; + return false; + } + } + else + { + Assert(m_pCmapTbl); + } + + // name table - eventually need feature label strings + + // Currently the only stuff we're getting from the name table are our feature names, + // so use the version from the Graphite font (not the base font if any). + //////if (m_fUseSepBase) + ////// pgg->SetupGraphics(&chrpOriginal); + + if (!m_fNameTblCopy) + { + res = (pNameTbl = (const byte *)pfont->getTable(TtfUtil::TableIdTag(ktiName), &cbNameSz)) ? kresOk : kresFail; + fOk = pNameTbl && (cbNameSz == 0 || TtfUtil::CheckTable(ktiName, pNameTbl, cbNameSz)); + if (!fOk) + { + m_stuInitError = L"could not locate name table"; + m_ferr = kferrFindNameTable; + return false; + } + + if (pNameTbl && cbNameSz > 0) + { + // Make a private copy of the name table for the engine's use. + m_pNameTbl = new byte[cbNameSz]; + std::copy(reinterpret_cast(pNameTbl), + reinterpret_cast(pNameTbl) + cbNameSz, m_pNameTbl); + m_fNameTblCopy = true; + m_cbNameTbl = cbNameSz; + } + else + { + m_pNameTbl = const_cast(reinterpret_cast(pNameTbl)); + m_fNameTblCopy = false; + } + } + else + { + Assert(m_pNameTbl); + } + + return true; +} + + +//void FontFace::DbgCheckFontFace() +//{ +// Assert(m_cfonts < 5000); +// Assert(m_cfonts >= 0); +// wchar_t chw0 = m_pgreng->m_stuFaceName[0]; +// Assert(chw0 >= 0x0040); // A +// Assert(chw0 <= 0x007A); // z +//} + +} // namespace gr + +//:End Ignore diff --git a/Build/source/libs/graphite/engine-2.4/src/segment/FontFace.h b/Build/source/libs/graphite/engine-2.4/src/segment/FontFace.h new file mode 100644 index 00000000000..7f2684a5908 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/src/segment/FontFace.h @@ -0,0 +1,246 @@ +/*-------------------------------------------------------------------- +Copyright (C) 1999, 2001 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: FontFace.h +Responsibility: Sharon Correll +Last reviewed: Not yet. + +Description: + Contains the definition of the FontFace class. + TODO: Merge with GrEngine. +----------------------------------------------------------------------------------------------*/ +#ifdef _MSC_VER +#pragma once +#endif +#ifndef FONTFACE_INCLUDED +#define FONTFACE_INCLUDED +#include + +#ifdef _MSC_VER +#include +#endif + +namespace gr +{ + +class IGrJustifier; +class Segment; + + +/*---------------------------------------------------------------------------------------------- + The GrEngine serves as the top level object that knows how to run Graphite tables + and generate Graphite segments. + + Primarily, this class implements IRenderEngine, which allows it to serve as a FW + rendering engine. It also implements ISimpleInit, a general interface for initializing + using a string. Finally, it implements ITraceControl, a very simple interface which + allows a client to flip a flag indicating whether or not we want to output a log of + the Graphite transduction process. + + Hungarian: greng +----------------------------------------------------------------------------------------------*/ +class FontFace +{ + friend class gr::FontMemoryUsage; + +public: + FontFace() + { + m_cfonts = 0; + } + + ~FontFace() + { + if (s_pFontCache) + s_pFontCache->RemoveFontFace(m_pgreng->FaceName(), m_pgreng->Bold(), m_pgreng->Italic()); + delete m_pgreng; + } + + void IncFontCount() + { + m_cfonts++; + } + void DecFontCount() + { + m_cfonts--; + if (m_cfonts <= 0 && (s_pFontCache == NULL || s_pFontCache->GetFlushMode() == kflushAuto)) + delete this; + } + + bool NoFonts() + { + return (m_cfonts <= 0); + } + + static FontFace * GetFontFace(Font * pfont, + std::wstring strFaceName, bool fBold, bool fItalic, + bool fDumbFallback = false); + + GrResult InitFontFace(Font * pfont, + std::wstring stuFaceName, bool fBold, bool fItalic, + bool fDumbLayout); + + FontErrorCode IsValidForGraphite(int * pnVersion, int * pnSubVersion) + { + return m_pgreng->IsValidForGraphite(pnVersion, pnSubVersion); + } + + static void ZapFontCache() + { + if (s_pFontCache) + { + s_pFontCache->AssertEmpty(); + delete s_pFontCache; + } + s_pFontCache = NULL; + } + + static void SetFlushMode(int flush) + { + if (s_pFontCache == NULL) + s_pFontCache = new FontCache; + s_pFontCache->SetFlushMode(flush); + } + static int GetFlushMode() + { + if (s_pFontCache == NULL) + s_pFontCache = new FontCache; + return s_pFontCache->GetFlushMode(); + } + + // Temporary, until interface gets thoroughly reworked: + GrEngine * GraphiteEngine() + { + return m_pgreng; + } + + // Feature access: + size_t NumberOfFeatures() + { + return m_pgreng->NumberOfFeatures_ff(); + } + featid FeatureID(size_t ifeat) + { + return m_pgreng->FeatureID_ff(ifeat); + } + size_t FeatureWithID(featid id) + { + return m_pgreng->FeatureWithID_ff(id); + } + bool GetFeatureLabel(size_t ifeat, lgid language, utf16 * label) + { + return m_pgreng->GetFeatureLabel_ff(ifeat, language, label); + } + int GetFeatureDefault(size_t ifeat) // index of default setting + { + return m_pgreng->GetFeatureDefault_ff(ifeat); + } + size_t NumberOfSettings(size_t ifeat) + { + return m_pgreng->NumberOfSettings_ff(ifeat); + } + int GetFeatureSettingValue(size_t ifeat, size_t ifset) + { + return m_pgreng->GetFeatureSettingValue_ff(ifeat, ifset); + } + bool GetFeatureSettingLabel(size_t ifeat, size_t ifset, lgid language, utf16 * label) + { + return m_pgreng->GetFeatureSettingLabel_ff(ifeat, ifset, language, label); + } + // Feature-label language access: + size_t NumberOfFeatLangs() + { + return m_pgreng->NumberOfFeatLangs_ff(); + } + short FeatLabelLang(int ilang) + { + return m_pgreng->GetFeatLabelLang_ff(ilang); + } + // Language access: + size_t NumberOfLanguages() + { + return m_pgreng->NumberOfLanguages_ff(); + } + isocode LanguageCode(size_t ilang) + { + return m_pgreng->GetLanguageCode_ff(ilang); + } + + // Script Direction access: + ScriptDirCode ScriptDirection() const throw() + { + unsigned int script_dirs = 0; + OLECHAR err_dummy = 0; + m_pgreng->get_ScriptDirection(&script_dirs, &err_dummy, 1); + return ScriptDirCode(script_dirs); + } + + bool BadFont(FontErrorCode * pferr = NULL) + { + return m_pgreng->BadFont(pferr); + } + bool DumbFallback(FontErrorCode * pferr = NULL) + { + return m_pgreng->DumbFallback(pferr); + } + +public: + // For use in segment creation: + void RenderLineFillSegment(Segment * pseg, Font * pfont, ITextSource * pts, + LayoutEnvironment & layout, + toffset ichStart, toffset ichStop, float xsMaxWidth, bool fBacktracking) + { + m_pgreng->MakeSegment(pseg, pfont, pts, NULL, layout, + ichStart, ichStop, xsMaxWidth, fBacktracking, false, 0, kestMoreLines); + } + void RenderRangeSegment(Segment * pseg, Font * pfont, + ITextSource * pts, LayoutEnvironment & layout, + toffset ichStart, toffset ichStop) + { + m_pgreng->MakeSegment(pseg, pfont, pts, NULL, layout, + ichStart, ichStop, kPosInfFloat, false, false, 0, kestMoreLines); + } + void RenderJustifiedSegment(Segment * pseg, Font * pfont, + ITextSource * pts, LayoutEnvironment & layout, + toffset ichStart, toffset ichStop, float xsCurrentWidth, float xsDesiredWidth) + { + m_pgreng->MakeSegment(pseg, pfont, pts, NULL, layout, + ichStart, ichStop, xsCurrentWidth, false, true, xsDesiredWidth, kestMoreLines); + } + + // Debugging. + //static bool DbgCheckFontCache() + //{ + // if (s_pFontCache) + // return s_pFontCache->DbgCheckFontCache(); + // else + // return true; + //} + //void DbgCheckFontFace(); + + static void calculateAllMemoryUsage(FontMemoryUsage & fmu); + void calculateMemoryUsage(FontMemoryUsage & fmu); + +protected: + // Number of fonts in existence that use this face; when it goes to zero, delete. + int m_cfonts; + + // Static variable: + static FontCache * s_pFontCache; + + // Member variables: + GrEngine * m_pgreng; +}; + +} // namespace gr + + +#if defined(GR_NO_NAMESPACE) +using namespace gr; +#endif + + +#endif // !FONTFACE_INCLUDED diff --git a/Build/source/libs/graphite/engine-2.4/src/segment/GrCharStream.cpp b/Build/source/libs/graphite/engine-2.4/src/segment/GrCharStream.cpp new file mode 100644 index 00000000000..f79817a7d42 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/src/segment/GrCharStream.cpp @@ -0,0 +1,653 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 1999, 2001 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: GrCharStream.cpp +Responsibility: Sharon Correll +Last reviewed: Not yet. + +Description: + Implements the GrCharStream class. +----------------------------------------------------------------------------------------------*/ + +//:>******************************************************************************************** +//:> Include files +//:>******************************************************************************************** +#include "Main.h" + +#ifdef _MSC_VER +#pragma hdrstop +#endif + +//:End Ignore + +//:>******************************************************************************************** +//:> Forward declarations +//:>******************************************************************************************** + +//:>******************************************************************************************** +//:> Local Constants and static variables +//:>******************************************************************************************** + +namespace gr +{ + +//:>******************************************************************************************** +//:> Methods +//:>******************************************************************************************** + +/*---------------------------------------------------------------------------------------------- + Constructor. +----------------------------------------------------------------------------------------------*/ +GrCharStream::GrCharStream(ITextSource * pgts, int ichrMin, int ichrLim, + bool fStartLine, bool fEndLine) + : m_pgts(pgts), + m_ichrMin(ichrMin), + m_ichrLim(ichrLim), + m_ichrPos(ichrMin), + m_fStartLine(fStartLine), + m_fEndLine(fEndLine), + m_cchrBackedUp(0), + m_ichrRunMin(0), + m_ichrRunLim(0), + m_ichlRunOffset(kPosInfinity), + m_ichrRunOffset(kPosInfinity) +{ + #if 0 // ??? surely m_cnRunMax and m_prgnRunText are undefined at this point + if (m_cchlRunMax > -1) + delete[] m_prgchlRunText; + #endif + m_cchlRunMax = -1; + m_prgchlRunText = NULL; + + m_vislotNextChunkMap.clear(); + + m_utf = m_pgts->utfEncodingForm(); +} + +/*---------------------------------------------------------------------------------------------- + Restart the stream when an error has a occurred and we need to fall back to dumb rendering. +----------------------------------------------------------------------------------------------*/ +void GrCharStream::Restart() +{ + if (m_cchlRunMax > -1) + delete[] m_prgchlRunText; + + m_ichrPos = m_ichrMin; + m_cchrBackedUp = 0; + m_ichrRunMin = 0; + m_ichrRunLim = 0; + m_ichlRunOffset = kPosInfinity; + m_ichrRunOffset = kPosInfinity; + + m_cchlRunMax = -1; + m_prgchlRunText = NULL; + + m_vislotNextChunkMap.clear(); +} + +/*---------------------------------------------------------------------------------------------- + Get the next character from the stream. + + @param pichwSegOffset - index of this character from the beginning of the segment + @param pcchRaw - number of raw (UTF-16 or UTF-8) chars consumed to get one complete + Unicode codepoint. +----------------------------------------------------------------------------------------------*/ +int GrCharStream::NextGet(GrTableManager * ptman, + GrFeatureValues * pfval, int * pichrSegOffset, int * pcchr) +{ + if (AtEnd()) + { + Assert(m_ichrPos == m_ichrLim); + return 0; + } + + int m_ichrMinBackedUp = m_ichrMin - m_cchrBackedUp; + + if ((m_ichrRunOffset + m_ichrRunMin) >= m_ichrRunLim) + { + // Get the next run of characters + + std::pair pairRange = m_pgts->propertyRange(m_ichrPos); + m_ichrRunMin = pairRange.first; + m_ichrRunLim = pairRange.second; + + // The only time the run extends before what we want is on the first run. + Assert((m_ichrRunMin == m_ichrPos) // m_ichwPos is beginning of run + || (m_ichrPos == m_ichrMinBackedUp)); // first run + // Pretend like the run starts where we need it: + m_ichrRunMin = max(m_ichrRunMin, m_ichrMinBackedUp); + Assert(m_ichrRunMin == m_ichrPos); + + if (m_cchlRunMax != -1 && m_cchlRunMax < m_ichrRunLim - m_ichrRunMin) + { + // Text buffer is too small: delete it and create a new one. + delete[] m_prgchlRunText; + m_cchlRunMax = -1; + } + + if (m_cchlRunMax == -1) + { + // Note that combining surrogates or UTF-8 will always result in the same or fewer + // number of characters needed in m_prgchlRunText, so the following is safe: + m_cchlRunMax = m_ichrRunLim - m_ichrRunMin; + m_prgchlRunText = new int[m_cchlRunMax]; + } + + utf32 * prgchlRunText32 = NULL; + utf16 * prgchwRunText16 = NULL; + utf8 * prgchsRunText8 = NULL; + + int cchGot; + switch (m_utf) + { + case kutf8: + prgchsRunText8 = new utf8[m_ichrRunLim - m_ichrRunMin]; + cchGot = m_pgts->fetch(m_ichrRunMin, m_ichrRunLim - m_ichrRunMin, prgchsRunText8); + break; + case kutf16: + prgchwRunText16 = new utf16[m_ichrRunLim - m_ichrRunMin]; + cchGot = m_pgts->fetch(m_ichrRunMin, m_ichrRunLim - m_ichrRunMin, prgchwRunText16); + break; + default: + Assert(false); + // Assume UTF-32: fall through + case kutf32: + prgchlRunText32 = new utf32[m_ichrRunLim - m_ichrRunMin]; + cchGot = m_pgts->fetch(m_ichrRunMin, m_ichrRunLim - m_ichrRunMin, prgchlRunText32); + break; + } + + int ichlUtf32 = 0; + for (int ichr = 0; ichr < m_ichrRunLim - m_ichrRunMin; ichr++) + { + if (ichr == m_ichrPos - m_ichrRunMin) + { + m_ichrRunOffset = ichr; + m_ichlRunOffset = ichlUtf32; + } + Assert(m_ichrRunOffset != kPosInfinity || ichr < m_ichrPos - m_ichrRunMin); + + int cchrUsed; + switch (m_utf) + { + case kutf8: + m_prgchlRunText[ichlUtf32] = Utf8ToUtf32(prgchsRunText8 + ichr, + m_ichrRunLim - m_ichrRunMin - ichr, &cchrUsed); + break; + case kutf16: + m_prgchlRunText[ichlUtf32] = Utf16ToUtf32(prgchwRunText16 + ichr, + m_ichrRunLim - m_ichrRunMin - ichr, &cchrUsed); + break; + default: + Assert(false); + // Assume UTF-32: fall through + case kutf32: + m_prgchlRunText[ichlUtf32] = prgchlRunText32[ichlUtf32]; + cchrUsed = 1; + break; + } + + m_vislotNextChunkMap.push_back(ichlUtf32); + for (int i = 1; i < cchrUsed; i++) + m_vislotNextChunkMap.push_back(-1); + ichr += cchrUsed - 1; + ichlUtf32++; + } + delete[] prgchlRunText32; + delete[] prgchwRunText16; + delete[] prgchsRunText8; + + while (m_ichrLim - m_ichrRunMin < signed(m_vislotNextChunkMap.size()) + && m_vislotNextChunkMap[m_ichrLim - m_ichrRunMin] == -1) + { + // Invalid surrogate boundary; this is really a bug in the application program, + // but adjust here to avoid a crash! + m_ichrLim--; + } + + SetUpFeatureValues(ptman, m_ichrPos); + + Assert(m_ichrRunOffset >= 0); + Assert(m_ichrRunOffset < m_ichrRunLim - m_ichrRunMin); + Assert(m_vislotNextChunkMap.size() == (unsigned) m_ichrRunLim - m_ichrMinBackedUp); + } + + int chlRet = m_prgchlRunText[m_ichlRunOffset]; + *pfval = m_fvalRunFeats; + *pichrSegOffset = m_ichrPos - m_ichrMin; // offset from the official start of the segment + // of the first 16-bit char + int ichrPosPrev = m_ichrPos; + ++m_ichlRunOffset; + do { + ++m_ichrPos; + ++m_ichrRunOffset; + } while (m_ichrPos - m_ichrMinBackedUp < signed(m_vislotNextChunkMap.size()) + && m_vislotNextChunkMap[m_ichrPos - m_ichrMinBackedUp] == -1); + + *pcchr = m_ichrPos - ichrPosPrev; // number of raw chars consumed + Assert(m_utf != kutf8 || *pcchr <= 6); + Assert(m_utf != kutf16 || *pcchr <= 2); + + Assert(m_ichrPos == (m_ichrRunMin + m_ichrRunOffset)); + Assert(m_ichrPos <= m_ichrLim); + + /* KLUDGE for debugging + if (m_ichrPos == 1) + nRet = 0x1018; + else if (m_ichrPos == 2) + nRet = 0x1039; + else if (m_ichrPos == 3) + nRet = 0x101b; + else if (m_ichrPos == 4) + nRet = 0x1032; + else if (m_ichrPos == 5) + nRet = 0x1037; + else if (m_ichrPos == 6) + nRet = 0x1037; + */ + + return chlRet; +} + +/*---------------------------------------------------------------------------------------------- + Convert UTF-8 to UTF-32--a single character's worth. Also pass back the number of 8-bit + items consumed. +----------------------------------------------------------------------------------------------*/ +utf32 GrCharStream::Utf8ToUtf32(utf8 * prgchs, int cchs, int * pcchsUsed) +{ + if (cchs <= 0) + { + *pcchsUsed = 0; + return 0; + } + + long chlRet = DecodeUtf8(prgchs, cchs, pcchsUsed); + Assert(chlRet > 0); + if (chlRet == -1) + { + // Some error occurred. Just treat the UTF-8 as UTF-32. + *pcchsUsed = 1; + return (utf32)prgchs[0]; + } + else + return chlRet; +} + +/*---------------------------------------------------------------------------------------------- + Convert UTF-16 to UTF-32--a single character's worth. Also pass back the number of 16-bit + items consumed. +----------------------------------------------------------------------------------------------*/ +utf32 GrCharStream::Utf16ToUtf32(utf16 * prgchw, int cchw, int * pcchwUsed) +{ + if (cchw <= 0) + { + *pcchwUsed = 0; + return 0; + } + + unsigned int nUtf32; + bool fSurrogate = FromSurrogatePair(prgchw[0], ((cchw < 2) ? 0 : prgchw[1]), &nUtf32); + *pcchwUsed = (fSurrogate) ? 2 : 1; + return (int)nUtf32; + +/* + // For testing: + int nCharRet; + if (cchw >= 2 && prgchw[0] == '^' && prgchw[1] == 'a') + { + nCharRet = 'A'; + *pcchwUsed = 2; + } + else if (cchw >= 3 && prgchw[0] == '#' && prgchw[1] == '#' && + prgchw[2] == 'B') + { + nCharRet = 'b'; + *pcchwUsed = 3; + } + else if (cchw >= 1) + { + nCharRet = prgchw[0]; + *pcchwUsed = 1; + } + else + { + nCharRet = 0; + *pcchwUsed = 0; + } + return nCharRet; +*/ +} + +/*---------------------------------------------------------------------------------------------- + Return true if the given position is at the boundary of a Unicode character; return false + if it is between two parts of pair of surrogates. +----------------------------------------------------------------------------------------------*/ +bool GrCharStream::AtUnicodeCharBoundary(ITextSource * pgts, int ichr) +{ + int cchr = pgts->getLength(); + if (ichr <= 0 || ichr >= cchr) + return true; + + UtfType utf = pgts->utfEncodingForm(); + + // Note that we never need more than a handful of characters. + int ichrMinGet = max(0, ichr - 1); + int ichrLimGet = ichr + 1; + utf16 rgchwText16[3]; + utf8 rgchsText8[3]; + bool fRet; + switch (utf) + { + case kutf8: + pgts->fetch(ichrMinGet, ichrLimGet - ichrMinGet, rgchsText8); + fRet = AtUnicodeCharBoundary(rgchsText8, ichrLimGet - ichrMinGet, + ichr - ichrMinGet, utf); + break; + case kutf16: + pgts->fetch(ichrMinGet, ichrLimGet - ichrMinGet, rgchwText16); + fRet = AtUnicodeCharBoundary(rgchwText16, ichrLimGet - ichrMinGet, + ichr - ichrMinGet, utf); + break; + default: + Assert(false); + case kutf32: + fRet = true; + break; + } + + return fRet; +} + +/*---------------------------------------------------------------------------------------------- + Return true if the given position is at the boundary of a Unicode character; return false + if it is between two parts of pair of surrogates. +----------------------------------------------------------------------------------------------*/ +bool GrCharStream::AtUnicodeCharBoundary(utf16 * prgchw, int cchw, int ichr, UtfType utf) +{ + Assert(ichr >= 0); + Assert(ichr <= cchw); + + if (ichr == 0) + return true; + if (ichr >= cchw) + return true; + + switch (utf) + { + case kutf16: + { + unsigned int nUtf32; + bool fMiddleOfPair = FromSurrogatePair(prgchw[ichr - 1], prgchw[ichr], &nUtf32); + return !fMiddleOfPair; + } + case kutf8: + { + // 16-bit buffer being treated like UTF-8. + utf8 rgchs[2]; + rgchs[1] = (utf8)prgchw[ichr]; + return AtUnicodeCharBoundary(rgchs, 2, 1, kutf8); + } + case kutf32: + default: + return true; + } + +/* + // temp stuff for debugging: + if (ichr > 0 && cchw >= 1 && prgchw[ichr-1] == '^' && prgchw[ichr] == 'a') + { + return false; + } + if (ichr > 0 && cchw >= 2 && prgchw[ichr-1] == '#' && prgchw[ichr] == '#' && + prgchw[ichr+1] == 'B') + { + return false; + } + if (ichr > 1 && cchw >= 1 && prgchw[ichr-2] == '#' && prgchw[ichr-1] == '#' && + prgchw[ichr] == 'B') + { + return false; + } + + return true; +*/ +} +#ifdef NDEBUG +bool GrCharStream::AtUnicodeCharBoundary(utf8 * prgchs, int cchs, int ichs, UtfType /*utf*/) +#else +bool GrCharStream::AtUnicodeCharBoundary(utf8 * prgchs, int cchs, int ichs, UtfType utf) +#endif +{ + Assert(ichs >= 0); + Assert(ichs <= cchs); + + Assert(utf == kutf8); + + if (ichs == 0) + return true; + if (ichs >= cchs) + return true; + + if (cchs == 0) + return true; + + // A bit pattern of 10xxxxxx indicates a continuation of a sequence + // (11xxxxxx means the first byte of a sequence, 0xxxxxxx means a single character). + + utf8 chsTest = prgchs[ichs] & 0xC0; + return (chsTest != 0x80); +} + +/*---------------------------------------------------------------------------------------------- + Convert the given pair of characters into a single 32-bit Unicode character. Return + true if they are a legitimate surrogate pair. If not, just return the first of the + two 16-bit characters. +----------------------------------------------------------------------------------------------*/ +bool GrCharStream::FromSurrogatePair(utf16 chwIn1, utf16 chwIn2, unsigned int * pchlOut) +{ + if ((chwIn1 < kzUtf16HighFirst) || (chwIn1 > kzUtf16HighLast) + || (chwIn2 < kzUtf16LowFirst) || (chwIn2 > kzUtf16LowLast)) + { + // Not a surrogate + *pchlOut = (unsigned int)chwIn1; + return false; + } + else + { + *pchlOut = ((chwIn1 - kzUtf16HighFirst) << kzUtf16Shift) + chwIn2 + kzUtf16Inc; + return true; + } +} + +/*---------------------------------------------------------------------------------------------- + Decode 1-6 bytes in the character string from UTF-8 format to Unicode (UCS-4). + As a side-effect, cbOut is set to the number of UTF-8 bytes consumed. + + @param rgchUtf8 Pointer to a a character array containing UTF-8 data. + @param cchUtf8 Number of characters in the array. + @param cbOut Reference to an integer for holding the number of input (8-bit) characters + consumed to produce the single output Unicode character. + + @return A single Unicode (UCS-4) character. If an error occurs, return -1. +----------------------------------------------------------------------------------------------*/ +long GrCharStream::DecodeUtf8(const utf8 * rgchUtf8, int cchUtf8, int * pcbOut) +{ + // check for valid input + AssertArray(rgchUtf8, cchUtf8); + if ((cchUtf8 == 0) || (rgchUtf8[0] == '\0')) + { + *pcbOut = (cchUtf8) ? 1 : 0; + return 0; + } + // + // decode the first byte of the UTF-8 sequence + // + long lnUnicode; + int cbExtra; + int chsUtf8 = *rgchUtf8++ & 0xFF; + if (chsUtf8 >= kzUtf8Flag6) // 0xFC + { + lnUnicode = chsUtf8 & kzUtf8Mask6; + cbExtra = 5; + } + else if (chsUtf8 >= kzUtf8Flag5) // 0xF8 + { + lnUnicode = chsUtf8 & kzUtf8Mask5; + cbExtra = 4; + } + else if (chsUtf8 >= kzUtf8Flag4) // 0xF0 + { + lnUnicode = chsUtf8 & kzUtf8Mask4; + cbExtra = 3; + } + else if (chsUtf8 >= kzUtf8Flag3) // 0xE0 + { + lnUnicode = chsUtf8 & kzUtf8Mask3; + cbExtra = 2; + } + else if (chsUtf8 >= kzUtf8Flag2) // 0xC0 + { + lnUnicode = chsUtf8 & kzUtf8Mask2; + cbExtra = 1; + } + else // 0x00 + { + lnUnicode = chsUtf8; + cbExtra = 0; + } + if (cbExtra >= cchUtf8) + { + return -1; + } + + switch (cbExtra) + { + case 5: + lnUnicode <<= kzUtf8ByteShift; + chsUtf8 = *rgchUtf8++ & 0xFF; + if ((chsUtf8 & ~kzByteMask) != 0x80) + return -1; + lnUnicode += chsUtf8 & kzByteMask; + // fall through + case 4: + lnUnicode <<= kzUtf8ByteShift; + chsUtf8 = *rgchUtf8++ & 0xFF; + if ((chsUtf8 & ~kzByteMask) != 0x80) + return -1; + lnUnicode += chsUtf8 & kzByteMask; + // fall through + case 3: + lnUnicode <<= kzUtf8ByteShift; + chsUtf8 = *rgchUtf8++ & 0xFF; + if ((chsUtf8 & ~kzByteMask) != 0x80) + return -1; + lnUnicode += chsUtf8 & kzByteMask; + // fall through + case 2: + lnUnicode <<= kzUtf8ByteShift; + chsUtf8 = *rgchUtf8++ & 0xFF; + if ((chsUtf8 & ~kzByteMask) != 0x80) + return -1; + lnUnicode += chsUtf8 & kzByteMask; + // fall through + case 1: + lnUnicode <<= kzUtf8ByteShift; + chsUtf8 = *rgchUtf8++ & 0xFF; + if ((chsUtf8 & ~kzByteMask) != 0x80) + return -1; + lnUnicode += chsUtf8 & kzByteMask; + break; + case 0: + // already handled + break; + default: + Assert(false); + } + if ((unsigned long)lnUnicode > kzUnicodeMax) + { + return -1; + } + *pcbOut = cbExtra + 1; + return lnUnicode; +} + +/*---------------------------------------------------------------------------------------------- + Get the current feature values and character properties from the stream. +----------------------------------------------------------------------------------------------*/ +void GrCharStream::CurrentFeatures(GrTableManager * ptman, GrFeatureValues * pfval) +{ + if (m_ichrRunOffset == kPosInfinity) + { + // Not yet set up. + if (AtEnd()) + { + // Empty stream; no valid values. + Assert(false); + return; + } + + // Get the settings from the first character. + int ichrSegOffset; + int ichrPosSave = m_ichrPos; + int ichrRunOffsetSave = m_ichrRunOffset; + int ichlRunOffsetSave = m_ichlRunOffset; + int cMapSize = m_vislotNextChunkMap.size(); + int cchrConsumed; + NextGet(ptman, pfval, &ichrSegOffset, &cchrConsumed); + // Put the character back. + m_ichrPos = ichrPosSave; + m_ichrRunOffset = ichrRunOffsetSave; + m_ichlRunOffset = ichlRunOffsetSave; + while (signed(m_vislotNextChunkMap.size()) > cMapSize) + m_vislotNextChunkMap.pop_back(); + } + else + { + *pfval = m_fvalRunFeats; + //*ppchrp = &m_chrpRun; + } +} + +/*---------------------------------------------------------------------------------------------- + Read the feature settings from the text properties. + + Eventually, handle style index here? +----------------------------------------------------------------------------------------------*/ +void GrCharStream::SetUpFeatureValues(GrTableManager * ptman, int ichr) +{ + // Set all the features to their default values. + for (int i = 0; i < kMaxFeatures; ++i) + { + m_fvalRunFeats.m_rgnFValues[i] = ptman->DefaultForFeatureAt(i); + } + m_fvalRunFeats.m_nStyleIndex = 0; + + // Add in the defaults for the language of the text. + std::vector vnFeats; + std::vector vnValues; + isocode lgcode = m_pgts->getLanguage(ichr); + ptman->DefaultsForLanguage(lgcode, vnFeats, vnValues); + size_t ifeatLp; + int ifeat; + for (ifeatLp = 0; ifeatLp < vnFeats.size(); ifeatLp++) + { + ptman->FeatureWithID(vnFeats[ifeatLp], &ifeat); + m_fvalRunFeats.m_rgnFValues[ifeat] = vnValues[ifeatLp]; + } + + // Add in the explicit feature settings. + FeatureSetting rgfset[kMaxFeatures]; + int cfeat = m_pgts->getFontFeatures(ichr, rgfset); + + for (ifeatLp = 0; ifeatLp < (size_t)cfeat; ifeatLp++) + { + ptman->FeatureWithID(rgfset[ifeatLp].id, &ifeat); + if (ifeat >= 0) + m_fvalRunFeats.m_rgnFValues[ifeat] = rgfset[ifeatLp].value; + } +} + +} // namespace gr diff --git a/Build/source/libs/graphite/engine-2.4/src/segment/GrCharStream.h b/Build/source/libs/graphite/engine-2.4/src/segment/GrCharStream.h new file mode 100644 index 00000000000..bb91cf54eba --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/src/segment/GrCharStream.h @@ -0,0 +1,183 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 1999, 2001 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: GrCharStream.h +Responsibility: Sharon Correll +Last reviewed: Not yet. + +Description: + + +----------------------------------------------------------------------------------------------*/ +#ifdef _MSC_VER +#pragma once +#endif +#ifndef GR_CHARSTREAM_INCLUDED +#define GR_CHARSTREAM_INCLUDED + +//:End Ignore + +namespace gr +{ + +/*---------------------------------------------------------------------------------------------- + Makes a stream out of a text string that is serving as input to the process. + + Hungarian: chstrm +----------------------------------------------------------------------------------------------*/ +class GrCharStream +{ +public: + // Constructor and destructor: + GrCharStream(ITextSource * pgts, int ichrMin, int ichrLim, + bool fStartLine, bool fEndLine); + + ~GrCharStream() + { + if (m_cchlRunMax >= 0) + delete[] m_prgchlRunText; + } + + // Getters: + ITextSource * TextSrc() { return m_pgts; } + int Min() { return m_ichrMin; } + int Pos() { return m_ichrPos; } + int Lim() { return m_ichrLim; } + bool StartLine() { return m_fStartLine; } + bool EndLine() { return m_fEndLine; } + + // offset from the beginning of the segment + int SegOffset() { return m_ichrPos - m_ichrMin; } + int SegOffset(int ichr) { return ichr - m_ichrMin; } + + bool AtEnd() + { + return (m_ichrPos >= m_ichrLim); + } + + // The input string is empty. + bool IsEmpty() + { + return (m_ichrLim - m_ichrMin == 0); + } + + // When we are restarting in order to create a segment other than the first, + // back up the position in the stream slightly in order to reprocess a few characters + // before the line-break. + void Backup(int cchrToReprocess) + { + Assert(m_ichrPos >= cchrToReprocess); + m_ichrPos -= cchrToReprocess; + m_ichrRunOffset = kPosInfinity; + m_cchrBackedUp = cchrToReprocess; + } + + // When we found a hard-break in the input stream, we need to put it back, and since + // we're done, we set the end of the stream to that position. + void HitHardBreak() + { + m_ichrPos -= 1; + m_ichrRunOffset -= 1; + m_ichrLim = m_ichrPos; + } + + void Restart(); + + int NextGet(GrTableManager *, GrFeatureValues * pfval, int * ichrSegOffset, int * pcchr); + + void CurrentFeatures(GrTableManager * ptman, GrFeatureValues * pfval); + + // For transduction logging: + int GetLogData(GrTableManager * ptman, int * rgnChars, bool * rgfNewRun, + GrFeatureValues * rgfval, int cchwBackup, + int * pcchwMaxRaw); + void GetLogDataRaw(GrTableManager * ptman, int cchw, int cchwBackup, + int cchwMax16bit, int * prgnChars, + utf16 * prgchw2, utf16 * prgchw3, utf16 * prgchw4, utf16 * prgchw5, utf16 * prgchw6, + int * prgichwRaw); + +protected: + void SetUpFeatureValues(GrTableManager * ptman, int ichr); +public: + static utf32 Utf8ToUtf32(utf8 * prgchs8bit, int cchs, int * pcchsUsed); + static utf32 Utf16ToUtf32(utf16 * prgchw16bit, int cchw, int * pcchwUsed); + bool AtUnicodeCharBoundary(int cchr) + { + return AtUnicodeCharBoundary(m_pgts, cchr); + } + static bool AtUnicodeCharBoundary(ITextSource * pgts, int ichr); + static bool AtUnicodeCharBoundary(utf8 * prgchs, int cchs, int ichs, UtfType utf); + static bool AtUnicodeCharBoundary(utf16 * prgchw, int cchw, int ichr, UtfType utf); + static bool FromSurrogatePair(utf16 chwIn1, utf16 chwIn2, unsigned int * pch32Out); + static long DecodeUtf8(const utf8 * rgchUtf8, int cchUtf8, int * pcbOut); + +protected: + // Instance variables: + // Hungarian note: chr = raw characters, chl = long characters (UTF-32) + // chs = short characters (UTF-8), chw = wide characters (UTF-16) + ITextSource * m_pgts; // string to render + UtfType m_utf; // what encoding form the text-source uses + int m_ichrMin; // official start of segment relative to beginning of string + int m_ichrLim; // end of stream (potential end of seg) relative to beginning of string + int m_ichrPos; // stream position (0 = start of string) + bool m_fStartLine; // true if a line-break character should be prepended + bool m_fEndLine; // true if a line-break character should be appended + int m_cchrBackedUp; // number of characters backed up before beginning of segment + + // We read a run's worth of data at a time and cache it in the following variables: + int m_cchlRunMax; // size of buffer allocated + int * m_prgchlRunText; // buffer containing current run + int m_ichrRunMin; // start of run relative to beginning of string + int m_ichrRunLim; // end of run relative to beginning of string + int m_ichlRunOffset; // index into m_prgchlRunText; kPosInfinity if nothing set up + int m_ichrRunOffset; // corresponding index into text source + GrFeatureValues m_fvalRunFeats; + + std::vector m_vislotNextChunkMap; // maps from 16-bit chars to 32-bit chars & glyphs + + enum + { + kzUtf8Mask1 = 0x7F, + kzUtf8Mask2 = 0x1F, + kzUtf8Mask3 = 0x0F, + kzUtf8Mask4 = 0x07, + kzUtf8Mask5 = 0x03, + kzUtf8Mask6 = 0x01 + }; + + enum + { + kzUtf8Flag1 = 0x00, + kzUtf8Flag2 = 0xC0, + kzUtf8Flag3 = 0xE0, + kzUtf8Flag4 = 0xF0, + kzUtf8Flag5 = 0xF8, + kzUtf8Flag6 = 0xFC + }; + + enum + { + kzByteMask = 0x3F, + kzByteMark = 0x80, + kzUtf8ByteShift = 6, + kzUnicodeMax = 0x7FFFFFFF + }; + + enum + { + kzUtf16Shift = 10, + kzUtf16Inc = 0x2400, + kzUtf16HighFirst = 0xD800, + kzUtf16HighLast = 0xDBFF, + kzUtf16LowFirst = 0xDC00, + kzUtf16LowLast = 0xDFFF + }; +}; + +} // namespace gr + +#endif // !GR_CHARSTREAM_INCLUDED + diff --git a/Build/source/libs/graphite/engine-2.4/src/segment/GrClassTable.cpp b/Build/source/libs/graphite/engine-2.4/src/segment/GrClassTable.cpp new file mode 100644 index 00000000000..80876fb8f74 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/src/segment/GrClassTable.cpp @@ -0,0 +1,269 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 1999, 2001 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: GrClassTable.cpp +Responsibility: Sharon Correll +Last reviewed: Not yet. + +Description: + Implements the GrClassTable class and related classes. +----------------------------------------------------------------------------------------------*/ + +//:>******************************************************************************************** +//:> Include files +//:>******************************************************************************************** +#include "Main.h" + +#ifdef _MSC_VER +#pragma hdrstop +#endif + +//:End Ignore + +//:>******************************************************************************************** +//:> Forward declarations +//:>******************************************************************************************** + +//:>******************************************************************************************** +//:> Local Constants and static variables +//:>******************************************************************************************** + +namespace gr +{ + +//:>******************************************************************************************** +//:> Methods +//:>******************************************************************************************** + +/*---------------------------------------------------------------------------------------------- + Fill in by reading from the file stream. +----------------------------------------------------------------------------------------------*/ +bool GrClassTable::ReadFromFont(GrIStream & grstrm, int fxdVersion) +{ + long lClassMapStart; + grstrm.GetPositionInFont(&lClassMapStart); + + // number of classes + m_ccls = grstrm.ReadUShortFromFont(); + if (m_ccls >= kMaxReplcmtClasses) + return false; // bad table + if (fxdVersion < 0x00030000 && m_ccls > kMaxReplcmtClassesV1_2) + return false; // bad table + + // number of linear classes + m_cclsLinear = grstrm.ReadUShortFromFont(); + if (m_cclsLinear > m_ccls) + return false; // bad table + + // class offsets + m_prgichwOffsets = new data16[m_ccls + 1]; + gAssert(m_prgichwOffsets); + if (!m_prgichwOffsets) + return false; // bad table + + data16 * pchw = m_prgichwOffsets; + int icls; + for (icls = 0; icls <= m_ccls; icls++, pchw++) + { + *pchw = grstrm.ReadUShortFromFont(); + } + + // Offsets are relative to the start class map; make them relative to the class list + // itself, and in terms of utf16s, not bytes. + long lClassesPos; + grstrm.GetPositionInFont(&lClassesPos); + int cbDiff = lClassesPos - lClassMapStart; + for (icls = 0; icls <= m_ccls; icls++) + { + m_prgichwOffsets[icls] = data16(int(m_prgichwOffsets[icls]) - cbDiff); + gAssert((m_prgichwOffsets[icls] & 0x00000001) == 0); + if ((m_prgichwOffsets[icls] & 0x00000001) != 0) + return false; // bad table + m_prgichwOffsets[icls] >>= 1; // divide by 2 + } + + // classes - slurp entire block (data remains in big-endian format) + m_prgchwBIGGlyphList = new data16[m_prgichwOffsets[m_ccls]]; + gAssert(m_prgchwBIGGlyphList); + if (!m_prgchwBIGGlyphList) + return false; // bad table + grstrm.ReadBlockFromFont(m_prgchwBIGGlyphList, + m_prgichwOffsets[m_ccls] * sizeof(data16)); + + return true; +} + +/*---------------------------------------------------------------------------------------------- + Set up an empty class table. +----------------------------------------------------------------------------------------------*/ +void GrClassTable::CreateEmpty() +{ + // number of classes + m_ccls = 0; + // number of linear classes + m_cclsLinear = 0; +} + +/*---------------------------------------------------------------------------------------------- + Search for the glyph ID using a fast binary search, and return the matching index. +----------------------------------------------------------------------------------------------*/ +int GrInputClass::FindIndex(gid16 gid) +{ + int digixInit = InitialSearchRange(); + int igixStart = StartSearch(); +#ifdef _DEBUG + int cgix = NumberOfGlyphs(); + int nPowerOf2 = 1; + while (nPowerOf2 <= cgix) + nPowerOf2 <<= 1; + nPowerOf2 >>= 1; + // Now nPowerOf2 is the max power of 2 <= cgix + gAssert((1 << LoopCount()) == nPowerOf2); // LoopCount() == log2(nPowerOf2) + gAssert(digixInit == nPowerOf2); + gAssert(igixStart == cgix - digixInit); +#endif // _DEBUG + + int digixCurr = digixInit; + + GrGlyphIndexPair * pgixCurr = m_pgixFirst + igixStart; + while (digixCurr > 0) + { + int nTest; + if (pgixCurr < m_pgixFirst) + nTest = -1; + else + nTest = pgixCurr->GlyphID() - gid; + + if (nTest == 0) + return pgixCurr->Index(); + + digixCurr >>= 1; // divide by 2 + if (nTest < 0) + pgixCurr += digixCurr; + else // (nTest > 0) + pgixCurr -= digixCurr; + } + + return -1; +} + +/*---------------------------------------------------------------------------------------------- + Return the selector index for the given glyph ID. +----------------------------------------------------------------------------------------------*/ +int GrClassTable::FindIndex(int icls, gid16 chwGlyphID) +{ + if (icls >= m_ccls) + { + gAssert(false); // bad compiler problem + return 0; + } + + if (icls < m_cclsLinear) + { + // The class is an output class--uses linear format--and is being used as an + // input class. Shouldn't happen if the compiler is working right. + gAssert(false); // comment out for test procedures + + // Do a slow linear search to find the glyph ID. + int ichwMin = m_prgichwOffsets[icls]; + int ichwLim = m_prgichwOffsets[icls+1]; + int cchw = ichwLim - ichwMin; + + for (int ichw = 0; ichw < cchw; ichw++) + { + if (GlyphAt(ichwMin + ichw) == chwGlyphID) + return ichw; + } + return -1; + } + + // Slurp the class into an instance so we can see what's there. + GrInputClass clsin; + int ichwMin = m_prgichwOffsets[icls]; + int ichwLim = m_prgichwOffsets[icls+1]; + clsin.CopyFrom(GlyphListLoc(ichwMin), (ichwLim - ichwMin)); + + // Do a fast binary search to find our glyph. + int iRet = clsin.FindIndex(chwGlyphID); + return iRet; +} + +/*---------------------------------------------------------------------------------------------- + Return the glyph ID at the selector index. +----------------------------------------------------------------------------------------------*/ +gid16 GrClassTable::GetGlyphID(int icls, int ichw) +{ + if (ichw < 0) + { + gAssert(false); + return 0; + } + + if (icls >= m_cclsLinear) + { + // The class is an input class--sorted by glyph ID--and is being used as an + // output class. Shouldn't happen if the compiler is working right. + gAssert(false); // comment out for test procedures + + if (icls >= m_ccls) // bad compiler problem + return 0; + + // Do a slow linear search to find the index and answer the matching glyph. + // Slurp the class into an instance so we can see what's there. + GrInputClass clsin; + int ichwMin = m_prgichwOffsets[icls]; + int ichwLim = m_prgichwOffsets[icls+1]; + clsin.CopyFrom(GlyphListLoc(ichwMin), (ichwLim - ichwMin)); + + int cgix = clsin.NumberOfGlyphs(); + for (int igix = 0; igix < cgix; igix++) + { + GrGlyphIndexPair * m_pgix = clsin.m_pgixFirst + igix; + if (m_pgix->Index() == ichw) + return m_pgix->GlyphID(); + } + return 0; + } + + int ichwMin = m_prgichwOffsets[icls]; + int ichwLim = m_prgichwOffsets[icls+1]; + + if (ichw >= ichwLim - ichwMin) + return 0; + else + return GlyphAt(ichwMin + ichw); +} + +/*---------------------------------------------------------------------------------------------- + Return the number of glyphs in the class. +----------------------------------------------------------------------------------------------*/ +int GrClassTable::NumberOfGlyphsInClass(int icls) +{ + int ichwMin = m_prgichwOffsets[icls]; + int ichwLim = m_prgichwOffsets[icls+1]; + + if (icls >= m_cclsLinear) + { + if (icls >= m_ccls) // bad compiler problem + return 0; + + GrInputClass clsin; + clsin.CopyFrom(GlyphListLoc(ichwMin), (ichwLim - ichwMin)); + + int cgix = clsin.NumberOfGlyphs(); + return cgix; + } + else + { + gAssert(false); // this method should not be used for output classes. + return ichwLim - ichwMin; + } +} + +} // namespace gr + +//:End Ignore + diff --git a/Build/source/libs/graphite/engine-2.4/src/segment/GrClassTable.h b/Build/source/libs/graphite/engine-2.4/src/segment/GrClassTable.h new file mode 100644 index 00000000000..26dab8ca105 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/src/segment/GrClassTable.h @@ -0,0 +1,179 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 1999, 2001 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: GrClassTable.h +Responsibility: Sharon Correll +Last reviewed: Not yet. + +Description: + The GrClassTable and related classes that store the classes that are used in substitutions. +----------------------------------------------------------------------------------------------*/ +#ifdef _MSC_VER +#pragma once +#endif +#ifndef GR_CTABLE_INCLUDED +#define GR_CTABLE_INCLUDED + +#include + +//:End Ignore + +namespace gr +{ + +/*---------------------------------------------------------------------------------------------- + A glyph ID / index pair, a member of the GrInputClass where the items are sorted + by glyph ID. + + Hungarian: gix +----------------------------------------------------------------------------------------------*/ +class GrGlyphIndexPair +{ + friend class GrInputClass; + friend class GrClassTable; + + gid16 GlyphID() { return lsbf(m_gidBIG); } + data16 Index() { return lsbf(m_nBIGIndex); } + + gid16 m_gidBIG; + data16 m_nBIGIndex; +}; + +/*---------------------------------------------------------------------------------------------- + A class consisting of a mapping from glyph ID to index, used for classes that + function as input classes (eg, occurrng in the left-hand side of a rule). + + Hungarian: clsin +----------------------------------------------------------------------------------------------*/ +class GrInputClass +{ + friend class GrClassTable; + +protected: + /*------------------------------------------------------------------------------------------ + Copy the raw memory into the instance. + ------------------------------------------------------------------------------------------*/ +#ifdef NDEBUG + void CopyFrom(data16 * pchwStart, int) +#else + void CopyFrom(data16 * pchwStart, int cchw) +#endif + { + m_cgixBIG = pchwStart[0]; + m_digixBIGInit = pchwStart[1]; + m_cBIGLoop = pchwStart[2]; + m_igixBIGStart = pchwStart[3]; + + int cgix = NumberOfGlyphs(); + m_pgixFirst = m_prggixBuffer; + if (cgix > 64) + { + m_vgix.resize(cgix); + m_pgixFirst = &m_vgix[0]; + } + gAssert((4 + (cgix * 2)) == cchw); + #ifdef _DEBUG + std::memset(m_pgixFirst, 0, cgix * sizeof(GrGlyphIndexPair)); + #endif + Assert(sizeof(GrGlyphIndexPair) == sizeof(gid16) + sizeof(data16)); + GrGlyphIndexPair * pgixStart = reinterpret_cast(pchwStart + 4); + std::copy(pgixStart, pgixStart + cgix, m_pgixFirst); + } + + int NumberOfGlyphs() { return lsbf(m_cgixBIG); } + int LoopCount() { return lsbf(m_cBIGLoop); } + int InitialSearchRange() { return lsbf(m_digixBIGInit); } + int StartSearch() { return lsbf(m_igixBIGStart); } + + int FindIndex(gid16 gid); + +protected: + // Instance variables: + data16 m_cgixBIG; // number of glyphs in the class + + // constants for fast binary search + data16 m_digixBIGInit; // (max power of 2 <= m_cgix); + // size of initial range to consider + data16 m_cBIGLoop; // log2(max power of 2 <= m_cgix); + // indicates how many iterations are necessary + data16 m_igixBIGStart; // m_cgix - m_digixInit; + // where to start search + + GrGlyphIndexPair m_prggixBuffer[64]; + std::vector m_vgix; + GrGlyphIndexPair * m_pgixFirst; +}; + + +/*---------------------------------------------------------------------------------------------- + Contains all the classes used for substitution rules. + + Hungarian: ctbl +----------------------------------------------------------------------------------------------*/ + +class GrClassTable +{ + friend class FontMemoryUsage; + +public: + // Constructor & destructor: + GrClassTable() + : m_prgichwOffsets(NULL), + m_prgchwBIGGlyphList(NULL) + { + } + + ~GrClassTable() + { + delete[] m_prgichwOffsets; + delete[] m_prgchwBIGGlyphList; + } + + int NumberOfClasses() { return m_ccls; } + int NumberOfInputClasses() { return m_ccls - m_cclsLinear; } + int NumberOfOutputClasses() { return m_cclsLinear; } + + bool ReadFromFont(GrIStream & grstrm, int fxdVersion); + void CreateEmpty(); + + int FindIndex(int icls, gid16 chwGlyphID); + gid16 GetGlyphID(int icls, int ichw); + int NumberOfGlyphsInClass(int icls); + + gid16 GlyphAt(int ichw) + { + return lsbf(m_prgchwBIGGlyphList[ichw]); + } + data16 * GlyphListLoc(int ichw) + { + return m_prgchwBIGGlyphList + ichw; + } + +protected: + // Instance variables: + int m_ccls; // number of classes + int m_cclsLinear; // number of classes in linear format + + data16 * m_prgichwOffsets; + + // Two formats are included in the following array: the first section consists of + // flat ordered lists of glyphs, used for the "output" classes that use linear format. + // This provides an index-to-glyph mapping. + // The second section contains data in the format of GrInputClasses, used for "input" + // classes that need a binary-search format. This provides a glyph-to-index mapping. + // We don't create instances of GrInputClasses, because that would make reading + // from the ECF file slow. Instead we just set up a single instance at the time + // we're interested in it. + // NOTE that all this data has been slurped directly from the ECF file and therefore + // uses BIG-ENDIAN format. + gid16 * m_prgchwBIGGlyphList; + +}; + +} // namespace gr + +#endif // !GR_CTABLE_INCLUDED + diff --git a/Build/source/libs/graphite/engine-2.4/src/segment/GrEngine.cpp b/Build/source/libs/graphite/engine-2.4/src/segment/GrEngine.cpp new file mode 100644 index 00000000000..258ea0a0299 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/src/segment/GrEngine.cpp @@ -0,0 +1,1984 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 1999, 2001 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: GrEngine.cpp +Responsibility: Sharon Correll +Last reviewed: Not yet. + +Description: Contains the implementation of the GrEngine class. +----------------------------------------------------------------------------------------------*/ + +//:>******************************************************************************************** +//:> Include files +//:>******************************************************************************************** +#include "Main.h" +#include +#include +#ifdef _MSC_VER +#pragma hdrstop +#endif +// any other headers (not precompiled) + +//:End Ignore + +namespace gr +{ + +//:>******************************************************************************************** +//:> Forward declarations +//:>******************************************************************************************** + +//:>******************************************************************************************** +//:> Local Constants and static variables +//:>******************************************************************************************** + + +//:>******************************************************************************************** +//:> General functions +//:>******************************************************************************************** + +// Stand-alone function: +void EngineVersion(int * nMajor, int * nMinor, int * nBugFix) +{ + *nMajor = GRAPHITE_VERSION_MAJOR; + *nMinor = GRAPHITE_VERSION_MINOR; + *nBugFix = GRAPHITE_VERSION_BUGFIX; +} + +bool compareCmap(const byte *lhs, const byte *rhs) +{ + using namespace gr; + + typedef const struct index {data16 version; data16 numberSubtables;} *const IndexPtr; + typedef const struct enc {data16 platID; data16 platSpecID; data32 offset;} *const EncPtr; + + // Calculate the size of the cmap. + + IndexPtr rhsIndex = IndexPtr(rhs); + size_t numSubTbl = lsbf(rhsIndex->numberSubtables); + size_t cbCmapSz = sizeof(index) + sizeof(enc) * numSubTbl; + EncPtr encTbl = EncPtr(rhs + sizeof(index)); + + for (size_t iSubTbl = 0; iSubTbl < numSubTbl; iSubTbl++) + //for (int iSubTbl = numSubTbl - 1; iSubTbl >= 0; --iSubTbl) + { + const data16 *const mapTbl = reinterpret_cast(rhs + lsbf((int)encTbl[iSubTbl].offset)); + int format = lsbf(*mapTbl); + switch (format) + { + // 16-bit lengths + case 0: + case 2: + case 4: + case 6: + cbCmapSz += lsbf((data16)unsigned(mapTbl[1])); + break; + // 32-bit lengths + case 8: + case 10: + case 12: + cbCmapSz += lsbf((int)unsigned(reinterpret_cast(mapTbl)[1])); + break; + default: + Assert(false); + } + } + + // Do the comparison. + return (memcmp(lhs, rhs, cbCmapSz) ? false : true); +} + + +//:>******************************************************************************************** +//:> GrEngine class. +//:>******************************************************************************************** + +GrEngine::GrEngine() +{ + /////////////_CrtSetDbgFlag(_CRTDBG_CHECK_ALWAYS_DF); //////////////// + + + m_cref = 1; + BasicInit(); +} + +void GrEngine::BasicInit() +{ + m_pfface = NULL; + + m_ptman = NULL; + m_pctbl = NULL; + m_pgtbl = NULL; + m_prgpsd = NULL; + m_cpsd = 0; + m_cfeat = 0; + m_mFontEmUnits = -1; + m_dysOffset = 0; + + ////m_tbufCmap.reset(); + m_pCmap_3_1 = NULL; + m_pCmap_3_10 = NULL; + ////m_tbufNameTbl.reset(); + // new interface stuff: + m_pCmapTbl = NULL; + m_pNameTbl = NULL; + m_fCmapTblCopy = false; + m_fNameTblCopy = false; + + m_fLogXductn = false; + + m_resFontValid = kresInvalidArg; // not yet initialized + m_ferr = kferrUninitialized; + m_fxdBadVersion = 0; + + m_fSmartReg = false; + m_fSmartBold = false; + m_fSmartItalic = false; + m_fSmartBI = false; + m_fFakeItalicCache = false; + m_fFakeBICache = false; + m_strCtrlFileReg.erase(); + m_strCtrlFileBold.erase(); + m_strCtrlFileItalic.erase(); + m_strCtrlFileBI.erase(); + m_fFakeItalic = false; + m_stuCtrlFile.erase(); + m_stuInitError.erase(); + m_stuErrCtrlFile.erase(); + m_stuFaceName.erase(); + m_stuBaseFaceName.erase(); + m_fUseSepBase = false; + m_stuFeatures.erase(); + + m_nFontCheckSum = 0; + + m_fInErrorState = false; + + m_rglcidFeatLabelLangs = NULL; // initialize lazily, when needed + m_clcidFeatLabelLangs = 0; +} + +GrEngine::~GrEngine() +{ + DestroyEverything(); + #ifdef _MSC_VER + if (!_CrtCheckMemory()) + { + OutputDebugString(L"bad memory"); + } + #endif +} + +/*---------------------------------------------------------------------------------------------- + Clean everything out (destructor or reinitializing with a different face name). +----------------------------------------------------------------------------------------------*/ +void GrEngine::DestroyEverything() +{ + DestroyContents(); + #ifdef _MSC_VER + if (!_CrtCheckMemory()) + { + OutputDebugString(L"bad memory"); + } + #endif + + m_strCtrlFileReg.erase(); + m_strCtrlFileBold.erase(); + m_strCtrlFileItalic.erase(); + m_strCtrlFileBI.erase(); + m_fSmartReg = false; + m_fSmartBold = false; + m_fSmartItalic = false; + m_fSmartBI = false; + m_fFakeItalicCache = false; + m_fFakeBICache = false; + m_stuBaseFaceName.erase(); + + //m_stuFaceName.erase(); + //m_stuFaceName = L"this is not a usable or valid string"; + m_fUseSepBase = false; + m_stuFeatures.erase(); +} + +void GrEngine::DestroyContents(bool fDestroyCmap) +{ + if (fDestroyCmap) + { + ////m_tbufCmap.reset(); + m_pCmap_3_1 = NULL; + m_pCmap_3_10 = NULL; + + if (m_fCmapTblCopy) + delete[] m_pCmapTbl; + if (m_fNameTblCopy) + delete[] m_pNameTbl; + m_pCmapTbl = NULL; + m_pNameTbl = NULL; + m_fCmapTblCopy = false; + m_fNameTblCopy = false; + } + + delete m_ptman; + delete m_pctbl; + delete m_pgtbl; + delete[] m_prgpsd; + m_ptman = NULL; + m_pctbl = NULL; + m_pgtbl = NULL; + m_prgpsd = NULL; + + ////m_tbufNameTbl.reset(); + + m_stuCtrlFile.erase(); + m_stuInitError.erase(); + + m_resFontValid = kresInvalidArg; + m_ferr = kferrUninitialized; +} + +/*---------------------------------------------------------------------------------------------- + For FontFace: return the number of features. +----------------------------------------------------------------------------------------------*/ +size_t GrEngine::NumberOfFeatures_ff() +{ + return (size_t)m_cfeat; +} + +/*---------------------------------------------------------------------------------------------- + For FontFace: return the feature ID for the ifeat-th feature. +----------------------------------------------------------------------------------------------*/ +featid GrEngine::FeatureID_ff(size_t ifeat) +{ + return (featid)m_rgfeat[ifeat].ID(); +} + +/*---------------------------------------------------------------------------------------------- + For FontFace: return the index of the feature with the given ID. +----------------------------------------------------------------------------------------------*/ +size_t GrEngine::FeatureWithID_ff(featid fid) +{ + int ifeatRet; + /* GrFeature * pfeat = */ + FeatureWithID(fid, &ifeatRet); + return (size_t)ifeatRet; +} + +/*---------------------------------------------------------------------------------------------- + For FontFace: return the label for the ifeat-th feature. +----------------------------------------------------------------------------------------------*/ +bool GrEngine::GetFeatureLabel_ff(size_t ifeat, lgid nLanguage, utf16 * rgchwLabel) +{ + std::wstring stu = m_rgfeat[ifeat].Label(this, nLanguage); + + int cch = stu.size(); + cch = min(cch, 127); // 1 char for zero-termination + std::copy(stu.data(), stu.data() + cch, rgchwLabel); + rgchwLabel[cch] = 0; + + return (cch > 0); +} + +/*---------------------------------------------------------------------------------------------- + For FontFace: return the index of the default setting. Return -1 if it cannot be found. +----------------------------------------------------------------------------------------------*/ +int GrEngine::GetFeatureDefault_ff(size_t ifeat) +{ + GrFeature * pfeat = m_rgfeat + ifeat; + int defaultValue = pfeat->DefaultValue(); + int cfset = pfeat->NumberOfSettings(); + int rgnSettings[100]; + pfeat->Settings(100, rgnSettings); + Assert(cfset < 100); // TODO: improve this + for (int ifset = 0; ifset < cfset; ifset++) + { + if (rgnSettings[ifset] == defaultValue) + return ifset; + } + return -1; +} + +/*---------------------------------------------------------------------------------------------- + For FontFace: return the number of settings for the ifeat-th feature. +----------------------------------------------------------------------------------------------*/ +size_t GrEngine::NumberOfSettings_ff(size_t ifeat) +{ + return m_rgfeat[ifeat].NumberOfSettings(); +} + +/*---------------------------------------------------------------------------------------------- + For FontFace: return the value of the ifset-th setting for the ifeat-th feature. +----------------------------------------------------------------------------------------------*/ +int GrEngine::GetFeatureSettingValue_ff(size_t ifeat, size_t ifset) +{ + return m_rgfeat[ifeat].NthSetting(ifset); +} + +/*---------------------------------------------------------------------------------------------- + For FontFace: return the UI label for the given feature setting. +----------------------------------------------------------------------------------------------*/ +bool GrEngine::GetFeatureSettingLabel_ff(size_t ifeat, size_t ifset, lgid language, + utf16 * rgchwLabel) +{ + std::wstring stu = m_rgfeat[ifeat].NthSettingLabel(this, ifset, language); + + int cch = stu.size(); + cch = min(cch, 127); // 1 char for zero-termination + // Note: the wchar_t label was originally assigned from utf16 data, so although wchar_t is + // utf32 on some platforms the conversion back to utf16 should still give correct results. + std::copy(stu.data(), stu.data() + cch, rgchwLabel); + rgchwLabel[cch] = 0; + + return (cch > 0); +} + +/*---------------------------------------------------------------------------------------------- + For FontFace: return the number of languages that are possible among the feature labels. +----------------------------------------------------------------------------------------------*/ +size_t GrEngine::NumberOfFeatLangs_ff() +{ + SetUpFeatLangList(); + return m_clcidFeatLabelLangs; +} + +/*---------------------------------------------------------------------------------------------- + For FontFace: return the language LCID for the feature-label language with the given index. +----------------------------------------------------------------------------------------------*/ +short GrEngine::GetFeatLabelLang_ff(size_t ilang) +{ + SetUpFeatLangList(); + return m_rglcidFeatLabelLangs[ilang]; +} + +/*---------------------------------------------------------------------------------------------- + For FontFace: return the number of supported languages. +----------------------------------------------------------------------------------------------*/ +size_t GrEngine::NumberOfLanguages_ff() +{ + return (size_t)m_langtbl.NumberOfLanguages(); +} + +/*---------------------------------------------------------------------------------------------- + For FontFace: return the language code for the language with the given index. +----------------------------------------------------------------------------------------------*/ +isocode GrEngine::GetLanguageCode_ff(size_t ilang) +{ + return m_langtbl.LanguageCode(ilang); +} + +/*---------------------------------------------------------------------------------------------- + Set up the list of all the languages that are present in the feature labels. +----------------------------------------------------------------------------------------------*/ +void GrEngine::SetUpFeatLangList() +{ + if (m_rglcidFeatLabelLangs) + return; + + int rgnNameIDs[kMaxFeatures]; + for (int ifeat = 0; ifeat < m_cfeat; ifeat++) + rgnNameIDs[ifeat] = m_rgfeat[ifeat].NameId(); + short rglcid[128]; // 128 is the number expected by TtfUtil::GetLangsForNames + m_clcidFeatLabelLangs = TtfUtil::GetLangsForNames(m_pNameTbl, 3, 1, rgnNameIDs, m_cfeat, rglcid); + m_rglcidFeatLabelLangs = new short[m_clcidFeatLabelLangs]; + memcpy(m_rglcidFeatLabelLangs, rglcid, sizeof(short) * m_clcidFeatLabelLangs); +} + +/*---------------------------------------------------------------------------------------------- + Return the maximum size needed for the block of data to pass between segments, that is, + to reinitialize the engine based on the results of the previously generated segment. + This value must match what is in GrTableManager::InitializeStreams() and + InitializeForNextSeg(). 256 is an absolute maximum imposed by the interface. + + In Graphite, what this block of data will contain is information about cross-line + contextualization and some directionality information. + + Assumes InitNew() has already been called to set the font name. +----------------------------------------------------------------------------------------------*/ +GrResult GrEngine::get_SegDatMaxLength(int * pcb) +{ + ChkGrOutPtr(pcb); + + if (m_resFontValid == kresInvalidArg) + ReturnResult(kresUnexpected); // engine not initialized + + GrResult res = m_resFontValid; + if (m_resFontValid == kresFail || m_resFontValid == kresUnexpected || m_resFontValid == kresFalse) + res = kresOk; // invalid font + if (ResultFailed(res)) + ReturnResult(res); + + Assert(m_ptman); + if (!m_ptman) + *pcb = 256; + else + *pcb = m_ptman->NumberOfPasses() + 4; + + ReturnResult(res); +} + +/*---------------------------------------------------------------------------------------------- + @return The supported script direction(s). If more than one, the application is + responsible for choosing the most appropriate. +----------------------------------------------------------------------------------------------*/ +GrResult GrEngine::get_ScriptDirection(unsigned int * pgrfsdc, OLECHAR * /*prgchwErrMsg*/, int /*cchMaxErrMsg*/) +{ + ChkGrOutPtr(pgrfsdc); + ChkGrArrayArg(prgchwErrMsg, cchMaxErrMsg); + + if (m_resFontValid == kresInvalidArg) + ReturnResult(kresUnexpected); // engine not initialized + + GrResult res = m_resFontValid; + + *pgrfsdc = m_grfsdc; + +// ClearFontError(prgchwErrMsg, cchMaxErrMsg); +// try +// { +// if (m_resFontValid == kresFail || m_resFontValid == kresUnexpected || m_resFontValid == kresFalse) +// { +// RecordFontLoadError(prgchwErrMsg, cchMaxErrMsg); +// res = kresOk; +// } +// *pgrfsdc = m_grfsdc; +// } +// catch (Throwable & thr) +// { +// res = (GrResult)thr.Error(); +// *pgrfsdc = kfsdcHorizLtr; +// } +// catch (...) +// { +// res = WARN(kresFail); +// *pgrfsdc = kfsdcHorizLtr; +// } + + ReturnResult(res); +} + +/*---------------------------------------------------------------------------------------------- + Get an glyph attribute from the engine that will help the GrJustifier in its work. +----------------------------------------------------------------------------------------------*/ +GrResult GrEngine::getGlyphAttribute(int iGlyph, int jgat, int nLevel, float * pValueRet) +{ + return m_ptman->State()->GetGlyphAttrForJustification(iGlyph, jgat, nLevel, pValueRet); +} + +GrResult GrEngine::getGlyphAttribute(int iGlyph, int jgat, int nLevel, int * pValueRet) +{ + return m_ptman->State()->GetGlyphAttrForJustification(iGlyph, jgat, nLevel, pValueRet); +} + +/*---------------------------------------------------------------------------------------------- + Set an glyph attribute in the engine as a result of the decisions made by the + GrJustifier. +----------------------------------------------------------------------------------------------*/ +GrResult GrEngine::setGlyphAttribute(int iGlyph, int jgat, int nLevel, float value) +{ + return m_ptman->State()->SetGlyphAttrForJustification(iGlyph, jgat, nLevel, value); +} + +GrResult GrEngine::setGlyphAttribute(int iGlyph, int jgat, int nLevel, int value) +{ + return m_ptman->State()->SetGlyphAttrForJustification(iGlyph, jgat, nLevel, value); +} + +//:>******************************************************************************************** +//:> Non-FieldWorks interface methods +//:>******************************************************************************************** + +/*---------------------------------------------------------------------------------------------- + Make a complete segment that can be used to measure and do line-breaking. + + OBSOLETE - delete +----------------------------------------------------------------------------------------------*/ +/* +GrResult GrEngine::MakeMeasuredSegment( + Font * pfont, ITextSource * pgts, + int ichMin, int ichLim, + bool fParaRtl, + Segment ** ppsegRet, SegEnd * pest, + std::ostream * pstrmLog, + OLECHAR * prgchwErrMsg, int cchMaxErrMsg) +{ + int dichContext, dichLimSeg; + float dxWidth; + return MakeSegment(ksegmodeMsfr, + pfont, pgts, NULL, ichMin, ichLim, false, false, + 100000, klbClipBreak, ktwshAll, // not used + fParaRtl, + ppsegRet, &dxWidth, + 0, NULL, 0, NULL, NULL, &dichContext, // not used + pstrmLog, + prgchwErrMsg, cchMaxErrMsg, + -1, false, false, klbClipBreak, // not used + &dichLimSeg, pest, + false, 100000, kestMoreLines); // not used +} +*/ + +/*---------------------------------------------------------------------------------------------- + Make a segment from the given range, regardless of the kind of line-break that results. + + OBSOLETE - delete +----------------------------------------------------------------------------------------------*/ +/* +GrResult GrEngine::MakeSegmentFromRange( + Font * pfont, ITextSource * pgts, IGrJustifier * pgj, + int ichMin, int ichLim, + bool fStartLine, bool fEndLine, + TrWsHandling twsh, bool fParaRtl, + Segment ** ppsegRet, float * pdxWidth, SegEnd * pest, + int cbPrev, byte * pbPrevSegDat, int cbNextMax, byte * pbNextSegDat, int * pcbNextSegDat, + int * pdichwContext, + std::ostream * pstrmLog, + OLECHAR * prgchwErrMsg, int cchwMaxErrMsg) +{ + int dichLimSegBogus; + return MakeSegment(ksegmodeMsfr, pfont, pgts, pgj, + ichMin, ichLim, + fStartLine, fEndLine, + 10000, klbWordBreak, // not used + twsh, fParaRtl, + ppsegRet, pdxWidth, + //cbPrev, pbPrevSegDat, cbNextMax, pbNextSegDat, pcbNextSegDat, pdichwContext, + 0, NULL, 0, NULL, NULL, NULL, + pstrmLog, + prgchwErrMsg, cchwMaxErrMsg, + ichLim, false, false, klbClipBreak, // not used + &dichLimSegBogus, pest, + 10000, kestMoreLines); // not used +} +*/ + + +//:>******************************************************************************************** +//:> Other methods +//:>******************************************************************************************** + +/*---------------------------------------------------------------------------------------------- + Create a segment. +----------------------------------------------------------------------------------------------*/ +void GrEngine::MakeSegment( + // Common parameters + Segment * psegNew, + Font * pfont, ITextSource * pgts, IGrJustifier * pjus, + LayoutEnvironment & layout, + int ichMin, int ichLim, + // for finding a break point + float dxMaxWidth, + bool fBacktracking, + // for justification + bool fJust, float dxJustifiedWidthJ, SegEnd estJ) +{ + ChkGrArgPtr(pgts); + ChkGrArgPtrN(pjus); + ChkGrOutPtr(psegNew); + Assert(layout.bestBreak() <= layout.worstBreak()); + + if (pjus == NULL) + pjus = layout.justifier(); + + if (m_resFontValid == kresInvalidArg) + // Uninitialized. + return; // ReturnResult(kresUnexpected); + + SetCmapAndNameTables(pfont); + + int segmode = ksegmodeRange; // segment from range + if (fJust) + segmode = ksegmodeJust; // justified segment + else if (dxMaxWidth < kPosInfFloat) + segmode = ksegmodeBreak; // find break point + + bool fFeatureVariations = pgts->featureVariations(); + + // Temporary: + if (!this->m_ptman) + { + Warn("No Graphite tables"); + m_ptman = new GrTableManager(this); + CreateEmpty(); + } + + // GrResult hr = kresOk; + m_fInErrorState = false; + + bool fBold, fItalic; + GetStyles(pfont, ichMin, &fBold, &fItalic); + + GetWritingSystemDirection(pgts, ichMin); + + // Find the end of the range to render with the current font. + int nDirDepth = 0; + int ichFontLim = FindFontLim(pgts, ichMin, &nDirDepth); + int ichStrmLim = 0; + int ichSegLim = 0; + switch (segmode) + { + case ksegmodeBreak: // find break point + // Here ichLim should be the end of the text-source, unless we're backtracking. + ichStrmLim = min(ichFontLim, ichLim); + ichSegLim = -1; // unknown + break; + case ksegmodeJust: // stretching an existing segment to achieve justification + ichStrmLim = ichFontLim; + ichSegLim = ichLim; + break; + //case ksegmodeMms: // MakeMeasuredSegment + // ichLim = ichFontLim; + // ichStrmLim = ichFontLim; + // ichSegLim = -1; // process to the end of the stream + // break; + case ksegmodeRange: // segment from range + ichLim = min(ichLim, ichFontLim); + ichStrmLim = ichFontLim; + ichSegLim = (ichLim == kPosInfinity) ? -1 : ichLim; + break; + default: + Assert(false); + } + + // Initialize the graphics object with the font and character properties. + // SILE + ////if (m_fUseSepBase) + ////{ + //// Assert(m_stuBaseFaceName.size() > 0); + //// SetUpGraphics(pgg, pgts, ichMin, m_stuBaseFaceName); + ////} + ////else + //// SetUpGraphics(pgg, pgts, ichMin, m_stuFaceName); + + GrResult res = kresOk; + + Assert(m_ptman); + m_ptman->State()->SetFont(pfont); + + // Create a character stream on the text source. + GrCharStream * pchstrm = new GrCharStream(pgts, ichMin, ichStrmLim, + layout.startOfLine(), layout.endOfLine()); + + // TODO: change vertical offset to work on a character-by-character basis + m_dysOffset = (pgts->getVerticalOffset(ichMin) * pfont->getDPIy()) / 72; + + // Run the tables and get back a segment. + + bool fMoreText = false; + int ichCallerBtLim = -1; + bool fInfiniteWidth = false; + switch (segmode) + { + //case ksegmodeMms: + case ksegmodeBreak: + case ksegmodeRange: + if (segmode == ksegmodeBreak) + { + fMoreText = ((ichFontLim < ichLim) || fBacktracking); + ichCallerBtLim = (fBacktracking) ? ichLim : -1; + fInfiniteWidth = false; + } + //else if (segmode == ksegmodeMms) + //{ + // fMoreText = false; + // ichCallerBtLim = -1; + // fInfiniteWidth = true; + // Assert(twsh == ktwshAll); + //} + else if (segmode == ksegmodeRange) + { + int ichTextLim; + ichTextLim = pgts->getLength(); + fMoreText = (ichLim < ichTextLim); + ichCallerBtLim = -1; + fInfiniteWidth = true; + } + try { + m_ptman->Run(psegNew, pfont, pchstrm, pjus, + ((pjus) ? kjmodiCanShrink : kjmodiNormal), + layout, + ichSegLim, dxMaxWidth, 0, + fBacktracking, fMoreText, fFeatureVariations, ichFontLim, fInfiniteWidth, false, + ichCallerBtLim, + nDirDepth, estJ); + } + catch (...) + { + // Disastrous problem in rendering. + if (!layout.dumbFallback()) + throw; // throws original exception + + // Try dumb rendering. + if (m_fUseSepBase) + SwitchGraphicsFont(true); // use the base font, which has real glyphs + + m_fInErrorState = true; + res = RunUsingEmpty(psegNew, pfont, pchstrm, layout, + ichSegLim, + dxMaxWidth, + fBacktracking, fMoreText, fInfiniteWidth, + ichCallerBtLim, + nDirDepth, estJ); + } + break; + + case ksegmodeJust: // justified segment + { + m_ptman->Run(psegNew, pfont, pchstrm, pjus, kjmodiJustify, layout, + ichSegLim, + dxJustifiedWidthJ, dxMaxWidth, + false, false, false, // not used + ichFontLim, + true, // infinite width + false, // kludge + -1, + nDirDepth, estJ); + //&dxWidth, &est); + Assert((ichLim - ichMin) == (psegNew->stopCharacter() - psegNew->startCharacter())); + break; + } + + default: + Assert(false); + } + + delete pchstrm; + + if (m_fUseSepBase) + SwitchGraphicsFont(false); +} + +/*---------------------------------------------------------------------------------------------- + Return an indication of whether an error happened in trying to load Graphite tables. +----------------------------------------------------------------------------------------------*/ +FontErrorCode GrEngine::IsValidForGraphite(int * pnVersion, int * pnSubVersion) +{ + if (pnVersion) + *pnVersion = m_fxdBadVersion >> 16; + if (pnSubVersion) + *pnSubVersion = m_fxdBadVersion & 0x0000FFFF; + + return m_ferr; +} + +/*---------------------------------------------------------------------------------------------- + Record a system error indicating that the font could not be loaded properly. + OBSOLETE +----------------------------------------------------------------------------------------------*/ +void GrEngine::RecordFontLoadError(OLECHAR * prgchwErrMsg, int cchMax) +{ + if (prgchwErrMsg == NULL || cchMax == 0) + return; + + std::wstring stuMessage = L"Error in initializing Graphite font \""; + stuMessage.append(m_stuFaceName); + if (m_stuErrCtrlFile.size()) + { + stuMessage.append(L"\" ("); + stuMessage.append(m_stuErrCtrlFile); + stuMessage.append(L")"); + } + else + stuMessage.append(L"\""); + if (m_stuInitError.size()) + { + stuMessage.append(L"--\n"); + stuMessage.append(m_stuInitError); + } + + std::fill_n(prgchwErrMsg, cchMax, L'\0'); + std::copy(stuMessage.data(), stuMessage.data() + min(cchMax - 1, signed(stuMessage.size())), + prgchwErrMsg); +} + +/*---------------------------------------------------------------------------------------------- + Record a system error indicating a bad error in rendering using a supposedly valid font. + OBSOLETE +----------------------------------------------------------------------------------------------*/ +void GrEngine::RecordFontRunError(OLECHAR * prgchwErrMsg, int cchMax, GrResult /*res*/) +{ + if (prgchwErrMsg == NULL || cchMax == 0) + return; + + std::wstring stuMessage = L"Error in rendering using Graphite font \""; + stuMessage.append(m_stuFaceName); + if (m_stuErrCtrlFile.size()) + { + stuMessage.append(L"\" ("); + stuMessage.append(m_stuErrCtrlFile); + stuMessage.append(L")"); + } + else + stuMessage.append(L"\""); + + std::fill_n(prgchwErrMsg, cchMax, L'\0'); + std::copy(stuMessage.data(), stuMessage.data() + min(cchMax - 1, signed(stuMessage.size())), + prgchwErrMsg); +} + +/*---------------------------------------------------------------------------------------------- + Initialize the font error message buffer to zero. This way we can be sure to recognize + an error condition by the fact that the buffer is non-zero. + OBSOLETE +----------------------------------------------------------------------------------------------*/ +void GrEngine::ClearFontError(OLECHAR * prgchwErrMsg, int cchMaxErrMsg) +{ + std::fill_n(prgchwErrMsg, cchMaxErrMsg, L'\0'); +} + +/*---------------------------------------------------------------------------------------------- + Set the overall direction of the writing system based on the text properties. +----------------------------------------------------------------------------------------------*/ +void GrEngine::GetWritingSystemDirection(ITextSource * pgts, int ichwMin) +{ + m_fRightToLeft = pgts->getRightToLeft(ichwMin); +} + +/*---------------------------------------------------------------------------------------------- + Find the end of the range that uses the current font. + + @param pgts - contains text to render + @param ichwMinFont - beginning of range to render with this font + @param pnDirDepth - return direction depth: 0=LTR, 1=RTL + + @return The lim of the range that could be rendered by this font. Also the direction depth. +----------------------------------------------------------------------------------------------*/ +int GrEngine::FindFontLim(ITextSource * pgts, int ichwMinFont, int * pnDirDepth) +{ + int ichwTextLen = (int)pgts->getLength(); + + int ichwLimRange; // range that can be rendered without breaking contextualization. + int ichwMinNext = ichwMinFont; + + while (true) + { + std::pair pairRange = pgts->propertyRange(ichwMinNext); + // int ichwMinRun = pairRange.first; + int ichwLimRun = pairRange.second; + *pnDirDepth = pgts->getDirectionDepth(ichwMinNext); + + //if (ichwLim > -1 && ichwLim < ichwLimRun) + //{ + // // Stopping in the middle of a run + // return ichwLim; + //} + + // We can at least go to the end of this run. + ichwLimRange = ichwLimRun; + if (ichwLimRun >= ichwTextLen) + { + // Hit the end of the text-source + return ichwLimRange; + } + else + { + // If the following run is the same as this run except for color and underlining, + // we don't have to break here. + if (!pgts->sameSegment(ichwMinNext, ichwLimRun)) + return ichwLimRange; + } + ichwMinNext = ichwLimRun; + } + + return ichwLimRange; +} + +/*---------------------------------------------------------------------------------------------- + Read the version number from the tables, and return false if any are a version this + implementation of the engine can't handle. +----------------------------------------------------------------------------------------------*/ +bool GrEngine::CheckTableVersions(GrIStream * pgrstrm, + const byte *pSilfTbl, int lSilfStart, + const byte *pGlobTbl, int lGlocStart, + const byte *pFeatTbl, int lFeatStart, + int * pfxdBadVersion) +{ + pgrstrm->OpenBuffer(pSilfTbl, sizeof(int)); + pgrstrm->SetPositionInFont(lSilfStart); + *pfxdBadVersion = ReadVersion(*pgrstrm); + pgrstrm->CloseBuffer(); + if (*pfxdBadVersion > kSilfVersion) + return false; + + pgrstrm->OpenBuffer(pGlobTbl, lGlocStart + sizeof(int)); + pgrstrm->SetPositionInFont(lGlocStart); + *pfxdBadVersion = ReadVersion(*pgrstrm); + pgrstrm->CloseBuffer(); + if (*pfxdBadVersion > kGlocVersion) + return false; + + pgrstrm->OpenBuffer(pFeatTbl, sizeof(int)); + pgrstrm->SetPositionInFont(lFeatStart); + *pfxdBadVersion = ReadVersion(*pgrstrm); + pgrstrm->CloseBuffer(); + if (*pfxdBadVersion > kFeatVersion) + return false; + + *pfxdBadVersion = 0; + return true; +} + +/*---------------------------------------------------------------------------------------------- + Reinterpret the version number from a font table. +----------------------------------------------------------------------------------------------*/ +int GrEngine::ReadVersion(GrIStream & grstrm) +{ + int fxdVersion = grstrm.ReadIntFromFont(); + + if (fxdVersion < 0x00010000) + fxdVersion = 0x00010000; // kludge for bug with which some fonts were generated + + return fxdVersion; +} + +/*---------------------------------------------------------------------------------------------- + Return whether the text is asking for bold and/or italic text. +----------------------------------------------------------------------------------------------*/ +void GrEngine::GetStyles(Font * pfont, int /*ichwMin*/, bool * pfBold, bool * pfItalic) +{ + *pfBold = pfont->bold(); + *pfItalic = pfont->italic(); +} + +/*---------------------------------------------------------------------------------------------- + Switch the Graphics object between the Graphite table file and the base font. + Should only be called when we know we are using a base font, or when we are reading + the base font to see if it is valid. +----------------------------------------------------------------------------------------------*/ +#ifdef NDEBUG +void GrEngine::SwitchGraphicsFont(bool) +#else +void GrEngine::SwitchGraphicsFont(bool fBase) +#endif +{ + Assert(!fBase || m_stuBaseFaceName.size() > 0); + + //LgCharRenderProps chrp; + //pgg->get_FontCharProperties(&chrp); + //if (fBase) + //{ + // wcsncpy(chrp.szFaceName, m_stuBaseFaceName.data(), m_stuBaseFaceName.size() + 1); + // chrp.szFaceName[31] = 0; + //} + //else + //{ + // wcsncpy(chrp.szFaceName, m_stuFaceName.data(), m_stuFaceName.size() + 1); + // chrp.szFaceName[31] = 0; + //} + //pgg->SetupGraphics(&chrp); +} + +/*---------------------------------------------------------------------------------------------- + Read the contents of the "Silf" table from the stream, which is on an extended + TrueType font file. Specifically, read the iSubTable-th sub-table (for now there is + only one). + + WARNING: any changes to this method must be accompanied by equivalent changes to + CreateEmpty(). +----------------------------------------------------------------------------------------------*/ +bool GrEngine::ReadSilfTable(GrIStream & grstrm, long lTableStart, int iSubTable, + long cbTableLen, int * pchwMaxGlyphID, int * pfxdSilfVersion) +{ + grstrm.SetPositionInFont(lTableStart); + + // version + *pfxdSilfVersion = ReadVersion(grstrm); + if (*pfxdSilfVersion > kSilfVersion) + // Version we don't know how to handle. + return false; + + if (*pfxdSilfVersion >= 0x00030000) + { + // compiler version--more accurately, the level of semantics needed to handle + // this font + int fxdCompilerVersion = ReadVersion(grstrm); + if (fxdCompilerVersion > 0x00040000) + return false; + } + + // number of tables + unsigned short cSubTables = grstrm.ReadUShortFromFont(); + Assert(cSubTables == 1); // for now + Assert(cSubTables <= kMaxSubTablesInFont); + if (cSubTables != 1 || cSubTables > kMaxSubTablesInFont) + return false; // bad font + + if (*pfxdSilfVersion >= 0x00020000) + // reserved + grstrm.ReadShortFromFont(); + + // subtable offsets and lengths + int nSubTableOffsets[kMaxSubTablesInFont+1]; + int cbSubTableLengths[kMaxSubTablesInFont]; + nSubTableOffsets[cSubTables] = cbTableLen; + int i; + for (i = 0; i < cSubTables; i++) + { + nSubTableOffsets[i] = grstrm.ReadIntFromFont(); + if (nSubTableOffsets[i] < 0 || nSubTableOffsets[i] > cbTableLen) + return false; + if (i > 0) + { + cbSubTableLengths[i-1] = nSubTableOffsets[i] - nSubTableOffsets[i-1]; + if (cbSubTableLengths[i-1] < 40) + return false; + } + } + cbSubTableLengths[cSubTables-1] = nSubTableOffsets[cSubTables] - nSubTableOffsets[cSubTables-1]; + + grstrm.SetPositionInFont(lTableStart + nSubTableOffsets[iSubTable]); + + // Now the stream is at the beginning of the desired sub-table. + + // Get the position of the start of the table. + long lSubTableStart; + grstrm.GetPositionInFont(&lSubTableStart); + + // rule version + int fxdRuleVersion = (*pfxdSilfVersion >= 0x00030000) ? + ReadVersion(grstrm) : + *pfxdSilfVersion; + + long lPassBlockPos = -1; + long lPseudosPos = -1; + if (*pfxdSilfVersion >= 0x00030000) + { + lPassBlockPos = grstrm.ReadUShortFromFont(); + if (lPassBlockPos > cbSubTableLengths[iSubTable]) + return false; // bad table + lPassBlockPos += lSubTableStart; + lPseudosPos = grstrm.ReadUShortFromFont(); + if (lPseudosPos > cbSubTableLengths[iSubTable]) + return false; // bad table + lPseudosPos += lSubTableStart; + } + + // maximum glyph ID + data16 chwTmp; + *pchwMaxGlyphID = grstrm.ReadUShortFromFont(); + + // extra ascent and descent + m_mXAscent = grstrm.ReadShortFromFont(); + m_mXDescent = grstrm.ReadShortFromFont(); + + // TODO: decide whether we want these: + m_mXAscent = 0; + m_mXDescent = 0; + + // number of passes + byte cPasses = grstrm.ReadByteFromFont(); + // index of first substitution pass + byte ipassSub1 = grstrm.ReadByteFromFont(); + // index of first positioning pass + byte ipassPos1 = grstrm.ReadByteFromFont(); + // index of first justification pass + byte ipassJust1 = grstrm.ReadByteFromFont(); + // index of first reordered pass, or 0xFF if no reordering + byte ipassReordered1 = grstrm.ReadByteFromFont(); + if (ipassReordered1 != 0xFF && ipassReordered1 > cPasses) + return false; + if (*pfxdSilfVersion < 0x00020000) + { + Assert(ipassJust1 == cPasses || ipassJust1 == ipassPos1); + ipassJust1 = ipassPos1; + } + + // Sanity checks. + if (cPasses >= kMaxPasses || ipassSub1 > ipassPos1 || ipassPos1 > ipassJust1 || ipassJust1 > cPasses) + return false; // bad table + + // line-break flag + int nLineBreak = grstrm.ReadByteFromFont(); + if (nLineBreak != 0 && nLineBreak != 1) + return false; // bad table + m_fLineBreak = (nLineBreak != 0)? true : false; + + // range of possible cross-line-boundary contextualization + m_cchwPreXlbContext = grstrm.ReadByteFromFont(); + m_cchwPostXlbContext = grstrm.ReadByteFromFont(); + + // actual glyph ID for pseudo-glyph (ID of bogus attribute) + byte bTmp; // unsigned + bTmp = grstrm.ReadByteFromFont(); + m_chwPseudoAttr = bTmp; + // breakweight + bTmp = grstrm.ReadByteFromFont(); + m_chwBWAttr = bTmp; + // directionality + bTmp = grstrm.ReadByteFromFont(); + m_chwDirAttr = bTmp; + + // Sanity checks--don't bother with these, I don't seem to be able to know what are reasonable values. + //if (m_chwPseudoAttr > 200 || m_chwBWAttr > 200 || m_chwDirAttr > 200) + // return false; // bad table + + if (*pfxdSilfVersion >= 0x00020000) + { + // reserved + grstrm.ReadByteFromFont(); + grstrm.ReadByteFromFont(); + + // justification levels + m_cJLevels = grstrm.ReadByteFromFont(); + if (m_cJLevels > kMaxJLevels) + return false; // bad table + m_fBasicJust = (m_cJLevels == 0); + m_chwJStretch0 = 0xffff; // if no justification + m_chwJShrink0 = 0xffff; + m_chwJStep0 = 0xffff; + m_chwJWeight0 = 0xffff; + for (i = 0; i < m_cJLevels; i++) + { + // justification glyph attribute IDs + bTmp = grstrm.ReadByteFromFont(); + if (i == 0) + m_chwJStretch0 = bTmp; + bTmp = grstrm.ReadByteFromFont(); + if (i == 0) + m_chwJShrink0 = bTmp; + bTmp = grstrm.ReadByteFromFont(); + if (i == 0) + m_chwJStep0 = bTmp; + bTmp = grstrm.ReadByteFromFont(); + if (i == 0) + m_chwJWeight0 = bTmp; + bTmp = grstrm.ReadByteFromFont(); // runto + // reserved + grstrm.ReadByteFromFont(); + grstrm.ReadByteFromFont(); + grstrm.ReadByteFromFont(); + } + } + else + { + m_cJLevels = 0; + m_fBasicJust = true; + m_chwJStretch0 = 0xffff; + m_chwJShrink0 = 0xffff; + m_chwJStep0 = 0xffff; + m_chwJWeight0 = 0xffff; + } + + // number of component attributes + chwTmp = grstrm.ReadUShortFromFont(); + m_cComponents = chwTmp; + + // number of user-defined slot attributes + m_cnUserDefn = grstrm.ReadByteFromFont(); + if (m_cnUserDefn > kMaxUserDefinableSlotAttrs) + return false; // bad table + + // max number of ligature components per glyph + m_cnCompPerLig = grstrm.ReadByteFromFont(); + if (m_cnCompPerLig > 16) + return false; // bad table + + // directions supported + bTmp = grstrm.ReadByteFromFont(); + m_grfsdc = bTmp; + if (m_grfsdc > kfsdcHorizLtr + kfsdcHorizRtl + kfsdcVertFromLeft + kfsdcVertFromRight) + return false; // bad table + + // reserved + bTmp = grstrm.ReadByteFromFont(); + bTmp = grstrm.ReadByteFromFont(); + bTmp = grstrm.ReadByteFromFont(); + + // critical features + int cCriticalFeatures; + if (*pfxdSilfVersion >= 0x00020000) + { + // reserved + bTmp = grstrm.ReadByteFromFont(); + + cCriticalFeatures = grstrm.ReadByteFromFont(); + Assert(cCriticalFeatures == 0); + if (cCriticalFeatures != 0) + return false; // bad table + + // reserved + bTmp = grstrm.ReadByteFromFont(); + } + + // rendering behaviors--ignore for now + byte cScripts = grstrm.ReadByteFromFont(); + int nTmp; + //unsigned int nBehaviors[kMaxRenderingBehavior]; -- this big buffer causes a stack overflow in Multiscribe; rework eventually + for (i = 0; i < cScripts; i++) + { + //nBehaviors[i] = unsigned(grstrm.ReadIntFromFont()); + nTmp = unsigned(grstrm.ReadIntFromFont()); + } + + // linebreak glyph ID + m_chwLBGlyphID = grstrm.ReadUShortFromFont(); + + // Jump to the beginning of the pass offset block, if we have this information. + if (*pfxdSilfVersion >= 0x00030000) + grstrm.SetPositionInFont(lPassBlockPos); + else + // Otherwise assume that's where we are! + Assert(lPassBlockPos == -1); + + // offsets to passes, relative to the start of this subtable; + // note that we read (cPasses + 1) of these + int nPassOffsets[kMaxPasses]; + int cbPassLengths[kMaxPasses]; + for (i = 0; i <= cPasses; i++) + { + nPassOffsets[i] = grstrm.ReadIntFromFont(); + if (nPassOffsets[i] > cbSubTableLengths[iSubTable]) + return false; // bad table (note that the "last" bogus pass's offset will = the table length) + if (i > 0) + { + cbPassLengths[i-1] = nPassOffsets[i] - nPassOffsets[i-1]; + if (cbPassLengths[i-1] < 44) + return false; + } + } + + // Jump to the beginning of the pseudo-glyph info block, if we have this information. + if (*pfxdSilfVersion >= 0x00030000) + grstrm.SetPositionInFont(lPseudosPos); + else + // Otherwise assume that's where we are! + Assert(lPseudosPos == -1); + + // number of pseudo-glyphs and search constants + unsigned short snTmp; + snTmp = grstrm.ReadUShortFromFont(); + m_cpsd = snTmp; + snTmp = grstrm.ReadUShortFromFont(); + m_dipsdInit = snTmp; + snTmp = grstrm.ReadUShortFromFont(); + m_cPsdLoop = snTmp; + snTmp = grstrm.ReadUShortFromFont(); + m_ipsdStart = snTmp; + + if (m_dipsdInit > m_cpsd || m_cPsdLoop > m_cpsd || m_ipsdStart > m_cpsd) + return false; + + // unicode-to-pseudo map + m_prgpsd = new GrPseudoMap[m_cpsd]; + for (i = 0; i < m_cpsd; i++) + { + if (*pfxdSilfVersion <= 0x00010000) + { + utf16 chwUnicode = grstrm.ReadUShortFromFont(); + m_prgpsd[i].SetUnicode(chwUnicode); + } + else + { + int nUnicode = grstrm.ReadIntFromFont(); + m_prgpsd[i].SetUnicode(nUnicode); + } + gid16 chwPseudo = grstrm.ReadUShortFromFont(); + m_prgpsd[i].SetPseudoGlyph(chwPseudo); + } + + // class table + m_pctbl = new GrClassTable(); + if (!m_pctbl->ReadFromFont(grstrm, *pfxdSilfVersion)) + return false; + + // passes + return m_ptman->CreateAndReadPasses(grstrm, *pfxdSilfVersion, fxdRuleVersion, + cPasses, lSubTableStart, nPassOffsets, cbPassLengths, + ipassSub1, ipassPos1, ipassJust1, ipassReordered1); +} + +/*---------------------------------------------------------------------------------------------- + Set up the engine with no Graphite smarts at all, just dummy tables. +----------------------------------------------------------------------------------------------*/ +void GrEngine::CreateEmpty() +{ + // Silf table + + m_mXAscent = 0; + m_mXDescent = 0; + + m_fLineBreak = false; + + // range of possible cross-line-boundary contextualization + m_cchwPreXlbContext = 0; + m_cchwPostXlbContext = 0; + + // Bogus attribute IDs: + m_chwPseudoAttr = 1; // actual glyph ID for pseudo-glyph (ID of bogus attribute) + m_chwBWAttr = 2; // breakweight + m_chwDirAttr = 3; // directionality + + m_cComponents = 0; // number of component attributes + + m_cnUserDefn = 0; // number of user-defined slot attributes + m_cnCompPerLig = 0; // max number of ligature components + + m_grfsdc = kfsdcHorizLtr; // supported script direction + + // linebreak glyph ID + m_chwLBGlyphID = 0xFFFE; + + // number of pseudo-glyphs and search constants + m_cpsd = 0; + m_dipsdInit = 0; + m_cPsdLoop = 0; + m_ipsdStart = 0; + + // class table + m_pctbl = new GrClassTable(); + m_pctbl->CreateEmpty(); + + // passes + if (m_ptman != 0) + m_ptman->CreateEmpty(); + + // Gloc and Glat tables + m_pgtbl = new GrGlyphTable(); + m_pgtbl->SetNumberOfGlyphs(0); + m_pgtbl->SetNumberOfComponents(0); + m_pgtbl->SetNumberOfStyles(1); // for now + + m_pgtbl->CreateEmpty(); + + // Feat table + m_cfeat = 0; + m_rglcidFeatLabelLangs = NULL; + m_clcidFeatLabelLangs = 0; + + // Language table + m_langtbl.CreateEmpty(); +} + +/*---------------------------------------------------------------------------------------------- + Create the glyph table and fill it in from the font stream. +----------------------------------------------------------------------------------------------*/ +bool GrEngine::ReadGlocAndGlatTables(GrIStream & grstrmGloc, long lGlocStart, + GrIStream & grstrmGlat, long lGlatStart, + int chwGlyphIDMax, int fxdSilfVersion) +{ + // Determine the highest used glyph ID number. +// int chwGlyphIDMax = m_chwLBGlyphID; +// for (int ipsd = 0; ipsd < m_cpsd; ipsd++) +// { +// if (m_prgpsd[ipsd].PseudoGlyph() > chwGlyphIDMax) +// chwGlyphIDMax = m_prgpsd[ipsd].PseudoGlyph(); +// } + + // Create the glyph table. + m_pgtbl = new GrGlyphTable(); + m_pgtbl->SetNumberOfGlyphs(chwGlyphIDMax + 1); + m_pgtbl->SetNumberOfComponents(m_cComponents); + m_pgtbl->SetNumberOfStyles(1); // for now + + return m_pgtbl->ReadFromFont(grstrmGloc, lGlocStart, grstrmGlat, lGlatStart, + m_chwBWAttr, m_chwJStretch0, m_cJLevels, m_cnCompPerLig, fxdSilfVersion); +} + +/*---------------------------------------------------------------------------------------------- + Read the contents of the "Feat" table from the stream, which is on an extended + TrueType font file. +----------------------------------------------------------------------------------------------*/ +bool GrEngine::ReadFeatTable(GrIStream & grstrm, long lTableStart) +{ + short snTmp; + data16 chwTmp; + int nTmp; + + grstrm.SetPositionInFont(lTableStart); + + // version + int fxdVersion = ReadVersion(grstrm); + if (fxdVersion > kFeatVersion) + return false; + + // number of features + int cfeat; + cfeat = grstrm.ReadUShortFromFont(); + if (cfeat > kMaxFeatures) + return false; // bad table; + + // reserved + chwTmp = grstrm.ReadUShortFromFont(); + nTmp = grstrm.ReadIntFromFont(); + + std::vector vnIDs; // unsigned ints + std::vector vnOffsets; + std::vector vcfset; + + m_cfeat = 0; + int ifeat; + for (ifeat = 0; ifeat < cfeat; ifeat++) + { + // ID + featid nID; + if (fxdVersion >= 0x00020000) + nID = (unsigned int)grstrm.ReadIntFromFont(); + else + nID = grstrm.ReadUShortFromFont(); + vnIDs.push_back(nID); + // number of settings + data16 cfset = grstrm.ReadUShortFromFont(); + vcfset.push_back(cfset); + if (fxdVersion >= 0x00020000) + grstrm.ReadShortFromFont(); // pad bytes + // offset to settings list + nTmp = grstrm.ReadIntFromFont(); + vnOffsets.push_back(nTmp); + // flags + chwTmp = grstrm.ReadUShortFromFont(); + Assert(chwTmp == 0x8000); // mutually exclusive + // index into name table of UI label + int nNameId = grstrm.ReadShortFromFont(); + + if (fxdVersion <= 0x00020000 && nID == GrFeature::knLangFeatV2) + { + // Ignore the obsolete "lang" feature which has ID = 1 + vnIDs.pop_back(); + vcfset.pop_back(); + vnOffsets.pop_back(); + continue; + } + AddFeature(nID, nNameId, cfset); + } + + // default feature setting value and name strings; + for (ifeat = 0; ifeat < m_cfeat; ifeat++) + { + GrFeature * pfeat = m_rgfeat + ifeat; + Assert(pfeat->ID() == vnIDs[ifeat]); + + grstrm.SetPositionInFont(lTableStart + vnOffsets[ifeat]); + + // Each feature has been initialized with blank spots for the number of settings + // it has. + int cfset = vcfset[ifeat]; + Assert(pfeat->NumberOfSettings() == cfset); + for (int ifset = 0; ifset < cfset; ifset++) + { + snTmp = grstrm.ReadShortFromFont(); // yes, signed (TT feat table spec says unsigned) + short snTmp2 = grstrm.ReadShortFromFont(); + pfeat->AddSetting(snTmp, snTmp2); + + if (ifset == 0) + { + // default setting value--first in list + pfeat->SetDefault(snTmp); + } + } + } + + return true; +} + +/*---------------------------------------------------------------------------------------------- + Read the contents of the "Sill" table from the stream, which is on an extended + TrueType font file. +----------------------------------------------------------------------------------------------*/ +bool GrEngine::ReadSillTable(GrIStream & grstrm, long lTableStart) +{ + grstrm.SetPositionInFont(lTableStart); + + // version + int fxdVersion = ReadVersion(grstrm); + if (fxdVersion > kSillVersion) + return false; + + return m_langtbl.ReadFromFont(&grstrm, fxdVersion); +} + +/*---------------------------------------------------------------------------------------------- + An error happened in running the tables. Set up temporary dummy tables, and try running + with dumb rendering. + Return kresUnexpected if even running the empty tables crashed, kresFail otherwise. +----------------------------------------------------------------------------------------------*/ +GrResult GrEngine::RunUsingEmpty(Segment * psegNew, Font * pfont, + GrCharStream * pchstrm, LayoutEnvironment & layout, + int ichStop, + float dxMaxWidth, + bool fNeedFinalBreak, bool fMoreText, bool fInfiniteWidth, + int ichwCallerBtLim, + int nDirDepth, SegEnd estJ) +{ + // Save the current state of the engine. + int mXAscentSave = m_mXAscent; + int mXDescentSave = m_mXDescent; + bool fLineBreakSave = m_fLineBreak; + int cchwPreXlbContextSave = m_cchwPreXlbContext; + int cchwPostXlbContextSave = m_cchwPostXlbContext; + data16 chwPseudoAttrSave = m_chwPseudoAttr; + data16 chwBWAttrSave = m_chwBWAttr; + data16 chwDirAttrSave = m_chwDirAttr; + int cComponentsSave = m_cComponents; + int cnUserDefnSave = m_cnUserDefn; + int cnCompPerLigSave = m_cnCompPerLig; + unsigned int grfsdcSave = m_grfsdc; + gid16 chwLBGlyphIDSave = m_chwLBGlyphID; + int cpsdSave = m_cpsd; + int dipsdInitSave = m_dipsdInit; + int cPsdLoopSave = m_cPsdLoop; + int ipsdStartSave = m_ipsdStart; + GrTableManager * ptmanSave = m_ptman; + GrClassTable * pctblSave = m_pctbl; + GrGlyphTable * pgtblSave = m_pgtbl; + int cfeatSave = m_cfeat; + GrResult resFontReadSave = m_resFontRead; + + GrResult res = kresFail; + + pchstrm->Restart(); + + // Create dummy versions of the tables and run them. + m_pctbl = NULL; + m_pgtbl = NULL; + m_ptman = new GrTableManager(this); + m_ptman->State()->SetFont(pfont); + CreateEmpty(); + + try + { + m_ptman->Run(psegNew, pfont, pchstrm, NULL, kjmodiNormal, layout, + ichStop, dxMaxWidth, 0, + fNeedFinalBreak, fMoreText, false, -1, fInfiniteWidth, false, + ichwCallerBtLim, + nDirDepth, estJ); + } + catch(...) + { + // Still didn't work. Oh, well, not much we can do. + res = kresUnexpected; + } + + psegNew->SetErroneous(true); + + if (m_ptman) + delete m_ptman; + if (m_pctbl) + delete m_pctbl; + if (m_pgtbl) + delete m_pgtbl; + + // Put everything back the way it was. + m_mXAscent = mXAscentSave; + m_mXDescent = mXDescentSave; + m_fLineBreak = fLineBreakSave; + m_cchwPreXlbContext = cchwPreXlbContextSave; + m_cchwPostXlbContext = cchwPostXlbContextSave; + m_chwPseudoAttr = chwPseudoAttrSave; + m_chwBWAttr = chwBWAttrSave; + m_chwDirAttr = chwDirAttrSave; + m_cComponents = cComponentsSave; + m_cnUserDefn = cnUserDefnSave; + m_cnCompPerLig = cnCompPerLigSave; + m_grfsdc = grfsdcSave; + m_chwLBGlyphID = chwLBGlyphIDSave; + m_cpsd = cpsdSave; + m_dipsdInit = dipsdInitSave; + m_cPsdLoop = cPsdLoopSave; + m_ipsdStart = ipsdStartSave; + m_ptman = ptmanSave; + m_pctbl = pctblSave; + m_pgtbl = pgtblSave; + m_cfeat = cfeatSave; + m_resFontRead = resFontReadSave; + + return res; +} + +/*---------------------------------------------------------------------------------------------- + Return the glyph ID for the given Unicode value. +----------------------------------------------------------------------------------------------*/ +gid16 GrEngine::GetGlyphIDFromUnicode(int nUnicode) +{ + gid16 chwGlyphID = MapToPseudo(nUnicode); + if (chwGlyphID != 0) + return chwGlyphID; // return a pseudo-glyph + + // Otherwise, get the glyph ID from the font's cmap. + + if (m_pCmap_3_10) + return gid16(TtfUtil::Cmap310Lookup(m_pCmap_3_10, nUnicode)); + else if (m_pCmap_3_1) + return gid16(TtfUtil::Cmap31Lookup(m_pCmap_3_1, nUnicode)); + else + return 0; +} + +/*---------------------------------------------------------------------------------------------- + Return the pseudo-glyph corresponding to the given Unicode input, or 0 if none. +----------------------------------------------------------------------------------------------*/ +gid16 GrEngine::MapToPseudo(int nUnicode) +{ + if (m_cpsd == 0) + return 0; + +#ifdef _DEBUG + int nPowerOf2 = 1; + while (nPowerOf2 <= m_cpsd) + nPowerOf2 <<= 1; + nPowerOf2 >>= 1; + // Now nPowerOf2 is the max power of 2 <= m_cpds + Assert((1 << m_cPsdLoop) == nPowerOf2); // m_cPsdLoop == log2(nPowerOf2) + Assert(m_dipsdInit == nPowerOf2); + Assert(m_ipsdStart == m_cpsd - m_dipsdInit); +#endif // _DEBUG + + int dipsdCurr = m_dipsdInit; + + GrPseudoMap * ppsdCurr = m_prgpsd + m_ipsdStart; + while (dipsdCurr > 0) + { + int nTest; + if (ppsdCurr < m_prgpsd) + nTest = -1; + else + nTest = ppsdCurr->Unicode() - nUnicode; + + if (nTest == 0) + return ppsdCurr->PseudoGlyph(); + + dipsdCurr >>= 1; // divide by 2 + if (nTest < 0) + ppsdCurr += dipsdCurr; + else // (nTest > 0) + ppsdCurr -= dipsdCurr; + } + + return 0; +} + +/*---------------------------------------------------------------------------------------------- + Return the actual glyph ID to use for glyph metrics and output. For most glyphs, this + is just the glyph ID we're already working with, but for pseudo-glyphs it will something + different. +----------------------------------------------------------------------------------------------*/ +gid16 GrEngine::ActualGlyphForOutput(gid16 chwGlyphID) +{ + gid16 chwActual = gid16(GlyphAttrValue(chwGlyphID, m_chwPseudoAttr)); + if (chwActual == 0) + return chwGlyphID; // not a pseudo, we're already working with the actual glyph ID + else + return chwActual; +} + +/*---------------------------------------------------------------------------------------------- + Look up name based on lang id and name id in name table. + Currently used to look up feature names. +----------------------------------------------------------------------------------------------*/ +std::wstring GrEngine::StringFromNameTable(int nLangID, int nNameID) +{ + std::wstring stuName; + stuName.erase(); + size_t lOffset = 0; + size_t lSize = 0; + + // The Graphite compiler stores our names in either + // the MS (platform id = 3) Unicode (writing system id = 1) table + // or the MS Symbol (writing system id = 0) table. Try MS Unicode first. + // lOffset & lSize are in bytes. + // new interface: + if (!TtfUtil::GetNameInfo(m_pNameTbl, 3, 1, nLangID, nNameID, lOffset, lSize)) + { + if (!TtfUtil::GetNameInfo(m_pNameTbl, 3, 0, nLangID, nNameID, lOffset, lSize)) + { + return stuName; + } + } + + size_t cchw = (unsigned(lSize) / sizeof(utf16)); + utf16 * pchwName = new utf16[cchw+1]; // lSize - byte count for Uni str + const utf16 *pchwSrcName = reinterpret_cast(m_pNameTbl + lOffset); + std::transform(pchwSrcName, pchwSrcName + cchw, pchwName, std::ptr_fun(lsbf)); + pchwName[cchw] = 0; // zero terminate + #ifdef _WIN32 + stuName.assign((const wchar_t*)pchwName, cchw); + #else + wchar_t * pchwName32 = new wchar_t[cchw+1]; // lSize - byte count for Uni str + for (int i = 0; i <= signed(cchw); i++) { + pchwName32[i] = pchwName[i]; + } + stuName.assign(pchwName32, cchw); + delete [] pchwName32; + #endif + + delete [] pchwName; + return stuName; +} + +/*---------------------------------------------------------------------------------------------- + Add a feature (eg, when loading from the font). +----------------------------------------------------------------------------------------------*/ +void GrEngine::AddFeature(featid nID, int nNameId, int cfset, int nDefault) +{ + if (m_cfeat >= kMaxFeatures) + return; + + int ifeat = m_cfeat; + m_rgfeat[ifeat].Initialize(nID, nNameId, cfset, nDefault); +// m_hmnifeat.Insert(nID, ifeat); + m_cfeat++; +} + +/*---------------------------------------------------------------------------------------------- + Return the feature with the given ID, or NULL if none. +----------------------------------------------------------------------------------------------*/ +GrFeature * GrEngine::FeatureWithID(featid nID, int * pifeat) +{ + for (int ifeat = 0; ifeat < m_cfeat; ifeat++) + { + if (m_rgfeat[ifeat].ID() == nID) + { + *pifeat = ifeat; + return m_rgfeat + ifeat; + } + } + *pifeat = -1; + return NULL; + + + // Alternate implementation if we end up with so many features that we need to use + // a hash map: +// int ifeat; +// if (m_hmnifeat.Retrieve(nID, &ifeat)) +// { +// Assert(ifeat < kMaxFeatures); +// return m_rgfeat + ifeat; // may be NULL +// } +// else +// return NULL; +} + +/*---------------------------------------------------------------------------------------------- + Return the default for the feature at the given index in the array. +----------------------------------------------------------------------------------------------*/ +int GrEngine::DefaultForFeatureAt(int ifeat) +{ + Assert(ifeat < kMaxFeatures); + if (ifeat >= m_cfeat || ifeat < 0) + return 0; // undefined feature + + return m_rgfeat[ifeat].DefaultValue(); +} + +/*---------------------------------------------------------------------------------------------- + Set the default for the feature at the given index in the array. +----------------------------------------------------------------------------------------------*/ +void GrEngine::SetDefaultForFeatureAt(int ifeat, int nValue) +{ + Assert(ifeat < kMaxFeatures); + Assert(ifeat < m_cfeat); + if (ifeat >= 0) + m_rgfeat[ifeat].SetDefault(nValue); +} + +/*---------------------------------------------------------------------------------------------- + Return the default feature settings for the given language. +----------------------------------------------------------------------------------------------*/ +void GrEngine::DefaultsForLanguage(isocode lgcode, + std::vector & vnFeats, std::vector & vnValues) +{ + m_langtbl.LanguageFeatureSettings(lgcode, vnFeats, vnValues); +} + +/*---------------------------------------------------------------------------------------------- + Initialize the directionality and breakweight attributes of a new slot based on its + glyph ID. + REVIEW: we could optimize by not initializing from the glyph table right away, + but waiting until we need the value. +----------------------------------------------------------------------------------------------*/ +void GrEngine::InitSlot(GrSlotState * pslot, int nUnicode) +{ + gid16 chwGlyphID = pslot->GlyphID(); + + if (m_ptman->InternalJustificationMode() != kjmodiNormal) + { + if (m_cJLevels > 0) + { + Assert(m_cJLevels == 1); // for now + // TODO: do this at level 0. + pslot->SetJStretch(m_pgtbl->GlyphAttrValue(chwGlyphID, m_chwJStretch0)); + pslot->SetJShrink( m_pgtbl->GlyphAttrValue(chwGlyphID, m_chwJShrink0)); + pslot->SetJStep( m_pgtbl->GlyphAttrValue(chwGlyphID, m_chwJStep0)); + pslot->SetJWeight( m_pgtbl->GlyphAttrValue(chwGlyphID, m_chwJWeight0)); + } + else if (nUnicode == knSpace) + { + // Basic stretch/shrink for whitespace. + // TODO: do this at level 0. + Assert(m_fBasicJust); + int mAdv = pslot->AdvanceX(m_ptman); + pslot->SetJStretch(mAdv * 100); // stretch up to 100 times natural width + pslot->SetJShrink(mAdv / 4); // shrink to 75% + pslot->SetJWeight(1); + } + } + + if (m_pgtbl && !m_pgtbl->IsEmpty()) + { + // Initialize from glyph table. + pslot->SetBreakWeight(m_pgtbl->GlyphAttrValue(chwGlyphID, m_chwBWAttr)); + + DirCode dirc = DirCode(m_pgtbl->GlyphAttrValue(chwGlyphID, m_chwDirAttr)); + if (BidiCode(nUnicode) && (chwGlyphID == 0 || dirc == kdircNeutral)) + // A built-in character for the bidi algorithm that is not defined in the font but + // must be given a special directionality: + goto LDefaults; + + pslot->SetDirectionality(dirc); + + return; + } + +LDefaults: + // Otherwise, in fill defaults for some basic values. + if (pslot->BreakWeight() == GrSlotState::kNotYetSet8) + { + switch (nUnicode) + { + case knSpace: + pslot->SetBreakWeight(klbWordBreak); + break; + case knHyphen: + pslot->SetBreakWeight(klbHyphenBreak); + break; + default: + pslot->SetBreakWeight(klbLetterBreak); + } + } + + if ((int)pslot->Directionality() == GrSlotState::kNotYetSet8) + { + switch (nUnicode) + { + case knSpace: + pslot->SetDirectionality(kdircWhiteSpace); + break; + case knLRM: + pslot->SetDirectionality(kdircL); + break; + case knRLM: + pslot->SetDirectionality(kdircR); + break; + case knLRO: + pslot->SetDirectionality(kdircLRO); + break; + case knRLO: + pslot->SetDirectionality(kdircRLO); + break; + case knLRE: + pslot->SetDirectionality(kdircLRE); + break; + case knRLE: + pslot->SetDirectionality(kdircRLE); + break; + case knPDF: + pslot->SetDirectionality(kdircPDF); + break; + default: + if (chwGlyphID == LBGlyphID()) + pslot->SetDirectionality(kdircNeutral); + else + pslot->SetDirectionality(kdircL); + } + } + else + Assert(false); // currently no way to set directionality ahead of time +} + +/*---------------------------------------------------------------------------------------------- + We have just changed this slot's glyph ID. Change the directionality and breakweight + attributes of a new slot based on its glyph ID. +----------------------------------------------------------------------------------------------*/ +void GrEngine::SetSlotAttrsFromGlyphAttrs(GrSlotState * pslot) +{ + InitSlot(pslot); +} + +/*---------------------------------------------------------------------------------------------- + Create a new segment. +----------------------------------------------------------------------------------------------*/ +void GrEngine::NewSegment(Segment ** ppseg) +{ + *ppseg = new Segment; +} + +/*---------------------------------------------------------------------------------------------- + Methods to pass on to the tables. +----------------------------------------------------------------------------------------------*/ +gid16 GrEngine::GetClassGlyphIDAt(int nClass, int nIndex) +{ + if (nIndex < 0) + return 0; + if (nClass < 0) + return 0; + + try { + return m_pctbl->GetGlyphID(nClass, nIndex); + } + catch (...) + { + return 0; + } +} + +int GrEngine::GetIndexInGlyphClass(int nClass, gid16 chwGlyphID) +{ + try { + return m_pctbl->FindIndex(nClass, chwGlyphID); + } + catch (...) + { + return -1; + } +} + +size_t GrEngine::NumberOfGlyphsInClass(int nClass) +{ + try { + return m_pctbl->NumberOfGlyphsInClass(nClass); + } + catch (...) + { + return 0; + } +} + +int GrEngine::GlyphAttrValue(gid16 chwGlyphID, int nAttrID) +{ + return m_pgtbl->GlyphAttrValue(chwGlyphID, nAttrID); +} + +int GrEngine::ComponentIndexForGlyph(gid16 chwGlyphID, int nCompID) +{ + return m_pgtbl->ComponentIndexForGlyph(chwGlyphID, nCompID); +} + +//:>******************************************************************************************** +//:> New interface +//:>******************************************************************************************** +/*---------------------------------------------------------------------------------------------- + Store the default features values as specified by the client. +----------------------------------------------------------------------------------------------*/ +void GrEngine::AssignDefaultFeatures(int cfeat, FeatureSetting * prgfset) +{ + for (int ifeatIn = 0; ifeatIn < cfeat; ifeatIn++) + { + int ifeat; + FeatureWithID(prgfset[ifeatIn].id, &ifeat); + if (ifeat >= 0 ) + SetDefaultForFeatureAt(ifeat, prgfset[ifeatIn].value); + } +} + +bool GrEngine::LoggingTransduction() +{ + Assert(false); + //return m_pfface->getLogging(); + //return m_fLogXductn; + return true; +} + +} // namespace gr + +//:End Ignore + diff --git a/Build/source/libs/graphite/engine-2.4/src/segment/GrEngine.h b/Build/source/libs/graphite/engine-2.4/src/segment/GrEngine.h new file mode 100644 index 00000000000..70f541cd365 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/src/segment/GrEngine.h @@ -0,0 +1,605 @@ +/*-------------------------------------------------------------------- +Copyright (C) 1999, 2001 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: GrEngine.h +Responsibility: Sharon Correll +Last reviewed: Not yet. + +Description: + Contains the definition of the GrEngine class. +----------------------------------------------------------------------------------------------*/ +#ifdef _MSC_VER +#pragma once +#endif +#ifndef GR_ENGINE_INCLUDED +#define GR_ENGINE_INCLUDED +#include + +#ifdef _MSC_VER +#include +#endif + +namespace gr +{ +class IGrJustifier; +class Segment; + + +/*---------------------------------------------------------------------------------------------- + The GrEngine serves as the top level object that knows how to run Graphite tables + and generate Graphite segments. + + Primarily, this class implements IRenderEngine, which allows it to serve as a FW + rendering engine. It also implements ISimpleInit, a general interface for initializing + using a string. Finally, it implements ITraceControl, a very simple interface which + allows a client to flip a flag indicating whether or not we want to output a log of + the Graphite transduction process. + + Hungarian: greng +----------------------------------------------------------------------------------------------*/ +class GrEngine : public GraphiteProcess +{ + friend class FontFace; + friend class FontMemoryUsage; + +public: + // Constructors & destructors: + GrEngine(); + void BasicInit(); + virtual ~GrEngine(); + void DestroyContents(bool fDestroyCmap = true); + + // ISimpleInit methods: + ////GrResult InitNew(const byte * prgb, int cb); -- obsolete + ////GrResult get_InitializationData(int cchMax, OLECHAR * rgchw, int * pcch); -- obsolete + + // ITraceControl methods: + //GrResult SetTracing(int n); + //GrResult GetTracing(int * pnOptions); + + // IRenderingFeatures methods: + //GrResult GetFeatureIDs(int cMax, int * prgFids, int * pcfid); + //GrResult GetFeatureLabel(int fid, int nLanguage, int cchMax, OLECHAR * rgchw, int * pcch); + //GrResult GetFeatureValues(int fid, int cfvalMax, + // int * prgfval, int * pcfval, int * pfvalDefault); + //GrResult GetFeatureValueLabel(int fid, int fval, int nLanguage, + // int cchMax, OLECHAR * rgchw, int * pcch); + + // IRenderEngine methods: + ////GrResult InitRenderer(IGrGraphics * pgg, OLECHAR * prgchData, int cchData); -- obsolete + ////GrResult FontIsValid(OLECHAR * prgchwErrMsg, int cchMaxErrMsg); + + GrResult get_SegDatMaxLength(int * pcb); + + //GrResult FindBreakPoint(Font * pfont, ITextSource * pgts, DELETE + // int ichMin, int ichLim, int ichLimBacktrack, + // bool fNeedFinalBreak, + // bool fStartLine, + // float dxMaxWidth, + // LineBrk lbPref, LineBrk lbMax, + // TrWsHandling twsh, bool fParaRtoL, + // Segment ** ppsegRet, + // int * pdichwLimSeg, float * pdxWidth, SegEnd * pest, + // int cbPrev, byte * pbPrevSegDat, + // int cbNextMax, byte * pbNextSegDat, int * pcbNextSegDat, + // int * pdichwContext, + // std::ostream * pstrmLog, + // OLECHAR * prgchwErrMsg, int cchMaxErrMsg); + + //GrResult FindBreakPointWJust(Font * pfont, ITextSource * pgts, IGrJustifier * pgjus, + // int ichMin, int ichLim, int ichLimBacktrack, DELETE + // bool fNeedFinalBreak, + // bool fStartLine, + // float dxMaxWidth, + // LineBrk lbPref, LineBrk lbMax, + // TrWsHandling twsh, bool fParaRtoL, + // Segment ** ppsegRet, + // int * pdichwLimSeg, float * pdxWidth, SegEnd * pest, + // int cbPrev, byte * pbPrevSegDat, + // int cbNextMax, byte * pbNextSegDat, int * pcbNextSegDat, + // int * pdichwContext, + // std::ostream * pstrmLog, + // OLECHAR * prgchwErrMsg, int cchMaxErrMsg); + + GrResult get_ScriptDirection(unsigned int * pgrfsdc, OLECHAR * prgchwErrMsg, int cchMaxErrMsg); + + // DELETE + //GrResult MakeJustifiedSegment(Font * pfont, ITextSource * pgts, IGrJustifier * pgj, + // int ichMin, int ichLim, + // bool fStartLine, bool fEndLine, + // float dxUnjustifiedWidth, float dxJustifiedWidth, + // TrWsHandling twsh, SegEnd est, LineBrk lb, + // bool fParaRtl, + // Segment ** ppsegRet, float * pdxWidth, + // //int cbPrev, byte * pbPrevSegDat, int cbNextMax, byte * pbNextSegDat, int * pcbNextSegDat, int * pdichwContext, + // std::ostream * pstrmLog, + // OLECHAR * prgchwErrMsg, int cchwMaxErrMsg); + + // IJustifyingRenderer methods: + // These methods return kresInvalidArg if the attribute ID is invalid or inappropriate; + // kresFail if the engine is not in an appropriate state to return the information. + virtual GrResult getGlyphAttribute(int iGlyph, int jgat, int nLevel, float * pValueRet); + virtual GrResult getGlyphAttribute(int iGlyph, int jgat, int nLevel, int * pValueRet); + virtual GrResult setGlyphAttribute(int iGlyph, int jgat, int nLevel, float value); + virtual GrResult setGlyphAttribute(int iGlyph, int jgat, int nLevel, int value); + + // Interface methods not used by FW: + + ////GrResult IsGraphiteFont(IGrGraphics * pgg); -- obsolete + + ////GrResult FontAscentAndDescent(IGrGraphics * pgg, int * pysAscent, int * pysDescent); -- obsolete + + //GrResult MakeMeasuredSegment( + // Font * pfont, ITextSource * pgts, + // int ichMin, int ichLim, + // bool fParaRtl, + // Segment ** ppsegRet, SegEnd * pest, + // std::ostream * pstrmLog, + // OLECHAR * prgchwErrMsg, int cchMaxErrMsg); + + //GrResult MakeSegmentFromRange(Font * pfont, ITextSource * pgts, IGrJustifier * pgj, + // int ichMin, int ichLim, + // bool fStartLine, bool fEndLine, + // TrWsHandling twsh, bool fParaRtl, + // Segment ** ppsegRet, float * pdxWidth, SegEnd * pest, + // int cbPrev, byte * pbPrevSegDat, int cbNextMax, byte * pbNextSegDat, int * pcbNextSegDat, + // int * pdichwContext, + // std::ostream * pstrmLog, + // OLECHAR * prgchwErrMsg, int cchwMaxErrMsg); + + // NEW interface + + GrResult ReadFontTables(Font * pfont, bool fItalic); + + FontErrorCode IsValidForGraphite(int * pnVersion, int * pnSubVersion); + + // Other public methods + + GrResult FindBreakPointAux(Font * pfont, ITextSource * pgts, IGrJustifier * pgjus, + int ichwMin, int ichwLim, int ichwLimBacktrack, + bool fNeedFinalBreakArg, bool fStartLine, bool fEndLine, + float dxMaxWidth, bool fWidthIsCharCount, + LineBrk lbPref, LineBrk lbMax, TrWsHandling twsh, bool fParaRtl, + Segment ** ppsegRet, + int * pdichwLimSeg, + float * pdxWidth, SegEnd * pest, + int cbPrev, byte * pbPrevSegDat, + int cbNextMax, byte * pbNextSegDat, int * pcbNextSegDat, + int * pdichwContext, + std::ostream * pstrmLog, + OLECHAR * prgchwErrMsg, int cchMaxErrMsg); + + gid16 GetGlyphIDFromUnicode(int nUnicode); + gid16 ActualGlyphForOutput(utf16 chwGlyphID); + + int GetFontEmUnits() + { + return m_mFontEmUnits; + } + + gid16 LBGlyphID() + { + return m_chwLBGlyphID; + } + + gid16 GetClassGlyphIDAt(int nClass, int nIndex); + int GetIndexInGlyphClass(int nClass, gid16 chwGlyphID); + size_t NumberOfGlyphsInClass(int nClass); + int GlyphAttrValue(gid16 chwGlyphID, int nAttrID); + int ComponentIndexForGlyph(gid16 chwGlyphID, int nCompID); + + ////void InitFontName(std::wstring stuInitialize, std::wstring & stuFaceName, std::wstring & stuFeatures); -- obsolete + void RecordFontLoadError(OLECHAR * prgchwErrMsg, int cchMaxErrMsg); + void RecordFontRunError(OLECHAR * prgchwErrMsg, int cchMaxErrMsg, GrResult res); + void ClearFontError(OLECHAR * prgchwErrMsg, int cchMaxErrMsg); + void GetWritingSystemDirection(ITextSource * pgts, int ichwMin); + ////GrResult SetUp(IGrGraphics * pgg, std::wstring stuFeatures); -- obsolete + ////GrResult SetUp(IGrGraphics * pgg, std::wstring stuFeaturesArg, bool fBold, bool fItalic); -- obsolete + + GrResult RunUsingEmpty(Segment * psegNew, Font * pfont, + GrCharStream * pchstrm, LayoutEnvironment & layout, + int ichStop, + float dxMaxWidth, + bool fNeedFinalBreak, bool fMoreText, bool fInfiniteWidth, + int ichwCallerBtLim, + int nDirDepth, SegEnd estJ); + bool InErrorState() + { + return m_fInErrorState; + } + + std::wstring FaceName() + { + return m_stuFaceName; + } + std::wstring BaseFaceName() + { + Assert(m_stuBaseFaceName.size() == 0 || m_fUseSepBase); + return m_stuBaseFaceName; // empty if not using separate base font + } + bool Bold() + { + return m_fBold; + } + bool Italic() + { + return m_fItalic; + } + + void GetStyles(Font * pfont, int ichwMin, bool * pfBold, bool * pfItalic); + void SwitchGraphicsFont(bool fBase); + + void AddFeature(featid nID, int nNameId, int cfset, int nDefault = 0); + GrFeature * FeatureWithID(featid nID, int * pifeat); + int DefaultForFeatureAt(int ifeat); + void SetDefaultForFeatureAt(int ifeat, int nValue); + GrFeature * Feature(int ifeat) + { + if (ifeat >= kMaxFeatures) + return NULL; + return m_rgfeat + ifeat; + } + void DefaultsForLanguage(isocode lgcode, + std::vector & vnFeats, std::vector & vnValues); + std::wstring StringFromNameTable(int nNameId, int nLang); + + void InitSlot(GrSlotState *, int nUnicode = -1); + void SetSlotAttrsFromGlyphAttrs(GrSlotState *); + + bool RightToLeft() + { + return m_fRightToLeft; + } + int TopDirectionLevel() + { + return (m_fRightToLeft) ? 1 : 0; + } + + GrGlyphTable * GlyphTable() + { + return m_pgtbl; + } + + GrClassTable * ClassTable() + { + return m_pctbl; + } + + int NumFeat() + { + return m_cfeat; + } + + bool LineBreakFlag() + { + return m_fLineBreak; + } + + int PreXlbContext() + { + return m_cchwPreXlbContext; + } + + int PostXlbContext() + { + return m_cchwPostXlbContext; + } + + int ExtraAscent() + { + return m_mXAscent; + } + + int ExtraDescent() + { + return m_mXDescent; + } + + float VerticalOffset() + { + return m_dysOffset; + } + + int NumUserDefn() + { + return m_cnUserDefn; + } + + int NumCompPerLig() + { + return m_cnCompPerLig; + } + + bool BasicJustification() + { + return m_fBasicJust; + } + + bool LoggingTransduction(); + //{ + // return m_pfface->getLogging(); + // //return m_fLogXductn; + //} + + bool FakeItalic() + { + return m_fFakeItalic; + } + + void NewSegment(Segment ** ppseg); + + static int ReadVersion(GrIStream & grstrm); + + /*---------------------------------------------------------------------------------------------- + Function to convert between coordinate systems. + This is identical to the built-in MulDiv function except that it rounds with better + precision. + + TODO: move these out of GrEngine to someplace more general. + ----------------------------------------------------------------------------------------------*/ + inline static int GrIntMulDiv(const int v, const int n, const int d) + { + return int(n < 0 ? + (double(v * n)/double(d)) - 0.5 : + (double(v * n)/double(d)) + 0.5); + } + inline static float GrFloatMulDiv(const float v, const float n, const float d) + { + return v * n / d; + } + inline static float GrIFIMulDiv(const int v, const float n, const int d) + { + return float(double(v) * n / double(d)); + } + inline static int GrFIFMulDiv(const float v, const int n, const float d) + { + return int(n < 0 ? + (v * double(n) / double(d)) - 0.5 : + (v * double(n) / double(d)) + 0.5); + } + inline static int RoundFloat(const float n) + { + return int(n < 0 ? n - 0.5 : n + 0.5); + } + +protected: + // Member variables: + + long m_cref; + + //////////// Font information //////////// + + bool m_fBold; + bool m_fItalic; + + // do we have the capacity to perform smart rendering for the various styles? + bool m_fSmartReg; + bool m_fSmartBold; + bool m_fSmartItalic; + bool m_fSmartBI; + // are the italics faked using a slant? + bool m_fFakeItalicCache; + bool m_fFakeBICache; + // control files for styled text; empty means not yet determined + std::wstring m_strCtrlFileReg; // regular + std::wstring m_strCtrlFileBold; // bold + std::wstring m_strCtrlFileItalic; // italic + std::wstring m_strCtrlFileBI; // bold-italic + + bool m_fFakeItalic; // true if we are simulating an italic slant in positioning + + std::wstring m_stuCtrlFile; // control file (.ttf file) from which we got + // currently loaded files + + std::wstring m_stuInitError; // description of any error that happened while initializing + // the engine + std::wstring m_stuErrCtrlFile; // file for which the error occurred + + std::wstring m_stuFaceName; // eg, "Times New Roman" + std::wstring m_stuFeatures; + + bool m_fUseSepBase; + std::wstring m_stuBaseFaceName; // from Sile table; empty if we are not using a separate + // control file + + GrResult m_resFontRead; // kresOk if the Graphite font was loaded successfully; + // kresFail if the font could not be found or basic tables couldn't be read; + // kresFalse if the Silf table is not present; + // kresUnexpected if the Graphite tables could not be loaded + + GrResult m_resFontValid; // kresInvalidArg if the engine is not yet initialized + // Originally: + // kresOk if Graphite font & dc font match cmaps + // kresUnexpected/kresFalse if dumb rendering + // kresFail if dumb rendering with no cmap + // But now it is apparently just = to m_resFontRead otherwise. + FontErrorCode m_ferr; + int m_fxdBadVersion; + + int m_nFontCheckSum; // when loading a font using the GrGraphics, remember the + // check sum as a unique identifer + + int m_nScriptTag; // from the pertinent writing system; currently not used + unsigned int m_grfsdc; // supported script directions + + bool m_fRightToLeft; // overall writing-system direction + + int m_mXAscent; // extra ascent, in font's em-units + int m_mXDescent; // extra descent, in font's em_units + + float m_dysOffset; // vertical offset, in logical units (eg, for super/subscript) + + bool m_fBasicJust; // true if there are no complex justification tables/rules in the + // font, so we use basic whitespace justification + int m_cJLevels; // number of justification levels + + GrTableManager * m_ptman; + GrClassTable * m_pctbl; + GrGlyphTable * m_pgtbl; + + FontFace * m_pfface; + + GrFeature m_rgfeat[kMaxFeatures]; +// HashMap m_hmnifeat; // maps from feature IDs to indices in the array +// // Review: do we need this, or is a linear search adequate? + int m_cfeat; // number of features present + + short * m_rglcidFeatLabelLangs; // LCIDs (language IDs) for all the labels in the feature table + size_t m_clcidFeatLabelLangs; + + GrLangTable m_langtbl; + + // are line-breaks relevant at all? + bool m_fLineBreak; + // ranges for possible cross-line-boundary contextualization + int m_cchwPreXlbContext; + int m_cchwPostXlbContext; + + // magic glyph attribute numbers + data16 m_chwPseudoAttr; // actual-for-pseudo fake glyph attribute + data16 m_chwBWAttr; // break-weight + data16 m_chwDirAttr; // directionality + data16 m_chwJStretch0; // justify.0.stretch + data16 m_chwJShrink0; // justify.0.shrink + data16 m_chwJStep0; // justify.0.step + data16 m_chwJWeight0; // justify.0.weight + + gid16 m_chwLBGlyphID; // magic line-break glyph ID + + int m_cComponents; // number of glyph attributes at the beginning of the glyph table + // that actually represent ligature components + + int m_cnUserDefn; // number of user-defined slot attributes + int m_cnCompPerLig; // max number of components needed per ligature + + int m_mFontEmUnits; // number of design units in the Em square for the font + + // for pseudo-glyph mappings + int m_cpsd; // number of psuedo-glyphs + GrPseudoMap * m_prgpsd; + int m_dipsdInit; // (max power of 2 <= m_cpsd); + // size of initial range to consider + int m_cPsdLoop; // log2(max power of 2 <= m_cpsd); + // indicates how many iterations are necessary + int m_ipsdStart; // m_cpsd - m_dipsdInit; + // where to start search + + // for Unicode to glyph ID mapping + ////TableBuffer m_tbufCmap; // hold the full cmap table + void * m_pCmap_3_1; // point to the MS Unicode cmap subtable + // uses platform 3 writing system 1 or 0, preferably 1 + // use for Unicode to Glyph ID conversion + void * m_pCmap_3_10; + byte * m_pCmapTbl; + bool m_fCmapTblCopy; + int m_cbCmapTbl; // needed only for memory instrumentation + + // for feature names and maybe other strings from font later + ////TableBuffer m_tbufNameTbl; // hold full name table; use Name() method to access + byte * m_pNameTbl; + bool m_fNameTblCopy; + int m_cbNameTbl; // needed only for memory instrumentation and sanity checks + + bool m_fLogXductn; // true if we want to log the transduction process + + bool m_fInErrorState; // true if we are handling a rendering error + + // Other protected methods: + + enum { + ksegmodeBreak = 0, // FindBreakPoint + ksegmodeJust, // MakeJustifiedSegment + //ksegmodeMms, // MakeMeasuredSegment + ksegmodeRange // MakeSegmentFromRange + }; + + void MakeSegment( + // Common parameters + Segment * psegRet, + Font * pfont, ITextSource * pgts, IGrJustifier * pjus, + LayoutEnvironment & layout, + int ichMin, int ichLim, + // for finding a line break + float dxMaxWidth, + bool fBacktracking, + // for making a justified segment + bool fJust, float dxJustifiedWidthJ, SegEnd estJ); + + int FindFontLim(ITextSource * pgts, int ichFontMin, int * pnDirDepth); + +#ifdef GR_FW + ////GrResult InitFromControlFile(IGrGraphics * pgg, std::wstring stuFaceName, + //// bool fBold, bool fItalic); -- obsolete + ////GrResult ReadFromControlFile(std::wstring stuFontFile); -- obsolete +// GrResult GetFallBackFont(std::wstring * pstu); +#endif + + ////GrResult ReadFromGraphicsFont(IGrGraphics * pgg, bool fItalic); -- obsolete + void DestroyEverything(); + + bool CheckTableVersions(GrIStream * pgrstrm, + const byte *silf_tbl, int lSilfStart, + const byte *gloc_tbl, int lGlocStart, + const byte *feat_tbl, int lFeatStart, + int * pfxdBadVersion); + //bool ReadSileTable(GrIStream & grstrm, long lTableSTart, + // int * pmFontEmUnits, bool * pfMismatchedBase); + bool ReadSilfTable(GrIStream & grstrm, long lTableStart, int iSubTable, + long cbTableLen, int * pchwMaxGlyphID, int * pfxdVersion); + bool ReadGlocAndGlatTables(GrIStream & grstrm, long lGlocStart, GrIStream & glat_strm, long lGlatStart, + int chwMaxGlyphID, int fxdSilfVersion); + bool ReadFeatTable(GrIStream & grstrm, long lTableStart); + bool ReadSillTable(GrIStream & grstrm, long lTableStart); + bool SetCmapAndNameTables(Font * pfont); + + void CreateEmpty(); + + bool BadFont(FontErrorCode * pferr = NULL) + { + if (pferr) + *pferr = m_ferr; + return (m_resFontValid == kresFail || m_resFontRead == kresFail); + } + bool DumbFallback(FontErrorCode * pferr = NULL) + { + if (pferr) + *pferr = m_ferr; + return (m_resFontValid != kresOk || m_resFontRead != kresOk); + } + + gid16 MapToPseudo(int nUnicode); + + // NEW interface + void AssignDefaultFeatures(int cfeat, FeatureSetting * prgfset); + + // Feature access for FontFace: + size_t NumberOfFeatures_ff(); + featid FeatureID_ff(size_t ifeat); + size_t FeatureWithID_ff(featid id); + bool GetFeatureLabel_ff(size_t ifeat, lgid language, utf16 * label); + int GetFeatureDefault_ff(size_t ifeat); + size_t NumberOfSettings_ff(size_t ifeat); + int GetFeatureSettingValue_ff(size_t ifeat, size_t ifset); + bool GetFeatureSettingLabel_ff(size_t ifeat, size_t ifset, lgid language, utf16 * label); + // Feature-label languages: + size_t NumberOfFeatLangs_ff(); + short GetFeatLabelLang_ff(size_t ilang); + // Language access for FontFace: + size_t NumberOfLanguages_ff(); + isocode GetLanguageCode_ff(size_t ilang); + + void SetUpFeatLangList(); + +}; + +} // namespace gr + +#if defined(GR_NO_NAMESPACE) +using namespace gr; +#endif + + +#endif // !GR_ENGINE_INCLUDED diff --git a/Build/source/libs/graphite/engine-2.4/src/segment/GrFSM.cpp b/Build/source/libs/graphite/engine-2.4/src/segment/GrFSM.cpp new file mode 100644 index 00000000000..92424f1feb7 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/src/segment/GrFSM.cpp @@ -0,0 +1,545 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 1999, 2001 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: GrFSM.cpp +Responsibility: Sharon Correll +Last reviewed: Not yet. + +Description: + Implements the finite state machine. +----------------------------------------------------------------------------------------------*/ + +//:>******************************************************************************************** +//:> Include files +//:>******************************************************************************************** +#include "Main.h" +#include +#ifdef _MSC_VER +#pragma hdrstop +#endif +// any other headers (not precompiled) + +//:End Ignore + +//:>******************************************************************************************** +//:> Forward declarations +//:>******************************************************************************************** + +//:>******************************************************************************************** +//:> Local Constants and static variables +//:>******************************************************************************************** + +namespace gr +{ + +//:>******************************************************************************************** +//:> Methods +//:>******************************************************************************************** + +/*---------------------------------------------------------------------------------------------- + Fill in the FSM by reading from the font stream. + Assumes the stream is in the correct position. +----------------------------------------------------------------------------------------------*/ +bool GrFSM::ReadFromFont(GrIStream & grstrm, int /*fxdVersion*/, int crul, int cbSpace) +{ + short snTmp; + + // number of FSM states + snTmp = grstrm.ReadShortFromFont(); + m_crow = snTmp; + // number of transitional states + snTmp = grstrm.ReadShortFromFont(); + int crowTransitional = snTmp; + // number of success states + snTmp = grstrm.ReadShortFromFont(); + int crowSuccess = snTmp; + m_crowFinal = m_crow - crowTransitional; + m_crowNonAcpt = m_crow - crowSuccess; + m_rowFinalMin = crowTransitional; + // number of columns + snTmp = grstrm.ReadShortFromFont(); + m_ccol = snTmp; + + // Sanity checks. + // TODO: add a sanity check for m_ccol. + if (m_crowFinal < 0 || m_crowNonAcpt < 0) + return false; + + // number of FSM glyph ranges and search constants + snTmp = grstrm.ReadShortFromFont(); + m_cmcr = snTmp; + if (m_cmcr < 0 || m_cmcr > cbSpace) + return false; + snTmp = grstrm.ReadShortFromFont(); + m_dimcrInit = snTmp; + if (m_dimcrInit > m_cmcr) + return false; + snTmp = grstrm.ReadShortFromFont(); + m_cLoop = snTmp; + if (m_cLoop > m_dimcrInit) + return false; + snTmp = grstrm.ReadShortFromFont(); + m_imcrStart = snTmp; + if (m_imcrStart != m_cmcr - m_dimcrInit) + return false; + + m_prgmcr = new GrFSMClassRange[m_cmcr]; + for (int imcr = 0; imcr < m_cmcr; imcr++) + { + m_prgmcr[imcr].m_chwFirst = grstrm.ReadUShortFromFont(); + m_prgmcr[imcr].m_chwLast = grstrm.ReadUShortFromFont(); + m_prgmcr[imcr].m_col = grstrm.ReadUShortFromFont(); + } + + // rule map and offsets (extra item at end gives final offset, ie, total) + m_prgirulnMin = new data16[crowSuccess + 1]; + data16 * pchw = m_prgirulnMin; + int i; + for (i = 0; i <= crowSuccess; i++, pchw++) + { + *pchw = grstrm.ReadUShortFromFont(); + if (i == 0 && *pchw != 0) + return false; + if (i > 0 && *pchw <= *(pchw - 1)) + return false; + } + + // Last offset functions as the total length of the rule list. + // Note that the number of rules in the map is not necessarily equal to the number of + // rules in the pass; some rules may be listed multiple times, if they are matched by more + // than one state. + int crulInMap = m_prgirulnMin[crowSuccess]; + m_prgrulnMatched = new data16[crulInMap]; + m_crulnMatched = crulInMap; + pchw = m_prgrulnMatched; + for (i = 0; i < crulInMap; i++, pchw++) + { + *pchw = grstrm.ReadUShortFromFont(); + if (*pchw > crul) + return false; // bad font + } + + // min rule pre-context number of items + byte bTmp = grstrm.ReadByteFromFont(); + m_critMinRulePreContext = bTmp; + if (m_critMinRulePreContext < 0) + return false; + // max rule pre-context number of items + bTmp = grstrm.ReadByteFromFont(); + m_critMaxRulePreContext = bTmp; + if (m_critMaxRulePreContext < m_critMinRulePreContext) + return false; + + if (m_critMinRulePreContext > kMaxSlotsPerRule || m_critMaxRulePreContext > kMaxSlotsPerRule) + return false; // bad table + + int cStartStates = m_critMaxRulePreContext - m_critMinRulePreContext + 1; + + // start states + m_prgrowStartStates = new short[cStartStates]; + short * psn = m_prgrowStartStates; + for (int ic = 0; ic < cStartStates; ic++, psn++) + { + *psn = grstrm.ReadShortFromFont(); + if (*psn >= m_crow) + return false; // bad table + } + + return true; +} + +/*---------------------------------------------------------------------------------------------- + Fill in the FSM's state table by reading from the font stream. + Assumes the stream is in the correct position. +----------------------------------------------------------------------------------------------*/ +bool GrFSM::ReadStateTableFromFont(GrIStream & grstrm, int /*fxdVersion*/, int /*cbSpace*/) +{ + int cCells = ((m_crow - m_crowFinal) * m_ccol); + m_prgrowTransitions = new short[cCells]; + short * psn = m_prgrowTransitions; + for (int iCell = 0; iCell < cCells; iCell++, psn++) + { + *psn = grstrm.ReadShortFromFont(); + if (*psn < 0 || *psn >= m_crow) + return false; + } + + return true; +} + +/*---------------------------------------------------------------------------------------------- + Use the transition table to find a rule or rules that match; then run the contraint + code to see if the rule is active. Return the rule number of the rule to be applied. + + @param ppass - pass, which knows how to run constraint code + @param psstrmIn - input stream + @param psstrmOut - output stream (from which to get recently output slots) +----------------------------------------------------------------------------------------------*/ +int GrFSM::GetRuleToApply(GrTableManager * ptman, GrPass * ppass, + GrSlotStream * psstrmIn, GrSlotStream * psstrmOut) +{ + // List of accepting states and corresponding count of slots that were + // matched by each. + int prgrowAccepting[kMaxSlotsPerRule]; + int prgcslotMatched[kMaxSlotsPerRule]; + + // Run the transition table until it jams. + int crowAccepting = RunTransitionTable(ppass, psstrmIn, psstrmOut, + prgrowAccepting, prgcslotMatched); + + // Nothing matched; fail quickly. + if (crowAccepting == 0) + return -1; + + int * prow = prgrowAccepting + crowAccepting - 1; + int * pcslot = prgcslotMatched + crowAccepting - 1; // # of slots matched AFTER the curr pos + + // Quick test for common case of exactly one rule matched. + if (crowAccepting == 1 && + (m_prgirulnMin[*prow - m_crowNonAcpt + 1] - m_prgirulnMin[*prow - m_crowNonAcpt]) == 1) + { + int iruln = m_prgirulnMin[*prow - m_crowNonAcpt]; + int ruln = m_prgrulnMatched[iruln]; + if (RunConstraintAndRecordLog(ptman, ppass, ruln, psstrmIn, psstrmOut, + ppass->PreModContextForRule(ruln), *pcslot)) + { + return ruln; + } + else + return -1; + } + + // Several rules were matched. We need to sort them and then run the constraints + // for each rule, accepting the first one whose constraints succeed. + + // Count up the number of rules that matched and allocate a buffer of the right size. + int crulMatched = 0; + while (prow >= prgrowAccepting) + { + crulMatched += + m_prgirulnMin[*prow - m_crowNonAcpt + 1] - m_prgirulnMin[*prow - m_crowNonAcpt]; + --prow; + } + MatchedRule * prgmr = new MatchedRule[crulMatched]; + + prow = prgrowAccepting + crowAccepting - 1; + + // Do a dumb insertion sort, ordering primarily by sort key (largest first) + // and secondarily by the order in the original file (rule number). + // Review: is this kind of sort fast enough? We are assuming that we usually only + // have a handful of matched rules. + int cmr = 0; + while (prow >= prgrowAccepting) + { + int iruln = m_prgirulnMin[*prow - m_crowNonAcpt]; + // Get all the rules matches by a single state. + while (iruln < m_prgirulnMin[*prow - m_crowNonAcpt + 1]) + { + int ruln = m_prgrulnMatched[iruln]; + int nSortKey = ppass->SortKeyForRule(ruln); + int cslot = *pcslot; + int imr; + for (imr = 0; imr < cmr; imr++) + { + if (nSortKey > prgmr[imr].nSortKey || + (nSortKey == prgmr[imr].nSortKey && ruln < prgmr[imr].ruln)) + { + // Insert here. + memmove(prgmr+imr+1, prgmr+imr, (sizeof(MatchedRule) * (cmr - imr))); + prgmr[imr].ruln = ruln; + prgmr[imr].nSortKey = nSortKey; + prgmr[imr].cslot = cslot; + break; + } + } + if (imr >= cmr) + { + prgmr[cmr].ruln = ruln; + prgmr[cmr].nSortKey = nSortKey; + prgmr[cmr].cslot = cslot; + } + cmr++; + + iruln++; + } + --prow; + --pcslot; + } + + + for (int imr = 0; imr < cmr; imr++) + { + int ruln = prgmr[imr].ruln; + if (RunConstraintAndRecordLog(ptman, ppass, ruln, psstrmIn, psstrmOut, + ppass->PreModContextForRule(ruln), prgmr[imr].cslot)) + { + // Success! + delete[] prgmr; + return ruln; + } + } + + // No rule matched or the constraints failed. + delete[] prgmr; + return -1; +} + +/*---------------------------------------------------------------------------------------------- + Run the transition table, generating a list of rows corresponding to accepting states. + + @param psstrmIn - input stream + @param prgrowAccepting - array to fill in with accepting rows + @param prgcslotMatched - corresponding array with number of slots matched +----------------------------------------------------------------------------------------------*/ +int GrFSM::RunTransitionTable(GrPass * ppass, GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, + int * prgrowAccepting, int * prgcslotMatched) +{ + int ipass = ppass->PassNumber(); + + // Remember we're reading the pre-context items from the output stream, not the input. + int cslotPreContextAvail = psstrmOut->WritePos(); + + if (cslotPreContextAvail < m_critMinRulePreContext) + return 0; // not enough input to match any rule + + // Look backwards by the number of pre-context items for this pass, but not earlier + // than the beginning of the stream. + int cslot = -1 * min(cslotPreContextAvail, m_critMaxRulePreContext); + + // Normally the start state is state 0. But if we are near the beginning of the stream, + // we may need to adjust due to the fact that we don't have enough input yet to + // match the pre-context items in all the rules. So in effect we skip some states + // corresponding to the earlier items that aren't present. + int row = m_prgrowStartStates[max(0, m_critMaxRulePreContext - cslotPreContextAvail)]; + + int * prowTop = prgrowAccepting; + int * pcslotTop = prgcslotMatched; + while (true) + { + if (row >= m_rowFinalMin) + // final state--jammed + return (prowTop - prgrowAccepting); + + if (psstrmIn->SlotsPendingInContext() <= cslot) + // no more input + return (prowTop - prgrowAccepting); + + // Figure out what column the input glyph belong in. + // Since this is a time-critical routine, we cache the results for the current pass. + GrSlotState * pslot = (cslot < 0) ? + psstrmOut->PeekBack(cslot) : + psstrmIn->Peek(cslot); + int col; + if (pslot->PassNumberForColumn() == ipass) + { + col = pslot->FsmColumn(); + } + else + { + gid16 chwGlyphID = (cslot < 0) ? + psstrmOut->PeekBack(cslot)->GlyphID() : + psstrmIn->Peek(cslot)->GlyphID(); + col = FindColumn(chwGlyphID); + pslot->CacheFsmColumn(ipass, col); + } + int rowNext; + if (col < 0) + rowNext = 0; + else + rowNext = m_prgrowTransitions[(row * m_ccol) + col]; + + if (rowNext == 0) // jammed + return (prowTop - prgrowAccepting); + + cslot++; + if (rowNext >= m_crowNonAcpt) // or (rowNext < 0) + { + // Accepting state--push it on the stack. + //rowNext *= -1; + gAssert((prowTop - prgrowAccepting) < kMaxSlotsPerRule); + *prowTop++ = rowNext; + *pcslotTop++ = cslot; + } + row = rowNext; + + gAssert((prowTop - prgrowAccepting) == (pcslotTop - prgcslotMatched)); + } +} + +/*---------------------------------------------------------------------------------------------- + Run the transition table, generating a list of rows corresponding to accepting states. + Optimized to avoid matrix arithmetic for non-accepting states. + + Review: do we need to use this version? + + @param psstrmIn - input stream + @param prgrowAccepting - array to fill in with accepting rows + @param prgcslotMatched - corresponding array with number of slots matched +----------------------------------------------------------------------------------------------*/ +#if 0 + +int GrFSM::RunTransitionTableOptimized(GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, + int * prgrowAccepting, int * prgcslotMatched) +{ + int cslot = 0; + int ichwRowOffset = 0; + int ichwRowOffsetLim = m_crowFinal * m_ccol; // number of cells + int * prowTop = prgrowAccepting; + int * pcslotTop = prgcslotMatched; + while (true) + { + if (ichwRowOffset >= ichwRowOffsetLim) + // final state--jammed + return (prowTop - prgrowAccepting); + + if (psstrmIn->SlotsPendingInContext() < cslot) + // no more input + return (prowTop - prgrowAccepting); + + gid16 chwGlyphID = psstrmIn->Peek(cslot)->GlyphID(); + int col = FindColumn(chwGlyphID); + short cellValue = *(m_prgprgrowXitions + ichwRowOffset + col); + + if (cellValue == 0) // jammed + return (prowTop - prgrowAccepting); + + cslot++; + if (cellValue < 0) + { + // Accepting state--push it on the stack. + int rowNext = cellValue * -1; + gAssert((prowTop - prgrowAccepting) < kMaxSlotsPerRule); + *prowTop++ = rowNext; + *pcslotTop++ = cslot; + ichwRowOffset = rowNext * m_ccol; + } + else + ichwRowOffset = cellValue; + + gAssert((prowTop - prgrowAccepting) == (pcslotTop - prgcslotMatched)); + } +} + +#endif // 0 + + +/*---------------------------------------------------------------------------------------------- + Run all the constraints for the rules matched by the state that we have reached. + The rules are ordered as they were in the GDL file. When we hit a constraint that + matches, return the corresponding rule number. Return -1 if no rule passed. + + @param ppass - pass, which knows how to actually run the constraints + @param psstrmIn - input stream + @param cslotMatched - number of slots matched; constraints must be run for each of these +----------------------------------------------------------------------------------------------*/ +//:Ignore +int GrFSM::RunConstraints_Obsolete(GrTableManager * ptman, GrPass * ppass, int row, + GrSlotStream * psstrmIn, int cslotMatched) +{ + int iruln = m_prgirulnMin[row - m_crowNonAcpt]; + while (iruln < m_prgirulnMin[row - m_crowNonAcpt + 1]) + { + int ruln = m_prgrulnMatched[iruln]; + bool fSuccess = ppass->RunConstraint(ptman, ruln, psstrmIn, NULL, 0, cslotMatched); + if (fSuccess) + { + if (ptman->LoggingTransduction()) + ppass->RecordRuleFired(psstrmIn->ReadPosForNextGet(), ruln); + return ruln; + } + else + { + if (ptman->LoggingTransduction()) + ppass->RecordRuleFailed(psstrmIn->ReadPosForNextGet(), ruln); + } + + iruln++; + } + return -1; // no rule succeeded +} +//:End Ignore + +/*---------------------------------------------------------------------------------------------- + Run the constraints for the given rule, and record whether it failed or succeeded in the + transduction log. + + @param ppass - pass, which knows how to actually run the constraints + @param psstrmIn - input stream + @param cslotPreModContext - number of slots before the current position that must be tested + @param islotLimMatched - number of slots matched AFTER the current position + + @return True if the constraints succeeded. +----------------------------------------------------------------------------------------------*/ +bool GrFSM::RunConstraintAndRecordLog(GrTableManager * ptman, GrPass * ppass, int ruln, + GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, + int cslotPreModContext, int islotLimMatched) +{ + bool fSuccess = ppass->RunConstraint(ptman, ruln, psstrmIn, psstrmOut, + cslotPreModContext, islotLimMatched); + + if (ptman->LoggingTransduction()) + { + if (fSuccess) + ppass->RecordRuleFired(psstrmIn->ReadPosForNextGet(), ruln); + else + ppass->RecordRuleFailed(psstrmIn->ReadPosForNextGet(), ruln); + } + + return fSuccess; +} + +/*---------------------------------------------------------------------------------------------- + Search for the class range containing the glyph ID, and return the matching FSM column. + Does a fast binary search that uses only shifts, no division. +----------------------------------------------------------------------------------------------*/ +int GrFSM::FindColumn(gid16 chwGlyphID) +{ + #ifdef _DEBUG + // Check that the pre-calculated constants are correct. + int nPowerOf2 = 1; + while (nPowerOf2 <= m_cmcr) + nPowerOf2 <<= 1; + nPowerOf2 >>= 1; + // Now nPowerOf2 is the max power of 2 <= m_cclsrg. + // m_cLoop is not needed for our purposes, but it is included because it is part of + // the TrueType standard. + gAssert(1 << m_cLoop == nPowerOf2); // m_cloop == log2(nPowerOf2) + gAssert(m_dimcrInit == nPowerOf2); + gAssert(m_imcrStart == m_cmcr - m_dimcrInit); + #endif + + int dimcrCurr = m_dimcrInit; + + GrFSMClassRange * pmcrCurr = m_prgmcr + m_imcrStart; + while (dimcrCurr > 0) + { + int nTest; + if (pmcrCurr < m_prgmcr) + nTest = -1; + else + { + nTest = pmcrCurr->m_chwFirst - chwGlyphID; + if (nTest < 0 && chwGlyphID <= pmcrCurr->m_chwLast) + //nTest = 0; + // This is a tiny bit more efficient: + return pmcrCurr->m_col; + } + + if (nTest == 0) + // found it + return pmcrCurr->m_col; + + dimcrCurr >>= 1; // divide by 2 + if (nTest < 0) + pmcrCurr += dimcrCurr; + else // (nTest > 0) + pmcrCurr -= dimcrCurr; + } + + return -1; +} + +} // namespace gr diff --git a/Build/source/libs/graphite/engine-2.4/src/segment/GrFSM.h b/Build/source/libs/graphite/engine-2.4/src/segment/GrFSM.h new file mode 100644 index 00000000000..087fead9428 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/src/segment/GrFSM.h @@ -0,0 +1,229 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 1999, 2001 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: GrFSM.h +Responsibility: Sharon Correll +Last reviewed: Not yet. + +Description: + The GrFSM class, which is the mechanism that examines input in a glyph stream and + determines which rule matches and should be run. +----------------------------------------------------------------------------------------------*/ +#ifdef _MSC_VER +#pragma once +#endif +#ifndef FSM_INCLUDED +#define FSM_INCLUDED + +//:End Ignore + +namespace gr +{ + +class GrPass; + +/*---------------------------------------------------------------------------------------------- + A machine class range consists of a range of contiguous glyph IDs that map to + a single column in the FSM (a machine class). (Note that there might be more than one + range mapping to a given column.) + + Keep in mind that these "classes" are completely different from the classes that + are used for substitution. These are used only for matching by the FSM. + + Hungarian: mcr +----------------------------------------------------------------------------------------------*/ +class GrFSMClassRange +{ + friend class GrFSM; + +protected: + gid16 m_chwFirst; // first glyph ID in range + gid16 m_chwLast; // last glyph ID in range + data16 m_col; // column (machine class) to which this range maps +}; + +/*---------------------------------------------------------------------------------------------- + The finite state machine that is used to match sequences of glyphs and + determine which rule to apply. There is one FSM per pass. + + The states in the FSM are grouped and ordered in the following way: + - non-accepting states (no rule completely matched) + - accepting non-final states (a rule matched, but a longer rule is possible) + - final states (a rule matched and no longer rule is possible) + In other words, we have: + - transition, non-accepting + - transition, accepting + - non-transition, accepting + The transition states have information about the next state to transition to; + the accepting states have information about the rule(s) that matched. + + There are three main data structures that are part of the finite state machine: + + (1) the transition matrix: m_prgprgrowXitions. It contains a row for each transition + state (non-accepting states plus accepting non-final states), and a column for each + machine class. The cell values indicate the next state to transition to for the + matched input. A positive number indicates that the next state is a non-accepting state; + a negative value indicates an accepting state. Zero means there is no next state; + no more matches are possible; machine has "jammed." + + (2) the matched-rule list: m_prgrulnMatched. This is a list of rule numbers, + which are indices into the pass's action- and constraint-code arrays. + It contains the numbers of the rules matched by the first accepting state, + followed by those matched by the second accepting state, etc. For each state, + the rules must be ordered using the same order of the rules in the RDL file. + + (3) the matched-rule-offsets list: m_prgirulnMin. This gives the starting index into + the matched-rule list for each accepting state. (Non-accepting states are not included, + so the first item is for state m_crowNonAcpt.) + + In addition, the FSM interacts with the action- and constraint-code lists in the pass + itself. These lists are indexed by rule number (the values of m_prgrulnMatched). + When some input matches the rule, the constraint-code is run; if it succeeds, + the rule number is returned to the caller and that rule is applied (ie, the action-code + is run). + + Hungarian: fsm + + Other hungarian: + row - row (state) + col - column (machine class) + ruln - rule number + + REVIEW: This is quite a time-critical class, and there are two potential optimizations + that have been proposed for the value of a cell: + + (1) use a negative cell number to indicate an accepting state and a positive number + to indicate a non-accepting state. So this gives a comparison with zero rather than + some arbitrary number + + (2) have the positive numbers--the most common case--be the actual byte offset into the + table rather than the row number. This saves matrix multiplication at each step, + ie, "m_prgsnTransitions[(row * m_ccol) + col]". + + The two versions are implemented in RunTransitionTable and RunTransitionTableOptimized. + Do these seem to be worth the inconvenience of added complexity in understanding + and debugging? +----------------------------------------------------------------------------------------------*/ +class GrFSM +{ + friend class FontMemoryUsage; + +public: + GrFSM() : + m_prgirulnMin(NULL), + m_prgrulnMatched(NULL), + m_prgrowTransitions(NULL), + m_prgibStateDebug(NULL), + m_prgmcr(NULL), + m_prgrowStartStates(NULL) + { + } + + ~GrFSM() + { + delete[] m_prgirulnMin; + delete[] m_prgrulnMatched; + + delete[] m_prgrowTransitions; + + delete[] m_prgibStateDebug; + + delete[] m_prgmcr; + + delete[] m_prgrowStartStates; + } + + bool ReadFromFont(GrIStream & grstrm, int fxdVersion, int crul, int cbSpace); + bool ReadStateTableFromFont(GrIStream & grstrm, int fxdVersion, int cbSpace); + + int GetRuleToApply(GrTableManager *, GrPass * ppass, + GrSlotStream * psstrmIn, GrSlotStream * psstrmOut); + + int RunTransitionTable(GrPass * ppass, GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, + int * prgrowAccepting, int * prgcslotMatched); + int RunTransitionTableOptimized(GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, + int * prgrowAccepting, int * prgcslotMatched); + bool RunConstraintAndRecordLog(GrTableManager *, GrPass * ppass, int ruln, + GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, + int cslotPreModContext, int cslotMatched); + + int RunConstraints_Obsolete(GrTableManager *, GrPass * ppass, int row, GrSlotStream * psstrmIn, + int cslotMatched); + + // For sorting matched rules + struct MatchedRule // mr + { + int ruln; + int nSortKey; + int cslot; // number of slots matched AFTER the current stream position + }; + + int MaxRulePreContext() + { + return m_critMaxRulePreContext; + } + +protected: + int FindColumn(gid16 chwGlyphID); +protected: + // Instance variables: + int m_crow; // number of rows (states) + int m_crowFinal; // number of final states; no transitions for these + int m_rowFinalMin; // index of first final row + int m_crowNonAcpt; // number of non-accepting states; no rule indices for these + + int m_ccol; // number of columns (machine classes) + + data16 * m_prgirulnMin; // m_crow-m_crowNonAcpt+1 of these; + // index within m_prgrulnMatched, start of matched + // rules for each accepting state + + data16 * m_prgrulnMatched; // long ordered list of rule indices matched by + // subsequent states; total length is sum of number + // of rules matched for each accepting state + int m_crulnMatched; // needed only for memory instrumentation + + // Transition matrix--for optimized version: +// short ** m_prgprgrowXitions; // ((m_crow-m_crowFinal) * m_ccol) of these; + // positive number indicates + // next state is non-accepting; negative number is + // negative of accepting state. + + // Transition matrix--for current version: + short * m_prgrowTransitions; // ((m_crow-m_crowFinal) * m_ccol) of these + + // debugger string offsets + data16 * m_prgibStateDebug; // for transition states; (m_crow-m_crul+1) of these + + // constants for fast binary search; these are generated by the compiler so that the + // engine doesn't have to take time to do it + data16 m_dimcrInit; // (max power of 2 <= m_cmcr); + // size of initial range to consider + data16 m_cLoop; // log2(max power of 2 <= m_cmcr); + // indicates how many iterations are necessary + data16 m_imcrStart; // m_cmcr - m_dimcrInit; + // where to start search + + int m_cmcr; // number of machine-class-ranges + GrFSMClassRange * m_prgmcr; // array of class ranges; we search these to find the + // mapping to the machine-class-column + + // minimum and maximum number of items in the rule contexts before the first modified + // item. + int m_critMinRulePreContext; + int m_critMaxRulePreContext; + + // start states--row in the FSM to start on depending on how many bogus slots we + // are skipping; (max rule-precontext - min rule-precontext + 1) of these; + // first always = zero + short * m_prgrowStartStates; + +}; + +} // namespace gr + + +#endif // !FSM_INCLUDED diff --git a/Build/source/libs/graphite/engine-2.4/src/segment/GrFeature.cpp b/Build/source/libs/graphite/engine-2.4/src/segment/GrFeature.cpp new file mode 100644 index 00000000000..79c2dd652b9 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/src/segment/GrFeature.cpp @@ -0,0 +1,328 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 1999, 2001 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: GrFeature.cpp +Responsibility: Sharon Correll +Last reviewed: Not yet. + +Description: + Implements the GrFeature class. +-------------------------------------------------------------------------------*//*:End Ignore*/ + +//:>******************************************************************************************** +//:> Include files +//:>******************************************************************************************** +#include "Main.h" +#include + +#ifdef _MSC_VER +#pragma hdrstop +#endif + +//:>******************************************************************************************** +//:> Forward declarations +//:>******************************************************************************************** + +//:>******************************************************************************************** +//:> Local Constants and static variables +//:>******************************************************************************************** + +namespace gr +{ + +//:>******************************************************************************************** +//:> GrFeature Methods +//:>******************************************************************************************** + +/*---------------------------------------------------------------------------------------------- + Initialize the feature. +----------------------------------------------------------------------------------------------*/ +void GrFeature::Initialize(featid nID, int nNameId, int cfset, int nDefault) +{ + m_nID = nID; + m_nNameId = nNameId; + m_nDefault = nDefault; + + m_vnVal.resize(cfset); + for (unsigned int ifset = 0; ifset < m_vnVal.size(); ifset++) + m_vnVal[ifset] = INT_MAX; + m_vnNameId.resize(cfset); +} + +/*---------------------------------------------------------------------------------------------- + Return the feature settings. +----------------------------------------------------------------------------------------------*/ +int GrFeature::Settings(int cMax, int * prgnVal) +{ + int cRet = min(cMax, signed(m_vnVal.size())); + for (int ifset = 0; ifset < cRet; ifset++) + prgnVal[ifset] = m_vnVal[ifset]; + return cRet; +} + +/*---------------------------------------------------------------------------------------------- + Add a feature setting. +----------------------------------------------------------------------------------------------*/ +void GrFeature::AddSetting(int nVal, int nNameId) +{ + Assert(nVal != INT_MAX); + unsigned int ifset; + for (ifset = 0; ifset < m_vnVal.size(); ifset++) + { + if (m_vnVal[ifset] == nVal) + return; // already there + } + for (ifset = 0; ifset < m_vnVal.size(); ifset++) + { + if (m_vnVal[ifset] == INT_MAX) + { + m_vnVal[ifset] = nVal; + m_vnNameId[ifset] = nNameId; + return; + } + } + m_vnVal.push_back(nVal); + m_vnNameId.push_back(nNameId); +} + +/*---------------------------------------------------------------------------------------------- + Return true if the given setting is valid according to the font's feature table. +----------------------------------------------------------------------------------------------*/ +bool GrFeature::IsValidSetting(int nVal) +{ + for (unsigned int ifset = 0; ifset < m_vnVal.size(); ifset++) + { + if (m_vnVal[ifset] == nVal) + return true; + } + return false; +} + +/*---------------------------------------------------------------------------------------------- + Read the feature label from the name table. +----------------------------------------------------------------------------------------------*/ +std::wstring GrFeature::Label(GrEngine * pgreng, int nLang) +{ + std::wstring stu = pgreng->StringFromNameTable(nLang, m_nNameId); + if (stu == L"NoName") + stu.erase(); + return stu; +} + +/*---------------------------------------------------------------------------------------------- + Read the feature value label from the name table. +----------------------------------------------------------------------------------------------*/ +std::wstring GrFeature::SettingLabel(GrEngine * pgreng, int nVal, int nLang) +{ + for (unsigned int ifset = 0; ifset < m_vnVal.size(); ifset++) + { + if (m_vnVal[ifset] == nVal) + { + std::wstring stu = pgreng->StringFromNameTable(nLang, m_vnNameId[ifset]); + if (stu == L"NoName") + stu.erase(); + return stu; + } + } + Assert(false); // setting is not valid + return L""; +} + +/*---------------------------------------------------------------------------------------------- + Return the given setting value. +----------------------------------------------------------------------------------------------*/ +int GrFeature::NthSetting(int ifset) +{ + if (ifset >= (int)m_vnVal.size()) + return -1; + else + return m_vnVal[ifset]; +} + +/*---------------------------------------------------------------------------------------------- + Read the feature value label for the given index. +----------------------------------------------------------------------------------------------*/ +std::wstring GrFeature::NthSettingLabel(GrEngine * pgreng, int ifset, int nLang) +{ + std::wstring stu; + + if (ifset >= (int)m_vnVal.size()) + stu.erase(); + else + { + stu = pgreng->StringFromNameTable(nLang, m_vnNameId[ifset]); + if (stu == L"NoName") + stu.erase(); + } + return stu; +} + +/*---------------------------------------------------------------------------------------------- + Return the feature setting label. +----------------------------------------------------------------------------------------------*/ +// void GrFeature::SetSettingLabel(int nVal, std::wstring stuLabel, int nLang) +// { +// for (int ifset = 0; ifset < m_vfset.size(); ifset++) +// { +// if (m_vfset[ifset].m_nVal == nVal) +// { +// m_vfset[ifset].m_hmnstuLabels.Insert(nLang, stuLabel, true); +// return; +// } +// } +// Assert(false); // setting is not valid +// } + + +//:>******************************************************************************************** +//:> GrLangTable Methods +//:>******************************************************************************************** + +/*---------------------------------------------------------------------------------------------- + Read the languages from the font. +----------------------------------------------------------------------------------------------*/ +bool GrLangTable::ReadFromFont(GrIStream * pgrstrm, int /*fxdVersion*/) +{ + GrIStream & grstrm = *pgrstrm; + + // number of languages + m_clang = (size_t)grstrm.ReadUShortFromFont(); + + // search constants + m_dilangInit = grstrm.ReadUShortFromFont(); + m_cLoop = grstrm.ReadUShortFromFont(); + m_ilangStart = grstrm.ReadUShortFromFont(); + + // Slurp the data into the buffers. The "+1" represents a bogus ending entry that quickly + // gives us the size of the feature list. Note that the resulting data is all big-endian. + int cb = (m_clang + 1) * sizeof(LangEntry); + m_prglang = new LangEntry[m_clang + 1]; + grstrm.ReadBlockFromFont(m_prglang, cb); + + m_cbOffset0 = (lsbf)(m_prglang[0].cbOffsetBIG); + + Assert((lsbf)(m_prglang[m_clang].cFeaturesBIG) == 0); // bogus entry has no settings + cb = (lsbf)(m_prglang[m_clang].cbOffsetBIG) - m_cbOffset0; + + if (cb % sizeof(FeatSet) != 0) + { + // # of bytes does not fit nicely into FeatSet class--probably a corrupt font. + Assert(cb % sizeof(FeatSet) == 0); + return false; + } + int cfset = cb / sizeof(FeatSet); + m_prgfset = new FeatSet[cfset]; + m_cfset = cfset; + grstrm.ReadBlockFromFont(m_prgfset, cb); + + return true; +} + +/*---------------------------------------------------------------------------------------------- + Create an empty language table to use for dumb rendering, or when there is no valid + Sill table. +----------------------------------------------------------------------------------------------*/ +void GrLangTable::CreateEmpty() +{ + m_prglang = NULL; + m_prgfset = NULL; + m_clang = 0; + m_dilangInit = 0; + m_cLoop = 0; + m_ilangStart = 0; +} + +/*---------------------------------------------------------------------------------------------- + Return information about the language with the given ID by filling in the given vectors + with the feature ids and values. Will wipe out any data in the vectors already. +----------------------------------------------------------------------------------------------*/ +void GrLangTable::LanguageFeatureSettings(isocode lgcode, + std::vector & vnFeatId, std::vector & vnValues) +{ + vnFeatId.clear(); + vnValues.clear(); + + int ilang = FindIndex(lgcode); + if (ilang == -1) + return; // no such language: leave vectors empty + + LangEntry * plang = m_prglang + ilang; + int cbOffset = lsbf(plang->cbOffsetBIG) - m_cbOffset0; + Assert(cbOffset % sizeof(FeatSet) == 0); + if (cbOffset >= signed(m_cfset * sizeof(FeatSet))) + return; // bad offset + + byte * pbFeatSet = reinterpret_cast(m_prgfset) + cbOffset; + FeatSet * pfset = reinterpret_cast(pbFeatSet); + for (int ifset = 0; ifset < lsbf(plang->cFeaturesBIG); ifset++) + { + vnFeatId.push_back(lsbf(pfset[ifset].featidBIG)); + vnValues.push_back(lsbf(pfset[ifset].valueBIG)); + } +} + +/*---------------------------------------------------------------------------------------------- + Return the code for the language at the given index. +----------------------------------------------------------------------------------------------*/ +isocode GrLangTable::LanguageCode(size_t ilang) +{ + isocode lgcodeRet; + if (ilang > m_clang) + { + std::fill_n(lgcodeRet.rgch, 4, '\0'); + return lgcodeRet; + } + LangEntry * plang = m_prglang + ilang; + std::copy(plang->rgchCode, plang->rgchCode + 4, lgcodeRet.rgch); + return lgcodeRet; +} + +/*---------------------------------------------------------------------------------------------- + Return the index of the language in the list. +----------------------------------------------------------------------------------------------*/ +int GrLangTable::FindIndex(isocode lgcode) +{ + if (m_clang == 0) + return -1; +#ifdef _DEBUG + int nPowerOf2 = 1; + while (nPowerOf2 <= signed(m_clang)) + nPowerOf2 <<= 1; + nPowerOf2 >>= 1; + // Now nPowerOf2 is the max power of 2 <= m_clang + gAssert((1 << m_cLoop) == nPowerOf2); // m_cLoop == log2(nPowerOf2) + gAssert(m_dilangInit == nPowerOf2); + gAssert(m_ilangStart == m_clang - m_dilangInit); +#endif // _DEBUG + + int dilangCurr = m_dilangInit; + + int ilangCurr = m_ilangStart; // may become < 0 + while (dilangCurr > 0) + { + int nTest; + if (ilangCurr < 0) + nTest = -1; + else + { + LangEntry * plangCurr = m_prglang + ilangCurr; + nTest = strcmp(plangCurr->rgchCode, lgcode.rgch); + } + + if (nTest == 0) + return ilangCurr; + + dilangCurr >>= 1; // divide by 2 + if (nTest < 0) + ilangCurr += dilangCurr; + else // (nTest > 0) + ilangCurr -= dilangCurr; + } + + return -1; +} + +} // namespace gr diff --git a/Build/source/libs/graphite/engine-2.4/src/segment/GrFeatureValues.h b/Build/source/libs/graphite/engine-2.4/src/segment/GrFeatureValues.h new file mode 100644 index 00000000000..97e6a1fe33c --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/src/segment/GrFeatureValues.h @@ -0,0 +1,66 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 1999, 2001 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: GrFeatureValues.h +Responsibility: Sharon Correll +Last reviewed: Not yet. + +Description: + + +----------------------------------------------------------------------------------------------*/ +#ifdef _MSC_VER +#pragma once +#endif +#ifndef GR_FEATVAL_INCLUDED +#define GR_FEATVAL_INCLUDED + +//:End Ignore + +namespace gr +{ + +/*---------------------------------------------------------------------------------------------- + A convenient way to group together style and feature information that interacts + with the rules. + + Hungarian: fval +----------------------------------------------------------------------------------------------*/ +class GrFeatureValues +{ + friend class GrCharStream; + friend class GrSlotAbstract; + friend class GrSlotState; + +public: + // Standard constructor: + GrFeatureValues() + { + m_nStyleIndex = 0; + std::fill(m_rgnFValues, m_rgnFValues + kMaxFeatures, 0); + } + + // Copy constructor: + GrFeatureValues(const GrFeatureValues & fval) + { + m_nStyleIndex = fval.m_nStyleIndex; + std::copy(fval.m_rgnFValues, fval.m_rgnFValues + kMaxFeatures, m_rgnFValues); + } + + // For transduction logging: +#ifdef TRACING + void WriteXductnLog(GrTableManager * ptman, std::ostream &); +#endif // TRACING + +protected: + int m_nStyleIndex; + int m_rgnFValues[kMaxFeatures]; +}; + +} // namespace gr + + +#endif // !GR_FEATVAL_INCLUDED diff --git a/Build/source/libs/graphite/engine-2.4/src/segment/GrGlyphTable.cpp b/Build/source/libs/graphite/engine-2.4/src/segment/GrGlyphTable.cpp new file mode 100644 index 00000000000..5603e1ebf2c --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/src/segment/GrGlyphTable.cpp @@ -0,0 +1,509 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 1999, 2001 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: GrGlyphTable.cpp +Responsibility: Sharon Correll +Last reviewed: 10Aug99, JT, quick look over + +Description: + Implements the GrGlyphTable class and related classes. +----------------------------------------------------------------------------------------------*/ + +//:>******************************************************************************************** +//:> Include files +//:>******************************************************************************************** +#include "Main.h" + +#ifdef _MSC_VER +#pragma hdrstop +#endif + +//:End Ignore + +//:>******************************************************************************************** +//:> Forward declarations +//:>******************************************************************************************** + +//:>******************************************************************************************** +//:> Local Constants and static variables +//:>******************************************************************************************** + +namespace gr +{ + +//:>******************************************************************************************** +//:> Methods +//:>******************************************************************************************** + +/*---------------------------------------------------------------------------------------------- + Fill in the glyph table from the font stream. +----------------------------------------------------------------------------------------------*/ +bool GrGlyphTable::ReadFromFont(GrIStream & grstrmGloc, long lGlocStart, + GrIStream & grstrmGlat, long lGlatStart, + data16 chwBWAttr, data16 chwJStrAttr, int cJLevels, int cnCompPerLig, + int fxdSilfVersion) +{ + // Create the glyph sub-table for the single style. + GrGlyphSubTable * pgstbl = new GrGlyphSubTable(); + + // Gloc table--offsets into Glat table + grstrmGloc.SetPositionInFont(lGlocStart); + + // version + int fxdGlocVersion = GrEngine::ReadVersion(grstrmGloc); + if (fxdGlocVersion > kGlocVersion) + return false; + + // flags + short snFlags = grstrmGloc.ReadShortFromFont(); + + // number of attributes + unsigned short cAttrs = grstrmGloc.ReadUShortFromFont(); + + // Create a single sub-table for the single style. + pgstbl->Initialize(fxdSilfVersion, snFlags, + chwBWAttr, chwJStrAttr, data16(chwJStrAttr + cJLevels), + m_cglf, cAttrs, cnCompPerLig); + + SetSubTable(0, pgstbl); + + return pgstbl->ReadFromFont(grstrmGloc, m_cglf, grstrmGlat, lGlatStart, fxdSilfVersion); +} + +bool GrGlyphSubTable::ReadFromFont(GrIStream & grstrmGloc, int cGlyphs, + GrIStream & grstrmGlat, long lGlatStart, int fxdSilfVersion) +{ + // attribute value offsets--slurp + if (m_fGlocShort) + { + grstrmGloc.ReadBlockFromFont(m_prgibBIGAttrValues, ((cGlyphs + 1) * sizeof(data16))); + } + else + { + grstrmGloc.ReadBlockFromFont(m_prgibBIGAttrValues, ((cGlyphs + 1) * sizeof(data32))); + } + + // length of buffer needed for glyph attribute values: + int cbBufLen = GlocLookup(data16(cGlyphs)); + + // TODO: slurp debugger offsets: 'm_prgibBIGGlyphAttrDebug' + + // Glat table + grstrmGlat.SetPositionInFont(lGlatStart); + + // version + int fxdGlatVersion = grstrmGlat.ReadIntFromFont(); + if (fxdGlatVersion > kGlatVersion) + return false; + + m_pgatbl = new GrGlyphAttrTable(); + m_pgatbl->Initialize(fxdGlatVersion, fxdSilfVersion, cbBufLen); + + // Back up over the version number and include it right in the attribute value entry + // buffer, since the offsets take it into account. + grstrmGlat.SetPositionInFont(lGlatStart); + + // Slurp the entire block of entries. + grstrmGlat.ReadBlockFromFont(m_pgatbl->m_prgbBIGEntries, cbBufLen); + + return true; +} + +/*---------------------------------------------------------------------------------------------- + Create an empty glyph table with no glyph attributes. +----------------------------------------------------------------------------------------------*/ +void GrGlyphTable::CreateEmpty() +{ + // Create the glyph sub-table for the single style. + GrGlyphSubTable * pgstbl = new GrGlyphSubTable(); + + // Create a single sub-table for the single style. + pgstbl->Initialize(0, 0, 0, 0, 0, m_cglf, 0, 0); + + SetSubTable(0, pgstbl); + + pgstbl->CreateEmpty(); +} + +void GrGlyphSubTable::CreateEmpty() +{ + m_pgatbl = new GrGlyphAttrTable(); + m_pgatbl->Initialize(0, 0, 0); +} + +/*---------------------------------------------------------------------------------------------- + Initialization. +----------------------------------------------------------------------------------------------*/ +void GrGlyphSubTable::Initialize(int fxdSilfVersion, utf16 chwFlags, + data16 chwBWAttr, data16 chwJStrAttr, data16 chwJStrHWAttr, + int cGlyphs, int cAttrs, int cnCompPerLig) +{ + m_fxdSilfVersion = fxdSilfVersion; + m_fHasDebugStrings = HasAttrNames(chwFlags); + m_nAttrIDLim = cAttrs; + m_chwBWAttr = chwBWAttr; + m_chwJStrAttr = chwJStrAttr; + m_chwJStrHWAttr = chwJStrHWAttr; + m_fGlocShort = !LongFormat(chwFlags); + + if (m_fGlocShort) + { // item # cGlyphs holds length, which is convenient for dealing with last item + m_prgibBIGAttrValues = new byte[(cGlyphs + 1) * sizeof(data16)]; + } + else + { + m_prgibBIGAttrValues = new byte[(cGlyphs + 1) * sizeof(data32)]; + } + + + if (m_fHasDebugStrings) + { + m_prgibBIGGlyphAttrDebug = new data16[cAttrs + 1]; + } + + // Make a cache to hold a list of defined components for each glyph. This is + // calculated lazily, as needed, so we also include (as the first item) a flag to + // indicate whether or not it has been calculated; hence the "+1". + m_cnCompPerLig = cnCompPerLig; + m_prgnDefinedComponents = new int[(m_cnCompPerLig + 1) * cGlyphs]; + std::fill_n(m_prgnDefinedComponents, (m_cnCompPerLig + 1) * cGlyphs, 0); + + // Now the instance is ready to have the locations and the debug strings + // read from the file. +} + +/*---------------------------------------------------------------------------------------------- + Return the attribute value for the given glyph. +----------------------------------------------------------------------------------------------*/ +int GrGlyphSubTable::GlyphAttrValue(gid16 chwGlyphID, int nAttrID) +{ + if (m_nAttrIDLim == 0) + { + // No attributes defined (eg, invalid font) + return 0; + } + if (nAttrID >= m_nAttrIDLim || nAttrID >= 0xFFFF) + { + gAssert(false); + return 0; + } + int ibMin = GlocLookup(chwGlyphID); // where this glyph's attrs start + int ibLim = GlocLookup(chwGlyphID + 1); // where next glyph starts + + int nRet = m_pgatbl->GlyphAttr16BitValue(ibMin, ibLim, data16(nAttrID)); + if ((data16)nAttrID == m_chwJStrAttr) + { + // For justify.stretch, which can be a 32-bit value, add on the high word. + unsigned int nRetHW = m_pgatbl->GlyphAttr16BitValue(ibMin, ibLim, m_chwJStrHWAttr); + nRet = (nRetHW << 16) | nRet; + } + return ConvertValueForVersion(nRet, nAttrID); +} + +/*---------------------------------------------------------------------------------------------- + Convert the glyph attribute value from the version of the font table to what is + expected by the engine. +----------------------------------------------------------------------------------------------*/ +int GrGlyphSubTable::ConvertValueForVersion(int nValue, int nAttrID) +{ + return ConvertValueForVersion(nValue, nAttrID, (int)m_chwBWAttr, m_fxdSilfVersion); +} + +int GrGlyphSubTable::ConvertValueForVersion(int nValue, int nAttrID, int nBWAttr, int fxdVersion) +{ + if ((nBWAttr >= 0 && nAttrID == (int)nBWAttr) || + (nBWAttr == -1 && nAttrID == (int)kslatBreak)) + { + if (fxdVersion < 0x00020000) + { + //switch (nValue) + //{ + //case klbv1WordBreak: return klbWordBreak; + //case klbv1HyphenBreak: return klbHyphenBreak; + //case klbv1LetterBreak: return klbLetterBreak; + //case klbv1ClipBreak: return klbClipBreak; + //default: + // break; + //} + //switch (nValue * -1) + //{ + //case klbv1WordBreak: return (klbWordBreak * -1); + //case klbv1HyphenBreak: return (klbHyphenBreak * -1); + //case klbv1LetterBreak: return (klbLetterBreak * -1); + //case klbv1ClipBreak: return (klbClipBreak * -1); + //default: + // break; + //} + + // Breakweight values in version 2 are 10 times what they were in version 1. + if (abs(nValue) <= 7) + return nValue * 10; + } + } + return nValue; +} + +/*---------------------------------------------------------------------------------------------- + Return the attribute value for a glyph. Loop through the attribute runs, looking + for the one containing the given attribute. Assume the value is 0 if not found. + + @param ibMin - byte offset of first run for the glyph of interest + @param ibLim - byte offset of first run for the following glyph + @param nAttrID - attribute to find +----------------------------------------------------------------------------------------------*/ +int GrGlyphAttrTable::GlyphAttr16BitValue(int ibMin, int ibLim, data16 nAttrID) +{ + GrGlyphAttrRun gatrun; + byte * pbBIGEnt = m_prgbBIGEntries + ibMin; + + if (m_fxdGlatVersion < 0x00020000 && nAttrID >= 0xFF) { + gAssert(false); + return 0; + } + + if (ibMin >= m_cbEntryBufLen || ibLim >= m_cbEntryBufLen) + { + // Invalid offset + return 0; + } + + while (pbBIGEnt < m_prgbBIGEntries + ibLim) + { + // Suck the run of attribute values into the instance, so we can see + // what's there. + gatrun.CopyFrom(pbBIGEnt, m_fxdGlatVersion); + + if (nAttrID < gatrun.m_suMinAttrID) + // Attribute not found--assume value is 0. + return 0; + else if (gatrun.m_suMinAttrID + gatrun.m_cAttrs > nAttrID) + { + // Found the value in this run. + data16 chw = lsbf(gatrun.m_rgchwBIGValues[nAttrID - gatrun.m_suMinAttrID]); + if ((chw & 0x8000) == 0) + return (int)chw; + else + return 0xFFFF0000 | chw; // sign extension + } + else + // Go to next run. + pbBIGEnt += gatrun.ByteCount(m_fxdGlatVersion); + } + + // Attribute not found--assume value is 0; + return 0; +} + +/*---------------------------------------------------------------------------------------------- + Given a point on the glyph, determine which component (if any) the point is in, and return + its index relative to the components that are defined for this glyph; ie, the index within + the compRef array. + Return -1 if the click with not inside any component, or if there are no components + defined for this glyph. + CURRENTLY NOT USED - if ever used, need to incorporate floating point +----------------------------------------------------------------------------------------------*/ +int GrGlyphSubTable::ComponentContainingPoint(gid16 chwGlyphID, int x, int y) +{ + int i = CalculateDefinedComponents(chwGlyphID); + for (int inComp = 0; inComp < m_cnCompPerLig; inComp++) + { + // The m_pnComponents list holds a list of the component attributes that are defined + // for this glyph, padded with -1's. + int nCompID = m_prgnDefinedComponents[i + inComp]; + if (nCompID == -1) + break; // hit the end of the list + + // The value of the component attribute is actually the attribute ID for the + // first of the component box fields--the top. There should a contiguous group of + // four fields: top, bottom, left, right. + int nFieldIDMin = GlyphAttrValue(chwGlyphID, nCompID); + gAssert(nFieldIDMin != 0); + int nTop = GlyphAttrValue(chwGlyphID, nFieldIDMin); + int nBottom = GlyphAttrValue(chwGlyphID, nFieldIDMin + 1); + int nLeft = GlyphAttrValue(chwGlyphID, nFieldIDMin + 2); + int nRight = GlyphAttrValue(chwGlyphID, nFieldIDMin + 3); + + if (nLeft <= x && x < nRight && + nBottom <= y && y < nTop) + { + return inComp; + } + } + return -1; +} + +/*---------------------------------------------------------------------------------------------- + Fill in the box with the source-device coordinates corresponding to the given component. + The rectangle is relative to the top-left of the glyph. + Return false if the component is not defined. + + @param xysEmSquare - of the font, in logical units + @param chwGlyphID - the glyph of interest + @param icomp - the component of interest (eg, for the "oe" ligature, + the index for component.o would be 0, + and the index for component.e would be 1); + these is as defined by the glyph, not as used in the rules + @param mFontEmUnits - the number of em-units in the font, for scaling + @param dysFontAscent - ascent of the font, for adjusting coordinate systems + @param pxsLeft, pxsRight, pysTop, pysBottom + - return values, in source device coordinates + @param fTopOrigin - convert values to a coordinate system where the origin is the + top of the line, not the baseline +----------------------------------------------------------------------------------------------*/ +bool GrGlyphSubTable::ComponentBoxLogUnits(float xysEmSquare, + gid16 chwGlyphID, int icomp, int mFontEmUnits, float dysFontAscent, + float * pxsLeft, float * pysTop, float * pxsRight, float * pysBottom, + bool fTopOrigin) +{ + int i = CalculateDefinedComponents(chwGlyphID); + + // The m_pnComponents list holds a list of the component attributes that are defined + // for this glyph, padded with -1's. + int nCompID = m_prgnDefinedComponents[i + icomp]; + if (nCompID == -1) + { + // Ooops, the component is undefined for this glyph. + *pxsLeft = 0; + *pxsRight = 0; + *pysTop = 0; + *pysBottom = 0; + return false; + } + + // The value of the component attribute is actually the attribute ID for the + // first of the component box fields--the top. There should a contiguous group of + // four fields: top, bottom, left, right. + int nFieldIDMin = GlyphAttrValue(chwGlyphID, nCompID); + if (nFieldIDMin == 0) + { + // Component inadequately defined. This can happen when we defined components + // for a glyph and then substituted another glyph for it. + *pxsLeft = 0; + *pxsRight = 0; + *pysTop = 0; + *pysBottom = 0; + return false; + } + int mTop = GlyphAttrValue(chwGlyphID, nFieldIDMin); + int mBottom = GlyphAttrValue(chwGlyphID, nFieldIDMin + 1); + int mLeft = GlyphAttrValue(chwGlyphID, nFieldIDMin + 2); + int mRight = GlyphAttrValue(chwGlyphID, nFieldIDMin + 3); + + ////int xysFontEmUnits; + ////// ysHeight should correspond to the pixels in the font's em square + ////GrResult res = pgg->GetFontEmSquare(&xysFontEmUnits); + ////if (ResultFailed(res)) + //// return false; + + *pxsLeft = GrEngine::GrIFIMulDiv(mLeft, xysEmSquare, mFontEmUnits); + *pxsRight = GrEngine::GrIFIMulDiv(mRight, xysEmSquare, mFontEmUnits); + *pysTop = GrEngine::GrIFIMulDiv(mTop, xysEmSquare, mFontEmUnits); + *pysBottom = GrEngine::GrIFIMulDiv(mBottom, xysEmSquare, mFontEmUnits); + + if (*pxsLeft > *pxsRight) + { + float xsTmp = *pxsLeft; + *pxsLeft = *pxsRight; + *pxsRight = xsTmp; + } + if (*pysTop < *pysBottom) + { + float ysTmp = *pysTop; + *pysTop = *pysBottom; + *pysBottom = ysTmp; + } + + if (fTopOrigin) + { + // Currently top and bottom coordinates are such that 0 is the baseline and positive is + // upwards, while for the box we want to return, 0 is the top of the glyph and positive + // is downwards. So switch systems. + *pysTop = (dysFontAscent - *pysTop); + *pysBottom = (dysFontAscent - *pysBottom); + } + + return true; +} + +/*---------------------------------------------------------------------------------------------- + Calculate the list of defined components for the given glyph, if any. + Return the index to the first relevant item in the array. + Private. + TODO: With the current implementation that stores the glyph ids in each slot, this + mechanism is redundant and obsolete, and should be removed. +----------------------------------------------------------------------------------------------*/ +int GrGlyphSubTable::CalculateDefinedComponents(gid16 chwGlyphID) +{ + // The first item is a flag indicating whether the list has been calculated. + int iFlag = chwGlyphID * (m_cnCompPerLig + 1); // index of has-been-calculated flag + int iMin = iFlag + 1; // first actual value; +1 in order to skip the flag + if (m_prgnDefinedComponents[iFlag] == 0) + { + int iTmp = iMin; + for (int nCompID = 0; nCompID < m_cComponents; nCompID++) + { + if (ComponentIsDefined(chwGlyphID, nCompID)) + m_prgnDefinedComponents[iTmp++] = nCompID; + if (iTmp - iMin >= m_cnCompPerLig) + break; // ignore any components beyond the maximum allowed + } + // Fill in the rest of the list with -1. + for( ; iTmp < iMin + m_cnCompPerLig; iTmp++) + m_prgnDefinedComponents[iTmp] = -1; + + m_prgnDefinedComponents[iFlag] = 1; // has been calculated + } + return iMin; +} + +/*---------------------------------------------------------------------------------------------- + Return true if the given attr ID, which is a component definition attribute, indicates + that that component is defined for the given glyph. + + @param chwGlyphID - the glyph of interest + @param nAttrID - the attribute of interest, assumed to be a component glyph + attribute (eg. component.e.top) +----------------------------------------------------------------------------------------------*/ +bool GrGlyphSubTable::ComponentIsDefined(gid16 chwGlyphID, int nAttrID) +{ + gAssert(nAttrID < m_cComponents); + if (nAttrID >= m_cComponents) + return false; + + return (GlyphAttrValue(chwGlyphID, nAttrID) != 0); +} + +/*---------------------------------------------------------------------------------------------- + Return the index of the given component as defined for the given glyph ID. that is, + convert the global ID for the component to the one within this glyph. Return -1 + if the component is not defined for the given glyph. + For instance, given the glyph ID "oe" (the oe ligature) and the attr ID for component.o, + the result would be 0; for component.e the result would be 1. +----------------------------------------------------------------------------------------------*/ +int GrGlyphSubTable::ComponentIndexForGlyph(gid16 chwGlyphID, int nCompID) +{ + int i = CalculateDefinedComponents(chwGlyphID); + + for (int iLp = 0; iLp < m_cnCompPerLig; iLp++) + { + if (m_prgnDefinedComponents[i + iLp] == nCompID) + return iLp; + } + return -1; +} + +/*---------------------------------------------------------------------------------------------- + Return the ID of the nth defined component attribute for the given glyph. +----------------------------------------------------------------------------------------------*/ +//int GrGlyphSubTable::NthComponentID(gid16 chwGlyphID, int n) +//{ +// int i = CalculateDefinedComponents(chwGlyphID); +// return m_pnComponents[i + 1 + n]; +//} + +} // namespace gr + +//:End Ignore diff --git a/Build/source/libs/graphite/engine-2.4/src/segment/GrGlyphTable.h b/Build/source/libs/graphite/engine-2.4/src/segment/GrGlyphTable.h new file mode 100644 index 00000000000..5e229e4bc63 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/src/segment/GrGlyphTable.h @@ -0,0 +1,421 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 1999, 2001 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: GrGlyphTable.h +Responsibility: Sharon Correll +Last reviewed: 10Aug99, JT, quick look over + +Description: + The GrGlyphTable and related classes that store the values of glyph attributes. + + For each glyph in a TrueType font, Graphite has a list of glyph attributes (which + are defined in the GDL script file). Since most of the values will be zero, we save space + by only storing the non-zero values. + + Eventually it may be possible to have more than one TrueType font compiled into a single + glyph table, hence the need for multiple sub-tables. For now we assume that there is only + one font file and only one sub-table. + + Note that BIG in a variable name means that the data is in big-endian format, or is a range + of bytes that must be interpreted as a run of wide chars or ints in big-endian format. +-------------------------------------------------------------------------------*//*:End Ignore*/ + +//:Ignore +#ifdef _MSC_VER +#pragma once +#endif +#ifndef GR_GTABLE_INCLUDED +#define GR_GTABLE_INCLUDED +//:End Ignore + +namespace gr +{ + +class Font; + +/*---------------------------------------------------------------------------------------------- + A run of non-zero attribute values for a single glyph, where the attribute IDs + are contiguous. + + NOTE: it is assumed that the format of this class matches the byte order of the data as it + is read directly from the TTF/ECF file--that is, it is big-endian. + + Hungarian: gatrun +----------------------------------------------------------------------------------------------*/ + +class GrGlyphAttrRun +{ + friend class GrGlyphTable; + friend class GrGlyphSubTable; + friend class GrGlyphAttrTable; + + enum { + kMaxAttrsPerRun = 255 + }; + + /*------------------------------------------------------------------------------------------ + Copy the raw memory (starting at the given byte) into the instance. This method must + reflect the format of the "Glat_entry" as it is stored in the file and slurped into + memory. + ------------------------------------------------------------------------------------------*/ + void CopyFrom(byte * pbBIGEnt, int fxdGlatVersion) + { + if (fxdGlatVersion >= 0x00020000) + { + // 16-bit attribute number and number of attributes + unsigned short * su = (unsigned short *)pbBIGEnt; + m_suMinAttrID = lsbf(*su); + su = (unsigned short *)(pbBIGEnt + 2); + m_cAttrs = lsbf(*su); + } + else + { + // 8-bit attribute number and number of attributes + m_suMinAttrID = *pbBIGEnt; // first attribute number + m_cAttrs = *(pbBIGEnt + 1); // number of attributes + } + + if (m_cAttrs >= kMaxAttrsPerRun) + { + gAssert(false); + m_cAttrs = kMaxAttrsPerRun; + } + #ifdef _DEBUG + // Probably not strictly necessary to zero the array, but convenient for debugging. + // Removed from release build for optimization + std::fill(m_rgchwBIGValues, m_rgchwBIGValues + kMaxAttrsPerRun, L'\0'); + #endif + // this is mixing types of data16 and byte pointers! + const data16 * prgchw = reinterpret_cast(pbBIGEnt + ByteCountHeader(fxdGlatVersion)); + std::copy(prgchw, prgchw + m_cAttrs, m_rgchwBIGValues); + } + + int ByteCount(int fxdGlatVersion) + { + return (ByteCountHeader(fxdGlatVersion) + (m_cAttrs * sizeof(data16))); + } + + int ByteCountHeader(int fxdGlatVersion) + { + if (fxdGlatVersion >= 0x00020000) + return 4; // 2 16-bit words + else + return 2; // 2 8-bit words + } + +protected: + unsigned short m_suMinAttrID; // ID of first attribute in the run + unsigned short m_cAttrs; // number of attributes in the run + data16 m_rgchwBIGValues[kMaxAttrsPerRun]; +}; + +/*---------------------------------------------------------------------------------------------- + Contains runs of attribute values for all the glyphs in the font; corresponds to + the "Glat" table in the font. + + Hungarian: gatbl +----------------------------------------------------------------------------------------------*/ + +class GrGlyphAttrTable +{ + friend class GrGlyphTable; + friend class GrGlyphSubTable; + friend class FontMemoryUsage; + +protected: + // Constructor: + GrGlyphAttrTable() + { + m_prgbBIGEntries = NULL; + } + + // Destructor: + ~GrGlyphAttrTable() + { + delete[] m_prgbBIGEntries; + } + + // Initialization: + void Initialize(int fxdGlatVersion, int fxdSilfVersion, int cbBufLen) + { + m_fxdGlatVersion = fxdGlatVersion; + m_fxdSilfVersion = fxdSilfVersion; + m_cbEntryBufLen = cbBufLen; + m_prgbBIGEntries = new byte[cbBufLen]; + // Now the instance is ready to have all the glyph attr entries slurped into + // the byte array from the file. + } + + int GlyphAttr16BitValue(int ibMin, int ibLim, data16 bAttrID); + +protected: + int m_fxdGlatVersion; // for interpreting the attribute-run headers + + int m_fxdSilfVersion; // version number of the Silf table, which is used + // to interpret the attribute values + + // Block of variable-length glyph attribute runs, matching the format of + // GrGlyphAttrRun. We don't store instances of that class here because they + // are variable length, and it would be too slow to read them individually from the + // font. Instead, we set up a single instance in the method that accesses the values; + // having this instance will help debugging. Eventually we may want to do without it, + // if it would help efficiency. + int m_cbEntryBufLen; // needed for memory instrumentation and sanity checking + byte * m_prgbBIGEntries; + +}; + +/*---------------------------------------------------------------------------------------------- + One glyph table per font (style) file; corresponds to the "Gloc" table in the font. + Currently there is only considered to be one style per file, so there is only one of + these. It holds the (non-zero) glyph attribute values for every glyph in the font. + + Hungarian: gstbl + + Review: Eventually we may need to make a subclass that uses 32-bit values for the offsets, + or just use a separate array pointer in this class. Which would be preferable? +----------------------------------------------------------------------------------------------*/ + +class GrGlyphSubTable +{ + friend class GrGlyphTable; + friend class FontMemoryUsage; + +public: + // Constructor: + GrGlyphSubTable() : + m_pgatbl(NULL), + m_prgibBIGAttrValues(NULL), + m_prgibBIGGlyphAttrDebug(NULL), + m_prgnDefinedComponents(NULL) + { + } + // Destructor: + ~GrGlyphSubTable() + { + delete m_pgatbl; + delete[] m_prgibBIGAttrValues; + if (m_fHasDebugStrings) + delete[] m_prgibBIGGlyphAttrDebug; + delete[] m_prgnDefinedComponents; + } + + // Initialization: + bool ReadFromFont(GrIStream & gloc_strm, int cGlyphs, + GrIStream & glat_strm, long lGlatStart, int fxdSilVersion); + void Initialize(int fxdSilfVersion, data16 chwFlags, + data16 chwBWAttr, data16 chwJStrAttr, data16 chwJStrHWAttr, + int cGlyphs, int cAttrs, int cnCompPerLig); + + void CreateEmpty(); + + void SetNumberOfComponents(int c) + { + m_cComponents = c; + } + + // General: + int NumberOfGlyphAttrs() { return m_nAttrIDLim; } // 0..(m_nAttrIDLim-1) + + int GlyphAttrValue(gid16 chwGlyphID, int nAttrID); + + // Ligatures: + int ComponentContainingPoint(gid16 chwGlyphID, int x, int y); + bool ComponentBoxLogUnits(float xysEmSquare, gid16 chwGlyphID, int icomp, + int mFontEmUnits, float dysAscent, + float * pxsLeft, float * pysTop, float * pxsRight, float * pysBottom, + bool fTopOrigin = true); +protected: + int CalculateDefinedComponents(gid16 chwGlyphID); + bool ComponentIsDefined(gid16 chwGlyphID, int nAttrID); + int ComponentIndexForGlyph(gid16 chwGlyphID, int nCompID); +// int NthComponentID(gid16 chwGlyphID, int n); + int ConvertValueForVersion(int nRet, int nAttrID); + +public: + static int ConvertValueForVersion(int nRet, int nAttrID, int nBWAttr, int fxdVersion); + + // Flags: + bool LongFormat(data16 chwFlags) // 32-bit values? + { + return ((chwFlags & 0x01) == 0x01); // bit 0 + } + bool HasAttrNames(data16 chwFlags) + { + return ((chwFlags & 0x02) == 0x02); // bit 1 + } + int GlocLookup(data16 chwGlyphId) + { + if (m_fGlocShort) + { + unsigned short su = ((unsigned short *)m_prgibBIGAttrValues)[chwGlyphId]; + return lsbf(su); + } + else + { unsigned int u = ((unsigned int *)m_prgibBIGAttrValues)[chwGlyphId]; + return lsbf((int)u); + } + } + +protected: + int m_fxdSilfVersion; // version number of the Silf table, which is used + // to interpret the attribute values + bool m_fHasDebugStrings; // are debugging strings loaded into memory? + + int m_nAttrIDLim; // number of glyph attributes + int m_cComponents; // number of initial glyph attributes that + // represent ligature components + int m_cnCompPerLig; + + GrGlyphAttrTable * m_pgatbl; + byte * m_prgibBIGAttrValues; // byte offsets for glyph attr values - BIG endian + bool m_fGlocShort; // flag for Gloc table format + data16 * m_prgibBIGGlyphAttrDebug; // byte offsets for glyph attr debug strings - BIG endian + + data16 m_chwBWAttr; // breakweight attr ID; needed for converting + // between versions + + // Attr IDs for justify.0.stretch and justify.0.stretchHW; these must always be looked + // up in tandem. + data16 m_chwJStrAttr; + data16 m_chwJStrHWAttr; + + int * m_prgnDefinedComponents; // for each glyph, cache list of component attributes that + // are defined +}; + +/*---------------------------------------------------------------------------------------------- + Holds all the information about glyph attributes. + + Hungarian: gtbl +----------------------------------------------------------------------------------------------*/ + +class GrGlyphTable +{ + friend class GrGlyphSubTable; + friend class FontMemoryUsage; + +public: + // Constructor: + GrGlyphTable() + { + m_cglf = 0; + m_cComponents = 0; + m_cgstbl = 0; + m_vpgstbl.clear(); + } + + // Destructor: + ~GrGlyphTable() + { + for (int i = 0; i < m_cgstbl; ++i) + delete m_vpgstbl[i]; + } + + bool ReadFromFont(GrIStream & gloc_strm, long lGlocStart, + GrIStream & glat_strm, long lGlatStart, + data16 chwBWAttr, data16 chwJStrAttr, int cJLevels, int cnCompPerLig, + int fxdSilfVersion); + + void CreateEmpty(); + + // Setters: + void SetNumberOfGlyphs(int c) + { + m_cglf = c; + } + void SetNumberOfStyles(int c) + { + m_cgstbl = c; + m_vpgstbl.resize(c); + } + void SetNumberOfComponents(int c) + { + m_cComponents = c; + for (unsigned int ipgstbl = 0; ipgstbl < m_vpgstbl.size(); ipgstbl++) + m_vpgstbl[ipgstbl]->SetNumberOfComponents(c); + } + void SetSubTable(int i, GrGlyphSubTable * pgstbl) + { + if (signed(m_vpgstbl.size()) <= i) + { + gAssert(false); + m_vpgstbl.resize(i+1); + } + m_vpgstbl[i] = pgstbl; + m_vpgstbl[i]->SetNumberOfComponents(m_cComponents); + } + + // Getters: + int NumberOfGlyphs() { return m_cglf; } + int NumberOfStyles() { return m_cgstbl; } + + int NumberOfGlyphAttrs() + { + // All of the sub-tables should have the same number of glyph attributes, + // so just ask the first. + return m_vpgstbl[0]->NumberOfGlyphAttrs(); + } + + int GlyphAttrValue(gid16 chwGlyphID, int nAttrID) + { + gAssert(m_cgstbl == 1); + return m_vpgstbl[0]->GlyphAttrValue(chwGlyphID, nAttrID); + } + // Eventually: + //int GlyphAttrValue(gid16 chwGlyphID, int nAttrID, int nStyleIndex) + //{ + // return m_vpgstbl[nStyleIndex]->GlyphAttrValue(chwGlyphID, nAttrID); + //} + + int ComponentContainingPoint(gid16 chwGlyphID, int x, int y) + { + gAssert(m_cgstbl == 1); + return m_vpgstbl[0]->ComponentContainingPoint(chwGlyphID, x, y); + } + // Eventually: + //int ComponentContainingPoint(gid16 chwGlyphID, int nStyleIndex, int x, int y) + //{ + // gAssert(m_cgstbl == 1); + // return m_vpgstbl[nStyleIndex]->ComponentContainingPoint(chwGlyphID, nAttrID); + //} + + bool ComponentBoxLogUnits(float xysEmSquare, gid16 chwGlyphID, int icomp, + int mFontEmUnits, float dysAscent, + float * pxsLeft, float * pysTop, float * pxsRight, float * pysBottom, + bool fTopOrigin = true) + { + gAssert(m_cgstbl == 1); + return m_vpgstbl[0]->ComponentBoxLogUnits(xysEmSquare, + chwGlyphID, icomp, mFontEmUnits, dysAscent, + pxsLeft, pysTop, pxsRight, pysBottom, + fTopOrigin); + } + + int ComponentIndexForGlyph(gid16 chwGlyphID, int nCompID) + { + gAssert(m_cgstbl == 1); + return m_vpgstbl[0]->ComponentIndexForGlyph(chwGlyphID, nCompID); + } + + bool IsEmpty() + { + return (m_cglf == 0); + } + +protected: + int m_cglf; // number of glyphs + int m_cComponents; // number of defined components + int m_cgstbl; // number of sub-tables, corresponding to font files; + // for now there is only one + + std::vector m_vpgstbl; + +}; + +} // namespace gr + +#endif // !GR_GTABLE_INCLUDED diff --git a/Build/source/libs/graphite/engine-2.4/src/segment/GrPass.cpp b/Build/source/libs/graphite/engine-2.4/src/segment/GrPass.cpp new file mode 100644 index 00000000000..dd0c7e2b2bc --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/src/segment/GrPass.cpp @@ -0,0 +1,2113 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 1999, 2001 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: GrPass.cpp +Responsibility: Sharon Correll +Last reviewed: Not yet. + +Description: + Implements the GrPass class and subclasses. +----------------------------------------------------------------------------------------------*/ + +//:>******************************************************************************************** +//:> Include files +//:>******************************************************************************************** +#include "Main.h" + +#ifdef _MSC_VER +#pragma hdrstop +#endif + +//:End Ignore + +//:>******************************************************************************************** +//:> Forward declarations +//:>******************************************************************************************** + +//:>******************************************************************************************** +//:> Local Constants and static variables +//:>******************************************************************************************** + +namespace gr +{ + +//:>******************************************************************************************** +//:> Methods +//:>******************************************************************************************** +/*---------------------------------------------------------------------------------------------- + Constructors and initializers +----------------------------------------------------------------------------------------------*/ +GrPass::GrPass(int i) + : m_ipass(i), + m_fxdVersion(0), + m_nMaxRuleContext(0), + m_pfsm(NULL), + m_nMaxRuleLoop(0), + m_nMaxBackup(0), + m_crul(0), + m_prgchwRuleSortKeys(NULL), + m_prgcritRulePreModContext(NULL), + m_cbPassConstraint(0), + m_prgibConstraintStart(NULL), + m_prgibActionStart(NULL), + m_prgbPConstraintBlock(NULL), + m_prgbConstraintBlock(NULL), + m_prgbActionBlock(NULL), + m_cbConstraints(0), + m_cbActions(0), + m_prgibConstraintDebug(NULL), + m_prgibRuleDebug(NULL), + m_fCheckRules(false), + m_prgfRuleOkay(NULL), + m_vnStack(128), + m_pzpst(NULL) +{ +} + +void PassState::InitForNewSegment(int ipass, int nMaxChunk) +{ + m_ipass = ipass; + m_nRulesSinceAdvance = 0; + m_nMaxChunk = nMaxChunk; + m_cslotSkipToResync = 0; + m_fDidResyncSkip = false; + m_islotPConstraintLim = -1; + m_nPConstraintResult = -1; + + InitializeLogInfo(); +} + +void PassState::InitializeLogInfo() +{ + m_crulrec = 0; + m_crngrec = 0; + std::fill_n(m_rgcslotDeletions, 128, 0); + std::fill_n(m_rgfInsertion, 128, false); +} + +/*---------------------------------------------------------------------------------------------- + Destructors +----------------------------------------------------------------------------------------------*/ +GrPass::~GrPass() +{ + delete m_pfsm; + + delete[] m_prgchwRuleSortKeys; + + delete[] m_prgcritRulePreModContext; + + delete[] m_prgibConstraintStart; + delete[] m_prgibActionStart; + + delete[] m_prgbPConstraintBlock; + delete[] m_prgbConstraintBlock; + delete[] m_prgbActionBlock; + + delete[] m_prgfRuleOkay; + + delete[] m_prgibConstraintDebug; + delete[] m_prgibRuleDebug; +} + +/*---------------------------------------------------------------------------------------------- + Fill in the pass by reading from the font stream. +----------------------------------------------------------------------------------------------*/ +bool GrPass::ReadFromFont(GrIStream & grstrm, int fxdSilfVersion, int fxdRuleVersion, + int nOffset, int cbPassLength) +{ + long lPassInfoStart; + grstrm.GetPositionInFont(&lPassInfoStart); + + m_fxdVersion = fxdSilfVersion; + + m_fCheckRules = (fxdRuleVersion > kRuleVersion); + +// Assert(nOffset == lPassInfoStart); + if (lPassInfoStart != nOffset) + { + grstrm.SetPositionInFont(nOffset); + } + + int nPassMax = nOffset + cbPassLength; + + // flags - ignore for now + //byte bTmp = grstrm.ReadByteFromFont(); + grstrm.ReadByteFromFont(); + + // MaxRuleLoop + m_nMaxRuleLoop = grstrm.ReadByteFromFont(); + + // max rule context + m_nMaxRuleContext = grstrm.ReadByteFromFont(); + + // MaxBackup + m_nMaxBackup = grstrm.ReadByteFromFont(); + + // number of rules + m_crul = grstrm.ReadShortFromFont(); + // TODO: add a sanity check for the number of rules. + + // offset to pass constraint code, relative to start of subtable + int nPConstraintOffset = 0; + long lFsmPos = -1; + if (fxdSilfVersion >= 0x00020000) + { + if (fxdSilfVersion >= 0x00030000) + lFsmPos = grstrm.ReadUShortFromFont() + nOffset; // offset to row info + else + grstrm.ReadShortFromFont(); // pad bytes + nPConstraintOffset = grstrm.ReadIntFromFont(); + if (nPConstraintOffset >= nPassMax) + return false; // bad font + } + // offset to rule constraint code, relative to start of subtable + long nConstraintOffset = grstrm.ReadIntFromFont(); + // offset to action code, relative to start of subtable + long nActionOffset = grstrm.ReadIntFromFont(); + // offset to debug strings; 0 if stripped + long nDebugOffset = grstrm.ReadIntFromFont(); + int cbConstraintLength = nActionOffset - nConstraintOffset; + if (cbConstraintLength < 0) + return false; + int cbActionLength = ((nDebugOffset == 0) ? nPassMax : nDebugOffset) - nActionOffset; + if (cbActionLength < 0) + return false; + //int cbDebugLength = nPassMax - nDebugOffset; + + // Jump to beginning of FSM, if we have this information. + if (fxdSilfVersion >= 0x00030000) + { + if (lFsmPos < nOffset || lFsmPos >= nPassMax) + return false; + grstrm.SetPositionInFont(lFsmPos); + } + else + { + // Otherwise assume that's where we are! + Assert(lFsmPos == -1); + grstrm.GetPositionInFont(&lFsmPos); + } + + m_pfsm = new GrFSM(); + + if (!m_pfsm->ReadFromFont(grstrm, fxdSilfVersion, m_crul, nPassMax - lFsmPos)) + return false; // bad font + + // rule sort keys + m_prgchwRuleSortKeys = new data16[m_crul]; + data16 * pchw = m_prgchwRuleSortKeys; + int irul; + for (irul = 0; irul < m_crul; irul++, pchw++) + { + *pchw = grstrm.ReadUShortFromFont(); + //if (*pchw > m_crul) + // return false; // probably a bad font--but this is recoverable + // @todo: figure out a better check here + } + + // rule pre-mod-context item counts + m_prgcritRulePreModContext = new byte[m_crul]; + byte * pb = m_prgcritRulePreModContext; + for (irul = 0; irul < m_crul; irul++, pb++) + { + *pb = grstrm.ReadByteFromFont(); + if (*pb > m_nMaxRuleContext) + return false; + } + + // constraint offset for pass-level constraints + if (fxdSilfVersion >= 0x00020000) + { + // reserved - pad byte + grstrm.ReadByteFromFont(); + m_cbPassConstraint = grstrm.ReadUShortFromFont(); + if (m_cbPassConstraint > nConstraintOffset - nPConstraintOffset) + return false; // bad font + } + else + m_cbPassConstraint = 0; + + // constraint and action offsets for rules + m_prgibConstraintStart = new data16[m_crul + 1]; + pchw = m_prgibConstraintStart; + for (irul = 0; irul <= m_crul; irul++, pchw++) + { + *pchw = grstrm.ReadUShortFromFont(); + if (*pchw > cbConstraintLength) + return false; // bad font + } + + m_prgibActionStart = new data16[m_crul + 1]; + pchw = m_prgibActionStart; + for (irul = 0; irul <= m_crul; irul++, pchw++) + { + *pchw = grstrm.ReadUShortFromFont(); + if (*pchw > cbActionLength) + return false; // bad font + } + + // FSM state table + grstrm.GetPositionInFont(&lFsmPos); + if (!m_pfsm->ReadStateTableFromFont(grstrm, fxdSilfVersion, nOffset + nConstraintOffset - lFsmPos)) + return false; + + if (fxdSilfVersion >= 0x00020000) + // reserved - pad byte + grstrm.ReadByteFromFont(); + + // Constraint and action blocks + int cb = m_cbPassConstraint; // pass constraints + m_prgbPConstraintBlock = new byte[cb]; + grstrm.ReadBlockFromFont(m_prgbPConstraintBlock, cb); + m_cbConstraints = cb; + + cb = m_prgibConstraintStart[m_crul]; // rule constraints + m_prgbConstraintBlock = new byte[cb]; + grstrm.ReadBlockFromFont(m_prgbConstraintBlock, cb); + m_cbConstraints += cb; + + cb = m_prgibActionStart[m_crul]; + m_prgbActionBlock = new byte[cb]; + grstrm.ReadBlockFromFont(m_prgbActionBlock, cb); + m_cbActions = cb; + + // Rule-validity flags + m_prgfRuleOkay = new bool[m_crul]; + for (irul = 0; irul < m_crul; irul++) + m_prgfRuleOkay[irul] = !m_fCheckRules; + + // TODO SharonC/AlanW: debuggers + + return true; +} + +/*---------------------------------------------------------------------------------------------- + Initialize a bogus pass with no rules. Currently this is used to make a single positioning + pass if there was none in the font. +----------------------------------------------------------------------------------------------*/ +void GrPass::InitializeWithNoRules() +{ + m_crul = 0; + m_nMaxRuleContext = 1; + m_nMaxRuleLoop = 1; + m_nMaxBackup = 0; + m_pfsm = NULL; + m_prgchwRuleSortKeys = NULL; + m_prgcritRulePreModContext = NULL; +} + +/*---------------------------------------------------------------------------------------------- + Extend the output stream by the given number of characters. + (Overridden by GrBidiPass.) + + @param ptman - table manager + @param psstrmIn/Out - streams being processed + @param cslotNeededByNext - the number of slots being requested by the following pass + @param twsh - how we are handling trailing white-space + @param pnRet - return value + @param pcslotGot - return the number of slots gotten + @param pislotFinalBreak - index of the final slot (LB or actual glyph), or -1; + adjusted when we are removing the trailing white-space and + so the end of the segment will be before the any actual + line-break slot + + @return kNextPass if we were able to generated the number requested, or processing is + complete; otherwise return the number of slots needed from the previous pass. +----------------------------------------------------------------------------------------------*/ +void GrPass::ExtendOutput(GrTableManager * ptman, + GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, + int cslotNeededByNext, TrWsHandling twsh, + int * pnRet, int * pcslotGot, int * pislotFinalBreak) +{ + // Kludge to generate an error in rendering: + //int z = 50; + //int t = ((5 * 10) / z) - 1; + //if (this->m_ipass == 4) + //{ + // int x; x = z / t; + //} + + int islotInitReadPos = psstrmIn->ReadPos(); + int islotInitWritePos = psstrmOut->WritePos(); + + int cslotToGet = max(cslotNeededByNext, + m_pzpst->NeededToResync() - psstrmOut->WritePos()); + int cslotGot = 0; + + gid16 chwLB = ptman->LBGlyphID(); + + // While we haven't got the number of slot we've been asked for, and there is enough + // available in the input, run rules, filling up the output. + + while ((cslotToGet > 0 && cslotGot < cslotToGet) + // Don't leave this pass until we've got the index offset. This is especially + // needed for input to the positioning pass, but it doesn't hurt to make it a + // general rule. + || !psstrmOut->GotIndexOffset() + // Don't leave this pass until all the slots to reprocess have been + // completely handled. + || (psstrmIn->SlotsToReprocess() > 0) + // Don't leave this pass until there is a complete cluster in the output + || (islotInitWritePos == psstrmOut->WritePos()) + || (psstrmOut->MaxClusterSlot(islotInitWritePos, psstrmOut->WritePos()) > 0)) + { + int cslotAvailable = psstrmIn->TotalSlotsPending(); + int cslotNeedMore = MaxRuleContext() - cslotAvailable + ptman->PrevPassMaxBackup(m_ipass); + + // This test should not be necessary, but just in case. + if (psstrmIn->PastEndOfPositioning(false)) + cslotNeedMore = 0; // the input stream is done + + if (// Not enough available in the input: + (cslotNeedMore > 0 && !psstrmIn->FullyWritten()) + + // && psstrmIn->SegLimIfKnown() == -1) && -- no, because substitution passes may need + // to consider slots beyond the seg limit + + // Positioning passes need to know where they are in relation to the initial + // line-break. + || (IsPosPass() && !psstrmIn->GotIndexOffset()) + + // The following can happen on backtracking, when we undo stuff before the + // beginning of the segment: + || !ptman->Pass(m_ipass - 1)->DidResyncSkip()) + { + // Ask previous pass for more input. + *pnRet = max(cslotNeedMore, 1); + *pnRet = max(*pnRet, cslotNeededByNext - cslotGot); + *pcslotGot = cslotGot; + return; + } + + Assert(ptman->Pass(m_ipass - 1)->DidResyncSkip()); + + bool fDoneThisPass = (cslotAvailable == 0); + if (psstrmIn->SlotsToReprocess() == 0) + { + fDoneThisPass = fDoneThisPass || + psstrmIn->PastEndOfPositioning(false) || + psstrmOut->PastEndOfPositioning(true); + } + + if (fDoneThisPass) + { + // No more input to process--this pass is done. + Assert(psstrmIn->SlotsToReprocess() == 0); + psstrmIn->ClearReprocBuffer(); + + if (twsh == ktwshNoWs && m_ipass == ptman->NumberOfLbPasses()) + { + *pnRet = RemoveTrailingWhiteSpace(ptman, psstrmOut, twsh, pislotFinalBreak); + if (*pnRet == kBacktrack) // entire segment was white-space: + return; // backtrack, which will fail + } + DoResyncSkip(psstrmOut); + DoCleanUpSegMin(ptman, psstrmIn, islotInitReadPos, psstrmOut); + DoCleanUpSegLim(ptman, psstrmOut, twsh); + psstrmOut->MarkFullyWritten(); + *pnRet = kNextPass; + *pcslotGot = cslotGot; + return; + } + + if (twsh == ktwshOnlyWs && m_ipass == ptman->NumberOfLbPasses() + 1) + { + // Note that this is the first pass after the linebreak pass, so psstrmInput + // is the output of the linebreak pass. + GrSlotState * pslotNext = psstrmIn->Peek(); + if (!pslotNext->IsLineBreak(chwLB) && + pslotNext->Directionality() != kdircWhiteSpace && + psstrmIn->SegMin() > -1 && psstrmIn->SegMin() <= psstrmIn->ReadPos()) + { + // We are only allowing white-space in this segment and we hit + // something else. Don't process any further. + if (psstrmIn->SegLimIfKnown() > -1 && + psstrmIn->SegLimIfKnown() <= psstrmIn->ReadPos()) + { + // Already inserted a line-break; we're done. + DoResyncSkip(psstrmOut); + psstrmOut->MarkFullyWritten(); + *pnRet = kNextPass; + *pcslotGot = cslotGot; + return; + } + while (psstrmIn->SlotsToReprocess() > 0) + { + psstrmOut->CopyOneSlotFrom(psstrmIn); + psstrmOut->SetPosForNextRule(0, psstrmIn, IsPosPass()); + } + psstrmIn->ClearReprocBuffer(); + *pnRet = kBacktrack; + return; + } + } + + // Otherwise, we have enough input to run a rule. + + psstrmIn->SetRuleStartReadPos(); + psstrmOut->SetRuleStartWritePos(); + + int ruln = -1; + if (m_pzpst->PassConstraintSucceeds(ptman, this, psstrmIn, psstrmOut)) + { + if (m_pfsm) + ruln = m_pfsm->GetRuleToApply(ptman, this, psstrmIn, psstrmOut); + ruln = CheckRuleValidity(ruln); + } + RunRule(ptman, ruln, psstrmIn, psstrmOut); + + cslotGot = psstrmOut->WritePos() - islotInitWritePos; + psstrmOut->CalcIndexOffset(ptman); + } + + DoResyncSkip(psstrmOut); + DoCleanUpSegMin(ptman, psstrmIn, islotInitReadPos, psstrmOut); + + // We're past the point where we care about anything in the reprocessing buffer. + Assert(psstrmIn->NoReproc()); + psstrmIn->ClearReprocBuffer(); + + if (psstrmOut->PastEndOfPositioning(true)) + { + DoCleanUpSegLim(ptman, psstrmOut, twsh); + psstrmOut->MarkFullyWritten(); + } + + *pnRet = kNextPass; + *pcslotGot = cslotGot; +} + +/*---------------------------------------------------------------------------------------------- + Extend the output stream by the given number of characters. + For a GrBidiPass, if we are at a direction change, get the entire + range of upstream glyphs, reverse them, and treat them as one chunk. + Otherwise just pass one slot through. + + @param ptman - table manager + @param psstrmInput/Output - streams being processed + @param cslotNeededByNext - the number of slots being requested by the following pass + @param twsh - how we are handling trailing white-space + @param pnRet - return value + @param pcslotGot - return the number of slots gotten + @param pislotFinalBreak - not used in this version + + @return 1 if we need more glyphs from the previous pass +----------------------------------------------------------------------------------------------*/ +void GrBidiPass::ExtendOutput(GrTableManager * ptman, + GrSlotStream* psstrmIn, GrSlotStream* psstrmOut, + int cslotNeededByNext, TrWsHandling twsh, + int * pnRet, int * pcslotGot, int * /*pislotFinalBreak*/) +{ + Assert(psstrmIn->SlotsToReprocess() == 0); + + int islotInitReadPos = psstrmIn->ReadPos(); + int islotInitWritePos = psstrmOut->WritePos(); + + Assert(m_pzpst->NeededToResync() == 0); + + int cslotToGet = max(cslotNeededByNext, + m_pzpst->NeededToResync() - psstrmOut->WritePos()); + int cslotGot = 0; + int nTopDir; + if (twsh == ktwshOnlyWs) + nTopDir = (ptman->State()->ParaRightToLeft()) ? 1 : 0; + else + nTopDir = ptman->TopDirectionLevel(); + + while (cslotToGet > 0 && cslotGot < cslotToGet) + { + int islotChunkO = psstrmOut->WritePos(); + int islotChunkI = psstrmIn->ReadPos(); + + // Need at least one character to test. + if (psstrmIn->SlotsPending() < 1 || !ptman->Pass(m_ipass-1)->DidResyncSkip()) + { + if (!psstrmIn->FullyWritten()) + { + // Ask previous pass for more input. + *pnRet = max(cslotToGet - psstrmIn->SlotsPending(), 1); + *pnRet = max(*pnRet, cslotNeededByNext - cslotGot); + *pcslotGot = cslotGot; + return; + } + else + { + Assert(ptman->Pass(m_ipass-1)->DidResyncSkip()); + Assert(psstrmIn->SlotsToReprocess() == 0); + psstrmIn->ClearReprocBuffer(); + DoResyncSkip(psstrmOut); + DoCleanUpSegMin(ptman, psstrmIn, islotInitReadPos, psstrmOut); + DoCleanUpSegLim(ptman, psstrmOut, twsh); + psstrmOut->MarkFullyWritten(); + *pnRet = kNextPass; + *pcslotGot = cslotGot; + return; + } + } + + std::vector vislotStarts; + std::vector vislotStops; + int islotReverseLim = psstrmIn->DirLevelRange(ptman->State(), + psstrmIn->ReadPos(), nTopDir, + vislotStarts, vislotStops); + //int islotReverseLim = psstrmIn->OldDirLevelRange(pengst, psstrmIn->ReadPos(), nTopDir); + if (islotReverseLim == -1) + { + // We haven't got the full range of reversed text yet-- + // ask for more input. + *pnRet = max(1, cslotNeededByNext - cslotGot); + *pcslotGot = cslotGot; + return; + } + + // Okay, we have enough input to do the reversal, if any. + + int cslotToReverse = islotReverseLim - psstrmIn->ReadPos(); + + // Never reverse the final linebreak; leave it at the end. + if (cslotToReverse > 0 && islotReverseLim > 0) + { + GrSlotState * pslotLast = psstrmIn->SlotAt(islotReverseLim - 1); + if (pslotLast->IsFinalLineBreak(ptman->LBGlyphID())) + { + for (size_t i = 0; i < vislotStops.size(); i++) + if (vislotStops.back() == islotReverseLim - 1) + vislotStops.back() = islotReverseLim - 2; + islotReverseLim--; + cslotToReverse--; + } + } + + psstrmIn->SetRuleStartReadPos(); + psstrmOut->SetRuleStartWritePos(); + + if (cslotToReverse == 0) + { + psstrmOut->CopyOneSlotFrom(psstrmIn); + } + else + { + int islotNextWritePos = psstrmOut->WritePos() + cslotToReverse; + int islotNextReadPos = psstrmIn->ReadPos() + cslotToReverse; + if (vislotStarts.size() == 0) + { + Assert(false); // this should have been done by DirLevelRange + vislotStarts.push_back(psstrmIn->ReadPos()); + vislotStops.push_back(islotNextReadPos - 1); + } + Assert(vislotStarts.back() == psstrmIn->ReadPos()); + Assert(vislotStops.back() == islotNextReadPos - 1); + int cslotNotCopied = Reverse(ptman, psstrmIn, psstrmOut, vislotStarts, vislotStops); + //Reverse(nTopDir + 1, + // psstrmIn, psstrmIn->ReadPos(), islotReverseLim, + // psstrmOut, psstrmOut->WritePos() + cslotToReverse - 1, psstrmOut->WritePos()-1); + + islotNextWritePos -= cslotNotCopied; // bidi markers that are not passed through + + psstrmIn->SetReadPos(islotNextReadPos); + psstrmOut->SetWritePos(islotNextWritePos); + + // It's quite strange to have the segment start or end in the middle of stuff to + // reverse (because the LB forms a natural terminator), but at any rate, + // if that happens, record the segment lim at the corresponding place in the + // output stream. + int islotSegMinIn = psstrmIn->SegMin(); + if (islotSegMinIn > -1 && + psstrmIn->ReadPos() - cslotToReverse <= islotSegMinIn && + islotSegMinIn < psstrmIn->ReadPos()) + { + Assert(islotSegMinIn == psstrmIn->ReadPos() - cslotToReverse); // normal situation + psstrmOut->SetSegMin( + psstrmOut->WritePos() - (psstrmIn->ReadPos() - islotSegMinIn)); + } + int islotSegLimIn = psstrmIn->SegLimIfKnown(); + if (islotSegLimIn > -1 && + psstrmIn->ReadPos() - cslotToReverse <= islotSegLimIn && + islotSegLimIn < psstrmIn->ReadPos()) + { + Assert(islotSegLimIn == psstrmIn->ReadPos() - cslotToReverse); // normal situation + psstrmOut->SetSegLim( + psstrmOut->WritePos() - (psstrmIn->ReadPos() - islotSegLimIn)); + } + } + + psstrmOut->SetPosForNextRule(0, psstrmIn, false); + + // Record the chunk mappings: + MapChunks(psstrmIn, psstrmOut, islotChunkI, islotChunkO, 0); + + cslotGot = psstrmOut->WritePos() - islotInitWritePos; + psstrmOut->CalcIndexOffset(ptman); + } + + DoResyncSkip(psstrmOut); + DoCleanUpSegMin(ptman, psstrmIn, islotInitReadPos, psstrmOut); + + // We're past the point where we care about anything in the reprocessing buffer. + Assert(psstrmIn->NoReproc()); + psstrmIn->ClearReprocBuffer(); + + Assert(psstrmIn->SlotsToReprocess() == 0); + + if (psstrmOut->PastEndOfPositioning(true)) + { + DoCleanUpSegLim(ptman, psstrmOut, twsh); + psstrmOut->MarkFullyWritten(); + } + + *pnRet = kNextPass; + *pcslotGot = cslotGot; +} + +/*---------------------------------------------------------------------------------------------- + Generate slots containing glyph IDs for the underlying character data, + incrementing the input pointer as we go. + + @param ptman - table manager + @param pchstrm - input character stream + @param psstrmOutput - output slot stream + @param ichSegLim - known end of segment, index into the text; or -1; + the lim of the of char-stream itself represents + the end of the text-source; this lim is the + known desired end of the segment + @param cchwPostXlbContext - number of characters that may be needed from the following line; + valid when ichSegLim > -1 + @param lb - breakweight to use for inserted LB + @param cslotToGet - the number of slots being requested by the following pass + @param fNeedFinalBreak - true if the end of the segment needs to be a valid break point + @param pislotFinalBreak - the end of this segment +----------------------------------------------------------------------------------------------*/ +int GrPass::ExtendGlyphIDOutput(GrTableManager * ptman, + GrCharStream * pchstrm, GrSlotStream * psstrmOut, int ichSegLim, int cchwPostXlbContext, + LineBrk lb, int cslotToGet, bool fNeedFinalBreak, TrWsHandling twsh, + int * pislotFinalBreak) +{ + EngineState * pengst = ptman->State(); + + // This pass should be the glyph-generation pass. + Assert(dynamic_cast(this)); + Assert(m_pzpst->m_cslotSkipToResync == 0); + m_pzpst->m_fDidResyncSkip = true; + + for (int islot = 0; islot < cslotToGet; ++islot) + { + int islotChunkO = psstrmOut->WritePos(); + int islotChunkI = pchstrm->SegOffset(); + + if (pchstrm->AtEnd() + || (ichSegLim > -1 && pchstrm->Pos() == ichSegLim)) + { + if (psstrmOut->SegLimIfKnown() > -1 && + psstrmOut->SegLimIfKnown() <= psstrmOut->WritePos()) + { + // Already found the end of this stream. + } + else + { + if (pchstrm->EndLine() && !fNeedFinalBreak) + // (if we need a good final break, don't just append an LB; + // make it backtrack and find a valid break point) + { + // Only need to get a good break when we're backtracking; otherwise we + // already know it. + Assert(ichSegLim == -1 || !fNeedFinalBreak); + // Notice that we're cheating here: we're putting the LB in the zeroth + // stream instead of in the output of the linebreak table. + psstrmOut->AppendLineBreak(ptman, pchstrm, + (pchstrm->AtEnd() ? klbWordBreak : lb), + ((ptman->RightToLeft()) ? kdircRlb : kdircLlb), -1, false, + pchstrm->SegOffset()); + if (pchstrm->AtEnd()) + pengst->SetFinalLB(); + else + pengst->SetInsertedLB(true); + } + else + { + // Don't actually insert a line-break glyph. + psstrmOut->SetSegLimToWritePos(); + } + *pislotFinalBreak = psstrmOut->WritePos() - 1; + if (ptman->NumberOfLbPasses() > 0 && pengst->HasInitialLB()) + { + // Because we cheated above: the output stream of the linekbreak table + // has an initial LB, which this stream doesn't have. Adjust the position + // of the final break to match what it will be in the output of the + // lb table. + *pislotFinalBreak += 1; + } + } + + if (twsh == ktwshNoWs && m_ipass == ptman->NumberOfLbPasses()) + { + int nRet = RemoveTrailingWhiteSpace(ptman, psstrmOut, twsh, pislotFinalBreak); + if (nRet == kBacktrack) // entire segment was white-space: + return kBacktrack; // backtrack, which will fail + } + if (pchstrm->AtEnd()) + { + psstrmOut->MarkFullyWritten(); + // If all the characters use the same feature settings, tell the table-manager + // in order to optimize running pass constraints. + if (psstrmOut->NoFeatureChanges()) + ptman->SetFeatureVariations(false); + return kNextPass; + } + // otherwise we may need a few more characters for line-boundary contextualization. + } + + int ichwSegOffset; // offset from the official start of the segment + int cchw; // number of 16-bit chars consumed + GrFeatureValues fval; + int nUnicode = pchstrm->NextGet(ptman, &fval, &ichwSegOffset, &cchw); + gid16 chwGlyphID = ptman->GetGlyphIDFromUnicode(nUnicode); + + if (nUnicode == knCR || nUnicode == knLF || nUnicode == knLineSep || nUnicode == knParaSep || + nUnicode == knORC) + { + // Hard line-break: we're done. + // Note that we don't include the hard-break character in this segment. + pchstrm->HitHardBreak(); + pengst->SetHitHardBreak(); + psstrmOut->MarkFullyWritten(); + return kNextPass; + } + + GrSlotState * pslotNew; + ptman->State()->NewSlot(chwGlyphID, fval, 0, ichwSegOffset, nUnicode, &pslotNew); + + psstrmOut->NextPut(pslotNew); + psstrmOut->MapInputChunk(islotChunkI, islotChunkO, pchstrm->SegOffset(), false, false); + // Mapping the output chunks of the char stream has already been handled by the + // char stream. + + } + + psstrmOut->CalcIndexOffset(ptman); + + if (psstrmOut->PastEndOfPositioning(true) + || (ichSegLim > -1 && pchstrm->Pos() > ichSegLim + cchwPostXlbContext)) + { + // We have enough for this segment. + psstrmOut->MarkFullyWritten(); + } + + return kNextPass; +} + +/*---------------------------------------------------------------------------------------------- + Extend the output stream until it is using up the allotted amount of + physical space. Return kNextPass when all data has been processed successfully. + Return kBacktrack when space overflows, indicating that we need to backtrack + and find a break point. Otherwise, return the number of slots we + need from the previous pass. + + @param fWidthIsCharCount - kludge for test procedures + @param fInfiniteWidth - don't test for more space + @param fMustBacktrack - true if we need a good final break and haven't found one yet + @param lbMax - max allowed for the final slot + @param twsh - how we are handling trailing white-space +----------------------------------------------------------------------------------------------*/ +int GrPass::ExtendFinalOutput(GrTableManager * ptman, + GrSlotStream * psstrmInput, GrSlotStream * psstrmOutput, + float xsSpaceAllotted, bool fWidthIsCharCount, bool fInfiniteWidth, + bool fHaveLineBreak, bool fMustBacktrack, LineBrk /*lbMax*/, TrWsHandling twsh, + int * pislotLB, float * pxsWidth) +{ + EngineState * pengst = ptman->State(); + + // This pass should be the final positioning pass. + Assert(dynamic_cast(this)); + + // It would be very strange to be positioning based on something that happened in + // previous line. -- not true any more, since this will include the max-precontext-length. +// Assert(m_cslotSkipToResync == 0); + + int islotOutputLB = -1; + //int islotInitWritePos = psstrmOutput->WritePos(); + int islotNoLbUpTo = psstrmOutput->WritePos();; + + while (true) + { + // Do this right up front, so we are only measuring actual output. + if (m_pzpst->CanResyncSkip(psstrmOutput)) + m_pzpst->DoResyncSkip(psstrmOutput); + + bool fMoreSpace; + if (!m_pzpst->DidResyncSkip()) + fMoreSpace = true; + else if (fInfiniteWidth) + fMoreSpace = true; + else + fMoreSpace = psstrmOutput->MoreSpace(ptman, + xsSpaceAllotted, fWidthIsCharCount, + true, // always ignore trailing white space when we are first making the segment + twsh, + pxsWidth); + if (!fMoreSpace) + { + // Overflowed available space; backtrack and find a line break. + while (psstrmInput->SlotsToReprocess() > 0) + { + psstrmOutput->CopyOneSlotFrom(psstrmInput); + psstrmOutput->SetPosForNextRule(0, psstrmInput, IsPosPass()); + } + psstrmInput->ClearReprocBuffer(); + + *pislotLB = -1; + pengst->SetExceededSpace(); + pengst->SetHitHardBreak(false); + return kBacktrack; + } + + if (islotOutputLB != -1 && psstrmInput->SlotsToReprocess() == 0) + { + // Hit the inserted line break--we're done. + psstrmInput->ClearReprocBuffer(); + *pislotLB = islotOutputLB; + return kNextPass; + } + + int nslotAvailable = psstrmInput->SlotsPending(); + if ((nslotAvailable - ptman->PrevPassMaxBackup(m_ipass) + < MaxRuleContext() && !psstrmInput->FullyWritten()) + || !ptman->Pass(m_ipass-1)->DidResyncSkip()) + { + // Not enough available in the input--ask previous pass for more input. + // Ten is an arbitrary value--we ask for more that we really need to cut down + // on the number of times we loop between passes. + return max(MaxRuleContext() - (nslotAvailable - 10), 1); + } + + Assert(ptman->Pass(m_ipass - 1)->DidResyncSkip()); + + if (nslotAvailable == 0) + { + // No more input to process. If we have a valid line-break, or we don't care, + // we're done. Otherwise backtrack to find a valid break point. + Assert(psstrmInput->SlotsToReprocess() == 0); + psstrmInput->ClearReprocBuffer(); + if (fMustBacktrack) + { + *pislotLB = -1; + return kBacktrack; + } + else + { + psstrmOutput->MarkFullyWritten(); + return kNextPass; + } + } + + // Otherwise, we have enough input to run a rule. + + psstrmInput->SetRuleStartReadPos(); + psstrmOutput->SetRuleStartWritePos(); + + int ruln = -1; + if (m_pfsm) + ruln = m_pfsm->GetRuleToApply(ptman, this, psstrmInput, psstrmOutput); + ruln = CheckRuleValidity(ruln); + RunRule(ptman, ruln, psstrmInput, psstrmOutput); + + if (fHaveLineBreak) + { + islotOutputLB = + psstrmOutput->FindFinalLineBreak(ptman->LBGlyphID(), + islotNoLbUpTo, psstrmOutput->WritePos()); + islotNoLbUpTo = psstrmOutput->WritePos(); + } + + psstrmOutput->CalcIndexOffset(ptman); + } + + Assert(false); + + psstrmInput->ClearReprocBuffer(); + *pislotLB = -1; + return kNextPass; +} + +/*---------------------------------------------------------------------------------------------- + Remove undesirable trailing white-space. +----------------------------------------------------------------------------------------------*/ +int GrPass::RemoveTrailingWhiteSpace(GrTableManager * ptman, GrSlotStream * psstrmOut, +#ifdef NDEBUG + TrWsHandling /*twsh*/, int * pislotFinalBreak) +#else + TrWsHandling twsh, int * pislotFinalBreak) +#endif +{ + EngineState * pengst = ptman->State(); + + Assert(twsh == ktwshNoWs); + Assert(m_ipass == ptman->NumberOfLbPasses()); // output of (final) lb pass + + int islotTmp = psstrmOut->FinalSegLim(); + if (islotTmp <= 0) + return kNextPass; + + GrSlotState * pslotLast = psstrmOut->SlotAt(islotTmp-1); + if (islotTmp > 0 && pslotLast->IsFinalLineBreak(ptman->LBGlyphID())) + { + islotTmp--; + pslotLast = (islotTmp > 0) ? psstrmOut->SlotAt(islotTmp-1) : NULL; + } + bool fRemovedWs = false; + while (islotTmp > 0 && pslotLast->Directionality() == kdircWhiteSpace) + { + islotTmp--; + pslotLast = (islotTmp > 0) ? psstrmOut->SlotAt(islotTmp-1) : NULL; + fRemovedWs = true; + } + if (fRemovedWs) + { + if (islotTmp <= 0) + { + // Entire segment was white-space: backtrack, which will fail. + return kBacktrack; + } + psstrmOut->SetSegLim(islotTmp); + *pislotFinalBreak = islotTmp - 1; + pengst->SetFinalLB(false); + pengst->SetRemovedTrWhiteSpace(); + ptman->UnwindAndReinit(islotTmp - 1); + } + + return kNextPass; +} + +/*---------------------------------------------------------------------------------------------- + Keep track of whether we're advancing through the input satisfactorily; + if not, forcibly advance. This is a safety net to avoid infinite loops; it + should never be necessary if they've set up their tables right. +----------------------------------------------------------------------------------------------*/ +void GrPass::CheckInputProgress(GrSlotStream * psstrmInput, GrSlotStream * psstrmOutput, + int /*islotOrigInput*/) +{ + int islotInput = psstrmInput->ReadPosForNextGet(); +// Assert(islotInput >= islotOrigInput); -- no longer true now that we can back up + + if (islotInput <= psstrmInput->ReadPosMax()) + { + // Didn't advance. + if (m_pzpst->m_nRulesSinceAdvance >= m_nMaxRuleLoop) + { + bool fAdvanced = false; + // Forcibly advance. First try to advance to where we backed up from. + while (!psstrmInput->AtEnd() && + psstrmInput->ReadPosForNextGet() < psstrmInput->ReadPosMax()) + { + RecordHitMaxRuleLoop(psstrmInput->ReadPosForNextGet()); + psstrmOutput->CopyOneSlotFrom(psstrmInput); + fAdvanced = true; + } + // If that didn't do anything productive, just advance one slot. + if (!fAdvanced && !psstrmInput->AtEndOfContext()) + { + RecordHitMaxRuleLoop(psstrmInput->ReadPosForNextGet()); + psstrmOutput->CopyOneSlotFrom(psstrmInput); + } + + m_pzpst->m_nRulesSinceAdvance = 0; + } + else m_pzpst->m_nRulesSinceAdvance++; + } + else m_pzpst->m_nRulesSinceAdvance = 0; + + psstrmInput->SetReadPosMax(islotInput); +} + +/*---------------------------------------------------------------------------------------------- + Record the chunks in the streams' chunk maps. + + psstrmIn/Out - streams being processed + islotChunkIn/Out - start of chunks + cslotReprocessed - number of slots to reprocess before the rule was run +----------------------------------------------------------------------------------------------*/ +void GrPass::MapChunks(GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, + int islotChunkIn, int islotChunkOut, int cslotReprocessed) +{ + if (islotChunkOut > psstrmOut->WritePos()) + { + // backing up + int islotReadPosTmp = psstrmIn->ReadPosForNextGet(); +/// Assert((islotChunkIn - islotReadPosTmp) == (islotChunkOut - psstrmOut->WritePos())); +// psstrmIn->MapOutputChunk(psstrmOut->WritePos() - 1, islotReadPosTmp - 1, +// islotChunkOut, true, 0, true); +// psstrmOut->MapInputChunk(islotReadPosTmp - 1, psstrmOut->WritePos() - 1, +// islotChunkIn, true, true); + + // Resync. + if (psstrmOut->WritePos() == 0) + { + // Clear all the chunks. + psstrmIn->MapOutputChunk(-1, -1, 0, true, 0, true); + psstrmOut->MapInputChunk(-1, -1, islotReadPosTmp, true, true); + psstrmIn->AssertChunkMapsValid(psstrmOut); + return; + } + else if (islotReadPosTmp == 0) + { + // Clear all the chunks. + psstrmIn->MapOutputChunk(-1, -1, psstrmOut->WritePos(), true, 0, true); + psstrmOut->MapInputChunk(-1, -1, 0, true, true); + psstrmIn->AssertChunkMapsValid(psstrmOut); + return; + } + // Find the beginning of the current chunk. + int islotChunkOutAdj = min(islotChunkOut, psstrmOut->WritePos() - 1); + int islotChunkInAdj = psstrmOut->ChunkInPrev(islotChunkOutAdj); + while (islotChunkInAdj == -1 && islotChunkOutAdj > 0) + islotChunkInAdj = psstrmOut->ChunkInPrev(--islotChunkOutAdj); + + if (islotChunkInAdj == -1) + { + // Couldn't find the beginning of any chunk; zap them all. + psstrmIn->MapOutputChunk(-1, -1, psstrmOut->WritePos(), true, 0, true); + psstrmOut->MapInputChunk(-1, -1, psstrmOut->ReadPos(), true, true); + psstrmIn->AssertChunkMapsValid(psstrmOut); + return; + } + + if (psstrmIn->ChunkInNext(islotChunkInAdj) != islotChunkOutAdj) + { + islotChunkOutAdj = psstrmIn->ChunkInNext(islotChunkInAdj); + while (islotChunkOutAdj == -1 && islotChunkInAdj > 0) + islotChunkOutAdj = psstrmIn->ChunkInNext(--islotChunkInAdj); + } + + psstrmIn->MapOutputChunk(islotChunkOutAdj, islotChunkInAdj, + psstrmOut->WritePos(), false, 0, true); + psstrmOut->MapInputChunk(islotChunkInAdj, islotChunkOutAdj, + psstrmIn->ReadPos(), false, true); + } + else if (islotChunkOut == psstrmOut->WritePos()) + // no output generated--continue the previous chunk + ; + else if (islotChunkIn == psstrmIn->ReadPos()) + // no input consumed + ; + else + { + psstrmIn->MapOutputChunk(islotChunkOut, islotChunkIn, psstrmOut->WritePos(), + (cslotReprocessed > 0), cslotReprocessed, false); + psstrmOut->MapInputChunk(islotChunkIn, islotChunkOut, psstrmIn->ReadPos(), + (cslotReprocessed > 0), false); + } + + psstrmIn->AssertChunkMapsValid(psstrmOut); + + m_pzpst->m_nMaxChunk = max(m_pzpst->m_nMaxChunk, psstrmIn->LastNextChunkLength()); +} + +/*---------------------------------------------------------------------------------------------- + This method is something of a kludge. During the course of running the rules we try to + keep track of the seg-min location, but sometimes that gets confused due to insertions + and deletions at the segment boundaries. +----------------------------------------------------------------------------------------------*/ +void GrSubPass::DoCleanUpSegMin(GrTableManager * ptman, + GrSlotStream * psstrmIn, int islotInitReadPos, GrSlotStream * psstrmOut) +{ + int islotSegMinIn = psstrmIn->SegMin(); + if (islotSegMinIn == -1) + return; // input doesn't even know it + if (islotInitReadPos > islotSegMinIn) + return; // should already have figured it out + + // Otherwise this batch of processing likely set the seg-min on the output stream, + // so check it out. + + // First, if the seg-min of the input stream is zero, it should be zero on the output. + if (islotSegMinIn == 0) + { + psstrmOut->SetSegMin(0, true); + return; + } + + // If there is an initial line-break, the seg-min should be just before it. + int islot; + if (ptman->State()->HasInitialLB()) + { + gid16 chwLB = ptman->LBGlyphID(); + + // Unfortunately, the seg-min from the previous segment can get off, too. :-( + // Fix it, while we're at it. + if (!psstrmIn->SlotAt(islotSegMinIn)->IsInitialLineBreak(chwLB)) + { + for (islot = 0; islot < psstrmIn->ReadPos(); islot++) + if (psstrmIn->SlotAt(islot)->IsInitialLineBreak(chwLB)) + { + psstrmIn->SetSegMin(islot, true); + break; + } + } + if (psstrmOut->SegMin() > -1 + && psstrmOut->SlotAt(psstrmOut->SegMin())->IsInitialLineBreak(chwLB)) + { + return; // already okay + } + for (islot = 0; islot < psstrmOut->WritePos(); islot++) + if (psstrmOut->SlotAt(islot)->IsInitialLineBreak(chwLB)) + { + psstrmOut->SetSegMin(islot, true); + return; + } + Assert(false); // couldn't find it + } + + // Otherwise, figure it out using the associations. First observe that the seg-min + // will be in the corresponding chunk to the seg-min of the previous pass. + int islotChunkMinIn = psstrmIn->ChunkInNextMin(islotSegMinIn); + int islotChunkLimIn = psstrmIn->ChunkInNextLim(islotSegMinIn); + if (islotChunkMinIn == -1) islotChunkMinIn = 0; + if (islotChunkLimIn == -1) islotChunkLimIn = 1; + + int islotChunkMinOut = psstrmIn->ChunkInNext(islotChunkMinIn); + int islotChunkLimOut = psstrmIn->ChunkInNext(islotChunkLimIn); + if (islotChunkMinOut == -1) islotChunkMinOut = 0; + if (islotChunkLimOut == -1) islotChunkLimOut = 1; + + int islotSegMinOut = psstrmOut->SegMin(); + if (islotSegMinOut == -1) + { + // No reasonable guess; try to figure it out. + for (islot = islotChunkMinOut; islot < islotChunkLimOut; islot++) + { +// GrSlotState * pslotOut = psstrmOut->SlotAt(islot); + if (psstrmOut->SlotAt(islot)->BeforeAssoc() == 0) + { + islotSegMinOut = islot; + break; + } + } + if (islotSegMinOut == -1) + { + // Ick, couldn't figure it out. Let's hope we set it to something reasonable earlier. + Assert(psstrmOut->SegMin() > -1); + return; + } + } + // else we have a reasonable guess + + // islotSegMinOut is the best or at leastfirst slot in the chunk that maps into the segment. + // But if there is an adjacent slot inserted before it and it is in the chunk, + // we want to include that also. + while (islotSegMinOut > islotChunkMinOut + && psstrmOut->SlotAt(islotSegMinOut-1)->BeforeAssoc() >= 0) + { + islotSegMinOut--; + } + psstrmOut->SetSegMin(islotSegMinOut, true); +} + +/*---------------------------------------------------------------------------------------------- + This method is something of a kludge. We try to put inserted glyphs after the final + line-break, but if we don't have line break, they should go inside the segment. + This method is only called after the pass is fully written. +----------------------------------------------------------------------------------------------*/ +void GrSubPass::DoCleanUpSegLim(GrTableManager * ptman, GrSlotStream * psstrmOut, + TrWsHandling twsh) +{ + int islotSegLimOut = psstrmOut->SegLimIfKnown(); + if (islotSegLimOut == -1) + return; // output hasn't set it; nothing to fix + + if (twsh == ktwshNoWs) + return; // we just stripped off the whitespace; don't put it back! + + //gid16 chwLB = ptman->LBGlyphID(); + // If there is a LB glyph, it should be at islotSegLimOut-- + // unless we backtracked an inserted one earlier. + if (ptman->State()->HasInsertedLB()) // && psstrmOut->SlotAt(islotSegLimOut)->IsFinalLineBreak(chwLB)) + return; + + // Okay, no LB; make sure all output glyphs are included in this segment. + psstrmOut->SetSegLimToWritePos(true); +} + +/*---------------------------------------------------------------------------------------------- + If we are in a state where we are supposed to skip some of the initial output, + do so. The purpose of this is to resync when restarting for a segment other than the + first. Caller should ensure that there are enough slots to skip. +----------------------------------------------------------------------------------------------*/ +int PassState::DoResyncSkip(GrSlotStream * psstrmOutput) +{ + if (m_fDidResyncSkip) + return 0; + + if (m_cslotSkipToResync == 0) + { + m_fDidResyncSkip = true; + return 0; + } + + if (!CanResyncSkip(psstrmOutput)) + { + Assert(false); // caller makes sure this doesn't happen + return (m_cslotSkipToResync - psstrmOutput->WritePos()); + } + + psstrmOutput->ResyncSkip(m_cslotSkipToResync); + m_fDidResyncSkip = true; + + return 0; +} + +/*---------------------------------------------------------------------------------------------- + Run a constraint for a single rule. + + @param ruln - rule to test + @param psstrmIn - input stream + @param psstrmOut - for accessing items in the pre-context + @param cslotPreModContext - the number of items that need to be tested prior to the + current stream position + @param cslotMatched - the number of items matched after the current stream position +----------------------------------------------------------------------------------------------*/ +bool GrPass::RunConstraint(GrTableManager * ptman, int ruln, + GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, + int cslotPreModContext, int cslotMatched) +{ + int nRet = 0; + + if (m_prgibConstraintStart == NULL) + return true; + + int biStart = int(m_prgibConstraintStart[ruln]); + if (biStart == 0) + return true; // no constraints + + for (int islot = -cslotPreModContext; islot < cslotMatched; islot++) + { + nRet = RunCommandCode(ptman, m_prgbConstraintBlock + biStart, true, + psstrmIn, psstrmOut, islot); + + if (nRet == 0) // one slot failed + return false; + } + + return (nRet != 0); +} + +/*---------------------------------------------------------------------------------------------- + See if pass-level constraints are succeeding, or if we need to run them. + + @param ptman - table manager + @param ppass - this PassState's pass + @param psstrmIn - input stream + @param psstrmOut - for accessing items in the pre-context +----------------------------------------------------------------------------------------------*/ +bool PassState::PassConstraintSucceeds(GrTableManager * ptman, GrPass * ppass, + GrSlotStream * psstrmIn, GrSlotStream * psstrmOut) +{ + if (m_islotPConstraintLim > psstrmIn->ReadPos() && m_nPConstraintResult != -1) + { + // Constraint result is known for this slot. + return (m_nPConstraintResult > 0)? true : false; + } + + m_nPConstraintResult = ppass->RunPassConstraint(ptman, psstrmIn, psstrmOut); + + if (!ptman->FeatureVariations()) + { + m_islotPConstraintLim = 100000; + } + else + { + // Determine the range of slots that have the same features as the current slot, + // and set the slot index to the end of that range. + m_islotPConstraintLim = psstrmIn->FeatureRangeLim(psstrmOut); + } + + RecordPassRange(psstrmIn->ReadPos(), m_islotPConstraintLim, (m_nPConstraintResult != 0)); + + return (m_nPConstraintResult != 0)? true : false; +} + +/*---------------------------------------------------------------------------------------------- + Run a pass-level constraint for this pass. + + @param psstrmIn - input stream + @param psstrmOut - for accessing items in the pre-context +----------------------------------------------------------------------------------------------*/ +bool GrPass::RunPassConstraint(GrTableManager * ptman, + GrSlotStream * psstrmIn, GrSlotStream * psstrmOut) +{ + int nRet = 0; + + if (m_cbPassConstraint == 0) // no test + return true; + if (m_prgbPConstraintBlock == NULL) // no test + return true; + + nRet = RunCommandCode(ptman, m_prgbPConstraintBlock, true, psstrmIn, psstrmOut, 0); + + return (nRet != 0); +} + +/*---------------------------------------------------------------------------------------------- + Check that we can interpret all the commands in the rule. If not, return -1 indicating + that we don't want to run a rule after all. This can happen when the version of the compiler + that generated the font is later than this engine. +----------------------------------------------------------------------------------------------*/ +int GrPass::CheckRuleValidity(int ruln) +{ + if (ruln == -1) + return -1; + + if (m_prgfRuleOkay[ruln]) + return ruln; + + int biStart = m_prgibActionStart[ruln]; + byte * pbNext = m_prgbActionBlock + biStart; + + // General purpose variables: +// int arg1, arg2, arg3, arg4; + int nSlotRef; + int nInputClass; + int nOutputClass; + int c; + int islotArg; + int nIndex; + int nGlyphAttr; + int nAttLevel; + int nFeat; + int nPState; +// SlotAttrName slat; + + int i; + +// int nRet = 0; + + while (true) // exit by encountering PopRet or RetTrue or RetZero + { + ActionCommand op = ActionCommand(*pbNext++); + + switch (op) + { + case kopNop: + break; + + case kopPushByte: + pbNext++; + break; + case kopPushByteU: + pbNext++; + break; + case kopPushShort: + pbNext++; + pbNext++; + break; + case kopPushShortU: + pbNext++; + pbNext++; + break; + case kopPushLong: + pbNext++; + pbNext++; + pbNext++; + pbNext++; + break; + + case kopNeg: + case kopTrunc8: case kopTrunc16: + case kopNot: + break; + + case kopAdd: case kopSub: + case kopMul: case kopDiv: + case kopMin: case kopMax: + case kopAnd: case kopOr: + case kopEqual: case kopNotEq: + case kopLess: case kopGtr: + case kopLessEq: case kopGtrEq: + break; + + case kopCond: + break; + + case kopNext: + break; + case kopNextN: + c = *pbNext; pbNext++; // count + break; + case kopPutGlyph8bitObs: + nOutputClass = *pbNext++; + break; + case kopPutGlyph: + pbNext += 2; + break; + case kopPutCopy: + nSlotRef = *pbNext++; + break; + case kopPutSubs8bitObs: + nSlotRef = *pbNext++; + nInputClass = *pbNext++; + nOutputClass = *pbNext++; + break; + case kopPutSubs: + nSlotRef = *pbNext++; + pbNext += 4; // 2 bytes each for classes + break; + case kopCopyNext: + break; + case kopInsert: + break; + case kopDelete: + break; + case kopAssoc: + c = *pbNext; pbNext++; + for (i = 0; i < c; i++) + pbNext++; + break; + case kopCntxtItem: + islotArg = *pbNext++; + c = *pbNext++; + break; + + case kopAttrSet: + case kopAttrAdd: + case kopAttrSub: + case kopAttrSetSlot: + pbNext++; // slot attribute ID + break; + case kopIAttrSet: + case kopIAttrAdd: + case kopIAttrSub: + case kopIAttrSetSlot: + pbNext++; // slot attribute ID + nIndex = *pbNext++; // index; eg, global ID for component + break; + + case kopPushSlotAttr: + pbNext++; + nSlotRef = *pbNext++; + break; + case kopPushISlotAttr: + pbNext++; + nSlotRef = *pbNext++; + nIndex = *pbNext++; + break; + + case kopPushGlyphAttrObs: + case kopPushAttToGAttrObs: + nGlyphAttr = *pbNext++; + nSlotRef = *pbNext++; + break; + case kopPushGlyphAttr: + case kopPushAttToGlyphAttr: + pbNext += 3; + break; + case kopPushGlyphMetric: + case kopPushAttToGlyphMetric: + nGlyphAttr = *pbNext++; + nSlotRef = *pbNext++; + nAttLevel = *pbNext++; + break; + case kopPushFeat: + nFeat = *pbNext++; + nSlotRef = *pbNext++; + break; + + case kopPushProcState: + nPState = *pbNext++; + break; + case kopPushVersion: + break; + + case kopPopRet: + case kopRetZero: + case kopRetTrue: + m_prgfRuleOkay[ruln] = true; + return ruln; + + default: + // Uninterpretable command: + return -1; + } + } + + return ruln; // to keep compiler from griping +} + +/*---------------------------------------------------------------------------------------------- + Runs the rule, if any, otherwise just passes one character through. + The rule does nothing but set the line-break weights for the slots. + + @param ptman - the table manager that allocates slots + @param ruln - number of rule to run; -1 if none applies + @param psstrmIn/Out - input/output stream +----------------------------------------------------------------------------------------------*/ +void GrLineBreakPass::RunRule(GrTableManager * ptman, int ruln, + GrSlotStream * psstrmIn, GrSlotStream * psstrmOut) +{ + // Remember the beginnings of the new chunk: + int islotIn = psstrmIn->ReadPos(); + int islotOut = psstrmOut->WritePos(); + int cslotReprocessed = psstrmIn->SlotsToReprocess(); + + if (ruln == -1) + { + // Just pass one glyph through. + psstrmOut->CopyOneSlotFrom(psstrmIn); + psstrmOut->SetPosForNextRule(0, psstrmIn, false); + } + else + { + // Run the rule. + int biStart = m_prgibActionStart[ruln]; + int iResult = RunCommandCode(ptman, m_prgbActionBlock + biStart, false, + psstrmIn, psstrmOut, 0); + psstrmOut->SetPosForNextRule(iResult, psstrmIn, false); + } + + CheckInputProgress(psstrmIn, psstrmOut, islotIn); + + MapChunks(psstrmIn, psstrmOut, islotIn, islotOut, cslotReprocessed); +} + +/*---------------------------------------------------------------------------------------------- + Runs the rule, if any, otherwise just passes one character through. + Keeps track of the association information in the slots and chunk + mappings for backtracking. + + @param ptman - the table manager that allocates slots + @param ruln - number of rule to run; -1 if none applies + @param psstrmIn/Out - input / output streams +----------------------------------------------------------------------------------------------*/ +void GrSubPass::RunRule(GrTableManager * ptman, int ruln, + GrSlotStream * psstrmIn, GrSlotStream * psstrmOut) +{ + // Remember the beginnings of the new chunk: + int islotIn = psstrmIn->ReadPosForNextGet(); + int islotOut = psstrmOut->WritePos(); + int cslotReprocessed = psstrmIn->SlotsToReprocess(); + + if (ruln == -1) + { + // Just pass one glyph through. + psstrmOut->CopyOneSlotFrom(psstrmIn); + psstrmOut->SetPosForNextRule(0, psstrmIn, false); + } + else + { + // Run the rule. + int biStart = m_prgibActionStart[ruln]; + int iResult = RunCommandCode(ptman, m_prgbActionBlock + biStart, false, + psstrmIn, psstrmOut, 0); + psstrmOut->SetPosForNextRule(iResult, psstrmIn, false); + // Restore if we need line-boundary contextualization based on physical locations + ////psstrmOut->SetLBContextFlag(ptman, islotOut); + } + + CheckInputProgress(psstrmIn, psstrmOut, islotIn); + + MapChunks(psstrmIn, psstrmOut, islotIn, islotOut, cslotReprocessed); +} + +/*---------------------------------------------------------------------------------------------- + Runs the rule, if any, otherwise just positions one character in the standard way. + Keeps track of (among other things) the overall physical size of the output + and chunk mappings. + + @param ptman - the table manager that allocates slots + @param ruln - number of rule to run; -1 if none applies + @param psstrmIn / Out - input / output streams +----------------------------------------------------------------------------------------------*/ +void GrPosPass::RunRule(GrTableManager * ptman, int ruln, + GrSlotStream * psstrmIn, GrSlotStream * psstrmOut) +{ + // Remember the beginnings of the new chunk: + int islotIn = psstrmIn->ReadPosForNextGet(); + int islotOut = psstrmOut->WritePos(); + int cslotReprocessed = psstrmIn->SlotsToReprocess(); + + int iResult = 0; + + Assert(psstrmIn->GotIndexOffset()); + // Don't do any positioning in anything being processed from the previous line. + if (psstrmIn->ReadPosForNextGet() < psstrmIn->IndexOffset()) + ruln = -1; + + if (ruln == -1) + { + // Just position one glyph in the standard way. + psstrmOut->CopyOneSlotFrom(psstrmIn); + iResult = 0; + } + else + { + // Run the rule. + int biStart = m_prgibActionStart[ruln]; + iResult = RunCommandCode(ptman, m_prgbActionBlock + biStart, false, + psstrmIn, psstrmOut, 0); + } + + // Make sure an entire cluster is present in the output stream. Actually there might be + // interleaved clusters, which is the purpose for the loop. + int dislotClusterMax = 0; + do { + dislotClusterMax = psstrmIn->MaxClusterSlot(islotIn, psstrmIn->ReadPos()); + Assert(dislotClusterMax >= 0); + for (int islot = 0; islot < dislotClusterMax; islot++) + psstrmOut->CopyOneSlotFrom(psstrmIn); + iResult -= dislotClusterMax; + } while (dislotClusterMax > 0); + + psstrmOut->SetPosForNextRule(iResult, psstrmIn, true); + + // Restore if we need line-boundary contextualization based on physical locations + ////psstrmOut->SetLBContextFlag(ptman, islotOut); + + if (ruln > -1) + { + psstrmOut->CalcIndexOffset(ptman); + // Update the attachment trees and cluster metrics for slots modified by this rule. + // Note that this loop assumes that the reprocess buffer points to the identical + // slot objects as the output stream (not copies of the slots). + for (int islot = islotIn - psstrmIn->SlotsSkippedToResync(); + islot < psstrmOut->WritePos() + psstrmIn->SlotsToReprocess(); + islot++) + { + psstrmOut->SlotAt(islot)->HandleModifiedPosition(ptman, psstrmIn, psstrmOut, islot); + } + } + + CheckInputProgress(psstrmIn, psstrmOut, islotIn); + + MapChunks(psstrmIn, psstrmOut, islotIn, islotOut, cslotReprocessed); + + psstrmOut->AssertStreamIndicesValid(psstrmIn); +} + +/*---------------------------------------------------------------------------------------------- + Perform the reversal for internal bidirectionality. + Caller is responsible for updating the read- and write-positions. + Private. + + OBSOLETE + + @param nCurrDirection - direction level of range of reverse + @param psstrmIn, psstrmOut - streams + @param islotInMin, islotInLim - range to reverse + @param islotOutMin,islotOutLim - corresponding output positions; note that islotOutMin + will be greater than islotOutLim if we are reversing + reversing the slots (direction is odd) +----------------------------------------------------------------------------------------------*/ +#if 0 +void GrBidiPass::OldReverse(int nCurrDirection, + GrSlotStream * psstrmIn, int islotInMin, int islotInLim, + GrSlotStream * psstrmOut, int islotOutMin, int islotOutLim) +{ + int oInc = (islotOutLim > islotOutMin)? 1: -1; // which direction output is moving in + // buffer (if dir is even, oInc == 1; + // if odd, oInc == -1) + + int islotITmp = islotInMin; + int islotOTmp = islotOutMin; + + while (islotITmp != islotInLim) { + // Find end of sub-range at current level to reverse. + int islotSubLim = psstrmIn->OldDirLevelRange(NULL, islotITmp, nCurrDirection); + Assert(islotSubLim >= 0); + + if (islotSubLim == islotITmp) { + // Current slot is at this level--just copy it. + psstrmOut->SimpleCopyFrom(psstrmIn, islotITmp, islotOTmp); + islotOTmp += oInc; + islotITmp++; + } + else { + // There is a sub-range that needs to be reversed. + int islotONext = islotOTmp + ((islotSubLim-islotITmp) * oInc); + OldReverse(nCurrDirection+1, + psstrmIn, islotITmp, islotSubLim, + psstrmOut, islotONext - oInc, islotOTmp - oInc); + islotOTmp = islotONext; + islotITmp = islotSubLim; + } + } +} +#endif + +/*---------------------------------------------------------------------------------------------- + Perform the reversal for internal bidirectionality. + Caller is responsible for updating the read- and write-positions. + Return the number of slots NOT copied because they were markers. + Private. + + @param psstrmIn, psstrmOut - streams + @param vislotStarts, vislotStops - indices of ranges to reverse, from inner to outer +----------------------------------------------------------------------------------------------*/ +int GrBidiPass::Reverse(GrTableManager * ptman, + GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, + std::vector & vislotStarts, std::vector & vislotStops) +{ + Assert(vislotStarts.size() == vislotStops.size()); + + std::vector vislotMap; // list of slot indices in the order they should be copied + // into the output + + int islotOuterStart = vislotStarts.back(); + int islotOuterStop = vislotStops.back(); + + // Initialize map as if nothing is reversed; eg for [2, 9]: (2 3 4 5 6 7 8 9) + int islot; + for (islot = 0; islot <= (islotOuterStop - islotOuterStart); islot++) + vislotMap.push_back(islot + islotOuterStart); + + // Do the inner reversals first, followed by the outer reversals. + size_t iislot; + for (iislot = 0; iislot < vislotStarts.size(); iislot++) + { + // Reverse the run. + int islotStart = vislotStarts[iislot] - islotOuterStart; + int islotStop = vislotStops[iislot] - islotOuterStart; + int islot1, islot2; + for (islot1 = islotStart, islot2 = islotStop; islot1 < islot2; islot1++, islot2--) + { + int islotTmp = vislotMap[islot1]; + vislotMap[islot1] = vislotMap[islot2]; + vislotMap[islot2] = islotTmp; + } + } + + // With vislotStarts = [7, 5, 2] and vislotStops = [8, 8, 9], we get + // first: (2 3 4 5 6 8 7 9) + // then: (2 3 4 7 8 5 6 9) + // and finally: (9 6 5 8 7 4 3 2) + + // Now copy the slots. + + int islotOutStart = psstrmOut->WritePos(); + int cslotNotCopied = 0; + for (iislot = 0; iislot < vislotMap.size(); iislot++) + { + GrSlotState * pslot = psstrmIn->SlotAt(vislotMap[iislot]); + // Don't copy bidi markers unless they have been set to use a specific glyph. + if (pslot->IsBidiMarker() && pslot->ActualGlyphForOutput(ptman) == 0) + cslotNotCopied++; + else + psstrmOut->SimpleCopyFrom(psstrmIn, vislotMap[iislot], + iislot + islotOutStart - cslotNotCopied); + } + return cslotNotCopied; +} + +/*---------------------------------------------------------------------------------------------- + Unwind the output for this pass, given that a change was assumed to have occurred + in the input at the given position. Return the position to which we unwound. +----------------------------------------------------------------------------------------------*/ +int GrPass::Unwind(GrTableManager * ptman, + int islotChanged, GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, + bool /*fFirst*/) +{ + // Back up the number of slots required for the longest rule context, + // but if we land in the middle of a chunk, go forward to its boundary. + int islotIn = max(islotChanged - m_pzpst->MaxChunk(), 0); + if (!psstrmIn->NoReproc()) + islotIn = min(islotIn, psstrmIn->ReprocMin()); + psstrmIn->ClearReprocBuffer(); + int islotOut = 0; + if (islotIn < psstrmIn->SlotsSkippedToResync() || + islotIn == 0 || + psstrmIn->ReadPos() == 0) + { + // The next-chunk-map is invalid. The beginning of the chunk is 0. + islotIn = 0; + islotOut = 0; + } + else if (islotIn >= psstrmIn->ReadPos()) + { + // No need to unwind. + Assert(psstrmIn->NoReproc()); + return psstrmOut->WritePos(); + } + else + { + Assert(islotIn < psstrmIn->ReadPos()); + islotIn = min(islotIn, psstrmIn->ReadPos() - 1); + while (islotIn < psstrmIn->ReadPos() && + (islotOut = psstrmIn->ChunkInNext(islotIn)) == -1) + { + ++islotIn; + } + if (islotIn == psstrmIn->ReadPos()) + islotOut = psstrmOut->WritePos(); + } + + Assert(islotOut != -2); // because the chunk size must be <= than the max-chunk, + // so we should never hit the end of the output stream + + // Now we've found a chunk boundary. + +// if (fFirst) +// Unattach(psstrmIn, islotIn, psstrmOut, islotOut, islotChanged); +// else +// Unattach(psstrmIn, islotIn, psstrmOut, islotOut, -1); + + psstrmIn->UnwindInput(islotIn, PreBidiPass()); + psstrmOut->UnwindOutput(islotOut, IsPosPass()); + + m_pzpst->ZapPConstraintInfo(); + + if (psstrmIn->ReadPos() < psstrmIn->SlotsSkippedToResync()) + { + ptman->Pass(m_ipass - 1)->UndoResyncSkip(); + psstrmIn->ClearSlotsSkippedToResync(); + } + if (psstrmOut->WritePos() < psstrmOut->SlotsSkippedToResync()) + { + Assert(psstrmOut->SlotsSkippedToResync() == m_pzpst->m_cslotSkipToResync); + UndoResyncSkip(); + psstrmOut->ClearSlotsSkippedToResync(); + } + + if (ptman->LoggingTransduction()) + m_pzpst->UnwindLogInfo(islotIn, islotOut); + + return islotOut; +} + +/*---------------------------------------------------------------------------------------------- + For a GrBidiPass, just unwind to the beginning of the reordered chunk. +----------------------------------------------------------------------------------------------*/ +int GrBidiPass::Unwind(GrTableManager * ptman, + int islotChanged, GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, + bool /*fFirst*/) +{ + int islotIn; + int islotOut; + + if (islotChanged == 0) + { + islotIn = 0; + islotOut = 0; + } + else { + islotIn = min(islotChanged, psstrmIn->WritePos()); + islotIn = max(islotIn - 1, 0); + while (islotIn > 0 && !StrongDir(psstrmIn->SlotAt(islotIn)->Directionality())) + { + // Slightly redundant with ZapCalculatedDirLevels, but can be needed for slots + // that have been modified by the substitution passes. + psstrmIn->SlotAt(islotIn)->ZapDirLevel(); + islotIn--; + } + Assert(islotIn == 0 || psstrmIn->SlotAt(islotIn)->DirHasBeenProcessed()); + islotOut = 0; + while (islotIn > 0 && (islotOut = psstrmIn->ChunkInNext(islotIn)) == -1) + --islotIn; + } + + if (islotOut == -1 || islotOut == -2) + islotOut = 0; + + // Now we've found a chunk boundary; islotI and islotO are the positions in the + // input and output streams, respectively. + + psstrmIn->UnwindInput(islotIn, false); + psstrmOut->UnwindOutput(islotOut, false); + + if (psstrmOut->WritePos() < m_pzpst->m_cslotSkipToResync) + { + Assert(false); // shouldn't be any of this mess for the Bidi pass + m_pzpst->m_fDidResyncSkip = false; + } + + if (ptman->LoggingTransduction()) + m_pzpst->UnwindLogInfo(islotIn, islotOut); + + return islotOut; +} + +/*---------------------------------------------------------------------------------------------- + Reinitialize part of the transduction logging information when we unwind the pass. +----------------------------------------------------------------------------------------------*/ +void PassState::UnwindLogInfo(int islotIn, int islotOut) +{ + while (m_crulrec > 0 && m_rgrulrec[m_crulrec-1].m_islot >= islotIn) + { + m_crulrec--; + m_rgrulrec[m_crulrec].m_islot = 0; + m_rgrulrec[m_crulrec].m_irul = 0; + m_rgrulrec[m_crulrec].m_fFired = false; + } + + while (m_crngrec > 0 && m_rgrngrec[m_crngrec-1].m_islotMin >= islotIn) + { + m_crngrec--; + m_rgrngrec[m_crngrec].m_islotMin = 0; + m_rgrngrec[m_crngrec].m_islotLim = 0; + m_rgrngrec[m_crngrec].m_fSucceeds = false; + } + if (m_crngrec > 0 && m_rgrngrec[m_crngrec-1].m_islotLim > islotIn) + m_rgrngrec[m_crngrec-1].m_islotLim = islotIn; + + for (int islot = islotOut; islot < 128; islot++) + { + m_rgcslotDeletions[islot] = 0; + m_rgfInsertion[islot] = false; + } +} + +/*---------------------------------------------------------------------------------------------- + Undo the side effects of attachments, ie, fix up the attachment trees as we unwind. + + @param islotLB the index of the line-break that was just inserted, or -1 if this is + not the first pass to include line-breaks; we want to skip this slot + in the processing in this method + + OBSOLETE +----------------------------------------------------------------------------------------------*/ +//:Ignore +void GrPosPass::Unattach(GrSlotStream * /*psstrmIn*/, int /*islotIn*/, + GrSlotStream * /*psstrmOut*/, int /*islotOut*/, int /*islotLB*/) +{ + // Because this is a positioning pass, there is a one-to-one correspondence between + // the slots in the input and the slots in the output. Thus we can make simplifying + // assumptions. Specifically, the chunk sizes are equal, except for the possiblity + // of a LB slot that we just inserted in the input stream. +#if 0 + +#ifdef _DEBUG + int islotDiff = (psstrmIn->ReadPos() - islotIn) - (psstrmOut->WritePos() - islotOut); + if (islotLB == -1) + Assert(islotDiff == 0); + else + Assert(islotDiff == 1); +#endif // _DEBUG + + int islotInLp = psstrmIn->ReadPos(); + int islotOutLp = psstrmOut->WritePos(); + for ( ; islotInLp-- > islotIn && islotOutLp-- > islotOut; ) + { + if (islotLB == islotInLp) + { + GrSlotState * pslotTmp = psstrmIn->SlotAt(islotInLp); + islotInLp--; + } + + GrSlotState * pslotIn = psstrmIn->SlotAt(islotInLp); + GrSlotState * pslotOut = psstrmOut->SlotAt(islotOutLp); + + if (pslotIn != pslotOut) + { + GrSlotState * pslotInRoot = pslotIn->AttachRoot(); + GrSlotState * pslotOutRoot = pslotOut->AttachRoot(); + + if (pslotOutRoot) + pslotOutRoot->RemoveLeaf(pslotOut); + if (pslotInRoot) + pslotInRoot->AddLeaf(pslotIn); + } + } +#endif // 0 +} +//:End Ignore + + +/*---------------------------------------------------------------------------------------------- + Record the fact that the given rule's constraint failed, for the purpose of logging + the transduction process. +----------------------------------------------------------------------------------------------*/ +void GrPass::RecordRuleFailed(int islot, int irul) +{ + m_pzpst->RecordRule(islot, irul, false); +} + +/*---------------------------------------------------------------------------------------------- + Record the fact that the given rule fired, for the purpose of logging + the transduction process. +----------------------------------------------------------------------------------------------*/ +void GrPass::RecordRuleFired(int islot, int irul) +{ + m_pzpst->RecordRule(islot, irul, true); +} + +/*---------------------------------------------------------------------------------------------- + Record the result of running a pass constraint for a range of slots. +----------------------------------------------------------------------------------------------*/ +void GrPass::RecordPassConstraintRange(int islotMin, int islotLim, bool fSuccess) +{ + m_pzpst->RecordPassRange(islotMin, islotLim, fSuccess); +} + + +/*---------------------------------------------------------------------------------------------- + Record the fact that we forcibly advanced due to the max-rule-loop. +----------------------------------------------------------------------------------------------*/ +void GrPass::RecordHitMaxRuleLoop(int islot) +{ + m_pzpst->RecordRule(islot, PassState::kHitMaxRuleLoop); +} + + +/*---------------------------------------------------------------------------------------------- + Record the fact that we forcibly advanced due to the max-backup. + + In theory it should be possible to call this, but in reality, it is pretty hard to be + able to say that there is a rule that would have fired except it was prevent by + MaxBackup. So currently this method is not called. +----------------------------------------------------------------------------------------------*/ +void GrPass::RecordHitMaxBackup(int islot) +{ + m_pzpst->RecordRule(islot, PassState::kHitMaxBackup); +} + + +/*---------------------------------------------------------------------------------------------- + Record some rule-related activity on a slot. +----------------------------------------------------------------------------------------------*/ +void PassState::RecordRule(int islot, int irul, bool fFired) +{ + if (m_crulrec >= 128) + return; + + m_rgrulrec[m_crulrec].m_irul = irul; + m_rgrulrec[m_crulrec].m_islot = islot; + //m_rgrulrec[m_crulrec].m_fFired = true; + m_rgrulrec[m_crulrec].m_fFired = fFired; + m_crulrec++; +} + +/*---------------------------------------------------------------------------------------------- + Record the running of a pass constraint over a range of slots. +----------------------------------------------------------------------------------------------*/ +void PassState::RecordPassRange(int islotMin, int islotLim, bool fSucceeds) +{ + if (m_crngrec >= 64) + return; + + m_rgrngrec[m_crngrec].m_islotMin = islotMin; + m_rgrngrec[m_crngrec].m_islotLim = islotLim; + m_rgrngrec[m_crngrec].m_fSucceeds = fSucceeds; + m_crngrec++; +} + +/*---------------------------------------------------------------------------------------------- + Record the fact that a slot was deleted before the given slot (in the output). +----------------------------------------------------------------------------------------------*/ +void PassState::RecordDeletionBefore(int islot) +{ + if (islot >= 128) + return; + + (m_rgcslotDeletions[islot])++; +} + +/*---------------------------------------------------------------------------------------------- + Record the fact that the given slot was inserted into the output. +----------------------------------------------------------------------------------------------*/ +void PassState::RecordInsertionAt(int islot) +{ + if (islot >= 128) + return; + + m_rgfInsertion[islot] = true; +} + +} // namespace gr diff --git a/Build/source/libs/graphite/engine-2.4/src/segment/GrPass.h b/Build/source/libs/graphite/engine-2.4/src/segment/GrPass.h new file mode 100644 index 00000000000..dafb2570e40 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/src/segment/GrPass.h @@ -0,0 +1,666 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 1999, 2001 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: GrPass.h +Responsibility: Sharon Correll +Last reviewed: Not yet. + +Description: + The GrPass class and subclasses. +----------------------------------------------------------------------------------------------*/ +#ifdef _MSC_VER +#pragma once +#endif +#ifndef PASS_INCLUDED +#define PASS_INCLUDED + +//:End Ignore + +namespace gr +{ + +/*---------------------------------------------------------------------------------------------- + This class stores the state of processing in a single pass. + + Hungarian: zpst +----------------------------------------------------------------------------------------------*/ + +class PassState { + friend class GrPass; + friend class GrGlyphGenPass; + friend class GrLineBreakPass; + friend class GrSubPass; + friend class GrBidiPass; + friend class GrPosPass; + friend class FontMemoryUsage; + +public: + PassState() + { + } + + void InitForNewSegment(int ipass, int nMaxChunk); + void InitializeLogInfo(); + + int MaxChunk() + { + return m_nMaxChunk; + } + + void SetResyncSkip(int c) + { + m_cslotSkipToResync = c; + m_fDidResyncSkip = false; + } + int NeededToResync() + { + if (m_fDidResyncSkip) + return 0; + return m_cslotSkipToResync; + } + bool DidResyncSkip() + { + return m_fDidResyncSkip; + } + bool CanResyncSkip(GrSlotStream * psstrmOutput) + { + if (m_fDidResyncSkip) + return true; // already did it + // Are we in the position to do the resync-skip? + return m_cslotSkipToResync <= psstrmOutput->WritePos(); + } + int DoResyncSkip(GrSlotStream * psstrmOutput); + void UndoResyncSkip() + { + m_fDidResyncSkip = false; + } + + bool PassConstraintSucceeds(GrTableManager * ptman, GrPass * ppass, + GrSlotStream * psstrmIn, GrSlotStream * psstrmOut); + + void ZapPConstraintInfo() + { + m_islotPConstraintLim = -1; + m_nPConstraintResult = -1; + } + + void UnwindLogInfo(int islotIn, int islotOut); + void RecordRule(int islot, int irul, bool fFired = false); + void RecordPassRange(int islotMin, int islotLim, bool fSuccess); + void RecordDeletionBefore(int islot); + void RecordInsertionAt(int islot); +#ifdef TRACING + void LogPassConstraints(std::ostream & strmOut); + void LogRulesFiredAndFailed(std::ostream & strmOut, GrSlotStream * psstrmIn); + void LogInsertionsAndDeletions(std::ostream & strmOut, GrSlotStream * psstrmOut); +#endif // TRACING + +protected: + int m_ipass; + + // Used to avoid infinite loops. If m_nRulesSinceAdvance > m_nMaxRuleLoop, + // and we have not passed the stream's ReadPosMax, forcibly advance. + int m_nRulesSinceAdvance; + + // Maximum length of chunk, used when unwinding the streams during backtracking. This + // must be initialized to m_nMaxRuleContext, but that is not always adequate, because + // when there is reprocessing going on the chunks may be longer. + int m_nMaxChunk; + + // Indicates how much of the pass's initial output should be automatically + // skipped over in order to resync with a chunk boundary. This handles the situation + // where we are reprocessing a little of the previous segment in order to handle + // cross-line-boundary contextuals. The goal is to skip over the output until we hit + // what we know (from processing the previous segment) is a chunk boundary. + // + // In most cases (and always when this is the first segment of the + // writing system) this number is 0. + int m_cslotSkipToResync; + bool m_fDidResyncSkip; + + enum { + kHitMaxBackup = -1, + kHitMaxRuleLoop = -2 + }; + + int m_islotPConstraintLim; // end of range to which m_nPConstraintResult applies + int m_nPConstraintResult; // 0 = fail, 1 = success, -1 = unknown + + // For logging transduction process: + // record of range for which pass constraint is tested + struct PassRangeRecord + { + int m_islotMin; + int m_islotLim; + bool m_fSucceeds; + }; + PassRangeRecord m_rgrngrec[64]; + int m_crngrec; + + // record of one rule matched or fired + struct RuleRecord + { + int m_irul; // rule index, or kHitMaxBackup or kHitMaxRuleLoop + int m_islot; // slot index of input stream + bool m_fFired; + }; + RuleRecord m_rgrulrec[128]; + int m_crulrec; + + int m_rgcslotDeletions[128]; // number of deletions before slot i in output + bool m_rgfInsertion[128]; // true if slot i in output was inserted +}; + +/*---------------------------------------------------------------------------------------------- + This class handles finding and applying rules from the pass and storing + the results in the appropriate stream. + + Hungarian: pass +----------------------------------------------------------------------------------------------*/ +class GrPass { + friend class FontMemoryUsage; + +protected: + // Action command codes; these MUST match the corresponding definitions in the compiler: + enum ActionCommand { + kopNop = 0, + + kopPushByte, kopPushByteU, kopPushShort, kopPushShortU, kopPushLong, + + kopAdd, kopSub, kopMul, kopDiv, + kopMin, kopMax, + kopNeg, + kopTrunc8, kopTrunc16, + + kopCond, + + kopAnd, kopOr, kopNot, + kopEqual, kopNotEq, + kopLess, kopGtr, kopLessEq, kopGtrEq, + + kopNext, kopNextN, kopCopyNext, + kopPutGlyph8bitObs, kopPutSubs8bitObs, kopPutCopy, + kopInsert, kopDelete, + kopAssoc, + kopCntxtItem, + + kopAttrSet, kopAttrAdd, kopAttrSub, + kopAttrSetSlot, + kopIAttrSetSlot, + kopPushSlotAttr, kopPushGlyphAttrObs,kopPushGlyphMetric, kopPushFeat, + kopPushAttToGAttrObs, kopPushAttToGlyphMetric, + kopPushISlotAttr, + + kopPushIGlyphAttr, // not implemented + + kopPopRet, kopRetZero, kopRetTrue, + kopIAttrSet, kopIAttrAdd, kopIAttrSub, + kopPushProcState, kopPushVersion, + kopPutSubs, kopPutSubs2, kopPutSubs3, + kopPutGlyph, kopPushGlyphAttr, kopPushAttToGlyphAttr + + }; + + enum StackMachineFlag { + ksmfDone = 0, + ksmfContinue, + ksmfUnderflow, + ksmfStackNotEmptied + }; + +public: + // Constructor: + GrPass(int i); + // Destructor: + virtual ~GrPass(); + + int PassNumber() { return m_ipass; } + + bool ReadFromFont(GrIStream & grstrm, int fxdSilfVersion, int fxdRuleVersion, + int nOffset, int cbPassLength); + void InitializeWithNoRules(); + + virtual void SetTopDirLevel(int /*n*/) + { // only GrBidiPass does anything interesting + } + + void SetPassState(PassState * pzpst) + { + m_pzpst = pzpst; + } + + virtual void ExtendOutput(GrTableManager *, + GrSlotStream * psstrmInput, GrSlotStream * psstrmOutput, int nslotToGet, + TrWsHandling twsh, + int * pnRet, int * pcslotGot, int * pislotFinalBreak); + + int ExtendGlyphIDOutput(GrTableManager *, GrCharStream *, + GrSlotStream *, int ichSegLim, int cchwPostXlbContext, + LineBrk lb, int cslotToGet, bool fNeedFinalBreak, + TrWsHandling twsh, int * pislotFinalBreak); + + int ExtendFinalOutput(GrTableManager *, GrSlotStream * psstrmInput, + GrSlotStream * psstrmOutput, + float xsSpaceAllotted, bool fWidthIsCharCount, bool fInfiniteWidth, + bool fHaveLineBreak, bool fMustBacktrack, + LineBrk lbMax, TrWsHandling twsh, + int * pislotLB, float * pxsWidth); + + int RemoveTrailingWhiteSpace(GrTableManager * ptman, GrSlotStream * psstrmOut, + TrWsHandling twsh, int * pislotFinalBreak); + + virtual int Unwind(GrTableManager * ptman, + int islotChanged, GrSlotStream *psstrmInput, GrSlotStream * psstrmOutput, + bool fFirst); + + int MaxBackup() + { + return m_nMaxBackup; + } + + bool DidResyncSkip() + { + return m_pzpst->DidResyncSkip(); + } + int DoResyncSkip(GrSlotStream * psstrmOutput) + { + return m_pzpst->DoResyncSkip(psstrmOutput); + } + + void UndoResyncSkip() + { + m_pzpst->UndoResyncSkip(); + } + void SetResyncSkip(int n) + { + m_pzpst->SetResyncSkip(n); + } + + virtual void DoCleanUpSegMin(GrTableManager * /*ptman*/, + GrSlotStream * /*psstrmIn*/, int /*islotInitReadPos*/, GrSlotStream * /*psstrmOut*/) + { + } + + virtual void DoCleanUpSegLim(GrTableManager * /*ptman*/, GrSlotStream * /*psstrmOut*/, + TrWsHandling /*twsh*/) + { + } + + virtual bool IsPosPass() + { + return false; + } + + virtual bool PreBidiPass() = 0; + + bool RunConstraint(GrTableManager *, int ruln, + GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, + int cslotPreModContext, int cslotMatched); + + bool RunPassConstraint(GrTableManager * ptman, + GrSlotStream * psstrmIn, GrSlotStream * psstrmOut); + + int RunCommandCode(GrTableManager * ptman, + byte * pbStart, bool fConstraints, + GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, int islot); + +protected: + int RunOneCommand(GrTableManager * ptman, bool fConstraints, + ActionCommand op, byte ** ppbArg, bool * pfMustGet, bool * pfInserting, + GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, int islot, + std::vector & vnStack, StackMachineFlag * psmf); + void DoStackArithmetic2Args(ActionCommand op, std::vector & vnStack, + StackMachineFlag * psmf); + void DoStackArithmetic1Arg(ActionCommand op, std::vector & vnStack, + StackMachineFlag * psmf); + void DoConditional(std::vector & vnStack, StackMachineFlag * psmf); + StackMachineFlag CheckStack(std::vector & vnStack, int cn); + void DoNext(GrTableManager * ptman, + int cslot, GrSlotStream * psstrmIn, GrSlotStream * psstrmOut); + void DoPutGlyph(GrTableManager * ptman, bool fInserting, int nReplacementClass, + GrSlotStream * psstrmIn, GrSlotStream * psstrmOut); + void DoPutCopy(GrTableManager * ptman, bool fInserting, int cslotCopyFrom, + GrSlotStream * psstrmIn, GrSlotStream * psstrmOut); + void DoPutSubs(GrTableManager * ptman, bool fInserting, + int cslotSel, int nSelClass, int nReplacementClass, + GrSlotStream * psstrmIn, GrSlotStream * psstrmOut); + void DoPutSubs2(GrTableManager * ptman, bool fInserting, + int cslotSel1, int nSelClass1, int cslotSel2, int nSelClass2, int nReplacementClass, + GrSlotStream * psstrmIn, GrSlotStream * psstrmOut); + void DoPutSubs3(GrTableManager * ptman, bool fInserting, + int cslotSel1, int nSelClass1, int cslotSel2, int nSelClass2, int cslotSel3, int nSelClass3, + int nReplacementClass, GrSlotStream * psstrmIn, GrSlotStream * psstrmOut); + void DoPutSubsInit(GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, bool fInserting, + GrSlotState ** ppslotNextPut, bool * pfAtSegMin, bool * pfAtSegLim); + void DoPutSubsAux(GrTableManager * ptman, bool fInserting, gid16 nGlyphReplacement, + GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, GrSlotState * pslotNextInput, + bool fAtSegMin, bool fAtSegLim); + void SetNeutralAssocs(GrSlotState * pslotNew, GrSlotStream * psstrmIn); + void DoDelete(GrTableManager * ptman, + GrSlotStream * psstrmIn, GrSlotStream * psstrmOut); + void DoAssoc(int cnAssocs, std::vector & vnAssocs, bool fInserting, + GrSlotStream * psstrmIn, GrSlotStream * psstrmOut); + void DoSetAttr(GrTableManager * ptman, + ActionCommand op, bool fInserrting, + SlotAttrName slat, int slati, std::vector & vnStack, + GrSlotStream * psstrmIn, GrSlotStream * psstrmOut); + void DoPushSlotAttr(GrTableManager * ptman, + int nSlotRef, bool fInserting, + SlotAttrName slat, int slati, std::vector & vnStack, + GrSlotStream * psstrmIn, GrSlotStream * psstrmOut); + void DoPushGlyphAttr(GrTableManager * ptman, int nSlotRef, bool fInserting, + int nGlyphAttr, std::vector & vnStack, + GrSlotStream * psstrmIn, GrSlotStream * psstrmOut); + void DoPushAttToGlyphAttr(GrTableManager * ptman, int nSlotRef, bool fInserting, + int nGlyphAttr, std::vector & vnStack, + GrSlotStream * psstrmIn, GrSlotStream * psstrmOut); + void DoPushGlyphMetric(GrTableManager * ptman, int nSlotRef, bool fInserting, + int nGlyphAttr, int nAttLevel, std::vector & vnStack, + GrSlotStream * psstrmIn, GrSlotStream * psstrmOut); + void DoPushAttToGlyphMetric(GrTableManager * ptman, int nSlotRef, bool fInserting, + int nGlyphAttr, int nAttLevel, std::vector & vnStack, + GrSlotStream * psstrmIn, GrSlotStream * psstrmOut); + void DoPushFeatValue(GrTableManager * ptman, int islot, bool fInsering, + int nFeat, std::vector & vnStack, + GrSlotStream * psstrmIn, GrSlotStream * psstrmOut); + void DoPushProcState(GrTableManager * ptman, int nPState, std::vector & vnStack); +protected: + void DoPushGlyphMetricAux(GrTableManager * ptman, + GrSlotState * pslot, int nGlyphAttr, int nAttLevel, + std::vector & vnStack, GrSlotStream * psstrmIn); +public: + int SortKeyForRule(int ruln) + { + Assert(ruln < m_crul); + return m_prgchwRuleSortKeys[ruln]; + } + int PreModContextForRule(int ruln) + { + Assert(ruln < m_crul); + return m_prgcritRulePreModContext[ruln]; + } + + int MaxRulePreContext() + { + if (m_pfsm) + return m_pfsm->MaxRulePreContext(); + else + return 0; + } + + void RecordRuleFailed(int islot, int irul); + void RecordRuleFired(int islot, int irul); + void RecordPassConstraintRange(int islotMin, int islotLim, bool fSuccess); + void RecordHitMaxRuleLoop(int islot); + void RecordHitMaxBackup(int islot); +#ifdef TRACING + void LogRulesFiredAndFailed(std::ostream & strmOut, GrSlotStream * psstrmIn, int ipassJust); + void LogInsertionsAndDeletions(std::ostream & strmOut, GrSlotStream * psstrmOut); +#endif // TRACING + +protected: + int CheckRuleValidity(int ruln); + + virtual void RunRule(GrTableManager *, int ruln, + GrSlotStream * psstrmInput, GrSlotStream * psstrmOutput) = 0; + + void CheckInputProgress(GrSlotStream* input, GrSlotStream* psstrmOutput, + int islotOrigInput); + + void MapChunks(GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, + int islotChunkI, int islotChunkO, int cslotReprocessed); + + virtual void Unattach(GrSlotStream * /*psstrmIn*/, int /*islotIn*/, // GrPosPass overrides + GrSlotStream * /*psstrmOut*/, int /*islotOut*/, int /*islotLB*/) + { + } + + friend class EngineState; // let it call the method below + virtual int MaxRuleContext() // GrBidiPass overrides + { + return m_nMaxRuleContext; + } + +protected: + // Instance variables: + + int m_ipass; // index of pass + + int m_fxdVersion; + + // number of items required from previous pass; don't access directly, use the getter + // method, because GrBidiPass overrides to always use 1. + int m_nMaxRuleContext; + + GrFSM * m_pfsm; // Finite State Machine to give next rule + + int m_nMaxRuleLoop; // maximum number of rules to process before forcibly + // advancing input position + + int m_nMaxBackup; + + int m_crul; // number of rules + + // rule sort keys, indicating precedence of rules; m_crul of these + data16 * m_prgchwRuleSortKeys; + + // for each rule, the number of items in the context before the first modified item + // that the constraints need to be tested on + byte * m_prgcritRulePreModContext; + + // byte count for pass-level constraints; just 1 of these + data16 m_cbPassConstraint; + // offsets for constraint and action code; m_crul+1 of each of these (the last + // indicates the total byte count) + data16 * m_prgibConstraintStart; + data16 * m_prgibActionStart; + + // blocks of constraint and action code + byte * m_prgbPConstraintBlock; // pass-level constraints + byte * m_prgbConstraintBlock; // rule constraints + byte * m_prgbActionBlock; + + int m_cbConstraints; // needed for memory instrumentation only + int m_cbActions; // needed for memory instrumentation only + + bool m_fHasDebugStrings; + data16 * m_prgibConstraintDebug; // m_crul+1 of these + data16 * m_prgibRuleDebug; // m_crul+1 of these + + bool m_fCheckRules; + bool * m_prgfRuleOkay; + + std::vector m_vnStack; // for stack machine processing (more efficient than creating the + // vector each time) + + // state of process for this pass + PassState * m_pzpst; + +}; // end of class GrPass + + +/*---------------------------------------------------------------------------------------------- + The initial pass that generates glyph IDs from Unicode input. + + Hungarian: pass +----------------------------------------------------------------------------------------------*/ +class GrGlyphGenPass : public GrPass +{ + friend class FontMemoryUsage; + +public: + GrGlyphGenPass(int ipass) : GrPass(ipass) + { + } + + virtual bool PreBidiPass() + { + return true; + } + +protected: + // Irrelevant when generating glyphs. + virtual void RunRule(GrTableManager *, int /*ruln*/, + GrSlotStream * /*psstrmInput*/, GrSlotStream * /*psstrmOutput*/) + { + Assert(false); + } + +}; // end of class GrGlyphGenPass + + +/*---------------------------------------------------------------------------------------------- + A pass containing rules that set the break weight values. + + Hungarian: pass +----------------------------------------------------------------------------------------------*/ +class GrLineBreakPass : public GrPass +{ + friend class FontMemoryUsage; + +public: + GrLineBreakPass(int ipass) : GrPass(ipass) + { + } + + virtual bool PreBidiPass() + { + return true; + } + +protected: + virtual void RunRule(GrTableManager *, int ruln, + GrSlotStream * psstrmInput, GrSlotStream * psstrmOutput); + +}; // end of class GrLineBreakPass + + +/*---------------------------------------------------------------------------------------------- + A pass containing substitution rules. + + Hungarian: pass +----------------------------------------------------------------------------------------------*/ +class GrSubPass : public GrPass +{ + friend class FontMemoryUsage; + +public: + GrSubPass(int ipass) : GrPass(ipass) + { + } + + virtual bool PreBidiPass() + { + return true; + } + +protected: + virtual void RunRule(GrTableManager *, int ruln, + GrSlotStream * psstrmInput, GrSlotStream * psstrmOutput); + + virtual void DoCleanUpSegMin(GrTableManager * ptman, + GrSlotStream * psstrmIn, int islotInitReadPos, GrSlotStream * psstrmOut); + virtual void DoCleanUpSegLim(GrTableManager * ptman, GrSlotStream * psstrmOut, + TrWsHandling twsh); + +}; // end of class GrSubPass + + +/*---------------------------------------------------------------------------------------------- + This class is the one the knows how to handle bidi reordering, including backtracking. + + Hungarian: pass +----------------------------------------------------------------------------------------------*/ +class GrBidiPass : public GrSubPass +{ + friend class FontMemoryUsage; + +public: + // Constructor: + GrBidiPass(int ipass) + : GrSubPass(ipass), + m_nTopDirection(0) + { + } + + virtual void SetTopDirLevel(int n) + { + m_nTopDirection = n; + } + + virtual bool PreBidiPass() + { + return false; + } + + virtual void ExtendOutput(GrTableManager *, + GrSlotStream * psstrmI, GrSlotStream * psstrmO, int nslotToGet, + TrWsHandling twsh, + int * pnRet, int * pcslotGot, int * pislotFinalBreak); + + virtual int Unwind(GrTableManager * ptman, + int islotChanged, GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, + bool fFirst); +protected: + virtual int MaxRuleContext() + { + return 1; + } + +private: + //void OldReverse(int nCurrDirection, + // GrSlotStream * psstrmI, int islotI1, int islotI2, + // GrSlotStream * psstrmO, int islotO1, int islotO2); + + int Reverse(GrTableManager * ptman, + GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, + std::vector & vislotStarts, std::vector & vislotStops); + +protected: + // Instance variables: + int m_nTopDirection; // 0 for LTR, 1 for RTL -- CURRENTLY NOT USED; need to + // initialize it when we set the writing system direction + +}; // end of class GrBidiPass + + +/*---------------------------------------------------------------------------------------------- + A pass containing positioning rules. + + Hungarian: pass +----------------------------------------------------------------------------------------------*/ +class GrPosPass : public GrPass +{ + friend class FontMemoryUsage; + +public: + GrPosPass(int ipass) : GrPass(ipass) + { + } + + virtual bool IsPosPass() + { + return true; + } + + virtual bool PreBidiPass() + { + return false; + } + +protected: + virtual void RunRule(GrTableManager *, int ruln, + GrSlotStream * psstrmInput, GrSlotStream * psstrmOutput); + + virtual void Unattach(GrSlotStream * psstrmIn, int islotIn, + GrSlotStream * psstrmOut, int islotOut, int islotLB); + +}; // end of class GrPosPass + +} // namespace gr + + +#endif // PASS_INCLUDED diff --git a/Build/source/libs/graphite/engine-2.4/src/segment/GrPassActionCode.cpp b/Build/source/libs/graphite/engine-2.4/src/segment/GrPassActionCode.cpp new file mode 100644 index 00000000000..e8fc1ff1958 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/src/segment/GrPassActionCode.cpp @@ -0,0 +1,1511 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 1999, 2001 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: GrPassActionCode.cpp +Responsibility: Sharon Correll +Last reviewed: Not yet. + +Description: + A continution of the GrPass file, including functions to run the action commands. +----------------------------------------------------------------------------------------------*/ + +//:>******************************************************************************************** +//:> Include files +//:>******************************************************************************************** +#include "Main.h" + +#ifdef _MSC_VER +#pragma hdrstop +#endif + +//:End Ignore + +//:>******************************************************************************************** +//:> Forward declarations +//:>******************************************************************************************** + +//:>******************************************************************************************** +//:> Local type definitions +//:>******************************************************************************************** + +typedef signed char Int8; // signed value +typedef unsigned char Uint8; // unsigned value + + +namespace gr +{ + +//:>******************************************************************************************** +//:> Methods +//:>******************************************************************************************** + +/*---------------------------------------------------------------------------------------------- + The main function to run a block of action or constraint code and return a result. + + @param ptman - table manager, for generating new slots; NULL when + running constraints + @param pbStart - address of the first command + @param fConstraints - true if we are running constraint tests; + false if we are running rule actions + @param psstrmIn - input stream + @param psstrmOut - output stream; when running constraints, used to access items + in the precontext + @param islot - slot being processed relative to the start of the rule; + used only for constraints; must be 0 for rule actions +----------------------------------------------------------------------------------------------*/ +int GrPass::RunCommandCode(GrTableManager * ptman, + byte * pbStart, bool fConstraints, + GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, int islot) +{ + byte * pbNext = pbStart; + +// std::vector vnStack; +// vnStack.EnsureSpace(128); // make it nice and big + m_vnStack.clear(); + + gAssert(fConstraints || islot == 0); + + // There are two states: fMustGet = true means we need to get a slot to work on from + // the input; fMustGet = false means we have a slot and we need to do a Next before + // we can get the next one. + bool fMustGet = !fConstraints; + + bool fInserting = false; // set to true by an Insert command + + int nRet = 0; + + while (true) + { + ActionCommand op = ActionCommand(*pbNext++); + StackMachineFlag smf; + nRet = RunOneCommand(ptman, fConstraints, op, + &pbNext, &fMustGet, &fInserting, + psstrmIn, psstrmOut, islot, + m_vnStack, &smf); + + if (smf == ksmfDone) + return nRet; + + if (smf == ksmfUnderflow) + { + Warn("Underflow in Graphite stack machine"); + gAssert(false); + FontException fexptn; + fexptn.version = -1; + fexptn.subVersion = -1; + fexptn.errorCode = kferrUnknown; + throw fexptn; // disastrous error in rendering; fall back to dumb rendering + } + } + return nRet; // not needed, but to avoid compiler warning +} + +/*---------------------------------------------------------------------------------------------- + Perform a single command. Specifically, read the arguments from the byte buffer and the + run the appropriate functions. + + @param ptman - table manager, for generating new slots; or NULL + @param fConstraints - true if we are running constraints; false if we are running + rule actions + @param op - command operator + @param ppbArg - pointer to first argument + @param pfMustGet - state: getting input or processing it; when running constraints, + always false + @param pfInserting - true if current item is to be inserted, or was inserted + @param psstrmIn - input stream + @param psstrmOut - output stream + @param islot - the slot being processed relative to the beginning of the rule; + only relevant for constraint testing, must be 0 for rule actions + @param vnStack - the stack of values being manipulated + @param psmf - error code, done flag, or continue flag +----------------------------------------------------------------------------------------------*/ +int GrPass::RunOneCommand(GrTableManager * ptman, bool fConstraints, + ActionCommand op, byte ** ppbArg, bool * pfMustGet, bool * pfInserting, + GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, int islot, + std::vector & vnStack, StackMachineFlag * psmf) +{ + *psmf = ksmfContinue; + + // General purpose variables: + int arg1, arg2, arg3, arg4; + int nSlotRef; + int nInputClass; + int nOutputClass; + int c; + int islotArg; + int nIndex; + int nGlyphAttr; + int nAttLevel; + int nFeat; + int nPState; + SlotAttrName slat; + + int i; + std::vector vnTmp; + + byte * pbNext = *ppbArg; + + int nRet = 0; + + switch (op) + { + case kopNop: + break; + + case kopPushByte: + arg1 = Int8(*pbNext++); + vnStack.push_back(arg1); + break; + case kopPushByteU: + arg1 = Uint8(*pbNext++); + vnStack.push_back(arg1); + break; + case kopPushShort: + arg1 = Int8(*pbNext++); + arg2 = Uint8(*pbNext++); + vnStack.push_back((arg1 << 8) + arg2); + break; + case kopPushShortU: + arg1 = Uint8(*pbNext++); + arg2 = Uint8(*pbNext++); + vnStack.push_back((arg1 << 8) + arg2); + break; + case kopPushLong: + arg1 = Int8(*pbNext++); + arg2 = Uint8(*pbNext++); + arg3 = Uint8(*pbNext++); + arg4 = Uint8(*pbNext++); + vnStack.push_back((arg1 << 24) + (arg2 << 16) + (arg3 << 8) + arg4); + break; + + case kopNeg: + case kopTrunc8: case kopTrunc16: + case kopNot: + DoStackArithmetic1Arg(op, vnStack, psmf); + if (*psmf != ksmfContinue) + return 0; + break; + + case kopAdd: case kopSub: + case kopMul: case kopDiv: + case kopMin: case kopMax: + case kopAnd: case kopOr: + case kopEqual: case kopNotEq: + case kopLess: case kopGtr: + case kopLessEq: case kopGtrEq: + DoStackArithmetic2Args(op, vnStack, psmf); + if (*psmf != ksmfContinue) + return 0; + break; + + case kopCond: + DoConditional(vnStack, psmf); + if (*psmf != ksmfContinue) + return 0; + break; + + case kopNext: + if (fConstraints) + { + gAssert(false); + } + else + { + gAssert(!*pfMustGet); + DoNext(ptman, 1, psstrmIn, psstrmOut); + *pfMustGet = true; + *pfInserting = false; + } + break; + case kopNextN: + c = Int8(*pbNext++); + if (fConstraints) + { + gAssert(false); + } + else + { + gAssert(false); // for now we don't allow anything other than moving one slot + gAssert(!*pfMustGet); // forward at a time + DoNext(ptman, c, psstrmIn, psstrmOut); + *pfMustGet = true; + } + break; + case kopPutGlyph8bitObs: + case kopPutGlyph: + if (op == kopPutGlyph8bitObs) + nOutputClass = Uint8(*pbNext++); + else + { + nOutputClass = (Uint8(*pbNext++) << 8); + nOutputClass += Uint8(*pbNext++); + } + if (fConstraints) + { + gAssert(false); + } + else + { + gAssert(*pfMustGet); + DoPutGlyph(ptman, *pfInserting, nOutputClass, psstrmIn, psstrmOut); + *pfMustGet = false; + } + break; + case kopPutCopy: + nSlotRef = Int8(*pbNext++); + if (fConstraints) + { + gAssert(false); + } + else + { + gAssert(*pfMustGet); + DoPutCopy(ptman, *pfInserting, nSlotRef, psstrmIn, psstrmOut); + *pfMustGet = false; + } + break; + case kopPutSubs8bitObs: + case kopPutSubs: + nSlotRef = Int8(*pbNext++); + if (op == kopPutSubs8bitObs) + { + nInputClass = Uint8(*pbNext++); + nOutputClass = Uint8(*pbNext++); + } + else + { + nInputClass = (Uint8(*pbNext++) << 8); + nInputClass += Uint8(*pbNext++); + nOutputClass = (Uint8(*pbNext++) << 8); + nOutputClass += Uint8(*pbNext++); + } + if (fConstraints) + { + gAssert(false); + } + else + { + gAssert(*pfMustGet); + DoPutSubs(ptman, *pfInserting, nSlotRef, nInputClass, nOutputClass, + psstrmIn, psstrmOut); + *pfMustGet = false; + } + break; + case kopCopyNext: + if (fConstraints) + { + gAssert(false); + } + else + { + gAssert(*pfMustGet); + gAssert(!*pfInserting); // 0 means copy this slot + DoPutCopy(ptman, *pfInserting, 0, psstrmIn, psstrmOut); + DoNext(ptman, 1, psstrmIn, psstrmOut); + // *pfMustGet still = true + } + break; + case kopInsert: + if (fConstraints) + { + gAssert(false); + } + else + { + gAssert(*pfMustGet); + *pfInserting = true; + // *pfMustGet still = true + + if (ptman->LoggingTransduction()) + m_pzpst->RecordInsertionAt(psstrmOut->WritePos()); + } + break; + case kopDelete: + if (fConstraints) + { + gAssert(false); + } + else + { + gAssert(*pfMustGet); + DoDelete(ptman, psstrmIn, psstrmOut); + *pfMustGet = false; + } + break; + case kopAssoc: + c = Uint8(*pbNext++); + // std::vector vnTmp; + for (i = 0; i < c; i++) + vnTmp.push_back(Int8(*pbNext++)); + if (fConstraints) + { + gAssert(false); + } + else + { + gAssert(!*pfMustGet); + DoAssoc(c, vnTmp, *pfInserting, psstrmIn, psstrmOut); + } + break; + case kopCntxtItem: + islotArg = Int8(*pbNext++); + c = Uint8(*pbNext++); + if (fConstraints) + { + // Old approach: + // If this is NOT the relevant item, push TRUE, which causes the subsequent tests + // (which are eventually ORed with it) to become irrelevant. + //vnStack.Push((int)(islotArg != islot)); + + // If this is not the relevant item, skip the specified number of bytes. + if (islotArg != islot) + { + pbNext += c; + vnStack.push_back(1); + } + } + else + { + gAssert(false); + } + break; + + case kopAttrSet: + case kopAttrAdd: + case kopAttrSub: + case kopAttrSetSlot: + slat = SlotAttrName(Uint8(*pbNext++)); // slot attribute ID + if (fConstraints) + { + gAssert(false); + } + else + { + gAssert(!*pfMustGet); + DoSetAttr(ptman, op, *pfInserting, slat, -1, vnStack, psstrmIn, psstrmOut); + if (*psmf != ksmfContinue) + return 0; + } + break; + case kopIAttrSet: + case kopIAttrAdd: + case kopIAttrSub: + case kopIAttrSetSlot: + slat = SlotAttrName(Uint8(*pbNext++)); // slot attribute ID + nIndex = Uint8(*pbNext++); // index; eg, global ID for component + if (fConstraints) + { + gAssert(false); + } + else + { + gAssert(!*pfMustGet); + DoSetAttr(ptman, op, *pfInserting, slat, nIndex, vnStack, + psstrmIn, psstrmOut); + if (*psmf != ksmfContinue) + return 0; + } + break; + + case kopPushSlotAttr: + slat = SlotAttrName(Uint8(*pbNext++)); + nSlotRef = Int8(*pbNext++); + if (fConstraints) + nSlotRef += islot + 1; // +1 to peek ahead to a slot we haven't "got" yet + DoPushSlotAttr(ptman, nSlotRef, *pfInserting, slat, -1, vnStack, psstrmIn, psstrmOut); + if (*psmf != ksmfContinue) + return 0; + break; + case kopPushISlotAttr: + slat = SlotAttrName(Uint8(*pbNext++)); + nSlotRef = Int8(*pbNext++); + nIndex = Uint8(*pbNext++); + if (fConstraints) + nSlotRef += islot + 1; // +1 to peek ahead to a slot we haven't "got" yet + DoPushSlotAttr(ptman, nSlotRef, *pfInserting, slat, nIndex, vnStack, psstrmIn, psstrmOut); + if (*psmf != ksmfContinue) + return 0; + break; + + case kopPushGlyphAttrObs: + case kopPushAttToGAttrObs: + case kopPushGlyphAttr: + case kopPushAttToGlyphAttr: + if (op == kopPushGlyphAttrObs || op == kopPushAttToGAttrObs) + nGlyphAttr = Uint8(*pbNext++); + else { + nGlyphAttr = (Uint8(*pbNext++) << 8); + nGlyphAttr += Uint8(*pbNext++); + } + nSlotRef = Int8(*pbNext++); + if (fConstraints) + nSlotRef += islot + 1; // +1 to peek ahead to a slot we haven't "got" yet + if (op == kopPushAttToGlyphAttr || op == kopPushAttToGAttrObs) + DoPushAttToGlyphAttr(ptman, nSlotRef, *pfInserting, nGlyphAttr, + vnStack, psstrmIn, psstrmOut); + else + DoPushGlyphAttr(ptman, nSlotRef, *pfInserting, nGlyphAttr, vnStack, + psstrmIn, psstrmOut); + if (*psmf != ksmfContinue) + return 0; + break; + case kopPushGlyphMetric: + case kopPushAttToGlyphMetric: + nGlyphAttr = Uint8(*pbNext++); + nSlotRef = Int8(*pbNext++); + nAttLevel = Int8(*pbNext++); + if (fConstraints) + nSlotRef += islot + 1; // +1 to peek ahead to a slot we haven't "got" yet + if (op == kopPushAttToGlyphMetric) + DoPushAttToGlyphMetric(ptman, nSlotRef, *pfInserting, nGlyphAttr, nAttLevel, + vnStack, psstrmIn, psstrmOut); + else + DoPushGlyphMetric(ptman, nSlotRef, *pfInserting, nGlyphAttr, nAttLevel, + vnStack, psstrmIn, psstrmOut); + if (*psmf != ksmfContinue) + return 0; + break; + case kopPushFeat: + nFeat = Uint8(*pbNext++); + nSlotRef = Int8(*pbNext++); + if (fConstraints) + nSlotRef += islot + 1; // +1 to peek ahead to a slot we haven't "got" yet +// else +// nSlotRef = 0; + DoPushFeatValue(ptman, nSlotRef, *pfInserting, nFeat, vnStack, psstrmIn, psstrmOut); + if (*psmf != ksmfContinue) + return 0; + break; + case kopPushProcState: + nPState = Uint8(*pbNext++); + gAssert(fConstraints); + DoPushProcState(ptman, nPState, vnStack); + break; + case kopPushVersion: + vnStack.push_back(kRuleVersion); + break; + case kopPopRet: + if ((*psmf = CheckStack(vnStack, 1)) != ksmfContinue) + return 0; + nRet = vnStack.back(); + vnStack.pop_back(); + if (vnStack.size() != 0) + { + gAssert(false); + *psmf = ksmfStackNotEmptied; + } + else + *psmf = ksmfDone; + break; + case kopRetZero: + nRet = 0; + if (vnStack.size() != 0) + { + gAssert(false); + *psmf = ksmfStackNotEmptied; + } + else + *psmf = ksmfDone; + break; + case kopRetTrue: + nRet = 1; + if (vnStack.size() != 0) + { + gAssert(false); + *psmf = ksmfStackNotEmptied; + } + else + *psmf = ksmfDone; + break; + + default: + gAssert(false); + } + + *ppbArg = pbNext; + return nRet; +} + +/*---------------------------------------------------------------------------------------------- + Perform arithmetic functions that take two arguments. +----------------------------------------------------------------------------------------------*/ +void GrPass::DoStackArithmetic2Args(ActionCommand op, std::vector & vnStack, + StackMachineFlag * psmf) +{ + if ((*psmf = CheckStack(vnStack, 2)) != ksmfContinue) + return; + + int nArg2 = vnStack.back(); + vnStack.pop_back(); + int nArg1 = vnStack.back(); + vnStack.pop_back(); + + int nResult; + + switch (op) + { + case kopAdd: nResult = nArg1 + nArg2; break; + case kopSub: nResult = nArg1 - nArg2; break; + case kopMul: nResult = nArg1 * nArg2; break; + case kopDiv: nResult = nArg1 / nArg2; break; + case kopMin: nResult = min(nArg1, nArg2); break; + case kopMax: nResult = max(nArg1, nArg2); break; + case kopAnd: nResult = (nArg1 != 0 && nArg2 != 0)? 1: 0; break; + case kopOr: nResult = (nArg1 != 0 || nArg2 != 0)? 1: 0; break; + case kopEqual: nResult = (nArg1 == nArg2)? 1: 0; break; + case kopNotEq: nResult = (nArg1 != nArg2)? 1: 0; break; + case kopLess: nResult = (nArg1 < nArg2)? 1: 0; break; + case kopLessEq: nResult = (nArg1 <= nArg2)? 1: 0; break; + case kopGtr: nResult = (nArg1 > nArg2)? 1: 0; break; + case kopGtrEq: nResult = (nArg1 >= nArg2)? 1: 0; break; + default: + Assert(false); + } + + vnStack.push_back(nResult); +} + +/*---------------------------------------------------------------------------------------------- + Perform arithmetic functions that take one argument. +----------------------------------------------------------------------------------------------*/ +void GrPass::DoStackArithmetic1Arg(ActionCommand op, std::vector & vnStack, + StackMachineFlag * psmf) +{ + if ((*psmf = CheckStack(vnStack, 1)) != ksmfContinue) + return; + + int nArg = vnStack.back(); + vnStack.pop_back(); + int nResult; + + switch (op) + { + case kopNeg: nResult = nArg * -1; break; + case kopTrunc8: nResult = nArg & 0xFF; break; + case kopTrunc16: nResult = nArg & 0xFFFF; break; + case kopNot: nResult = (nArg == 0)? 1: 0; break; + default: + Assert(false); + } + + vnStack.push_back(nResult); +} + +/*---------------------------------------------------------------------------------------------- + Perform the conditional statement. +----------------------------------------------------------------------------------------------*/ +void GrPass::DoConditional(std::vector & vnStack, StackMachineFlag * psmf) +{ + if ((*psmf = CheckStack(vnStack, 3)) != ksmfContinue) + return; + + int nArg3 = vnStack.back(); + vnStack.pop_back(); + int nArg2 = vnStack.back(); + vnStack.pop_back(); + int nArg1 = vnStack.back(); + vnStack.pop_back(); + + if (nArg1 == 0) + vnStack.push_back(nArg3); + else + vnStack.push_back(nArg2); +} + +/*---------------------------------------------------------------------------------------------- + Check to make sure the stack has the appropriate number of items on it; if not, + return a stack error flag. +----------------------------------------------------------------------------------------------*/ +GrPass::StackMachineFlag GrPass::CheckStack(std::vector & vnStack, int cn) +{ + if (signed(vnStack.size()) < cn) + return ksmfUnderflow; + else + return ksmfContinue; +} + +/*---------------------------------------------------------------------------------------------- + We are finished processing a slot; go on to the next slot, or possibly go backwards. +----------------------------------------------------------------------------------------------*/ +void GrPass::DoNext(GrTableManager * /*ptman*/, +#ifdef NDEBUG + int, +#else + int cslot, +#endif + GrSlotStream * /*psstrmIn*/, GrSlotStream * /*psstrmOut*/) +{ + gAssert(cslot == 1); // for now anyway +} + +/*---------------------------------------------------------------------------------------------- + Set the next glyph to be the given class. There should only be one member of the class, + but if there happens to be more than one, just use the first member. + All the slot attributes remain unchanged from the current input slot; associations are + neutralized. + + @param ptman - table manager, for generating new slots + @param fInserting - true if this slot is being inserted, not copied + @param nReplacementClass - class from which to take replacement glyph (corresponding to + selector slot's glyph's index in selector class) + @param psstrmIn / Out - input/output streams +----------------------------------------------------------------------------------------------*/ +void GrPass::DoPutGlyph(GrTableManager * ptman, bool fInserting, int nReplacementClass, + GrSlotStream * psstrmIn, GrSlotStream * psstrmOut) +{ + EngineState * pengst = ptman->State(); + + // If we are exactly at the segment boundary, pass the information on to the output stream. + // Note that inserted items always go outside the segment, if they are at the boundary + // (you DON'T want them between the segment boundary and the LB slot!). + bool fSetSegMin = psstrmIn->AtSegMin() && !fInserting; + bool fSetSegLim = psstrmIn->AtSegLim(); + + // Slot to copy features and text properties from: + GrSlotState * pslotNextInput; + if (psstrmIn->AtEndOfContext()) + { + gAssert(fInserting); + pslotNextInput = psstrmIn->RuleInputSlot(0, psstrmOut); + } + else + pslotNextInput = (fInserting)? psstrmIn->Peek(): psstrmIn->NextGet(); + + gid16 nGlyphReplacement = ptman->GetClassGlyphIDAt(nReplacementClass, 0); + + GrSlotState * pslotNew; + if (fInserting) + { + pengst->NewSlot(nGlyphReplacement, pslotNextInput, m_ipass, &pslotNew); + // leave associations empty; eventually they will be "neutralized" + } + else + { + pengst->NewSlotCopy(pslotNextInput, m_ipass, &pslotNew); + pslotNew->SetGlyphID(nGlyphReplacement); + ptman->SetSlotAttrsFromGlyphAttrs(pslotNew); + } + + if (fSetSegMin) + psstrmOut->SetSegMinToWritePos(false); + if (fSetSegLim) + psstrmOut->SetSegLimToWritePos(false); + //gid16 chw; chw = pslotNew->GlyphID(); + psstrmOut->NextPut(pslotNew); +} + +/*---------------------------------------------------------------------------------------------- + Copy a glyph from the given slot in the input to the output. All the associations and slot + attributes are copied from the specified slot as well. Consume a slot from the input + (which may or may not be the slot we're copying). + + @param ptman - table manager, for generating new slots + @param fInserting - true if this slot is being inserted, not copied + @param cslotCopyFrom - slot to copy from + @param psstrmIn / Out - input/output streams +----------------------------------------------------------------------------------------------*/ +void GrPass::DoPutCopy(GrTableManager * ptman, bool fInserting, int cslotCopyFrom, + GrSlotStream * psstrmIn, GrSlotStream * psstrmOut) +{ + EngineState * pengst = ptman->State(); + + // If we are exactly at the segment boundary, pass the information on to the output stream. + // Note that inserted items always go outside the segment, if they are at the boundary. + bool fSetSegMin = psstrmIn->AtSegMin() && !fInserting; + bool fSetSegLim = psstrmIn->AtSegLim(); + + if (!fInserting) + { + gAssert(!psstrmIn->AtEndOfContext()); + // Absorb next slot + psstrmIn->NextGet(); + } + + GrSlotState * pslotCopyFrom = psstrmIn->RuleInputSlot(cslotCopyFrom, psstrmOut); + + GrSlotState * pslotNew; + pengst->NewSlotCopy(pslotCopyFrom, m_ipass, &pslotNew); + + if (fSetSegMin) + psstrmOut->SetSegMinToWritePos(false); + if (fSetSegLim) + psstrmOut->SetSegLimToWritePos(false); + //gid16 chw; chw = pslotNew->GlyphID(); + psstrmOut->NextPut(pslotNew); +} + +/*---------------------------------------------------------------------------------------------- + Copy the current slot from the input to the output, substituting the corresponding glyph + in the output class. All the associations and slot attributes remain unchanged from the + current input slot. + + @param ptman - table manager, for generating new slots + @param fInserting - true if this slot is being inserted, not copied + @param cslotSel - selector slot, relative to current slot + @param nSelectorClass - class of selector slot + @param nReplacementClass - class from which to take replacement glyph (corresponding to + selector slot's glyph's index in selector class) + @param psstrmIn / Out - input/output streams +----------------------------------------------------------------------------------------------*/ +void GrPass::DoPutSubs(GrTableManager * ptman, bool fInserting, + int cslotSel, int nSelClass, int nReplacementClass, + GrSlotStream * psstrmIn, GrSlotStream * psstrmOut) +{ + bool fAtSegMin, fAtSegLim; + GrSlotState * pslotNextInput; + DoPutSubsInit(psstrmIn, psstrmOut, fInserting, &pslotNextInput, &fAtSegMin, &fAtSegLim); + + GrSlotState * pslotInSelector = psstrmIn->RuleInputSlot(cslotSel, psstrmOut); + + gid16 gidSelector = pslotInSelector->GlyphID(); + int nSelIndex = ptman->GetIndexInGlyphClass(nSelClass, gidSelector); + gAssert(nSelIndex != -1); + gid16 gidReplacement = (nSelIndex == -1)? + gidSelector: + ptman->GetClassGlyphIDAt(nReplacementClass, nSelIndex); + + DoPutSubsAux(ptman, fInserting, gidReplacement, psstrmIn, psstrmOut, pslotNextInput, + fAtSegMin, fAtSegLim); +} + +/*---------------------------------------------------------------------------------------------- + Copy the current slot from the input to the output, substituting the corresponding glyph + in the output class based on 2 input classes. All the associations and slot attributes + remain unchanged from the current input slot. + + @param ptman - table manager, for generating new slots + @param fInserting - true if this slot is being inserted, not copied + @param cslotSel - selector slot, relative to current slot + @param nSelectorClass - class of selector slot + @param nReplacementClass - class from which to take replacement glyph (corresponding to + selector slot's glyph's index in selector class) + @param psstrmIn / Out - input/output streams +----------------------------------------------------------------------------------------------*/ +void GrPass::DoPutSubs2(GrTableManager * ptman, bool fInserting, + int cslotSel1, int nSelClass1, int cslotSel2, int nSelClass2, int nReplacementClass, + GrSlotStream * psstrmIn, GrSlotStream * psstrmOut) +{ + bool fAtSegMin, fAtSegLim; + GrSlotState * pslotNextInput; + DoPutSubsInit(psstrmIn, psstrmOut, fInserting, &pslotNextInput, &fAtSegMin, &fAtSegLim); + + GrSlotState * pslotInSelector1 = psstrmIn->RuleInputSlot(cslotSel1, psstrmOut); + gid16 gidSelector1 = pslotInSelector1->GlyphID(); + int nSelIndex1 = ptman->GetIndexInGlyphClass(nSelClass1, gidSelector1); + gAssert(nSelIndex1 != -1); + //size_t cClassLen1 = ptman->NumberOfGlyphsInClass(nSelClass1); + + GrSlotState * pslotInSelector2 = psstrmIn->RuleInputSlot(cslotSel2, psstrmOut); + gid16 gidSelector2 = pslotInSelector2->GlyphID(); + int nSelIndex2 = ptman->GetIndexInGlyphClass(nSelClass2, gidSelector2); + gAssert(nSelIndex2 != -1); + size_t cClassLen2 = ptman->NumberOfGlyphsInClass(nSelClass2); + + int nSelIndex = (nSelIndex1 == -1 || nSelIndex2 == -1) ? + -1 : + (nSelIndex1 * static_cast(cClassLen2)) + nSelIndex2; + + gid16 gidReplacement = (nSelIndex == -1)? + gidSelector1: + ptman->GetClassGlyphIDAt(nReplacementClass, nSelIndex); + + DoPutSubsAux(ptman, fInserting, gidReplacement, psstrmIn, psstrmOut, pslotNextInput, + fAtSegMin, fAtSegLim); +} + +/*---------------------------------------------------------------------------------------------- + Copy the current slot from the input to the output, substituting the corresponding glyph + in the output class based on 2 input classes. All the associations and slot attributes + remain unchanged from the current input slot. + + @param ptman - table manager, for generating new slots + @param fInserting - true if this slot is being inserted, not copied + @param cslotSel - selector slot, relative to current slot + @param nSelectorClass - class of selector slot + @param nReplacementClass - class from which to take replacement glyph (corresponding to + selector slot's glyph's index in selector class) + @param psstrmIn / Out - input/output streams +----------------------------------------------------------------------------------------------*/ +void GrPass::DoPutSubs3(GrTableManager * ptman, bool fInserting, + int cslotSel1, int nSelClass1, int cslotSel2, int nSelClass2, int /*cslotSel3*/, int nSelClass3, + int nReplacementClass, + GrSlotStream * psstrmIn, GrSlotStream * psstrmOut) +{ + bool fAtSegMin, fAtSegLim; + GrSlotState * pslotNextInput; + DoPutSubsInit(psstrmIn, psstrmOut, fInserting, &pslotNextInput, &fAtSegMin, &fAtSegLim); + + GrSlotState * pslotInSelector1 = psstrmIn->RuleInputSlot(cslotSel1, psstrmOut); + gid16 gidSelector1 = pslotInSelector1->GlyphID(); + int nSelIndex1 = ptman->GetIndexInGlyphClass(nSelClass1, gidSelector1); + gAssert(nSelIndex1 != -1); + //size_t cClassLen1 = ptman->NumberOfGlyphsInClass(nSelClass1); + + GrSlotState * pslotInSelector2 = psstrmIn->RuleInputSlot(cslotSel2, psstrmOut); + gid16 gidSelector2 = pslotInSelector2->GlyphID(); + int nSelIndex2 = ptman->GetIndexInGlyphClass(nSelClass2, gidSelector2); + gAssert(nSelIndex2 != -1); + size_t cClassLen2 = ptman->NumberOfGlyphsInClass(nSelClass2); + +// GrSlotState * pslotInSelector3 = psstrmIn->RuleInputSlot(cslotSel3, psstrmOut); +// gid16 gidSelector3 = pslotInSelector3->GlyphID(); + int nSelIndex3 = ptman->GetIndexInGlyphClass(nSelClass3, gidSelector2); + gAssert(nSelIndex3 != -1); + size_t cClassLen3 = ptman->NumberOfGlyphsInClass(nSelClass3); + + int nSelIndex = (nSelIndex1 == -1 || nSelIndex2 == -1 || nSelIndex3 == -1) ? + -1 : + (((nSelIndex1 * static_cast(cClassLen2)) + nSelIndex2) * static_cast(cClassLen3)) + nSelIndex3; + + gid16 gidReplacement = (nSelIndex == -1)? + gidSelector1: + ptman->GetClassGlyphIDAt(nReplacementClass, nSelIndex); + + DoPutSubsAux(ptman, fInserting, gidReplacement, psstrmIn, psstrmOut, pslotNextInput, + fAtSegMin, fAtSegLim); +} + + +/*---------------------------------------------------------------------------------------------- + Initial common part of all the DoPutSubs... methods. +----------------------------------------------------------------------------------------------*/ +void GrPass::DoPutSubsInit(GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, bool fInserting, + GrSlotState ** ppslotNextInput, bool * pfAtSegMin, bool * pfAtSegLim) +{ + // Do this before reading from stream. + *pfAtSegMin = psstrmIn->AtSegMin(); + *pfAtSegLim = psstrmIn->AtSegLim(); + + // Slot to copy features and text properties from: + if (psstrmIn->AtEndOfContext()) + { + gAssert(fInserting); + *ppslotNextInput = psstrmIn->RuleInputSlot(0, psstrmOut); + } + else + *ppslotNextInput = (fInserting)? psstrmIn->Peek(): psstrmIn->NextGet(); +} + +/*---------------------------------------------------------------------------------------------- + Common part of all the DoPutSubs... methods. +----------------------------------------------------------------------------------------------*/ +void GrPass::DoPutSubsAux(GrTableManager * ptman, bool fInserting, gid16 nGlyphReplacement, + GrSlotStream * /*psstrmIn*/, GrSlotStream * psstrmOut, GrSlotState * pslotNextInput, + bool fAtSegMin, bool fAtSegLim) +{ + EngineState * pengst = ptman->State(); + + // If we are exactly at the segment boundary, pass the information on to the output stream. + // Note that inserted items always go outside the segment, if they are at the boundary. + bool fSetSegMin = fAtSegMin && !fInserting; + bool fSetSegLim = fAtSegLim; + + GrSlotState * pslotNew; + if (fInserting) + { + pengst->NewSlot(nGlyphReplacement, pslotNextInput, m_ipass, &pslotNew); + // leave associations empty; eventually they will be "neutralized" + } + else + { + pengst->NewSlotCopy(pslotNextInput, m_ipass, &pslotNew); + pslotNew->SetGlyphID(nGlyphReplacement); + ptman->SetSlotAttrsFromGlyphAttrs(pslotNew); + } + + if (fSetSegMin) + psstrmOut->SetSegMinToWritePos(false); + if (fSetSegLim) + psstrmOut->SetSegLimToWritePos(false); + //gid16 chw; chw = pslotNew->GlyphID(); + psstrmOut->NextPut(pslotNew); +} + +/*---------------------------------------------------------------------------------------------- + A slot has just been inserted. Clear all the associations; eventually (unless we go on + to set the associations explicitly) we will set its before-assoc to the slot after it + and its after-assoc to the slot before it. This makes it basically unselectable. + OBSOLETE - handled by slot initialization code +----------------------------------------------------------------------------------------------*/ +void GrPass::SetNeutralAssocs(GrSlotState * pslotNew, GrSlotStream * /*psstrmIn*/) +{ + pslotNew->ClearAssocs(); +} + +/*---------------------------------------------------------------------------------------------- + Delete the next slot in the input. + + @param psstrmIn - input stream + @param psstrmOut - output stream +----------------------------------------------------------------------------------------------*/ +void GrPass::DoDelete(GrTableManager * ptman, GrSlotStream * psstrmIn, GrSlotStream * psstrmOut) +{ + if (psstrmIn->AtSegMin()) + psstrmOut->SetSegMinToWritePos(); + if (psstrmIn->AtSegLim()) + psstrmOut->SetSegLimToWritePos(); + + GrSlotState * pslot = psstrmIn->NextGet(); + //gid16 chw; chw = pslotNew->GlyphID(); + pslot->MarkDeleted(); + + if (ptman->LoggingTransduction()) + m_pzpst->RecordDeletionBefore(psstrmOut->WritePos()); +} + +/*---------------------------------------------------------------------------------------------- + Set the associations for the current slot. Any previous associations will be overwritten. + + @param cn - number of associations + @param vnAssoc - list of associations + @param fInserting - whether current slot was inserted + @param psstrmIn / Out - input/output streams +----------------------------------------------------------------------------------------------*/ +void GrPass::DoAssoc(int cnAssocs, std::vector & vnAssocs, bool /*fInserting*/, + GrSlotStream * psstrmIn, GrSlotStream * psstrmOut) +{ + gAssert((unsigned)cnAssocs == vnAssocs.size()); + + // Sort the list of associations. It's okay to use a simple bubble sort + // since we expect the list to be very short. Ideally we should remove duplicates + // too but I don't think duplicates actually hurt anything. + for (int i1 = 0; i1 < cnAssocs - 1; i1++) + { + for (int i2 = i1 + 1; i2 < cnAssocs; i2++) + { + if (vnAssocs[i2] < vnAssocs[i1]) + { + int nTmp = vnAssocs[i2]; + vnAssocs[i2] = vnAssocs[i1]; + vnAssocs[i1] = nTmp; + } + } + } + + std::vector vpslotAssocs; + vpslotAssocs.resize(cnAssocs); + for (int i = 0; i < cnAssocs; i++) + vpslotAssocs[i] = psstrmIn->RuleInputSlot(vnAssocs[i], psstrmOut); + + GrSlotState * pslot = psstrmOut->RuleOutputSlot(); + pslot->Associate(vpslotAssocs); +} + +/*---------------------------------------------------------------------------------------------- + Set a slot attribute for the current slot; the value is on the stack. + + @param op - command + @param fInserting - whether current slot was inserted + @param slat - slot attribute to set + @param slati - slot attribute index, or -1 for non-indexed attribute + @param vnStack - stack to read value from + @param psstrmIn / Out - input/output streams +----------------------------------------------------------------------------------------------*/ +#ifdef NDEBUG +void GrPass::DoSetAttr(GrTableManager * ptman, ActionCommand op, bool /*fInserting*/, +#else +void GrPass::DoSetAttr(GrTableManager * ptman, ActionCommand op, bool fInserting, +#endif + SlotAttrName slat, int slati, std::vector & vnStack, + GrSlotStream * psstrmIn, GrSlotStream * psstrmOut) +{ + int nVal = vnStack.back(); + vnStack.pop_back(); + + if (slat == kslatUserDefnV1) + slat = kslatUserDefn; + + if (slati != -1 && slat != kslatCompRef && slat != kslatUserDefn) + { + // Invalid slot attribute index. + gAssert(false); + slati = -1; + } + + if (slati == -1 && (slat == kslatCompRef || slat == kslatUserDefn)) + { + // Missing slot attribute index. + gAssert(false); + slati = 0; + } + + if (slat == kslatPosX || slat == kslatPosY) + { + // Doesn't make sense to set the pos attribute. + gAssert(false); + return; + } + + GrSlotState * pslotIn = psstrmIn->RuleInputSlot(0, psstrmOut); + + GrSlotState * pslotComp; + + int nOldVal; + + if (op == kopAttrAdd || op == kopAttrSub || op == kopIAttrAdd || op == kopIAttrSub) + { + // Incrementing or decrementing. + + gAssert(!fInserting); + + switch (slat) + { + case kslatAdvX: nOldVal = pslotIn->AdvanceX(ptman); break; + case kslatAdvY: nOldVal = pslotIn->AdvanceY(ptman); break; + case kslatShiftX: nOldVal = pslotIn->ShiftX(); break; + case kslatShiftY: nOldVal = pslotIn->ShiftY(); break; + + case kslatAttAtX: nOldVal = pslotIn->AttachAtX(ptman, psstrmIn); break; + case kslatAttAtY: nOldVal = pslotIn->AttachAtY(); break; + case kslatAttAtXoff: nOldVal = pslotIn->AttachAtXOffset(); break; + case kslatAttAtYoff: nOldVal = pslotIn->AttachAtYOffset(); break; + + case kslatAttWithX: nOldVal = pslotIn->AttachWithX(ptman, psstrmIn); break; + case kslatAttWithY: nOldVal = pslotIn->AttachWithY(); break; + case kslatAttWithXoff: nOldVal = pslotIn->AttachWithXOffset(); break; + case kslatAttWithYoff: nOldVal = pslotIn->AttachWithYOffset(); break; + + case kslatUserDefn: nOldVal = pslotIn->UserDefn(slati); break; + + case kslatMeasureSol: nOldVal = pslotIn->MeasureSol(); break; + case kslatMeasureEol: nOldVal = pslotIn->MeasureEol(); break; + + case kslatJStretch: nOldVal = pslotIn->JStretch(); break; + case kslatJShrink: nOldVal = pslotIn->JShrink(); break; + case kslatJStep: nOldVal = pslotIn->JStep(); break; + case kslatJWeight: nOldVal = pslotIn->JWeight(); break; + case kslatJWidth: nOldVal = pslotIn->JWidth(); break; + + // These are kind of odd, but maybe. + case kslatAttLevel: nOldVal = pslotIn->AttachLevel(); break; + case kslatBreak: nOldVal = pslotIn->BreakWeight(); break; + case kslatDir: nOldVal = pslotIn->Directionality(); break; + + case kslatSegsplit: nOldVal = 0; break; + + default: + // Kind of attribute that it makes no sense to increment. + gAssert(false); + return; + } + + if (op == kopAttrAdd || op == kopIAttrAdd) + nVal = nOldVal + nVal; + else + { + gAssert(op == kopAttrSub || op == kopIAttrSub); + nVal = nOldVal - nVal; + } + } + + GrSlotState * pslotOut = psstrmOut->RuleOutputSlot(); + + if (pslotOut->IsLineBreak(ptman->LBGlyphID())) + { + switch (slat) + { + case kslatAdvX: + case kslatAdvY: + case kslatShiftX: + case kslatShiftY: + + case kslatAttTo: + case kslatAttLevel: + case kslatAttAtX: + case kslatAttAtY: + case kslatAttAtGpt: + case kslatAttAtXoff: + case kslatAttAtYoff: + case kslatAttWithX: + case kslatAttWithY: + case kslatAttWithGpt: + case kslatAttWithXoff: + case kslatAttWithYoff: + + case kslatMeasureSol: + case kslatMeasureEol: + + case kslatJStretch: + case kslatJShrink: + case kslatJStep: + case kslatJWeight: + case kslatJWidth: + slat = kslatNoEffect; + break; + default: + ; // okay, do nothing + } + } + + nVal = GrGlyphSubTable::ConvertValueForVersion(nVal, slat, -1, m_fxdVersion); + + switch (slat) + { + case kslatAdvX: pslotOut->SetAdvanceX(nVal); break; + case kslatAdvY: pslotOut->SetAdvanceY(nVal); break; + case kslatShiftX: pslotOut->SetShiftX(nVal); break; + case kslatShiftY: pslotOut->SetShiftY(nVal); break; + + case kslatAttTo: pslotOut->SetAttachTo(nVal); break; + case kslatAttLevel: pslotOut->SetAttachLevel(nVal); break; + case kslatAttAtX: pslotOut->SetAttachAtX(nVal); break; + case kslatAttAtY: pslotOut->SetAttachAtY(nVal); break; + case kslatAttAtGpt: pslotOut->SetAttachAtGpoint(nVal); break; + case kslatAttAtXoff: pslotOut->SetAttachAtXOffset(nVal); break; + case kslatAttAtYoff: pslotOut->SetAttachAtYOffset(nVal); break; + case kslatAttWithX: pslotOut->SetAttachWithX(nVal); break; + case kslatAttWithY: pslotOut->SetAttachWithY(nVal); break; + case kslatAttWithGpt: pslotOut->SetAttachWithGpoint(nVal); break; + case kslatAttWithXoff: pslotOut->SetAttachWithXOffset(nVal); break; + case kslatAttWithYoff: pslotOut->SetAttachWithYOffset(nVal); break; + + case kslatUserDefn: pslotOut->SetUserDefn(slati, nVal); break; + + case kslatCompRef: + gAssert(nVal - 1 >= psstrmIn->RuleStartReadPos() - psstrmIn->ReadPosForNextGet()); + pslotComp = psstrmIn->RuleInputSlot(nVal, psstrmOut); + pslotOut->SetCompRefSlot(ptman, slati, pslotComp); + break; + + case kslatMeasureSol: pslotOut->SetMeasureSol(nVal); break; + case kslatMeasureEol: pslotOut->SetMeasureEol(nVal); break; + + case kslatJStretch: pslotOut->SetJStretch(nVal); break; + case kslatJShrink: pslotOut->SetJShrink(nVal); break; + case kslatJStep: pslotOut->SetJStep(nVal); break; + case kslatJWeight: pslotOut->SetJWeight(nVal); break; + case kslatJWidth: pslotOut->SetJWidth(nVal); break; + + case kslatBreak: pslotOut->SetBreakWeight(nVal); break; + case kslatDir: pslotOut->SetDirectionality(DirCode(nVal)); break; + case kslatInsert: pslotOut->SetInsertBefore((nVal != 0)? true : false); break; + + case kslatSegsplit: break; // not handled + + case kslatNoEffect: + // Do nothing. + break; + + default: + // Kind of attribute that it makes no sense to set. + gAssert(false); + return; + } +} + +/*---------------------------------------------------------------------------------------------- + Push value of a slot attribute onto the stack. + + @param nSlotRef - slot whose attribute we are interested in + @param fInserting - whether current slot was inserted + @param slat - slot attribute to get + @param slati - slot attribute index, or -1 for non-indexed attribute + @param vnStack - stack to push onto + @param psstrmIn - input stream +----------------------------------------------------------------------------------------------*/ +void GrPass::DoPushSlotAttr(GrTableManager * ptman, + int nSlotRef, bool /*fInserting*/, + SlotAttrName slat, int slati, std::vector & vnStack, + GrSlotStream * psstrmIn, GrSlotStream * psstrmOut) +{ + GrSlotState * pslot = psstrmIn->RuleInputSlot(nSlotRef, psstrmOut, true); + if (pslot == NULL) + { + // Non-existent pre-context item. + vnStack.push_back(0); + return; + } + + int nVal; + int xyBogus; + + if (slat == kslatUserDefnV1) + slat = kslatUserDefn; + + if (slati != -1 && slat != kslatCompRef && slat != kslatUserDefn) + { + // Invalid slot attribute index. + gAssert(false); + slati = -1; + } + + if (slati == -1 && (slat == kslatCompRef || slat == kslatUserDefn)) + { + // Missing slot attribute index. + gAssert(false); + slati = 0; + } + + switch (slat) + { + case kslatAdvX: nVal = pslot->AdvanceX(ptman); break; + case kslatAdvY: nVal = pslot->AdvanceY(ptman); break; + case kslatShiftX: nVal = pslot->ShiftX(); break; + case kslatShiftY: nVal = pslot->ShiftY(); break; + + case kslatPosX: pslot->Position(ptman, psstrmIn, &nVal, &xyBogus); break; + case kslatPosY: pslot->Position(ptman, psstrmIn, &xyBogus, &nVal); break; + + case kslatAttTo: nVal = pslot->AttachTo(); break; + case kslatAttLevel: nVal = pslot->AttachLevel(); break; + case kslatAttAtY: nVal = pslot->AttachAtY(); break; + case kslatAttAtGpt: nVal = pslot->AttachAtGpoint(); break; + case kslatAttAtXoff: nVal = pslot->AttachAtXOffset(); break; + case kslatAttAtYoff: nVal = pslot->AttachAtYOffset(); break; + case kslatAttWithY: nVal = pslot->AttachWithY(); break; + case kslatAttWithGpt: nVal = pslot->AttachWithGpoint(); break; + case kslatAttWithXoff: nVal = pslot->AttachWithXOffset(); break; + case kslatAttWithYoff: nVal = pslot->AttachWithYOffset(); break; + case kslatAttAtX: nVal = pslot->AttachAtX(ptman, psstrmIn); break; + case kslatAttWithX: nVal = pslot->AttachWithX(ptman, psstrmIn); break; + + case kslatMeasureSol: nVal = pslot->MeasureSol(); break; + case kslatMeasureEol: nVal = pslot->MeasureEol(); break; + + case kslatJStretch: nVal = pslot->JStretch(); break; + case kslatJShrink: nVal = pslot->JShrink(); break; + case kslatJStep: nVal = pslot->JStep(); break; + case kslatJWeight: nVal = pslot->JWeight(); break; + case kslatJWidth: nVal = pslot->JWidth(); break; + + case kslatBreak: nVal = pslot->BreakWeight(); break; + case kslatDir: nVal = pslot->Directionality(); break; + case kslatInsert: nVal = pslot->InsertBefore(); break; + + case kslatSegsplit: nVal = 0; break; // not used in this engine + + case kslatUserDefn: nVal = pslot->UserDefn(slati); break; + + // Currently no way to look up component.X.ref. + + default: + // Invalid attribute. + gAssert(false); + nVal = 0; + } + + vnStack.push_back(nVal); +} + +/*---------------------------------------------------------------------------------------------- + Push value of a glyph attribute onto the stack. + + @param nSlotRef - slot whose attribute we are interested in + @param fInserting - whether current slot was inserted + @param nGlyphAttr - glyph attribute to get + @param vnStack - stack to push onto + @param psstrmIn - input stream +----------------------------------------------------------------------------------------------*/ +void GrPass::DoPushGlyphAttr(GrTableManager * ptman, int nSlotRef, bool /*fInserting*/, + int nGlyphAttr, + std::vector & vnStack, GrSlotStream * psstrmIn, GrSlotStream * psstrmOut) +{ + GrSlotState * pslot = psstrmIn->RuleInputSlot(nSlotRef, psstrmOut, true); + if (pslot == NULL) + { + // Non-existent pre-context item. + vnStack.push_back(0); + return; + } + int nVal = pslot->GlyphAttrValueEmUnits(ptman, nGlyphAttr); + vnStack.push_back(nVal); +} + +/*---------------------------------------------------------------------------------------------- + Push value of a glyph attribute onto the stack. The slot of interest is the slot to + which the current slot is attached. + + @param nSlotRef - leaf slot + @param fInserting - whether current slot was inserted + @param nGlyphAttr - glyph attribute to get + @param vnStack - stack to push onto + @param psstrmIn - input stream +----------------------------------------------------------------------------------------------*/ +void GrPass::DoPushAttToGlyphAttr(GrTableManager * ptman, int nSlotRef, bool /*fInserting*/, + int nGlyphAttr, std::vector & vnStack, + GrSlotStream * psstrmIn, GrSlotStream * psstrmOut) +{ + // Note that it is the slot in the output stream that has + // the relevant attach.to attribute set. + GrSlotState * pslotLeaf = psstrmOut->RuleOutputSlot(0); + int srAttTo = pslotLeaf->AttachTo(); + if (srAttTo == 0) + { + gAssert(false); + vnStack.push_back(0); + return; + } + + GrSlotState * pslotRoot = psstrmIn->RuleInputSlot(nSlotRef + srAttTo, psstrmOut); + int nVal = pslotRoot->GlyphAttrValueEmUnits(ptman, nGlyphAttr); + vnStack.push_back(nVal); +} + +/*---------------------------------------------------------------------------------------------- + Push value of a glyph metric onto the stack. + + @param nSlotRef - slot whose attribute we are interested in + @param fInserting - whether current slot was inserted + @param nGlyphAttr - glyph attribute to get + @param nAttLevel - for accessing composite metrics + @param vnStack - stack to push onto + @param psstrmIn - input stream +----------------------------------------------------------------------------------------------*/ +void GrPass::DoPushGlyphMetric(GrTableManager * ptman, int nSlotRef, bool /*fInserting*/, + int nGlyphAttr, int nAttLevel, + std::vector & vnStack, GrSlotStream * psstrmIn, GrSlotStream * psstrmOut) +{ + GrSlotState * pslot = psstrmIn->RuleInputSlot(nSlotRef, psstrmOut, true); + if (pslot == NULL) + { + // Non-existent pre-context item. + vnStack.push_back(0); + return; + } + + DoPushGlyphMetricAux(ptman, pslot, nGlyphAttr, nAttLevel, vnStack, psstrmIn); +} + +/*---------------------------------------------------------------------------------------------- + Push value of a glyph metric onto the stack. The slot of interest is the slot to + which the current slot is attached. + + @param nSlotRef - slot whose attribute we are interested in + @param fInserting - whether current slot was inserted + @param nGlyphAttr - glyph attribute to get + @param nAttLevel - for accessing composite metrics + @param vnStack - stack to push onto + @param psstrmIn - input stream + @param psstrmOut - output stream +----------------------------------------------------------------------------------------------*/ +void GrPass::DoPushAttToGlyphMetric(GrTableManager * ptman, int nSlotRef, bool /*fInserting*/, + int nGlyphAttr, int nAttLevel, + std::vector & vnStack, + GrSlotStream * psstrmIn, GrSlotStream * psstrmOut) +{ + // Note that it is the slot in the output stream that has + // the relevant attach.to attribute set. + GrSlotState * pslotLeaf = psstrmOut->RuleOutputSlot(0); + int srAttTo = pslotLeaf->AttachTo(); + if (srAttTo == 0) + { + gAssert(false); + vnStack.push_back(0); + return; + } + + GrSlotState * pslot = psstrmIn->RuleInputSlot(nSlotRef + srAttTo, psstrmOut); + + DoPushGlyphMetricAux(ptman, pslot, nGlyphAttr, nAttLevel, vnStack, psstrmIn); +} + +/*--------------------------------------------------------------------------------------------*/ + +void GrPass::DoPushGlyphMetricAux(GrTableManager * ptman, + GrSlotState * pslot, int nGlyphAttr, int nAttLevel, + std::vector & vnStack, GrSlotStream * psstrmIn) +{ + int mVal; + GlyphMetric gmet = GlyphMetric(nGlyphAttr); + if (nAttLevel == 0 || gmet == kgmetAscent || gmet == kgmetDescent) + { + mVal = pslot->GlyphMetricEmUnits(ptman, nGlyphAttr); + } + else + { + pslot->CalcCompositeMetrics(ptman, psstrmIn, NULL, nAttLevel, true); + + float xy; + switch (gmet) + { + case kgmetLsb: xy = pslot->ClusterLsb(psstrmIn); break; + case kgmetRsb: xy = pslot->ClusterRsb(psstrmIn); break; + case kgmetBbTop: xy = pslot->ClusterBbTop(psstrmIn); break; + case kgmetBbBottom: xy = pslot->ClusterBbBottom(psstrmIn); break; + case kgmetBbLeft: xy = pslot->ClusterBbLeft(psstrmIn); break; + case kgmetBbRight: xy = pslot->ClusterBbRight(psstrmIn); break; + case kgmetBbHeight: xy = pslot->ClusterBbHeight(psstrmIn); break; + case kgmetBbWidth: xy = pslot->ClusterBbWidth(psstrmIn); break; +// case kgmetAdvHeight: xy = pslot->ClusterAdvHeight(psstrmIn); break; + case kgmetAdvWidth: xy = pslot->ClusterAdvWidth(psstrmIn); break; + default: + gAssert(false); + xy = 0; + } + mVal = ptman->LogToEmUnits(xy); + } + + vnStack.push_back(mVal); +} + +/*---------------------------------------------------------------------------------------------- + Push a feature value onto the stack. For rule actions, the slot of interest is the + current slot. + + @param nSlotRef - slot being examined + @param fInserting - whether current slot was inserted + @param nFeat - feature of interest + @param vnStack - stack to push onto + @param psstrmIn - input stream + @param psstrmOut - output stream +----------------------------------------------------------------------------------------------*/ +#ifdef NDEBUG +void GrPass::DoPushFeatValue(GrTableManager * /*ptman*/, int nSlotRef, bool /*fInserting*/, +#else +void GrPass::DoPushFeatValue(GrTableManager * /*ptman*/, int nSlotRef, bool fInserting, +#endif + int nFeat, std::vector & vnStack, GrSlotStream * psstrmIn, GrSlotStream * psstrmOut) +{ + gAssert(!fInserting); + + GrSlotState * pslot = psstrmIn->RuleInputSlot(nSlotRef, psstrmOut, true); + if (pslot == NULL) + { + // Non-existent pre-context item. + vnStack.push_back(0); + return; + } + + int nVal = pslot->FeatureValue(nFeat); + vnStack.push_back(nVal); +} + +/*---------------------------------------------------------------------------------------------- + Push a processing-state value onto the stack. + + @param nFeat - feature of interest + @param vnStack - stack to push onto +----------------------------------------------------------------------------------------------*/ +void GrPass::DoPushProcState(GrTableManager * ptman, int nPState, std::vector & vnStack) +{ + int nValue; + if (nPState == kpstatJustifyMode) + { + // Convert from internal modes to user modes. + int jmodi = ptman->InternalJustificationMode(); + switch (jmodi) + { + case kjmodiNormal: + case kjmodiCanShrink: + nValue = kjmoduNormal; + break; + case kjmodiMeasure: + nValue = kjmoduMeasure; + break; + case kjmodiJustify: + nValue = kjmoduJustify; + break; + default: + gAssert(false); + nValue = kjmoduNormal; + } + } + else if (nPState == kpstatJustifyLevel) + nValue = 1; // TODO: get justify level from ptman + vnStack.push_back(nValue); +} + +} // namespace gr diff --git a/Build/source/libs/graphite/engine-2.4/src/segment/GrPseudoMap.h b/Build/source/libs/graphite/engine-2.4/src/segment/GrPseudoMap.h new file mode 100644 index 00000000000..c6fec210808 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/src/segment/GrPseudoMap.h @@ -0,0 +1,48 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 1999, 2001 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: GrPseudoMap.h +Responsibility: Sharon Correll +Last reviewed: Not yet. + +Description: + The GrPseudoMap class. +----------------------------------------------------------------------------------------------*/ +#ifdef _MSC_VER +#pragma once +#endif +#ifndef GR_PSEUDOMAP_INCLUDED +#define GR_PSEUDOMAP_INCLUDED + +//:End Ignore + +namespace gr +{ + +/*---------------------------------------------------------------------------------------------- + A mapping between a Unicode value and a pseudo-glyph. + + Hungarian: psd +----------------------------------------------------------------------------------------------*/ + +class GrPseudoMap +{ +public: + unsigned int Unicode() { return m_nUnicode; } + gid16 PseudoGlyph() { return m_chwPseudo; } + + void SetUnicode(int n) { m_nUnicode = n; } + void SetPseudoGlyph(gid16 chw) { m_chwPseudo = chw; } + +protected: + // Instance variables: + unsigned int m_nUnicode; + gid16 m_chwPseudo; +}; + +} // namespace gr + +#endif // !GR_PSEUDOMAP_INCLUDED diff --git a/Build/source/libs/graphite/engine-2.4/src/segment/GrSlotState.cpp b/Build/source/libs/graphite/engine-2.4/src/segment/GrSlotState.cpp new file mode 100644 index 00000000000..e8590528827 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/src/segment/GrSlotState.cpp @@ -0,0 +1,1563 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 1999, 2001 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: GrSlotState.cpp +Responsibility: Sharon Correll +Last reviewed: Not yet. + +Description: + GrSlotState class implementation. +-------------------------------------------------------------------------------*//*:End Ignore*/ + +//:>******************************************************************************************** +//:> Include files +//:>******************************************************************************************** +#include "Main.h" + +#ifdef _MSC_VER +#pragma hdrstop +#endif + +//:>******************************************************************************************** +//:> Forward declarations +//:>******************************************************************************************** + +//:>******************************************************************************************** +//:> Local Constants and static variables +//:>******************************************************************************************** + +namespace gr +{ + +//:>******************************************************************************************** +//:> Methods +//:>******************************************************************************************** + +/*---------------------------------------------------------------------------------------------- + Initialize slots. +----------------------------------------------------------------------------------------------*/ +// standard for pass 0 slots +void GrSlotState::Initialize(gid16 chw, GrEngine * pgreng, + GrFeatureValues fval, int ipass, int ichwSegOffset, int nUnicode) +{ + Assert(ipass == 0); + m_chwGlyphID = chw; + m_chwActual = kInvalidGlyph; + m_xysGlyphWidth = kNegInfFloat; + m_bStyleIndex = byte(fval.m_nStyleIndex); + u_intslot nullSlot; + nullSlot.pslot = NULL; + std::fill_n(PUserDefnBuf(), m_cnUserDefn, nullSlot); + std::fill_n(PCompRefBuf(), m_cnCompPerLig, nullSlot); + std::fill_n(PSlatiBuf(), m_cnCompPerLig, nullSlot); + u_intslot * pFeatBuf = PFeatureBuf(); + for (size_t i = 0; i < m_cnFeat; i++) + pFeatBuf[i].nValue = fval.m_rgnFValues[i]; + m_ipassFsmCol = -1; + m_colFsm = -1; + + m_ipassModified = ipass; + m_ichwSegOffset = ichwSegOffset; + m_nUnicode = nUnicode; + m_vpslotAssoc.clear(); + pgreng->InitSlot(this, nUnicode); + + switch (nUnicode) + { + case knLRM: m_spsl = kspslLRM; break; + case knRLM: m_spsl = kspslRLM; break; + case knLRO: m_spsl = kspslLRO; break; + case knRLO: m_spsl = kspslRLO; break; + case knLRE: m_spsl = kspslLRE; break; + case knRLE: m_spsl = kspslRLE; break; + case knPDF: m_spsl = kspslPDF; break; + default: + Assert(m_spsl == kspslNone); + m_spsl = kspslNone; + break; + } +} + +// line-break slots +void GrSlotState::Initialize(gid16 chw, GrEngine * pgreng, + GrSlotState * pslotFeat, int ipass, int ichwSegOffset) +{ + m_chwGlyphID = chw; + m_chwActual = kInvalidGlyph; + m_xysGlyphWidth = kNegInfFloat; + u_intslot nullSlot; + nullSlot.pslot = NULL; + std::fill_n(PUserDefnBuf(), m_cnUserDefn, nullSlot); + std::fill_n(PCompRefBuf(), m_cnCompPerLig, nullSlot); + std::fill_n(PSlatiBuf(), m_cnCompPerLig, nullSlot); + CopyFeaturesFrom(pslotFeat); + m_ipassModified = ipass; + m_ichwSegOffset = ichwSegOffset; + m_nUnicode = -1; + m_vpslotAssoc.clear(); + pgreng->InitSlot(this); + // Caller is responsible for setting m_spsl. + m_ipassFsmCol = -1; + m_colFsm = -1; +} + +// for inserting new slots after pass 0 (under-pos and unicode are irrelevant) +void GrSlotState::Initialize(gid16 chw, GrEngine * pgreng, + GrSlotState * pslotFeat, int ipass) +{ + m_chwGlyphID = chw; + m_chwActual = kInvalidGlyph; + m_xysGlyphWidth = kNegInfFloat; + u_intslot nullSlot; + nullSlot.pslot = NULL; + std::fill_n(PUserDefnBuf(), m_cnUserDefn, nullSlot); + std::fill_n(PCompRefBuf(), m_cnCompPerLig, nullSlot); + std::fill_n(PSlatiBuf(), m_cnCompPerLig, nullSlot); + CopyFeaturesFrom(pslotFeat); + m_ipassModified = ipass; + m_ichwSegOffset = kInvalid; + m_nUnicode = kInvalid; + m_vpslotAssoc.clear(); + pgreng->InitSlot(this); + m_spsl = kspslNone; + m_ipassFsmCol = -1; + m_colFsm = -1; +} + +/*---------------------------------------------------------------------------------------------- + The slot has been modified by the given pass and therefore is in a new state; + make a new SlotState initialized from the old one. +----------------------------------------------------------------------------------------------*/ +void GrSlotState::InitializeFrom(GrSlotState * pslotOld, int ipass) +{ + CopyFrom(pslotOld, false); + + m_ipassModified = ipass; + m_pslotPrevState = pslotOld; + m_ichwSegOffset = kInvalid; + m_vpslotAssoc.clear(); + m_vpslotAssoc.push_back(pslotOld); + + m_dircProc = pslotOld->m_dircProc; + m_fDirProcessed = pslotOld->m_fDirProcessed; + + // Since we're going on to a new pass, no point in copying these: + m_ipassFsmCol = -1; + m_colFsm = -1; + + ////FixAttachmentTree(pslotOld); +} + +/*---------------------------------------------------------------------------------------------- + Copy the features and style information from the given slot. +----------------------------------------------------------------------------------------------*/ +void GrSlotState::CopyFeaturesFrom(GrSlotState * pslotSrc) +{ + m_bStyleIndex = pslotSrc->m_bStyleIndex; + Assert(m_cnFeat == pslotSrc->m_cnFeat); + std::copy(pslotSrc->PFeatureBuf(), pslotSrc->PFeatureBuf() + m_cnFeat, PFeatureBuf()); +} + +/*---------------------------------------------------------------------------------------------- + Copy the basic information. + Warning: the functions below will break if GrSlotState and subclasses are given virtual + methods. In that case, we will need to copy from the address of the first variable in + GrSlotAbstract. +----------------------------------------------------------------------------------------------*/ +void GrSlotState::CopyFrom(GrSlotState * pslot, bool fCopyEverything) +{ + GrSlotAbstract::CopyAbstractFrom(pslot); + std::copy(pslot->m_prgnVarLenBuf, pslot->m_prgnVarLenBuf + CExtraSpace(), m_prgnVarLenBuf); + + if (fCopyEverything) + { + Assert(false); + m_ipassModified = pslot->m_ipassModified; + m_pslotPrevState = pslot->m_pslotPrevState; + m_ichwSegOffset = pslot->m_ichwSegOffset; + m_colFsm = pslot->m_colFsm; + m_ipassFsmCol = pslot->m_ipassFsmCol; + // TODO: copy m_vpslotAssocs. + m_fNeutralAssocs = pslot->m_fNeutralAssocs; + } + + m_dislotRootFixed = pslot->m_dislotRootFixed; + + m_vdislotAttLeaves.resize(pslot->m_vdislotAttLeaves.size()); + for (size_t i = 0; i < pslot->m_vdislotAttLeaves.size(); i++) + m_vdislotAttLeaves[i] = pslot->m_vdislotAttLeaves[i]; + + m_islotPosPass = pslot->m_islotPosPass; + m_nUnicode = pslot->m_nUnicode; + m_dircProc = pslot->m_dircProc; + m_fDirProcessed = pslot->m_fDirProcessed; + m_cnUserDefn = pslot->m_cnUserDefn; + m_cnFeat = pslot->m_cnFeat; + m_bStyleIndex = pslot->m_bStyleIndex; + m_mAdvanceX = pslot->m_mAdvanceX; + m_mAdvanceY = pslot->m_mAdvanceY; + m_mShiftX = pslot->m_mShiftX; + m_mShiftY = pslot->m_mShiftY; + m_srAttachTo = pslot->m_srAttachTo; + m_nAttachLevel = pslot->m_nAttachLevel; + m_mAttachAtX = pslot->m_mAttachAtX; + m_mAttachAtY = pslot->m_mAttachAtY; + m_mAttachAtXOffset = pslot->m_mAttachAtXOffset; + m_mAttachAtYOffset = pslot->m_mAttachAtYOffset; + m_mAttachWithX = pslot->m_mAttachWithX; + m_mAttachWithY = pslot->m_mAttachWithY; + m_mAttachWithXOffset = pslot->m_mAttachWithXOffset; + m_mAttachWithYOffset = pslot->m_mAttachWithYOffset; + m_nAttachAtGpoint = pslot->m_nAttachAtGpoint; + m_nAttachWithGpoint = pslot->m_nAttachWithGpoint; + m_fAttachMod = pslot->m_fAttachMod; + m_fShiftMod = pslot->m_fShiftMod; + m_fIgnoreAdvance = pslot->m_fIgnoreAdvance; + m_fHasComponents = pslot->m_fHasComponents; + + m_nCompositeLevel = kNegInfinity; // uncalculated, so don't need to copy the positions?? +} + +void GrSlotAbstract::CopyAbstractFrom(GrSlotState * pslot) +{ + u_intslot * pnBufSave = m_prgnVarLenBuf; + *this = *pslot; + m_prgnVarLenBuf = pnBufSave; + Assert(m_prgnVarLenBuf); +} + +/*---------------------------------------------------------------------------------------------- + Initialize the output slot from the one use within the passes, with the basic information. + Warning: this function will break if GrSlotState and subclasses are given virtual + methods. In that case, we will need to copy from the address of the first variable in + GrSlotAbstract. +----------------------------------------------------------------------------------------------*/ +void GrSlotOutput::InitializeOutputFrom(GrSlotState * pslot) +{ + CopyAbstractFrom(pslot); + + // Copy just the component information, which is of length (m_cnCompPerLig * 2) + //std::copy(pslot->PCompRefBuf(), + // pslot->PCompRefBuf() + (m_cnCompPerLig * 2), + // this->PCompRefBufSlout()); +} + +/*---------------------------------------------------------------------------------------------- + Return the ID of the actual glyph that will be used for output and metrics. This is the + same for most glyphs, but will be different for pseudo-glyphs. +----------------------------------------------------------------------------------------------*/ +gid16 GrSlotAbstract::ActualGlyphForOutput(GrTableManager * ptman) +{ + if (m_chwActual == kInvalidGlyph) + m_chwActual = ptman->ActualGlyphForOutput(m_chwGlyphID); + return m_chwActual; +} +/*---------------------------------------------------------------------------------------------- + We are replacing the old slot with the recipient. Replace the pointers in any attachment + root or attached leaf slots. + OBSOLETE +----------------------------------------------------------------------------------------------*/ +void GrSlotState::FixAttachmentTree(GrSlotState * /*pslotOld*/) +{ +#if 0 + pslotOld->m_vpslotAttLeaves.CopyTo(m_vpslotAttLeaves); + for (int islot = 0; islot < m_vpslotAttLeaves.Size(); islot++) + { + Assert(m_vpslotAttLeaves[islot]->m_pslotAttRoot == pslotOld); + m_vpslotAttLeaves[islot]->m_pslotAttRoot = this; + } + + m_pslotAttRoot = pslotOld->m_pslotAttRoot; + if (m_pslotAttRoot) + { + for (int islot = 0; islot < m_pslotAttRoot->m_vpslotAttLeaves.Size(); islot++) + { + if (m_pslotAttRoot->m_vpslotAttLeaves[islot] == pslotOld) + { + m_pslotAttRoot->m_vpslotAttLeaves.Delete(islot); + m_pslotAttRoot->m_vpslotAttLeaves.Push(this); + return; + } + } + Assert(false); // didn't find old slot in the list + } +#endif // 0 +} + +/*---------------------------------------------------------------------------------------------- + Make sure all the values are cached that are needed to be copied to the output slots +----------------------------------------------------------------------------------------------*/ +void GrSlotState::EnsureCacheForOutput(GrTableManager * ptman) +{ + // Make sure the actual glyph ID is set. + gid16 gidActual = ActualGlyphForOutput(ptman); + + // Make sure the glyph metrics are stored. + Font * pfont = ptman->State()->GetFont(); + if (IsLineBreak(ptman->LBGlyphID())) + { + GetGlyphMetric(pfont, kgmetAscent, 0); + GetGlyphMetric(pfont, kgmetDescent, 0); + m_xysGlyphX = 0; + m_xysGlyphY = 0; + m_xysGlyphHeight = 0; + m_xysGlyphWidth = 0; + m_xysAdvX = 0; + m_xysAdvY = 0; + m_bIsSpace = true; + } + else + { + //IsSpace(ptman); // cache this flag--doing bb-top below will do it + + GetGlyphMetric(pfont, kgmetAscent, gidActual); + GetGlyphMetric(pfont, kgmetDescent, gidActual); + GetGlyphMetric(pfont, kgmetBbTop, gidActual); + // call above will also cache all the values below + //GetGlyphMetric(pfont, kgmetBbBottom, gidActual); + //GetGlyphMetric(pfont, kgmetBbLeft, gidActual); + //GetGlyphMetric(pfont, kgmetBbRight, gidActual); + //GetGlyphMetric(pfont, kgmetAdvWidth, gidActual); + //GetGlyphMetric(pfont, kgmetAdvHeight, gidActual); + } +} + +/*---------------------------------------------------------------------------------------------- + Set the associations for the slot. +----------------------------------------------------------------------------------------------*/ +void GrSlotState::Associate(GrSlotState * pslot) +{ + m_vpslotAssoc.clear(); + m_vpslotAssoc.push_back(pslot); +} + +void GrSlotState::Associate(GrSlotState * pslotBefore, GrSlotState * pslotAfter) +{ + m_vpslotAssoc.clear(); + m_vpslotAssoc.push_back(pslotBefore); + m_vpslotAssoc.push_back(pslotAfter); +} + +void GrSlotState::Associate(std::vector & vpslot) +{ + m_vpslotAssoc.clear(); + ///vpslot.CopyTo(m_vpslotAssoc); -- bug in CopyTo, so we do it ourselves: + for (size_t islot = 0; islot < vpslot.size(); ++islot) + { + m_vpslotAssoc.push_back(vpslot[islot]); + } + + // Set its character styles and features from the associated slot. + if (vpslot.size() > 0) // && !m_pslotPrevState + { + std::copy(m_vpslotAssoc[0]->PFeatureBuf(), + m_vpslotAssoc[0]->PFeatureBuf() + m_cnFeat, PFeatureBuf()); + } +} + +/*---------------------------------------------------------------------------------------------- + Clear the associations for the slot. +----------------------------------------------------------------------------------------------*/ +void GrSlotState::ClearAssocs() +{ + m_vpslotAssoc.clear(); +} + +/*---------------------------------------------------------------------------------------------- + Return a list of (ie, add into the vector) all the underlying associations, relative + to the official beginning of the segment. +----------------------------------------------------------------------------------------------*/ +void GrSlotState::AllAssocs(std::vector & vichw) +{ + if (PassModified() == 0) + { + Assert(m_ichwSegOffset != kInvalid); + vichw.push_back(m_ichwSegOffset); + } + else + { + for (size_t i = 0; i < m_vpslotAssoc.size(); ++i) + m_vpslotAssoc[i]->AllAssocs(vichw); + } +} + +/*---------------------------------------------------------------------------------------------- + Return the underlying position of the before-association, relative to the official + beginning of the segment. May be -1, if this slot maps to a character in the previous + segment, or >= the length of the segment, if it maps to a character in the following + segment. +----------------------------------------------------------------------------------------------*/ +int GrSlotState::BeforeAssoc() +{ + GrSlotState * pslot = this; + while (pslot->PassModified() > 0) + { + pslot = pslot->RawBeforeAssocSlot(); + if (pslot == NULL) + { + return kPosInfinity; + } + } + Assert(pslot->m_ichwSegOffset != kInvalid); + return pslot->m_ichwSegOffset; +} + +/*---------------------------------------------------------------------------------------------- + Return the underlying position of the after-association, relative to the official + beginning of the segment. May be -1, if this slot maps to a character in the previous + segment, or >= the length of the segment, if it maps to a character in the following + segment. +----------------------------------------------------------------------------------------------*/ +int GrSlotState::AfterAssoc() +{ + GrSlotState * pslot = this; + while (pslot->PassModified() > 0) + { + pslot = pslot->RawAfterAssocSlot(); + if (pslot == NULL) + { + return kNegInfinity; + } + } + Assert(pslot->m_ichwSegOffset != kInvalid); + return pslot->m_ichwSegOffset; +} + +/*---------------------------------------------------------------------------------------------- + It is possible to get into a state where we are associated with an invalid state. + For instance, slot C may be associated with slots B1 and B2, but slot B1 is not associated + with any earlier slot, in which case slot C should remove the association with B1 and just + be associated with B2. +----------------------------------------------------------------------------------------------*/ +void GrSlotState::CleanUpAssocs() +{ + for (size_t i = 0; i < m_vpslotAssoc.size(); i++) + m_vpslotAssoc[i]->CleanUpAssocs(); + + GrSlotState * pslot; + + pslot = RawBeforeAssocSlot(); + while (pslot && BeforeAssoc() == kPosInfinity) + { + // The before association is bogus--delete it. + m_vpslotAssoc.erase(m_vpslotAssoc.begin()); + pslot = RawBeforeAssocSlot(); + } + + pslot = RawAfterAssocSlot(); + while (pslot && AfterAssoc() == kNegInfinity) + { + // The after association is bogus--delete it. + m_vpslotAssoc.pop_back(); + pslot = RawAfterAssocSlot(); + } +} + +/*---------------------------------------------------------------------------------------------- + Fill in the array of the given output slot with the underlying positions of the + ligature components, relative to the official beginning of the segment. + Positions may be < 0, if this slot maps to a character in the previous segment, + or >= the length of the segment, if it maps to a character in the following segment. +----------------------------------------------------------------------------------------------*/ +void GrSlotState::SetComponentRefsFor(GrSlotOutput * pslout, int slatiArg) +{ + if (PassModified() > 0) + { + GrSlotState * pslot; + int slati; + if (HasComponents()) + { + for (int iComponent = 0; iComponent < m_cnCompPerLig; iComponent++) + { + pslot = CompRefSlot(iComponent); + slati = Slati(iComponent); + if (pslot) + { + Assert(slati != -1); + Assert(PassModified() >= pslot->PassModified()); + pslot->SetComponentRefsFor(pslout, slati); + } + } + } + else + { + // Follow the chain back through the passes. + for (int islot = 0; islot < AssocsSize(); islot++) + { + pslot = m_vpslotAssoc[islot]; + if (pslot) + { + Assert(PassModified() >= pslot->PassModified()); + // Passing slati here is definitely needed for our Arabic font: for instance when + // you type something like "mla", so the l is transformed into a temporary glyph + // before creating the ligature. However, this seems to have broken something, + // which I will probably find eventually. :-( + pslot->SetComponentRefsFor(pslout, slatiArg); + //pslot->SetComponentRefsFor(pslout, -1); + } + } + } + } + else + { + Assert(m_ichwSegOffset != kInvalid); + pslout->AddComponentReference(m_ichwSegOffset, slatiArg); + } +} + +/*---------------------------------------------------------------------------------------------- + Fill in the vector with the underlying positions of the + ligature components, relative to the official beginning of the segment. + Positions may be < 0, if this slot maps to a character in the previous segment, + or >= the length of the segment, if it maps to a character in the following segment. + ENHANCE: merge with method above. +----------------------------------------------------------------------------------------------*/ +void GrSlotState::AllComponentRefs(std::vector & vichw, std::vector & vicomp, + int iComponent) +{ + if (PassModified() > 0) + { + GrSlotState * pslot; + if (HasComponents()) + { + for (int jComponent = 0; jComponent < m_cnCompPerLig; jComponent++) + { + pslot = CompRefSlot(jComponent); + if (pslot) + { + Assert(PassModified() >= pslot->PassModified()); + pslot->AllComponentRefs(vichw, vicomp, jComponent); + } + } + } + else + { + for (int islot = 0; islot < AssocsSize(); islot++) + { + m_vpslotAssoc[islot]->AllComponentRefs(vichw, vicomp, iComponent); + } + } + } + else + { + Assert(m_ichwSegOffset != kInvalid); + vichw.push_back(m_ichwSegOffset); + vicomp.push_back(iComponent); + } +} + +/*---------------------------------------------------------------------------------------------- + Get the value of the component.???.ref attribute for the slot. + Note that 'i' is the local index for the component as defined for this glyph. +----------------------------------------------------------------------------------------------*/ +GrSlotState * GrSlotState::CompRefSlot(int i) +{ + Assert(i < m_cnCompPerLig); + if (i < m_cnCompPerLig) + return CompRef(i); + else + return NULL; +} + +/*---------------------------------------------------------------------------------------------- + Set the value of the component.???.ref attribute for the slot. +----------------------------------------------------------------------------------------------*/ +void GrSlotState::SetCompRefSlot(GrTableManager * ptman, int slati, GrSlotState * pslotComp) +{ + // Convert the global identifer for the component to the index for this glyph. + int icomp = ptman->ComponentIndexForGlyph(GlyphID(), slati); + Assert(icomp != -1); + if (icomp == -1) + // Component not defined for this glyph--ignore. + return; + Assert(icomp < m_cnCompPerLig); + + if (m_fHasComponents == false) + { + // None have been set yet; initialize them. + for (int iLoop = 0; iLoop < m_cnCompPerLig; iLoop++) + { + SetCompRef(iLoop, NULL); + SetSlati(iLoop, -1); + } + } + + m_fHasComponents = true; + int iLoop; + for (iLoop = 0; iLoop < m_cnCompPerLig; iLoop++) + { + if (Slati(iLoop) == slati) + break; + if (Slati(iLoop) == -1) + break; + } + //if (icomp < m_cnCompPerLig) + if (iLoop < m_cnCompPerLig) + { + //SetCompRef(icomp, pslotComp); + SetCompRef(iLoop, pslotComp); + SetSlati(iLoop, slati); + } +} + +/*---------------------------------------------------------------------------------------------- + Return the underlying position for the slot, relative to the official beginning of the + segment. +----------------------------------------------------------------------------------------------*/ +int GrSlotState::SegOffset() +{ + if (m_ichwSegOffset == kInvalid) + { + Assert(m_pslotPrevState); + Assert(m_ipassModified > 0); + return m_pslotPrevState->SegOffset(); + } + else + { + Assert(m_pslotPrevState == NULL); + Assert(m_ipassModified == 0); + return m_ichwSegOffset; + } +} + +/*---------------------------------------------------------------------------------------------- + Return the value of the glyph attribute (in design units, if this is a measurement). +----------------------------------------------------------------------------------------------*/ +int GrSlotState::GlyphAttrValueEmUnits(GrTableManager * ptman, int nAttrID) +{ + return ptman->GlyphAttrValue(m_chwGlyphID, nAttrID); +} + +/*---------------------------------------------------------------------------------------------- + Return the value of the glyph metric, in design coordinates (ie, based on the font's + em-square). +----------------------------------------------------------------------------------------------*/ +int GrSlotState::GlyphMetricEmUnits(GrTableManager * ptman, int nMetricID) +{ + int mValue; + if (ptman->State()->GetFont()) + { + // Get the actual metric, possibly adjusted for hinting, then convert back to + // design units. + float xysValue = GlyphMetricLogUnits(ptman, nMetricID); + mValue = ptman->LogToEmUnits(xysValue); + } + else + // Ask the font directly. + ////mValue = ??? + mValue = 0; + + return mValue; +} + +/*---------------------------------------------------------------------------------------------- + Return the value of the glyph attribute, converted to source device coordinates. + The attribute is assumed to be one whose value is a measurement. +----------------------------------------------------------------------------------------------*/ +float GrSlotState::GlyphAttrValueLogUnits(GrTableManager * ptman, int nAttrID) +{ + int mValue = GlyphAttrValueEmUnits(ptman, nAttrID); + float xysRet = ptman->EmToLogUnits(mValue); + return xysRet; +} + +/*---------------------------------------------------------------------------------------------- + Return the value of the glyph metric, in the source device's logical units. +----------------------------------------------------------------------------------------------*/ +float GrSlotState::GlyphMetricLogUnits(GrTableManager * ptman, int nMetricID) +{ +#ifdef _DEBUG + if (IsLineBreak(ptman->LBGlyphID())) + { + Warn("Getting metrics of line-break slot"); + } +#endif // _DEBUG + if (IsLineBreak(ptman->LBGlyphID())) + { + return 0; + } + + return GetGlyphMetric(ptman->State()->GetFont(), nMetricID, + ActualGlyphForOutput(ptman)); +} + + +float GrSlotOutput::GlyphMetricLogUnits(Font * pfont, int nMetricID) +{ + Assert(m_chwActual != kInvalidGlyph); + if (m_chwActual == kInvalidGlyph) + return 0; + + return GetGlyphMetric(pfont, nMetricID, m_chwActual); +} + +//float GrSlotOutput::GlyphMetricLogUnits(int gmet) -- obsolete: no longer caching these values +//{ +// // When the font is not passed as an argument, the values better be cached! +// +// switch (gmet) +// { // There may be off by one errors below, depending on what width and height mean +// case kgmetLsb: +// return m_xysGlyphX; +// case kgmetRsb: +// return (m_xysAdvX - m_xysGlyphX - m_xysGlyphWidth); +// case kgmetBbTop: +// return m_xysGlyphY; +// case kgmetBbBottom: +// return (m_xysGlyphY - m_xysGlyphHeight); +// case kgmetBbLeft: +// return m_xysGlyphX; +// case kgmetBbRight: +// return (m_xysGlyphX + m_xysGlyphWidth); +// case kgmetBbHeight: +// return m_xysGlyphHeight; +// case kgmetBbWidth: +// return m_xysGlyphWidth; +// case kgmetAdvWidth: +// return m_xysAdvX; +// case kgmetAdvHeight: +// return m_xysAdvY; +// default: +// Warn("GetGlyphMetric was asked for an illegal metric."); +// }; +// +// return 0; +//} + +float GrSlotState::GetGlyphMetric(Font * pfont, int nMetricID, gid16 chwGlyphID) +{ + GlyphMetric gmet = GlyphMetric(nMetricID); + switch (gmet) + { + case kgmetAscent: + case kgmetDescent: + if (m_xysFontAscent == kNegInfFloat) + { + m_xysFontAscent = GrSlotAbstract::GetGlyphMetric(pfont, kgmetAscent, chwGlyphID); + m_xysFontDescent = GrSlotAbstract::GetGlyphMetric(pfont, kgmetDescent, chwGlyphID); + } + break; + default: + if (m_xysGlyphWidth == kNegInfFloat) + { + GetGlyphMetricAux(pfont, chwGlyphID, m_xysGlyphX, m_xysGlyphY, m_xysGlyphWidth, + m_xysGlyphHeight, m_xysAdvX, m_xysAdvY, m_bIsSpace); + } + break; + } + + switch (gmet) + { // There may be off-by-one errors below, depending on what width and height mean + case kgmetAscent: + return m_xysFontAscent; + case kgmetDescent: + return m_xysFontDescent; + case kgmetLsb: + return m_xysGlyphX; + case kgmetRsb: + return (m_xysAdvX - m_xysGlyphX - m_xysGlyphWidth); + case kgmetBbTop: + return m_xysGlyphY; + case kgmetBbBottom: + return (m_xysGlyphY - m_xysGlyphHeight); + case kgmetBbLeft: + return m_xysGlyphX; + case kgmetBbRight: + return (m_xysGlyphX + m_xysGlyphWidth); + case kgmetBbHeight: + return m_xysGlyphHeight; + case kgmetBbWidth: + return m_xysGlyphWidth; + case kgmetAdvWidth: + return m_xysAdvX; + case kgmetAdvHeight: + return m_xysAdvY; + default: + Warn("GetGlyphMetric was asked for an illegal metric."); + }; + + return 0; +} + +float GrSlotAbstract::GetGlyphMetric(Font * pfont, int nMetricID, gid16 chwGlyphID) +{ + GlyphMetric gmet = GlyphMetric(nMetricID); + + float yAscent, yDescent; + + if (kgmetAscent == gmet) + { + //if (m_xysFontAscent != -1) + // return m_xysFontAscent; + pfont->getFontMetrics(&yAscent); + //m_xysFontAscent = xysRet; + //if (pfont) + // m_xysFontAscent = yAscent; + return yAscent; + } + + if (kgmetDescent == gmet) + { + //if (m_xysFontDescent != -1) + // return m_xysFontDescent; + pfont->getFontMetrics(NULL, &yDescent); + //m_xysFontDescent = xysRet; + //if (pfont) + // m_xysFontDescent = yDescent; + return yDescent; + } + + float xysGlyphX, xysGlyphY, xysGlyphWidth, xysGlyphHeight, xysAdvX, xysAdvY; + GetGlyphMetricAux(pfont, chwGlyphID, xysGlyphX, xysGlyphY, xysGlyphWidth, + xysGlyphHeight, xysAdvX, xysAdvY, m_bIsSpace); + + switch (gmet) + { // There may be off-by-one errors below, depending on what width and height mean + case kgmetLsb: + return xysGlyphX; + case kgmetRsb: + return (xysAdvX - xysGlyphX - xysGlyphWidth); + case kgmetBbTop: + return xysGlyphY; + case kgmetBbBottom: + return (xysGlyphY - xysGlyphHeight); + case kgmetBbLeft: + return xysGlyphX; + case kgmetBbRight: + return (xysGlyphX + xysGlyphWidth); + case kgmetBbHeight: + return xysGlyphHeight; + case kgmetBbWidth: + return xysGlyphWidth; + case kgmetAdvWidth: + return xysAdvX; + case kgmetAdvHeight: + return xysAdvY; + default: + Warn("GetGlyphMetric was asked for an illegal metric."); + }; + + return 0; +} + +void GrSlotAbstract::GetGlyphMetricAux(Font * pfont, gid16 chwGlyphID, + float & xysGlyphX, float & xysGlyphY, + float & xysGlyphWidth, float & xysGlyphHeight, float & xysAdvX, float & xysAdvY, sdata8 & bIsSpace) +{ + gr::Point ptAdvances; + gr::Rect rectBb; + pfont->getGlyphMetrics(chwGlyphID, rectBb, ptAdvances); + + xysGlyphX = rectBb.left; + xysGlyphY = rectBb.top; + xysGlyphWidth = (rectBb.right - rectBb.left); + xysGlyphHeight = (rectBb.top - rectBb.bottom); + xysAdvX = ptAdvances.x; + xysAdvY = ptAdvances.y; + + bIsSpace = (0 == xysGlyphX && 0 == xysGlyphY); // should agree with test done in IsSpace() below + + if (bIsSpace == 1) + { + // White space glyph - only case where nGlyphX == nGlyphY == 0 + // nGlyphWidth & nGlyphHeight are always set to 16 for unknown reasons, so correct. + xysGlyphWidth = xysGlyphHeight = 0; + } +} + +/*---------------------------------------------------------------------------------------------- + Test the glyph id to see if it is a white space glyph. +----------------------------------------------------------------------------------------------*/ +sdata8 GrSlotState::IsSpace(GrTableManager * ptman) +{ + gid16 gidActual = ActualGlyphForOutput(ptman); + + ////if (m_xysGlyphWidth == -1) + ////{ + //// res = ptman->State()->GraphicsObject()->GetGlyphMetrics(gidActual, + //// &m_xysGlyphWidth, &m_xysGlyphHeight, + //// &m_xysGlyphX, &m_xysGlyphY, &m_xysAdvX, &m_xysAdvY); + //// if (ResultFailed(res)) + //// { + //// WARN(res); + //// return 2; // will test as true but can be distinguished by separate value + //// } + + //// gr::Point ptAdvances; + //// gr::Rect rectBb; + //// ptman->State()->Font()->getGlyphMetrics(gidActual, rectBb, ptAdvances); + ////} + + if (m_bIsSpace == -1) + GetGlyphMetric(ptman->State()->GetFont(), kgmetBbLeft, gidActual); + // One call is enough to cache the information. + //GetGlyphMetric(ptman->State()->Font(), kgmetBbBottom, gidActual); + + // should agree with test done in GetGlyphMetric() above + //////m_bIsSpace = (0 == m_xysGlyphX && 0 == m_xysGlyphY); + + Assert(m_bIsSpace == 0 || m_bIsSpace == 1); + + return m_bIsSpace; +} + +bool GrSlotOutput::IsSpace() +{ + Assert(m_bIsSpace == 0 || m_bIsSpace == 1); + return (m_bIsSpace != 0)? true : false; +} + +/*---------------------------------------------------------------------------------------------- + If any of the attach attributes have been modified, fix things up. Set up the attachment + tree, and set any needed default positions. Zap the cached positions of any following + glyphs in the stream. + + @param psstrm - the stream in which the modifications were made + @param islotThis - the index of the attached (leaf) slot in the stream; + -1 if we don't know +----------------------------------------------------------------------------------------------*/ +void GrSlotState::HandleModifiedPosition(GrTableManager * ptman, + GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, int islotThis) +{ + if (!m_fAttachMod && !m_fShiftMod) + return; + + if (islotThis == -1) + { + for (int islot = 0; islot < psstrmOut->WritePos(); islot++) + { + if (psstrmOut->SlotAt(islot) == this) + { + islotThis = islot; + break; + } + } + Assert(islotThis > -1); + } + + if (m_fAttachMod) + { + // Attachments. + + // Note that it doesn't make sense to attach a slot to itself, so if the value of + // the attach.to attribute is 0, that means clear the attachment. + GrSlotState * pslotNewRoot = AttachRoot(psstrmOut); + + AttachToRoot(ptman, psstrmOut, pslotNewRoot); + + if (pslotNewRoot) + { + // If this is an attachment with no positions, attach the two glyphs side by side + // in the appropriate order. + bool fRtl = ((pslotNewRoot->PostBidiDirLevel(ptman) % 2) != 0); + if ((fRtl && m_srAttachTo < 0) || (!fRtl && m_srAttachTo > 0)) + { + // The root is on the right, the leaf is on the left. + if (m_mAttachAtX == kNotYetSet && m_nAttachAtGpoint == kNotYetSet) + m_mAttachAtX = 0; + if (m_mAttachWithX == kNotYetSet && m_nAttachWithGpoint == kNotYetSet) + m_mAttachWithX = short(AdvanceX(ptman)); + } + else + { + // The root is on the left, the leaf is on the right. + if (m_mAttachAtX == kNotYetSet && m_nAttachAtGpoint == kNotYetSet) + m_mAttachAtX = short(pslotNewRoot->AdvanceX(ptman)); + if (m_mAttachWithX == kNotYetSet && m_nAttachWithGpoint == kNotYetSet) + m_mAttachWithX = 0; + } + } + } + else + { + // Shifting, or changing the advance width. + Assert(m_fShiftMod); + EnsureLocalAttachmentTree(ptman, psstrmIn, psstrmOut, islotThis); + ZapMetricsAndPositionDownToBase(psstrmOut); + ZapMetricsOfLeaves(psstrmOut); + } + + if (psstrmOut->m_ipass == ptman->NumberOfPasses() - 1) + ptman->InitPosCache(); // cached position is most likely no longer valid + + // Invalidate the positions of this and any following glyphs. + for (int islot = islotThis + 1; islot < psstrmOut->WritePos(); islot++) + psstrmOut->SlotAt(islot)->ZapPosition(); + + m_fAttachMod = false; + m_fShiftMod = false; +} + +/*---------------------------------------------------------------------------------------------- + The shift attribute of a slot has been modified. Make sure any slots that are part of the + same attachment cluster are local to this stream. The reason for this is so that the + position calculations stay consistent within the stream. +----------------------------------------------------------------------------------------------*/ +void GrSlotState::EnsureLocalAttachmentTree(GrTableManager * ptman, + GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, int islotThis) +{ + if (m_dislotRootFixed) + { + GrSlotState * pslotRoot = SlotAtOffset(psstrmOut, m_dislotRootFixed); + psstrmOut->EnsureLocalCopy(ptman, pslotRoot, psstrmIn); + pslotRoot = SlotAtOffset(psstrmOut, m_dislotRootFixed); // get the new one! + pslotRoot->EnsureLocalAttachmentTree(ptman, psstrmIn, psstrmOut, islotThis + m_dislotRootFixed); + } + for (size_t islot = 0; islot < m_vdislotAttLeaves.size(); islot++) + { + GrSlotState * pslotLeaf = SlotAtOffset(psstrmOut, m_vdislotAttLeaves[islot]); + psstrmOut->EnsureLocalCopy(ptman, pslotLeaf, psstrmIn); + } +} + +/*---------------------------------------------------------------------------------------------- + The recipient slot is being attached to the argument slot. + NOTE: the caller is responsible to zap the cached positions of following glyphs + in the stream. +----------------------------------------------------------------------------------------------*/ +void GrSlotState::AttachToRoot(GrTableManager * /*ptman*/, GrSlotStream * psstrm, + GrSlotState * pslotNewRoot) +{ + GrSlotState * pslotOldRoot = (m_dislotRootFixed == 0) ? + NULL : + SlotAtOffset(psstrm, m_dislotRootFixed); + + if (pslotOldRoot) + { + if (pslotOldRoot != pslotNewRoot) + pslotOldRoot->RemoveLeaf(m_dislotRootFixed); + pslotOldRoot->ZapMetricsAndPositionDownToBase(psstrm); + pslotOldRoot->ZapMetricsOfLeaves(psstrm); + } + + ZapCompositeMetrics(); + + if (pslotNewRoot && pslotNewRoot != pslotOldRoot) + { + pslotNewRoot->AddLeaf(m_srAttachTo); + pslotNewRoot->ZapMetricsAndPositionDownToBase(psstrm); + pslotNewRoot->ZapMetricsOfLeaves(psstrm); + } + + m_dislotRootFixed = m_srAttachTo; +} + +/*---------------------------------------------------------------------------------------------- + Return the absolute position of the glyph, relative to the start of the segment, + in font design units. +----------------------------------------------------------------------------------------------*/ +void GrSlotState::Position(GrTableManager * ptman, + GrSlotStream * psstrmOut, int * pmXPos, int * pmYPos) +{ + Assert(!m_fAttachMod); // the attachment tree should be set up + Assert(!m_fShiftMod); + + float xsWidth, xsVisWidth; + if (m_xsPositionX == kNegInfFloat || m_ysPositionY == kNegInfFloat) + ptman->CalcPositionsUpTo(psstrmOut->m_ipass, this, true, &xsWidth, &xsVisWidth); + + *pmXPos = ptman->LogToEmUnits(m_xsPositionX); + *pmYPos = ptman->LogToEmUnits(m_ysPositionY); +} + +/*---------------------------------------------------------------------------------------------- + Recalculate the metrics for this slot, which has attachments on it (or possibly + did in the past). +----------------------------------------------------------------------------------------------*/ +void GrSlotState::AdjustRootMetrics(GrTableManager * ptman, GrSlotStream * psstrm) +{ + Assert(m_dislotRootFixed == m_srAttachTo); + GrSlotState * pslotRoot = AttachRoot(psstrm); + CalcRootMetrics(ptman, psstrm, NULL, kPosInfinity); + if (pslotRoot) + pslotRoot->AdjustRootMetrics(ptman, psstrm); +} + +/*---------------------------------------------------------------------------------------------- + Calculate the composite metrics for this slot. + + @param psstrm - stream for which we are calculating it + @param psstrmNext - because when processing in the middle of a pass, we may need to + get the slot from the following (output) stream + @param nLevel - attachment level we are asking for; kPosInifinity means all levels + @param fThorough - true: do a thorough recalculation; false: don't recalculate + metrics for leaves (are they assumed to be accurate???) + --currently not used +----------------------------------------------------------------------------------------------*/ +void GrSlotState::CalcCompositeMetrics(GrTableManager * ptman, GrSlotStream * psstrm, + GrSlotStream * psstrmNext, int nLevel, bool fThorough) +{ + if (m_nCompositeLevel == nLevel) + return; + + if (fThorough) + { + Assert(m_dislotRootFixed == m_srAttachTo); + GrSlotState * pslotRoot = AttachRoot(psstrm); + // Kludge to handle the fact that we might have gotten the root from the wrong stream. + // Calling MidPassSlotAt finds the right one. + if (psstrmNext && pslotRoot) + { + int islotRoot = pslotRoot->PosPassIndex(); + pslotRoot = psstrm->MidPassSlotAt(islotRoot, psstrmNext); + } + + InitMetrics(ptman, pslotRoot); + + for (size_t islot = 0; islot < m_vdislotAttLeaves.size(); islot++) + { + GrSlotState * pslotLeaf; + if (psstrmNext) + { + // Calculating a position in the middle of processing a pass. + pslotLeaf = psstrm->MidPassSlotAt(PosPassIndex() + m_vdislotAttLeaves[islot], + psstrmNext); + } + else + { + // Calculating the final position. + pslotLeaf = SlotAtOffset(psstrm, m_vdislotAttLeaves[islot]); + } + + if (pslotLeaf->AttachLevel() <= nLevel) + pslotLeaf->CalcCompositeMetrics(ptman, psstrm, psstrmNext, nLevel, fThorough); + else + // this slot will be ignored in the composite metrics + pslotLeaf->ZapRootMetrics(); + } + CalcRootMetrics(ptman, psstrm, psstrmNext, nLevel); + + m_nCompositeLevel = nLevel; + } + else + { + Assert(false); // for now + + // Don't bother with the leaves. + InitRootMetrics(ptman); + } +} + +/*---------------------------------------------------------------------------------------------- + Calculate the metrics for this node and all its leaf nodes. +----------------------------------------------------------------------------------------------*/ +void GrSlotState::CalcRootMetrics(GrTableManager * /*ptman*/, GrSlotStream * psstrm, + GrSlotStream * psstrmNext, int nLevel) +{ + for (size_t idislot = 0; idislot < m_vdislotAttLeaves.size(); idislot++) + { + GrSlotState * pslotLeaf = SlotAtOffset(psstrm, m_vdislotAttLeaves[idislot]); + // Kludge to handle the fact that we might have gotten the leaf from the wrong stream. + // Calling MidPassSlotAt finds the right one. + if (psstrmNext) + { + int islot = pslotLeaf->PosPassIndex(); + pslotLeaf = psstrm->MidPassSlotAt(islot, psstrmNext); + } + if (pslotLeaf->AttachLevel() > nLevel) + continue; + + m_xsClusterXOffset = min(m_xsClusterXOffset, pslotLeaf->m_xsClusterXOffset); + if (!pslotLeaf->m_fIgnoreAdvance) + { + m_xsClusterAdv = max( + m_xsClusterAdv, + pslotLeaf->m_xsClusterAdv + m_xsRootShiftX); + } + m_xsClusterBbLeft = min(m_xsClusterBbLeft, pslotLeaf->m_xsClusterBbLeft); + m_xsClusterBbRight = max(m_xsClusterBbRight, pslotLeaf->m_xsClusterBbRight); + m_ysClusterBbTop = max(m_ysClusterBbTop, pslotLeaf->m_ysClusterBbTop); + m_ysClusterBbBottom = min(m_ysClusterBbBottom, pslotLeaf->m_ysClusterBbBottom); + } +} + +/*---------------------------------------------------------------------------------------------- + Reset the cluster metrics of this slot. +----------------------------------------------------------------------------------------------*/ +void GrSlotState::InitMetrics(GrTableManager * ptman, GrSlotState * pslotRoot) +{ + InitLeafMetrics(ptman, pslotRoot); + InitRootMetrics(ptman); +} + +/*---------------------------------------------------------------------------------------------- + Initialize the variables that store the offsets of just this node (ignoring any of its + leaves) relative to the cluster base. +----------------------------------------------------------------------------------------------*/ +void GrSlotState::InitLeafMetrics(GrTableManager * ptman, GrSlotState * pslotRoot) +{ + float xsShiftX = ptman->EmToLogUnits(ShiftX()); + float ysShiftY = ptman->EmToLogUnits(ShiftY()); + + if (ptman->RightToLeft()) + xsShiftX *= -1; + + if (IsBase()) + { + // The x-value below has to be zero because the shift is incorporated into + // m_xsRootShiftX. (m_ysRootShiftY, on the other hand, isn't used anywhere.) + m_xsOffsetX = 0; + m_ysOffsetY = ysShiftY; + + m_xsRootShiftX = xsShiftX; + m_ysRootShiftY = ysShiftY; + Assert(!IsLineBreak(ptman->LBGlyphID()) + || (m_xsRootShiftX == 0 && m_ysRootShiftY == 0)); + return; + } + + Assert(!IsLineBreak(ptman->LBGlyphID())); + + // Hint-adjusted logical coordinates equivalent to attach.at and attach.with attributes. + // If attach.at or attach.with attributes were unset, the defaults for a side-by-side + // attachment should have been supplied in HandleModifiedPosition(). + float xsAttAtX, ysAttAtY, xsAttWithX, ysAttWithY; + AttachLogUnits(ptman, pslotRoot, &xsAttAtX, &ysAttAtY, &xsAttWithX, &ysAttWithY); + + m_xsOffsetX = xsAttAtX - xsAttWithX; + m_xsOffsetX += pslotRoot->m_xsOffsetX; + m_xsOffsetX += xsShiftX; + + m_ysOffsetY = ysAttAtY - ysAttWithY; + m_ysOffsetY += pslotRoot->m_ysOffsetY; + m_ysOffsetY += ysShiftY; + + // Cumulative effect of shifts on this and all base nodes: + m_xsRootShiftX = pslotRoot->m_xsRootShiftX + xsShiftX; + m_ysRootShiftY = pslotRoot->m_ysRootShiftY + ysShiftY; +} + +/*---------------------------------------------------------------------------------------------- + Initialize the variables that store the offsets of this node taking into account its + leaves; these are relative to the cluster base. +----------------------------------------------------------------------------------------------*/ +void GrSlotState::InitRootMetrics(GrTableManager * ptman) +{ + if (IsLineBreak(ptman->LBGlyphID())) + { + m_fIgnoreAdvance = true; + m_xsClusterXOffset = 0; + m_xsClusterAdv = 0; + m_xsClusterBbLeft = 0; + m_xsClusterBbRight = 0; + m_ysClusterBbTop = 0; + m_ysClusterBbBottom = 0; + return; + } + + float xsAdvanceX = ptman->EmToLogUnits(AdvanceX(ptman)); + + // If the glyph's advance width is zero, then we NEVER want it to have any affect, + // even if the glyph is attached way out to the right of its base's advance. + m_fIgnoreAdvance = (xsAdvanceX == 0); + + float xsBbLeft = GlyphMetricLogUnits(ptman, kgmetBbLeft); + float xsBbRight = GlyphMetricLogUnits(ptman, kgmetBbRight); + float ysBbTop = GlyphMetricLogUnits(ptman, kgmetBbTop); + float ysBbBottom = GlyphMetricLogUnits(ptman, kgmetBbBottom); + + // Any shifts should be ignored for the sake of calculating actual position or width, + // hence we subtract the cumulative effect of the shifts. + m_xsClusterXOffset = m_xsOffsetX - m_xsRootShiftX; + m_xsClusterAdv = m_xsOffsetX + xsAdvanceX - m_xsRootShiftX; + + m_xsClusterBbLeft = m_xsOffsetX + xsBbLeft; + m_xsClusterBbRight = m_xsOffsetX + xsBbRight; + m_ysClusterBbTop = m_ysOffsetY + ysBbTop; + m_ysClusterBbBottom = m_ysOffsetY + ysBbBottom; +} + +/*---------------------------------------------------------------------------------------------- + X-offset of a single glyph relative to the previous advance position. +----------------------------------------------------------------------------------------------*/ +float GrSlotState::GlyphXOffset(GrSlotStream * psstrm, float fakeItalicRatio) +{ + float xsRet = Base(psstrm)->ClusterRootOffset() + m_xsOffsetX; + + // fake an italic slant + xsRet += m_ysOffsetY * fakeItalicRatio; + + return xsRet; +} + +/*---------------------------------------------------------------------------------------------- + Y-offsets of a single glyph relative to the previous advance position. +----------------------------------------------------------------------------------------------*/ +float GrSlotState::GlyphYOffset(GrSlotStream * /*psstrm*/) +{ + return m_ysOffsetY; +} + +/*---------------------------------------------------------------------------------------------- + Return the offset of the last leaf of the cluster, relative to this slot, which is + the base. Return kNegInfinity if there are not enough slots in the stream to tell. +----------------------------------------------------------------------------------------------*/ +int GrSlotState::LastLeafOffset(GrSlotStream * psstrm) +{ + int islotRet = 0; + for (size_t idislot = 0; idislot < m_vdislotAttLeaves.size(); idislot++) + { + int dislot = m_vdislotAttLeaves[idislot]; + Assert(dislot != 0); + if (!psstrm->HasSlotAtPosPassIndex(PosPassIndex() + dislot)) + return kNegInfinity; + GrSlotState * pslotLeaf = SlotAtOffset(psstrm, dislot); + int islotTmp = pslotLeaf->LastLeafOffset(psstrm); + if (islotTmp == kNegInfinity) + return kNegInfinity; + islotRet = max(islotRet, (dislot + islotTmp)); + } + return islotRet; +} + +/*---------------------------------------------------------------------------------------------- + Return the attach positions in the device context's logical units, + adjusted for hinting if possible. + + Note that m_nAttachAt/WithGpoint = 0 is always an invalid value (resulting from a + glyph attribute that was defined in terms of x/y coordinates that didn't map to an + actual on-curve point). Therefore the x/y coordinates should be used to do the + attachment. In the case where we actually want point #0 on the curve, + m_nAttachAt/WithGpoint will have the special value 'kGpointZero' (the glyph attribute + is defined this way). +----------------------------------------------------------------------------------------------*/ +void GrSlotState::AttachLogUnits(GrTableManager * ptman, GrSlotState * pslotRoot, + float * pxsAttAtX, float * pysAttAtY, + float * pxsAttWithX, float * pysAttWithY) +{ + if (m_nAttachAtGpoint == kNotYetSet || m_nAttachAtGpoint == 0) + { + // Use x- and y-coordinates; no adjustment for hinting is done. + int mX = m_mAttachAtX + m_mAttachAtXOffset; + int mY = m_mAttachAtY + m_mAttachAtYOffset; + + *pxsAttAtX = ptman->EmToLogUnits(mX); + *pysAttAtY = ptman->EmToLogUnits(mY); + } + else + { + // Look up the actual on-curve point. + int nGpoint = m_nAttachAtGpoint; + if (nGpoint == kGpointZero) + nGpoint = 0; + bool fImpl = ptman->GPointToXY(pslotRoot->GlyphID(), nGpoint, pxsAttAtX, pysAttAtY); + + // Debuggers: + //int mXTmpAt = m_mAttachAtX + m_mAttachAtXOffset; + //int mYTmpAt = m_mAttachAtY + m_mAttachAtYOffset; + //int xsAttAtXTmp = ptman->EmToLogUnits(mXTmpAt); + //int ysAttAtYTmp = ptman->EmToLogUnits(mYTmpAt); + //fImpl = false; + + if (!fImpl) + { + // Fall back to using x- and y-coordinates; no adjustment for hinting. + int mX = m_mAttachAtX + m_mAttachAtXOffset; + int mY = m_mAttachAtY + m_mAttachAtYOffset; + *pxsAttAtX = ptman->EmToLogUnits(mX); + *pysAttAtY = ptman->EmToLogUnits(mY); + } + else + { + // Adjust by offsets. + *pxsAttAtX += ptman->EmToLogUnits(m_mAttachAtXOffset); + *pysAttAtY += ptman->EmToLogUnits(m_mAttachAtYOffset); + } + } + + if (m_nAttachWithGpoint == kNotYetSet || m_nAttachWithGpoint == 0) + { + // Use x- and y-coordinates; no adjustment for hinting is done. + int mX = m_mAttachWithX + m_mAttachWithXOffset; + int mY = m_mAttachWithY + m_mAttachWithYOffset; + + *pxsAttWithX = ptman->EmToLogUnits(mX); + *pysAttWithY = ptman->EmToLogUnits(mY); + } + else + { + // Look up the actual on-curve point. + int nGpoint = m_nAttachWithGpoint; + if (nGpoint == kGpointZero) + nGpoint = 0; + bool fImpl = ptman->GPointToXY(m_chwGlyphID, nGpoint, pxsAttWithX, pysAttWithY); + + // Debuggers: + //int mXTmpWith = m_mAttachWithX + m_mAttachWithXOffset; + //int mYTmpWith = m_mAttachWithY + m_mAttachWithYOffset; + //int xsAttWithXTmp = ptman->EmToLogUnits(mXTmpWith); + //int ysAttWithYTmp = ptman->EmToLogUnits(mYTmpWith); + //fImpl = false; + + if (!fImpl) + { + // Fall back to using x- and y-coordinates; no adjustment for hinting. + int mX = m_mAttachWithX + m_mAttachWithXOffset; + int mY = m_mAttachWithY + m_mAttachWithYOffset; + *pxsAttWithX = ptman->EmToLogUnits(mX); + *pysAttWithY = ptman->EmToLogUnits(mY); + } + else + { + // Adjust by offsets. + *pxsAttWithX += ptman->EmToLogUnits(m_mAttachWithXOffset); + *pysAttWithY += ptman->EmToLogUnits(m_mAttachWithYOffset); + } + } +} + +/*---------------------------------------------------------------------------------------------- + Return the slot that is 'dislot' slots away from this slot in the given stream. + Only valid for streams that are the input to or output of positioning passes. +----------------------------------------------------------------------------------------------*/ +GrSlotState * GrSlotState::SlotAtOffset(GrSlotStream * psstrm, int dislot) +{ + Assert(psstrm->m_fUsedByPosPass); + return psstrm->SlotAtPosPassIndex(PosPassIndex() + dislot); +} + +/*---------------------------------------------------------------------------------------------- + If the direction level has not been calculated at this point, assume it is the + top direction. This should only happen if there was no bidi pass to set it. + This method should only be called by the positioning passes; it assumes any bidi + pass has been run. +----------------------------------------------------------------------------------------------*/ +int GrSlotState::PostBidiDirLevel(GrTableManager * ptman) +{ + if (m_nDirLevel == -1) + { + Assert(!ptman->HasBidiPass()); + return ptman->TopDirectionLevel(); + } + return m_nDirLevel; +} + +/*---------------------------------------------------------------------------------------------- + Return true if this glyph represents a LRM code. +----------------------------------------------------------------------------------------------*/ +bool GrSlotState::IsLrm() +{ + if (PassModified() == 0) + return (m_nUnicode == knLRM); + return m_pslotPrevState->IsLrm(); +} + +/*---------------------------------------------------------------------------------------------- + Return true if this glyph represents a RLM code. +----------------------------------------------------------------------------------------------*/ +bool GrSlotState::IsRlm() +{ + if (PassModified() == 0) + return (m_nUnicode == knRLM); + return m_pslotPrevState->IsRlm(); +} + + +/*---------------------------------------------------------------------------------------------- + Used by GlyphInfo +----------------------------------------------------------------------------------------------*/ +//float GrSlotOutput::AdvanceX(Segment * pseg) +//{ +// return pseg->EmToLogUnits(m_mAdvanceX); +//} +//float GrSlotOutput::AdvanceY(Segment * pseg) +//{ +// return pseg->EmToLogUnits(m_mAdvanceY); +//} +float GrSlotOutput::MaxStretch(Segment * pseg, int level) +{ + Assert(level == 0); + return (level == 0) ? pseg->EmToLogUnits(m_mJStretch0) : 0; +} +float GrSlotOutput::MaxShrink(Segment * pseg, int level) +{ + Assert(level == 0); + return (level == 0) ? pseg->EmToLogUnits(m_mJShrink0) : 0; +} +float GrSlotOutput::StretchStep(Segment * pseg, int level) +{ + Assert(level == 0); + return (level == 0) ? pseg->EmToLogUnits(m_mJStep0) : 0; +} +int GrSlotOutput::JustWeight(int level) +{ + Assert(level == 0); + return (level == 0) ? m_nJWeight0 : 0; +} +float GrSlotOutput::JustWidth(Segment * pseg, int level) +{ + Assert(level == 0); + return (level == 0) ? pseg->EmToLogUnits(m_mJWidth0) : 0; +} +float GrSlotOutput::MeasureSolLogUnits(Segment * pseg) +{ + return pseg->EmToLogUnits(m_mMeasureSol); +} +float GrSlotOutput::MeasureEolLogUnits(Segment * pseg) +{ + return pseg->EmToLogUnits(m_mMeasureEol); +} + +/*---------------------------------------------------------------------------------------------- + Make a copy of the GrSlotOutput. This is used in making an identical copy of the segment. + Warning: this function will break if GrSlotState and subclasses are given virtual + methods. In that case, we will need to copy from the address of the first variable in + GrSlotAbstract. +----------------------------------------------------------------------------------------------*/ +void GrSlotOutput::ExactCopyFrom(GrSlotOutput * pslout, u_intslot * pnVarLenBuf, int cnExtraPerSlot) +{ + // The chunk of the object from GrSlotAbstract can be copied exactly, + // except for the variable-length buffer. + *this = *pslout; + m_prgnVarLenBuf = pnVarLenBuf; + std::copy(pslout->m_prgnVarLenBuf, pslout->m_prgnVarLenBuf + cnExtraPerSlot, + m_prgnVarLenBuf); + + // Now copy the stuff specific to GrSlotOutput. + m_ichwBeforeAssoc = pslout->m_ichwBeforeAssoc; + m_ichwAfterAssoc = pslout->m_ichwAfterAssoc; + m_cComponents = pslout->m_cComponents; + + m_isloutClusterBase = pslout->m_isloutClusterBase; + m_disloutCluster = pslout->m_disloutCluster; + m_xsClusterXOffset = pslout->m_xsClusterXOffset; + m_xsClusterAdvance = pslout->m_xsClusterAdvance; + m_igbb = pslout->m_igbb; + m_xsAdvanceX = pslout->m_xsAdvanceX; +// m_ysAdvanceY = pslout->m_ysAdvanceY; +// m_rectBB = pslout->m_rectBB; +} + +/*---------------------------------------------------------------------------------------------- + Shift the glyph to the opposite end of the segment. This is needed for white-space-only + segments whose direction is being changed. +----------------------------------------------------------------------------------------------*/ +void GrSlotOutput::ShiftForDirDepthChange(float dxsSegWidth) +{ + float dxsShift = dxsSegWidth - m_xsAdvanceX - (2 * m_xsPositionX); + int tmp; tmp = (int) dxsShift; + m_xsPositionX += dxsShift; +// m_rectBB.left += dxsShift; +// m_rectBB.right += dxsShift; +} + +/*---------------------------------------------------------------------------------------------- + Return the indices of all the glyphs attached to this cluster, in logical order. + Return an empty vector if this glyph is not the base glyph or if there are no + attached glyphs. + This method return glyph indices, not slot indices. +----------------------------------------------------------------------------------------------*/ +void GrSlotOutput::ClusterMembers(Segment * pseg, int isloutThis, std::vector & visloutRet) +{ + if (m_isloutClusterBase == -1 || m_isloutClusterBase == isloutThis) // yes, a base + pseg->ClusterMembersForGlyph(isloutThis, m_disloutCluster, visloutRet); + else + { + Assert(visloutRet.size() == 0); + } +} + +} // namespace gr diff --git a/Build/source/libs/graphite/engine-2.4/src/segment/GrSlotState.h b/Build/source/libs/graphite/engine-2.4/src/segment/GrSlotState.h new file mode 100644 index 00000000000..f813d01d151 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/src/segment/GrSlotState.h @@ -0,0 +1,1331 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 1999, 2001 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: GrSlotState.h +Responsibility: Sharon Correll +Last reviewed: Not yet. + +Copyright (C) 1999 by SIL International. All rights reserved. + +Description: + Classes GrSlotAbstract, GrSlotState, and GrSlotOutput +----------------------------------------------------------------------------------------------*/ +#ifdef _MSC_VER +#pragma once +#endif +#ifndef SLOTSTATE_INCLUDED +#define SLOTSTATE_INCLUDED + +namespace gr +{ + +class GrSlotAbstract; +class GrSlotState; +class GrSlotOutput; +class GrSlotStream; +class Font; + +//:End Ignore + + +/*---------------------------------------------------------------------------------------------- + Subsumes GrSlotState and GrSlotOutput, both of which represent a single glyph + and its slot attributes and features. + + Hungarian: slab +----------------------------------------------------------------------------------------------*/ +class GrSlotAbstract +{ + friend class GrSlotStream; + friend class GlyphInfo; + +public: + // Constructor: + GrSlotAbstract() + { + } + + virtual ~GrSlotAbstract() + { + // the table manager is responsible for destroying the contents of m_prgnVarLenBuf + } + + void BasicInitializeAbstract(int cnCompPerLig, u_intslot * pnBuf) + { + m_dirc = kNotYetSet8; + m_lb = kNotYetSet8; + m_fInsertBefore = true; + m_nDirLevel = -1; + + m_bIsSpace = -1; // unknown + + m_fInsertBefore = true; + + m_mMeasureSol = 0; + m_mMeasureEol = 0; + + m_mJStretch0 = 0; + m_mJShrink0 = 0; + m_mJStep0 = 0; + m_nJWeight0 = 0; + m_mJWidth0 = 0; + + m_cnCompPerLig = byte(cnCompPerLig); + m_prgnVarLenBuf = pnBuf; + } + + void CopyAbstractFrom(GrSlotState * pslot); + + void SetBufferPtr(u_intslot * pn) + { + m_prgnVarLenBuf = pn; + } + + gid16 GlyphID() { return m_chwGlyphID; } + gid16 RawActualGlyph() { return m_chwActual; } + virtual float GetGlyphMetric(Font * pfont, int nGlyphMetricID, gid16 chwGlyphID); + +protected: + void GetGlyphMetricAux(Font * pfont, gid16 chwGlyphID, + float & xysGlyphX, float & xysGlyphY, + float & xysGlyphWidth, float & xysGlyphHeight, float & xysAdvX, float & xysAdvY, + sdata8 & bIsSpace); + +public: + + //GrSlotState * CompRefSlot(int i); + + int BreakWeight() + { + return (int)m_lb; + } + DirCode Directionality() + { + return DirCode(int(m_dirc)); + } + bool InsertBefore() + { + return m_fInsertBefore; + } + int MeasureSol() + { + return m_mMeasureSol; + } + int MeasureEol() + { + return m_mMeasureEol; + } + + int DirLevel() + { + return m_nDirLevel; + } + + int SpecialSlotFlag() + { + return m_spsl; + } + void SetSpecialSlotFlag(int spsl) + { + m_spsl = sdata8(spsl); + } + + enum { + kNotYetSet = 0x7FFF, + kNotYetSet8 = 0x7F, + kInvalidGlyph = 0xFFFF + }; + + gid16 ActualGlyphForOutput(GrTableManager * ptman); + + // Needed for GlyphInfo: + float XPosition() + { + return m_xsPositionX; + } + float YPosition() + { + return m_ysPositionY; // relative to baseline (positive is up) + } + +protected: + gid16 m_chwGlyphID; + gid16 m_chwActual; // actual glyph to output (which is a different glyph for pseudos) + + sdata8 m_spsl; // special slot flag: LB, bidi marker + +// bool m_fInitialLB; // for LB slots: true if this is the initial LB; + // false if it is the terminating LB + // TODO: remove + + sdata8 m_dirc; // default = kNotYetSet8 (read from glyph attr) + sdata8 m_lb; // default = kNotYetSet8 (read from glyph attr) + + sdata8 m_nDirLevel; + + // Slot attributes that are used by GrSlotOutput: + short m_mMeasureSol; + short m_mMeasureEol; + + unsigned short m_mJStretch0; + unsigned short m_mJShrink0; + unsigned short m_mJStep0; + int m_mJWidth0; + byte m_nJWeight0; + + bool m_fInsertBefore; // default = true + + sdata8 m_bIsSpace; // 0 = false, 1 = true, -1 = unknown + + byte m_cnCompPerLig; + // There is a large block managed by either the GrTableManager (for GrSlotState) + // or the segment (for GrSlotOutput); this variable points at the sub-buffer for this + // particular slot: + u_intslot * m_prgnVarLenBuf; + + float m_xsPositionX; + float m_ysPositionY; + +}; // end of class GrSlotAbstract + + +/*---------------------------------------------------------------------------------------------- + A GrSlotState represents one slot as modified by a pass in the table. + Each time a slot state is modified, a new instance is created, copying the relevant + information. + + Hungarian: slot + + Other hungarian: + m - integer indicating glyph design units ("em-units") + sr - integer indicating slot reference +----------------------------------------------------------------------------------------------*/ +class GrSlotState : public GrSlotAbstract +{ + + friend class GrSlotStream; + friend class FontMemoryUsage; + +public: + enum { kNeutral = 99 }; + + // Constructors: + GrSlotState() + : GrSlotAbstract(), + m_pslotPrevState(NULL) + { + m_vpslotAssoc.clear(); + //m_fInitialLB = false; // TODO: remove + m_spsl = kspslNone; + m_fNeutralAssocs = false; + m_dircProc = kdircUnknown; + m_fDirProcessed = false; + + m_vdislotAttLeaves.clear(); + m_fAttachMod = false; + m_fShiftMod = false; + m_dislotRootFixed = 0; + ZapCompositeMetrics(); + } + + virtual ~GrSlotState() + { + } + + void BasicInitialize(int cnUserDefn, int cnCompPerLig, int cnFeat, u_intslot * pnBuf) + { + BasicInitializeAbstract(cnCompPerLig, pnBuf); + + m_mAdvanceX = kNotYetSet; + m_mAdvanceY = kNotYetSet; + m_mShiftX = 0; + m_mShiftY = 0; + + m_fAdvXSet = false; // for transduction logging + m_fAdvYSet = false; + + m_srAttachTo = 0; + m_nAttachLevel = 0; + + m_mAttachAtX = kNotYetSet; + m_mAttachAtY = 0; + m_nAttachAtGpoint = kNotYetSet; + m_mAttachAtXOffset = 0; + m_mAttachAtYOffset = 0; + m_mAttachWithX = kNotYetSet; + m_mAttachWithY = 0; + m_nAttachWithGpoint = kNotYetSet; + m_mAttachWithXOffset = 0; + m_mAttachWithYOffset = 0; + + m_islotPosPass = kNotYetSet; + + m_cnUserDefn = byte(cnUserDefn); + m_cnFeat = byte(cnFeat); + + m_fHasComponents = false; + + m_xysFontAscent = kNegInfFloat; + m_xysFontDescent = kNegInfFloat; + m_xysGlyphWidth = kNegInfFloat; + m_xysGlyphHeight = kNegInfFloat; + m_xysGlyphX = kNegInfFloat; + m_xysGlyphY = kNegInfFloat; + m_xysAdvX = kNegInfFloat; + m_xysAdvY = kNegInfFloat; + } + + void Initialize(gid16 chw, GrEngine *, GrFeatureValues fval, + int ipass, int ichwSegOffset, int nUnicode = -1); + void Initialize(gid16 chw, GrEngine *, GrSlotState * pslotFeat, + int ipass, int ichwSegOffset); + void Initialize(gid16 chw, GrEngine *, GrSlotState * pslotFeat, + int ipass); + + void InitializeFrom(GrSlotState * pslot, int ipass); + void CopyFeaturesFrom(GrSlotState * pslotSrc); + void FixAttachmentTree(GrSlotState * pslotOld); + + void CopyFrom(GrSlotState * pslot, bool fCopyEverything = true); + + virtual float GetGlyphMetric(Font * pfont, int nGlyphMetricID, gid16 chwGlyphID); + + // General: + int RawSegOffset() { return m_ichwSegOffset; } + + void SetGlyphID(gid16 chw) + { + m_chwGlyphID = chw; + m_chwActual = kInvalidGlyph; + m_xysGlyphWidth = kNegInfFloat; // indicate glyph metrics are invalid + m_ipassFsmCol = -1; + m_colFsm = -1; + } + int PosPassIndex() + { + return m_islotPosPass; + } +#ifdef NDEBUG + void SetPosPassIndex(int islot, bool) +#else + void SetPosPassIndex(int islot, bool fInputToPosPass1) +#endif + { + // If we're resetting it, it should be to the same value as before: + Assert(fInputToPosPass1 || m_islotPosPass == kNotYetSet || m_islotPosPass == islot); + m_islotPosPass = islot; + } + void IncPosPassIndex() + { + m_islotPosPass++; + } + void ZapPosPassIndex() + { + m_islotPosPass = kNotYetSet; + } + + int StyleIndex() { return m_bStyleIndex; } + + int AttachTo() { return m_srAttachTo; } + int AttachLevel() { return m_nAttachLevel; } + + int RawAttachAtX() { return m_mAttachAtX; } + int AttachAtY() { return m_mAttachAtY; } + int AttachAtGpoint() { return m_nAttachAtGpoint; } + int AttachAtXOffset() { return m_mAttachAtXOffset; } + int AttachAtYOffset() { return m_mAttachAtYOffset; } + + int RawAttachWithX() { return m_mAttachWithX; } + int AttachWithY() { return m_mAttachWithY; } + int AttachWithGpoint() { return m_nAttachWithGpoint; } + int AttachWithXOffset() { return m_mAttachWithXOffset; } + int AttachWithYOffset() { return m_mAttachWithYOffset; } + + void Associate(GrSlotState *); + void Associate(GrSlotState *, GrSlotState *); + void Associate(std::vector &); + void ClearAssocs(); + + int AssocsSize() { return m_vpslotAssoc.size(); } + GrSlotState * RawBeforeAssocSlot() + { + if (m_vpslotAssoc.size() == 0) + return NULL; + return m_vpslotAssoc[0]; + } + GrSlotState * RawAfterAssocSlot() + { + if (m_vpslotAssoc.size() == 0) + return NULL; + return m_vpslotAssoc.back(); + } + GrSlotState * AssocSlot(int i) { return m_vpslotAssoc[i]; } + + void AllAssocs(std::vector & vichw); + int BeforeAssoc(); + int AfterAssoc(); + + void CleanUpAssocs(); + + void SetComponentRefsFor(GrSlotOutput *, int iComp = -1); + void AllComponentRefs(std::vector & vichw, std::vector & vicomp, int iComponent = -1); + + int PassModified() { return m_ipassModified; } + int SegOffset(); + int UnderlyingPos(); + GrSlotState * PrevState() { return m_pslotPrevState; } + + void MarkDeleted() // for now, do nothing + { + } + + sdata8 IsSpace(GrTableManager * ptman); + + // TODO: remove argument from these methods; it is no longer needed. + bool IsLineBreak(gid16 chwLB) + { + return (IsInitialLineBreak(chwLB) || IsFinalLineBreak(chwLB)); + //return (m_chwGlyphID == chwLB); // TODO: remove + } + bool IsInitialLineBreak(gid16 /*chwLB*/) + { + return (m_spsl == kspslLbInitial); + //return (IsLineBreak(chwLB) && m_fInitialLB == true); // TODO: remove + } + bool IsFinalLineBreak(gid16 /*chwLB*/) + { + return (m_spsl == kspslLbFinal); + //return (IsLineBreak(chwLB) && m_fInitialLB == false); // TODO: remove + } + + bool IsBidiMarker() + { + switch (m_spsl) + { + case kspslLRM: + case kspslRLM: + case kspslLRO: + case kspslRLO: + case kspslLRE: + case kspslRLE: + case kspslPDF: + return true; + default: + return false; + } + return false; + } + + bool HasComponents() { return m_fHasComponents; } + + // Directionality as determined by the bidi algorithm + DirCode DirProcessed() // return the value + { + Assert(m_dirc != kNotYetSet8); + if (m_dircProc == kdircUnknown) + m_dircProc = DirCode(m_dirc); + return m_dircProc; + } + void SetDirProcessed(DirCode dirc) // set the directionality + { + m_dircProc = dirc; + } + bool DirHasBeenProcessed() // has this slot been fully processed? + { + return m_fDirProcessed; + } + void MarkDirProcessed() // this slot has been fully processed + { + m_fDirProcessed = true; + } + + int RawAdvanceX() { return m_mAdvanceX; } + int RawAdvanceY() { return m_mAdvanceY; } + int ShiftX() { return m_mShiftX; } + int ShiftY() { return m_mShiftY; } + + // Slot attributes that must be calculated: + + int AdvanceX(GrTableManager * ptman) + { + if (m_mAdvanceX == kNotYetSet) + // Initialize it from the glyph metric (adjusted for hinting). + m_mAdvanceX = short(GlyphMetricEmUnits(ptman, kgmetAdvWidth)); + return m_mAdvanceX; + } + + int AdvanceY(GrTableManager * ptman) + { + if (m_mAdvanceY == kNotYetSet) + // Initialize it from the glyph metric (adjusted for hinting). + m_mAdvanceY = short(GlyphMetricEmUnits(ptman, kgmetAdvHeight)); + return m_mAdvanceY; + } + + int AttachAtX(GrTableManager * ptman, GrSlotStream * psstrm) + { + if (m_mAttachAtX == kNotYetSet) + { + Assert(false); // Should have already been set in HandleModifiedPosition, + // but just in case... + if (m_srAttachTo == 0) + return 0; + else + m_mAttachAtX = short(AttachRoot(psstrm)->AdvanceX(ptman)); // attach on the right + } + return m_mAttachAtX; + } + + int AttachWithX(GrTableManager * /*ptman*/, GrSlotStream * /*psstrm*/) + { + if (m_mAttachAtX == kNotYetSet) + { + Assert(false); // Should have already been set in HandleModifiedPosition, + // but just in case. + if (!m_srAttachTo == 0) + return 0; + else + m_mAttachAtX = 0; // attach on the right + } + return m_mAttachAtX; + } + + int JStretch() + { + return m_mJStretch0; + } + int JShrink() + { + return m_mJShrink0; + } + int JStep() + { + return m_mJStep0; + } + int JWeight() + { + return m_nJWeight0; + } + int JWidth() + { + return m_mJWidth0; + } + + // Slot attribute setters: + + void SetAdvanceX(int mVal) + { + Assert(mVal < 0xFFFF); m_mAdvanceX = short(mVal & 0xFFFF); m_fShiftMod = true; + m_fAdvXSet = true; // for transduction logging + } + void SetAdvanceY(int mVal) + { + Assert(mVal < 0xFFFF); m_mAdvanceY = short(mVal & 0xFFFF); m_fShiftMod = true; + m_fAdvYSet = true; // for transduction logging + } + void SetShiftX(int mVal) + { + Assert(mVal < 0xFFFF); m_mShiftX = short(mVal & 0xFFFF); + m_fShiftMod = true; + } + void SetShiftY(int mVal) + { + Assert(mVal < 0xFFFF); m_mShiftY = short(mVal & 0xFFFF); + m_fShiftMod = true; + } + + void SetAttachTo(int srVal) + { + Assert(srVal < 0xFFFF); + m_srAttachTo = short(srVal & 0xFFFF); + m_fAttachMod = true; + } + void SetAttachLevel(int nVal) { + Assert(nVal < 0xFFFF); m_nAttachLevel = short(nVal & 0xFFFF); m_fAttachMod = true; } + + void SetAttachAtX(int mVal) + { + Assert(mVal < 0xFFFF); + m_mAttachAtX = short(mVal) & 0xFFFF; + m_fAttachMod = true; + } + void SetAttachAtY(int mVal) { + Assert(mVal < 0xFFFF); m_mAttachAtY = short(mVal & 0xFFFF); m_fAttachMod = true; } + void SetAttachAtGpoint(int nVal) { + m_nAttachAtGpoint = short(nVal); m_fAttachMod = true; } + void SetAttachAtXOffset(int mVal) { + Assert(mVal < 0xFFFF); m_mAttachAtXOffset = short(mVal & 0xFFFF); m_fAttachMod = true; } + void SetAttachAtYOffset(int mVal) { + Assert(mVal < 0xFFFF); m_mAttachAtYOffset = short(mVal & 0xFFFF); m_fAttachMod = true; } + + void SetAttachWithX(int mVal) { + Assert(mVal < 0xFFFF); m_mAttachWithX = short(mVal & 0xFFFF); m_fAttachMod = true; } + void SetAttachWithY(int mVal) { + Assert(mVal < 0xFFFF); m_mAttachWithY = short(mVal & 0xFFFF); m_fAttachMod = true; } + void SetAttachWithGpoint(int nVal) { + m_nAttachWithGpoint = short(nVal); m_fAttachMod = true; } + void SetAttachWithXOffset(int mVal) { + Assert(mVal < 0xFFFF); m_mAttachWithXOffset = short(mVal & 0xFFFF); m_fAttachMod = true; } + void SetAttachWithYOffset(int mVal) { + Assert(mVal < 0xFFFF); m_mAttachWithYOffset = short(mVal & 0xFFFF); m_fAttachMod = true; } + + void SetCompRefSlot(GrTableManager * ptman, int i, GrSlotState * pslotComp); + + void SetBreakWeight(int lb) { m_lb = sdata8(lb); } + void SetInsertBefore(bool f) { m_fInsertBefore = f; } + + void SetDirectionality(DirCode dirc) { m_dirc = sdata8(dirc); } + void SetDirLevel(int n) { m_nDirLevel = sdata8(n); } + + void SetMeasureSol(int mVal) { m_mMeasureSol = short(mVal); } + void SetMeasureEol(int mVal) { m_mMeasureEol = short(mVal); } + + void SetJStretch(int mVal) { m_mJStretch0 = short(mVal); } + void SetJShrink(int mVal) { m_mJShrink0 = short(mVal); } + void SetJStep(int mVal) { m_mJStep0 = short(mVal); } + void SetJWeight(int nVal) { m_nJWeight0 = byte(nVal); } + void SetJWidth(int mVal) { m_mJWidth0 = mVal; } + void AddJWidthToAdvance(GrTableManager * ptman) + { + // Don't change m_fShiftMod. + m_mAdvanceX = short(m_mJWidth0 + AdvanceX(ptman)); // make sure it is calculated + m_mJWidth0 = 0; + m_fAdvXSet = true; // for transduction logging + } + + int PostBidiDirLevel(GrTableManager * ptman); + + bool BaseEarlierInStream(); + + void ZapDirLevel() + { + m_nDirLevel = -1; + m_dircProc = kdircUnknown; + m_fDirProcessed = false; + } + + int GlyphAttrValueEmUnits(GrTableManager * ptman, int nAttrID); + int GlyphMetricEmUnits(GrTableManager * ptman, int nGlyphMetricID); + + float GlyphAttrValueLogUnits(GrTableManager * ptman, int nAttrID); + float GlyphMetricLogUnits(GrTableManager * ptman, int nGlyphMetricID); + +// void HandleModifiedCluster(GrTableManager * ptman, +// GrSlotStream * psstrm, int islotThis); + void HandleModifiedPosition(GrTableManager * ptman, + GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, int islotThis); + + void CalcCompositeMetrics(GrTableManager * ptman, GrSlotStream * psstrm, + GrSlotStream * psstrmNext, int nLevel, bool fThorough = false); + + void Position(GrTableManager * ptman, + GrSlotStream * psstrmOut, int * pmXPos, int * pmYPos); + + void ZapPosition() + { + m_xsPositionX = kNegInfFloat; + m_ysPositionY = kNegInfFloat; + } + + void SetXPos(float xs) + { + m_xsPositionX = xs; + } + void SetYPos(float ys) + { + m_ysPositionY = ys; // relative to baseline (positive is up) + } + + float ClusterRootOffset() { return -m_xsClusterXOffset; } // the offset of the root + // relative to the whole cluster + + float ClusterAdvWidthFrom(float xs) { return xs + m_xsClusterAdv; } + float ClusterBbLeftFrom(float xs) { return xs + m_xsClusterBbLeft; } + float ClusterBbRightFrom(float xs) { return xs + m_xsClusterBbRight; } + + float ClusterLsb(GrSlotStream * psstrm, float xs) + { + return ClusterBbLeft(psstrm) + xs; + } + float ClusterRsb(GrSlotStream * /*psstrm*/, float xs) + { + return ClusterAdvWidthFrom(xs) - ClusterBbRightFrom(xs); + } + + float ClusterAdvWidth(GrSlotStream * psstrm) + { + return ClusterAdvWidthFrom(Base(psstrm)->ClusterRootOffset()); + } +// int ClusterAdvHeight(GrSlotStream * psstrm) +// { +// Assert(m_mAdvanceY != kNotYetSet); +// return EmUnitsToTwips(m_mAdvanceY); +// } + float ClusterBbLeft(GrSlotStream * psstrm) + { + return ClusterBbLeftFrom(Base(psstrm)->ClusterRootOffset()); + } + float ClusterBbRight(GrSlotStream * psstrm) + { + return ClusterBbRightFrom(Base(psstrm)->ClusterRootOffset()); + } + float ClusterBbTop(GrSlotStream * /*psstrm*/) + { + return m_ysClusterBbTop; + } + float ClusterBbBottom(GrSlotStream * /*psstrm*/) + { + return m_ysClusterBbBottom; + } + float ClusterBbWidth(GrSlotStream * /*psstrm*/) + { + return m_xsClusterBbRight - m_xsClusterBbLeft + 1; + } + float ClusterBbHeight(GrSlotStream * /*psstrm*/) + { + return m_ysClusterBbTop - m_ysClusterBbBottom + 1; + } + float ClusterLsb(GrSlotStream * psstrm) + { + return ClusterBbLeft(psstrm); + } + float ClusterRsb(GrSlotStream * psstrm) + { + return ClusterAdvWidth(psstrm) - ClusterBbRight(psstrm); + } + + float GlyphXOffset(GrSlotStream * psstrm, float fakeItalicRatio = 0); + float GlyphYOffset(GrSlotStream * psstrm = NULL); + + bool IsBase() + { + Assert(m_dislotRootFixed == m_srAttachTo); + return (m_dislotRootFixed == 0); + } + + bool HasClusterMembers() + { + return (m_vdislotAttLeaves.size() > 0); + } + + GrSlotState * AttachRoot(GrSlotStream * psstrm) + { + if (m_srAttachTo == 0) + return NULL; + else + return SlotAtOffset(psstrm, m_srAttachTo); + } + + int AttachRootPosPassIndex() + { + return PosPassIndex() + m_srAttachTo; + } + + GrSlotState * Base(GrSlotStream * psstrm) + { + GrSlotState * pslotRoot = AttachRoot(psstrm); + if (!pslotRoot) + return this; + else + return pslotRoot->Base(psstrm); + } + + int LastLeafOffset(GrSlotStream * psstrm); + + void AddLeaf(int dislot) + { + m_vdislotAttLeaves.push_back(dislot * -1); + } + void RemoveLeaf(int dislot) + { + for (size_t iislot = 0; iislot < m_vdislotAttLeaves.size(); iislot++) + { + if (m_vdislotAttLeaves[iislot] == dislot * -1) + { + m_vdislotAttLeaves.erase(m_vdislotAttLeaves.begin() + iislot); + return; + } + } + Assert(false); + } + + bool HasAsRoot(GrSlotStream * psstrm, GrSlotState * pslot) + { + GrSlotState * pslotRoot = AttachRoot(psstrm); + if (pslotRoot == pslot) + return true; + else if (pslotRoot == NULL) + return false; + else + return pslotRoot->HasAsRoot(psstrm, pslot); + } + + bool HasAsPreviousState(GrSlotState * pslot) + { + if (this == pslot) + return true; + else + return m_pslotPrevState->HasAsPreviousState(pslot); + } + + void EnsureCacheForOutput(GrTableManager * ptman); + + bool IsLrm(); + bool IsRlm(); + + // Cache of FSM column information for the most recent pass: + int FsmColumn() { return m_colFsm; } + int PassNumberForColumn() { return m_ipassFsmCol; } + void CacheFsmColumn(int ipass, int col) + { + m_colFsm = col; + m_ipassFsmCol = ipass; + } + + // Variable-length buffer--includes four sub-buffers: + // * user-defined variables + // * component.???.ref assignments + // * mapping from components used to global attribute IDs for components + // * feature values + + // user-defined slot attributes + int UserDefn(int slati) + { + Assert(slati < m_cnUserDefn); + return m_prgnVarLenBuf[slati].nValue; + } + void SetUserDefn(int slati, int nVal) + { + Assert(slati < m_cnUserDefn); + m_prgnVarLenBuf[slati].nValue = nVal; + } + u_intslot * PUserDefnBuf() + { + return m_prgnVarLenBuf; + } + + // pointer to the associated slot which is the value of the comp.ref attribute + GrSlotState * CompRef(int slati) + { + Assert(slati < m_cnCompPerLig); + return m_prgnVarLenBuf[m_cnUserDefn + slati].pslot; + } + void SetCompRef(int slati, GrSlotState * pvSlot) + { + Assert(slati < m_cnCompPerLig); + m_prgnVarLenBuf[m_cnUserDefn + slati].pslot = pvSlot; + } + u_intslot * PCompRefBuf() + { + return m_prgnVarLenBuf + m_cnUserDefn; + } + + // global component identifier + int Slati(int i) + { + Assert(i < m_cnCompPerLig); + return m_prgnVarLenBuf[m_cnUserDefn + m_cnCompPerLig + i].nValue; + } + void SetSlati(int i, int n) + { + Assert(i < m_cnCompPerLig); + m_prgnVarLenBuf[m_cnUserDefn + m_cnCompPerLig + i].nValue = n; + } + u_intslot * PSlatiBuf() + { + return m_prgnVarLenBuf + m_cnUserDefn + m_cnCompPerLig; + } + + // feature settings + int FeatureValue(int i) + { + Assert(i < m_cnFeat); + return m_prgnVarLenBuf[m_cnUserDefn + (m_cnCompPerLig * 2) + i].nValue; + } + + u_intslot * PFeatureBuf() + { + return m_prgnVarLenBuf + m_cnUserDefn + (m_cnCompPerLig * 2); + } + + int CExtraSpace() + { + return m_cnUserDefn + (m_cnCompPerLig * 2) + m_cnFeat; + } + + GrSlotState * CompRefSlot(int i); + + void GetFeatureValues(GrFeatureValues * pfval) + { + pfval->m_nStyleIndex = m_bStyleIndex; + std::fill(pfval->m_rgnFValues, pfval->m_rgnFValues + kMaxFeatures, 0); + for (size_t i = 0; i < m_cnFeat; i++) + pfval->m_rgnFValues[i] = PFeatureBuf()[i].nValue; + } + + // Return true if this slot has all the same features as the argument slot. + bool SameFeatures(GrSlotState * pslot) + { + for (size_t i = 0; i < m_cnFeat; i++) + { + if (FeatureValue(i) != pslot->FeatureValue(i)) + return false; + } + return true; + } + +// For transduction logging: +#ifdef TRACING + void SlotAttrsModified(bool * rgfMods, bool fPreJust, int * pccomp, int * pcassoc); + void LogSlotAttribute(GrTableManager *, std::ostream &, int ipass, int slat, int icomp, + bool fPreJust, bool fPostJust); + void LogAssociation(GrTableManager * ptman, + std::ostream & strmOut, int ipass, int iassoc, bool fBoth, bool fAfter); + int m_islotTmpIn; // for use by transduction log; index of slot in input stream + int m_islotTmpOut; // ditto; index of slot in output stream +#endif // TRACING + +protected: + + // Instance variables: + int m_ipassModified; // pass in which this slot was modified + + GrSlotState * m_pslotPrevState; + + int m_ichwSegOffset; // for original (pass 0) slot states: position in + // underlying text relative to the official + // beginning of the segment; + // should == kInvalid for other slot states + int m_islotPosPass; // index of slot in positioning streams, relative to first official + // slot in the segment (possibly the LB slot) + + int m_colFsm; // which FSM column this glyph corresponds to... + int m_ipassFsmCol; // ...for the most recent pass + + std::vector m_vpslotAssoc; // association mappings + + bool m_fNeutralAssocs; // true if we've set the associations to some neutral + // default, rather than them being set explicitly + // within a rule + + int m_nUnicode; // for debugging + + DirCode m_dircProc; // directionality as processed in bidi algorithm + bool m_fDirProcessed; + + // affects length of variable-length buffer + byte m_cnUserDefn; + byte m_cnFeat; + + byte m_bStyleIndex; + + // Slot attributes: + short m_mAdvanceX; + short m_mAdvanceY; + short m_mShiftX; + short m_mShiftY; + + short m_srAttachTo; + short m_nAttachLevel; + + short m_mAttachAtX; + short m_mAttachAtY; + short m_mAttachAtXOffset; + short m_mAttachAtYOffset; + short m_mAttachWithX; + short m_mAttachWithY; + short m_mAttachWithXOffset; + short m_mAttachWithYOffset; + + short m_nAttachAtGpoint; + short m_nAttachWithGpoint; + + // Raw glyph metrics (directly from font) + float m_xysFontAscent; + float m_xysFontDescent; + float m_xysGlyphWidth; + float m_xysGlyphHeight; + float m_xysGlyphX; + float m_xysGlyphY; + float m_xysAdvX; + float m_xysAdvY; + + // Attachment and metrics + + // This is a flag that is set whenever we change the value of any of the attach + // slot attributes. Then when we want to find out something about the attachments, + // if it is set, we have some work to do in updating the pointers and metrics. + bool m_fAttachMod; + + // This is a flag that is set whenever we change the value of any of the shift or + // advance slot attributes. It forces us to zap the metrics. + bool m_fShiftMod; + + // This glyph (and all its leaves, if any) have a zero advance width; + // never allow it to affect the advance width of a cluster it is part of. + bool m_fIgnoreAdvance; + + int m_dislotRootFixed; // the offset of the slot (relative to this one) that considers + // this slot to be one of its leaves + std::vector m_vdislotAttLeaves; + + // The following are used by the CalcCompositeMetrics() method and depend on + // the cluster level that was passed as an argument. + + int m_nCompositeLevel; // cluster level last used to calculate composite metrics; + // kNegInfinity if uncalculated + + // offsets for this node only, relative to cluster base + float m_xsOffsetX; + float m_ysOffsetY; // relative to baseline (positive is up) + + // offsets for this node and its leaves, relative to cluster base (y-coords are + // relative to baseline) + float m_xsClusterXOffset; + float m_xsClusterAdv; + float m_xsClusterBbLeft; + float m_xsClusterBbRight; + float m_ysClusterBbTop; + float m_ysClusterBbBottom; + + // cumulative total of shifts for this node and roots; advance needs to ignore these + float m_xsRootShiftX; + float m_ysRootShiftY; + + bool m_fHasComponents; // default = false + + // Private methods: + + void CopyAbstractFrom(GrSlotState * pslot); + + void AdjustRootMetrics(GrTableManager * ptman, GrSlotStream *); + void InitMetrics(GrTableManager * ptman, GrSlotState * pslotRoot); + void InitLeafMetrics(GrTableManager * ptman, GrSlotState * pslotRoot); + void InitRootMetrics(GrTableManager * ptman); + void CalcRootMetrics(GrTableManager * ptman, GrSlotStream * psstrm, + GrSlotStream * psstrmNext, int nLevel); + void AttachToRoot(GrTableManager * ptman, GrSlotStream *, GrSlotState * pslotNewRoot); + void AttachLogUnits(GrTableManager * ptman, + GrSlotState * pslotRoot, + float * pxsAttAtX, float * pysAttAtY, + float * pxsAttWithX, float * pysAttWithY); + + GrSlotState * SlotAtOffset(GrSlotStream * psstrm, int dislot); // ENHANCE SharonC: inline? + + void EnsureLocalAttachmentTree(GrTableManager * ptman, + GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, int islotThis); + + void ZapCompositeMetrics() + { + m_nCompositeLevel = kNegInfinity; + m_xsPositionX = kNegInfFloat; + m_ysPositionY = kNegInfFloat; + m_xsOffsetX = 0; + m_ysOffsetY = 0; + m_xsRootShiftX = 0; + m_ysRootShiftY = 0; + ZapRootMetrics(); + } + + void ZapRootMetrics() + { + m_xsClusterXOffset = 0; + m_xsClusterAdv = 0; + m_xsClusterBbLeft = 0; + m_xsClusterBbRight = 0; + m_ysClusterBbTop = 0; + m_ysClusterBbBottom = 0; + m_fIgnoreAdvance = false; + } + + void ZapMetricsAndPositionDownToBase(GrSlotStream * psstrm) + { + ZapCompositeMetrics(); + if (m_dislotRootFixed) + SlotAtOffset(psstrm, m_dislotRootFixed)->ZapMetricsAndPositionDownToBase(psstrm); + } + + void ZapMetricsOfLeaves(GrSlotStream * psstrm, bool fThis = false) + { + if (fThis) + ZapCompositeMetrics(); + for (size_t islot = 0; islot < m_vdislotAttLeaves.size(); islot++) + { + SlotAtOffset(psstrm, m_vdislotAttLeaves[islot])->ZapMetricsOfLeaves(psstrm, true); + } + } + +public: // for transduction logging + bool m_fAdvXSet; + bool m_fAdvYSet; + +}; // end of class GrSlotState + + +/*---------------------------------------------------------------------------------------------- + A GrSlotOutput represents one slot as the final output of the final pass. These + are recorded in the segment. + + Hungarian: slout +----------------------------------------------------------------------------------------------*/ +class GrSlotOutput : public GrSlotAbstract +{ + friend class GlyphInfo; + friend class Segment; + friend class SegmentMemoryUsage; + +public: + GrSlotOutput() + { + m_cComponents = 0; + m_isloutClusterBase = -1; // not part of any cluster + m_disloutCluster = 0; + m_igbb = -1; + } + + void ExactCopyFrom(GrSlotOutput * pslout, u_intslot * pnVarLenBuf, int cnExtraPerSlot); + + void InitializeOutputFrom(GrSlotState * pslot); + + int BeforeAssoc() + { + return m_ichwBeforeAssoc; // relative to the official beginning of the segment + } + int AfterAssoc() + { + return m_ichwAfterAssoc; // relative to the official beginning of the segment + } + + void SetBeforeAssoc(int ichw) + { + m_ichwBeforeAssoc = ichw; + } + void SetAfterAssoc(int ichw) + { + m_ichwAfterAssoc = ichw; + } + + //u_intslot * PCompRefBufSlout() + //{ + // return m_prgnVarLenBuf; + //} + int CExtraSpaceSlout() + { + return (m_cnCompPerLig * 2); + } + + int IbufUnderlyingCompOffset() + { + return 0; + } + int IbufCompIdOffset() + { + return m_cnCompPerLig; + } + + void AddComponentReference(int ichw, int slati) + { + short ichw16 = short(ichw); + if (m_cComponents >= m_cnCompPerLig) + { + Assert(false); // too many--ignore the requested component ref + } + else + { + int iComp; + for (iComp = 0; iComp < m_cComponents; iComp++) + { + if (ComponentId(iComp) == slati) + { + // We already have at least one character for this component. Add another. + if (m_prgnVarLenBuf[IbufUnderlyingCompOffset() + iComp].smallint[0] > ichw16) + m_prgnVarLenBuf[IbufUnderlyingCompOffset() + iComp].smallint[0] = ichw16; // min + if (m_prgnVarLenBuf[IbufUnderlyingCompOffset() + iComp].smallint[1] < ichw16) + m_prgnVarLenBuf[IbufUnderlyingCompOffset() + iComp].smallint[1] = ichw16; // max + return; + } + } + + iComp = m_cComponents; + + m_prgnVarLenBuf[IbufUnderlyingCompOffset() + iComp].smallint[0] = ichw16; // min + m_prgnVarLenBuf[IbufUnderlyingCompOffset() + iComp].smallint[1] = ichw16; // max + + // OBSOLETE comment: + // Maps the used components to the defined components. Normally this will be + // one-to-one and the buffer will hold [0,1,2...]. But possibly we may + // have defined components a, b, and c, but only mapped a and c to actual + // characters. This buffer will then hold [0,2]. + + m_prgnVarLenBuf[IbufCompIdOffset() + iComp].nValue = slati; + +// Assert(iComp >= m_cComponents); // because we process them in order they are defined + // in, but we could have skipped some that are + // defined + m_cComponents++; + } + } + int NumberOfComponents() // the number used by the rules + { + return m_cComponents; + } + // Index of ligature components, relative to the beginning of the segment. + // iComp is index of components USED in this glyph. + int FirstUnderlyingComponent(int iComp) + { + Assert(iComp < m_cnCompPerLig); + int ichw = m_prgnVarLenBuf[IbufUnderlyingCompOffset() + iComp].smallint[0]; + return ichw; + } + int LastUnderlyingComponent(int iComp) + { + Assert(iComp < m_cnCompPerLig); + int ichw = m_prgnVarLenBuf[IbufUnderlyingCompOffset() + iComp].smallint[1]; + return ichw; + } + int ComponentId(int iComp) + { + return m_prgnVarLenBuf[IbufCompIdOffset() + iComp].nValue; + } + + void SetClusterBase(int islout) + { + m_isloutClusterBase = islout; + } + + int ClusterBase() + { + return m_isloutClusterBase; + } + + bool IsPartOfCluster() + { + return (m_isloutClusterBase > -1); + } + + //int NumClusterMembers() + //{ + // return m_visloutClusterMembers.size(); + //} + //int ClusterMember(int iislout) + //{ + // return m_visloutClusterMembers[iislout]; + //} + + void AddClusterMember(int isloutThis, int isloutAttached) + { + m_disloutCluster = sdata8(max(int(m_disloutCluster), abs(isloutThis - isloutAttached))); + } + + void ClusterMembers(Segment * pseg, int islout, std::vector & visloutRet); + + int ClusterRange() + { + return m_disloutCluster; + } + + float ClusterXOffset() { return m_xsClusterXOffset; } + float ClusterAdvance() { return m_xsClusterAdvance; } + void SetClusterXOffset(float xs) { m_xsClusterXOffset = xs; } + void SetClusterAdvance(float xs) { m_xsClusterAdvance = xs; } + + float GlyphMetricLogUnits(Font * pfont, int nGlyphMetric); + //float GlyphMetricLogUnits(int nMetricID); + + int GlyphBbIndex() { return m_igbb; } + void SetGlyphBbIndex (int i) { m_igbb = i; } + + Rect BoundingBox(Font & font) + { + Rect rectBB; + rectBB.left = m_xsPositionX + GlyphMetricLogUnits(&font, kgmetBbLeft); + if (IsSpace()) + rectBB.right = m_xsPositionX + GlyphMetricLogUnits(&font, kgmetAdvWidth); + else + rectBB.right = m_xsPositionX + GlyphMetricLogUnits(&font, kgmetBbRight); + rectBB.top = m_ysPositionY + GlyphMetricLogUnits(&font, kgmetBbTop); + rectBB.bottom = m_ysPositionY + GlyphMetricLogUnits(&font, kgmetBbBottom); + return rectBB; + } + + bool IsLineBreak() + { + return (IsInitialLineBreak() || IsFinalLineBreak()); + } + bool IsInitialLineBreak() + { + return (m_spsl == kspslLbInitial); + } + bool IsFinalLineBreak() + { + return (m_spsl == kspslLbFinal); + } + + //float AdvanceXMetric() + //{ + // return m_xysAdvX; + //} + + bool IsSpace(); + + void AdjustPosXBy(float dxs) + { + m_xsPositionX += dxs; + //m_rectBB.left += dxs; + //m_rectBB.right += dxs; + } + + void ShiftForDirDepthChange(float dxsSegWidth); + + // Used by GlyphInfo + int IndexAttachedTo(); + //inline float AdvanceX(Segment * pseg); + //inline float AdvanceY(Segment * pseg); + float MaxStretch(Segment * pseg, int level); + float MaxShrink(Segment * pseg, int level); + float StretchStep(Segment * pseg, int level); + int JustWeight(int level); + float JustWidth(Segment * pseg, int level); + float MeasureSolLogUnits(Segment * pseg); + float MeasureEolLogUnits(Segment * pseg); + Rect ComponentRect(Segment * pseg, int icomp); + +protected: + // Instance variables: + + sdata8 m_cComponents; + + data8 m_disloutCluster; // how far to search on either side of this glyph to find + // other members of the cluster; + // 0 means there are no cluster members or this glyph is + // attached to some other base + + int m_isloutClusterBase; // the index of the slot that serves as the base for the + // cluster this slot is a part of; -1 if not part of cluster + + int m_ichwBeforeAssoc; // index of associated character(s) in the string + int m_ichwAfterAssoc; // (relative to the official beginning of the segment) + // char might possibly not be officially in this segment, + // in which case value is infinity + + // Measurements for highlighting an entire cluster, relative to origin of this slot, + // which is the cluster base. + float m_xsClusterXOffset; + float m_xsClusterAdvance; // for single non-cluster glyphs, advance width of positioned glyph + + // Index into m_prggbb in Segment; -1 indicates a line break slot that is not rendered: + int m_igbb; + + float m_xsAdvanceX; +// float m_ysAdvanceY; -- not used +// Rect m_rectBB; + +}; // end of class GrSlotOutput + +} // namespace gr + + +#endif // !SLOTSTATE_INCLUDED diff --git a/Build/source/libs/graphite/engine-2.4/src/segment/GrSlotStream.cpp b/Build/source/libs/graphite/engine-2.4/src/segment/GrSlotStream.cpp new file mode 100644 index 00000000000..f881ea303eb --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/src/segment/GrSlotStream.cpp @@ -0,0 +1,2461 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 1999, 2001 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: GrSlotStream.cpp +Responsibility: Sharon Correll +Last reviewed: Not yet. + +Description: + GrSlotStream class implementation. +----------------------------------------------------------------------------------------------*/ + +//:>******************************************************************************************** +//:> Include files +//:>******************************************************************************************** +#include "Main.h" + +#include "GrConstants.h" + +#ifdef _MSC_VER +#pragma hdrstop +#endif + +//:End Ignore + +//:>******************************************************************************************** +//:> Forward declarations +//:>******************************************************************************************** + +//:>******************************************************************************************** +//:> Local Constants and static variables +//:>******************************************************************************************** + +namespace gr +{ + +//:>******************************************************************************************** +//:> Methods +//:>******************************************************************************************** + +/*---------------------------------------------------------------------------------------------- + Answer true if there is nothing valid available to read from the stream. +----------------------------------------------------------------------------------------------*/ +bool GrSlotStream::AtEnd() +{ + Assert(AssertValid()); + + if (m_islotReprocPos > -1 && m_islotReprocPos < signed(m_vpslotReproc.size())) + return false; + + if (m_islotSegLim > -1 && m_islotReadPos >= m_islotSegLim) + // We've determined the segment limit, and we're at or past it. + return true; + + return (m_islotReadPos == m_islotWritePos); +} + +/*---------------------------------------------------------------------------------------------- + Answer true if there is nothing at all available to read from the stream. + For substitution passes, we need to consider slots that may be beyond what we know + will be the official end of the segment. +----------------------------------------------------------------------------------------------*/ +bool GrSlotStream::AtEndOfContext() +{ + if (m_fUsedByPosPass) + return AtEnd(); + + if (m_islotReprocPos > -1 && m_islotReprocPos < signed(m_vpslotReproc.size())) + return false; + + return (m_islotReadPos == m_islotWritePos); +} + +/*---------------------------------------------------------------------------------------------- + Append a slot to the end of the stream. +----------------------------------------------------------------------------------------------*/ +void GrSlotStream::NextPut(GrSlotState * pslot) +{ + Assert(AssertValid()); + + if (m_islotWritePos < signed(m_vpslot.size())) + { + m_vpslot[m_islotWritePos] = pslot; + } + else + { + m_vpslot.push_back(pslot); + m_vislotPrevChunkMap.push_back(-1); + m_vislotNextChunkMap.push_back(-1); + } + + if (m_fUsedByPosPass && GotIndexOffset()) + pslot->SetPosPassIndex(m_islotWritePos - m_cslotPreSeg, m_fInputToPosPass1); + + m_islotWritePos++; +} + +/*---------------------------------------------------------------------------------------------- + Get the next slot from the stream. +----------------------------------------------------------------------------------------------*/ +GrSlotState * GrSlotStream::NextGet() +{ + Assert(AssertValid()); + Assert(!AtEndOfContext()); + + GrSlotState * pslotRet; + + if (m_islotReprocPos > -1) + { + if (m_islotReprocPos >= signed(m_vpslotReproc.size())) + { + // Finished reprocessing. + Assert((unsigned)m_islotReprocPos == m_vpslotReproc.size()); + m_islotReprocPos = -1; + // But leave the m_vpslotReproc array in place so that earlier slots can + // be accessed by the rules. + pslotRet = m_vpslot[m_islotReadPos]; + m_islotReadPos++; + } + else + { + // Read from the reprocess buffer. + pslotRet = m_vpslotReproc[m_islotReprocPos]; + m_islotReprocPos++; + } + } + else + { + // Read normally. + pslotRet = m_vpslot[m_islotReadPos]; + m_islotReadPos++; + } + + Assert(!m_fUsedByPosPass || pslotRet->PosPassIndex() != GrSlotAbstract::kNotYetSet); + + return pslotRet; +} + +/*--------------------------------------------------------------------------------------------- + Peek at the next slot from the stream (dislot = 0 means the very next slot). + Only used for peeking forward. RuleInputSlot is used for accessing any possible + slot in the rule's context. +----------------------------------------------------------------------------------------------*/ +GrSlotState * GrSlotStream::Peek(int dislot) +{ + Assert(AssertValid()); + Assert(!AtEndOfContext()); + Assert(dislot >= 0); + + GrSlotState * pslotRet; + + if (m_islotReprocPos > -1) + { + int cslotReproc = m_vpslotReproc.size() - m_islotReprocPos; // num left in reproc buffer + if (dislot >= cslotReproc) + { + // Not quite enough slots in the reprocess buffer. + pslotRet = m_vpslot[m_islotReadPos + dislot - cslotReproc]; + } + else if (m_islotReprocPos + dislot < 0) + { + // Reading prior to the reprocess buffer + pslotRet = m_vpslot[m_islotReadPos + dislot - cslotReproc]; + } + else + { + // Read from the reprocess buffer. + pslotRet = m_vpslotReproc[m_islotReprocPos + dislot]; + } + } + else + { + // Read normally. + Assert(m_islotWritePos - m_islotReadPos > dislot); + pslotRet = m_vpslot[m_islotReadPos + dislot]; + } + + return pslotRet; +} + +/*--------------------------------------------------------------------------------------------- + Treat the stream, which is really the output stream, as an input stream, + retrieving a recently output slot. This happens when we are reading before the + current stream position when the rule is being matched, or before the original + stream position when the rule is being run. + + @param dislot - how far back to peek before the write position + WHEN THE RULE STARTED; a negative number + (NOTE: the current write position is irrelevant) + @param fNullOkay - true if it's okay to return NULL in the situation where we're asking + for something before the beginning of the stream +----------------------------------------------------------------------------------------------*/ +#ifdef NDEBUG +GrSlotState * GrSlotStream::PeekBack(int dislot, bool) +#else +GrSlotState * GrSlotStream::PeekBack(int dislot, bool fNullOkay) +#endif +{ + Assert(dislot < 0); + if (dislot < m_islotRuleStartWrite * -1) + { + Assert(fNullOkay); + return NULL; + } + GrSlotState * pslotRet; + if (m_islotReprocPos > -1) + { + if (dislot < m_islotReprocLim - m_islotRuleStartWrite && + dislot >= m_islotReprocLim - m_islotRuleStartWrite - signed(m_vpslotReproc.size())) + { + // Read from the reprocess buffer. + // Review: this is weird; can it ever happen? + pslotRet = m_vpslotReproc[m_vpslotReproc.size() + - (m_islotReprocLim - m_islotRuleStartWrite) + dislot]; + } + else + pslotRet = m_vpslot[m_islotRuleStartWrite + dislot]; + } + else + pslotRet = m_vpslot[m_islotRuleStartWrite + dislot]; + + return pslotRet; +} + +/*--------------------------------------------------------------------------------------------- + Skip the given number of slots in the stream. + ENHANCE: implement more efficiently +----------------------------------------------------------------------------------------------*/ +void GrSlotStream::Skip(int dislot) +{ + for (int islot = 0; islot < dislot; ++islot) + NextGet(); +} + +/*---------------------------------------------------------------------------------------------- + Perform assertions to ensure that the stream is in a valid state. +----------------------------------------------------------------------------------------------*/ +bool GrSlotStream::AssertValid() +{ + Assert(m_islotWritePos <= signed(m_vpslot.size())); + Assert(m_islotReadPos <= m_islotWritePos); + // Streams used by the positioning passes (input or output) should not be working + // with slots beyond the segment lim + Assert(m_islotSegLim == -1 || !m_fUsedByPosPass || m_islotReadPos <= m_islotSegLim); + Assert(m_vpslot.size() == m_vislotPrevChunkMap.size()); + Assert(m_vpslot.size() == m_vislotNextChunkMap.size()); + return true; +} + +/*---------------------------------------------------------------------------------------------- + Return the number of slots that have been completely output by the previous pass but not + yet processed by the following pass. ("Completely" output means that they do not need + to be reprocessed by the same pass, only then are they available as valid input.) + Include any slots that are present by virtue of needing to be reprocessed by the + corresponding output stream. +----------------------------------------------------------------------------------------------*/ +int GrSlotStream::SlotsPending() +{ + Assert(AssertValid()); + if (m_islotSegLim > -1) + return (m_islotSegLim - m_islotReadPos + SlotsToReprocess()); + else + return (m_islotWritePos - m_islotReadPos + SlotsToReprocess()); +} + +int GrSlotStream::SlotsPendingInContext() +{ + Assert(AssertValid()); + if (m_fUsedByPosPass) + return SlotsPending(); + else + return (m_islotWritePos - m_islotReadPos + SlotsToReprocess()); +} + +int GrSlotStream::TotalSlotsPending() +{ + int cslot = SlotsPendingInContext(); + if (m_fUsedByPosPass && m_islotSegLim > -1) + { + int ctmp = m_islotWritePos - m_islotReadPos + SlotsToReprocess(); + if (ctmp > cslot) + { + int x; x = 3; + } + cslot = max(cslot, ctmp); + } + return cslot; +} + +/*---------------------------------------------------------------------------------------------- + Return true if this pass is input or output to a positioning pass and we're past the end + of the segment. So this stream is virtually finished. +----------------------------------------------------------------------------------------------*/ +bool GrSlotStream::PastEndOfPositioning(bool fOutput) +{ + if (m_fUsedByPosPass && m_islotSegLim > -1) + { + if (fOutput) // this stream is functioning as an output stream + return (m_islotWritePos >= m_islotSegLim); + else // this stream is functioning as an input stream + return (m_islotReadPos >= m_islotSegLim); + } + return false; +} + +/*---------------------------------------------------------------------------------------------- + Mark the stream as fully written, so that the output pass doesn't keep trying to ask + for more input. +----------------------------------------------------------------------------------------------*/ +void GrSlotStream::MarkFullyWritten() +{ + m_fFullyWritten = true; +} + +/*---------------------------------------------------------------------------------------------- + Return the position of the first glyph at or following the given position + that is in the top direction, or -1 if we do not have a complete range. + + @param ptman + @param islotStart + @nTopDirLevel - top direction: 0 = left-to-right, 1 = right-to-left +----------------------------------------------------------------------------------------------*/ +int GrSlotStream::OldDirLevelRange(EngineState * pengst, int islotStart, int nTopDirLevel) +{ + Assert(m_islotReadPos <= islotStart); + Assert(islotStart < m_islotWritePos); + + int islot = islotStart; + int nSlotDirLevel = GetSlotDirLevel(pengst, islot, nTopDirLevel, nTopDirLevel, + kdircUnknown, kdircNeutral); + if (nSlotDirLevel == -1) + return -1; + while (nSlotDirLevel > nTopDirLevel) + { + islot++; + if (islot >= m_islotWritePos) + { + if (m_fFullyWritten) + return islot; + else + return -1; + } + else if (m_islotSegLim > -1 && islot >= m_islotSegLim) + { + return islot; + } + + nSlotDirLevel = GetSlotDirLevel(pengst, islot, nTopDirLevel, nTopDirLevel, + kdircUnknown, kdircNeutral); + if (nSlotDirLevel == -1) + return -1; + } + return islot; +} + +/*---------------------------------------------------------------------------------------------- + Return the end of the range that has the same feature settings as the current slot. + The recipient is functioning as the input stream. +----------------------------------------------------------------------------------------------*/ +int GrSlotStream::FeatureRangeLim(GrSlotStream * psstrmOut) +{ + GrSlotState * pslot = RuleInputSlot(0, psstrmOut); + int islotResult = ReadPos(); + while (true) + { + if (WritePos() < islotResult) + return WritePos(); + islotResult++; + GrSlotState * pslotNext = Peek(islotResult - ReadPos() - 1); // Peek(0) means get the next + if (!pslotNext->SameFeatures(pslot)) + break; + } + return islotResult; +} + +/*---------------------------------------------------------------------------------------------- + Return true if the all the slots in the stream have the same feature settings. + Assumes the stream has been fully run. +----------------------------------------------------------------------------------------------*/ +bool GrSlotStream::NoFeatureChanges() +{ + Assert(SlotsToReprocess() == 0); + + GrSlotState * pslotFirst = SlotAt(0); + for (int islot = 1; islot < WritePos(); islot++) + { + GrSlotState * pslotAnother = SlotAt(islot); + if (!pslotFirst->SameFeatures(pslotAnother)) + return false; + } + return true; +} + +/*---------------------------------------------------------------------------------------------- + Return the position of the first glyph at or following the given position + that is in the top direction, or -1 if we do not have a complete range. + + @param ptman + @param islotStart + @nTopDirLevel - top direction: 0 = left-to-right, 1 = right-to-left +----------------------------------------------------------------------------------------------*/ +int GrSlotStream::DirLevelRange(EngineState * pengst, int islotStart, int nTopDirLevel, + std::vector & vislotStarts, std::vector & vislotStops) +{ + Assert(m_islotReadPos <= islotStart); + Assert(islotStart < m_islotWritePos); + + std::vector vislotStartStack; // indices of starts of ranges to reverse + + // Stack corresponding to embedding and override markers: + std::vector vdircMarkerStack; + std::vector vdircOverrideStack; + std::vector vnLevelStack; + + vislotStarts.clear(); + vislotStops.clear(); + + //vislotStartStack.Push(islot); + + int islotSegLim = (FullyWritten() || m_islotSegLim > -1) ? + FinalSegLim() : + WritePos() + 100; // arbitrarily large number + + if (islotStart > islotSegLim) + { + // Don't do anything fancy with stuff beyond the end of the segment. + return 0; + } + + DirCode dircMarker = kdircNeutral; // none so far + int nCurrLevel = nTopDirLevel; + int nMarkerLevel = nTopDirLevel; + //bool fHitMark = false; + DirCode dircOverride = kdircNeutral; + int islot = islotStart; + Assert(islot <= m_islotWritePos); + + while (true) + { + GrSlotState * pslot = m_vpslot[islot]; + DirCode dirc = pslot->DirProcessed(); + bool fIncludeLast = false; + int nSlotDirLevel; + if (dirc == kdircLRO || dirc == kdircLRE) // steps X1, X3 in the Unicode bidi algorithm + { + vdircMarkerStack.push_back(dircMarker); + vdircOverrideStack.push_back(dircOverride); + vnLevelStack.push_back(nCurrLevel); + dircMarker = dirc; + dircOverride = (dirc == kdircLRO) ? kdircL : kdircNeutral; + nSlotDirLevel = (nCurrLevel % 2) ? + nCurrLevel + 1 : nCurrLevel + 2; // next highest LTR level + nMarkerLevel = nSlotDirLevel; + + pslot->SetDirProcessed(dircMarker); + pslot->SetDirLevel(nMarkerLevel); + pslot->MarkDirProcessed(); + } + else if (dirc == kdircRLO || dirc == kdircRLE) // steps X2, X4 + { + vdircMarkerStack.push_back(dircMarker); + vdircOverrideStack.push_back(dircOverride); + vnLevelStack.push_back(nCurrLevel); + dircMarker = dirc; + dircOverride = (dirc == kdircRLO) ? kdircR : kdircNeutral; + nSlotDirLevel = (nCurrLevel % 2) ? + nCurrLevel + 2 : nCurrLevel + 1; // next highest RTL level + nMarkerLevel = nSlotDirLevel; + + pslot->SetDirProcessed(dircMarker); + pslot->SetDirLevel(nMarkerLevel); + pslot->MarkDirProcessed(); + } + else if (dirc == kdircPDF) + { + if (dircMarker == kdircNeutral) + pslot->SetDirProcessed((nCurrLevel % 2) ? kdircR : kdircL); + else + pslot->SetDirProcessed(RightToLeftDir(dircMarker) ? kdircPdfR : kdircPdfL); + pslot->SetDirLevel(nMarkerLevel); + pslot->MarkDirProcessed(); + + if (vnLevelStack.size()) + { + dircMarker = vdircMarkerStack.back(); + vdircMarkerStack.pop_back(); + dircOverride = vdircOverrideStack.back(); + vdircOverrideStack.pop_back(); + nMarkerLevel = vnLevelStack.back(); + vnLevelStack.pop_back(); + nSlotDirLevel = nMarkerLevel; + fIncludeLast = true; + } + else // ignore + nSlotDirLevel = nCurrLevel; + } + else + { + nSlotDirLevel = GetSlotDirLevel(pengst, islot, nTopDirLevel, nMarkerLevel, + dircMarker, dircOverride); + if (nSlotDirLevel == -1) + return -1; // not enough slots + } + + Assert(pengst->WhiteSpaceOnly() || nCurrLevel >= nTopDirLevel); + while (nSlotDirLevel > nCurrLevel) + { + vislotStartStack.push_back(islot); + nCurrLevel++; + } + // otherwise... + while (nTopDirLevel <= nCurrLevel && nSlotDirLevel < nCurrLevel) + { + if (vislotStartStack.size()) + { + int islotStartTmp = vislotStartStack.back(); + vislotStartStack.pop_back(); + vislotStarts.push_back(islotStartTmp); + vislotStops.push_back(islot - 1); // previous character was the end of the range + } + else + Assert(pengst->WhiteSpaceOnly()); // the space is higher than the segment itself + nCurrLevel--; + } + // In the case of white-space-only segments, the space may be bumped up to a level + // higher than the segment itself. + Assert(pengst->WhiteSpaceOnly() || vislotStartStack.size() + nTopDirLevel == (unsigned)nCurrLevel); + Assert(pengst->WhiteSpaceOnly() || vnLevelStack.size() == vdircMarkerStack.size()); + Assert(pengst->WhiteSpaceOnly() || vdircOverrideStack.size() == vdircMarkerStack.size()); + + if (nCurrLevel <= nTopDirLevel) + { + if (fIncludeLast) + { + // Include in the range to reverse the PDF or the char after the LRM/RLM. + // (Note: don't use a size_t below: we are decrementing below zero.) + for (int i = signed(vislotStops.size()) - 1; i >= 0 && vislotStops[i] == islot-1; i--) + { + vislotStops[i] = islot; + } + islot++; + } + break; // reached end of reversible range + } + + islot++; + if (islot >= m_islotWritePos) + { + if (m_fFullyWritten) + break; // end of input + else + return -1; // not enough slots + } + else if (islot >= islotSegLim) + { + break; // end of input + } + } + + // Reached the end of a reversable range. + while (vislotStartStack.size() > 0) + { + int islotStartTmp = vislotStartStack.back(); + vislotStartStack.pop_back(); + vislotStarts.push_back(islotStartTmp); + //vislotStops.push_back(min(islot, ReadPos() - 1)); + //vislotStops.push_back(min(islot, max(ReadPos() - 1, islotStartTmp))); + vislotStops.push_back(min(islot - 1, islotSegLim - 1)); + nCurrLevel--; + } + Assert(pengst->WhiteSpaceOnly() || nCurrLevel == nTopDirLevel); + Assert(vislotStarts.size() == vislotStops.size()); + + // The start- and stop-lists were generated in the order that we hit the stops, in other + // words, from inner to outer. Which is the order in which we need to do the reversals, too. + + return islot; +} + + +/*---------------------------------------------------------------------------------------------- + Return the direction level of the glyph at the given position, according to the + Unicode bidi algorithm. Return -1 if there aren't enough slots in the stream to + figure it out. + + ???? How should this handle the reprocessing sub-stream???? + + @param ptman + @param islot - slot for which information is requested + @param nOuterLevel - 0 = left-to-right, 1 = right-to-left + @param nCurrLevel + @param dircMarker - most recent override or embedding marker, if any + (for interpreting PDF codes) + @param dircOverride - override imposed by LRO or RLO +----------------------------------------------------------------------------------------------*/ +int GrSlotStream::GetSlotDirLevel(EngineState * pengst, int islot, + int nOuterLevel, int nCurrLevel, DirCode dircMarker, DirCode dircOverride) +{ +// Assert(m_psstrmReprocess == NULL); + + GrSlotState * pslot = m_vpslot[islot]; + + int nDirLevel = pslot->DirLevel(); + if (nDirLevel > -1) + // already figured out + return nDirLevel; + + if (pengst->WhiteSpaceOnly()) + { + // White-space-only segments should not have any reordering. + nDirLevel = pengst->ParaRightToLeft(); + pslot->SetDirLevel(nDirLevel); + pslot->MarkDirProcessed(); + return nDirLevel; + } + + DirCode dirc = pslot->DirProcessed(); + + if (!pslot->DirHasBeenProcessed() && (WeakDir(dirc) || NeutralDir(dirc)) ) + { + // Resolve weak and neutral types; process an entire run of weak types at once, + // in several passes. + + int islotWeakRunLim = islot + 1; + while (true) + { + if (islotWeakRunLim >= m_islotWritePos) + { + if (!m_fFullyWritten) + return -1; // get more slots + else + break; + } + else if (m_islotSegLim > -1 && islotWeakRunLim >= SegLimIfKnown()) + { + break; + } + if (StrongDir(m_vpslot[islotWeakRunLim]->DirProcessed())) + // ignore the line-break; we need the next strong dir after that + //// && !m_vpslot[islotWeakRunLim]->IsFinalLineBreak(ptman->LBGlyphID())) + { + break; + } + if (m_vpslot[islotWeakRunLim]->DirProcessed() == kdircPDF && + dircMarker != kdircUnknown) + { + // A valid PDF is a strong code. TODO: replace kdircPDF with kdircPdfL/R + break; + } + + islotWeakRunLim++; + } + + int islotLp; + + // X6. Handle directional overrides: LRO, RLO. + if (dircOverride != kdircNeutral) + { + for (islotLp = islot; islotLp < islotWeakRunLim; islotLp++) + { + m_vpslot[islotLp]->SetDirProcessed(dircOverride); + m_vpslot[islotLp]->MarkDirProcessed(); + } + goto LSetDir; + } + + DirCode dircLp; + //DirCode dircTmp; + + // W1. Non-spacing marks get the type of the previous slot. + for (islotLp = islot; islotLp < islotWeakRunLim; islotLp++) + { + Assert(!m_vpslot[islotLp]->DirHasBeenProcessed()); + + if (m_vpslot[islotLp]->DirProcessed() == kdircNSM) + { +#ifdef _DEBUG + if (islotLp <= 0) + { + Warn("Pathological case in bidi algorithm"); + } +#endif // _DEBUG + dircLp = AdjacentNonBndNeutralCode(pengst, islotLp - 1, -1, dircMarker); + + m_vpslot[islotLp]->SetDirProcessed(dircLp); + } + } + + // W2. European numbers are changed to Arabic numbers if the previous strong type + // was an Arabic letter. + DirCode dircPrevStrong = AdjacentStrongCode(pengst, islot - 1, -1, dircMarker); + if (dircPrevStrong == kdircRArab) + { + for (islotLp = islot; islotLp < islotWeakRunLim; islotLp++) + { + dircLp = m_vpslot[islotLp]->DirProcessed(); + if (dircLp == kdircEuroNum) + m_vpslot[islotLp]->SetDirProcessed(kdircArabNum); + } + } + + // W4. A single European separator between two Latin numbers changes to a Latin number. + // A single common separator between two numbers of the same type changes to that + // type. + for (islotLp = islot; islotLp < islotWeakRunLim; islotLp++) + { + dircLp = m_vpslot[islotLp]->DirProcessed(); + if ((dircLp == kdircEuroSep || dircLp == kdircComSep) && + islotLp + 1 < m_islotWritePos) // don't test last slot in stream + { + DirCode dircPrev = AdjacentNonBndNeutralCode(pengst, islotLp - 1, -1, dircMarker); + DirCode dircNext = AdjacentNonBndNeutralCode(pengst, islotLp + 1, 1, dircMarker); + if (dircPrev == dircNext) + { + if (dircLp == kdircEuroSep && dircPrev == kdircEuroNum) + { + m_vpslot[islotLp]->SetDirProcessed(kdircEuroNum); + } + else if (dircLp == kdircComSep && + (dircPrev == kdircEuroNum || dircPrev == kdircArabNum)) + { + m_vpslot[islotLp]->SetDirProcessed(dircPrev); + } + } + } + } + + // W5, W6. A sequence of European number terminators adjacent to Latin numbers changes + // to Latin numbers. + // This appears to be an ambiguity in the official algorithm: do we search backward + // first, or forward? For our purposes, it is easier to search backward first. + for (islotLp = islot; islotLp < islotWeakRunLim; islotLp++) + { + dircLp = m_vpslot[islotLp]->DirProcessed(); + if (dircLp == kdircEuroTerm || dircLp == kdircBndNeutral) + { + if (TerminatorSequence(pengst, islotLp - 1, -1, dircMarker) == kdircEuroNum) + dircLp = kdircEuroNum; + else + { + if (TerminatorSequence(pengst, islotLp + 1, 1, dircMarker) == kdircEuroNum) + dircLp = kdircEuroNum; + // else could possibly be unknown if we are at the end of the stream + } + } + + // W6. Separators and terminators change to neutral. (Don't change + // boundary neutrals at this point, because that would confuse step Pre-L1.) + if (dircLp == kdircEuroSep || dircLp == kdircEuroTerm || dircLp == kdircComSep) + { + dircLp = kdircNeutral; + } + m_vpslot[islotLp]->SetDirProcessed(dircLp); + } + + // W7. European numbers are changed to plain left-to-right if the previous strong type + // was left-to-right. + dircPrevStrong = AdjacentStrongCode(pengst, islot - 1, -1, dircMarker); + if (dircPrevStrong == kdircL) + { + for (islotLp = islot; islotLp < islotWeakRunLim; islotLp++) + { + dircLp = (m_vpslot[islotLp]->DirProcessed()); + if (dircLp == kdircEuroNum) + m_vpslot[islotLp]->SetDirProcessed(kdircL); + } + } + + // Pre-L1. Make a list of all the trailing whitespace characters that need to take + // on the direction of the final line break (ie, the top direction). We can't actually + // change them yet, because that would confuse the loop below. But we have to + // record them now because they might get changed in the loop below. + std::vector vislotTrailingWS; + int islotFinalLB = -1; + for (islotLp = islotWeakRunLim; islotLp-- > islot; ) + { + if (m_vpslot[islotLp]->IsFinalLineBreak(pengst->TableManager()->LBGlyphID())) + { + islotFinalLB = islotLp; + for (int islotLp2 = islotLp; islotLp2-- > islot; ) + { + dircLp = m_vpslot[islotLp2]->DirProcessed(); + if (dircLp == kdircWhiteSpace || dircLp == kdircBndNeutral) + vislotTrailingWS.push_back(islotLp2); + else + break; // hit something other than whitespace or neutral + } + break; + } + } + + // N1. A sequence of neutrals takes the direction of the strong surrounding text if + // the text on both sides has the same direction. Latin and Arabic numbers are treated + // as if they are right-to-left. + // (If they are not the same, leave the type as neutral.) + for (islotLp = islot; islotLp < islotWeakRunLim; islotLp++) + { + dircLp = m_vpslot[islotLp]->DirProcessed(); + + // Change Boundary Neutrals to plain neutrals (must happen after Pre-L1). + if (dircLp == kdircBndNeutral) + { + m_vpslot[islotLp]->SetDirProcessed(kdircNeutral); + dircLp = kdircNeutral; + } + + if (NeutralDir(dircLp)) + { + // First, look for either a strong code or a number. If we get at least + // one strong code and a number with the same direction, use that strong + // code. + DirCode dircPrev = AdjacentStrongCode(pengst, islotLp - 1, -1, dircMarker, true); + DirCode dircNext = AdjacentStrongCode(pengst, islotLp + 1, 1, dircMarker, true); + + if (dircNext == kdircUnknown) + return -1; + + if (dircPrev == kdircUnknown) + dircPrev = dircNext; + + DirCode dircResult = kdircUnknown; + if (dircNext == kdircNeutral) + {} + else if (RightToLeftDir(dircPrev) == RightToLeftDir(dircNext) && + (StrongDir(dircNext) || StrongDir(dircPrev))) + { + // Got a strong matching direction. + dircResult = (StrongDir(dircPrev)) ? dircPrev : dircNext; + } + else if (dircNext == kdircPdfL || dircNext == kdircPdfR) + { + // A following PDF flag wins, because it represents the edge of a run. + dircResult = dircNext; + } + else if (StrongDir(dircNext) && StrongDir(dircPrev)) + { // We must have text in different directions. + } + else + { + // Try again, insisting on strong codes, no numbers. + if (!StrongDir(dircPrev)) + dircPrev = AdjacentStrongCode(pengst, islotLp - 1, -1, dircMarker, false); + if (!StrongDir(dircNext)) + dircNext = AdjacentStrongCode(pengst, islotLp + 1, 1, dircMarker, false); + if (dircPrev == kdircUnknown) + dircPrev = dircNext; + + if (RightToLeftDir(dircPrev) == RightToLeftDir(dircNext) && + (StrongDir(dircNext) || StrongDir(dircPrev))) + { + // Got a strong matching direction. + dircResult = (StrongDir(dircPrev)) ? dircPrev : dircNext; + } + } + + if (dircResult != kdircUnknown) + { + dircResult = (RightToLeftDir(dircResult)) ? kdircR : kdircL; + m_vpslot[islotLp]->SetDirProcessed(dircResult); + } + // else leave as neutral + } + } + + // L1. Now change trailing neutrals recorded above to the directionality of + // the immediately following line-break, if any. + if (islotFinalLB != -1) + { + DirCode dircLB = m_vpslot[islotFinalLB]->DirProcessed(); + dircLB = (dircLB == kdircLlb) ? kdircL : kdircR; + for (int iislot = 0; iislot < signed(vislotTrailingWS.size()); iislot++) + { + int islotTmp = vislotTrailingWS[iislot]; + m_vpslot[islotTmp]->SetDirProcessed(dircLB); + } + } + + // Mark all the slots processed. + for (islotLp = islot; islotLp < islotWeakRunLim; islotLp++) + m_vpslot[islotLp]->MarkDirProcessed(); + } + else + m_vpslot[islot]->MarkDirProcessed(); + +LSetDir: + + // Final resolution. + + dirc = pslot->DirProcessed(); + + if (dirc != kdircLlb && dirc != kdircRlb && dircOverride != kdircNeutral) + { + // Enforce whatever is imposed by the override. + m_vpslot[islot]->SetDirProcessed(dircOverride); + nDirLevel = nCurrLevel; + } + else if ((nCurrLevel % 2) == 0) // current level is even (left-to-right) + { + switch (dirc) + { + case kdircNeutral: + case kdircWhiteSpace: + nDirLevel = nCurrLevel; + break; + + case kdircL: + nDirLevel = nCurrLevel; + break; + + case kdircLlb: + case kdircRlb: // all line-breaks have the direction of the paragraph + nDirLevel = nOuterLevel; + break; + + case kdircR: + case kdircRArab: + nDirLevel = nCurrLevel + 1; + break; + + case kdircEuroNum: + case kdircArabNum: + nDirLevel = nCurrLevel + 2; + break; + + default: + Assert(false); + nDirLevel = nCurrLevel; + } + } + else // current level is odd (right-to-left) + { + switch (dirc) + { + case kdircNeutral: + case kdircWhiteSpace: + nDirLevel = nCurrLevel; + break; + + case kdircR: + //case kdircRlb: + case kdircRArab: + nDirLevel = nCurrLevel; + break; + + case kdircL: + //case kdircLlb: + case kdircEuroNum: + case kdircArabNum: + nDirLevel = nCurrLevel + 1; + break; + + case kdircLlb: + case kdircRlb: // all line-breaks have the direction of the paragraph + nDirLevel = nOuterLevel; + break; + + default: + Assert(false); + nDirLevel = nCurrLevel; + } + } + pslot->SetDirLevel(nDirLevel); + + return nDirLevel; +} + +/*---------------------------------------------------------------------------------------------- + Return the next or previous strong code, kdircNeutral if we don't find one, + or kdircUnknown if we need more slots to process. + + @param islot - index of slot of interest + @param nInc - +1 to search forward, -1 to search backward + @param fNumbersAreStrong - true if we want to treat numbers as having strong + directionality + @param dircPDF - how to interpret PDF codes (from corresponding RLO, etc) +----------------------------------------------------------------------------------------------*/ +DirCode GrSlotStream::AdjacentStrongCode(EngineState * pengst, int islot, int nInc, + DirCode dircPDF, bool fNumbersAreStrong) +{ + if (islot < 0) + return pengst->InitialStrongDir(); + + else if (islot >= m_islotWritePos) + { + if (m_fFullyWritten || (m_islotSegLim > -1 && islot >= SegLimIfKnown())) + return kdircNeutral; + else + return kdircUnknown; + } + + DirCode dirc = m_vpslot[islot]->DirProcessed(); + + if (dirc == kdircPDF && StrongDir(dircPDF)) + return (RightToLeftDir(dircPDF)) ? kdircPdfR : kdircPdfL; + if (StrongDir(dirc)) + return dirc; + if (fNumbersAreStrong && (dirc == kdircEuroNum || dirc == kdircArabNum)) + return dirc; + + return AdjacentStrongCode(pengst, islot + nInc, nInc, dircPDF, fNumbersAreStrong); +} + +/*---------------------------------------------------------------------------------------------- + Return kdircEuroNum if there is a terminator sequence starting or ending with a + European number. Return kdircUnknown if we need more slots to process. + Return kdircNeutral otherwise. + + @param islot - index of slot of interest + @param nInc - +1 to search forward, -1 to search backward + @param dircPDF - how to interpret PDF codes (from corresponding RLO, etc) +----------------------------------------------------------------------------------------------*/ +DirCode GrSlotStream::TerminatorSequence(EngineState * pengst, int islot, int nInc, + DirCode dircPDF) +{ + if (islot < 0) + return pengst->InitialTermDir(); + + else if (islot >= m_islotWritePos) + { + if (m_fFullyWritten) + return kdircNeutral; + else + return kdircUnknown; + } + + DirCode dirc = m_vpslot[islot]->DirProcessed(); + + if (dirc == kdircPDF) + return (RightToLeftDir(dircPDF)) ? kdircPdfR : kdircPdfL; + else if (dirc == kdircEuroNum) + // number found at end of terminator sequence + return kdircEuroNum; + else if (dirc == kdircEuroTerm) + // yes, this slot is a terminator; are there more? + return TerminatorSequence(pengst, islot + nInc, nInc, dircPDF); + else if (dirc == kdircLlb || dirc == kdircRlb) + // line-break slot--ignore and keep going + return TerminatorSequence(pengst, islot + nInc, nInc, dircPDF); + else if (dirc == kdircBndNeutral) + // boundary neutral--ignore and keep going + return TerminatorSequence(pengst, islot + nInc, nInc, dircPDF); + else + // no number found + return kdircNeutral; +} + +/*---------------------------------------------------------------------------------------------- + Return the previous code that is not a Boundary Neutral. Return Other Neutral if there + is no such. + + @param islot - index of slot of interest + @param nInc - +1 to search forward, -1 to search backward + @param dircPDF - how to interpret PDF codes (from corresponding RLO, etc) +----------------------------------------------------------------------------------------------*/ +DirCode GrSlotStream::AdjacentNonBndNeutralCode(EngineState * pengst, int islot, int nInc, + DirCode dircPDF) +{ + Assert(islot < m_islotWritePos); + if (islot < 0) + return kdircNeutral; // or should we use: ptman->InitialStrongDir() ?? + + else if (islot >= m_islotWritePos) + { + if (m_fFullyWritten) + return kdircNeutral; + else + return kdircUnknown; + } + + DirCode dirc = m_vpslot[islot]->DirProcessed(); + + if (dirc == kdircBndNeutral) + return AdjacentNonBndNeutralCode(pengst, islot + nInc, nInc, dircPDF); + else if (dirc == kdircPDF) + return (RightToLeftDir(dircPDF)) ? kdircPdfR : kdircPdfL; + else + return dirc; +} + +/*---------------------------------------------------------------------------------------------- + Directionality type functions. +----------------------------------------------------------------------------------------------*/ +bool StrongDir(DirCode dirc) +{ + return (dirc == kdircL || dirc == kdircR || dirc == kdircRArab || + dirc == kdircLRO || dirc == kdircRLO || dirc == kdircLRE || dirc == kdircRLE || + dirc == kdircPdfL || dirc == kdircPdfR); +} + +bool WeakDir(DirCode dirc) +{ + return (dirc == kdircEuroNum || dirc == kdircEuroSep || + dirc == kdircEuroTerm || dirc == kdircArabNum || + dirc == kdircComSep || dirc == kdircBndNeutral || dirc == kdircNSM); +} + +bool NeutralDir(DirCode dirc) +{ + return (dirc == kdircWhiteSpace || dirc == kdircNeutral); +} + +/*---------------------------------------------------------------------------------------------- + Special values used by the bidi algorithm. +----------------------------------------------------------------------------------------------*/ +bool BidiCode(int nUnicode) +{ + switch (nUnicode) + { + case knLRM: + case knRLM: + case knLRO: + case knRLO: + case knLRE: + case knRLE: + case knPDF: + return true; + default: + break; + } + return false; +} + +/*---------------------------------------------------------------------------------------------- + Return true if the directionality should be treated as right-to-left. + Used for the step of resolving neutrals (N1). +----------------------------------------------------------------------------------------------*/ +bool RightToLeftDir(DirCode dirc) +{ + switch (dirc) + { + case kdircL: + case kdircLRO: + case kdircLRE: + case kdircPdfL: + case kdircLlb: + return false; + + case kdircR: + case kdircRArab: + case kdircArabNum: + case kdircEuroNum: + case kdircRLO: + case kdircRLE: + case kdircPdfR: + case kdircRlb: + return true; + + case kdircNeutral: + case kdircWhiteSpace: + case kdircComSep: + case kdircEuroSep: + case kdircEuroTerm: + case kdircBndNeutral: + case kdircNSM: + case kdircPDF: + return false; + + default: + Assert(false); + return false; + } +} + +/*---------------------------------------------------------------------------------------------- + Copy a slot from prevStream, incrementing the positions. +----------------------------------------------------------------------------------------------*/ +void GrSlotStream::CopyOneSlotFrom(GrSlotStream * psstrmPrev) +{ +#ifdef _DEBUG + gid16 chw; chw = psstrmPrev->Peek()->GlyphID(); +#endif + + // If we are exactly at the segment boundary, pass the information on to this stream. + if (psstrmPrev->AtSegMin()) + SetSegMinToWritePos(); + if (psstrmPrev->AtSegLim()) + SetSegLimToWritePos(); + + NextPut(psstrmPrev->NextGet()); + + AssertValid(); + psstrmPrev->AssertValid(); +} + +/*---------------------------------------------------------------------------------------------- + Copy one slot from the input stream to the recipient, which is the output stream. + Used when reversing ranges of glyphs; caller is responsible for adjusting the read- + and write-positions of the streams. + + REVIEW: How should this handle the reprocessing sub-stream? Currently this is not a problem + because this function is only used by the bidi pass, which never has intra-pass + reprocessing. +----------------------------------------------------------------------------------------------*/ +void GrSlotStream::SimpleCopyFrom(GrSlotStream * psstrmI, int islotInput, int islotOutput) +{ + if (signed(m_vpslot.size()) < islotOutput + 1) + { + m_vpslot.resize(islotOutput + 1); + m_vislotPrevChunkMap.resize(islotOutput + 1); + m_vislotNextChunkMap.resize(islotOutput + 1); + } + + m_vpslot[islotOutput] = psstrmI->m_vpslot[islotInput]; + m_vislotPrevChunkMap[islotOutput] = -1; + m_vislotNextChunkMap[islotOutput] = -1; + + Assert(m_fUsedByPosPass); + if (m_fUsedByPosPass && GotIndexOffset()) + m_vpslot[islotOutput]->SetPosPassIndex(islotOutput - m_cslotPreSeg, m_fInputToPosPass1); + +} + +/*---------------------------------------------------------------------------------------------- + Return true if there is physical space to add more glyphs, false if the positioning + has caused them to use all the alotted space. Recipient is assumed to be output + stream from the final pass. + + @param ptman - table manager, for handling the positioning + @param pgg - graphics device + @param xsSpaceAllotted - how much space is available + @param fWidthIsCharCount - kludge for test procedures + @param fIgnoreTrailingWS - true if we are ignoring trailing white-space (currently + always true) + @param twsh - how the segment is handling trailing white-space + @param pxsWidth - return width of stuff so far +----------------------------------------------------------------------------------------------*/ +bool GrSlotStream::MoreSpace(GrTableManager * ptman, + float xsSpaceAllotted, bool fWidthIsCharCount, + bool fIgnoreTrailingWS, TrWsHandling twsh, + float * pxsWidth) +{ + Assert(ptman->NumberOfPasses() - 1 == m_ipass); + + if (fWidthIsCharCount) + { + // Used in test procedures + *pxsWidth = (float)m_islotWritePos; + return (m_islotWritePos < xsSpaceAllotted); + } + else + { + *pxsWidth = -1; + if (!GotIndexOffset()) + return true; + if (WritePos() <= IndexOffset()) + return true; + int dislot = MaxClusterSlot(WritePos()); + if (dislot == kNegInfinity || dislot > 0) + // We're in the middle of processing a cluster--we have to keep processing, + // so for now assume there is more space. + return true; + + float xsWidth, xsVisWidth; + ptman->CalcPositionsUpTo(m_ipass, NULL, false, &xsWidth, &xsVisWidth); + + *pxsWidth = (fIgnoreTrailingWS || twsh == ktwshOnlyWs) ? xsVisWidth : xsWidth; + return (*pxsWidth < xsSpaceAllotted); + } +} + +/*---------------------------------------------------------------------------------------------- + Work backwards from the prevLineBreak position (or if none, the readPos) to find the + previous line-break of the given weight or less. Return the position of the inserted + line-break slot, or -1 if no appropriate break point was found. Recipient should be + the output of the final line break pass, or if none, the output of the + glyph-generation pass. + + @param ptman - table manager, for supplying new slots + @param islotPrevBreak - position of previous inserted line break + @param fInsertedLB - did we actually insert a line-break glyph before? + @param islotStartTry - where to start looking, or -1 for the end of the stream + @param lb - (max) break weight to allow + @param twsh - how we are handling trailing white-space + @param islotMin - first slot that is officially part of the segment (after initial LB) + @param plbNextToTry - the best we found +----------------------------------------------------------------------------------------------*/ +int GrSlotStream::InsertLineBreak(GrTableManager * ptman, + int islotPrevBreak, bool fInsertedLB, int islotStartTry, + LineBrk lb, TrWsHandling twsh, int islotMin, + LineBrk * plbNextToTry) +{ + EngineState * pengst = ptman->State(); + + Assert(!fInsertedLB || islotPrevBreak > -1); + + int ichwSegOffset; + int islot; + LineBrk lbFound; + if (!FindSegmentEnd(ptman, islotStartTry, lb, twsh, islotMin, + &islot, &ichwSegOffset, &lbFound, plbNextToTry)) + { + return -1; // didn't find a legal break + } + + GrSlotState * pslotCopyFeat = pengst->AnAdjacentSlot(m_ipass, islot + 1); + Assert(pslotCopyFeat); + + if (islotPrevBreak > -1 && fInsertedLB) + { + //GrSlotState * pslotOld = m_vpslot[islotPrevBreak]; + + m_vpslot.erase(m_vpslot.begin() + islotPrevBreak); + m_vislotPrevChunkMap.erase(m_vislotPrevChunkMap.begin() + islotPrevBreak); + m_vislotNextChunkMap.erase(m_vislotNextChunkMap.begin() + islotPrevBreak); + AdjustPrevStreamNextChunkMap(ptman, islotPrevBreak + 1, -1); + } + else + { + m_islotReadPos++; + m_islotWritePos++; + } + + GrSlotState * pslotNew; + pengst->NewSlot(ptman->LBGlyphID(), pslotCopyFeat, 0, ichwSegOffset, &pslotNew); + + pslotNew->SetSpecialSlotFlag(kspslLbFinal); + pslotNew->SetBreakWeight(lbFound); + pslotNew->SetDirectionality(ptman->RightToLeft() ? kdircRlb : kdircLlb); + + int islotLB = islot + 1; + m_vpslot.insert(m_vpslot.begin() + islotLB, pslotNew); + // Inserting -1 makes it part of a chunk with the previous char/glyph + m_vislotPrevChunkMap.insert(m_vislotPrevChunkMap.begin() + islotLB, -1); + m_vislotNextChunkMap.insert(m_vislotNextChunkMap.begin() + islotLB, -1); + AdjustPrevStreamNextChunkMap(ptman, islotLB, 1); + // We don't need to adjust the following stream because we are going to unwind it anyway. + + if (m_fUsedByPosPass && GotIndexOffset()) + { + pslotNew->SetPosPassIndex(islot - m_cslotPreSeg, m_fInputToPosPass1); + // Increment the stream index for the following slots. + for (int islotTmp = islotLB; + islotTmp < ((islotPrevBreak == -1) ? m_islotWritePos : islotPrevBreak + 1); + islotTmp++) + { + SlotAt(islotTmp)->IncPosPassIndex(); + } + } + + m_islotSegLim = islotLB + 1; // after the line-break glyph + + return islotLB; +} + +/*---------------------------------------------------------------------------------------------- + Make a segment break that does not correspond to a line break; ie, don't insert + a line-break glyph. + + Work backwards from the prevLineBreak position (or if none, the readPos) to find the + previous line-break of the given weight or less. Return the position of the final slot + in the segment, or -1 if no appropriate break point was found. Recipient should be + the output of the final line break pass, if any, or the glyph-generation pass. + + @param ptman - table manager, for supplying new slots + @param islotPrevBreak - position of previous inserted line break + @param fInsertedLB - did we actually insert a line-break glyph previously; currently + ignored + @param islotStartTry - where to start looking, or -1 for the end of the stream + @param lb - (max) break weight to allow + @param twsh - how we are handling trailing white-space + @param islotMin - first slot that is officially part of the segment (after initial LB) +----------------------------------------------------------------------------------------------*/ +int GrSlotStream::MakeSegmentBreak(GrTableManager * ptman, + int /*islotPrevBreak*/, bool /*fInsertedLB*/, int islotStartTry, + LineBrk lb, TrWsHandling twsh, int islotMin, + LineBrk * plbNextToTry) +{ + int ichwSegOffset; + int islot; + LineBrk lbFound; + if (!FindSegmentEnd(ptman, islotStartTry, lb, twsh, islotMin, + &islot, &ichwSegOffset, &lbFound, plbNextToTry)) + { + return -1; // didn't find a legal break + } + + // Review: do we need to delete any previously-inserted line-break glyph from the stream? + // Doesn't seem like this has been a problem so far. + + m_islotSegLim = islot + 1; // after the final glyph of this segment + + return islot; +} + +/*---------------------------------------------------------------------------------------------- + Work backwards from the prev line break position (or if none, the readPos) to find an + earlier line-break of the given weight or less. + Recipient should be the output of the final line break pass, if any, or the output + of the glyph-generation pass. + + @param ptman - table manager, for supplying new slots + @param islotStartTry - where to start looking, or -1 for the end of the stream + @param lb - (max) break weight to allow + @param twsh - how we are handling trailing white-space + @param islotMin - first slot that is officially part of the segment (after initial LB) + @param pislot - slot AFTER which the break will go (not the lim of the segment) + @param pichwSegOffset - offset relative to the segment + @param plbFound - weight of break to be created + @param plbNextToTry - best found, in case we didn't find one at the requested level + + @return Whether or not an appropriate break was found. +----------------------------------------------------------------------------------------------*/ +bool GrSlotStream::FindSegmentEnd(GrTableManager * ptman, + int islotStartTry, LineBrk lb, TrWsHandling twsh, int islotMin, + int * pislot, int * pichwSegOffset, LineBrk * plbFound, + LineBrk * plbNextToTry) +{ + Assert(AssertValid()); + Assert(m_ipass == ptman->NumberOfLbPasses()); + + if (islotStartTry < 0) + return false; + + *pislot = islotStartTry; + GrSlotState * pslot = m_vpslot[*pislot]; + *plbNextToTry = klbClipBreak; // worst break + + ptman->State()->SetRemovedTrWhiteSpace(false); + + while (twsh != ktwshOnlyWs) // in white-space only case, ignore lb values + { + if (*pislot < islotMin) + { + return false; + } + *plbFound = LineBrk(pslot->m_lb); + // Sanity check + if (abs(*plbFound) > klbClipBreak) + { +// Assert(false); + Warn("Unusually large breakweight"); + *plbFound = (LineBrk)((*plbFound < 0) ? -klbClipBreak : klbClipBreak); + } + *plbNextToTry = (LineBrk)(min(static_cast(*plbNextToTry), abs(*plbFound))); + *pichwSegOffset = pslot->SegOffset(); + + if (int(*plbFound) >= 0 && *plbFound <= lb) + break; + + --(*pislot); + if (*pislot < 0) + { + return false; + } + pslot = m_vpslot[*pislot]; + + if (*pislot == 0 && pslot->IsInitialLineBreak(ptman->LBGlyphID())) { + // Can't break after the initial LB; that would produce an empty segment. + return false; + } + + if (int(*plbFound) <= 0 && ((int)*plbFound * -1) <= lb) + { + *plbFound = LineBrk(int(*plbFound) * -1); + break; + } + } + + // Found a good break. + + if (twsh == ktwshOnlyWs) + { + // white-space-only segment + while (pslot->Directionality() != kdircWhiteSpace) + { + --(*pislot); + if (*pislot < 0) + return false; + pslot = m_vpslot[*pislot]; + *pichwSegOffset = pslot->SegOffset(); + } + } + else if (twsh == ktwshNoWs) + { + // no trailing white-space: remove it + while (pslot->Directionality() == kdircWhiteSpace) + { + --(*pislot); + if (*pislot < 0) + return false; + pslot = m_vpslot[*pislot]; + *pichwSegOffset = pslot->SegOffset(); + ptman->State()->SetRemovedTrWhiteSpace(true); + } + } + + return true; +} + +/*---------------------------------------------------------------------------------------------- + Return true if the stream (which should be the output of the last linebreak pass) has + a better break at some earlier point than the one we found. + + @param islotBreak - position of inserted or final break point in stream, or index + of last valid slot +----------------------------------------------------------------------------------------------*/ +bool GrSlotStream::HasEarlierBetterBreak(int islotBreak, LineBrk lbFound, gid16 chwLB) +{ + Assert(AssertValid()); + + int islot = islotBreak; + if (SlotAt(islot)->IsFinalLineBreak(chwLB)) + islot--; + + if (lbFound == klbNoBreak) + lbFound = (LineBrk)SlotAt(islot)->BreakWeight(); + + while (islot >= 0) + { + if (SlotAt(islot)->IsInitialLineBreak(chwLB)) + return false; + if (SlotAt(islot)->BreakWeight() < lbFound) + return true; + islot--; + } + + return false; +} + +/*---------------------------------------------------------------------------------------------- + Make sure the stream contains a local instance of the given slot, not a copy used by + a previous pass. +----------------------------------------------------------------------------------------------*/ +void GrSlotStream::EnsureLocalCopy(GrTableManager * ptman, GrSlotState * pslot, + GrSlotStream * psstrmIn) +{ + //Assert(m_vpslot[islot + m_cslotPreSeg] == pslot); + Assert(pslot->PassModified() <= m_ipass); + + if (pslot->PassModified() < m_ipass) + { + int islot = pslot->PosPassIndex(); + Assert(SlotAtPosPassIndex(islot) == pslot); + GrSlotState * pslotNew; + ptman->State()->NewSlotCopy(pslot, m_ipass, &pslotNew); + m_vpslot[islot + m_cslotPreSeg] = pslotNew; + + psstrmIn->ReplaceSlotInReprocessBuffer(pslot, pslotNew); + } +} + +/*---------------------------------------------------------------------------------------------- + A slot has been replace within the coorsponding output stream. Make sure the reprocess + buffer of this stream constains the same slot. +----------------------------------------------------------------------------------------------*/ +void GrSlotStream::ReplaceSlotInReprocessBuffer(GrSlotState * pslotOld, GrSlotState * pslotNew) +{ + if (m_islotReprocPos > -1) + { + for (size_t islot = 0; islot < m_vpslotReproc.size(); islot++) + { + if (m_vpslotReproc[islot] == pslotOld) + m_vpslotReproc[islot] = pslotNew; + } + } +} + +/*---------------------------------------------------------------------------------------------- + Inserting a line break can potentially alter the directionality of preceeding glyphs. + Zap the information that has been calculated. + + @param islotLB - index of the inserted final line-break glyph +----------------------------------------------------------------------------------------------*/ +void GrSlotStream::ZapCalculatedDirLevels(int islotLB) +{ + int islot; + for (islot = m_islotWritePos; islot-- > islotLB; ) + m_vpslot[islot]->ZapDirLevel(); + + for (islot = islotLB; islot-- > 0; ) + { + if (StrongDir(m_vpslot[islot]->Directionality())) + // We've found a strong direction code; don't need to zap beyond this point. + return; + + m_vpslot[islot]->ZapDirLevel(); + } +} + +/*---------------------------------------------------------------------------------------------- + Return the slot index of the last slot in the cluster for the just-processed chunk, + relative to the last slot in the chunk. + + Return kNegInfinity if there are not enough slots in the stream to tell. This can + happen while we are in the middle of processing a cluster. +----------------------------------------------------------------------------------------------*/ +int GrSlotStream::MaxClusterSlot(int islotChunkMin, int islotChunkLim) +{ + Assert(islotChunkLim > islotChunkMin); + + if (!m_fUsedByPosPass) + return 0; // no clusters yet + + int islotRet = SlotAt(islotChunkLim - 1)->PosPassIndex(); + + for (int islot = islotChunkMin; islot < islotChunkLim; islot++) + { + GrSlotState * pslot = SlotAt(islot); + + if (m_cslotPreSeg == -1) + return kNegInfinity; + if (!HasSlotAtPosPassIndex(pslot->AttachRootPosPassIndex())) + return kNegInfinity; + + GrSlotState * pslotBase = pslot->Base(this); + + int dislotOffset = pslotBase->LastLeafOffset(this); + if (dislotOffset == kNegInfinity) + return kNegInfinity; + islotRet = max(islotRet, pslotBase->PosPassIndex() + dislotOffset); + } + + // Make it relative to the last slot in the chunk. + islotRet -= SlotAt(islotChunkLim - 1)->PosPassIndex(); + + return islotRet; +} + +/*---------------------------------------------------------------------------------------------- + Return the break weight of the given slot, which should be a line-break. + OBSOLETE?? +----------------------------------------------------------------------------------------------*/ +#ifdef NDEBUG +LineBrk GrSlotStream::BreakWeightAt(gid16 /*chwLB*/, int islot) +#else +LineBrk GrSlotStream::BreakWeightAt(gid16 chwLB, int islot) +#endif +{ + GrSlotState * pslot = GetSlotAt(islot); + Assert(pslot->IsLineBreak(chwLB)); + return LineBrk(pslot->m_lb); +} + +/*---------------------------------------------------------------------------------------------- + Append an initial or final line break of the given weight to the stream. + + @param ptman - table manager, for generating new slot + @param lb - break weight for the line-break glyph + @param dirc - directionality code for the line-break glyph + @param islotLB - where to insert, or -1 if at the end + @param fInitial - is this an initial line-break, or a final break? + @param ichwSegOffset - offset relative to the beginning of the segment +----------------------------------------------------------------------------------------------*/ +void GrSlotStream::AppendLineBreak(GrTableManager * ptman, GrCharStream * pchstrm, + LineBrk lb, DirCode dirc, int islotLB, bool fInitial, int ichwSegOffset) +{ + EngineState * pengst = ptman->State(); + + Assert(AssertValid()); +/// Assert(m_islotReprocPos == -1); + + Assert(islotLB == -1 || fInitial); + if (islotLB == -1) + islotLB = m_islotWritePos; + +// int islot = m_islotWritePos; + + GrSlotState * pslotCopyFeat = pengst->AnAdjacentSlot(m_ipass, islotLB); + GrSlotState * pslotNew; + if (pslotCopyFeat) + pengst->NewSlot(ptman->LBGlyphID(), pslotCopyFeat, 0, ichwSegOffset, &pslotNew); + else + { + GrFeatureValues fval; + pchstrm->CurrentFeatures(ptman, &fval); + pengst->NewSlot(ptman->LBGlyphID(), fval, 0, ichwSegOffset, -1, &pslotNew); + } + + pslotNew->m_lb = sdata8(lb); + pslotNew->SetSpecialSlotFlag(fInitial ? kspslLbInitial : kspslLbFinal); + //pslotNew->m_fInitialLB = fInitial; // TODO: remove + pslotNew->SetDirectionality(dirc); + + m_vpslot.insert(m_vpslot.begin() + islotLB, pslotNew); + // Make it part of a chunk with previous char/glyph + m_vislotPrevChunkMap.insert(m_vislotPrevChunkMap.begin() + islotLB, -1); + m_vislotNextChunkMap.insert(m_vislotNextChunkMap.begin() + islotLB, -1); + if (m_ipass > 0) + AdjustPrevStreamNextChunkMap(ptman, islotLB, 1); + + m_islotWritePos++; + + if (m_fUsedByPosPass && GotIndexOffset()) + { + pslotNew->SetPosPassIndex(islotLB - m_cslotPreSeg, m_fInputToPosPass1); + // Increment the stream index for the following slots. + for (int islotTmp = islotLB + 1; islotTmp < m_islotWritePos; islotTmp++) + { + SlotAt(islotTmp)->IncPosPassIndex(); + } + } + + if (fInitial) + m_islotSegMin = islotLB; // just before the LB + else + m_islotSegLim = islotLB + 1; // just after the LB +} + +/*---------------------------------------------------------------------------------------------- + Return the index of the line break glyph within the specified range, or -1 if none. + Recipient is functioning as the output stream. + + @param chwLB - glyph ID being used for line-break glyphs + @param islotMin/Lim - range to search +----------------------------------------------------------------------------------------------*/ +int GrSlotStream::FindFinalLineBreak(gid16 chwLB, int islotMin, int islotLim) +{ + for (int islot = islotMin; islot < islotLim; ++islot) + { + if (m_vpslot[islot]->IsFinalLineBreak(chwLB)) + return islot; + } + return -1; +} + +/*---------------------------------------------------------------------------------------------- + A slot has been inserted (nInc == 1) or deleted (nInc == -1). Adjust the next-chunk map + of the previous stream to match. +----------------------------------------------------------------------------------------------*/ +void GrSlotStream::AdjustPrevStreamNextChunkMap(GrTableManager * ptman, int islotMod, int nInc) +{ + if (m_ipass == 0) + return; // no previous stream to adjust + + int islotTmp = max(islotMod - 5, 0); + while (islotTmp > 0 && m_vislotPrevChunkMap[islotTmp] == -1) + islotTmp--; + + ptman->InputStream(m_ipass)->AdjustNextChunkMap( + ((islotTmp <= 0) ? 0 : m_vislotPrevChunkMap[islotTmp]), + islotMod, nInc); +} + +/*---------------------------------------------------------------------------------------------- + An insertion or deletion has occurred at the given location in the following stream + (specifically of an line-break glyph). Adjust the next-chunk-map accordingly so + the indices still match. +----------------------------------------------------------------------------------------------*/ +void GrSlotStream::AdjustNextChunkMap(int islotMin, int islotInsOrDel, int nInc) +{ + for (int islot = islotMin; islot < m_islotWritePos; islot++) + { + if (m_vislotNextChunkMap[islot] != -1 && m_vislotNextChunkMap[islot] >= islotInsOrDel) + m_vislotNextChunkMap[islot] += nInc; + } +} + +/*---------------------------------------------------------------------------------------------- + Unwind the read position of the stream, so that the following pass will begin + reading from the new position. The recipient is functioning as the input stream. +----------------------------------------------------------------------------------------------*/ +void GrSlotStream::UnwindInput(int islotNewPos, bool fPreBidiPass) +{ + Assert(m_islotReprocPos == -1); + Assert(islotNewPos <= m_islotReadPos); + + int islot; + for (islot = islotNewPos; islot < m_islotReadPos; ++islot) + m_vislotNextChunkMap[islot] = -1; + + m_islotReadPos = islotNewPos; + m_islotReadPosMax = m_islotReadPos; + + Assert(m_islotReadPos <= m_islotWritePos); + if (fPreBidiPass) + { + for (islot = m_islotReadPos; islot < m_islotWritePos; ++islot) + SlotAt(islot)->ZapDirLevel(); + } +} + +/*---------------------------------------------------------------------------------------------- + Unwind the write position of the stream, so that the pass will begin writing + at the new position. The recipient is functioning as the output stream +----------------------------------------------------------------------------------------------*/ +void GrSlotStream::UnwindOutput(int islotNewPos, bool fOutputOfPosPass) +{ + Assert(islotNewPos <= m_islotWritePos); + + int islot; + for (islot = islotNewPos; islot < m_islotWritePos; ++islot) + { + m_vislotPrevChunkMap[islot] = -1; + + if (!fOutputOfPosPass && m_fUsedByPosPass) + // This stream is the input to the first positioning pass, ie, the output + // of the last sub pass or the bidi pass. Zap the stream indices, + // since unwinding this pass could cause them to be invalid due to a later + // reordering. + SlotAt(islot)->ZapPosPassIndex(); + } + + m_islotWritePos = islotNewPos; + + m_fFullyWritten = false; + + if (m_islotSegMin > m_islotWritePos) + m_islotSegMin = -1; + if (m_islotSegLim > m_islotWritePos) + m_islotSegLim = -1; +} + +/*---------------------------------------------------------------------------------------------- + We've just created a new chunk, with the recipient as the output stream. The beginning + of the chunk is passed as 'islotOutput' and the end of the chunk is assumed to be the + write-position of the recipient. Store the mappings into the corresponding + input position. + + @param islotInputMin - beginning of chunk in input stream + @param islotOutputMin - beginning of chunk in output stream (recipient) + @param islotInputLim - end of chunk in input stream (currently not used) + @param fSkipChunkStart - if true, either we have reprocessed part of a + previously created chunk, + or there was no input consumed; + in either case, don't record the beginning of the chunk, + just make this chunk be part of the previous + @param fBackingUp - this chunk results in the stream position moving backwards, + so clear anything we're backing over +----------------------------------------------------------------------------------------------*/ +void GrSlotStream::MapInputChunk(int islotInputMin, int islotOutputMin, int /*islotInputLim*/, + bool fSkipChunkStart, bool fBackingUp) +{ + Assert(AssertValid()); + Assert(islotOutputMin >= -1); + + if (!fSkipChunkStart) + { + Assert(islotOutputMin >= 0); + if (islotOutputMin >= 0) // just in case an invalid value was passed + m_vislotPrevChunkMap[islotOutputMin] = islotInputMin; + } + + int islot; + for (islot = max(0, islotOutputMin + 1); islot < m_islotWritePos; ++islot) + m_vislotPrevChunkMap[islot] = -1; // not a chunk boundary + +// if (fBackingUp && m_islotWritePos < m_vislotPrevChunkMap.Size()) +// m_vislotPrevChunkMap[m_islotWritePos] = -1; + + if (fBackingUp) + for (islot = m_islotWritePos; islot < signed(m_vislotPrevChunkMap.size()); islot++) + m_vislotPrevChunkMap[islot] = -1; + +// m_vislotPrevChunkMap[m_islotWritePos] = islotInputLim; +} + +/*---------------------------------------------------------------------------------------------- + Return the length of the final chunk, where the recipient is the input stream. +----------------------------------------------------------------------------------------------*/ +int GrSlotStream::LastNextChunkLength() +{ + int cslotRet = 1; + for (int islot = m_islotReadPos; islot-- > 0; ) + { + if (m_vislotNextChunkMap[islot] != -1) + return cslotRet; + cslotRet++; + } + return cslotRet + 1; +} + +/*---------------------------------------------------------------------------------------------- + We've just created a new chunk, with the recipient as the input stream. The beginning of + the chunk is passed as 'islotInputMin' and the end of the chunk is assumed to be the + read-position of the recipient. Store the mappings into the corresponding + output position. + + @param islotOutputMin - beginning of chunk in output stream + @param islotInputMin - beginning of chunk in input stream (recipient) + @param islotOutputLim - end of chunk in output stream (currently not used) + @param fSkipChunkStart - if true, either we have reprocessed part of a + previously created chunk, + or there was no output generated; + in either case, don't record the beginning of the chunk, + just make this chunk be part of the previous + @param fBackingUp - this chunk results in the stream position moving backwards, + so clear anything we're backing over +----------------------------------------------------------------------------------------------*/ +void GrSlotStream::MapOutputChunk(int islotOutputMin, int islotInputMin, int /*islotOutputLim*/, + bool fSkipChunkStart, int cslotReprocess, bool fBackingUp) +{ + Assert(AssertValid()); + + // Note: islotInputMin can be less than -1 if there is a large reprocess buffer near the + // beginning of the input stream. In which case, fSkipChunk start should be true and + // cslotReprocess large enough to keep any of the stuff below from having any problems. + //Assert(islotInputMin >= -1); + + if (!fSkipChunkStart) + { + Assert(islotInputMin >= 0); + if (islotInputMin >= 0) // just in case an invalid value was passed + m_vislotNextChunkMap[islotInputMin] = islotOutputMin; + } + + int islot; + for (islot = max(0, islotInputMin + 1 + cslotReprocess); islot < m_islotReadPos; ++islot) + m_vislotNextChunkMap[islot] = -1; // not a chunk boundary + +// if (fBackingUp && m_islotReadPos < m_vislotNextChunkMap.Size()) +// m_vislotNextChunkMap[m_islotReadPos] = -1; + + if (fBackingUp) + for (islot = m_islotReadPos; islot < signed(m_vislotNextChunkMap.size()); islot++) + m_vislotNextChunkMap[islot] = -1; + +// m_vislotNextChunkMap[m_islotReadPos] = islotOutputLim; +} + +/*---------------------------------------------------------------------------------------------- + Ensure that the chunk maps for a pair of streams match properly. The recipient is + the input stream. +----------------------------------------------------------------------------------------------*/ +#ifdef _DEBUG +void GrSlotStream::AssertChunkMapsValid(GrSlotStream * psstrmOut) +#else +void GrSlotStream::AssertChunkMapsValid(GrSlotStream *) +#endif +{ +#ifdef _DEBUG + GrSlotStream * psstrmIn = this; + + Assert(m_ipass == 0 || (m_ipass + 1 == psstrmOut->m_ipass)); + + int islotMapNext; + int islotMapPrev; + int islot; + for (islot = 0; islot < m_islotReadPos; ++islot) + { + islotMapNext = psstrmIn->ChunkInNext(islot); + Assert(islotMapNext != -2); + if (islotMapNext != -1) + { + islotMapPrev = psstrmOut->ChunkInPrev(islotMapNext); + if (islotMapPrev == -2) + { + Assert(islot == psstrmOut->WritePos()); + } + else + { + Assert(islot == islotMapPrev); + } + } + } + + for (islot = 0; islot < psstrmOut->m_islotWritePos; ++islot) + { + islotMapPrev = psstrmOut->ChunkInPrev(islot); + Assert(islotMapPrev != -2); + if (islotMapPrev != -1) + { + islotMapNext = psstrmIn->ChunkInNext(islotMapPrev); + if (islotMapNext == -2) + { + Assert(islot == psstrmIn->ReadPos()); + } + else + { + Assert(islot == islotMapNext); + } + } + } +#endif // _DEBUG +} + +/*---------------------------------------------------------------------------------------------- + Ensure that corresponding items in the streams of a positioning pass have matching + stream indices. The recipient is the output stream. +----------------------------------------------------------------------------------------------*/ +#ifdef _DEBUG +void GrSlotStream::AssertStreamIndicesValid(GrSlotStream * psstrmIn) +#else +void GrSlotStream::AssertStreamIndicesValid(GrSlotStream *) +#endif +{ +#ifdef _DEBUG + if (!GotIndexOffset()) + return; + + Assert(m_fUsedByPosPass); + + for (int islot = 0; islot < WritePos(); islot++) + { + GrSlotState * pslotOut = SlotAt(islot); + GrSlotState * pslotIn = + psstrmIn->SlotAt(islot + psstrmIn->IndexOffset() - IndexOffset()); + Assert(pslotOut->PosPassIndex() == pslotIn->PosPassIndex()); + Assert(pslotOut->HasAsPreviousState(pslotIn)); + } +#endif // _DEBUG +} + +/*---------------------------------------------------------------------------------------------- + Ensure that the roots of all attachments made in this chunk are present + in the output stream. (Currently the compiler ensures this by making it an error + to write rules that don't do this.) +----------------------------------------------------------------------------------------------*/ +#ifdef _DEBUG +void GrSlotStream::AssertAttachmentsInOutput(int islotMin, int islotLim) +#else +void GrSlotStream::AssertAttachmentsInOutput(int, int) +#endif +{ +#ifdef _DEBUG + for (int islot = islotMin; islot < islotLim; islot++) + { + GrSlotState * pslotOut = SlotAt(islot); + int dislot = pslotOut->AttachTo(); + Assert(islotMin <= islot + dislot); + Assert(islot + dislot < islotLim); + } +#endif // _DEBUG +} + +/*---------------------------------------------------------------------------------------------- + Answer the slot index corresponding to the start of the chunk (as mapped to the following + stream). + ENHANCE: make more robust. +----------------------------------------------------------------------------------------------*/ +int GrSlotStream::ChunkInNextMin(int islot) +{ + int islotRet = islot; + while (m_vislotNextChunkMap[islotRet] == -1 && islotRet > 0) + --islotRet; + return islotRet; +} + +/*---------------------------------------------------------------------------------------------- + Answer the slot index corresponding to the end of the chunk (as mapped to the following + stream). + ENHANCE: make more robust. +----------------------------------------------------------------------------------------------*/ +int GrSlotStream::ChunkInNextLim(int islot) +{ + int islotRet = islot + 1; + if (islotRet == m_islotReadPos) + return islot; + while (m_vislotNextChunkMap[islotRet] == -1 && islotRet < m_islotReadPos) + { + ++islotRet; + //Assert(islotRet < signed(m_vislotNextChunkMap.size())); + if (islotRet >= signed(m_vislotNextChunkMap.size())) + { + islotRet = m_vislotNextChunkMap.size() - 1; + break; + } + } + return islotRet; +} + +/*---------------------------------------------------------------------------------------------- + Skip over the given number slots. This is used to resync the streams when we + are restarting a new segment. Specifically the output stream informs the + input stream of the number of slots to skip to get the boundary for a chunk that + the output finds interesting. +----------------------------------------------------------------------------------------------*/ +void GrSlotStream::ResyncSkip(int cslot) +{ + Assert(AssertValid()); + m_islotReadPos += cslot; + m_cslotSkippedForResync = cslot; + // Should never skip past the beginning of the line. + Assert(m_islotSegMin == -1 || m_islotReadPos <= m_islotSegMin); +} + +/*---------------------------------------------------------------------------------------------- + Record the number of slots in the stream that are previous to the official start of the + segment. +----------------------------------------------------------------------------------------------*/ +void GrSlotStream::CalcIndexOffset(GrTableManager * /*ptman*/) +{ + if (GotIndexOffset()) + return; // already figured it + + if (m_islotSegMin > -1) + { + m_cslotPreSeg = m_islotSegMin; + if (m_fUsedByPosPass) + { + for (int islotPre = 0; islotPre < WritePos(); islotPre++) + { + SlotAt(islotPre)->SetPosPassIndex(islotPre - m_cslotPreSeg, + m_fInputToPosPass1); + } + } + } + // else can't figure it out yet + + // Old code: +#if 0 + gid16 chwLB = ptman->LBGlyphID(); + + for (int islot = 0; islot < WritePos(); islot++) + { + if (SlotAt(islot)->IsLineBreak(chwLB)) + { + if (SlotAt(islot)->IsInitialLineBreak(chwLB)) + { + m_cslotPreSeg = islot; + } + else + { + // Otherwise, we hit the final line break, which is kind of strange, because + // in this case there is no initial line break, and we should have set + // m_cslotPreSeg to 0 immediately when it was initialized. + Assert(false); + m_cslotPreSeg = 0; + } + + if (m_fUsedByPosPass) + { + for (int islotPre = 0; islotPre < WritePos(); islotPre++) + { + SlotAt(islotPre)->SetPosPassIndex(islotPre - m_cslotPreSeg, + m_fInputToPosPass1); + } + } + return; + } + + } + // No line breaks yet, so no way to tell. +#endif +} + +/*---------------------------------------------------------------------------------------------- + Set the positions in the streams for the next rule. The recipient is the output stream. + If we are moving backwards, copy part of the output stream back to (a temporary buffer + in) the input stream, so that we can reprocess it. + + @param cslotArg - how far to skip forward or back; most commonly zero +----------------------------------------------------------------------------------------------*/ +void GrSlotStream::SetPosForNextRule(int cslotArg, GrSlotStream * psstrmIn, + bool fOutputOfPosPass) +{ + Assert(AssertValid()); + + int cslot = cslotArg; + // Can't reprocess what has already been read by the next pass. MaxBackup should allow + // the flexibility needed, but if not, we fix it here. + if (m_islotWritePos + cslot < m_islotReadPos) + cslot = m_islotReadPos - m_islotWritePos; + + Assert(psstrmIn->m_ipass == m_ipass-1); + + if (cslot >= 0) + { + // Skipping forward. + Assert(cslot <= psstrmIn->SlotsPendingInContext()); + for (int islot = 0; islot < cslot; islot++) + CopyOneSlotFrom(psstrmIn); + } + else + { + // Reprocessing. + + // Save corresponding positions before doing the back-up. + int islotReadPosInSave = psstrmIn->ReadPosForNextGet(); + int islotWritePosOutSave = this->WritePos(); + + std::vector vpslotTmp; + int islot; + if (psstrmIn->SlotsToReprocess() > 0) + { + // Stick any slots still to reprocess in a temporary buffer. + for (islot = psstrmIn->m_islotReprocPos; + islot < signed(psstrmIn->m_vpslotReproc.size()); + islot++) + { + vpslotTmp.push_back(psstrmIn->m_vpslotReproc[islot]); + } + } + + psstrmIn->ClearReprocBuffer(); + psstrmIn->m_islotReprocLim = psstrmIn->m_islotReadPos; + + for (islot = cslot; islot < 0; islot++) + psstrmIn->m_vpslotReproc.push_back(m_vpslot[m_islotWritePos+islot]); + for (islot = 0; islot < signed(vpslotTmp.size()); islot++) + psstrmIn->m_vpslotReproc.push_back(vpslotTmp[islot]); + psstrmIn->m_islotReprocPos = 0; + + if (!fOutputOfPosPass && m_fUsedByPosPass) + { + // Last substitution pass; zap the stream indices, since they may + // now be invalid. + for (islot = 0; islot < signed(psstrmIn->m_vpslotReproc.size()); islot++) + psstrmIn->m_vpslotReproc[islot]->ZapPosPassIndex(); + } + + // If either the min or lim is in the middle of the reprocess buffer, + // adjust as necessary to match where it is in the output stream. + int islotSegMinIn = psstrmIn->SegMin(); + if (islotSegMinIn > -1 && + psstrmIn->ReadPosForNextGet() <= islotSegMinIn && + islotSegMinIn < islotReadPosInSave) + { + Assert(this->SegMin() > -1); + int dislotIn = islotReadPosInSave - islotSegMinIn; + int dislotOut = islotWritePosOutSave - SegMin(); + psstrmIn->SetSegMin(islotSegMinIn + dislotIn - dislotOut, true); + if (psstrmIn->m_cslotPreSeg > psstrmIn->SegMin()) + psstrmIn->m_cslotPreSeg = -1; + } + int islotSegLimIn = psstrmIn->SegLimIfKnown(); + if (islotSegLimIn > -1 && + psstrmIn->ReadPosForNextGet() <= islotSegLimIn && + islotSegLimIn < islotReadPosInSave) + { + int islotSegLimOut = this->SegLimIfKnown(); + Assert(islotSegLimOut > -1); + int dislotIn = islotReadPosInSave - islotSegLimIn; + int dislotOut = islotWritePosOutSave - islotSegLimOut; + psstrmIn->SetSegLim(islotSegLimIn + dislotIn - dislotOut); + } + + m_islotWritePos += cslot; + + if (m_islotSegMin >= m_islotWritePos) + m_islotSegMin = -1; + if (m_islotSegLim >= m_islotWritePos) + m_islotSegLim = -1; + } +} + +/*---------------------------------------------------------------------------------------------- + If a rule was run over a LB glyph, set the appropriate flag in the table manager. + CURRENTLY NOT USED +----------------------------------------------------------------------------------------------*/ +void GrSlotStream::SetLBContextFlag(GrTableManager * ptman, int islotStart) +{ + gid16 chwLB = ptman->LBGlyphID(); + for (int islot = islotStart; islot < WritePos(); islot++) + { + GrSlotState * pslot = SlotAt(islot); + if (pslot->IsInitialLineBreak(chwLB)) + ptman->State()->SetStartLineContext(true); + if (pslot->IsFinalLineBreak(chwLB)) + ptman->State()->SetEndLineContext(true); + } +} + +/*---------------------------------------------------------------------------------------------- + Return the number of slots that have been output by the current pass but must be + reprocessed by this same pass. The recipient is serving as the input stream. +----------------------------------------------------------------------------------------------*/ +int GrSlotStream::SlotsToReprocess() +{ + Assert(AssertValid()); + + if (m_islotReprocPos == -1) + return 0; + return (m_vpslotReproc.size() - m_islotReprocPos); +} + +/*---------------------------------------------------------------------------------------------- + Get the input at the given slot, that is, the original input, ignoring the issue of + reprocessing. +----------------------------------------------------------------------------------------------*/ +GrSlotState * GrSlotStream::GetSlotAt(int islot) +{ + return m_vpslot[islot]; +} + +/*---------------------------------------------------------------------------------------------- + In the middle of running a pass, return the given slot to use in processing. + Read it from the reprocess buffer if appropriate, or for slots previous to the current + position, read from the output stream (psstrmNext). + + psstrmNext may be NULL when processing is complete, therefore we only have one stream to + deal with. +----------------------------------------------------------------------------------------------*/ +GrSlotState * GrSlotStream::MidPassSlotAt(int islot, GrSlotStream * psstrmNext) +{ + int islotInput = islot - ReadPosForNextGet() + 1; // +1 because RuleInputSlot takes 0 to mean the previously read slot + GrSlotState * pslot = RuleInputSlot(islotInput, psstrmNext); + return pslot; +} + +/*---------------------------------------------------------------------------------------------- + Return the "current" input item from the rule's perspective, ie, the last slot read. + So dislotOffset = 0 means not the slot at the read position but one slot earlier. + + If dislotOffset is less the the original read position that was in effect at the + beginning of the rule, we need to read from the output stream, which has the + up-to-date values. See the class comment for more details. + + @param dislotOffset - offset from current stream position + @param fNullOkay - true if it's okay to return NULL in the situation where we're asking + for something before the beginning of the stream +----------------------------------------------------------------------------------------------*/ +GrSlotState * GrSlotStream::RuleInputSlot(int dislotOffset, GrSlotStream * psstrmOutput, + bool fNullOkay) +{ + Assert(m_islotRuleStartRead <= m_islotReadPos); + + if (dislotOffset > 0) + return Peek(dislotOffset - 1); + + int cslotOffsetBack = dislotOffset * -1; + + if (m_islotReprocLim > -1) + { + // There is a reprocess buffer. + + // Position when starting the rule should never be earlier than the + // beginning of the reprocess buffer. + Assert(m_islotRuleStartRead >= m_islotReprocLim - signed(m_vpslotReproc.size())); + + // number of items following the reprocess buffer: + int cslotPostReproc = m_islotReadPos - m_islotReprocLim; + + if (cslotOffsetBack >= cslotPostReproc) + { + // number of items in the reprocess buffer that were valid when the rule + // was started: + int cslotValidReproc = m_islotReprocLim - m_islotRuleStartRead; + + if (cslotOffsetBack >= cslotPostReproc + cslotValidReproc) + { + // Read from the output stream. (Remember that PeekBack works relative to + // the rule-start write position, not the current write position.) + int dislotTmp = dislotOffset - 1 + cslotPostReproc + + cslotValidReproc - SlotsToReprocess(); + Assert(dislotTmp < 0); + return psstrmOutput->PeekBack(dislotTmp); + } + else + { + if (m_islotReprocPos > -1) + { + // Current read pos could be inside reprocess buffer. + Assert(cslotPostReproc == 0); + int islotStartReadReprocBuf = m_vpslotReproc.size() - cslotValidReproc; + Assert(islotStartReadReprocBuf >= 0); + int islotInReprocBuf = m_islotReprocPos - cslotOffsetBack - 1; + if (islotInReprocBuf < islotStartReadReprocBuf) + { + // Return a slot from before the reprocess buffer, from the + // output stream (which is serving as our input stream for precontext + // items). + return psstrmOutput->PeekBack(islotInReprocBuf - islotStartReadReprocBuf); + } + else if (islotInReprocBuf < 0) + { + Assert(false); + //int islotReprocMin = m_islotReprocLim - m_vpslotReproc.Size(); + //return m_vpslot[islotReprocMin + islotInReprocBuf]; + } + else + // Read from the reprocess buffer. + return m_vpslotReproc[islotInReprocBuf]; + } + else + // Looking backwards into the reprocess buffer. + return m_vpslotReproc[ + m_vpslotReproc.size() - cslotOffsetBack + cslotPostReproc - 1]; + } + } + } + + // There is no reprocess buffer, or it is not a factor. + + if (m_islotReadPos + dislotOffset - 1 < m_islotRuleStartRead) + { + // Read from the output stream. + return psstrmOutput->PeekBack(m_islotReadPos + dislotOffset - 1 - m_islotRuleStartRead, + fNullOkay); + } + else + { + // Read normally from the input stream. + return m_vpslot[m_islotReadPos - cslotOffsetBack - 1]; + } +} + +/*---------------------------------------------------------------------------------------------- + Return the "current" output item from the rule's perspective, ie, the last slot written. + So dislotOffset = 0 means not the slot at the write position but one slot earlier. +----------------------------------------------------------------------------------------------*/ + +GrSlotState * GrSlotStream::RuleOutputSlot(int dislotOffset) +{ + return m_vpslot[m_islotWritePos - 1 + dislotOffset]; +} + +/*---------------------------------------------------------------------------------------------- + For any slot in the final output that has no associations, set the "before" pointer to + the following slot and the "after" pointer to the preceding slot. The idea of this is + that it will make it impossible to select a the glyph separately. + + Note that if the slot is the first on the line, it will not be associated with + a slot in the previous segment. + + @param chwLB - the glyph IB for the line-break glyphs +----------------------------------------------------------------------------------------------*/ +void GrSlotStream::SetNeutralAssociations(gid16 chwLB) +{ + for (int islot = 0; islot < m_islotWritePos; ++islot) + { + GrSlotState * pslot = SlotAt(islot); + if (pslot->PassModified() > 0 && + (pslot->BeforeAssoc() == kPosInfinity || pslot->AfterAssoc() == kNegInfinity)) + { + pslot->CleanUpAssocs(); + if (pslot->BeforeAssoc() != kPosInfinity && pslot->AfterAssoc() != kNegInfinity) + continue; + + Assert(pslot->BeforeAssoc() == kPosInfinity && pslot->AfterAssoc() == kNegInfinity); + + GrSlotState * pslotBefore = FindAssociatedSlot(islot, 1, chwLB); + GrSlotState * pslotAfter = FindAssociatedSlot(islot, -1, chwLB); + + if (pslotBefore && pslotAfter) + pslot->Associate(pslotBefore, pslotAfter); + else if (pslotBefore) + pslot->Associate(pslotBefore); + else if (pslotAfter) + pslot->Associate(pslotAfter); + else + { + // Weird, but can happen with an empty segment. + Warn("No assocations"); + } + +// Assert(pslot->m_vpslotAssoc.Size() > 0); + pslot->m_fNeutralAssocs = true; + } + } +} + +/*---------------------------------------------------------------------------------------------- + Find the next or previous slot in the final output that has explicit associations, or + return NULL if none. + + @param islot - starting slot + @param nInc - +1 if we want to find the next slot, -1 if we want the previous slot + @param chwLB - the glyph IB for the line-break glyphs +----------------------------------------------------------------------------------------------*/ +GrSlotState * GrSlotStream::FindAssociatedSlot(int islot, int nInc, gid16 chwLB) +{ + int islotNext = islot + nInc; + + while (islotNext >= 0 && islotNext < m_islotWritePos) + { + GrSlotState * pslotRet = SlotAt(islotNext); + if (pslotRet->IsLineBreak(chwLB)) + { } + else if (pslotRet->PassModified() == 0 || + (pslotRet->m_vpslotAssoc.size() > 0 && pslotRet->m_fNeutralAssocs == false)) + { + return pslotRet; + } + islotNext += nInc; + } + return NULL; +} + +} // namespace gr diff --git a/Build/source/libs/graphite/engine-2.4/src/segment/GrSlotStream.h b/Build/source/libs/graphite/engine-2.4/src/segment/GrSlotStream.h new file mode 100644 index 00000000000..ce29f619ca5 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/src/segment/GrSlotStream.h @@ -0,0 +1,586 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 1999, 2001 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: GrSlotStream.h +Responsibility: Sharon Correll +Last reviewed: Not yet. + +Description: + Classes GrSlotStream and GrSlotState. +----------------------------------------------------------------------------------------------*/ +#ifdef _MSC_VER +#pragma once +#endif +#ifndef SLOTSTREAM_INCLUDED +#define SLOTSTREAM_INCLUDED + +//:End Ignore + +namespace gr +{ + +class EngineState; +class Font; + +/*---------------------------------------------------------------------------------------------- + Each GrSlotStream represents the output of one pass, which also serves as the input + of the following pass. Hence it has two positions, a write position for when it is + serving as an output stream, and a read position for when it is serving as an input + stream. The TableManager holds a list of the streams. + + The reading of slot streams is complicated by two factors. First, it may be necessary + to access the "pre-context" items of a rule, which are the slots before the current + stream position at the point when the rule is matched. These items will not be modified + by the rule, but may have been modified by a previous rule in the same pass, Therefore + we need to read these slots from the output stream, rather than the input stream, + because the output stream has the current slot attribute values that we want to work with. + In order make this happen, we keep track of the read and write positions of + the streams at the time the current rule was matched (m_islotRuleStartRead and + m_islotRuleStartWrite) and whenever we try to read a slot before m_islotRuleStartRead, + we read the corresponding slot from the output stream instead. + + Second, a rule may explicitly set the advance position so that some items are + actually reprocessed (and potentially modified) by the same pass. When this happens, + we actually copy the slots to reprocess from the output stream back + into a temporary buffer (m_vpslotReproc) in the input stream, and set up the stream so + that the next read operations will read from the buffer. + + It gets tricky because these two mechanisms can overlap with each other, so care + must be taken to read from the right place: the input stream in the normal way, + the reprocess buffer, or the output stream. See the RuleInputSlot method. + + Another messy bit of code has to do with maintaining chunks. These are used for + backtracking and unwinding after inserting a line-break. Adjacent streams have maps + showing how many slots were processed by a single rule; the maps must be consisent + between adjacent rules. The following is an example of a pair of valid chunk maps: + + Input stream Output stream + Pos next-map prev-map + 0 0 0 + 1 -1 -1 + 2 2 2 + 3 4 -1 + 4 -1 3 + 5 -1 -1 + 6 7 -1 + 7 -1 6 + 8 -1 -1 + + A -1 means that slot is not at the beginning of a chunk. Otherwise, there must be a + corresponding value in the parallel map of the adjacent stream--eg, the input stream's + next-map(3) == 4 and the output stream's prev-map(4) == 3. Assertions are run + regularly to ensure that the chunk maps stay valid. + + So above, the first chunk corresponds to slots 0-1 in the input and 0-1 in the output; + two slots were processed by the rule. The second chunk corresponds to slot 2 + in the input and slots 2-3 in the output (a slot was inserted). + The third corresponds to slots 3-5 in the input and 4-6 in the output (three slots + processed). The fourth chunk covers slots 6-8 in the input and 7-8 in the output + (one slot was deleted). + + ENHANCE SharonC: explain the effect of skipped slots on the chunk maps. + + Hungarian: sstrm +----------------------------------------------------------------------------------------------*/ +class GrSlotStream { + + friend class GrSlotState; + friend class FontMemoryUsage; + +public: + // Constructor: + GrSlotStream(int ipass) + { + m_ipass = ipass; + m_vpslot.clear(); + m_vislotPrevChunkMap.clear(); + m_vislotNextChunkMap.clear(); + m_vpslotReproc.clear(); + } + + // Destructor: + ~GrSlotStream() + { + ReleaseSlots(0, m_vpslot.size()); + } + + void ReleaseSlots(int /*islotMin*/, int /*islotLim*/) + { + // A slot stream is responsible for deleting the slot states that it created, + // that is, the ones whose modified tag equals this stream's pass index. + // NO LONGER TRUE - there is a master list of them managed by the GrTableManager. +// for (int islot = islotMin; islot < islotLim; ++islot) +// { +// if (m_vpslot[islot]->m_ipassModified == m_ipass) +// delete m_vpslot[islot]; +// } + } + + // Getters: + int WritePos() { return m_islotWritePos; } + int ReadPos() { return m_islotReadPos; } + bool FullyWritten() { return m_fFullyWritten; } + + int SlotsPresent() { return m_vpslot.size(); } + + // Setters: + void SetWritePos(int islot) + { + m_islotWritePos = islot; + } + void SetReadPos(int islot) + { + m_islotReadPos = islot; + } + + void Initialize(int ipassPos1, bool fAnythingPrevious) + { + m_islotWritePos = 0; + m_islotReadPos = 0; + m_islotReprocPos = -1; + m_islotReprocLim = -1; + m_islotRuleStartRead = 0; + m_islotRuleStartWrite = 0; + m_islotReadPosMax = 0; + m_cslotSkippedForResync = 0; + m_cslotPreSeg = (fAnythingPrevious) ? -1 : 0; + m_fFullyWritten = false; + m_islotSegMin = -1; + m_islotSegLim = -1; + m_fUsedByPosPass = (m_ipass + 1 >= ipassPos1); + m_fInputToPosPass1 = (m_ipass + 1 == ipassPos1); + m_vpslot.clear(); // not responsible for destroying the slots + m_vislotPrevChunkMap.clear(); + m_vislotNextChunkMap.clear(); + } + +public: + bool AtEnd(); + bool AtEndOfContext(); + void NextPut(GrSlotState* pslot); + GrSlotState * NextGet(); + GrSlotState * Peek(int dislot = 0); + GrSlotState * PeekBack(int dislot, bool fNullOkay = false); + void Skip(int = 1); + GrSlotState * SlotAt(int islot) + { + return m_vpslot[islot]; + } + + int OutputOfPass() + { + return m_ipass; + } + + // This function is intended to be used within positioning passes where there is a + // one-to-one correspondence beween the slots in consecutive streams. + GrSlotState * OutputSlotAt(int islot) + { + return Peek(islot - ReadPosForNextGet()); + } + + // Return the functional read position, taking into account the reprocess buffer. + int ReadPosForNextGet() + { + return ReadPos() - SlotsToReprocess(); + } + + // Only valid for streams that are the input or output to a positioning pass. + GrSlotState * SlotAtPosPassIndex(int islot) + { + Assert(GotIndexOffset()); + Assert(m_fUsedByPosPass); + return m_vpslot[islot + m_cslotPreSeg]; + } + + // Only valid for streams that are the input or output to a positioning pass. + bool HasSlotAtPosPassIndex(int islot) + { + Assert(GotIndexOffset()); + Assert(m_fUsedByPosPass); + return (signed(m_vpslot.size()) > (islot + m_cslotPreSeg)); + } + + bool AssertValid(); + void AssertChunkMapsValid(GrSlotStream * psstrmOut); + void AssertStreamIndicesValid(GrSlotStream * psstrmIn); + void AssertAttachmentsInOutput(int islotMin, int islotLim); + bool NoReproc() + { + return (m_islotReprocPos == -1 || (m_islotReprocPos >= signed(m_vpslotReproc.size()))); + } + + int SlotsPending(); + int SlotsPendingInContext(); + int TotalSlotsPending(); + bool PastEndOfPositioning(bool fOutput); + + void ClearReprocBuffer() + { + m_islotReprocPos = -1; + m_islotReprocLim = -1; + m_vpslotReproc.clear(); + } + + int ReprocLim() + { + return m_islotReprocLim; + } + + int ReprocMin() + { + Assert(m_islotReprocPos > -1); + return m_islotReprocLim - m_vpslot.size(); + } + + int RuleStartReadPos() + { + return m_islotRuleStartRead; + } + + void SetRuleStartReadPos() + { + if (m_islotReprocPos > -1) + m_islotRuleStartRead = m_islotReprocLim - SlotsToReprocess(); + else + m_islotRuleStartRead = m_islotReadPos; + } + + int RuleStartWritePos() + { + return m_islotRuleStartWrite; + } + + void SetRuleStartWritePos() + { + m_islotRuleStartWrite = m_islotWritePos; + } + + void MarkFullyWritten(); + +#ifdef NDEBUG + void SetSegMin(int islot, bool = false) +#else + void SetSegMin(int islot, bool fAdjusting = false) +#endif + { + Assert(fAdjusting || m_islotSegMin == -1 || m_islotSegMin == islot); + m_islotSegMin = islot; + } + void SetSegMinToWritePos(bool /*fMod*/ = true) + { + if (m_islotSegMin == -1) + m_islotSegMin = m_islotWritePos; + else + Assert(m_islotSegMin <= m_islotWritePos); // eg, already set to before the initial LB + } + int SegMin() + { + return m_islotSegMin; + } + void SetSegLim(int islot) + { + m_islotSegLim = islot; + } + void SetSegLimToWritePos(bool fMod = true) + { + if (m_islotSegLim > -1 && !fMod) + { + Assert(m_islotSegLim <= m_islotWritePos); + return; + } + m_islotSegLim = m_islotWritePos; + } + int SegLimIfKnown() + { + return m_islotSegLim; + } + int FinalSegLim() + { + if (m_islotSegLim > -1) + return m_islotSegLim; + else + return m_islotWritePos; + } + + // Return true if we are exactly at the segment min. + bool AtSegMin() + { + if (m_islotSegMin == -1) + return false; + return (m_islotSegMin == ReadPosForNextGet()); + } + + // Return true if we are exactly at the segment lim. + bool AtSegLim() + { + if (m_islotSegLim == -1) + return false; + return (m_islotSegLim == ReadPosForNextGet()); + } + + int ReadPosMax() + { + return m_islotReadPosMax; + } + void SetReadPosMax(int islot) + { + m_islotReadPosMax = std::max(m_islotReadPosMax, islot); + } + + int FeatureRangeLim(GrSlotStream * psstrmOut); + bool NoFeatureChanges(); + + int OldDirLevelRange(EngineState * pengst, int islotStart, int nTopDirection); + int DirLevelRange(EngineState * pengst, int islotStart, int nTopDirection, + std::vector & vislotStarts, std::vector & vislotStops); + int GetSlotDirLevel(EngineState * pengst, int islot, + int nOuterLevel, int nCurrLevel, DirCode dircMarker, DirCode dircOverride); + DirCode AdjacentStrongCode(EngineState * pengst, int islot, int nInc, + DirCode dircPDF, bool fNumbersAreStrong = false); + DirCode TerminatorSequence(EngineState * pengst, int islot, int nInc, DirCode dircPDF); + DirCode AdjacentNonBndNeutralCode(EngineState * pengst, int islot, int nInc, + DirCode dircPDF); + + void CopyOneSlotFrom(GrSlotStream * psstrmPrev); + void SimpleCopyFrom(GrSlotStream * psstrmI, int islotInput, int islotOutput); + + bool MoreSpace(GrTableManager * ptman, + float xsSpaceAllotted, bool fWidthIsCharCount, + bool fIgnoreTrailingWS, TrWsHandling twsh, + float * pxsWidth); + + int InsertLineBreak(GrTableManager * ptman, + int islotPrevBreak, bool fInsertedLB, int islotStartTry, + LineBrk lb, TrWsHandling twsh, int islotMin, LineBrk * plbNextToTry); + int MakeSegmentBreak(GrTableManager * ptman, + int islotPrevBreak, bool fInsertedLB, int islotStartTry, + LineBrk lb, TrWsHandling twsh, int islotMin, LineBrk * plbNextToTry); + bool FindSegmentEnd(GrTableManager * ptman, + int islotStartTry, LineBrk lb, TrWsHandling twsh, int islotMin, + int * pislot, int * pichwSegOffset, + LineBrk * plbFound, LineBrk * plbNextToTry); + bool HasEarlierBetterBreak(int islotBreak, LineBrk lbFound, gid16 chwLB); + LineBrk BreakWeightAt(gid16 chwLB, int islot); + void AppendLineBreak(GrTableManager *, GrCharStream * pchstrm, + LineBrk, DirCode dirc, int islot, bool fInitial, int ichwSegOffset); + int FindFinalLineBreak(gid16 chwLB, int islotMin, int islotLim); + void AdjustPrevStreamNextChunkMap(GrTableManager * ptman, int islotMod, int nInc); + void AdjustNextChunkMap(int islotMin, int islotMod, int nInc); + + void EnsureLocalCopy(GrTableManager * ptman, GrSlotState * pslot, GrSlotStream * psstrmIn); + void ReplaceSlotInReprocessBuffer(GrSlotState * pslotOld, GrSlotState * pslotNew); + + void ZapCalculatedDirLevels(int islotLB); + + int MaxClusterSlot(int islotChunkLim) + { + return MaxClusterSlot(islotChunkLim - 1, islotChunkLim); + } + int MaxClusterSlot(int islotChunkMin, int islotChunkLim); + + void UnwindInput( int islot, bool fPreBidiPass); + void UnwindOutput(int islot, bool fOutputOfPosPass); + + void MapInputChunk( int islotIn, int islotOut, int islotInLim, + bool fReprocessing, bool fBackingUp); + void MapOutputChunk(int islotOut, int islotIn, int islotOutLim, + bool fReprocessing, int cslotReprocess, bool fBackingUp); + + int LastNextChunkLength(); + + int ChunkInPrev(int i) + { + Assert(i >= 0); + Assert(i < signed(m_vislotPrevChunkMap.size())); + Assert(i < m_islotWritePos); + return m_vislotPrevChunkMap[i]; + } + int ChunkInNext(int i) + { + Assert(i >= 0); + Assert(i < signed(m_vislotNextChunkMap.size())); + Assert(i < m_islotReadPos); + return m_vislotNextChunkMap[i]; + } + + int ChunkInNextMin(int islot); + int ChunkInNextLim(int islot); + + void ResyncSkip(int nslot); + int SlotsSkippedToResync() + { + return m_cslotSkippedForResync; + } + void ClearSlotsSkippedToResync() + { + m_cslotSkippedForResync = 0; + } + + int IndexOffset() + { + Assert(GotIndexOffset()); // should have been calculated + return m_cslotPreSeg; + } + void SetIndexOffset(int c) + { + m_cslotPreSeg = c; + } + bool GotIndexOffset() + { + return (m_cslotPreSeg >= 0); + } + void CalcIndexOffset(GrTableManager * ptman); + + void SetPosForNextRule(int nslot, GrSlotStream * psstrmInput, bool fOutputOfPosPass); + void SetLBContextFlag(GrTableManager * ptman, int islotStart); + int SlotsToReprocess(); + + void SetNeutralAssociations(gid16 chwLB); +protected: + GrSlotState * FindAssociatedSlot(int islot, int nInc, gid16 chwLB); + + GrSlotState * GetSlotAt(int islot); + +public: + // Used by the action code: + void BackupReadPos(int cslot = 1) + { + for (int islot = 0; islot < cslot; islot++) + { + if (m_islotReprocLim > -1 && m_islotReprocLim == m_islotReadPos) + { + if (m_islotReprocPos == -1) + m_islotReprocPos = m_vpslotReproc.size() - 1; + else + --m_islotReprocPos; + Assert(m_islotReprocPos >= 0); + } + else + --m_islotReadPos; + } + } + + GrSlotState * MidPassSlotAt(int islot, GrSlotStream * psstrmNext = NULL); + GrSlotState * RuleInputSlot(int dislot = 0, GrSlotStream * psstrmOut = NULL, + bool fNullOkay = false); + GrSlotState * RuleOutputSlot(int dislot = 0); + + void PutSlotAt(GrSlotState * pslot, int islot) + { + // Currently only used for the final pass, when applying justify.width to + // the advance width. + Assert(signed(m_vpslot.size()) > islot); + Assert(WritePos() > islot); + Assert(ReadPos() <= islot); + Assert(SlotsToReprocess() == 0); + m_vpslot[islot] = pslot; + } + +protected: + // Instance variables: + int m_ipass; // which pass this stream is serving as OUTPUT of + + std::vector m_vpslot; // the slots being processed + + // Chunking information: + std::vector m_vislotPrevChunkMap; // chunk mapping into previous stream; + // -1 if not at a chunk boundary + // (this information is needed for + // reinitialization after inserting a line break) + + std::vector m_vislotNextChunkMap; // chunk mapping into next stream, or -1 + // (this information is needed for backtracking) + + // Since most streams serve as both input and output, there are two positions. + // Note that readPos <= writePos always. + int m_islotWritePos; // where previous pass should put next output + int m_islotReadPos; // where following pass should start processing from + + // When we are reprocessing some of the output from the next stream: + std::vector m_vpslotReproc; // temporary buffer + int m_islotReprocLim; // the read position corresponding to the end of the reprocess + // buffer; -1 if buffer is invalid + int m_islotReprocPos; // index into m_vpslotReproc from where we should read next; + // -1 if we are not reprocessing + + int m_islotRuleStartRead; // read position when the rule was started; any requests before + // this point should access the output stream, because it has + // the most up-to-date values. + int m_islotRuleStartWrite; // write position when the rule started + + bool m_fFullyWritten; // set to true when we can't get any more from the + // previous pass; initially false. + + int m_islotSegMin; // the official min of the segment; -1 if not yet set + int m_islotSegLim; // the official lim of the segment; -1 if not yet set + // (only set for the output of the final line-break pass + // and those beyond) + + int m_cslotSkippedForResync; // number of slots skipped to resync; + // specifically, the number of slots' worth of the + // next-chunk-map that are invalid, not mapped + // to any slots in the following stream + + int m_cslotPreSeg; // number of slots previous to the official beginning of the segment; + // -1 if we haven't figured it out yet. Used for keeping streams + // in the positioning pass in sync; not particularly useful for + // substitution passes, and will possibly be left uncalculated. + + bool m_fUsedByPosPass; // true if this is input to or output from a positioning pass + bool m_fInputToPosPass1; // true if this is the input to the first positioning pass + + // Max value of m_islotReadPos; used for recognizing infinite loops and forcibly + // advancing (see GrPass::CheckInputProgress). + int m_islotReadPosMax; + +public: + // For transduction logging: +#ifdef TRACING +// void LogSlotGlyphs(std::ofstream & strmOut, gid16 chwLB); +#endif // TRACING + + // For test procedures: + int NumberOfSlots() { return m_vpslot.size(); } + GrSlotState * LastSlotWritten() + { + if (m_islotWritePos == 0) + return NULL; + else + return m_vpslot[m_islotWritePos-1]; + } + GrSlotState * LastSlotRead() + { + if (m_islotReadPos == 0) + return NULL; + else + return m_vpslot[m_islotReadPos-1]; + } + + gid16 GlyphIDAt(int islot) + { + return m_vpslot[islot]->m_chwGlyphID; + } + + int PreChunk() // answer the number of prepended items that are not in any chunk; + // should be obsolete now + { + int islot; + for (islot = 0; islot < m_islotReadPos; ++islot) + { + if (m_vislotNextChunkMap[islot] != -1) + return islot; + } + Assert(false); + return islot; + } + +}; // end of class GrSlotStream + +} // namespace gr + + +#endif // !SLOTSTREAM_INCLUDED diff --git a/Build/source/libs/graphite/engine-2.4/src/segment/GrTableManager.cpp b/Build/source/libs/graphite/engine-2.4/src/segment/GrTableManager.cpp new file mode 100644 index 00000000000..77e2b3eea90 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/src/segment/GrTableManager.cpp @@ -0,0 +1,2712 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 1999, 2001 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: GrTableManager.cpp +Responsibility: Sharon Correll +Last reviewed: Not yet. + +Description: + GrTableManager, which handles the interactions between passes, including the demand-pull + algorithm. +-------------------------------------------------------------------------------*//*:End Ignore*/ + +//:>******************************************************************************************** +//:> Include files +//:>******************************************************************************************** +#include "Main.h" + +#ifdef _MSC_VER +#pragma hdrstop +#else +#include +#endif +#include + +//:>******************************************************************************************** +//:> Forward declarations +//:>******************************************************************************************** + +//:>******************************************************************************************** +//:> Local Constants and static variables +//:>******************************************************************************************** + +namespace gr +{ + +//:>******************************************************************************************** +//:> Methods +//:>******************************************************************************************** + +/*---------------------------------------------------------------------------------------------- + Constructors and initializers +----------------------------------------------------------------------------------------------*/ +EngineState::EngineState() + : m_ipassJustCalled(-1), + m_fStartLineContext(false), + m_fEndLineContext(false), + ////m_pgg(NULL), + m_cslotPreSeg(0), + m_islotblkCurr(-1), + m_islotNext(kSlotBlockSize), + m_fInitialLB(false), + m_fFinalLB(false), + m_fInsertedLB(false), + m_fExceededSpace(false), + m_fHitHardBreak(false), + m_fRemovedWhtsp(false), + m_dxsShrinkPossible(GrSlotState::kNotYetSet), + m_islotPosNext(-1), + m_xsPosXNext(0), + m_ysPosYNext(0), + m_dxsTotWidthSoFar(0), + m_dxsVisWidthSoFar(0), + m_prgzpst(NULL), + m_prgpsstrm(NULL) +{ + m_vslotblk.clear(); + m_vprgnSlotVarLenBufs.clear(); +} + +void EngineState::Initialize(GrEngine * pgreng, GrTableManager * ptman) +{ + m_ptman = ptman; + m_cpass = ptman->NumberOfPasses(); // duplicate for convenience + + m_cUserDefn = pgreng->NumUserDefn(); + m_cFeat = pgreng->NumFeat(); + m_cCompPerLig = pgreng->NumCompPerLig(); + + if (m_prgzpst) + delete[] m_prgzpst; + m_prgzpst = new PassState[m_cpass]; + ptman->StorePassStates(m_prgzpst); +} + +/*---------------------------------------------------------------------------------------------- + Destructors +----------------------------------------------------------------------------------------------*/ +GrTableManager::~GrTableManager() +{ + for (int ipass = 0; ipass < m_cpass; ++ipass) + delete Pass(ipass); + + delete[] m_prgppass; +} + +EngineState::~EngineState() +{ + DestroySlotBlocks(); + + delete[] m_prgzpst; + + if (m_prgpsstrm) + { + for (int isstrm = 0; isstrm < m_cpass; ++isstrm) + delete OutputStream(isstrm); + + delete[] m_prgpsstrm; + } +} + +/*---------------------------------------------------------------------------------------------- + Delete all the slots. +----------------------------------------------------------------------------------------------*/ +void EngineState::DestroySlotBlocks() +{ + Assert(m_vslotblk.size() == m_vprgnSlotVarLenBufs.size()); + for (size_t islotblk = 0; islotblk < m_vslotblk.size(); ++islotblk) + { + delete[] m_vslotblk[islotblk]; + delete[] m_vprgnSlotVarLenBufs[islotblk]; + } + m_vslotblk.clear(); + m_vprgnSlotVarLenBufs.clear(); +} + +/*---------------------------------------------------------------------------------------------- + Create the passes, and them fill them in by reading from the file stream. +----------------------------------------------------------------------------------------------*/ +bool GrTableManager::CreateAndReadPasses(GrIStream & grstrm, + int fxdSilfVersion, int fxdRuleVersion, + int cpassFont, long lSubTableStart, int * rgnPassOffsets, int * rgcbPassLengths, + int ipassSub1Font, int ipassPos1Font, int ipassJust1Font, byte ipassPostBidiFont) +{ + Assert(ipassSub1Font <= ipassJust1Font); + Assert(ipassJust1Font <= ipassPos1Font); + Assert(ipassPos1Font <= cpassFont); + if (ipassSub1Font > ipassJust1Font || ipassJust1Font > ipassPos1Font + || ipassPos1Font > cpassFont) + { + return false; // bad table + } + + // Adjusted indices based on the fact that we have a glyph generation pass that is + // pass 0, and possibly a bidi pass: + m_cpass = cpassFont + 1; + int ipassLB1, ipassSub1, ipassBidi, ipassPos1, ipassJust1; + ipassLB1 = 1; + ipassSub1 = ipassSub1Font + 1; + if (ipassPostBidiFont == 0xFF) + { + // No bidi pass. + m_fBidi = false; + // Add 1 below to account for the glyph-generation pass. + ipassPos1 = ipassPos1Font + 1; + ipassJust1 = ipassJust1Font + 1; + ipassBidi = ipassJust1; + } + else + { + m_fBidi = true; + m_cpass++; + Assert(ipassPostBidiFont == ipassJust1Font); + ipassJust1 = ipassJust1Font + 2; + ipassPos1 = ipassPos1Font + 2; + ipassBidi = ipassJust1 - 1; + } + + // Always make at least one positioning pass, even if there are no rules. + if (ipassPos1 == m_cpass) + { + m_cpass++; + } + + m_prgppass = new GrPass*[m_cpass + 1]; + m_prgppass[0] = new GrGlyphGenPass(0); + int ipass; + for (ipass = 1; ipass < m_cpass; ipass++ ) + m_prgppass[ipass] = NULL; // clear so that if loading a pass fails, we can delete the table-manager + + m_cpassLB = 0; + m_ipassJust1 = 1; + m_ipassPos1 = 1; + bool f = true; + ipass = 1; + int ipassFont = 0; + for ( ; ipass < m_cpass; ipass++, ipassFont++) + { + if (ipass < ipassSub1) + { + m_prgppass[ipass] = new GrLineBreakPass(ipass); + f = m_prgppass[ipass]->ReadFromFont(grstrm, fxdSilfVersion, fxdRuleVersion, + lSubTableStart + rgnPassOffsets[ipassFont], rgcbPassLengths[ipassFont]); + m_cpassLB++; + m_ipassJust1++; + m_ipassPos1++; + } + else if (ipassSub1 <= ipass && ipass < ipassBidi) + { + m_prgppass[ipass] = new GrSubPass(ipass); + f = m_prgppass[ipass]->ReadFromFont(grstrm, fxdSilfVersion, fxdRuleVersion, + lSubTableStart + rgnPassOffsets[ipassFont], rgcbPassLengths[ipassFont]); + m_ipassJust1++; + m_ipassPos1++; + } + else if (ipassBidi == ipass && ipass < ipassJust1) + { + m_prgppass[ipass] = new GrBidiPass(ipass); + m_prgppass[ipass]->SetTopDirLevel(TopDirectionLevel()); + ipassFont--; // no corresponding pass in font + m_ipassJust1++; + m_ipassPos1++; + f = true; + } + else if (ipassJust1 <= ipass && ipass < ipassPos1) + { + // A justification pass is, in essence, a substitution pass. + m_prgppass[ipass] = new GrSubPass(ipass); + f = m_prgppass[ipass]->ReadFromFont(grstrm, fxdSilfVersion, fxdRuleVersion, + lSubTableStart + rgnPassOffsets[ipassFont], rgcbPassLengths[ipassFont]); + m_ipassPos1++; + } + else if (ipassPos1 <= ipass) + { + m_prgppass[ipass] = new GrPosPass(ipass); + if (ipassFont < cpassFont) + { + f = m_prgppass[ipass]->ReadFromFont(grstrm, fxdSilfVersion, fxdRuleVersion, + lSubTableStart + rgnPassOffsets[ipassFont], rgcbPassLengths[ipassFont]); + } + else + { + // No positioning pass in font: create a bogus one. + m_prgppass[ipass]->InitializeWithNoRules(); + f = true; + } + } + else + { + Assert(false); + f = false; // bad table + } + + if (!f) + return false; // bad table + } + + return true; +} + +/*---------------------------------------------------------------------------------------------- + Create passes corresponding to an invalid font. +----------------------------------------------------------------------------------------------*/ +void GrTableManager::CreateEmpty() +{ + m_cpass = 2; + + m_prgppass = new GrPass*[2]; + m_prgppass[0] = new GrGlyphGenPass(0); + + m_prgppass[1] = new GrPosPass(1); + m_prgppass[1]->InitializeWithNoRules(); + + m_ipassPos1 = 1; + m_cpassLB = 0; + m_fBidi = false; + + m_engst.CreateEmpty(); +} + +void EngineState::CreateEmpty() +{ + m_fStartLineContext = false; + m_fEndLineContext = false; +} + +/*---------------------------------------------------------------------------------------------- + Create the slot streams corresponding to the passes. +----------------------------------------------------------------------------------------------*/ +void EngineState::CreateSlotStreams() +{ + if (m_prgpsstrm) + return; + + m_prgpsstrm = new GrSlotStream * [m_cpass]; + for (int ipass = 0; ipass < m_cpass; ++ipass) + { + m_prgpsstrm[ipass] = new GrSlotStream(ipass); + } +} + +/*---------------------------------------------------------------------------------------------- + Store information about the pass-states in the pass objects. +----------------------------------------------------------------------------------------------*/ +void GrTableManager::StorePassStates(PassState * rgzpst) +{ + for (int ipass = 0; ipass < m_cpass; ipass++) + Pass(ipass)->SetPassState(rgzpst + ipass); +} + +/*---------------------------------------------------------------------------------------------- + Demand-driven loop: with goal of filling up final slot stream, loop backward and forward + filling up slot streams until final stream has reached physical capacity. + + @param pgjus - justification agent; NULL if justification is of no interest + @param jmodi - (internal) justification mode + @param fStartLine, fEndLine + @param ichSegLim - known end of segment; -1 when using backtracking + @param dxWidthRequested - available width; when justifying, exact width desired + @param dxUnjustifiedWidth - when justifying, what the width would be normally + @param fNeedFinalBreak - true if the end of the segment needs to be a valid break point + @param fMoreText - true if char stream doesn't go up to text-stream lim + @param ichFontLim - end of the range that could be rendered by this font + @param fInfiniteWidth - used for "measured" segments + @param fWidthIsCharCount - kludge for test procedures: the width is a character count, + not a pixel count + @param lbPref - try for longest segment ending with this breakweight + - when justifying, lb to assume + @param lbMax - max (last resort) breakweight if no preferred break possible + @param ichwCallerBtLim - caller's backtrack lim; -1 if caller is not backtracking + @param twsh - how to handle trailing white-space + @param fParaRtl - overall paragraph direction + @param nDirDepth - direction depth of this segment +----------------------------------------------------------------------------------------------*/ +void GrTableManager::Run(Segment * psegNew, Font * pfont, + GrCharStream * pchstrm, IGrJustifier * pgjus, int jmodi, + LayoutEnvironment & layout, + int ichSegLim, + float dxWidthRequested, float dxUnjustifiedWidth, + bool fNeedFinalBreak, bool fMoreText, bool fFeatureVariations, int ichFontLim, + bool fInfiniteWidth, bool fWidthIsCharCount, + int ichwCallerBtLim, + int nDirDepth, SegEnd estJ) +{ + bool fStartLine = layout.startOfLine(); + bool fEndLine = layout.endOfLine(); + LineBrk lbPref = layout.bestBreak(); + LineBrk lbMax = layout.worstBreak(); + TrWsHandling twsh = layout.trailingWs(); + bool fParaRtl = layout.rightToLeft(); + Segment * psegPrev = layout.prevSegment(); + Segment * psegInit = layout.segmentForInit(); + std::ostream * pstrmLog = layout.loggingStream(); + + m_engst.Initialize(Engine(), this); // do this after the tables have been fully read + m_engst.m_jmodi = jmodi; + m_engst.m_ipassJustCalled = -1; + m_engst.m_twsh = twsh; + m_engst.m_fParaRtl = fParaRtl; + m_engst.m_dxsShrinkPossible = GrSlotState::kNotYetSet; + m_engst.m_fFeatureVariations = fFeatureVariations; + m_fLogging = (pstrmLog != NULL); + + int cbPrev; + byte * pbPrevSegDat = NULL; + if (psegPrev) + cbPrev = psegPrev->NextSegInitBuffer(&pbPrevSegDat); + else if (psegInit) + cbPrev = psegInit->ThisSegInitBuffer(&pbPrevSegDat); + else + cbPrev = 0; + + if (pchstrm->IsEmpty()) + { + m_engst.m_lbPrevEnd = klbNoBreak; + InitSegmentAsEmpty(psegNew, pfont, pchstrm, fStartLine, fEndLine); + psegNew->SetWidths(0, 0); + psegNew->SetUpOutputArrays(pfont, this, NULL, 0, 0, 0, twsh, + fParaRtl, nDirDepth, true); + psegNew->SetLayout(layout); + return; + } + + int islotUnderBreak = -1; // position of inserted or final break point in underlying + // data; none so far (if an actual LB has been inserted, + // this is the index of that slot; otherwise it is the + // index of the last valid slot) + int islotSurfaceBreak = -1; // position of line break in surface stream; none so far + LineBrk lbBestToTry = lbPref; + LineBrk lbFound = klbNoBreak; + + float dxMaxWidth = dxWidthRequested; + + if (m_engst.m_jmodi == kjmodiJustify) + { + Assert(fInfiniteWidth); + lbBestToTry = klbClipBreak; + lbFound = lbPref; + } + + float dxWidth; + + std::vector vnslotNeeded; + vnslotNeeded.resize(m_cpass); + + m_engst.InitializeStreams(this, pchstrm, cbPrev, pbPrevSegDat, fNeedFinalBreak, &islotUnderBreak); + + int ipassCurr; + int nNeedInput; // kNextPass: go on to the next pass + // kBacktrack: need to insert a line break + // > 0: need more input from previous pass + + int cchwPostXlbContext = m_pgreng->PostXlbContext(); + if (ichSegLim > -1) + { + // When we know exactly where the end of the segment will be, get as much as + // we need from the character stream, and then fill up the remaining streams. + // (3 below is an arbitrary number; we just want to get slightly more than + // we really need.) + vnslotNeeded[0] = ichSegLim - pchstrm->Min() + cchwPostXlbContext + 3; + for (int ipass = 1; ipass < m_cpass; ipass++) + vnslotNeeded[ipass] = 10000; + // Start at pass 0. + ipassCurr = 0; + } + else + { + // When we're doing line-breaking to find the end of the segment, use the + // demand-driven approach that tries to fill up the available space. + vnslotNeeded[m_cpass - 1] = 1; + + // Start at the last pass. (It might be more efficient to start at the first pass and + // generate a small arbitrary number of glyphs.) + ipassCurr = m_cpass - 1; + } + + while (ipassCurr < m_cpass) + { + if (ipassCurr == 0) + { + int nNeedNow = vnslotNeeded[0]; + // Zeroth pass: generate glyph IDs from the underlying input. + nNeedInput = Pass(0)->ExtendGlyphIDOutput(this, + pchstrm, OutputStream(0), ichSegLim, cchwPostXlbContext, lbPref, + nNeedNow, fNeedFinalBreak, m_engst.m_twsh, &islotUnderBreak); + Assert(nNeedInput == kNextPass || nNeedInput == kBacktrack); + vnslotNeeded[0] -= nNeedNow; + } + else if (ipassCurr < m_cpass - 1) + { + // Middle pass. + int cslotNeedNow = vnslotNeeded[ipassCurr]; + cslotNeedNow = max(1, cslotNeedNow); + int cslotGot; + Pass(ipassCurr)->ExtendOutput(this, + InputStream(ipassCurr), OutputStream(ipassCurr), cslotNeedNow, twsh, + &nNeedInput, &cslotGot, &islotUnderBreak); + vnslotNeeded[ipassCurr] -= cslotGot; + //if (nNeedInput != kNextPass && nNeedInput != kBacktrack) + // nNeedInput = max(nNeedInput, cslotNeedNow - cslotGot); + } + else // (ipassCurr == m_cpass - 1) + { + // Final pass: position and test allotted space. + float dxWidthWShrink = dxMaxWidth; + if (m_engst.m_dxsShrinkPossible != GrSlotState::kNotYetSet) + dxWidthWShrink += (int)m_engst.m_dxsShrinkPossible; + nNeedInput = Pass(ipassCurr)->ExtendFinalOutput(this, + InputStream(ipassCurr), OutputStream(ipassCurr), + dxWidthWShrink, fWidthIsCharCount, fInfiniteWidth, + (islotUnderBreak > -1), (fNeedFinalBreak && lbFound == klbNoBreak), + lbMax, twsh, + &islotSurfaceBreak, &dxWidth); + } + + if (m_engst.m_jmodi == kjmodiJustify) + { + if (ipassCurr < m_ipassJust1 && !OutputStream(ipassCurr)->FullyWritten()) + { + // When justifying, fill up all the streams up to the point where we need + // to interact with the justification routine. + // I think this code is obsolete. + int nStillNeed = 1000; + if ((ipassCurr == 1 && nNeedInput != kNextPass) || ipassCurr == 0) + nStillNeed = ichSegLim - (pchstrm->Pos() - pchstrm->Min()) + + cchwPostXlbContext + 3; + if (nStillNeed > 0) + { + if (nNeedInput == kNextPass) + ipassCurr++; // repeat this pass + nNeedInput = nStillNeed; + } + } + else if (nNeedInput == kNextPass && ipassCurr + 1 == m_ipassJust1) + { + CallJustifier(pgjus, ipassCurr, dxUnjustifiedWidth, dxWidthRequested, fEndLine); + } + } + DetermineShrink(pgjus, ipassCurr); + + if (nNeedInput == kBacktrack) + { + // Final output has overflowed its space--find (or adjust) the break point. + + bool fFoundBreak = Backtrack(&islotUnderBreak, + &lbBestToTry, lbMax, twsh, fMoreText, ichwCallerBtLim, fEndLine, &lbFound); + if (!fFoundBreak) + { + // Nothing will fit. Initialize the new segment just enough so that + // we can delete it. + InitSegmentToDelete(psegNew, pfont, pchstrm); + return; + } + } + else if (nNeedInput == kNextPass) + { + // This pass is sufficiently full--return to following pass. + ipassCurr++; + } + else + { + // Get more input from previous pass. + ipassCurr--; + vnslotNeeded[ipassCurr] = nNeedInput; + } + } + + // At this point we have fully transduced all the text for this segment. + + // Figure out why we broke the segment and what the caller is supposed to do about it. + SegEnd est; + if (m_engst.m_jmodi == kjmodiJustify) + { + // Don't change what was passed in. + est = estJ; + } + else if (m_engst.m_fRemovedWhtsp) // (islotUnderBreak > -1 && twsh == ktwshNoWs) + { + Assert(!m_engst.m_fInsertedLB); + est = kestMoreWhtsp; + } + + else if (m_engst.m_fHitHardBreak) + { + est = kestHardBreak; + } + + else if (!m_engst.m_fExceededSpace && !fMoreText) + // Rendered to the end of the original requested range. + est = kestNoMore; + +// else if (!m_fExceededSpace && !fNextIsSameWs && fMoreText) +// // Writing system break; may be more room on the line. But see tweak below. +// *pest = kestWsBreak; + + else if (m_engst.m_fExceededSpace) + { + // Exceeded available space, found a legal break. + if (twsh == ktwshNoWs && m_engst.m_fRemovedWhtsp) + est = kestMoreWhtsp; + else + est = kestMoreLines; + } + + else if (twsh == ktwshOnlyWs) + { + est = kestOkayBreak; // but see tweak below + } + + else + { + // Broke because of something like a font change. Determine whether this is a legal + // break or not. + // TODO SharonC: handle the situation where it is legal to break BEFORE the first + // character of the following segment. + Assert(fMoreText); + //Assert(fNextIsSameWs); + if (ichwCallerBtLim > -1) + { + Assert(m_engst.m_fInsertedLB); + } + else if (ichSegLim > -1) + { + // We stopped where caller said to. + Assert(fInfiniteWidth); + } + else + { + Assert(!m_engst.m_fInsertedLB); + //Assert(islotUnderBreak == -1 || m_engst.m_fFinalLB); -- no, ExtendGlyphIDOutput clearly sets islotUnderBreak regardless + } + int islotTmp = OutputStream(m_cpass - 1)->WritePos(); + GrSlotState * pslotTmp; + if (m_engst.m_fFinalLB || m_engst.m_fInsertedLB) + pslotTmp = OutputStream(m_cpass-1)->SlotAt(islotTmp - 2); + else + pslotTmp = OutputStream(m_cpass-1)->SlotAt(islotTmp - 1); + + if (abs(pslotTmp->BreakWeight()) <= lbPref) + est = kestOkayBreak; + + else if (abs(pslotTmp->BreakWeight()) > lbMax) + est = kestBadBreak; + + else if (OutputStream(m_cpassLB)->HasEarlierBetterBreak(islotUnderBreak, lbFound, + this->LBGlyphID())) + { + est = kestBadBreak; + } + else + est = kestOkayBreak; + + // We no longer have the ability to know whether or not the next segment will use + // the same writing system. + //if (est == kestBadBreak && m_engst.m_fExceededSpace && !fNextIsSameWs && fMoreText) + // est = kestWsBreak; + } + + // Make a segment out of it and return it. + int dichSegLen; + InitNewSegment(psegNew, pfont, pchstrm, pgjus, + islotUnderBreak, islotSurfaceBreak, fStartLine, fEndLine, ichFontLim, lbFound, est, + &dichSegLen); + if (psegNew->segmentTermination() == kestNothingFit) + { + return; + } + else if (psegNew->segmentTermination() == kestHardBreak && + psegNew->startCharacter() == psegNew->stopCharacter()) + { + // Empty segment caused by a hard-break. + m_engst.m_lbPrevEnd = klbNoBreak; + psegNew->SetWidths(0, 0); + psegNew->SetUpOutputArrays(pfont, this, NULL, 0, 0, 0, twsh, + fParaRtl, nDirDepth, true); + psegNew->SetLayout(layout); + return; + } + + psegNew->RecordInitializationForThisSeg(cbPrev, pbPrevSegDat); + + if ((est == kestNoMore || est == kestWsBreak) && twsh == ktwshOnlyWs && + dichSegLen < pchstrm->Lim() - pchstrm->Min()) + { + // If we are asking for white-space only, and we didn't use up everything in the font + // range, we could possibly have gotten an initial white-space only segment + // (as opposed to a writing system break). + est = kestOkayBreak; + psegNew->FixTermination(est); + } + + // Do this before fixing up the associations below. + //if (m_pgreng->LoggingTransduction()) + // WriteTransductionLog(pchstrm, *ppsegRet, + // cbPrev, pbPrevSegDat, pbNextSegDat, pcbNextSegDat); + WriteTransductionLog(pstrmLog, pchstrm, psegNew, cbPrev, pbPrevSegDat); + + RecordAssocsAndOutput(pfont, psegNew, fWidthIsCharCount, twsh, fParaRtl, nDirDepth); + + // Do this after fixing up the associations. + //if (m_pgreng->LoggingTransduction()) + // WriteAssociationLog(pchstrm, *ppsegRet); + WriteAssociationLog(pstrmLog, pchstrm, psegNew); + + psegNew->SetLayout(layout); +} + +/*---------------------------------------------------------------------------------------------- + Create a new segment to return. + + @param pchstrm - input stream + @param pgjus - justification agent, in case this segment needs to be + stretched or shrunk + @param islotLBStreamBreak - position of inserted line break slot (which should be equal + to the position in the glyph generation stream); + -1 if no line-break was inserted (we rendered to the + end of the range) + @param islotSurfaceBreak - position of line break slot in final (surface) stream + @param fStartLine - does this segment start a line? + @param fEndLine - does this segment end a line? + @param ichFontLim - end of range that could be rendered by this font + @param lbEndFound - line break found; possibly adjusted here + @param est - why did the segment terminate +----------------------------------------------------------------------------------------------*/ +void GrTableManager::InitNewSegment(Segment * psegNew, + Font * pfont, GrCharStream * pchstrm, IGrJustifier * pgjus, + int islotLBStreamBreak, int islotSurfaceBreak, bool fStartLine, bool fEndLine, int ichFontLim, + LineBrk lbEndFound, SegEnd est, int * pdichSegLen) +{ + LineBrk lbStart = m_engst.m_lbPrevEnd; + LineBrk lbEnd = lbEndFound; + if (est == kestBadBreak) + lbEnd = klbLetterBreak; + + int ichwMin = pchstrm->Min(); + int ichwLim; + +// int cslotPreSegStream0 = m_cslotPreSeg; +// if (m_fInitialLB && m_cpassLB > 0) +// { +// // Initial LB is included in m_cslotPreSeg, but is not in stream 0. +// // --Not really needed, because both islotLBStreamBreak and m_cslotPreSeg take +// // the initial LB into account if it is there. +// cslotPreSegStream0--; +// } + + // No longer have to subtract this, because the chunk map takes it into + // consideration. + //int cslotPreInitialLB = m_cslotPreSeg - (m_fInitialLB ? 1 : 0); + + //int ichwOldTmp; + + if (m_engst.m_fInsertedLB) + { + Assert(islotLBStreamBreak > -1); + int ichwSegLim = m_engst.LbSlotToSegLim(islotLBStreamBreak, pchstrm, m_cpassLB); + ichwLim = ichwSegLim + pchstrm->Min(); // - cslotPreInitialLB; + + // Old result, for debugging: + //ichwOldTmp = islotLBStreamBreak + pchstrm->Min() - m_cslotPreSeg; + } + else if (m_engst.m_fFinalLB || islotLBStreamBreak == -1) + ichwLim = pchstrm->Lim(); + else + { + int ichwSegLim = m_engst.LbSlotToSegLim(islotLBStreamBreak, pchstrm, m_cpassLB); + ichwLim = ichwSegLim + pchstrm->Min(); // - cslotPreInitialLB; + + // Old result, for debugging: + // islotLBStreamBreak is the last slot in the segment, not the LB glyph; hence +1. + //ichwOldTmp = islotLBStreamBreak + pchstrm->Min() - m_cslotPreSeg + 1; + } + + *pdichSegLen = ichwLim - ichwMin; + + if (ichwMin >= ichwLim) + { + if (est == kestHardBreak) + { + // Empty segment cause by a hard-break. + InitSegmentAsEmpty(psegNew, pfont, pchstrm, fStartLine, fEndLine); + psegNew->FixTermination(est); + } + else + { + // Invalid empty segment. + Assert(ichwMin == ichwLim); + InitSegmentToDelete(psegNew, pfont, pchstrm); + } + return; + } + + Assert(psegNew); + + psegNew->Initialize(pchstrm->TextSrc(), + ichwMin, ichwLim, + lbStart, lbEnd, est, fStartLine, fEndLine, m_pgreng->RightToLeft()); + + psegNew->SetEngine(m_pgreng); + psegNew->SetFont(pfont); + psegNew->SetJustifier(pgjus); + psegNew->SetFaceName(m_pgreng->FaceName(), m_pgreng->BaseFaceName()); + + bool fNextSegNeedsContext = + !(est == kestNoMore || est == kestWsBreak + || ichwLim >= pchstrm->Lim() || ichwLim >= ichFontLim); + + InitializeForNextSeg(psegNew, islotLBStreamBreak, islotSurfaceBreak, lbEnd, + fNextSegNeedsContext, pchstrm); + + psegNew->SetPreContext(0 - m_pgreng->PreXlbContext()); +} + +/*---------------------------------------------------------------------------------------------- + The newly created segment is invalid, for instance, because we were backtracking and + couldn't find a valid break point. Initialize it just enough so that it can be + deleted by the client. +----------------------------------------------------------------------------------------------*/ +void GrTableManager::InitSegmentToDelete(Segment * psegNew, Font * pfont, + GrCharStream * pchstrm) +{ + psegNew->Initialize(pchstrm->TextSrc(), 0, 0, + klbClipBreak, klbClipBreak, kestNothingFit, false, false, + m_pgreng->RightToLeft()); + + psegNew->SetEngine(m_pgreng); + psegNew->SetFont(pfont); + psegNew->SetJustifier(NULL); // can't justify an empty segment + psegNew->SetFaceName(m_pgreng->FaceName(), m_pgreng->BaseFaceName()); + psegNew->SetPreContext(0); +} + +/*---------------------------------------------------------------------------------------------- + Map from the given slot (which is generally the final LB slot) to the end of the segment, + taking into account the fact that a single slot may represent two 16-bit surrogates. + + There are several approaches that seem reasonable but do NOT work. (I tried them!) + You can't calculate it directly from the length of the streams, because that doesn't take + into account the possible presence of surrogate pairs in the character stream. You can't + use the chunk map at the point of the LB, because if a rule spanned a LB the chunk won't + have ended there and so there won't be any valid information. + + What seems to work is to figure out the slot(s) in the zeroth stream using the associations + and then use the segment offset for this slot. This should be reliable because there is + always a one-to-one correspondence between glyphs in the line-break passes (ie, no + insertions or deletions), so the associations should be dependable and straightforward. +----------------------------------------------------------------------------------------------*/ +int EngineState::LbSlotToSegLim(int islotLB, GrCharStream * pchstrm, int cpassLB) +{ + Assert(islotLB < OutputStream(cpassLB)->WritePos()); + + // Figure out the corresponding characters in the zeroth stream. These should be straight- + // forward to figure out because no substitutions are permitted in the LB passes. + // I do the slots before and after the LB, if possible, as a sanity check. + GrSlotStream * psstrmLB = OutputStream(cpassLB); + GrSlotState * pslotPreLB = (m_fFinalLB || m_fInsertedLB) ? + psstrmLB->SlotAt(islotLB - 1) : + psstrmLB->SlotAt(islotLB); + GrSlotState * pslotPostLB = (psstrmLB->WritePos() > islotLB + 1) ? + psstrmLB->SlotAt(islotLB + 1) : + NULL; + + int ichwPreLB = pslotPreLB->AfterAssoc(); + + int ichwSegLim; + if (pslotPostLB) + { + ichwSegLim = pslotPostLB->BeforeAssoc(); + Assert(ichwPreLB + 1 == ichwSegLim + || ichwPreLB + 2 == ichwSegLim); // in case of a surrogate + } + else + { + ichwSegLim = ichwPreLB + 1; + while (!pchstrm->AtUnicodeCharBoundary(ichwSegLim)) + ichwSegLim++; + Assert(pchstrm->AtUnicodeCharBoundary(ichwSegLim)); + } + + // Old buggy routine that doesn't handle the case where a rule (and hence the chunk map) did + // not end at the LB character: + // Map backwards through the LB pass streams, if any. + //int islotAdjusted = islotLB + 1; // after the LB + //for (int ipass = m_cpassLB; ipass > 0; ipass--) + //{ + // islotAdjusted = ChunkInPrev(ipass, islotAdjusted, pchstrm); + //} + // + //int ichwSegLim = ChunkInPrev(0, islotAdjusted, pchstrm); + + // Mapping from 32-bit to 16-bit should only increase the index. Except that there + // may be a LB in the slot stream that is not in the character stream, so it could be + // one less. + Assert(ichwSegLim + m_cslotPreSeg >= islotLB - 1); + + return ichwSegLim; +} + +/*---------------------------------------------------------------------------------------------- + Return the chunk mapping into the previous stream, taking into account the fact that it + is not recorded for the write-position. +----------------------------------------------------------------------------------------------*/ +int GrTableManager::ChunkInPrev(int ipass, int islot, GrCharStream * pchstrm) +{ + GrSlotStream * psstrmOut = OutputStream(ipass); + GrSlotStream * psstrmIn = (ipass == 0) ? NULL : InputStream(ipass); + + int islotTmp = islot; + int islotAdjusted; + do { + if (islot >= psstrmOut->WritePos()) + { + Assert(islot == psstrmOut->WritePos()); + islotAdjusted = (ipass == 0) ? pchstrm->SegOffset() : psstrmIn->ReadPos(); + Assert(islotAdjusted > -1); + } + else + islotAdjusted = psstrmOut->ChunkInPrev(islotTmp); + islotTmp--; + } while (islotAdjusted == -1); + + return islotAdjusted; +} + +/*---------------------------------------------------------------------------------------------- + Create a new segment corresponding to an empty string. + + @param pchstrm - input stream + @param fStartLine - does this segment start a line? + @param fEndLine - does this segment end a line? +----------------------------------------------------------------------------------------------*/ +void GrTableManager::InitSegmentAsEmpty(Segment * psegNew, Font * pfont, + GrCharStream * pchstrm, bool fStartLine, bool fEndLine) +{ + LineBrk lbStart = m_engst.m_lbPrevEnd; + LineBrk lbEnd = klbNoBreak; + + int ichwMin = 0; + int ichwLim = 0; + + Assert(psegNew); + + psegNew->Initialize(pchstrm->TextSrc(), ichwMin, ichwLim, + lbStart, lbEnd, kestNoMore, fStartLine, fEndLine, m_pgreng->RightToLeft()); + + psegNew->SetEngine(m_pgreng); + psegNew->SetFont(pfont); + psegNew->SetJustifier(NULL); // can't justify an empty segment + psegNew->SetFaceName(m_pgreng->FaceName(), m_pgreng->BaseFaceName()); + + byte pbNextSegDat[256]; + int cbNextSegDat; + int * pcbNextSegDat = &cbNextSegDat; + + // Initialization for (theoretical) next segment. + byte * pb = pbNextSegDat; + *pb++ = byte(lbEnd); + *pb++ = kdircNeutral; + *pb++ = kdircNeutral; + *pb++ = 0; + for (int ipass = 0; ipass < m_cpass; ipass++) + *pb++ = 0; + *pcbNextSegDat = 0; + psegNew->RecordInitializationForNextSeg(*pcbNextSegDat, pbNextSegDat); + + psegNew->SetPreContext(0); +} + +/*---------------------------------------------------------------------------------------------- + Find a line-break and unwind the passes. Return true if we were able to + backtrack successfully (which may have meant using a less-than-optimal line-break). + Return false if no line-break could be found (because maxBreakWeight did not allow + letter breaks or clipping--generally because there was already something on this + line). + + @param pislotPrevBreak - position of previously-created break, -1 if none; + this is the index of the line-break glyph if any, + or the index of the last slot in the segment; + adjusted to contain the position of the newly + found break + @param plbMin - minimum (best) line break weight to try + @param lbMax - maximum (worst possible) line break weight + @param twsh - how to handle trailing white-space + @param fMoreText - true if char stream doesn't go up to original lim + @param ichwCallerBtLim - caller's backtrack lim; -1 if caller is not backtracking + @param plbFound - kind of line-break created +----------------------------------------------------------------------------------------------*/ +bool GrTableManager::Backtrack(int * pislotPrevBreak, + LineBrk * plbMin, LineBrk lbMax, TrWsHandling twsh, bool /*fMoreText*/, + int ichwCallerBtLim, bool fEndLine, + LineBrk * plbFound) +{ + int islotStartTry; + //if (*pislotPrevBreak == ichwCallerBtLim - 1) + //{ + // islotStartTry = *pislotPrevBreak; + //} + //else + if (*pislotPrevBreak == -1) + { + // If no line break has been found so far, figure out where to start trying based + // on where the final stream choked. + GrSlotStream * psstrmFinal = OutputStream(m_cpass-1); + if ((islotStartTry + = m_engst.TraceStreamZeroPos(psstrmFinal->WritePos()-1, TopDirectionLevel())) + == -1) + { + // Just start looking at the end of what's been generated. + islotStartTry = OutputStream(m_cpassLB)->ReadPos() - 1; + } + } + else + { + // Start just before previous line break. + if (m_engst.m_fInsertedLB || m_engst.m_fFinalLB) + islotStartTry = *pislotPrevBreak - 2; // skip inserted LB and previous slot + else + islotStartTry = *pislotPrevBreak - 1; // skip previous slot + } + if (ichwCallerBtLim > -1 && islotStartTry > ichwCallerBtLim - 1) + { + islotStartTry = ichwCallerBtLim - 1; + } + + // Determine if we want to insert an actual line-break "glyph". Don't do that if + // we are omitting trailing white space or we are at a writing-system or font break. + bool fInsertLB; + if (twsh == ktwshNoWs) + // omitting trailing white-space + fInsertLB = false; + + // These rules seem more complicated than what is necessary... :-/ + //else if (twsh == ktwshOnlyWs) + // // trailing white-space segment + // fInsertLB = true; + //else if (ichwCallerBtLim > -1) + // // backtracking + // fInsertLB = true; + //else if (*pislotPrevBreak > -1) + // // no longer at the edge of the writing system or font + // fInsertLB = true; + //else if (!fMoreText) + // // at final edge of total range to render + // fInsertLB = true; + //else + // fInsertLB = false; + + else if (!fEndLine) + fInsertLB = false; + else + fInsertLB = true; + + // Try to insert a line-break in the output of the (final) line-break pass (if any, or + // the output of the glyph-generation pass). First try the preferred (strictest) + // break weight and gradually relax. + LineBrk lb = *plbMin; + Assert(*plbMin <= lbMax); + GrSlotStream * psstrmLB = OutputStream(m_cpassLB); + islotStartTry = min(islotStartTry, psstrmLB->WritePos() - 1); + int islotNewBreak = -1; + while (lb <= lbMax) + { + LineBrk lbNextToTry; + if (fInsertLB) + { + islotNewBreak = psstrmLB->InsertLineBreak(this, + *pislotPrevBreak, m_engst.m_fInsertedLB, islotStartTry, + lb, twsh, m_engst.m_cslotPreSeg, &lbNextToTry); + } + else + { + islotNewBreak = psstrmLB->MakeSegmentBreak(this, + *pislotPrevBreak, m_engst.m_fInsertedLB, islotStartTry, + lb, twsh, m_engst.m_cslotPreSeg, &lbNextToTry); + } + if (islotNewBreak > -1) + break; + if (lb >= lbMax) + break; + lb = IncLineBreak(lb); // relax the break weight + } + + if (islotNewBreak == -1) + { + return false; + } + + // We've successfully inserted a line break. + + if (fInsertLB) + m_engst.m_fInsertedLB = true; + + m_engst.m_fFinalLB = false; + + UnwindAndReinit(islotNewBreak); + + *pislotPrevBreak = islotNewBreak; + *plbMin = lb; // return the best break we were able to find, so we don't keep trying + // for a better one when we know now that we can't find it + *plbFound = lb; + + return true; +} + +/*---------------------------------------------------------------------------------------------- + This method is called after backtracking or removing trailing white-space. + Unwind the following slot streams as necessary depending on where the change was made. + + @param islotNewBreak - in output of (final) line-break pass +----------------------------------------------------------------------------------------------*/ +void GrTableManager::UnwindAndReinit(int islotNewBreak) +{ + OutputStream(m_cpassLB)->ZapCalculatedDirLevels(islotNewBreak); + + // Mark the passes before the line-break pass as fully written, so that if there + // isn't a line-break glyph to intercept, we don't keep trying to get more input + // from them. + int ipass; + for (ipass = 1; ipass < m_cpassLB + 1; ++ipass) + { + InputStream(ipass)->MarkFullyWritten(); + } + + // Unwind the passes to the changed positions. + // Note that we don't need to unwind pass 0, since all it does is generate glyph IDs. + // Also we don't need to unwind the line-break passes, because conceptually they happen + // before the break is inserted. + + int islotChgPos = islotNewBreak; + bool fFirst = true; + for (ipass = m_cpassLB + 1 ; ipass < m_cpass ; ++ipass) + { + islotChgPos = + Pass(ipass)->Unwind(this, islotChgPos, InputStream(ipass), OutputStream(ipass), + fFirst); + fFirst = false; + } + // For anything that may have been skipped in the final output: + OutputStream(m_cpass - 1)->SetReadPos(0); + OutputStream(m_cpass - 1)->SetReadPosMax(0); + Pass(m_cpass - 1)->UndoResyncSkip(); + OutputStream(m_cpass - 1)->ClearSlotsSkippedToResync(); + + m_engst.InitPosCache(); + + m_engst.m_dxsShrinkPossible = GrSlotState::kNotYetSet; // recalculate it +} + +/*---------------------------------------------------------------------------------------------- + Store information in the newly created segment that will allow us to reinitalize + the streams in order to process the next segment, appropriately handling any + cross-line-boundary contextuals. + + The information required is the number of glyphs in the first stream that must + be reprocessed, and a skip-offset between each stream indicating the beginning + of chunk boundaries. + + In most cases, where there are no cross-line-boundary contextuals, all these numbers + will be zero. + + The buffer generated is of the following format (all are 1 byte, unsigned): + end breakweight + previous strong directionality code + previous terminator dir code + restart backup + skip offsets for each pass + This format must match what is generated by InitializeStreams. + + @param pseg - newly created segment + @param islotUnderBreak - position of line break inserted in underlying stream (output + of glyph-generation pass--stream 0); -1 if we rendered to + the end of the range + @param islotSurfaceBreak - position of line break in surface stream; + -1 if we rendered to the end of the range + @param lbEnd - kind of line-break at the end of this segment + @param fNextSegNeedsContext - true if we need to remember the context for the next seg + @param pchstrm - character stream input for this segment + @param cbNextMax - amount of space available in the buffer + @param pbNextSegDat - buffer for initializing next segment + @param pcbNextSegDat - amount of space used in buffer +----------------------------------------------------------------------------------------------*/ +void GrTableManager::InitializeForNextSeg(Segment * pseg, + int islotUnderBreak, int islotSurfaceBreak, LineBrk lbEnd, + bool fNextSegNeedsContext, GrCharStream * pchstrm) +{ + byte pbNextSegDat[256]; + int cbNextSegDat; + int * pcbNextSegDat = &cbNextSegDat; + + std::vector vcslotSkipOffsets; + vcslotSkipOffsets.resize(m_cpass); + + byte * pb = pbNextSegDat; + + if (!fNextSegNeedsContext) + { + // No contextualization between this segment and the next, whatever kind of renderer + // it might use. + *pcbNextSegDat = 0; + return; + } + + gid16 chwLB = LBGlyphID(); + + int islotUnderLim = islotUnderBreak; + if (!m_engst.m_fInsertedLB && !m_engst.m_fFinalLB) + // Then islotUnderBreak is the position of the last slot in the segment; increment + // to get the lim in stream zero. + islotUnderLim++; + + int islotSurfaceLim = islotSurfaceBreak; + if (islotSurfaceLim == -1) + islotSurfaceLim = OutputStream(m_cpass - 1)->FinalSegLim(); + + *pb++ = byte(lbEnd); + + // Find previous strong and terminator directionality codes. + + GrSlotStream * psstrm = OutputStream(m_cpass - 1); + DirCode dircStrong = kdircNeutral; + DirCode dircTerm = kdircNeutral; + int islot; + for (islot = islotSurfaceLim; islot-- > 0; ) + { + GrSlotState * pslot = psstrm->SlotAt(islot); + DirCode dirc = pslot->Directionality(); + if (dircTerm == kdircNeutral && dirc == kdircEuroTerm) + dircTerm = dirc; + if (StrongDir(dirc)) + { + dircStrong = dirc; + break; + } + } + *pb++ = byte(dircStrong); + *pb++ = byte(dircTerm); + + // Record how much of each pass to redo in the next segment. + // The basic algorithm is described in the "WR Data Transform Engine" document. + // But here we are doing a variation on what is described there. We are calculating + // the backup locations for BOTH the rule start locations and the necessary pre-contexts. + // It is the precontext values that are recorded for use by the following segment. But we + // also calculate the positions for the rule-start locations to make sure there is enough + // pre-context at each pass. + + int islotRS = islotSurfaceLim; // rule-start positions + int islotPC = islotRS; // to handle pre-context positions + + // If line-breaks are irrelevant to this font, we don't need to bother. + bool fGiveUp = !m_pgreng->LineBreakFlag(); + + int ipass; + for (ipass = m_cpass - 1; ipass >= 0 && !fGiveUp; --ipass) + { + GrSlotStream * psstrmIn = (ipass == 0) ? NULL : InputStream(ipass); + GrSlotStream * psstrmOut = OutputStream(ipass); + int islotBackupMin = (ipass == 0) ? 0 : psstrmOut->SegMin(); + if (ipass >= m_cpassLB && m_engst.m_fInitialLB) + islotBackupMin++; // how far we can back up--not before the start of this segment + + int islotPrevRS = 0; // corresponding slot in the previous stream for rule-start position + int islotPrevPC = 0; // same for pre-context position + + // Initially we have to include at least this many prior slots: + int cslotSkipOffset = 0; + + if (islotRS == psstrmOut->WritePos()) + { + islotPrevRS = (ipass == 0) ? pchstrm->Pos() : psstrmIn->ReadPos(); + } + else + { + // Ignore the final line-break, because it is explicitly inserted during + // the (final) line-break pass. +// if (ipass == m_cpassLB && psstrm->SlotAt(islotRS)->IsFinalLineBreak(chwLB)) +// { +// Assert(islotRS > 0); +// islotRS--; +// } + // Ignore the chunk in the pass that generated the line break that corresponds + // to the inserted line break being chunked with the previous glyph--we don't + // want to treat that as a cross-line-boundary contextual! + if (ipass == m_cpassLB && psstrmOut->SlotAt(islotRS)->IsFinalLineBreak(chwLB)) + { +// Assert(psstrm->ChunkInPrev(islotRS) == -1); + if (islotRS + 1 == psstrmOut->WritePos()) + islotPrevRS = (ipass == 0) ? pchstrm->SegOffset() : psstrmIn->ReadPos(); + else + islotPrevRS = psstrmOut->ChunkInPrev(islotRS + 1); + } + else + { + // Back up to the beginning of a chunk. + while (islotRS >= islotBackupMin && + (islotPrevRS = psstrmOut->ChunkInPrev(islotRS)) == -1) + { + --islotRS; + //++cslotSkipOffset; + } + } + } + if (islotPrevRS == -1 || islotRS < islotBackupMin) // hit the start of the segment + { + // In order to get enough context to be sure to run the same rules again, + // we'd have to back up into the previous segment. Too complicated, so give up. + fGiveUp = true; + break; + } + + int cslotPreContext = Pass(ipass)->MaxRulePreContext(); +LBackupPC: + if (islotPC == psstrmOut->WritePos()) + { + islotPrevPC = (ipass == 0) ? pchstrm->Pos() : psstrmIn->ReadPos(); + } + else + { + if (ipass == m_cpassLB && psstrmOut->SlotAt(islotPC)->IsFinalLineBreak(chwLB)) + { + if (islotPC+1 == psstrmOut->WritePos()) + islotPrevPC = (ipass == 0) ? pchstrm->SegOffset() : psstrmIn->ReadPos(); + else + islotPrevPC = psstrmOut->ChunkInPrev(islotPC+1); + } + else + { + // Back up to the beginning of a chunk; also make sure there are enough slots + // to handle the required pre-context for this pass. + while (islotPC >= islotBackupMin && + ((islotPrevPC = psstrmOut->ChunkInPrev(islotPC)) == -1 || + islotPrevRS - islotPrevPC < cslotPreContext)) + { + --islotPC; + ++cslotSkipOffset; + } + } + } + if (islotPC >= islotBackupMin && islotPrevRS - islotPrevPC < cslotPreContext) + { + --islotPC; + ++cslotSkipOffset; + goto LBackupPC; + } + if (islotPrevPC == -1 || islotPC < islotBackupMin) // hit the start of the segment + { + fGiveUp = true; + break; + } + + vcslotSkipOffsets[ipass] = cslotSkipOffset; + + islotRS = islotPrevRS; + islotPC = islotPrevPC; + + if (ipass == 0) + { + // Convert from underlying chars to stream-zero slots. + islotRS += m_engst.m_cslotPreSeg; + islotPC += m_engst.m_cslotPreSeg; + } + } + + // The following should be the case unless they tried to position contextually across + // the line break boundary, which is a very strange thing to do! - no longer true, + // because the pre-context is now included in this count, and it normal to have + // a pre-context in the final positioning pass. + //Assert(vcslotSkipOffsets[m_cpass-1] == 0); + + // Also no adjustments are made by the glyph-generation pass, so this should always + // be true: + Assert(vcslotSkipOffsets[0] == 0); + + // The number of slots in the underlying input previous to the line-break + // that must be reprocessed: + int cslotPreLB = islotUnderLim - islotPC; + + if (fGiveUp) + { + // We can't reasonably provide enough context, so don't try to do it at all. + cslotPreLB = 0; + for (ipass = 0; ipass < m_cpass; ipass++) + vcslotSkipOffsets[ipass] = 0; + } + + Assert(cslotPreLB >= 0); + Assert(cslotPreLB < 0xFF); + + *pb++ = byte(cslotPreLB); + for (ipass = 0; ipass < m_cpass; ipass++) + *pb++ = byte(vcslotSkipOffsets[ipass]); + + *pcbNextSegDat = 4 + m_cpass; + + pseg->RecordInitializationForNextSeg(*pcbNextSegDat, pbNextSegDat); +} + +/*---------------------------------------------------------------------------------------------- + Calculate the associations, and record the output slots in the segment. +----------------------------------------------------------------------------------------------*/ +void GrTableManager::RecordAssocsAndOutput(Font * pfont, + Segment * pseg, bool /*fWidthIsCharCount*/, + TrWsHandling twsh, bool fParaRtl, int nDirDepth) +{ + int cchwUnderlying = pseg->stopCharacter() - pseg->startCharacter(); + + GrSlotStream * psstrmFinal = OutputStream(m_cpass-1); + int csloutSurface = psstrmFinal->WritePos() - psstrmFinal->IndexOffset(); // # of output slots + + psstrmFinal->SetNeutralAssociations(LBGlyphID()); + + float xsTotalWidth, xsVisWidth; + + // Make sure the final positions are set for every glyph. + CalcPositionsUpTo(m_cpass-1, reinterpret_cast(NULL), false, + &xsTotalWidth, &xsVisWidth); + pseg->SetWidths(xsVisWidth, xsTotalWidth); + + pseg->SetUpOutputArrays(pfont, this, psstrmFinal, cchwUnderlying, csloutSurface, LBGlyphID(), + twsh, fParaRtl, nDirDepth); + + // Set underlying-to-surface assocations in the segment. + CalculateAssociations(pseg, csloutSurface); +} + +/*---------------------------------------------------------------------------------------------- + Calculate the underlying-to-surface associations and ligature mappings. + Assumes the arrays have been properly initialized. +----------------------------------------------------------------------------------------------*/ +void GrTableManager::CalculateAssociations(Segment * pseg, int /*csloutSurface*/) +{ + GrSlotStream * psstrmFinal = OutputStream(m_cpass-1); + + std::vector vichwAssocs; + std::vector vichwComponents; + std::vector vicomp; + + for (int islot = psstrmFinal->IndexOffset(); islot < psstrmFinal->WritePos(); islot++) + { + GrSlotState * pslot = psstrmFinal->SlotAt(islot); + int islout = islot - psstrmFinal->IndexOffset(); + if (!pslot->IsLineBreak(LBGlyphID())) + { + vichwAssocs.clear(); + pslot->AllAssocs(vichwAssocs); + + size_t iichw; + for (iichw = 0; iichw < vichwAssocs.size(); ++iichw) + { + pseg->RecordSurfaceAssoc(vichwAssocs[iichw], islout, 0); + } + + vichwComponents.clear(); + vicomp.clear(); + if (pslot->HasComponents()) + pslot->AllComponentRefs(vichwComponents, vicomp); + + for (iichw = 0; iichw < vichwComponents.size(); iichw++) + { + pseg->RecordLigature(vichwComponents[iichw], islout, vicomp[iichw]); + } + } + } + + AdjustAssocsForOverlaps(pseg); + pseg->CleanUpAssocsVectors(); + +// pseg->AdjustForOverlapsWithPrevSeg(); // for any characters officially in the + // previous segment but rendered in this one, + // or vice versa + + // TODO SharonC: for all characters that are right-to-left in the underlying stream, + // reverse the before and after flags in the segment. +} + +/*---------------------------------------------------------------------------------------------- + For any slots associated with characters in the new segment but not rendered in the + segment, adjust the underlying-to-surface mappings accordingly. Ie, set the before + mapping to kNegInfinity for slots at the beginning of the streams, and set the + after mapping to kPosInfinity for slots at the end of the streams. + + TODO SharonC: Rework this method more carefully to handle each slot exactly once. The current + approach could possibly, for instance, process a slot that is inserted in one pass + and deleted in the next. +----------------------------------------------------------------------------------------------*/ +void GrTableManager::AdjustAssocsForOverlaps(Segment * pseg) +{ + if (!m_engst.m_fInitialLB && !m_engst.m_fFinalLB && !m_engst.m_fInsertedLB) + // no cross-line contextualization possible + return; + + gid16 chwLB = LBGlyphID(); + std::vector vichwAssocs; + + // Process any slots output by any substitution pass (or later) on either side of the + // line-breaks. These are the relevant slots that are rendered in the previous and + // following segments. + for (int ipass = m_cpass; ipass-- > m_cpassLB + 1; ) + { + GrSlotStream * psstrm = OutputStream(ipass); + int islotMin = (ipass == m_cpass - 1) ? psstrm->IndexOffset() : 0; + + if (m_engst.m_fInitialLB) + { + for (int islot = islotMin; ; islot++) + { + GrSlotState * pslot = psstrm->SlotAt(islot); + if (pslot->IsInitialLineBreak(chwLB)) + break; + Assert(!pslot->IsFinalLineBreak(chwLB)); + if (pslot->PassModified() != ipass) + continue; + + vichwAssocs.clear(); + pslot->AllAssocs(vichwAssocs); + for (size_t iichw = 0; iichw < vichwAssocs.size(); ++iichw) + pseg->MarkSlotInPrevSeg(vichwAssocs[iichw], islot); + } + } + + if ((m_engst.m_fFinalLB || m_engst.m_fInsertedLB) && ipass > m_cpassLB) + { + for (int islot = psstrm->WritePos(); islot-- > islotMin ; ) + { + GrSlotState * pslot = psstrm->SlotAt(islot); + if (pslot->IsFinalLineBreak(chwLB)) + break; + Assert(!pslot->IsInitialLineBreak(chwLB)); + if (pslot->PassModified() != ipass) + continue; + + vichwAssocs.clear(); + pslot->AllAssocs(vichwAssocs); + for (size_t iichw = 0; iichw < vichwAssocs.size(); ++iichw) + pseg->MarkSlotInNextSeg(vichwAssocs[iichw], islot); + } + } + } +} + +/*---------------------------------------------------------------------------------------------- + Initialize all the streams. In particular, process the information about the + skip-offsets to handle segments other than the first. + + @param cbPrev - number of bytes in the pbPrevSegDat buffer + @param pbPrevSegDat - buffer in the following format (all are 1 byte, unsigned): + prev seg's end breakweight + prev seg's previous strong directionality code + prev seg's previous terminator dir code + restart backup + skip offsets for each pass + This format must match what is generated by InitializeForNextSeg. +----------------------------------------------------------------------------------------------*/ +void EngineState::InitializeStreams(GrTableManager * ptman, + GrCharStream * pchstrm, + int cbPrev, byte * pbPrevSegDat, bool fNeedFinalBreak, int * pislotFinalBreak) +{ + int cpassLB = ptman->NumberOfLbPasses(); + int ipassPos1 = ptman->FirstPosPass(); + + CreateSlotStreams(); + + int cslotBackup = 0; + + InitForNewSegment(ptman); + + if (cbPrev == 0) + { + m_lbPrevEnd = klbNoBreak; + m_dircInitialStrongDir = kdircNeutral; + m_dircInitialTermDir = kdircNeutral; + for (int ipass = 0; ipass < m_cpass; ++ipass) + { + OutputStream(ipass)->Initialize(ipassPos1, false); + m_prgzpst[ipass].SetResyncSkip(0); + + if (ptman->LoggingTransduction()) + m_prgzpst[ipass].InitializeLogInfo(); + } + } + else + { + Assert(cbPrev >= 4); + byte * pb = pbPrevSegDat; + + m_lbPrevEnd = LineBrk(*pb++); + + // Directionality codes from the previous segment. + m_dircInitialStrongDir = DirCode((int)*pb++); + m_dircInitialTermDir = DirCode((int)*pb++); + + cslotBackup = (int)*pb++; + Assert((cbPrev == 4 || cslotBackup == 0) || cbPrev == m_cpass + 4); + + for (int ipass = 0; ipass < m_cpass; ++ipass) + { + OutputStream(ipass)->Initialize(ipassPos1, true); + if (cbPrev == 4) + m_prgzpst[ipass].SetResyncSkip(0); // different writing system + else + m_prgzpst[ipass].SetResyncSkip(*pb++); + + if (ptman->LoggingTransduction()) + m_prgzpst[ipass].InitializeLogInfo(); + } + + pchstrm->Backup(cslotBackup); + } + + if (cbPrev > 0 || pchstrm->StartLine()) + { + // Go ahead and run the initial line-break passes (if any), and then insert + // a line-break at the appropriate place where the new segment will begin. + int cslotToGet = cslotBackup; +LGetMore: + ptman->Pass(0)->ExtendGlyphIDOutput(ptman, pchstrm, OutputStream(0), + -1, 0, klbWordBreak, + cslotToGet, fNeedFinalBreak, m_twsh, pislotFinalBreak); + OutputStream(0)->SetSegMin(cslotBackup); + for (int ipass = 1; ipass <= cpassLB; ipass++) + { + if (cslotToGet > 0) + { + int nRet = kNextPass; + int cslotGot; + ptman->Pass(ipass)->ExtendOutput(ptman, + InputStream(ipass), OutputStream(ipass), + cslotToGet, m_twsh, &nRet, &cslotGot, pislotFinalBreak); + if (nRet != kNextPass) + { + cslotToGet = 1; + goto LGetMore; + } + } + OutputStream(ipass)->SetSegMin(cslotBackup); + } + Assert(OutputStream(cpassLB)->WritePos() >= cslotBackup); + m_cslotPreSeg = cslotBackup; + if (pchstrm->StartLine()) + { + OutputStream(cpassLB)->AppendLineBreak(ptman, pchstrm, m_lbPrevEnd, + (ptman->RightToLeft() ? kdircRlb : kdircLlb), cslotBackup, true, -1); + SetInitialLB(); + m_cslotPreSeg++; + if (cpassLB > 0 && *pislotFinalBreak > -1) + // See corresponding kludge in GrPass::ExtendGlyphIDOutput. + *pislotFinalBreak += 1; + } + else + { + OutputStream(cpassLB)->SetSegMin(cslotBackup); + } + OutputStream(cpassLB)->CalcIndexOffset(ptman); + } + + else + { + Assert(cslotBackup == 0); + OutputStream(0)->SetSegMin(0); + m_cslotPreSeg = 0; + } +} + +/*---------------------------------------------------------------------------------------------- + Reinitialize as we start to generate a new segment. +----------------------------------------------------------------------------------------------*/ +void EngineState::InitForNewSegment(GrTableManager * ptman) +{ + // Set up a fresh batch of slots. + DestroySlotBlocks(); + m_islotblkCurr = -1; + m_islotNext = kSlotBlockSize; + + m_fInitialLB = false; + m_fFinalLB = false; + m_fInsertedLB = false; + m_fExceededSpace = false; + m_fHitHardBreak = false; + m_fRemovedWhtsp = false; + InitPosCache(); + //////m_pgg = pgg; + + for (int ipass = 0; ipass < m_cpass; ipass++) + m_prgzpst[ipass].InitForNewSegment(ipass, ptman->Pass(ipass)->MaxRuleContext()); +} + +/*---------------------------------------------------------------------------------------------- + Calculate the position in stream zero of the given slot in the final stream, + based on the associations. (This will be the same as the position at the end of the + line-break passes, which is really what we want.) + + @param islotFinal - index of the final slot in the final stream +----------------------------------------------------------------------------------------------*/ +int EngineState::TraceStreamZeroPos(int islotFinal, int nTopDir) +{ + GrSlotStream * psstrmFinal = OutputStream(m_cpass - 1); + if (psstrmFinal->WritePos() == 0) + return -1; + + GrSlotState * pslot = psstrmFinal->SlotAt(islotFinal); + + // If we're in the middle of reordered bidi stuff, just use the end of the stream. + if (pslot->DirLevel() > nTopDir) + return -1; + + int islot = pslot->BeforeAssoc(); + if (islot == kPosInfinity || islot < 0) + return -1; + return islot + m_cslotPreSeg; +} + +/*---------------------------------------------------------------------------------------------- + Return the next higher (more relaxed, less desirable) line break weight. +----------------------------------------------------------------------------------------------*/ +LineBrk GrTableManager::IncLineBreak(LineBrk lb) +{ + Assert(lb != klbClipBreak); + return (LineBrk)((int)lb + 1); +} + +/*---------------------------------------------------------------------------------------------- + Return a pointer to a slot that is near the current position in the given stream. + Return NULL if no slots have been output at all. + This is used for initializing features of line-break slots. + @param ipassArg - pass at which to start looking + @param islot - slot to look for; -1 if considering the current position +----------------------------------------------------------------------------------------------*/ +GrSlotState * EngineState::AnAdjacentSlot(int ipassArg, int islot) +{ + int ipass = ipassArg; + while (ipass >= 0) + { + GrSlotStream * psstrm = OutputStream(ipass); + if (psstrm->NumberOfSlots() > 0) + { + if (islot == -1) + { + if (psstrm->AtEnd()) + return psstrm->SlotAt(psstrm->WritePos() - 1); + else + return psstrm->Peek(); + } + else + { + if (psstrm->WritePos() <= islot) + return psstrm->SlotAt(psstrm->WritePos() - 1); + else + return psstrm->SlotAt(islot); + } + } + ipass--; + } + return NULL; +} + +/*---------------------------------------------------------------------------------------------- + Simple access methods. +----------------------------------------------------------------------------------------------*/ +GrEngine * GrTableManager::Engine() +{ + return m_pgreng; +} + +EngineState * GrTableManager::State() +{ + return &m_engst; +} + +GrEngine * EngineState::Engine() +{ + return m_ptman->Engine(); +} + +GrTableManager * EngineState::TableManager() +{ + return m_ptman; +} + +/*---------------------------------------------------------------------------------------------- + Memory management for slots +----------------------------------------------------------------------------------------------*/ + +// standard for pass 0 slots +void EngineState::NewSlot( + gid16 gID, GrFeatureValues fval, int ipass, int ichwSegOffset, int nUnicode, + GrSlotState ** ppslotRet) +{ + NextSlot(ppslotRet); + (*ppslotRet)->Initialize(gID, Engine(), fval, ipass, ichwSegOffset, nUnicode); +} + +// line-break slots +void EngineState::NewSlot( + gid16 gID, GrSlotState * pslotFeat, int ipass, int ichwSegOffset, + GrSlotState ** ppslotRet) +{ + NextSlot(ppslotRet); + (*ppslotRet)->Initialize(gID, Engine(), pslotFeat, ipass, ichwSegOffset); +} + +// for inserting new slots after pass 0 (under-pos and unicode are irrelevant) +void EngineState::NewSlot( + gid16 gID, GrSlotState * pslotFeat, int ipass, + GrSlotState ** ppslotRet) +{ + NextSlot(ppslotRet); + (*ppslotRet)->Initialize(gID, Engine(), pslotFeat, ipass); +} + +// for making a new version of the slot initialized from the old +void EngineState::NewSlotCopy(GrSlotState * pslotCopyFrom, int ipass, + GrSlotState ** ppslotRet) +{ + NextSlot(ppslotRet); + (*ppslotRet)->InitializeFrom(pslotCopyFrom, ipass); +} + +void EngineState::NextSlot(GrSlotState ** ppslotRet) +{ + int cnExtraPerSlot = m_cUserDefn + (m_cCompPerLig * 2) + m_cFeat; + if (m_islotNext >= kSlotBlockSize) + { + // Allocate a new block of slots + GrSlotState * slotblkNew = new GrSlotState[kSlotBlockSize]; + u_intslot * prgnSlotBuf = new u_intslot[kSlotBlockSize * cnExtraPerSlot]; + + m_vslotblk.push_back(slotblkNew); + m_vprgnSlotVarLenBufs.push_back(prgnSlotBuf); + m_islotblkCurr++; + m_islotNext = 0; + Assert((unsigned)m_islotblkCurr == m_vslotblk.size()-1); + } + + *ppslotRet = m_vslotblk[m_islotblkCurr] + m_islotNext; + (*ppslotRet)->BasicInitialize(m_cUserDefn, m_cCompPerLig, m_cFeat, + (m_vprgnSlotVarLenBufs[m_islotblkCurr] + (m_islotNext * cnExtraPerSlot))); + m_islotNext++; +} + +/*---------------------------------------------------------------------------------------------- + Convert the number of font design units into source device logical units. +----------------------------------------------------------------------------------------------*/ +float GrTableManager::EmToLogUnits(int m) +{ + return m_engst.EmToLogUnits(m); +} + +float EngineState::EmToLogUnits(int m) +{ + if (m == 0) + return 0; + + float xysFontEmSquare; + m_pfont->getFontMetrics(NULL, NULL, &xysFontEmSquare); + + // mEmUnits should be equal to the design units in the font's em square + int mEmUnits = Engine()->GetFontEmUnits(); + if (mEmUnits <= 0) + { + Warn("Failed to obtain font em-units"); + return (float)m; + } + + return GrEngine::GrIFIMulDiv(m, xysFontEmSquare, mEmUnits); +} + +/*---------------------------------------------------------------------------------------------- + Convert the source device coordinates to font design units. +----------------------------------------------------------------------------------------------*/ +int GrTableManager::LogToEmUnits(float xys) +{ + return m_engst.LogToEmUnits(xys); +} + +int EngineState::LogToEmUnits(float xys) +{ + if (xys == 0) + return 0; + + float xysFontEmSquare; + m_pfont->getFontMetrics(NULL, NULL, &xysFontEmSquare); + + // mEmUnits should be equal to the design units in the font's em square + int mEmUnits = Engine()->GetFontEmUnits(); + if (mEmUnits < 0) + { + Warn("Failed to obtain font em-units"); + return (int)xys; + } + + return GrEngine::GrFIFMulDiv(xys, mEmUnits, xysFontEmSquare); +} + +/*---------------------------------------------------------------------------------------------- + Find the coordinates for a given glyph point. + Return true on success, false otherwise. +----------------------------------------------------------------------------------------------*/ +bool GrTableManager::GPointToXY(gid16 chwGlyphID, int nGPoint, float * pxs, float * pys) +{ + return m_engst.GPointToXY(chwGlyphID, nGPoint, pxs, pys); +} + +bool EngineState::GPointToXY(gid16 chwGlyphID, int nGPoint, float * pxs, float * pys) +{ + *pxs = INT_MIN; + *pys = INT_MIN; + Point pointRet; + m_pfont->getGlyphPoint(chwGlyphID, nGPoint, pointRet); + *pxs = pointRet.x; + *pys = pointRet.y; + + return true; +} + +/*---------------------------------------------------------------------------------------------- + Call the justification routines. +----------------------------------------------------------------------------------------------*/ +void GrTableManager::CallJustifier(IGrJustifier * pgjus, int ipassCurr, + float dxUnjustified, float dxJustified, bool fEndLine) +{ + // Indicates the stream the justification routines will read and modify: + m_engst.m_ipassJustCalled = ipassCurr; + + int iGlyphMin = OutputStream(ipassCurr)->SegMin(); + int iGlyphLim = OutputStream(ipassCurr)->SegLimIfKnown(); + if (iGlyphLim == -1) + iGlyphLim = OutputStream(ipassCurr)->WritePos(); + + GrSlotStream * psstrm = OutputStream(ipassCurr); + if (m_pgreng->BasicJustification() && fEndLine) + UnstretchTrailingWs(psstrm, iGlyphLim); + + pgjus->adjustGlyphWidths(m_pgreng, iGlyphMin, iGlyphLim, dxUnjustified, dxJustified); + + // After returning, reading and modifying slot attributes is not permitted: + m_engst.m_ipassJustCalled = -1; +} + +/*---------------------------------------------------------------------------------------------- + For the basic justification approach, remove stretch from the trailing whitespace. +----------------------------------------------------------------------------------------------*/ +void GrTableManager::UnstretchTrailingWs(GrSlotStream * psstrm, int iGlyphLim) +{ + int islot = iGlyphLim - 1; + while (islot >= 0) + { + GrSlotState * pslot = psstrm->SlotAt(islot); + if (pslot->IsLineBreak(LBGlyphID())) + { } // keep looking for the trailing space + else if (pslot->IsSpace(this)) + pslot->SetJStretch(0); // TODO: do this at level 0 + else + // something other than space--quit + return; + islot--; + } +} + +/*---------------------------------------------------------------------------------------------- + Determine how much shrink is permissible. + + This method is really used only for testing the shrink mechanism, since at this time + we don't allow low-end justification to do any shrinking. +----------------------------------------------------------------------------------------------*/ +void GrTableManager::DetermineShrink(IGrJustifier * pgjus, int ipassCurr) +{ + if (m_engst.m_dxsShrinkPossible != GrSlotState::kNotYetSet) + return; + + if (m_engst.m_jmodi != kjmodiCanShrink || pgjus == NULL) + { + m_engst.m_dxsShrinkPossible = 0; + return; + } + + if (ipassCurr != m_ipassJust1 - 1) + return; + + GrSlotStream * psstrm = OutputStream(ipassCurr); + if (!psstrm->FullyWritten()) + return; + + // Normally just answer 0. To test shrinking, turn on the code below. + m_engst.m_dxsShrinkPossible = 0; + +#if TEST_SHRINK + int mTotal = 0; + int mShrink = 0; + int islotLim = psstrm->SegLimIfKnown(); + if (islotLim == -1) + islotLim = psstrm->WritePos(); + for ( ; islotLim >= 0; islotLim--) + { + // Trailing white space is not shrinkable. + GrSlotState * pslot = psstrm->SlotAt(islotLim - 1); + if (pslot->IsLineBreak(LBGlyphID())) + continue; + if (!pslot->IsSpace(this)) + break; + } + int islot; + for (islot = psstrm->SegMin(); islot < islotLim; islot++) + { + GrSlotState * pslot = psstrm->SlotAt(islot); + if (pslot->IsLineBreak(LBGlyphID())) + continue; + mTotal += pslot->AdvanceX(this); + mShrink += pslot->JShrink(); + } + + // Say that we are allowed to shrink up to 10% of the width of the segment. + mShrink = min(mShrink, mTotal/10); + m_engst.m_dxsShrinkPossible = EmToLogUnits(mShrink); +#endif // TEST_SHRINK +} + +/*---------------------------------------------------------------------------------------------- + Return the attribute of the given slot, back to the justification routine. Return + logical units. +----------------------------------------------------------------------------------------------*/ +GrResult EngineState::GetGlyphAttrForJustification(int iGlyph, int jgat, int nLevel, + float * pValueRet) +{ + GrResult res; + int valueRetInt = 0; + switch(jgat) + { + case kjgatWeight: + case kjgatStretchInSteps: + case kjgatBreak: + res = GetGlyphAttrForJustification(iGlyph, jgat, nLevel, &valueRetInt); + *pValueRet = (float)valueRetInt; + return res; + default: + break; + } + + if (m_ipassJustCalled == -1) + return kresUnexpected; + + if (nLevel != 1) + return kresInvalidArg; + + GrSlotStream * psstrm = OutputStream(m_ipassJustCalled); + + if (iGlyph < -1 || iGlyph >= psstrm->WritePos()) + return kresInvalidArg; + + GrSlotState * pslot = psstrm->SlotAt(iGlyph); + + // bool fConvertUnits = true; + + switch(jgat) + { + case kjgatStretch: + *pValueRet = EmToLogUnits(pslot->JStretch()); + break; + case kjgatShrink: + *pValueRet = EmToLogUnits(pslot->JShrink()); + break; + case kjgatStep: + *pValueRet = EmToLogUnits(pslot->JStep()); + break; + default: + return kresNotImpl; + } + return kresOk; +} + +GrResult EngineState::GetGlyphAttrForJustification(int iGlyph, int jgat, int nLevel, + int * pValueRet) +{ + GrResult res; + float valueRetFloat; + switch(jgat) + { + case kjgatStretch: + case kjgatShrink: + case kjgatStep: + res = GetGlyphAttrForJustification(iGlyph, jgat, nLevel, &valueRetFloat); + *pValueRet = GrEngine::RoundFloat(valueRetFloat); + return res; + default: + break; + } + + if (m_ipassJustCalled == -1) + return kresUnexpected; + + if (nLevel != 1) + return kresInvalidArg; + + GrSlotStream * psstrm = OutputStream(m_ipassJustCalled); + + if (iGlyph < -1 || iGlyph >= psstrm->WritePos()) + return kresInvalidArg; + + GrSlotState * pslot = psstrm->SlotAt(iGlyph); + + int mStretch, mStep; + //float xsStretch, xsStep; + + switch(jgat) + { + case kjgatWeight: + *pValueRet = pslot->JWeight(); + break; + case kjgatStretchInSteps: + // ???? should this be calculated in terms of logical units?? + // Probably doesn't matter, since the logical units are floating point, so the + // level of precision is about the same. + mStretch = pslot->JStretch(); + mStep = pslot->JStep(); + if (mStep == 0) + return kresUnexpected; + *pValueRet = int(mStretch / mStep); // round down + break; + //case kjgatStretchInSteps: + // xsStretch = EmToLogUnits(pslot->JStretch()); + // xsStep = EmToLogUnits(pslot->JStep()); + // if (xsStep == 0) + // return kresUnexpected; + // *pValueRet = int(xsStretch / xsStep); // round down + // break; + case kjgatBreak: + *pValueRet = pslot->BreakWeight(); + break; + default: + return kresNotImpl; + } + return kresOk; +} + +/*---------------------------------------------------------------------------------------------- + Set the attribute of the given slot, for the justification routine. +----------------------------------------------------------------------------------------------*/ +GrResult EngineState::SetGlyphAttrForJustification(int iGlyph, int jgat, int nLevel, + float value) +{ + GrResult res; + int valueInt; + switch(jgat) + { + case kjgatWeight: + case kjgatStretchInSteps: + case kjgatBreak: + valueInt = (int)value; + res = SetGlyphAttrForJustification(iGlyph, jgat, nLevel, valueInt); + return res; + default: + break; + } + + if (m_ipassJustCalled == -1) + return kresUnexpected; + + if (nLevel != 1) + return kresInvalidArg; + + GrSlotStream * psstrm = OutputStream(m_ipassJustCalled); + + if (iGlyph < -1 || iGlyph >= psstrm->WritePos()) + return kresInvalidArg; + + GrSlotState * pslot = psstrm->SlotAt(iGlyph); + + int mValue = LogToEmUnits(value); + mValue = min(mValue, 0xFFFF); // truncate to an unsigned short + + // Review: do we really want to allow them to set stretch/shrink/step/weight? The normal + // thing for them to do is set width. + switch(jgat) + { + case kjgatStretch: + pslot->SetJStretch(mValue); + break; + case kjgatShrink: + pslot->SetJShrink(mValue); + break; + case kjgatStep: + pslot->SetJStep(mValue); + break; + case kjgatWidth: + pslot->SetJWidth(mValue); + break; + default: + return kresNotImpl; + } + return kresOk; +} + +GrResult EngineState::SetGlyphAttrForJustification(int iGlyph, int jgat, int nLevel, + int value) +{ + GrResult res; + float valueFloat; + switch(jgat) + { + case kjgatStretch: + case kjgatShrink: + case kjgatStep: + case kjgatWidth: + valueFloat = (float)value; + res = SetGlyphAttrForJustification(iGlyph, jgat, nLevel, valueFloat); + return res; + default: + break; + } + + if (m_ipassJustCalled == -1) + return kresUnexpected; + + if (nLevel != 1) + return kresInvalidArg; + + GrSlotStream * psstrm = OutputStream(m_ipassJustCalled); + + if (iGlyph < -1 || iGlyph >= psstrm->WritePos()) + return kresInvalidArg; + + GrSlotState * pslot = psstrm->SlotAt(iGlyph); + + int mValue, cSteps; + switch(jgat) + { + case kjgatWeight: + pslot->SetJWeight(value); + break; + case kjgatWidthInSteps: + cSteps = value; + mValue = pslot->JStep(); + if (mValue == 0) + return kresUnexpected; + pslot->SetJWidth(mValue * cSteps); + break; + default: + return kresNotImpl; + } + return kresOk; +} + +//:>-------------------------------------------------------------------------------------------- +//:> Functions to forward to the engine. +//:>------------------------------------------------------------------------------------------*/ +gid16 GrTableManager::GetGlyphIDFromUnicode(int nUnicode) +{ + return m_pgreng->GetGlyphIDFromUnicode(nUnicode); +} + +/*--------------------------------------------------------------------------------------------*/ + +gid16 GrTableManager::ActualGlyphForOutput(utf16 chw) +{ + return m_pgreng->ActualGlyphForOutput(chw); +} + +/*--------------------------------------------------------------------------------------------*/ + +GrGlyphTable * GrTableManager::GlyphTable() +{ + return m_pgreng->GlyphTable(); +} + +/*--------------------------------------------------------------------------------------------*/ + +gid16 GrTableManager::LBGlyphID() +{ + return m_pgreng->LBGlyphID(); +} + +/*--------------------------------------------------------------------------------------------*/ + +gid16 GrTableManager::GetClassGlyphIDAt(int nClass, int nIndex) +{ + return m_pgreng->GetClassGlyphIDAt(nClass, nIndex); +} + +/*--------------------------------------------------------------------------------------------*/ + +int GrTableManager::GetIndexInGlyphClass(int nClass, gid16 chwGlyphID) +{ + return m_pgreng->GetIndexInGlyphClass(nClass, chwGlyphID); +} + +/*--------------------------------------------------------------------------------------------*/ + +size_t GrTableManager::NumberOfGlyphsInClass(int nClass) +{ + return m_pgreng->NumberOfGlyphsInClass(nClass); +} + +/*--------------------------------------------------------------------------------------------*/ + +void GrTableManager::SetSlotAttrsFromGlyphAttrs(GrSlotState * pslot) +{ + m_pgreng->SetSlotAttrsFromGlyphAttrs(pslot); +} + +/*--------------------------------------------------------------------------------------------*/ + +int GrTableManager::NumFeat() +{ + return m_pgreng->NumFeat(); +} + +/*--------------------------------------------------------------------------------------------*/ + +int GrTableManager::DefaultForFeatureAt(int ifeat) +{ + return m_pgreng->DefaultForFeatureAt(ifeat); +} + +/*--------------------------------------------------------------------------------------------*/ + +void GrTableManager::DefaultsForLanguage(isocode lgcode, + std::vector & vnFeats, std::vector & vnValues) +{ + return m_pgreng->DefaultsForLanguage(lgcode, vnFeats, vnValues); +} + +/*--------------------------------------------------------------------------------------------*/ + +GrFeature * GrTableManager::FeatureWithID(featid nID, int * pifeat) +{ + return m_pgreng->FeatureWithID(nID, pifeat); +} + +/*--------------------------------------------------------------------------------------------*/ + +GrFeature * GrTableManager::Feature(int ifeat) +{ + return m_pgreng->Feature(ifeat); +} + +/*--------------------------------------------------------------------------------------------*/ + +bool GrTableManager::RightToLeft() +{ + if (m_engst.WhiteSpaceOnly()) + return m_engst.m_fParaRtl; + else + return m_pgreng->RightToLeft(); +} + +/*--------------------------------------------------------------------------------------------*/ + +int GrTableManager::TopDirectionLevel() +{ + return m_pgreng->TopDirectionLevel(); +} + +/*--------------------------------------------------------------------------------------------*/ + +float GrTableManager::VerticalOffset() +{ + return m_pgreng->VerticalOffset(); +} + +/*--------------------------------------------------------------------------------------------*/ + +int GrTableManager::NumUserDefn() +{ + return m_pgreng->NumUserDefn(); +} + +/*--------------------------------------------------------------------------------------------*/ + +int GrTableManager::NumCompPerLig() +{ + return m_pgreng->NumCompPerLig(); +} + +/*--------------------------------------------------------------------------------------------*/ + +int GrTableManager::ComponentIndexForGlyph(gid16 chwGlyphID, int nCompID) +{ + return m_pgreng->ComponentIndexForGlyph(chwGlyphID, nCompID); +} + +/*--------------------------------------------------------------------------------------------*/ + +int GrTableManager::GlyphAttrValue(gid16 chwGlyphID, int nAttrID) +{ + return m_pgreng->GlyphAttrValue(chwGlyphID, nAttrID); +} + +/*--------------------------------------------------------------------------------------------*/ + +bool GrTableManager::LoggingTransduction() +{ + return m_fLogging; + //return m_pgreng->LoggingTransduction(); +} + +/*---------------------------------------------------------------------------------------------- + Calculate the positions of the glyphs up to the given slot, within the output of the given + pass. If the slot is NULL, go all the way to the end of what has been generated. + + @param ipass - index of pass needing positioning; normally this will be the + final pass, but it could be another if positions are + requested by the rules themselves + @param pslotLast - last slot that needs to be positioned, or NULL + @param fMidPass - calculating the position of some slot in the middle of the pass + @param pxsWidth - return the total width used so far + @param psxVisibleWidth - return the visible width so far + + MOVE to EngineState +----------------------------------------------------------------------------------------------*/ +void GrTableManager::CalcPositionsUpTo(int ipass, GrSlotState * pslotLast, bool fMidPass, + float * pxsWidth, float * pxsVisibleWidth) +{ + Assert(ipass >= m_ipassPos1 - 1); + + int isstrm = ipass; + GrSlotStream * psstrm = OutputStream(isstrm); + GrSlotStream * psstrmNext = (isstrm >= m_cpass - 1) ? NULL : OutputStream(isstrm + 1); + Assert(psstrm->GotIndexOffset()); + if (psstrm->WritePos() <= psstrm->IndexOffset()) + { + Assert(psstrm->WritePos() == 0); + *pxsWidth = 0; + *pxsVisibleWidth = 0; + return; + } + if (!pslotLast) + { + pslotLast = psstrm->SlotAt(psstrm->WritePos() - 1); + } + Assert(pslotLast); + + // First set positions of all base slots. + + int islot = psstrm->IndexOffset(); + GrSlotState * pslot; + float xs = 0; + float ys = VerticalOffset(); + *pxsWidth = 0; + *pxsVisibleWidth = 0; + + bool fLast = false; + bool fLastBase = false; + + bool fFakeItalic = m_pgreng->FakeItalic(); + float fakeItalicRatio = 0; + if (fFakeItalic) + fakeItalicRatio = State()->GetFont()->fakeItalicRatio(); + bool fBasicJust = m_pgreng->BasicJustification(); + + // Figure out how to know when to stop. + // We need to calculate up to the base of the last leaf slot, if it happens + // to be later in the stream than the last actual slot passed in. + if (!psstrm->HasSlotAtPosPassIndex(pslotLast->AttachRootPosPassIndex())) + return; + GrSlotState * pslotLastBase = (fMidPass && pslotLast->PosPassIndex() < psstrm->WritePos()) + ? pslotLast->Base(psstrmNext) + : pslotLast->Base(psstrm); + + if (ipass == m_cpass - 1 && m_engst.m_islotPosNext > -1) + { + // For final pass, initialize from cache of previous calculations. + islot = m_engst.m_islotPosNext; + xs = m_engst.m_xsPosXNext; + ys = m_engst.m_ysPosYNext; + *pxsWidth = m_engst.m_dxsTotWidthSoFar; + *pxsVisibleWidth = m_engst.m_dxsVisWidthSoFar; + + if (psstrm->SlotsPresent() <= islot) + return; + + if (pslotLastBase->PosPassIndex() == GrSlotAbstract::kNotYetSet) + { + Assert(false); // I think this case is handled above + return; // can't position this slot yet; its base has not been processed + } + + if (pslotLastBase->PosPassIndex() + psstrm->IndexOffset() < islot) + { + fLastBase = true; + if (pslotLast == pslotLastBase) + fLast = true; + } + } + + std::vector vpslotAttached; + std::vector vpsstrmAttached; + + bool fRtl = RightToLeft(); + + while (!fLast || !fLastBase) + { + Assert(islot < psstrm->SlotsPresent()); + + GrSlotStream * psstrmThis = psstrm; + if (fMidPass && islot < psstrm->WritePos()) + { + pslot = psstrm->MidPassSlotAt(islot, psstrmNext); + psstrmThis = psstrmNext; + } + else + { + //pslot = (isstrm == ipass) ? psstrm->SlotAt(islot) : psstrm->OutputSlotAt(islot); + pslot = psstrm->SlotAt(islot); + } + + if (!pslot->IsBase()) + { + // This slot is attached to another; it will be positioned strictly + // relative to that one. This happens in the loop below. + vpslotAttached.push_back(pslot); + vpsstrmAttached.push_back(psstrmThis); + } + else + { + // Base character. + + bool fLB = pslot->IsLineBreak(LBGlyphID()); + if (InternalJustificationMode() == kjmodiJustify && fBasicJust + && ipass == m_cpass - 1 && !fLB) + { + m_engst.AddJWidthToAdvance(psstrm, &pslot, islot, &pslotLast, &pslotLastBase); + } + + // Make sure the metrics are the complete ones. + pslot->CalcCompositeMetrics(this, psstrm, psstrmNext, kPosInfinity, true); + + float xsInc = pslot->GlyphXOffset(psstrm, fakeItalicRatio); + float ysInc = pslot->GlyphYOffset(psstrm); + float xsAdvX = pslot->ClusterAdvWidth(psstrm); + float ysAdvY = (fLB) ? + 0 : + EmToLogUnits(pslot->AdvanceY(this)); + + if (fRtl) + { + xs -= xsAdvX; + ys -= ysAdvY; + pslot->SetXPos(xs + xsInc); + pslot->SetYPos(ys + ysInc); + } + else + { + pslot->SetXPos(xs + xsInc); + pslot->SetYPos(ys + ysInc); + xs += xsAdvX; + ys += ysAdvY; + } + + *pxsWidth = max(*pxsWidth, fabsf(xs)); + if (!IsWhiteSpace(pslot)) + *pxsVisibleWidth = *pxsWidth; + + if (isstrm == m_cpass - 1) + { + // For the final output pass, cache the results of the calculation so far. + // Only do this for slots that have actually been processed by the final + // pass, because others may have intermediate values that may be changed + // later. + m_engst.m_islotPosNext = pslot->PosPassIndex() + psstrm->IndexOffset() + 1; + m_engst.m_xsPosXNext = xs; + m_engst.m_ysPosYNext = ys; + m_engst.m_dxsTotWidthSoFar = *pxsWidth; + m_engst.m_dxsVisWidthSoFar = *pxsVisibleWidth; + } + } + + // Need to have calculated both the last leaf and the last base (if they happen to + // be different); if so, we're done. + if (pslot == pslotLast) + fLast = true; + if (pslot == pslotLastBase) + fLastBase = true; + + islot++; + } + + Assert(fLast); + Assert(fLastBase); + + // Now set positions of non-base slots, relative to their bases. + + for (size_t ipslot = 0; ipslot < vpslotAttached.size(); ipslot++) + { + GrSlotState * pslotAtt = vpslotAttached[ipslot]; + GrSlotStream * psstrmAtt = vpsstrmAttached[ipslot]; + GrSlotState * pslotBase = pslotAtt->Base(psstrmAtt); + if (pslotBase->XPosition() == kNegInfinity || pslotBase->YPosition() == kNegInfinity) + { + Assert(false); + continue; + } + float xsCluster = pslotBase->XPosition() - pslotBase->GlyphXOffset(psstrm, fakeItalicRatio); + float ysCluster = pslotBase->YPosition() - pslotBase->GlyphYOffset(psstrm); + float xsInc = pslotAtt->GlyphXOffset(psstrm, fakeItalicRatio); + float ysInc = pslotAtt->GlyphYOffset(psstrm); + pslotAtt->SetXPos(xsCluster + xsInc); + pslotAtt->SetYPos(ysCluster + ysInc); + + // My theory is that we don't need to adjust *pxsWidth here, because the width of + // any non-base slots should be factored into the advance width of their cluster + // base, which was handled above. + } +} + +/*---------------------------------------------------------------------------------------------- + Return true if the given slot is white space. +----------------------------------------------------------------------------------------------*/ +bool GrTableManager::IsWhiteSpace(GrSlotState * pslot) +{ + if (pslot->IsLineBreak(LBGlyphID())) + return true; + return (pslot->IsSpace(this) != 0)? true : false; +} + +/*---------------------------------------------------------------------------------------------- + When doing basic justification, apply the value of justify.width to the advance width. + This happens during the final positioning routine. +----------------------------------------------------------------------------------------------*/ +void EngineState::AddJWidthToAdvance(GrSlotStream * psstrm, GrSlotState ** ppslot, int islot, + GrSlotState ** ppslotLast, GrSlotState ** ppslotLastBase) +{ + Assert(psstrm->OutputOfPass() == m_cpass - 1); // only used for final stream + if ((*ppslot)->JWidth() > 0) + { + if ((*ppslot)->PassModified() != m_cpass - 1) + { + // Replace the slot with a new slot, so it gets marked properly with the + // pass in which it was modified. (Otherwise the debug log gets screwed up.) + GrSlotState * pslotNew; + NewSlotCopy((*ppslot), m_cpass - 1, &pslotNew); + psstrm->PutSlotAt(pslotNew, islot); + if (*ppslot == *ppslotLast) + *ppslotLast = pslotNew; + if (*ppslot == *ppslotLastBase) + *ppslotLastBase = pslotNew; + *ppslot = pslotNew; + } + (*ppslot)->AddJWidthToAdvance(TableManager()); + } +} + + +//:>******************************************************************************************** +//:> Debuggers and utilities +//:>******************************************************************************************** + +//:Ignore +#if 0 +void GrTableManager::TempDebug() +{ + for (int ipass = 0; ipass < m_cpass; ++ipass) + { + int wpos = OutputStream(ipass)->WritePos(); + int rpos = OutputStream(ipass)->ReadPos(); + GrSlotState * wslot = OutputStream(ipass)->LastSlotWritten(); + GrSlotState * rslot = OutputStream(ipass)->LastSlotRead(); + + } +} +#endif +/*---------------------------------------------------------------------------------------------- + Given a character index in the original string, locate the corresponding line-break slot + in the final surface stream. The character index must be one before which there is a + line-break (seg lim), or the beginning or the end of the string. + TODO SharonC: fix the bugs +----------------------------------------------------------------------------------------------*/ +int GrTableManager::SurfaceLineBreakSlot(int ichw, GrCharStream * pchstrm, bool fInitial) +{ + if (ichw == 0) + { + Assert(fInitial); + return -1; // no initial line break + } + if (ichw == pchstrm->Lim()) + { + Assert(!fInitial); + return -1; // no terminating line break + } + + int islotIn = pchstrm->SegOffset(ichw); + Assert(islotIn >= 0); + islotIn += (fInitial? m_engst.m_cslotPreSeg - 1: m_engst.m_cslotPreSeg); + + gid16 chwLBGlyphID = LBGlyphID(); + + // Now islotIn is the position in stream 0; + + for (int ipass = 1; ipass < m_cpass; ++ipass) + { + int islotChunkMin; + int islotChunkLim; + GrSlotStream * psstrmOut = OutputStream(ipass); + + GrSlotStream * psstrmIn = InputStream(ipass); + if (fInitial) + islotIn = max(islotIn, psstrmIn->PreChunk()); + int islotT = psstrmIn->ChunkInNextMin(islotIn); + islotChunkMin = psstrmIn->ChunkInNext(islotT); + islotChunkMin = (islotChunkMin == -1)? 0: islotChunkMin; + + islotT = psstrmIn->ChunkInNextLim(islotIn); + Assert(islotT <= psstrmIn->ReadPos()); + if (islotT == psstrmIn->ReadPos()) + islotChunkLim = psstrmOut->WritePos(); + else + islotChunkLim = psstrmIn->ChunkInNext(islotT); + + int islotOut; + for (islotOut = islotChunkMin; islotOut < islotChunkLim; ++islotOut) + { + gid16 chw = psstrmOut->GlyphIDAt(islotOut); + if (chw == chwLBGlyphID) + break; + } + Assert(psstrmOut->GlyphIDAt(islotOut) == chwLBGlyphID); + + islotIn = islotOut; + } + return islotIn; +} + +/*---------------------------------------------------------------------------------------------- + Generate a debugger string showing the chunk boundaries for the given stream. +----------------------------------------------------------------------------------------------*/ +std::wstring GrTableManager::ChunkDebugString(int ipass) +{ + GrSlotStream * psstrm = OutputStream(ipass); + std::wstring stuRet; + //utf16 chwN = '\\'; + //utf16 chwR = '^'; + + gid16 chwLBGlyphID = LBGlyphID(); + + for (int islot = 0; islot < psstrm->WritePos(); islot++) + { + if (psstrm->ChunkInPrev(islot) != -1) + { + if (psstrm->ChunkInNext(islot) != -1) + stuRet.append(L">"); + else + stuRet.append(L"\\"); + } + else if (psstrm->ChunkInNext(islot) != -1) + stuRet.append(L"/"); + else + stuRet.append(L" "); + +// if (islot == psstrm->ReadPos()) +// stuRet.Append(&chwR, 1); + + wchar_t chw = psstrm->SlotAt(islot)->GlyphID(); + if (chw == chwLBGlyphID) + stuRet.append(L"#"); + else + stuRet.append(&chw, 1); + } + return stuRet; +} + +} // namespace gr + +//:End Ignore diff --git a/Build/source/libs/graphite/engine-2.4/src/segment/GrTableManager.h b/Build/source/libs/graphite/engine-2.4/src/segment/GrTableManager.h new file mode 100644 index 00000000000..7cc697539d8 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/src/segment/GrTableManager.h @@ -0,0 +1,568 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 1999, 2001 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: GrTableManager.h +Responsibility: Sharon Correll +Last reviewed: Not yet. + +Description: + The GrTableManager class. +----------------------------------------------------------------------------------------------*/ +#ifdef _MSC_VER +#pragma once +#endif +#ifndef GR_TABLEMAN_INCLUDED +#define GR_TABLEMAN_INCLUDED + +#include +//:End Ignore + +namespace gr +{ + +class Font; + +/*---------------------------------------------------------------------------------------------- + There is a single instance of Engine State that keeps track of the state of the processing + for a single segment generation. + + Hungarian: engst +----------------------------------------------------------------------------------------------*/ +class EngineState +{ + friend class GrTableManager; + friend class FontMemoryUsage; + +public: + EngineState(); + void Initialize(GrEngine *, GrTableManager *); + + ~EngineState(); + void DestroySlotBlocks(); + + void InitForNewSegment(GrTableManager * ptman); + + void CreateEmpty(); + + GrEngine * Engine(); + GrTableManager * TableManager(); + + void CreateSlotStreams(); + + GrSlotStream * InputStream(int ipass) + { + Assert(ipass > 0); // the char stream serves as input to the zeroth pass + return m_prgpsstrm[ipass - 1]; + } + + // Return the stream that serves as output to the given pass. + GrSlotStream * OutputStream(int ipass) + { + Assert(ipass < m_cpass); + return m_prgpsstrm[ipass]; + } + + GrSlotState * AnAdjacentSlot(int ipassArg, int islotArg); + + GrResult GetGlyphAttrForJustification(int iGlyph, int jgat, int nLevel, float * pxysValueRet); + GrResult GetGlyphAttrForJustification(int iGlyph, int jgat, int nLevel, int * pxysValueRet); + GrResult SetGlyphAttrForJustification(int iGlyph, int jgat, int nLevel, float xysValue); + GrResult SetGlyphAttrForJustification(int iGlyph, int jgat, int nLevel, int xysValue); + + enum { kSlotBlockSize = 50 }; // number of slots to allocate in a block + + void InitPosCache() + { + m_islotPosNext = -1; + m_xsPosXNext = 0; + m_ysPosYNext = 0; + m_dxsTotWidthSoFar = 0; + m_dxsVisWidthSoFar = 0; + } + + void SetFont(Font * pfont) + { + m_pfont = pfont; + } + Font * GetFont() + { + return m_pfont; + } + + bool StartLineContext() + { + return m_fStartLineContext; + } + bool EndLineContext() + { + return m_fEndLineContext; + } + void SetStartLineContext(bool f) + { + m_fStartLineContext = f; + } + void SetEndLineContext(bool f) + { + m_fEndLineContext = f; + } + + void SetInitialLB(bool f = true) + { + m_fInitialLB = f; + } + + void SetFinalLB(bool f = true) + { + m_fFinalLB = f; + } + + void SetInsertedLB(bool f = true) + { + m_fInsertedLB = f; + } + + bool HasInitialLB() + { + return m_fInitialLB; + } + bool HasInsertedLB() + { + return m_fInsertedLB; + } + bool HasFinalLB() + { + return m_fFinalLB; + } + + void SetExceededSpace(bool f = true) + { + m_fExceededSpace = f; + } + + bool ExceededSpace() + { + return m_fExceededSpace; + } + + void SetHitHardBreak(bool f = true) + { + m_fHitHardBreak = f; + } + + bool HitHardBreak() + { + return m_fHitHardBreak; + } + + void SetRemovedTrWhiteSpace(bool f = true) + { + m_fRemovedWhtsp = f; + } + + bool RemovedTrWhiteSpace() + { + return m_fRemovedWhtsp; + } + + bool WhiteSpaceOnly() + { + return (m_twsh == ktwshOnlyWs); + } + + bool ParaRightToLeft() + { + return m_fParaRtl; + } + + //int PrevPassMaxBackup(int ipass) + //{ + // if (ipass == 0) + // return 0; + // return Pass(ipass - 1)->MaxBackup(); + //} + + DirCode InitialStrongDir() + { + return m_dircInitialStrongDir; + } + DirCode InitialTermDir() + { + return m_dircInitialTermDir; + } + + void InitializeStreams(GrTableManager * ptman, GrCharStream * pchstrm, + int cbPrev, byte * pbPrevSegDat, bool fNeedFinalBreak, int * pislotFinalBreak); + int LbSlotToSegLim(int islot, GrCharStream * pchstrm, int cpassLB); + int TraceStreamZeroPos(int islotFinal, int nTopDir); + + float EmToLogUnits(int m); + int LogToEmUnits(float xys); + bool GPointToXY(gid16 chwGlyphID, int nGPoint, float * xs, float * ys); + + void AddJWidthToAdvance(GrSlotStream * psstrm, GrSlotState ** ppslot, int islot, + GrSlotState ** ppslotLast, GrSlotState ** ppslotLastBase); + + // Memory management for slots: + void NewSlot(gid16 gID, GrFeatureValues fval, int ipass, int ichwSegOffset, int nUnicode, + GrSlotState **); + void NewSlot(gid16 gID, GrSlotState * pslotFeat, int ipass, int ichwSegOffset, + GrSlotState **); + void NewSlot(gid16 gID, GrSlotState * pslotFeat, int ipass, GrSlotState **); + void NewSlotCopy(GrSlotState * pslotCopyFrom, int ipass, + GrSlotState ** pslotRet); +protected: + void NextSlot(GrSlotState ** ppslot); + +protected: + GrTableManager * m_ptman; + + int m_cFeat; + int m_cCompPerLig; + int m_cUserDefn; + + int m_jmodi; // justification mode + int m_ipassJustCalled; // pass after which justification routine was called; + // -1 if we are not in the midst of interacting with the + // GrJustifier + + // Pointer to font + Font * m_pfont; + + bool m_fStartLineContext; // true if there was a rule that ran over the initial LB + bool m_fEndLineContext; // true if there was a rule that ran over the final LB + + // the number of slots inserted in the first stream before the official beginning + // of the segment, including any initial line break + int m_cslotPreSeg; + + // List of allocated GrSlotStates; hungarian slotblk = prgslot + std::vector m_vslotblk; + std::vector m_vprgnSlotVarLenBufs; // corresponding var-length blocks + int m_islotblkCurr; + int m_islotNext; + + // Directionality codes from previous segment; these are used by the bidi algorithm + // at the initial line-break character. + DirCode m_dircInitialStrongDir; + DirCode m_dircInitialTermDir; + + LineBrk m_lbPrevEnd; + + // All of the following 3 are true only when there is an actual LB glyph in the stream + bool m_fInitialLB; // is there is an initial LB (an actual LB glyph--in all streams) + bool m_fFinalLB; // is there is a final LB (in all streams--true when we've hit + // the end of the input and end-of-line is true) + bool m_fInsertedLB; // is there is a final LB inserted in the output of LB pass + // (true when we've backtracked) + + bool m_fExceededSpace; // true if we backtracked due to exceeding space; false if we + // haven't backtracked, or we did so for some other reason + // (eg, omitting trailing whitespace) + + bool m_fHitHardBreak; // true if we encountered a hard-break in the input stream + // (before the natural end of the segment) + + bool m_fRemovedWhtsp; // true if we've hit trailing whitespace characters that we've + // removed + + TrWsHandling m_twsh; // white-space handling + bool m_fParaRtl; // paragraph direction + + bool m_fFeatureVariations; // can features vary over the course of the segment? + + float m_dxsShrinkPossible; + + // The final positioning pass is where we are going to do most of the positioning. + // Cache the intermediate results so we don't have to calculate from the beginning of + // the segment every time. + int m_islotPosNext; // where to continue calculating positions in final output stream + // (one past the last base that was calculated) + float m_xsPosXNext; + float m_ysPosYNext; + float m_dxsTotWidthSoFar; + float m_dxsVisWidthSoFar; + + int m_cpass; // number of passes + + // array of pass-state objects + PassState * m_prgzpst; + + // array of slot streams which are output of passes (input of zeroth + // pass is the character stream, not a slot stream): + GrSlotStream ** m_prgpsstrm; + // For instance, a simple set of passes might look like this: + // CharStream + // GlyphGenPass pass 0 + // SlotStream stream 0 + // SubPass pass 1 + // SlotStream stream 1 + // PosPass pass 2 + // SlotStream stream 2 + // + // m_cpass = 3 + +}; // end of class EngineState + +/*---------------------------------------------------------------------------------------------- + There is a single instance of GrTableManager that handle the interactions between + passes, including the demand-pull mechanism. + + Hungarian: tman +----------------------------------------------------------------------------------------------*/ + +class GrTableManager { + friend class FontMemoryUsage; + +public: + // Constructor & destructor: + GrTableManager(GrEngine * pgreng) + : m_cpass(0), + m_fBidi(false), + m_prgppass(NULL), + m_pgreng(pgreng) + { + Assert(pgreng); + } + + ~GrTableManager(); + + bool CreateAndReadPasses(GrIStream & grstrm, int fxdSilfVersion, int fxdRuleVersion, + int cpassFont, long lSubTableStart, int * rgnPassOffsets, int * rgcbPassLengths, + int ipassSub1Font, int ipassPos1Font, int ipassJust1Font, byte ipassPostBidiFont); + + void CreateEmpty(); + + GrEngine * Engine(); + EngineState * State(); + + void Run(Segment * psegNew, Font * pfont, GrCharStream * pchstrm, + IGrJustifier * pgjus, int jmodi, + LayoutEnvironment & layout, + int ichStop, float dxWidth, float dxUnjustified, + bool fNeedFinalBreak, bool fMoreText, bool fFeatureVariations, int ichFontLim, + bool fInfiniteWidth, bool fWidthIsCharCount, + int ichwCallerBtLim, + int nDirDepth, SegEnd estJ); + + GrPass* Pass(int ipass) + { + Assert(ipass >= 0); + return m_prgppass[ipass]; + } + + int NumberOfPasses() + { + return m_cpass; + } + + int NumberOfLbPasses() + { + return m_cpassLB; + } + + bool HasBidiPass() + { + return m_fBidi; + } + + int FirstPosPass() + { + return m_ipassPos1; + } + + void StorePassStates(PassState * rgzpst); + + // Return the stream that serves as input to the given pass. + GrSlotStream * InputStream(int ipass) + { + return m_engst.InputStream(ipass); + } + GrSlotStream * OutputStream(int ipass) + { + return m_engst.OutputStream(ipass); + } + + void UnwindAndReinit(int islotNewBreak); + +public: + int InternalJustificationMode() + { + return m_engst.m_jmodi; + } + + bool ShouldLogJustification() + { + return (m_engst.m_jmodi != kjmodiNormal); + } + + bool FeatureVariations() + { + return (m_engst.m_fFeatureVariations); + } + void SetFeatureVariations(bool f) + { + m_engst.m_fFeatureVariations = f; + } + + int PrevPassMaxBackup(int ipass) + { + if (ipass == 0) + return 0; + return Pass(ipass - 1)->MaxBackup(); + } + + // Forward to the engine itself + gid16 GetGlyphIDFromUnicode(int nUnicode); + gid16 ActualGlyphForOutput(utf16 chwGlyphID); + GrGlyphTable * GlyphTable(); + + gid16 LBGlyphID(); + + gid16 GetClassGlyphIDAt(int nClass, int nIndex); + int GetIndexInGlyphClass(int nClass, gid16 chwGlyphID); + size_t NumberOfGlyphsInClass(int nClass); + + void SetSlotAttrsFromGlyphAttrs(GrSlotState * pslot); + + int NumFeat(); + int DefaultForFeatureAt(int ifeat); + GrFeature * FeatureWithID(featid nID, int * pifeat); + GrFeature * Feature(int ifeat); + void DefaultsForLanguage(isocode lgcode, + std::vector & vnFeats, std::vector & vnValues); + + bool RightToLeft(); + int TopDirectionLevel(); + + float VerticalOffset(); + + int NumUserDefn(); + int NumCompPerLig(); + + int ComponentIndexForGlyph(gid16 chwGlyphID, int nCompID); + int GlyphAttrValue(gid16 chwGlyphID, int nAttrID); + + // --- + + bool LoggingTransduction(); + + float EmToLogUnits(int m); + int LogToEmUnits(float xys); + bool GPointToXY(gid16 chwGlyphID, int nGPoint, float * xs, float * ys); + + void CalcPositionsUpTo(int ipass, GrSlotState * pslotLast, bool fMidPass, + float * pxsWidth, float * pxsVisibleWidth); + + void InitPosCache() + { + m_engst.InitPosCache(); + } + + bool IsWhiteSpace(GrSlotState * pslot); + + // For transduction logging: + //bool WriteTransductionLog(GrCharStream * pchstrm, Segment * psegRet, + // int cbPrev, byte * pbPrevSegDat, byte * pbNextSegDat, int * pcbNextSegDat); + //bool WriteAssociationLog(GrCharStream * pchstrm, Segment * psegRet); + bool WriteTransductionLog(std::ostream * pstrmLog, + GrCharStream * pchstrm, Segment * psegRet, int cbPrevSetDat, byte * pbPrevSegDat); + bool WriteAssociationLog(std::ostream * pstrmLog, + GrCharStream * pchstrm, Segment * psegRet); +#ifdef TRACING + void WriteXductnLog(std::ostream & strmOut, GrCharStream * pchstrm, Segment * psegRet, + int cbPrevSegDat, byte * pbPrevSegDat); + //bool LogFileName(std::string & staFile); + void LogUnderlying(std::ostream & strmOut, GrCharStream * pchstrm, int cchwBackup); + void LogPass1Input(std::ostream & strmOut); + void LogPassOutput(std::ostream & strmOut, int ipass, int cslotSkipped); + void LogAttributes(std::ostream & strmOut, int ipass, bool fJustWidths = false); + void LogFinalPositions(std::ostream & strmOut); + void LogUnderlyingHeader(std::ostream & strmOut, int ichwMin, + int ichwLim, int cchwBackup, int * prgichw16bit); + void LogSlotHeader(std::ostream & strmOut, int cslot, + int cspPerSlot, int cspLeading, int islotMin = 0); + void LogSlotGlyphs(std::ostream & strmOut, GrSlotStream * psstrm); + void SlotAttrsModified(int ipass, bool * rgfMods, bool fPreJust, int * pccomp, int *pcassoc); + void LogInTable(std::ostream & strmOut, int n); + void LogInTable(std::ostream & strmOut, float n); + void LogHexInTable(std::ostream & strmOut, gid16 chw, bool fPlus = false); + void LogDirCodeInTable(std::ostream & strmOut, int dirc); + void LogBreakWeightInTable(std::ostream & strmOut, int lb); +#endif // TRACING + +protected: + void InitNewSegment(Segment * psegNew, Font * pfont, GrCharStream * pchstrm, IGrJustifier * pgjus, + int islotStream0Break, int islotSurfaceBreak, bool fStartLine, bool fEndLine, int ichFontLim, + LineBrk lbEnd, SegEnd est, int * dichSegLen); + + void InitSegmentAsEmpty(Segment * psegNew, Font * pfont, GrCharStream * pchstrm, + bool fStartLine, bool fEndLine); + + void InitSegmentToDelete(Segment * psegNew, Font * pfont, GrCharStream * pchstrm); + + int ChunkInPrev(int ipass, int islot, GrCharStream * pchstrm); + + bool Backtrack(int * islotPrevLB, + LineBrk * plbPref, LineBrk lbMax, TrWsHandling, bool fMoreText, + int ichwCallerBtLim, bool fEndLine, LineBrk * plbFound); + + LineBrk IncLineBreak(LineBrk lb); + + void InitializeForNextSeg(Segment* pseg, + int islotStream0Break, int islotSurfaceBreak, LineBrk lbEnd, + bool fNextSegNeedsContext, GrCharStream * pchstrm); + + void RecordAssocsAndOutput(Font * pfont, + Segment * pseg, bool fWidthIsCharCount, + TrWsHandling twsh, bool fParaRtl, int nDirDepth); + + void CalculateAssociations(Segment * pseg, int csloutSurface); + void AdjustAssocsForOverlaps(Segment * pseg); + + void UnstretchTrailingWs(GrSlotStream * psstrm, int iGlyphLim); + void CallJustifier(IGrJustifier * pgjus, int ipassCurr, float dxUnjustified, float dxJustified, + bool fEndLine); + + void DetermineShrink(IGrJustifier * pgjus, int ipass); + +protected: + // Instance variables: + + int m_cpass; // number of passes; zero-th pass is Unicode character -> glyph ID mapping; + // Note thatwe always have one positioning pass to measure things even + // if there are no tables to run. + + int m_cpassLB; // number of line-break passes + int m_ipassPos1; // first positioning pass + int m_ipassJust1; // first justification pass (== m_ipassPos1 if none) + + bool m_fBidi; // is there a bidi pass? + + // array of passes: + GrPass ** m_prgppass; + + // Pointer back to Graphite engine, to give access to global constants and tables. + GrEngine * m_pgreng; + + // State of processing. + EngineState m_engst; + + bool m_fLogging; + +public: + // For test procedures: + void SetUpTest(std::wstring); + +protected: + void TempDebug(); + int SurfaceLineBreakSlot(int ichw, GrCharStream * pchstrm, bool fInitial); + std::wstring ChunkDebugString(int ipass); +}; // end of class GrTableManager + +} // namespace gr + + +#endif // !GR_TABLEMAN_INCLUDED diff --git a/Build/source/libs/graphite/engine-2.4/src/segment/Main.h b/Build/source/libs/graphite/engine-2.4/src/segment/Main.h new file mode 100644 index 00000000000..8a67e29a5a6 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/src/segment/Main.h @@ -0,0 +1,189 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 1999, 2001 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: Main.h +Responsibility: Sharon Correll +Last reviewed: Not yet. + +Description: + Main.header file for the Graphite engine. +----------------------------------------------------------------------------------------------*/ +#ifdef _MSC_VER +#pragma once +#endif +#ifndef GRAPHITE_H +#define GRAPHITE_H 1 + +//:End Ignore + +#define NO_EXCEPTIONS 1 + +// It's okay to use functions that were declared deprecated by VS 2005: +#ifdef _MSC_VER +#define _CRT_SECURE_NO_DEPRECATE +#pragma warning(disable: 4996) // warning: function was declared deprecated +#pragma warning(disable: 4702) // unreachable code +#pragma warning(push) +#pragma warning(disable: 4548) // expression has no effect + +#endif + +#include "GrCommon.h" + +//:>******************************************************************************************** +//:> Interfaces. +//:>******************************************************************************************** +#include "GrData.h" + +//:>******************************************************************************************** +//:> Implementations. +//:>******************************************************************************************** + +#ifndef _WIN32 +#include "GrMstypes.h" +#ifndef HAVE_FABSF +float fabsf(float x); +#endif +#endif +#include "GrDebug.h" + +// For reading the font (FieldWorks's approach) and transduction logging: +#include +#include + +#include +////#include +#include +#include + +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +// gAssert should be used for any kind of assertions that can be caused by a corrupted font, +// particularly those that won't be caught when loading the tables. +#define gAssert(x) Assert(x) +// When testing the error mechanism (because the process of bringing up the assertion dialog +// interferes with FW repainting the invalid window: +////#define gAssert(x) if (!(x)) Warn("corrupted font?") + +// Internal headers. +#include "FileInput.h" + +// Public headers. +#include "GrResult.h" +//////#include "IGrGraphics.h" +#include "ITextSource.h" +#include "IGrJustifier.h" +#include "IGrEngine.h" +#include "GrConstants.h" +#include "GrFeature.h" + +// External helper classes. +#include "GrExt.h" + + +// Forward declarations. +namespace gr +{ + class GrTableManager; + class Segment; + class GrEngine; +} + +// Define after GrExt.h to avoid conflict with FW Rect class. +namespace gr +{ +/* +struct Point +{ + float x; + float y; + + Point() + { + x = y = 0; + } + + Point(POINT & p) + { + x = (float)p.x; + y = (float)p.y; + } +}; + + +struct Rect +{ + float top; + float bottom; + float left; + float right; + + Rect() + { + top = bottom = left = right = 0; + }; + + Rect(RECT & r) + { + top = (float)r.top; + bottom = (float)r.bottom; + left = (float)r.left; + right = (float)r.right; + }; +}; +*/ +}; // namespace gr + +#include "GrFeatureValues.h" +#include "GrSlotState.h" + +#include "SegmentAux.h" + +// Internal headers +#include "GrCharStream.h" +#include "GrGlyphTable.h" +#include "GrClassTable.h" +#include "GrPseudoMap.h" +#include "GrSlotStream.h" +#include "GrFSM.h" +#include "GrPass.h" +#include "GrTableManager.h" +#include "FontCache.h" + + +// Public headers +#include "Font.h" +#include "GraphiteProcess.h" +#include "GrEngine.h" +#include "FontFace.h" +#include "Segment.h" +#include "SegmentPainter.h" + +//#ifdef _WIN32 +//#include +//#include "WinFont.h" +//#include "WinSegmentPainter.h" +//#endif + +// Internal headers +#include "TtfUtil.h" +//#include "GrUtil.h" + +#include "GrWrappers.h" + +//#include "IGrDebug.h" +//#include "GrSegmentDebug.h" +//#include "GrEngineDebug.h" + +/////<<<<<<< .mine +// clashes with non gr stuff +// using namespace gr; +///////>>>>>>> .r98 + +#endif // GRAPHITE_H + diff --git a/Build/source/libs/graphite/engine-2.4/src/segment/Makefile.am b/Build/source/libs/graphite/engine-2.4/src/segment/Makefile.am new file mode 100644 index 00000000000..75b3607e1dc --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/src/segment/Makefile.am @@ -0,0 +1,24 @@ +segmentdir = $(top_srcdir)/src/segment + +libgraphite_la_SOURCES += $(segmentdir)/FileInput.cpp +libgraphite_la_SOURCES += $(segmentdir)/FontCache.cpp +libgraphite_la_SOURCES += $(segmentdir)/FontFace.cpp +libgraphite_la_SOURCES += $(segmentdir)/GrCharStream.cpp +libgraphite_la_SOURCES += $(segmentdir)/GrClassTable.cpp +libgraphite_la_SOURCES += $(segmentdir)/GrEngine.cpp +libgraphite_la_SOURCES += $(segmentdir)/GrFeature.cpp +libgraphite_la_SOURCES += $(segmentdir)/GrFSM.cpp +libgraphite_la_SOURCES += $(segmentdir)/GrGlyphTable.cpp +libgraphite_la_SOURCES += $(segmentdir)/GrPassActionCode.cpp +libgraphite_la_SOURCES += $(segmentdir)/GrPass.cpp +libgraphite_la_SOURCES += $(segmentdir)/GrSlotState.cpp +libgraphite_la_SOURCES += $(segmentdir)/GrSlotStream.cpp +libgraphite_la_SOURCES += $(segmentdir)/GrTableManager.cpp +libgraphite_la_SOURCES += $(segmentdir)/MemoryUsage.cpp +libgraphite_la_SOURCES += $(segmentdir)/Platform.cpp +libgraphite_la_SOURCES += $(segmentdir)/SegmentAux.cpp +libgraphite_la_SOURCES += $(segmentdir)/Segment.cpp +libgraphite_la_SOURCES += $(segmentdir)/TransductionLog.cpp + +EXTRA_DIST += $(segmentdir)/*.h + diff --git a/Build/source/libs/graphite/engine-2.4/src/segment/MemoryUsage.cpp b/Build/source/libs/graphite/engine-2.4/src/segment/MemoryUsage.cpp new file mode 100644 index 00000000000..d31496d7c54 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/src/segment/MemoryUsage.cpp @@ -0,0 +1,779 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 1999, 2001 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: MemoryUsage.cpp +Responsibility: Sharon Correll +Last reviewed: Not yet. + +Description: + Calculates memory usage for the engine and segments. +----------------------------------------------------------------------------------------------*/ + +#pragma warning(disable: 4244) // conversion from wchar_t to char +#pragma warning(disable: 4702) // unreachable code + +//:>******************************************************************************************** +//:> Include files +//:>******************************************************************************************** + +#include "GrCommon.h" +#include "GrData.h" +#ifndef _WIN32 +#include "GrMstypes.h" +#endif +#include "GrDebug.h" +//#include +#include +#include +//#include +// Forward declarations. + +#include "Main.h" + +//namespace gr +//{ +// class GrTableManager; +// class Segment; +// class GrEngine; +//} +// +//#include "GrTableManager.h" +//#include "GrFeatureValues.h" +//#include "GrSlotState.h" +//#include "SegmentAux.h" +//#include "Segment.h" +#include "MemoryUsage.h" + +//#ifndef _MSC_VER +//#include "config.h" +//#endif + +#ifdef _MSC_VER +#pragma hdrstop +#endif + +//:End Ignore + +//:>******************************************************************************************** +//:> Forward declarations +//:>******************************************************************************************** + +//:>******************************************************************************************** +//:> Local Constants and static variables +//:>******************************************************************************************** + +const int stringOverhead = (3 * sizeof(int)) + (sizeof(void *)) + (8 * sizeof(short)); +const int vectorOverhead = 3 * sizeof(void *); + +namespace gr +{ + +//:>******************************************************************************************** +//:> Font/engine +//:>******************************************************************************************** + +void FontMemoryUsage::initialize() +{ + font = 0; + fontCache = 0; + fontFace = 0; + + eng_count = 0; + eng_overhead = 0; + eng_scalars = 0; + eng_strings = 0; + eng_pointers = 0; + eng_cmap = 0; + eng_nameTable = 0; + + pseudoMap = 0; + + clstbl_counters = 0; + clstbl_offsets = 0; + clstbl_glyphList = 0; + + glftbl_general = 0; + glftbl_compDefns = 0; + glftbl_attrTable = 0; + glftbl_attrOffsets = 0; + + lngtbl_general = 0; + lngtbl_entries = 0; + lngtbl_featureSets = 0; + + tman_general = 0; + + pass_count = 0; + pass_general = 0; + pass_fsm = 0; + pass_ruleExtras = 0; + pass_constraintOffsets = 0; + pass_constraintCode = 0; + pass_actionOffsets = 0; + pass_actionCode = 0; + + engst_general = 0; + engst_passState = 0; + + sstrm_count = 0; + sstrm_general = 0; + sstrm_chunkMapsUsed = 0; + sstrm_chunkMapsAlloc = 0; + sstrm_reprocBuf = 0; + + slot_count = 0; + slot_general = 0; + slot_abstract = 0; + slot_varLenBuf = 0; + slot_assocsUsed = 0; + slot_assocsAlloc = 0; + slot_attachUsed = 0; + slot_attachAlloc = 0; +} + +/*---------------------------------------------------------------------------------------------- + Return the total byte count. +----------------------------------------------------------------------------------------------*/ +int FontMemoryUsage::total() +{ + int grandTotal = 0; + grandTotal += font + fontCache + fontFace; + grandTotal += eng_overhead + eng_scalars + eng_strings + eng_pointers + eng_cmap + eng_nameTable; + grandTotal += pseudoMap; + grandTotal += clstbl_counters + clstbl_offsets + clstbl_glyphList; + grandTotal += glftbl_general + glftbl_compDefns + glftbl_attrTable + glftbl_attrOffsets; + grandTotal += lngtbl_general + lngtbl_entries + lngtbl_featureSets; + grandTotal += tman_general; + grandTotal += pass_general + pass_fsm + pass_ruleExtras + + pass_constraintOffsets + pass_constraintCode + pass_actionOffsets + pass_actionCode; + grandTotal += engst_general + engst_passState; + grandTotal += sstrm_general + sstrm_chunkMapsAlloc + sstrm_reprocBuf; + grandTotal += slot_general + slot_abstract + slot_varLenBuf + slot_assocsAlloc + slot_attachAlloc; + + return grandTotal; +} + +/*---------------------------------------------------------------------------------------------- + Add the results of two runs together. +----------------------------------------------------------------------------------------------*/ +void FontMemoryUsage::add(FontMemoryUsage & fmu) +{ + font += fmu.font; + fontCache += fmu.fontCache; + fontFace += fmu.fontFace; + + eng_count += fmu.eng_count; + eng_overhead += fmu.eng_overhead; + eng_scalars += fmu.eng_scalars; + eng_strings += fmu.eng_strings; + eng_pointers += fmu.eng_pointers; + eng_cmap += fmu.eng_cmap; + eng_nameTable += fmu.eng_nameTable; + + pseudoMap += fmu.pseudoMap; + + clstbl_counters += fmu.clstbl_counters; + clstbl_offsets += fmu.clstbl_offsets; + clstbl_glyphList += fmu.clstbl_glyphList; + + glftbl_general += fmu.glftbl_general; + glftbl_compDefns += fmu.glftbl_compDefns; + glftbl_attrTable += fmu.glftbl_attrTable; + glftbl_attrOffsets += fmu.glftbl_attrOffsets; + + lngtbl_general += fmu.lngtbl_general; + lngtbl_entries += fmu.lngtbl_entries; + lngtbl_featureSets += fmu.lngtbl_featureSets; + + tman_general += fmu.tman_general; + + pass_count += fmu.pass_count; + pass_general += fmu.pass_general; + pass_fsm += fmu.pass_fsm; + pass_ruleExtras += fmu.pass_ruleExtras; + pass_constraintOffsets += fmu.pass_constraintOffsets; + pass_constraintCode += fmu.pass_constraintCode; + pass_actionOffsets += fmu.pass_actionOffsets; + pass_actionCode += fmu.pass_actionCode; + + engst_general += fmu.engst_general; + engst_passState += fmu.engst_passState; + + sstrm_count += fmu.sstrm_count; + sstrm_general += fmu.sstrm_general; + sstrm_chunkMapsUsed += fmu.sstrm_chunkMapsUsed; + sstrm_chunkMapsAlloc += fmu.sstrm_chunkMapsAlloc; + sstrm_reprocBuf += fmu.sstrm_reprocBuf; + + slot_count += fmu.slot_count; + slot_general += fmu.slot_general; + slot_abstract += fmu.slot_abstract; + slot_varLenBuf += fmu.slot_varLenBuf; + slot_assocsUsed += fmu.slot_assocsUsed; + slot_assocsAlloc += fmu.slot_assocsAlloc; + slot_attachUsed += fmu.slot_attachUsed; + slot_attachAlloc += fmu.slot_attachAlloc; +} + +/*---------------------------------------------------------------------------------------------- + Add up the memory used by all the engines in the cache. +----------------------------------------------------------------------------------------------*/ +FontMemoryUsage Font::calculateMemoryUsage() +{ + FontMemoryUsage fmu; + FontFace::calculateAllMemoryUsage(fmu); + return fmu; +} + +void FontFace::calculateAllMemoryUsage(FontMemoryUsage & fmu) +{ + s_pFontCache->calculateMemoryUsage(fmu); +} + +void FontCache::calculateMemoryUsage(FontMemoryUsage & fmuTotal) +{ + fmuTotal.fontCache += sizeof(int) * 4; // m_cfci, m_cfciMax, m_cfface, m_flush + fmuTotal.fontCache += sizeof(void*); // m_prgfci; + + // Iterate through all the font faces in the cache. + for (int ifci = 0; ifci < m_cfci; ifci++) + { + CacheItem * pfci = m_prgfci + ifci; + char rgchFontName[32]; + memset(rgchFontName, 0, 32 * sizeof(char)); + std::copy(pfci->szFaceName, pfci->szFaceName + 32, rgchFontName); + std::string strFontName(rgchFontName); + fmuTotal.vstrFontNames.push_back(strFontName); + int cface = 0; + if (pfci->pffaceRegular) + { + FontMemoryUsage fmu; + pfci->pffaceRegular->calculateMemoryUsage(fmu); + fmuTotal.add(fmu); + fmuTotal.vFontTotalsReg.push_back(fmu.total()); + cface++; + } + else + fmuTotal.vFontTotalsReg.push_back(0); + + if (pfci->pffaceBold) + { + FontMemoryUsage fmu; + pfci->pffaceBold->calculateMemoryUsage(fmu); + fmuTotal.add(fmu); + fmuTotal.vFontTotalsBold.push_back(fmu.total()); + cface++; + } + else + fmuTotal.vFontTotalsBold.push_back(0); + + if (pfci->pffaceItalic) + { + FontMemoryUsage fmu; + pfci->pffaceItalic->calculateMemoryUsage(fmu); + fmuTotal.add(fmu); + fmuTotal.vFontTotalsItalic.push_back(fmu.total()); + cface++; + } + else + fmuTotal.vFontTotalsItalic.push_back(0); + + if (pfci->pffaceBI) + { + FontMemoryUsage fmu; + pfci->pffaceBI->calculateMemoryUsage(fmu); + fmuTotal.add(fmu); + fmuTotal.vFontTotalsBI.push_back(fmu.total()); + cface++; + } + else + fmuTotal.vFontTotalsBI.push_back(0); + + fmuTotal.vFaceCount.push_back(cface); + } +} + +void FontFace::calculateMemoryUsage(FontMemoryUsage & fmu) +{ + fmu.fontFace += sizeof(int); // m_cfonts + fmu.fontFace += sizeof(void *) * 2; // s_pFontCache, m_pgreng + + fmu.font += m_cfonts * sizeof(void*); // m_pfface + + fmu.addEngine(m_pgreng); +} + +void FontMemoryUsage::addEngine(GrEngine * pgreng) +{ + eng_count++; + + eng_overhead += sizeof(long); // m_cref + eng_scalars += sizeof(bool) * 6; // m_fBold, m_fItalic, m_fSmart... + eng_scalars += sizeof(bool) * 2; // m_fFakeItalicCache, m_fFakeBICache; + eng_strings += stringOverhead * 4; // m_strCtrlFileReg/Bold/Italic/BI + eng_strings += sizeof(wchar_t) * pgreng->m_strCtrlFileReg.length(); + eng_strings += sizeof(wchar_t) * pgreng->m_strCtrlFileBold.length(); + eng_strings += sizeof(wchar_t) * pgreng->m_strCtrlFileItalic.length(); + eng_strings += sizeof(wchar_t) * pgreng->m_strCtrlFileBI.length(); + eng_scalars += sizeof(bool); + eng_strings += stringOverhead * 6; // m_stuCtrlFile etc. + eng_strings += sizeof(wchar_t) * pgreng->m_stuCtrlFile.length(); + eng_strings += sizeof(wchar_t) * pgreng->m_stuInitError.length(); + eng_strings += sizeof(wchar_t) * pgreng->m_stuFaceName.length(); + eng_strings += sizeof(wchar_t) * pgreng->m_stuFeatures.length(); + eng_strings += sizeof(wchar_t) * pgreng->m_stuBaseFaceName.length(); + eng_scalars += sizeof(bool); // m_fUseSepBase + eng_scalars += sizeof(GrResult) * 2; // m_resFontRead, m_resFontValid + eng_scalars += sizeof(FontErrorCode); + eng_scalars += sizeof(int) * 3; // m_fxdBadVersion, m_nFontCheckSum, m_nScriptTag, m_grfsdc + eng_scalars += sizeof(bool); // m_fRightToLeft + eng_scalars += sizeof(int) * 2; // m_mXAscent, m_mXDescent + eng_scalars += sizeof(float); // m_dysOffset + eng_scalars += sizeof(bool); // m_fBasicJust + eng_scalars += sizeof(int); // m_cJLevels + eng_pointers += sizeof(void*) * 4; // m_ptman, m_pctbl, m_pgtbl, m_pfface + eng_scalars += sizeof(GrFeature) * kMaxFeatures; + eng_scalars += sizeof(int); // m_cfeat + eng_scalars += sizeof(size_t); // m_clcidFeatLabelLangs + eng_scalars += sizeof(short) * pgreng->m_clcidFeatLabelLangs; + // m_langtbl + eng_scalars += sizeof(bool); // m_fLineBreak + eng_scalars += sizeof(int) * 2; // m_cchwPreXlbContext, m_cchwPostXlbContext + eng_scalars += sizeof(data16) * 7; // m_chwPseudoAttr, etc. + eng_scalars += sizeof(gid16); // m_chwLBGlyphID + eng_scalars += sizeof(int) * 4; // m_cComponents, m_cnUserDefn, m_cnCompPerLig, m_mFontEmUnits + + pseudoMap += sizeof(int) * 3; + pseudoMap += sizeof(GrPseudoMap) * pgreng->m_cpsd; + + eng_cmap += sizeof(void*) * 2; + eng_cmap += sizeof(byte*); + eng_cmap += sizeof(bool); + if (pgreng->m_fCmapTblCopy) + eng_cmap += pgreng->m_cbCmapTbl; + + eng_nameTable += sizeof(byte *); + eng_nameTable += sizeof(bool); + if (pgreng->m_fNameTblCopy) + eng_nameTable += pgreng->m_cbNameTbl; + + eng_scalars += sizeof(bool) * 2; // m_fLogXductn, m_fInErrorState + + clstbl_counters += sizeof(int) * 2; // m_ccls, m_cclsLinear + clstbl_offsets += sizeof(data16) * (pgreng->m_pctbl->m_ccls + 1); + clstbl_glyphList += sizeof(data16) * (pgreng->m_pctbl->m_prgichwOffsets[pgreng->m_pctbl->m_ccls]); + + glftbl_general += sizeof(int) * 3; // m_cglf, m_cComponents, m_cgstbl + glftbl_general += vectorOverhead; // m_vpgstbl + GrGlyphSubTable * pgstbl = pgreng->m_pgtbl->m_vpgstbl[0]; + glftbl_general += sizeof(int) * 4; // m_fxdSilfVersion, m_nAttrIDLim, m_cComponents, m_cnCompPerLig + glftbl_general += sizeof(bool) * 2; // m_fHasDebugStrings, m_fGlocShort + glftbl_general += sizeof(data16) * 3; // m_chw...Attr + glftbl_compDefns += sizeof(int) * (pgstbl->m_cnCompPerLig + 1) * pgreng->m_pgtbl->m_cglf; + glftbl_attrTable += sizeof(int) * 2; // m_fxdSilfVersion, m_cbEntryBufLen + glftbl_attrTable += sizeof(byte) * pgstbl->m_pgatbl->m_cbEntryBufLen; + glftbl_attrOffsets += + (pgreng->m_pgtbl->m_cglf + 1) * ((pgstbl->m_fGlocShort) ? sizeof(data16) : sizeof(data32)); + + lngtbl_general += sizeof(size_t); // m_clang + lngtbl_general += sizeof(data16) * 3; // m_dilangInit, m_cLoop, m_ilangStart + lngtbl_general += sizeof(void*) * 2; // m_prglang, m_prgfset + lngtbl_general += sizeof(int); // m_cbOffset0 + lngtbl_entries += sizeof(GrLangTable::LangEntry) * pgreng->m_langtbl.m_clang; + lngtbl_featureSets += sizeof(GrLangTable::FeatSet) * pgreng->m_langtbl.m_cfset; + + GrTableManager * ptman = pgreng->m_ptman; + tman_general += sizeof(int) * 4; // m_cpass, m_cpassLB, m_ipassPos1, m_ipassJust1 + tman_general += sizeof(bool); // m_fBidi + tman_general += sizeof(void*) * 2; // m_prgppass, m_pgreng + tman_general += sizeof(void*) * ptman->m_cpass; // m_prgppass + tman_general += sizeof(bool); // m_fLogging + + pass_count += ptman->m_cpass; + for (int ipass = 0; ipass < ptman->m_cpass; ipass++) + { + GrPass * ppass = ptman->m_prgppass[ipass]; + pass_general = sizeof(GrPass); + + GrFSM * pfsm = ppass->m_pfsm; + if (pfsm) + { + pass_fsm += sizeof(int) * 5; // m_crow, m_crowFinal, m_rowFinalMin, m_crowNonAcpt, m_ccol + pass_fsm += sizeof(void*) * 3; // m_prgirulnMin, m_prgrulnMatched, m_prgrowTransitions + int crowSuccess = pfsm->m_crow - pfsm->m_crowNonAcpt; + pass_fsm += sizeof(data16) * (crowSuccess + 1); // m_prgirulnMin + pass_fsm += sizeof(data16) * (pfsm->m_crulnMatched); // m_prgrulnMatched + pass_fsm += sizeof(short) * ((pfsm->m_crow - pfsm->m_crowFinal) * pfsm->m_ccol); + pass_fsm += sizeof(data16); // m_dimcrInit, m_cLoop, m_imcrStart + pass_fsm += sizeof(int); // m_cmcr + pass_fsm += sizeof(void*); // m_prgmcr + pass_fsm += sizeof(GrFSMClassRange) * pfsm->m_cmcr; + pass_fsm += sizeof(int) * 2; // m_critMinRulePreContext, m_critMaxRulePreContext + pass_fsm += sizeof(void*); // m_prgrowStartStates + pass_fsm += sizeof(short) * (pfsm->m_critMaxRulePreContext - pfsm->m_critMinRulePreContext + 1); + } + + pass_ruleExtras = sizeof(data16) * ppass->m_crul; // m_prgchwRuleSortKeys + pass_ruleExtras = sizeof(byte*) * ppass->m_crul; // m_prgcritRulePreModContext + + pass_constraintOffsets += sizeof(data16) * (ppass->m_crul + 1); + pass_actionOffsets =+ sizeof(data16) * (ppass->m_crul + 1); + + pass_constraintCode += sizeof(byte) * ppass->m_cbConstraints; + pass_actionCode += sizeof(byte) * ppass->m_cbActions; + + pass_general += sizeof(bool) * ppass->m_crul; // m_prgfRuleOkay + pass_general += vectorOverhead; // m_vnStack + pass_general += sizeof(int) * ppass->m_vnStack.capacity(); + } + + engst_general += sizeof(EngineState); + engst_general += sizeof(void *) * ptman->m_engst.m_vslotblk.capacity(); + engst_general += sizeof(void *) * ptman->m_engst.m_vprgnSlotVarLenBufs.capacity(); + engst_general += sizeof(void *) * ptman->m_engst.m_cpass; // m_prgpsstrm + + engst_passState += sizeof(PassState) * ptman->m_engst.m_cpass; + + for (int isstrm = 0; isstrm < ptman->m_engst.m_cpass; isstrm++) + { + sstrm_count++; + GrSlotStream * psstrm = ptman->m_engst.m_prgpsstrm[isstrm]; + sstrm_general += sizeof(GrSlotStream); + sstrm_chunkMapsUsed += psstrm->m_vislotPrevChunkMap.size(); + sstrm_chunkMapsUsed += psstrm->m_vislotPrevChunkMap.size(); + sstrm_chunkMapsAlloc += psstrm->m_vislotPrevChunkMap.capacity(); + sstrm_chunkMapsAlloc += psstrm->m_vislotNextChunkMap.capacity(); + sstrm_reprocBuf += psstrm->m_vpslotReproc.capacity(); + sstrm_reprocBuf += sizeof(int) * 2; + sstrm_general -= sizeof(int) * 2; + } + + slot_general += ptman->m_engst.m_vslotblk.size() * EngineState::kSlotBlockSize + * (sizeof(GrSlotState) - sizeof(GrSlotAbstract)); + slot_abstract += ptman->m_engst.m_vslotblk.size() * EngineState::kSlotBlockSize + * sizeof(GrSlotAbstract); + int cnExtraPerSlot = ptman->m_engst.m_cUserDefn + (ptman->m_engst.m_cCompPerLig * 2) + + ptman->m_engst.m_cFeat; + slot_varLenBuf += EngineState::kSlotBlockSize * cnExtraPerSlot * sizeof(u_intslot); + for (size_t islotblk = 0; islotblk < ptman->m_engst.m_vslotblk.size(); islotblk++) + { + for (int islot = 0; islot < EngineState::kSlotBlockSize; islot++) + { + slot_count++; + GrSlotState * pslot = ptman->m_engst.m_vslotblk[islotblk] + islot; + slot_assocsUsed += pslot->m_vpslotAssoc.size(); + slot_assocsAlloc += pslot->m_vpslotAssoc.capacity(); + slot_attachUsed += pslot->m_vdislotAttLeaves.size(); + slot_attachAlloc += pslot->m_vdislotAttLeaves.capacity(); + } + } + +} + +/*---------------------------------------------------------------------------------------------- + Write out the memory usage onto a stream. +----------------------------------------------------------------------------------------------*/ +void FontMemoryUsage::prettyPrint(std::ostream & strm) +{ + int totalBytes = total(); + + strm << "Number of engines: " << eng_count << "\n"; + strm << "Number of passes: " << pass_count << "\n\n"; + + strm << "Number of slot streams: " << sstrm_count << "\n"; + strm << "Number of slots: " << slot_count << "\n\n"; + + int classTableTotal = clstbl_counters + clstbl_offsets + clstbl_glyphList; + int glyphTableTotal = glftbl_general + glftbl_compDefns + glftbl_attrTable + glftbl_attrOffsets; + int langTableTotal = lngtbl_general + lngtbl_entries + lngtbl_featureSets; + int passTotal = pass_general + pass_fsm + pass_ruleExtras + pass_constraintOffsets + pass_constraintCode + + pass_actionOffsets + pass_actionCode; + int engineTotal = eng_overhead + eng_scalars + eng_strings + eng_pointers + eng_cmap + eng_nameTable + + pseudoMap + classTableTotal + glyphTableTotal + langTableTotal + tman_general + + passTotal; + + strm << "BYTE COUNT TOTALS\n"; + strm << "Font: " << font << "\n"; + strm << "Font cache: " << fontCache << "\n"; + strm << "Font face: " << fontFace << "\n"; + strm << "Engine " << engineTotal << "\n"; + strm << " Overhead: " << eng_overhead << "\n"; + strm << " Scalars: " << eng_scalars << "\n"; + strm << " Strings: " << eng_strings << "\n"; + strm << " Pointers: " << eng_pointers << "\n"; + strm << " Cmap table: " << eng_cmap << "\n"; + strm << " Name table: " << eng_nameTable << "\n"; + strm << " Pseudo map: " << pseudoMap << "\n"; + strm << " Class table: " << classTableTotal << "\n"; + strm << " Counters: " << clstbl_counters << "\n"; + strm << " Offsets: " << clstbl_offsets << "\n"; + strm << " Glyph list: " << clstbl_glyphList << "\n"; + strm << " Glyph table: " << glyphTableTotal << "\n"; + strm << " General: " << glftbl_general << "\n"; + strm << " Component defns: " << glftbl_compDefns << "\n"; + strm << " Attr table: " << glftbl_attrTable << "\n"; + strm << " Attr offsets: " << glftbl_attrOffsets << "\n"; + strm << " Language table: " << langTableTotal << "\n"; + strm << " General: " << lngtbl_general << "\n"; + strm << " Entries: " << lngtbl_entries << "\n"; + strm << " Feature sets: " << lngtbl_featureSets << "\n"; + strm << " Table manager: " << tman_general << "\n"; + strm << " Passes: " << passTotal << "\n"; + strm << " General: " << pass_general << "\n"; + strm << " FSM: " << pass_fsm << "\n"; + strm << " Rule extras: " << pass_ruleExtras << "\n"; + strm << " Constraint offsets: " << pass_constraintOffsets << "\n\n"; + strm << " Constraint code: " << pass_constraintCode << "\n"; + strm << " Action offsets: " << pass_actionOffsets << "\n"; + strm << " Action code: " << pass_actionCode << "\n\n"; + + int slotTotal = slot_general + slot_abstract + slot_varLenBuf + slot_assocsAlloc + slot_attachAlloc; + int streamTotal = sstrm_general + sstrm_chunkMapsAlloc + sstrm_reprocBuf + slotTotal; + int engineStateTotal = engst_general + engst_passState + streamTotal; + + strm << " Engine State: " << engineStateTotal << "\n"; + strm << " General: " << engst_general << "\n"; + strm << " Pass states: " << engst_passState << "\n"; + strm << " Slot streams: " << streamTotal << "\n"; + strm << " General: " << sstrm_general << "\n"; + strm << " Chunk maps: " << sstrm_chunkMapsAlloc << " (" << sstrm_chunkMapsUsed << " used)\n"; + strm << " Reprocess buffer: " << sstrm_reprocBuf << "\n"; + strm << " Slots: " << slotTotal << "\n"; + strm << " General: " << slot_general << "\n"; + strm << " Abstract: " << slot_abstract << "\n"; + strm << " Var-length buf: " << slot_varLenBuf << "\n"; + strm << " Associations: " << slot_assocsAlloc << " (" << slot_assocsUsed << " used)\n"; + strm << " Attachments: " << slot_attachAlloc << " (" << slot_attachUsed << " used)\n\n"; + + strm << "Total bytes used: " << totalBytes << "\n\n"; + + strm << "TOTALS PER FONT\n"; + for (size_t ifont = 0; ifont < vstrFontNames.size(); ifont++) + { + strm << vstrFontNames[ifont].c_str() << "\n"; + strm << " Regular: " << vFontTotalsReg[ifont] << "\n"; + strm << " Bold: " << vFontTotalsBold[ifont] << "\n"; + strm << " Italic: " << vFontTotalsItalic[ifont] << "\n"; + strm << " Bold-italic: " << vFontTotalsBI[ifont] << "\n\n"; + } +} + + +//:>******************************************************************************************** +//:> Segment +//:>******************************************************************************************** + +/*---------------------------------------------------------------------------------------------- + Initialize the data structure. +----------------------------------------------------------------------------------------------*/ +void SegmentMemoryUsage::initialize() +{ + seg_count = 0; + overhead = 0; + pointers = 0; + scalars = 0; + strings = 0; + metrics = 0; + associations = 0; + init = 0; + obsolete = 0; + + slot_count = 0; + slot_abstract = 0; + slot_varLenBuf = 0; + slot_scalars = 0; + slot_clusterMembers = 0; + + glyphInfo_count = 0; + glyphInfo = 0; + + wastedVector = 0; +} + +/*---------------------------------------------------------------------------------------------- + Add the memory for the segemtn to the SegmentMemoryUsage data structure. +----------------------------------------------------------------------------------------------*/ +void Segment::calculateMemoryUsage(SegmentMemoryUsage & smu) +{ + smu.addSegment(*this); +} + + +void SegmentMemoryUsage::addSegment(Segment & seg) +{ + seg_count++; + + overhead += sizeof(long); // m_cref + pointers += sizeof(void*); // m_pgts + scalars += sizeof(int); // m_dichwLim + scalars += sizeof(int); // m_ichwMin + pointers += sizeof(void*); // m_pfont + pointers += sizeof(void*); // m_preneng + scalars += sizeof(bool); // m_fErroneous + pointers += sizeof(void*); // m_pgjus + scalars += sizeof(LayoutEnvironment); + scalars += sizeof(bool); // m_fWsRtl + scalars += sizeof(bool); // m_fParaRtl + scalars += sizeof(TrWsHandling); + scalars += sizeof(int); // m_nDirDepth + init += sizeof(byte*); // m_prgbNextSegDat + init += sizeof(int); // m_cbNextSegDat + init += sizeof(byte) * seg.m_cbNextSegDat; + init += sizeof(byte*); // m_prgInitDat + init += sizeof(int); // m_cbInitDat + init += sizeof(byte) * seg.m_cbInitDat; + init += sizeof(int); // m_dichPreContext +// obsolete += sizeof(void *); // m_psegPrev +// obsolete += sizeof(void *); // m_psegNext +// strings += stringOverhead * 2; +// strings += sizeof(wchar_t) * seg.m_stuFaceName.length(); +// strings += sizeof(wchar_t) * seg.m_stuBaseFaceName.length(); +// scalars += sizeof(bool); // m_fUseSepBase; +// scalars += sizeof(float); // m_pixHeight +// scalars += sizeof(bool); // m_fBold +// scalars += sizeof(bool); // m_fItalic + scalars += sizeof(LineBrk); // m_lbStart + scalars += sizeof(LineBrk); // m_lbEnd + scalars += sizeof(bool); // m_fStartLine + scalars += sizeof(bool); // m_fEndLine + scalars += sizeof(SegEnd); // m_est + metrics += sizeof(int); // m_mFontEmUnits + metrics += sizeof(float) * 17; // was 19, removed m_x/ysDPI + associations += sizeof(int); // m_ichwAssocsMin + associations += sizeof(int); // m_ichwAssocsLim + int dichw = seg.m_ichwAssocsLim - seg.m_ichwAssocsMin; + associations += sizeof(int*); // m_prgisloutBefore + associations += sizeof(int) * dichw; + associations += sizeof(int*); // m_prgisloutAfter + associations += sizeof(int) * dichw; + associations += sizeof(void*); // m_prgpvisloutAssocs + associations += sizeof(void*) * dichw; + for (int idichw = 0; idichw < dichw; idichw++) + { + std::vector * pvisloutAssocs = seg.m_prgpvisloutAssocs[idichw]; + if (pvisloutAssocs) + { + associations += vectorOverhead; + associations += sizeof(int) * pvisloutAssocs->capacity(); + wastedVector += sizeof(int) * (pvisloutAssocs->capacity() - pvisloutAssocs->size()); + } + } + associations += sizeof(int*); // m_prgisloutLigature + associations += sizeof(int) * dichw; + associations += sizeof(sdata8*); // m_prgiComponent + associations += sizeof(sdata8) * dichw; +// obsolete += sizeof(void*); // m_psstrm + scalars += sizeof(int); // m_cslout + slot_count += seg.m_cslout; + for (int islout = 0; islout < seg.m_cslout; islout++) + { + GrSlotOutput * pslout = seg.m_prgslout + islout; + slot_abstract += sizeof(gid16) * 2; // m_chwGlyphID, m_chwActual + slot_abstract += sizeof(sdata8) * 4; // m_spsl, m_dirc, m_lb, m_nDirLevel +// slot_abstract += sizeof(float) * 8; // font/glyph metrics + slot_abstract += sizeof(short) * 5; // slot attributes - was 21 + slot_abstract += sizeof(int); // m_mJWidth0; + slot_abstract += sizeof(byte); // m_nJWeight0; + slot_abstract += sizeof(bool); // m_fInsertBefore + slot_abstract += sizeof(sdata8); // m_bIsSpace + slot_abstract += sizeof(byte); // m_cnCompPerLig + slot_abstract += sizeof(void*); // m_prgnVarLenBuf + slot_varLenBuf += pslout->CExtraSpaceSlout() * sizeof(u_intslot); + slot_abstract += sizeof(float); // m_xsPositionX, m_ysPositionY +// slot_abstract += sizeof(bool); // m_fAdvXSet, m_fAdvYSet + slot_scalars += sizeof(int) * 2; // m_ichwBefore/AfterAssoc + slot_scalars += sizeof(sdata8); // m_cComponents + slot_scalars += sizeof(int); // m_isloutClusterBase + slot_scalars += sizeof(sdata8); // m_disloutCluster + slot_scalars += sizeof(float) * 3; // m_xsClusterXOffset, m_xsClusterAdvance, m_xsAdvanceX + slot_scalars += sizeof(int); // m_igbb +// slot_scalars += sizeof(Rect); // m_rectBB + } + scalars += sizeof(int); // m_cnUserDefn + scalars += sizeof(int); // m_cnCompPerLig + scalars += sizeof(int); // m_cnFeat + glyphInfo_count += seg.m_cginf; + scalars += sizeof(int); // m_cginf; + scalars += sizeof(int); // m_isloutGinf0 + for (int iginf = 0; iginf < seg.m_cginf; iginf++) + { + ///GlyphInfo * pginf = seg.m_prgginf + iginf; + glyphInfo += sizeof(void *); // m_pseg + glyphInfo += sizeof(void *); // m_pslout + glyphInfo += sizeof(int); // m_islout + } + init += sizeof(int); // m_cslotRestartBackup + init += vectorOverhead; + init += sizeof(sdata8) * seg.m_vnSkipOffsets.capacity(); + wastedVector += sizeof(sdata8) * (seg.m_vnSkipOffsets.capacity() - seg.m_vnSkipOffsets.size()); + init += sizeof(DirCode); // m_dircPrevStrong + init += sizeof(DirCode); // m_dircPrevTerm + + //int grandTotal; + //grandTotal = overhead + pointers + scalars + strings + metrics + associations + // + init + obsolete + slot_count + slot_abstract + slot_varLenBuf + slot_scalars + // + slot_clusterMembers + glyphInfo_count + glyphInfo; + + //int totalPerSeg = grandTotal / seg_count; +} + +/*---------------------------------------------------------------------------------------------- + Write out the memory usage onto a stream. +----------------------------------------------------------------------------------------------*/ +void SegmentMemoryUsage::prettyPrint(std::ostream & strm) +{ + int totalBytes = overhead + pointers + scalars + strings + metrics + associations + + init + obsolete + slot_count + slot_abstract + slot_varLenBuf + slot_scalars + + slot_clusterMembers + glyphInfo_count + glyphInfo; + + int slotTotal = slot_abstract + slot_varLenBuf + slot_scalars + slot_clusterMembers; + + strm << "Number of segments: " << seg_count << "\n\n"; + + strm << "TOTALS\n"; + strm << "Overhead: " << overhead << "\n"; + strm << "Pointers: " << pointers << "\n"; + strm << "Scalars: " << scalars << "\n"; + strm << "Strings: " << strings << "\n"; + strm << "Metrics: " << metrics << "\n"; + strm << "Associations: " << associations << "\n"; + strm << "Obsolete: " << obsolete << "\n"; + strm << "Slot data: " << slotTotal << "\n"; + strm << " Abstract: " << slot_abstract << "\n"; + strm << " Var-length buffer: " << slot_varLenBuf << "\n"; + strm << " Scalars: " << slot_scalars << "\n"; + strm << " Cluster members: " << slot_clusterMembers << "\n"; + strm << "Glyph info: " << glyphInfo << "\n\n"; + + strm << "Wasted in vectors: " << wastedVector << "\n\n"; + + strm << "Total bytes used: " << totalBytes << "\n\n"; + + if (seg_count > 0) + { + strm << "AVERAGES\n"; + strm << "Overhead: " << overhead/seg_count << "\n"; + strm << "Pointers: " << pointers/seg_count << "\n"; + strm << "Scalars: " << scalars/seg_count << "\n"; + strm << "Strings: " << strings/seg_count << "\n"; + strm << "Metrics: " << metrics/seg_count << "\n"; + strm << "Associations: " << associations/seg_count << "\n"; + strm << "Obsolete: " << obsolete/seg_count << "\n"; + strm << "Slot data: " << slotTotal/seg_count << "\n"; + strm << " Abstract: " << slot_abstract/seg_count << "\n"; + strm << " Var-length buffer: " << slot_varLenBuf/seg_count << "\n"; + strm << " Scalars: " << slot_scalars/seg_count << "\n"; + strm << " Cluster members: " << slot_clusterMembers/seg_count << "\n"; + strm << "Glyph info: " << glyphInfo/seg_count << "\n\n"; + + strm << "Avg. bytes per segment: " << totalBytes / seg_count << "\n\n"; + + strm << "Avg. # of slots per segment: " << slot_count / seg_count << "\n\n"; + } +} + +} //namespace gr + diff --git a/Build/source/libs/graphite/engine-2.4/src/segment/Platform.cpp b/Build/source/libs/graphite/engine-2.4/src/segment/Platform.cpp new file mode 100644 index 00000000000..30ec3f4bf1f --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/src/segment/Platform.cpp @@ -0,0 +1,113 @@ +#include "GrPlatform.h" + +#ifdef _WIN32 +#include "windows.h" + +namespace gr +{ + +size_t Platform_UnicodeToANSI(const utf16 * prgchwSrc, size_t cchwSrc, char * prgchsDst, size_t cchsDst) +{ + return ::WideCharToMultiByte(CP_ACP, 0, (LPCWSTR)prgchwSrc, cchwSrc, prgchsDst, cchsDst, NULL, NULL); +} + +size_t Platform_AnsiToUnicode(const char * prgchsSrc, size_t cchsSrc, utf16 * prgchwDst, size_t cchwDst) +{ + return ::MultiByteToWideChar(CP_ACP, 0, prgchsSrc, cchsSrc, (LPWSTR)prgchwDst, cchwDst); +} + +size_t Platform_8bitToUnicode(int nCodePage, const char * prgchsSrc, int cchsSrc, + utf16 * prgchwDst, int cchwDst) +{ + return ::MultiByteToWideChar(nCodePage, 0, prgchsSrc, cchsSrc, (LPWSTR)prgchwDst, cchwDst); +} + +size_t utf8len(const char *s) +{ + return mbstowcs(NULL,s,0); +} + +utf16 *utf16cpy(utf16 *dest, const utf16 *src) +{ + return (utf16*)wcscpy((wchar_t*)dest, (const wchar_t*)src); +} + +utf16 *utf16ncpy(utf16 *dest, const utf16 *src, size_t n) +{ + return (utf16*)wcsncpy((wchar_t*)dest, (const wchar_t*)src, n); +} + +utf16 *utf16ncpy(utf16 *dest, const char *src, size_t n) +{ + #ifdef UTF16DEBUG + std::cerr << "utf16ncpy8: " << src << std::endl; + #endif + Platform_AnsiToUnicode(src, strlen(src), dest, n); + return dest; +} + + +size_t utf16len(const utf16 *s) +{ + return wcslen((const wchar_t*)s); +} + +int utf16cmp(const utf16 *s1, const utf16 *s2) +{ +return wcscmp((const wchar_t*)s1, (const wchar_t*)s2); +} + +int utf16ncmp(const utf16 *s1, const utf16 *s2, size_t n) +{ + return wcsncmp((const wchar_t*)s1, (const wchar_t*)s2, n); +} + +int utf16cmp(const utf16 *s1, const char *s2) +{ + while (*s1 && s2) + { + if (*s1 < *s2) + { + return -1; + } + if (*s1 > *s2) + { + return 1; + } + *s1++; + *s2++; + } + if (*s1) return -1; + else if (*s2) return 1; + return 0; +} + +} +#else // not _WIN32 + +#include +#include +#include + +#ifndef HAVE_FABSF +float fabsf(float x) +{ + return (x < 0.0f) ? -x : x; +} +#endif + +namespace gr +{ + +size_t utf16len(const utf16 *s) +{ + // assumes NULL terminated strings + const utf16 *start = s; + for (; *s; ++s); + + return s - start; +} + +} // namespace gr +#endif // _WIN32 + diff --git a/Build/source/libs/graphite/engine-2.4/src/segment/Segment.cpp b/Build/source/libs/graphite/engine-2.4/src/segment/Segment.cpp new file mode 100644 index 00000000000..0f6efa0e470 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/src/segment/Segment.cpp @@ -0,0 +1,3577 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 1999, 2001 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: Segment.cpp +Responsibility: Sharon Correll +Last reviewed: Not yet. + +Description: + Implements a Graphite segment--a range of rendered text in one writing system, that can be + rendered with a single font, and that fits on a single line. +-------------------------------------------------------------------------------*//*:End Ignore*/ + +//:>******************************************************************************************** +//:> Include files +//:>******************************************************************************************** +#include "Main.h" +#ifdef _MSC_VER +#pragma hdrstop +#endif +// any other headers (not precompiled) +#include +#ifndef _WIN32 +#include +#endif + +//:>******************************************************************************************** +//:> Forward declarations +//:>******************************************************************************************** + +//:>******************************************************************************************** +//:> Local Constants and static variables +//:>******************************************************************************************** +#if 0 // TODO remove +namespace +{ + +static bool g_fDrawing; + +} // namespace +#endif + + +static int g_csegTotal = 0; + +namespace gr +{ + +//:>******************************************************************************************** +//:> Segment methods +//:>******************************************************************************************** + + +int Segment::GetSegmentCount() /// TEMP +{ + return g_csegTotal; +} + + +/*---------------------------------------------------------------------------------------------- + Constructor: basic initialization. +----------------------------------------------------------------------------------------------*/ +Segment::Segment() : + m_pgts(NULL), + m_pfont(NULL), + m_preneng(NULL), + m_fErroneous(false), + m_pgjus(NULL), + m_prgbNextSegDat(NULL), + m_cbNextSegDat(0), + m_prgInitDat(NULL), + m_cbInitDat(0), +// m_fUseSepBase(0), + //m_psegAltEndLine(NULL), + m_prgisloutBefore(NULL), + m_prgisloutAfter(NULL), + m_prgpvisloutAssocs(NULL), + m_prgisloutLigature(NULL), + m_prgiComponent(NULL), +// m_psstrm(NULL), + m_cslout(0), + m_prgslout(NULL), + m_prgnSlotVarLenBuf(NULL), +// m_cnUserDefn(0), + m_cnCompPerLig(0), +// m_cnFeat(0), + m_cginf(0), + m_prgginf(NULL) +{ + m_cref = 1; + + g_csegTotal++; + +// m_stuFaceName.erase(); +// m_stuBaseFaceName.erase(); + m_vnSkipOffsets.clear(); +} + +/*---------------------------------------------------------------------------------------------- + Reference counting. +----------------------------------------------------------------------------------------------*/ + +long Segment::IncRefCount(void) +{ + AssertPtr(this); + return InterlockedIncrement(&m_cref); +} + +long Segment::DecRefCount(void) +{ + AssertPtr(this); + long cref = InterlockedDecrement(&m_cref); + if (cref == 0) { + m_cref = 1; + delete this; + } + return cref; +} + +/*---------------------------------------------------------------------------------------------- + Constructor to fit as much of the text on the line as possible, + finding a reasonable break point if necessary. +----------------------------------------------------------------------------------------------*/ +LineFillSegment::LineFillSegment( + Font * pfont, + ITextSource * pts, + LayoutEnvironment * playoutArg, + toffset ichStart, + toffset ichStop, + float xsMaxWidth, + bool fBacktracking) + : Segment() +{ + if (!pfont) + throw; + if (!pts) + throw; + + LayoutEnvironment layoutDefault; + LayoutEnvironment * playout = (!playoutArg) ? &layoutDefault : playoutArg; + + pfont->RenderLineFillSegment(this, pts, *playout, ichStart, ichStop, xsMaxWidth, + fBacktracking); +} + +/*---------------------------------------------------------------------------------------------- + Constructor to create a segment representing the given range of characters. +----------------------------------------------------------------------------------------------*/ +RangeSegment::RangeSegment( + Font * pfont, + ITextSource * pts, + LayoutEnvironment * playoutArg, + toffset ichStart, + toffset ichStop, + Segment * psegInitLike) + : Segment() +{ + if (!pfont) + throw; + if (!pts) + throw; + + LayoutEnvironment layoutDefault; + LayoutEnvironment * playout = (!playoutArg) ? &layoutDefault : playoutArg; + playout->setSegmentForInit(psegInitLike); + + pfont->RenderRangeSegment(this, pts, *playout, ichStart, ichStop); + + playout->setSegmentForInit(NULL); +} + +/*---------------------------------------------------------------------------------------------- + Constructor to create a justified segment. Private. +----------------------------------------------------------------------------------------------*/ +JustSegmentAux::JustSegmentAux( + Font * pfont, + ITextSource * pts, + LayoutEnvironment * playoutArg, + toffset ichStart, + toffset ichStop, + float xsNaturalWidth, + float xsJustifiedWidth, + Segment * psegInitLike) + : Segment() +{ + if (!pfont) + throw; + if (!pts) + throw; + + LayoutEnvironment layoutDefault; + LayoutEnvironment * playout = (!playoutArg) ? &layoutDefault : playoutArg; + playout->setSegmentForInit(psegInitLike); + + pfont->RenderJustifiedSegment(this, pts, *playout, ichStart, ichStop, + xsNaturalWidth, xsJustifiedWidth); + + playout->setSegmentForInit(NULL); +} + +//Segment::Segment(ITextSource * pgts, int ichwMin, int ichwLim, +// LineBrk lbStart, LineBrk lbEnd, +// bool fStartLine, bool fEndLine, bool fWsRtl) +//{ +// m_cref = 1; +// Initialize(pgts, ichwMin, ichwLim, lbStart, lbEnd, fStartLine, fEndLine, fWsRtl); +//} + +void Segment::Initialize(ITextSource * pgts, int ichwMin, int ichwLim, + LineBrk lbStart, LineBrk lbEnd, SegEnd est, + bool fStartLine, bool fEndLine, bool fWsRtl) +{ + AssertPtrN(pgts); + Assert(ichwMin >= 0); + Assert(ichwLim >= 0); + Assert(ichwMin <= ichwLim); + + //pgts->TextSrcObject(&m_pgts); // create a permanent wrapper, if necessary + // m_pgts->AddRef(); no, smart pointer + m_pgts = pgts; + + m_ichwMin = ichwMin; + m_dichwLim = ichwLim - ichwMin; + m_lbStart = lbStart; + m_lbEnd = lbEnd; + m_est = est; + m_dxsStretch = 0; + m_dxsWidth = -1; + m_dysAscent = -1; // to properly init, ComputeDimensions must be called + m_dysHeight = -1; + m_dysXAscent = -1; + m_dysXDescent = -1; + m_dysAscentOverhang = -1; + m_dysDescentOverhang = -1; + m_dxsLeftOverhang = -1; + m_dxsRightOverhang = -1; + m_dysOffset = 0; + m_fStartLine = fStartLine; + m_fEndLine = fEndLine; + m_fWsRtl = fWsRtl; + + m_dxsVisibleWidth = -1; + m_dxsTotalWidth = -1; + m_ichwAssocsMin = 0; + m_ichwAssocsLim = 0; + +// m_psstrm = NULL; + m_prgslout = NULL; + m_prgnSlotVarLenBuf = NULL; + m_prgisloutBefore = NULL; + m_prgisloutAfter = NULL; + m_prgpvisloutAssocs = NULL; + m_prgisloutLigature = NULL; + m_prgiComponent = NULL; + + m_prgbNextSegDat = NULL; + m_cbNextSegDat = 0; + + //m_psegAltEndLine = NULL; + +// m_stuFaceName.erase(); +// m_stuBaseFaceName.erase(); +// m_fUseSepBase = false; + +// m_psegPrev = NULL; // obsolete +// m_psegNext = NULL; + + //InitializePlatform(); +} + +/*---------------------------------------------------------------------------------------------- + Destructor. +----------------------------------------------------------------------------------------------*/ +Segment::~Segment() +{ + g_csegTotal--; + + DestroyContents(); +} + +void Segment::DestroyContents() +{ + delete m_pfont; + m_pfont = NULL; + + //if (m_pgts) + // // A specially-created wrapper object has to be deleted. + // m_pgts->DeleteTextSrcPtr(); + m_pgts = NULL; + + //if (m_pgjus) + // // A specially-created wrapper object has to be deleted. + // m_pgjus->DeleteJustifierPtr(); + m_pgjus = NULL; + + //if (m_psegAltEndLine) + //{ + // if (m_psegAltEndLine->m_psegAltEndLine == this) + // m_psegAltEndLine->m_psegAltEndLine = NULL; + // delete m_psegAltEndLine; + //} + + //for (int iginf = 0; iginf < m_cginf; iginf++) // DELETE + // delete m_prgginf[iginf].components; + + Assert((m_prgslout && m_prgnSlotVarLenBuf) || (!m_prgslout && !m_prgnSlotVarLenBuf)); + delete[] m_prgslout; + delete[] m_prgnSlotVarLenBuf; + delete[] m_prgisloutBefore; + delete[] m_prgisloutAfter; + for (int ichw = 0; ichw < m_ichwAssocsLim - m_ichwAssocsMin; ichw++) + { + if (m_prgpvisloutAssocs && m_prgpvisloutAssocs[ichw]) + delete m_prgpvisloutAssocs[ichw]; + } + delete[] m_prgpvisloutAssocs; + delete[] m_prgisloutLigature; + delete[] m_prgiComponent; + delete[] m_prgbNextSegDat; + delete[] m_prgInitDat; + delete[] m_prgginf; + m_cginf = 0; + + //DestroyContentsPlatform(); + + // ReleaseObj(m_pgts); automatic because smart pointer +} + +/*---------------------------------------------------------------------------------------------- + Factory method to create a new version of an existing segment with different + line-boundary flags. +----------------------------------------------------------------------------------------------*/ +Segment * Segment::LineContextSegment(Segment & seg, bool fStartLine, bool fEndLine) +{ + if (!seg.hasLineBoundaryContext()) + { + // Make an identical segment and just change the flags. + Segment * psegNew = new Segment(seg); + psegNew->InitLineContextSegment(fStartLine, fEndLine); + return psegNew; + } + else + { + // Rerun the processing. + LayoutEnvironment layout = seg.Layout(); + layout.setStartOfLine(fStartLine); + layout.setEndOfLine(fEndLine); + ITextSource & gts = seg.getText(); + Font & font = seg.getFont(); + return new RangeSegment(&font, >s, &layout, + seg.startCharacter(), seg.stopCharacter(), &seg); + } +} + +void Segment::InitLineContextSegment(bool fStartLine, bool fEndLine) +{ + // For RTL end-of-line segments, trailing white space hangs off the left of + // the origin of the segment. So when changing that flag + // shift appropriately. + bool fShift = ((m_nDirDepth % 2) && (m_fEndLine != fEndLine)); + + m_fStartLine = fStartLine; + m_fEndLine = fEndLine; + + m_layout.setStartOfLine(fStartLine); + m_layout.setEndOfLine(fEndLine); + + if (fShift) + { + (m_fEndLine) ? + ShiftGlyphs(m_dxsVisibleWidth - m_dxsTotalWidth) : // shift left + ShiftGlyphs(m_dxsTotalWidth - m_dxsVisibleWidth); // shift right + } + + m_dxsWidth = -1; +} + +/*---------------------------------------------------------------------------------------------- + A factory method to create a justified version of an existing segment. +----------------------------------------------------------------------------------------------*/ +Segment * Segment::JustifiedSegment(Segment & seg, float xsNewWidth) +{ + LayoutEnvironment layout(seg.Layout()); + ITextSource & gts = seg.getText(); + + // Why do we have to do this? + layout.setJustifier(seg.Justifier()); + Font & font = seg.getFont(); + return new JustSegmentAux(&font, >s, &layout, + seg.startCharacter(), seg.stopCharacter(), + seg.advanceWidth(), xsNewWidth, &seg); +} + +/*---------------------------------------------------------------------------------------------- + A factory method to create a new version of an existing trailing white-space segment + with a different direction. +----------------------------------------------------------------------------------------------*/ +Segment * Segment::WhiteSpaceSegment(Segment & seg, int nNewDepth) +{ + Segment * psegNew = new Segment(seg); + psegNew->InitWhiteSpaceSegment(nNewDepth); + return psegNew; +} + +void Segment::InitWhiteSpaceSegment(int nNewDepth) +{ + if (nNewDepth == m_nDirDepth) + { + return; + } + else if ((nNewDepth % 2) == (m_nDirDepth % 2)) + { + // Same direction, not much to change. + m_nDirDepth = nNewDepth; + return; + } + else if (m_twsh != ktwshOnlyWs) + return; // couldn't change it, oh, well + + // Otherwise, do the hard stuff: reverse the positions of the glyphs. + for (int islout = 0; islout < m_cslout; islout++) + { + OutputSlot(islout)->ShiftForDirDepthChange(m_dxsTotalWidth); + } + m_nDirDepth = nNewDepth; + + //SetDirectionDepthPlatform(nNewDepth); +} + +/*---------------------------------------------------------------------------------------------- + Basic copy method. +----------------------------------------------------------------------------------------------*/ +Segment::Segment(const Segment & seg) +{ + int islout; + + m_pgts = seg.m_pgts; + m_dichwLim = seg.m_dichwLim; + m_ichwMin = seg.m_ichwMin; + m_pfont = seg.m_pfont->copyThis(); + m_preneng = seg.m_preneng; + m_fErroneous = seg.m_fErroneous; + m_pgjus = seg.m_pgjus; + m_fWsRtl = seg.m_fWsRtl; + m_fParaRtl = seg.m_fParaRtl; + m_twsh = seg.m_twsh; + m_nDirDepth = seg.m_nDirDepth; + m_cbNextSegDat = seg.m_cbNextSegDat; + m_prgbNextSegDat = new byte[m_cbNextSegDat]; + std::copy(seg.m_prgbNextSegDat, seg.m_prgbNextSegDat + m_cbNextSegDat, m_prgbNextSegDat); +// m_psegPrev = seg.m_psegPrev; +// m_psegNext = seg.m_psegNext; +// m_stuFaceName = seg.m_stuFaceName; +// m_stuBaseFaceName = seg.m_stuBaseFaceName; +// m_fUseSepBase = seg.m_fUseSepBase; +// m_pixHeight = seg.m_pixHeight; +// m_fBold = seg.m_fBold; +// m_fItalic = seg.m_fItalic; + m_lbStart = seg.m_lbStart; + m_lbEnd = seg.m_lbEnd; + m_fStartLine = seg.m_fStartLine; + m_fEndLine = seg.m_fEndLine; + m_est = seg.m_est; + m_mFontEmUnits = seg.m_mFontEmUnits; + m_dysFontAscent = seg.m_dysFontAscent; + m_dysFontDescent = seg.m_dysFontDescent; + m_xysEmSquare = seg.m_xysEmSquare; +// m_xsDPI = seg.m_xsDPI; +// m_ysDPI = seg.m_ysDPI; + m_dxsStretch = seg.m_dxsStretch; + m_dxsWidth = seg.m_dxsWidth; + m_dysHeight = seg.m_dysHeight; + m_dysAscent = seg.m_dysAscent; + m_dysXAscent = seg.m_dysXAscent; + m_dysXDescent = seg.m_dysXDescent; + m_dysAscentOverhang = seg.m_dysAscentOverhang; + m_dysDescentOverhang = seg.m_dysDescentOverhang; + m_dxsLeftOverhang = seg.m_dxsLeftOverhang; + m_dxsRightOverhang = seg.m_dxsRightOverhang; + m_dxsVisibleWidth = seg.m_dxsVisibleWidth; + m_dxsTotalWidth = seg.m_dxsTotalWidth; + m_isloutVisLim = seg.m_isloutVisLim; + m_dysOffset = seg.m_dysOffset; + + m_ichwAssocsMin = seg.m_ichwAssocsMin; + m_ichwAssocsLim = seg.m_ichwAssocsLim; + + int dichw = m_ichwAssocsLim - m_ichwAssocsMin; + m_prgisloutBefore = new int[dichw]; + std::copy(seg.m_prgisloutBefore, seg.m_prgisloutBefore + dichw, m_prgisloutBefore); + m_prgisloutAfter = new int[dichw]; + std::copy(seg.m_prgisloutAfter, seg.m_prgisloutAfter + dichw, m_prgisloutAfter); + m_prgpvisloutAssocs = new std::vector * [dichw]; + for (int ivislout = 0; ivislout < dichw; ivislout++) + { + std::vector * pvislout = seg.m_prgpvisloutAssocs[ivislout]; + if (pvislout) + { + std::vector * pvisloutNew = new std::vector; + m_prgpvisloutAssocs[ivislout] = pvisloutNew; + *pvisloutNew = *pvislout; // copy the vector + } + } + m_prgisloutLigature = new int[dichw]; + std::copy(seg.m_prgisloutLigature, seg.m_prgisloutLigature + dichw, m_prgisloutLigature); + m_prgiComponent = new sdata8[dichw]; + std::copy(seg.m_prgiComponent, seg.m_prgiComponent + dichw, m_prgiComponent); + + m_cslout = seg.m_cslout; + int cnExtraPerSlot = (m_cslout > 0) ? seg.m_prgslout[0].CExtraSpaceSlout() : 0; + m_prgnSlotVarLenBuf = new u_intslot[m_cslout * cnExtraPerSlot]; + m_prgslout = new GrSlotOutput[m_cslout]; + for (islout = 0; islout < m_cslout; islout++) + { + GrSlotOutput * psloutOrig = seg.m_prgslout + islout; + GrSlotOutput * psloutThis = m_prgslout + islout; + psloutThis->ExactCopyFrom(psloutOrig, + m_prgnSlotVarLenBuf + (islout * cnExtraPerSlot), // var-length buffer location + cnExtraPerSlot); + } + +// m_cnUserDefn = seg.m_cnUserDefn; + m_cnCompPerLig = seg.m_cnCompPerLig; +// m_cnFeat = seg.m_cnFeat; + m_cslotRestartBackup = seg.m_cslotRestartBackup; + std::copy(seg.m_prgnSlotVarLenBuf, seg.m_prgnSlotVarLenBuf + + (m_cslout * cnExtraPerSlot), m_prgnSlotVarLenBuf); + + m_cginf = seg.m_cginf; + m_isloutGinf0 = seg.m_isloutGinf0; + m_prgginf = new GlyphInfo[m_cginf]; + std::copy(seg.m_prgginf, seg.m_prgginf + m_cginf, m_prgginf); + for (int iginf = 0; iginf < m_cginf; iginf++) + { + m_prgginf[iginf].m_pseg = this; + m_prgginf[iginf].m_pslout = m_prgslout + m_prgginf[iginf].m_islout; + } + + // Platform-specific; remove eventually: + //m_cgstrm = seg.m_cgstrm; + //m_prggstrm = new GlyphStrm[m_cgstrm]; + //for (int igstrm = 0; igstrm < m_cgstrm; igstrm++) + //{ + // m_prggstrm[igstrm].gsk.ys = seg.m_prggstrm[igstrm].gsk.ys; + // m_prggstrm[igstrm].gsk.clrFore = seg.m_prggstrm[igstrm].gsk.clrFore; + // m_prggstrm[igstrm].gsk.clrBack = seg.m_prggstrm[igstrm].gsk.clrBack; + // m_prggstrm[igstrm].vchwGlyphId = seg.m_prggstrm[igstrm].vchwGlyphId; + // m_prggstrm[igstrm].vdxs = seg.m_prggstrm[igstrm].vdxs; + // m_prggstrm[igstrm].vigbb = seg.m_prggstrm[igstrm].vigbb; + // m_prggstrm[igstrm].xsStart = seg.m_prggstrm[igstrm].xsStart; + // m_prggstrm[igstrm].xsStartInt = seg.m_prggstrm[igstrm].xsStartInt; + //} + //m_cgbb = seg.m_cgbb; + //m_prggbb = new GlyphBb[m_cgbb]; + //memcpy(m_prggbb, seg.m_prggbb, m_cgbb * sizeof(GlyphBb)); + //------------------------------------- + + m_vnSkipOffsets = seg.m_vnSkipOffsets; + m_dircPrevStrong = seg.m_dircPrevStrong; + m_dircPrevTerm = seg.m_dircPrevTerm; + m_cbInitDat = seg.m_cbInitDat; + m_prgInitDat = new byte[m_cbInitDat]; + std::copy(seg.m_prgInitDat, seg.m_prgInitDat + m_cbInitDat, m_prgInitDat); +} + +/*---------------------------------------------------------------------------------------------- + Swap the guts of the two segments. + OBSOLETE +----------------------------------------------------------------------------------------------*/ +void Segment::SwapWith(Segment * pgrseg) +{ + int crefThis = m_cref; + int crefOther = pgrseg->m_cref; + + std::swap(*this, *pgrseg); + + m_cref = crefThis; + pgrseg->m_cref = crefOther; +} + +/*---------------------------------------------------------------------------------------------- + Delete the pointer to the alternate-end-of-line segment. +----------------------------------------------------------------------------------------------*/ +void Segment::ClearAltEndLineSeg() +{ + //if (m_psegAltEndLine) + //{ + // if (m_psegAltEndLine->m_psegAltEndLine == this) + // m_psegAltEndLine->m_psegAltEndLine = NULL; // so we don't get into a loop + // delete m_psegAltEndLine; + // m_psegAltEndLine = NULL; + //} +} + + +//:>******************************************************************************************** +//:> Interface methods +//:>******************************************************************************************** + +/*---------------------------------------------------------------------------------------------- + Return the font that was used to create this segment. + Note that in some implementations, the font may be invalid; eg, on Windows the font + may not contain a valid device context. +----------------------------------------------------------------------------------------------*/ +Font & Segment::getFont() +{ + return *m_pfont; +} + +/*---------------------------------------------------------------------------------------------- + Return the text-source that the segment is representing. +----------------------------------------------------------------------------------------------*/ +ITextSource & Segment::getText() +{ + return *m_pgts; +} + +/*---------------------------------------------------------------------------------------------- + The distance the drawing point should advance after drawing this segment. + Always positive, even for RtoL segments. +----------------------------------------------------------------------------------------------*/ +float Segment::advanceWidth() +{ + if (m_dxsWidth < 0) + { + ////SetUpGraphics(ichwBase, pgg, true); + ComputeDimensions(); + } + return m_dxsWidth; +} + +/*---------------------------------------------------------------------------------------------- + Compute the rectangle in destination coords which contains all the pixels drawn by + this segment. This should be a sufficient rectangle to invalidate if the segment is + about to be discarded. +----------------------------------------------------------------------------------------------*/ +Rect Segment::boundingRect() +{ + if (m_dxsWidth < 0) + { + ////SetUpGraphics(ichwBase, pgg, true); + ComputeDimensions(); + } + + Rect rectRet; + rectRet.top = m_dysAscent + m_dysAscentOverhang; + rectRet.bottom = (m_dysAscent - m_dysHeight) - m_dysDescentOverhang; + rectRet.left = m_dxsLeftOverhang; + rectRet.right = m_dxsVisibleWidth + m_dxsRightOverhang; + + return rectRet; +} + +/*---------------------------------------------------------------------------------------------- + Answer whether the primary direction of the segment is right-to-left. This is based + on the direction of the writing system, except for white-space-only segments, in + which case it is based on the main paragraph direction. +----------------------------------------------------------------------------------------------*/ +bool Segment::rightToLeft() +{ + if (m_twsh == ktwshOnlyWs) + { + // White-space-only segment: use main paragraph direction. + return (m_nDirDepth % 2 != 0)? true : false; + } + + GrEngine * pgreng = EngineImpl(); + if (pgreng) + { + return pgreng->RightToLeft(); + } + return (m_pgts->getRightToLeft(m_ichwMin) != 0)? true : false; +} + +/*---------------------------------------------------------------------------------------------- + Get the depth of direction embedding used by this segment. It is presumably the same + for all runs of the segment, otherwise, some of them would use a different writing + system and therefore be part of a different segment. So just use the first. +----------------------------------------------------------------------------------------------*/ +int Segment::directionDepth(bool * pfWeak) +{ + if (pfWeak) + { + *pfWeak = (m_twsh == ktwshOnlyWs); + //if (*pfWeak && m_ichwMin > 0) + //{ + // utf16 chw; + // m_pgts->fetch(m_ichwMin - 1, 1, &chw); + // if (chw == 0x202E || chw==0x202D) // overrides LRO & RLO + // *pfWeak = false; + //} + } + +// *pnDepth = m_pgts->getDirectionDepth(m_ichwLim); +// Assert(*pnDepth == m_nDirDepth); + + return m_nDirDepth; +} + +/*---------------------------------------------------------------------------------------------- + Change the direction of the segment. This is needed specifically for white-space-only + segments, which are initially created to be in the direction of the paragraph, but then + later are discovered to not be line-end after all, and need to be changed to use the + directionality of the writing system. + + @return kresFail for segments that do not have weak directionality and therefore + cannot be changed. +----------------------------------------------------------------------------------------------*/ +bool Segment::setDirectionDepth(int nNewDepth) +{ + Assert(false); + + if (nNewDepth == m_nDirDepth) + { + return true; + } + else if ((nNewDepth % 2) == (m_nDirDepth % 2)) + { + // Same direction, not much to change. + m_nDirDepth = nNewDepth; + return true; + } + else if (m_twsh != ktwshOnlyWs) + return false; + + // Otherwise, do the hard stuff: reverse the positions of the glyphs. + for (int islout = 0; islout < m_cslout; islout++) + { + OutputSlot(islout)->ShiftForDirDepthChange(m_dxsTotalWidth); + } + + //SetDirectionDepthPlatform(nNewDepth); + + return true; + +} + +/*---------------------------------------------------------------------------------------------- + The logical range of characters covered by the segment, relative to the beginning of + the segment. The stop character is the index of the first character beyond the end + of the segment. + + These values should be exact at a writing system or string boundary, + but may be somewhat fuzzy at a line-break, since characters may be re-ordered + across such boundaries. The renderer is free to apply any definition it likes of + where a line-break occurs. This should always be the same value obtained from the + renderer as pdichLimSeg. +----------------------------------------------------------------------------------------------*/ +int Segment::startCharacter() +{ + return m_ichwMin; +} + +int Segment::stopCharacter() +{ + return m_ichwMin + m_dichwLim; +} + +/*---------------------------------------------------------------------------------------------- + Returns an indication of why the segment ended. +----------------------------------------------------------------------------------------------*/ +bool Segment::startOfLine() +{ + return m_fStartLine; +} + +/*---------------------------------------------------------------------------------------------- + Returns an indication of why the segment ended. +----------------------------------------------------------------------------------------------*/ +bool Segment::endOfLine() +{ + return m_fEndLine; +} + +/*---------------------------------------------------------------------------------------------- + Returns true if this segment has something special happening at line boundaries. +----------------------------------------------------------------------------------------------*/ +bool Segment::hasLineBoundaryContext() +{ + return (EngineImpl()->LineBreakFlag()); +} + +/*---------------------------------------------------------------------------------------------- + Returns an indication of why the segment ended. +----------------------------------------------------------------------------------------------*/ +SegEnd Segment::segmentTermination() +{ + return m_est; +} + +/*---------------------------------------------------------------------------------------------- + Indicates the last character of interest to the segment, relative to the beginning + of the segment. The meaning of this is that no behavior of this segment will be + affected if characters beyond that change. This does not necessarily mean that + a different line break could not have been obtained by the renderer if characters + beyond that change, just that a segment with the boundaries of this one would + not behave differently. +----------------------------------------------------------------------------------------------*/ +//GrResult Segment::get_LimInterest(int ichwBase, int * pdichw) +//{ +// ChkGrOutPtr(pdichw); +// +// GrEngine * pgreng = EngineImpl(); +// Assert(pgreng); +// *pdichw = m_dichwLim + pgreng->PostXlbContext(); +// ReturnResult(kresOk); +//} + +/*---------------------------------------------------------------------------------------------- + Changes the end-of-line status of the segment. This is used after making the last segment + of a string if we want to attempt to put some more text after it (e.g., in another + writing system), or if we have reordered due to bidirectionality. + + ENHANCE: the current version handles switching back and forth when we are trying to + decide whether we can put more stuff on a line. So it assumes we are at the end of + the contextual run (ie, the next batch of stuff will be in a different ows). + This will not correctly handle the way this function could or possibly + should be used for bidirectional reordering. +----------------------------------------------------------------------------------------------*/ +/* +GrResult Segment::changeLineEnds(bool fNewStart, bool fNewEnd) +{ + if (m_fStartLine != fNewStart || m_fEndLine != fNewEnd) + { + if (EngineImpl()->LineBreakFlag()) + { + if (!m_psegAltEndLine) + { + int dichwLimSeg, dichwContext; + float dxWidth; + SegEnd est; + int cbNextSegDat; + byte rgbNextSegDat[256]; + OLECHAR rgchErrMsg[256]; + Segment * pseg; + + EngineImpl()->FindBreakPointAux(m_pfont, m_pgts, m_pgjus, + m_ichwMin, m_ichwMin + m_dichwLim, m_ichwMin + m_dichwLim, + false, fNewStart, fNewEnd, kPosInfFloat, false, + klbNoBreak, klbNoBreak, m_twsh, m_fParaRtl, + &pseg, + &dichwLimSeg, &dxWidth, &est, + m_cbInitDat, m_prgInitDat, 256, rgbNextSegDat, &cbNextSegDat, + &dichwContext, + NULL, + rgchErrMsg, 256); + // TODO: do something with the error message. This shouldn't really happen, + // since to get here we already created a segment with this font. + if (!pseg) + { + // Because we provide INT_MAX as the amount of space, there should + // always be enough room to generate the alternate segment. + Assert(false); + THROW(kresUnexpected); + } + Assert(cbNextSegDat == 0); + m_psegAltEndLine = pseg; + } + Assert(m_psegAltEndLine->m_fEndLine == fNewEnd); + Segment * pseg = m_psegAltEndLine; // save the value + SwapWith(m_psegAltEndLine); + m_psegAltEndLine = pseg; // reset it after swap + pseg->m_psegAltEndLine = this; + } + else + { + bool fShift = ((m_nDirDepth % 2) && (m_fEndLine != fNewEnd)); + m_fStartLine = fNewStart; + m_fEndLine = fNewEnd; + if (fShift) + { + (m_fEndLine) ? + ShiftGlyphs(m_dxsVisibleWidth - m_dxsTotalWidth) : // shift left + ShiftGlyphs(m_dxsTotalWidth - m_dxsVisibleWidth); // shift right + } + m_dxsWidth = -1; + } + } + + ReturnResult(kresOk); +} +*/ + +/*---------------------------------------------------------------------------------------------- + Get the type of break that occurs at the logical start of the segment. +----------------------------------------------------------------------------------------------*/ +LineBrk Segment::startBreakWeight() +{ + return m_lbStart; +} + +/*---------------------------------------------------------------------------------------------- + Get the type of break that occurs at the logical end of the segment. +----------------------------------------------------------------------------------------------*/ +LineBrk Segment::endBreakWeight() +{ + return m_lbEnd; +} + +/*---------------------------------------------------------------------------------------------- + Read the amount of stretch, that is, the difference between the actual and natural width. + If the segment has been shrunk, returns a negative number. + TODO: implement properly. +----------------------------------------------------------------------------------------------*/ +float Segment::stretch() +{ + return (float)m_dxsStretch; +} + +/*---------------------------------------------------------------------------------------------- + Return the maximum stretch possible. + TODO: implement properly. +----------------------------------------------------------------------------------------------*/ +float Segment::maxStretch() +{ + return 1000; +} + +/*---------------------------------------------------------------------------------------------- + Return the maximum shrink possible. + TODO: implement properly. +----------------------------------------------------------------------------------------------*/ +float Segment::maxShrink() +{ + return 0; +} + +/*---------------------------------------------------------------------------------------------- + Return iterators representing the complete range of glyphs in the segment. +----------------------------------------------------------------------------------------------*/ +std::pair Segment::glyphs() +{ + return std::make_pair(GlyphIterator(*this, 0), GlyphIterator(*this, m_cginf)); +} + +/*---------------------------------------------------------------------------------------------- + Return iterators representing the set of glyphs for the given character. +----------------------------------------------------------------------------------------------*/ +std::pair Segment::charToGlyphs(toffset ich) +{ + std::vector vislout = UnderlyingToLogicalAssocs(ich); + + if (vislout.size() == 0) + return std::make_pair(GlyphSetIterator(), GlyphSetIterator()); + else + { + // Note that BOTH instances of GlyphSetIterator must use the same underlying vector, + // so that comparisons make sense. + RcVector * qvislout = new RcVector(vislout); + return std::make_pair( + GlyphSetIterator(*this, 0, qvislout), + GlyphSetIterator(*this, vislout.size(), qvislout)); + } +} + +/*---------------------------------------------------------------------------------------------- + Return the rendered glyphs and their x- and y-coordinates, in the order generated by + the final positioning pass, relative to the top-left of the segment. They are always + returned in (roughly) left-to-right order. Note: any of the arrays may be null. +----------------------------------------------------------------------------------------------*/ +/* +GrResult Segment::GetGlyphsAndPositions( + Rect rs, Rect rd, int cchMax, int * pcchRet, + utf16 * prgchGlyphs, float * prgxd, float * prgyd, float * prgdxdAdv) +{ + ChkGrOutPtr(pcchRet); + if (prgchGlyphs) + ChkGrArrayArg(prgchGlyphs, cchMax); + if (prgxd) + ChkGrArrayArg(prgxd, cchMax); + if (prgyd) + ChkGrArrayArg(prgyd, cchMax); + if (prgdxdAdv) + ChkGrArrayArg(prgdxdAdv, cchMax); + + GrResult res; + + //SetUpGraphics(ichwBase, pgg, true); + + Assert(m_dxsWidth >= 0); + Assert(m_dysAscent >= 0); + + *pcchRet = m_cginf; + if (cchMax < m_cginf) + { + res = (cchMax == 0) ? kresFalse : kresInvalidArg; + //RestoreFont(pgg); + ReturnResult(res); + } + + if (m_dxsWidth < 0) + ComputeDimensions(); + + float dysFontAscent = m_dysFontAscent; + //////res = GetFontAscentSourceUnits(pgg, &dysFontAscent); + //////if (ResultFailed(res)) + //////{ + ////// RestoreFont(pgg); + ////// ReturnResult(res); + //////} + + float xs = 0; + // Top of text that sits on the baseline, relative to top of segment: + float ys = m_dysAscent - dysFontAscent; + + float * prgxdLocal; + if (prgxd == NULL) + prgxdLocal = new float[cchMax]; + else + prgxdLocal = prgxd; + + res = GetGlyphsAndPositionsPlatform(xs, ys, rs, rd, + prgchGlyphs, prgxdLocal, prgyd, prgdxdAdv); + + if (!prgxd) + delete[] prgxdLocal; + + //RestoreFont(pgg); + + ReturnResult(res); +} +*/ + +/*---------------------------------------------------------------------------------------------- + For debugging. Return the characters in this segment. + OBSOLETE +----------------------------------------------------------------------------------------------*/ +GrResult Segment::GetCharData(int cchMax, utf16 * prgch, int * pcchRet) +{ + ChkGrArgPtr(prgch); + ChkGrOutPtr(pcchRet); + + int ichLimTmp = m_ichwMin + min(m_dichwLim, cchMax); + m_pgts->fetch(m_ichwMin, ichLimTmp - m_ichwMin, prgch); + *pcchRet = ichLimTmp - m_ichwMin; + ReturnResult(kresOk); +} + +/*---------------------------------------------------------------------------------------------- + Return either the first or last character that the the glyph corresponds to. The + index of the glyph matches what was returned by GetGlyphsAndPositions. + OBSOLETE +----------------------------------------------------------------------------------------------*/ +GrResult Segment::GlyphToChar(int iginf, bool fFirst, int * pich) +{ + Assert(m_dxsWidth >= 0); + Assert(m_dysAscent >= 0); + + *pich = PhysicalSurfaceToUnderlying(iginf, fFirst); + ReturnResult(kresOk); +} + +/*---------------------------------------------------------------------------------------------- + Return all the characters that the glyph corresponds to. Most commonly this will + be only one char, but ligatures, for instance, will have several. The index of the + glyph matches what was returned by GetGlyphsAndPositions. + OBSOLETE +----------------------------------------------------------------------------------------------*/ +GrResult Segment::GlyphToAllChars(int iginf, + int cichMax, int * prgich, int * pcichRet) +{ + Assert(m_dxsWidth >= 0); + Assert(m_dysAscent >= 0); + + std::vector vich; + int ichFirst = PhysicalSurfaceToUnderlying(iginf, true); + int ichLast = PhysicalSurfaceToUnderlying(iginf, false); + Assert(ichFirst <= ichLast); + + if (ichFirst < ichLast) + { + // Loop over the range of characters that might be associated with this glyph + // and add any that actually are. + // TODO: we should probably use a method that gets us all the physical associations, + // but this should get us 99.5% of the way there for now. + for (int ich = ichFirst; ich <= ichLast; ich++) + { + int iginfFirst = UnderlyingToPhysicalSurface(ich, true); + int iginfLast = UnderlyingToPhysicalSurface(ich, false); + if (iginfFirst == iginf || iginfLast == iginf) + vich.push_back(ich); + } + } + else + vich.push_back(ichFirst); + + *pcichRet = vich.size(); + if (cichMax < signed(vich.size())) + { + GrResult res = (cichMax == 0 ? kresFalse : kresInvalidArg); + ReturnResult(res); + } + int * pi = prgich; + for (size_t i = 0; i < vich.size(); i++) + *pi++ = vich[i]; + + ReturnResult(kresOk); +} + +/*---------------------------------------------------------------------------------------------- + Return either the first or last glyph that corresponds to the character. The + index of the glyph matches what was returned by GetGlyphsAndPositions. + OBSOLETE +----------------------------------------------------------------------------------------------*/ +GrResult Segment::CharToGlyph(int ich, bool fFirst, int * pigbb) +{ + Assert(m_dxsWidth >= 0); + Assert(m_dysAscent >= 0); + + *pigbb = UnderlyingToPhysicalSurface(ich, fFirst); + ReturnResult(kresOk); +} + + +//:>******************************************************************************************** +//:> Non-FieldWorks interface methods +//:>******************************************************************************************** + +/*---------------------------------------------------------------------------------------------- + Return the breakweight for the given character. Returns the best value if the character is + mapped to glyphs with different values. +----------------------------------------------------------------------------------------------*/ +LineBrk Segment::getBreakWeight(int ich, bool fBreakBefore) +{ + LineBrk lbFirst, lbLast; + + int isloutFirst = UnderlyingToLogicalSurface(ich, true); + if (isloutFirst == kPosInfinity || isloutFirst == kNegInfinity) + return klbClipBreak; + GrSlotOutput * psloutFirst = m_prgslout + isloutFirst; + bool fNotFirst = false; + if ((psloutFirst->NumberOfComponents() > 0) + && psloutFirst->FirstUnderlyingComponent(0) != ich) + { + // Not the first component of a ligature. + lbFirst = (LineBrk) ((int)klbClipBreak * -1); + fNotFirst = true; + } + else + { + lbFirst = (LineBrk) psloutFirst->BreakWeight(); + } + + int isloutLast = UnderlyingToLogicalSurface(ich, false); + if (isloutLast == kPosInfinity || isloutLast == kNegInfinity) + return klbClipBreak; + GrSlotOutput * psloutLast = m_prgslout + isloutLast; + bool fNotLast = false; + int icompLast = psloutLast->NumberOfComponents() - 1; + if ((psloutLast->NumberOfComponents() > 0) + && psloutLast->LastUnderlyingComponent(icompLast) != ich) + { + // Not the last component of a ligature. + lbLast = klbClipBreak; + fNotLast = true; + } + else + { + lbLast = (LineBrk) psloutLast->BreakWeight(); + } + + LineBrk lbRet; + if (fNotLast && fNotFirst) + // middle of a ligature + lbRet = klbClipBreak; + else if (fNotLast) + lbRet = (fBreakBefore) ? lbFirst : klbClipBreak; + else if (fNotFirst) + lbRet = (fBreakBefore) ? klbClipBreak : lbLast; + else + lbRet = (fBreakBefore) ? lbFirst : lbLast; + + return lbRet; +} + +/*---------------------------------------------------------------------------------------------- + Return the width of the range of characters. Line-boundary contextualization is handled + by the measure attributes on the glyphs. The width returned is equivalent to the sum of + the widths of any line-segments that would be needed to underline all the characters. + + Since this method is intended to be used on "measured" segments that include the entire + paragraph, it is not very smart about handling cross-line-boundary contextualization. + It basically ignores any glyphs that are rendered by this segment but not officially + part of the segment. +----------------------------------------------------------------------------------------------*/ +float Segment::getRangeWidth(int ichMin, int ichLim, + bool /*fStartLine*/, bool /*fEndLine*/, bool fSkipSpace) +{ + if (m_dxsWidth < 0) + { + ////SetUpGraphics(ichwBase, pgg, true); + ComputeDimensions(); + } + + Assert(m_dxsWidth >= 0); + Assert(m_dysAscent >= 0); + + //float xsSegRight = m_dxsTotalWidth; + + int ichMinRange = min(ichMin, ichLim); + int ichLimRange = max(ichMin, ichLim); + + //int ichMinSeg = max(ichMinRange, m_ichwMin + m_ichwAssocsMin); + //int ichLimSeg = min(ichLimRange, m_ichwMin + m_ichwAssocsLim); + int ichMinSeg = max(ichMinRange, m_ichwMin); + int ichLimSeg = min(ichLimRange, m_ichwMin + m_dichwLim); + + if (ichLimSeg < m_ichwMin) // not + m_ichwAssocsMin + return 0; + if (ichMinSeg >= m_ichwMin + m_dichwLim) // not m_ichwAssocsLim + return 0; + + if (fSkipSpace) + { + int islout = UnderlyingToLogicalSurface(ichLimSeg - 1, true); + GrSlotOutput * pslout = (islout == kNegInfinity || islout == kPosInfinity) ? + NULL : + OutputSlot(islout); + while (pslout && pslout->IsSpace()) + { + ichLimSeg--; + islout = UnderlyingToLogicalSurface(ichLimSeg - 1, true); +// pslout = OutputSlot(islout); + pslout = (islout == kNegInfinity || islout == kPosInfinity) ? + NULL : OutputSlot(islout); + } + } + + float xsWidth = 0; + SegmentNonPainter segp(this); // doesn't really need to paint + float rgxdLefts[100]; + float rgxdRights[100]; + size_t cxd = 0; + if (ichMinRange < ichLimRange) + cxd = segp.getUnderlinePlacement(ichMinSeg, ichLimSeg, fSkipSpace, + 100, rgxdLefts, rgxdRights, NULL); + for (size_t i = 0; i < cxd; i++) + xsWidth += rgxdRights[i] - rgxdLefts[i]; + + // Add in the line-boundary contextualization. + int isloutFirst = UnderlyingToLogicalSurface(ichMin, true); + int isloutLast = UnderlyingToLogicalSurface(ichLim - 1, false); + int mSol = 0; + int mEol = 0; + if (0 <= isloutFirst && isloutFirst < m_cslout) + mSol = m_prgslout[isloutFirst].MeasureSol(); + if (0 <= isloutLast && isloutLast < m_cslout) + mEol = m_prgslout[isloutLast].MeasureEol(); + float dxsSol = GrEngine::GrIFIMulDiv(mSol, m_xysEmSquare, m_mFontEmUnits); + float dxsEol = GrEngine::GrIFIMulDiv(mEol, m_xysEmSquare, m_mFontEmUnits); + xsWidth += dxsSol; + xsWidth += dxsEol; + + //RestoreFont(pgg); + + return xsWidth; +} + +/*---------------------------------------------------------------------------------------------- + Return the next reasonable breakpoint after ichStart resulting in range that fits in + the specified width. +----------------------------------------------------------------------------------------------*/ +int Segment::findNextBreakPoint(int ichStart, + LineBrk lbPref, LineBrk lbWorst, float dxMaxWidth, + float * pdxBreakWidth, bool fStartLine, bool fEndLine) +{ + ChkGrOutPtr(pdxBreakWidth); + + int ichBreak; + + // First make a rough estimation of how much will fit, using a binary chop approach. + int iginfStart = UnderlyingToPhysicalSurface(ichStart, !m_fWsRtl); + int iginfEnd = UnderlyingToPhysicalSurface(m_ichwMin + m_dichwLim - 1, m_fWsRtl); + int iginfLeft = min(iginfStart, iginfEnd); + int iginfRight= max(iginfStart, iginfEnd); + + int iginfMin = iginfLeft; + int iginfLim = iginfRight; + int ichFit; + if (m_fWsRtl) // right-to-left + { + float xRight = GlyphLeftEdge(iginfRight + 1); + float xLeftMost = xRight - dxMaxWidth; + while (GlyphLeftEdge(iginfLim) < xLeftMost) + { + if (iginfLim - iginfMin <= 1) + break; + int iginfMid = (iginfLim + iginfMin) >> 1; // divide by 2 + if (GlyphLeftEdge(iginfMid) < xLeftMost) + iginfLim = iginfMid; + else + iginfMin = iginfMid; + } + ichFit = PhysicalSurfaceToUnderlying(iginfLim, false); + } + else // left-to-right + { + float xLeft = GlyphLeftEdge(iginfLeft); + float xRightMost = dxMaxWidth - xLeft; // QUESTION: shouldn't this be +, not -? + iginfLim++; + while (GlyphLeftEdge(iginfLim) > xRightMost) + { + if (iginfLim - iginfMin <= 1) + break; + int iginfMid = (iginfLim + iginfMin) >> 1; // divide by 2 + if (GlyphLeftEdge(iginfMid) > xRightMost) + iginfLim = iginfMid; + else + iginfMin = iginfMid; + } + Assert(iginfLim <= m_cginf); + if (iginfLim >= m_cginf) iginfLim = m_cginf - 1; + ichFit = PhysicalSurfaceToUnderlying(iginfLim, false); + } + + // Breaking after ichFit should pretty much fit in the space. But make sure. + float dxWidthFit; + while (ichFit > ichStart) + { + dxWidthFit = getRangeWidth(ichStart, ichFit, fStartLine, fEndLine); + if (dxWidthFit <= dxMaxWidth) + break; + ichFit--; + } + + if (ichFit <= ichStart) + { + // Nothing will fit. + return ichStart - 1; + } + + // Now look for a good break. First look forward until the range doesn't fit anymore. + int ichTry = ichFit; + int nExtra = 2; + LineBrk lbBest = klbClipBreak; + int ichBestBreak = -1; + while (nExtra > 0 && ichTry < m_ichwMin + m_dichwLim) + { + float dxWTmp; + dxWTmp = getRangeWidth(ichStart, ichTry, fStartLine, fEndLine); + if (dxWTmp <= dxMaxWidth) + { + LineBrk lbTmp; + lbTmp = getBreakWeight(ichTry - 1, false); + if (lbTmp > 0 && lbTmp < lbWorst && max(lbTmp, lbPref) <= lbBest) + { + ichBestBreak = ichTry; + lbBest = max(lbTmp, lbPref); // any value better than lbPref is insignificant + } + else + { + lbTmp = getBreakWeight(ichTry - 1, true); + if (lbTmp < 0) + { + lbTmp = LineBrk(max(lbTmp * -1L, long(lbPref))); + if (lbTmp < lbWorst && lbTmp <= lbBest) + { + ichBestBreak = ichTry - 1; + lbBest = lbTmp; + } + } + } + } + else + { + // Didn't fit. But it is theoretically possible that actually adding another + // character will! Try a few more. + nExtra--; + } + ichTry++; + } + + if (ichBestBreak > -1) + { + if (ichTry >= m_ichwMin + m_dichwLim) + { + // Break at the end of the segment. + ichBreak = m_ichwMin + m_dichwLim; + *pdxBreakWidth = getRangeWidth(ichStart, m_dichwLim, fStartLine, fEndLine); + return ichBreak; + } + + if (lbBest <= lbPref) + { + // Found a reasonable break by looking forward; return it. + ichBreak = ichBestBreak;// + m_ichwMin; + *pdxBreakWidth = getRangeWidth(ichStart, ichBestBreak, fStartLine, fEndLine); + return ichBreak; + } + } + + // Didn't find a really good break point looking forward from our rough guess. + // Now look backward. + + ichTry = ichFit; + while (ichTry > ichStart) + { + LineBrk lbTmp; + lbTmp = getBreakWeight(ichTry - 1, false); + if (lbTmp > 0 && lbTmp < lbWorst && max(lbTmp, lbPref) < lbBest) + { + ichBestBreak = ichTry; + lbBest = max(lbTmp, lbPref); // any value better than lbPref is insignificant + } + else + { + lbTmp = getBreakWeight(ichTry - 1, true); + if (lbTmp < 0) + { + lbTmp = LineBrk(max(lbTmp * -1L, long(lbPref))); + if (lbTmp < lbWorst && lbTmp < lbBest) + { + ichBestBreak = ichTry - 1; + lbBest = lbTmp; + } + } + } + if (lbBest <= lbPref) + break; + + ichTry--; + } + + if (ichBestBreak > -1 && ichBestBreak > ichStart) + { + // Found a reasonable break by looking backward; return it. + ichBreak = ichBestBreak;// + m_ichwMin; + *pdxBreakWidth = getRangeWidth(ichStart, ichBestBreak, fStartLine, fEndLine); + return ichBreak; + } + + // No reasonable break. + return ichStart - 1; +} + +/*---------------------------------------------------------------------------------------------- + Private; used by findNextBreakPoint(). +----------------------------------------------------------------------------------------------*/ +float Segment::GlyphLeftEdge(int iginf) +{ + if (iginf >= m_cginf) + return m_prgginf[m_cginf - 1].origin() + m_prgginf[m_cginf - 1].advanceWidth(); +// return m_prgginf[m_cginf].origin() + m_prgginf[m_cginf].advanceWidth(); + else + return m_prgginf[iginf].origin(); +} + + +//:>******************************************************************************************** +//:> Other methods +//:>******************************************************************************************** + +/*---------------------------------------------------------------------------------------------- + Get the embedded string. For temporary use; AddRef is not automatically called. + Do not release unless you AddRef. +----------------------------------------------------------------------------------------------*/ +ITextSource * Segment::GetString() +{ + return m_pgts; +} + +/*---------------------------------------------------------------------------------------------- + Compute the ascent, height, width, and overhangs of the segment. + The ascent is the ascent of the font (distance from the baseline to the top) + plus any extra ascent height specified by the font. + The descent is distance from the baseline to the bottom of font, plus any extra descent + specified by the font (ExtraDescent). + The ascent overhang is the distance from the top of the font to the top of the highest + glyph, or zero if all the glyphs fit within the ascent. + The descent overhang is the distance from the bottom of the font to the bottom of the lowest + glyph, or zero if all the glyphs fit within the descent. + The height is the sum of the ascent and descent. +----------------------------------------------------------------------------------------------*/ +void Segment::ComputeDimensions() +{ + if (m_fEndLine) + m_dxsWidth = m_dxsVisibleWidth; // don't include trailing white space. + else + m_dxsWidth = m_dxsTotalWidth; + + if (m_dxsWidth == -1) + { + for (int iginf = 0; iginf < m_cginf; iginf++) + { + GlyphInfo * pginf = m_prgginf + iginf; + if (pginf->isSpace()) + continue; + m_dxsWidth = max(m_dxsWidth, (pginf->origin() + pginf->advanceWidth())); + } + } + + int dysNegFontDescent = (int)m_dysFontDescent * -1; + + // if there were no glyphs in the segment then there is sometimes no EngineImpl + if (!EngineImpl()) + { + Assert(m_cslout == 0); + Assert(m_cginf == 0); + m_dxsWidth = 0; + m_dysAscent = 0; // max(0.0, m_dysFontAscent); + m_dysHeight = 0; // max(0.0, m_dysAscent - dysNegFontDescent); + m_dysAscentOverhang = 0; + m_dysDescentOverhang = 0; + m_dxsLeftOverhang = 0; + m_dxsRightOverhang = 0; + return; + } + + // Calculate the extra ascent and descent. + int mXAscent = EngineImpl()->ExtraAscent(); + int mXDescent = EngineImpl()->ExtraDescent(); + + m_dysXAscent = GrEngine::GrIFIMulDiv(mXAscent, m_xysEmSquare, m_mFontEmUnits); + m_dysXDescent = GrEngine::GrIFIMulDiv(mXDescent, m_xysEmSquare, m_mFontEmUnits); + + m_dysAscent = m_dysFontAscent + m_dysXAscent; + float dysNegDescent = dysNegFontDescent - m_dysXDescent; // dysNegDescent < 0 + m_dysHeight = m_dysAscent - dysNegDescent; + + // Calculate the overhangs. + float dysVisAscent = m_dysAscent; + float dysNegVisDescent = dysNegDescent; + float dxsVisLeft = 0; + float dxsVisRight = m_dxsTotalWidth; + ComputeOverhangs(&dysVisAscent, &dysNegVisDescent, &dxsVisLeft, &dxsVisRight); + m_dysAscentOverhang = max(float(0), (dysVisAscent - m_dysAscent)); + m_dysDescentOverhang = max(float(0), (dysNegDescent - dysNegVisDescent)); + m_dxsLeftOverhang = min(float(0), dxsVisLeft); + m_dxsRightOverhang = max(float(0), dxsVisRight - m_dxsTotalWidth); + + m_dysOffset = EngineImpl()->VerticalOffset(); +} + +/*---------------------------------------------------------------------------------------------- + Compute the visible ascent and descent, based on how much the bounding box of any + glyph may extend beyond the ascent or descent of the font. + Also compute the left- and right-overhangs. +----------------------------------------------------------------------------------------------*/ +void Segment::ComputeOverhangs(float * pdysVisAscent, float * pdysNegVisDescent, + float * pdxsVisLeft, float * pdxsVisRight) +{ + for (int iginf = 0; iginf < m_cginf; iginf++) + { + Rect bbox = m_prgginf[iginf].bb(); + + *pdysVisAscent = max(*pdysVisAscent, bbox.top); + *pdysNegVisDescent = min(*pdysNegVisDescent, bbox.bottom); + + *pdxsVisLeft = min(*pdxsVisLeft, bbox.left); + *pdxsVisRight = max(*pdxsVisRight, bbox.right); + } +} + +/*---------------------------------------------------------------------------------------------- + Create the arrays to store the final output and association information. +----------------------------------------------------------------------------------------------*/ +void Segment::SetUpOutputArrays(Font * pfont, GrTableManager * ptman, + GrSlotStream * psstrmFinal, + int cchwInThisSeg, int csloutSurface, gid16 chwLB, + TrWsHandling twsh, bool fParaRtl, int nDirDepth, +#ifdef NDEBUG + bool /*fEmpty*/) +#else + bool fEmpty) +#endif +{ + m_mFontEmUnits = EngineImpl()->GetFontEmUnits(); + + pfont->getFontMetrics(&m_dysFontAscent, &m_dysFontDescent, &m_xysEmSquare); +// m_xsDPI = (float)pfont->getDPIx(); +// m_ysDPI = (float)pfont->getDPIy(); + + // Note that storing both of these values is redundant; they should be the same. +// Assert(m_xysEmSquare == m_pixHeight); + + m_twsh = twsh; + m_fParaRtl = fParaRtl; + if (m_twsh == ktwshOnlyWs) + m_nDirDepth = (int)fParaRtl; + else if (fParaRtl && nDirDepth == 0) + m_nDirDepth = 2; + else + m_nDirDepth = nDirDepth; + + // Create association mappings and set up final versions of slots. + + Assert((psstrmFinal == NULL) == fEmpty); + + m_ichwAssocsMin = 0; + m_ichwAssocsLim = cchwInThisSeg; + + m_prgisloutBefore = new int[cchwInThisSeg]; + + m_prgisloutAfter = new int[cchwInThisSeg]; + + m_prgpvisloutAssocs = new std::vector * [cchwInThisSeg]; + + m_prgisloutLigature = new int[cchwInThisSeg]; + + m_prgiComponent = new sdata8[cchwInThisSeg]; + + int cslot = 0; + //m_psstrm = psstrmFinal; // TODO: make a local variable + if (psstrmFinal) + cslot = psstrmFinal->FinalSegLim(); + else + Assert(fEmpty); + + float xsMin = 0; + int islot; + int islotMin = (psstrmFinal) ? psstrmFinal->IndexOffset() : 0; + for (islot = islotMin; islot < cslot; islot++) + xsMin = min(xsMin, psstrmFinal->SlotAt(islot)->XPosition()); + + // For right-to-left segments, the draw origin is at the left side of the visible + // portion of the text. So if necessary, scoot everything left so that the invisible + // trailing white-space is to the left of the draw position. + Assert(m_dxsTotalWidth > -1); + Assert(m_dxsVisibleWidth > -1); + float dxsInvisible = (m_fEndLine) ? m_dxsTotalWidth - m_dxsVisibleWidth : 0; + for (islot = islotMin; ((m_nDirDepth % 2) && (islot < cslot)); islot++) + { + GrSlotState * pslot = psstrmFinal->SlotAt(islot); + // int islout = islot - islotMin; + if (pslot->GlyphID() == chwLB) + continue; // skip over linebreak markers + if (m_nDirDepth % 2) // redundant test + { + // RTL will have descending neg values, adjust to be positive. Also make sure + // invisible trailing white space is to the left of the draw origin. + // Review: will changing this value have side affects? + pslot->SetXPos(pslot->XPosition() - xsMin - dxsInvisible); + } + } + + Assert(kPosInfinity > 0); + Assert(kNegInfinity < 0); + for (int ichw = 0; ichw < cchwInThisSeg; ++ichw) + { + m_prgisloutBefore[ichw] = kPosInfinity; + m_prgisloutAfter[ichw] = kNegInfinity; + m_prgpvisloutAssocs[ichw] = new std::vector; + m_prgisloutLigature[ichw] = kNegInfinity; + m_prgiComponent[ichw] = 0; + } + + m_cslout = csloutSurface; + if (ptman->NumUserDefn() > 0 && ptman->NumCompPerLig() > 0) + { + int x; x = 3; + } + +// m_cnUserDefn = ptman->NumUserDefn(); + m_cnCompPerLig = ptman->NumCompPerLig(); +// m_cnFeat = ptman->NumFeat(); + // Normal buffers, plus: + // - underlying indices of ligature components + // - map from used components to defined components +// int cnExtraPerSlot = m_cnUserDefn + (m_cnCompPerLig * 2) + m_cnFeat + (m_cnCompPerLig * 2); + + // We don't need to store the user-defined slot attributes or the features in the segment itself. + // What we need is: (1) component.ref attr settings, (2) slot-attribute indices, + // (3) underlying indices of ligature components, and (4) map from used components + // to defined components + // 18Jul08 - it looks like all we need are underlying chars for ligature components and + // map from components to defined components. + int cnExtraPerSlot = m_cnCompPerLig * 2; + m_prgslout = new GrSlotOutput[m_cslout]; + m_prgnSlotVarLenBuf = new u_intslot[m_cslout * cnExtraPerSlot]; + + m_isloutVisLim = 0; + if (psstrmFinal) + { + for (islot = islotMin; islot < psstrmFinal->FinalSegLim(); ++islot) + { + int isloutRel = islot - islotMin; + + GrSlotState * pslot = psstrmFinal->SlotAt(islot); + pslot->SetPosPassIndex(isloutRel, false); + pslot->EnsureCacheForOutput(ptman); + GrSlotOutput * pslout = OutputSlot(isloutRel); + pslout->SetBufferPtr(m_prgnSlotVarLenBuf + (isloutRel * cnExtraPerSlot)); + pslout->InitializeOutputFrom(pslot); + pslout->SetBeforeAssoc(pslot->BeforeAssoc()); + pslout->SetAfterAssoc(pslot->AfterAssoc()); + if (pslot->HasComponents()) + pslot->SetComponentRefsFor(pslout); + Assert(pslot->HasComponents() == (pslout->NumberOfComponents() > 0)); + //if (pslot->HasClusterMembers()) + //{ + //Assert(pslot->HasClusterMembers() || pslot->ClusterRootOffset() == 0); + pslout->SetClusterXOffset(pslot->ClusterRootOffset() * -1); + pslout->SetClusterAdvance(pslot->ClusterAdvWidthFrom(0)); + + //} + + if (!ptman->IsWhiteSpace(pslot)) + m_isloutVisLim = islot + 1; + } + } + + // Set up the clusters. + for (islot = islotMin; islot < m_cslout; islot++) + { + GrSlotState * pslot = psstrmFinal->SlotAt(islot); + int isloutAdj = islot - islotMin; + int isloutBaseIndex = pslot->Base(psstrmFinal)->PosPassIndex(); + if (!pslot->IsBase()) + { + OutputSlot(isloutBaseIndex)->AddClusterMember(isloutBaseIndex, pslot->PosPassIndex()); + OutputSlot(isloutAdj)->SetClusterBase(isloutBaseIndex); + } + else if (pslot->HasClusterMembers() && pslot->IsBase()) + { + Assert(isloutBaseIndex == islot - islotMin); + OutputSlot(isloutAdj)->SetClusterBase(isloutBaseIndex); + } + } + + ///AssertValidClusters(psstrmFinal); + + // CalcPositionsUpTo() called on final pass already from Table Mgr + + // Final output for draw routines. + + SetUpGlyphInfo(ptman, psstrmFinal, chwLB, nDirDepth, islotMin, cslot); + + //SetUpOutputArraysPlatform(ptman, chwLB, nDirDepth, islotMin, cslot); + +} + +/*---------------------------------------------------------------------------------------------- + Set up the data structures that represent the actual rendered glyphs for the new segment. +----------------------------------------------------------------------------------------------*/ +void Segment::SetUpGlyphInfo(GrTableManager * ptman, GrSlotStream * psstrmFinal, + gid16 chwLB, int /*nDirDepth*/, int islotMin, int cslot) +{ + //int paraDirLevel = (ptman->State()->ParaRightToLeft()) ? 1 : 0; + + m_cginf = 0; + + int islot; + for (islot = islotMin; islot < cslot; islot++) + { + if (psstrmFinal->SlotAt(islot)->GlyphID() != chwLB) + { + m_cginf++; + } + } + + // For right-to-left segments, the draw origin will be at the left side of the visible + // portion of the text. So if necessary, scoot everything left so that the invisible + // trailing white-space is to the left of the draw position. + Assert(m_dxsTotalWidth > -1); + Assert(m_dxsVisibleWidth > -1); + //float dxsInvisible = (m_fEndLine) ? m_dxsTotalWidth - m_dxsVisibleWidth : 0; + + m_prgginf = new GlyphInfo [m_cginf]; + + m_isloutGinf0 = -1; + int iginf = 0; + for (islot = islotMin; islot < cslot; islot++) + { + GrSlotState * pslot = psstrmFinal->SlotAt(islot); + + if (pslot->GlyphID() == chwLB) + { + continue; // skip over linebreak markers + } + + int islout = islot - islotMin; + GrSlotOutput * pslout = OutputSlot(islout); + + if (m_isloutGinf0 == -1) + m_isloutGinf0 = islout; + + m_prgginf[iginf].m_pslout = pslout; + m_prgginf[iginf].m_islout = islout; + m_prgginf[iginf].m_pseg = this; + + // Fill in stuff in the output slot that is needed by the GlyphInfo object. + ////pslout->m_xsAdvanceX = pslot->GlyphMetricLogUnits(ptman, kgmetAdvWidth); // wrong + pslout->m_xsAdvanceX = ptman->EmToLogUnits(pslot->AdvanceX(ptman)); + //pslout->m_ysAdvanceY = ptman->EmToLogUnits(pslot->AdvanceY(ptman)); + //pslout->m_rectBB.top + // = pslot->YPosition() + pslot->GlyphMetricLogUnits(ptman, kgmetBbTop); + //pslout->m_rectBB.bottom + // = pslot->YPosition() + pslot->GlyphMetricLogUnits(ptman, kgmetBbBottom); + //pslout->m_rectBB.left + // = pslot->XPosition() + pslot->GlyphMetricLogUnits(ptman, kgmetBbLeft); + //if (pslot->IsSpace(ptman)) + // pslout->m_rectBB.right + // = pslot->XPosition() + pslot->GlyphMetricLogUnits(ptman, kgmetAdvWidth); + //else + // pslout->m_rectBB.right + // = pslot->XPosition() + pslot->GlyphMetricLogUnits(ptman, kgmetBbRight); + + iginf++; + } + + if (cslot - islotMin == 0) + m_isloutGinf0 = 0; + if (m_isloutGinf0 == -1) + { + Assert(m_cginf == 0); + m_isloutGinf0 = ((OutputSlot(0)->IsInitialLineBreak()) ? 1 : 0); + } + + Assert(m_isloutGinf0 == 0 || m_isloutGinf0 == 1); +} + +/* +// OLD VERSION +void Segment::SetUpGlyphInfo(GrTableManager * ptman, GrSlotStream * psstrmFinal, gid16 chwLB, int nDirDepth, + int islotMin, int cslot) +{ + int paraDirLevel = (ptman->State()->ParaRightToLeft()) ? 1 : 0; + + m_cginf = 0; + int islot; + for (islot = islotMin; islot < cslot; islot++) + { + if (psstrmFinal->SlotAt(islot)->GlyphID() != chwLB) + m_cginf++; + } + + // For right-to-left segments, the draw origin will be at the left side of the visible + // portion of the text. So if necessary, scoot everything left so that the invisible + // trailing white-space is to the left of the draw position. + Assert(m_dxsTotalWidth > -1); + Assert(m_dxsVisibleWidth > -1); + float dxsInvisible = (m_fEndLine) ? m_dxsTotalWidth - m_dxsVisibleWidth : 0; + + m_prgginf = new GlyphInfo [m_cginf]; + + // Fill in glyph information structures. + m_isloutGinf0 = -1; + for (islot = islotMin; islot < cslot; islot++) + { + GrSlotState * pslot = psstrmFinal->SlotAt(islot); + + int islout = islot - islotMin; + if (pslot->GlyphID() == chwLB) + { + continue; // skip over linebreak markers + } + if (m_isloutGinf0 == -1) + m_isloutGinf0 = islout; + + GrSlotOutput * pslout = OutputSlot(islout); + + int iginf = islout - m_isloutGinf0; + GlyphInfo & ginf = m_prgginf[iginf]; + + ginf.glyphID = pslot->ActualGlyphForOutput(ptman); + ginf.pseudoGlyphID = pslot->GlyphID(); + if (ginf.glyphID == ginf.pseudoGlyphID) + ginf.pseudoGlyphID = 0; + + ginf.isSpace = pslot->IsSpace(ptman); + + ginf.origin = pslot->XPosition(); + ginf.yOffset = pslot->YPosition(); + + ginf.bbLeft = pslot->XPosition() + pslot->GlyphMetricLogUnits(ptman, kgmetBbLeft); + ginf.bbTop = pslot->YPosition() + pslot->GlyphMetricLogUnits(ptman, kgmetBbTop); + if (ginf.isSpace) + { + ginf.bbRight = pslot->XPosition() + pslot->GlyphMetricLogUnits(ptman, kgmetAdvWidth); + } + else + { + ginf.bbRight = pslot->XPosition() + pslot->GlyphMetricLogUnits(ptman, kgmetBbRight); + } + ginf.bbBottom = pslot->YPosition() + pslot->GlyphMetricLogUnits(ptman, kgmetBbBottom); + + ginf.advanceWidth = pslot->GlyphMetricLogUnits(ptman, kgmetAdvWidth); + ginf.advanceHeight = 0; + + if (pslot->AttachTo() == 0) // not attached + ginf.attachedTo = -1; + else + ginf.attachedTo = pslot->AttachTo() + islot; + + ginf.directionality = byte(pslot->Directionality()); + if (pslot->DirLevel() == -1) + ginf.directionLevel = paraDirLevel; + else + ginf.directionLevel = byte(pslot->DirLevel()); + + //ginf.firstChar = LogicalSurfaceToUnderlying(islout, true); + //ginf.lastChar = LogicalSurfaceToUnderlying(islout, false); + + if (pslot->HasComponents()) + { + SetUpLigInfo(ptman, ginf, pslout); + } + else + { + ginf.numberOfComponents = 0; + ginf.components = NULL; + } + + ginf.insertBefore = pslot->InsertBefore(); + + ginf.maxStretch[0] = ptman->EmToLogUnits(pslot->JStretch()); + ginf.maxShrink[0] = ptman->EmToLogUnits(pslot->JShrink()); + ginf.stretchStep[0]= ptman->EmToLogUnits(pslot->JStep()); + ginf.justWidth[0] = ptman->EmToLogUnits(pslot->JWidth()); + ginf.justWeight[0] = pslot->JWeight(); + + ginf.measureStartOfLine = pslout->MeasureSolLogUnits(); + ginf.measureEndOfLine = pslout->MeasureEolLogUnits(); + } +} +*/ + +/*---------------------------------------------------------------------------------------------- + Set up the data structures that represent the components of a ligature glyph. +----------------------------------------------------------------------------------------------*/ +/* +void Segment::SetUpLigInfo(GrTableManager * ptman, GlyphInfo & ginf, GrSlotOutput * pslout) +{ + GrGlyphTable * pgtbl = ptman->GlyphTable(); + + int ccomp = pslout->NumberOfComponents(); + ginf.numberOfComponents = ccomp; + ginf.components = new ComponentBox[ccomp]; + for (int icomp = 0; icomp < ccomp; icomp++) + { + ComponentBox & cb = ginf.components[icomp]; + + // TODO: Rework ComponentIndexForGlyph to take slati rather than iForGlyph. + float xsLeft, xsRight, ysTop, ysBottom; + int slati = pslout->ComponentId(icomp); + int iForGlyph = pgtbl->ComponentIndexForGlyph(pslout->GlyphID(), slati); + pgtbl->ComponentBoxLogUnits(m_xysEmSquare, pslout->GlyphID(), iForGlyph, + m_mFontEmUnits, m_dysAscent, + &xsLeft, &ysTop, &xsRight, &ysBottom, false); + + cb.firstChar = pslout->UnderlyingComponent(icomp); + cb.lastChar = cb.firstChar; // TODO: is this supported? + cb.left = xsLeft; + cb.right = xsRight; + cb.top = ysTop; + cb.bottom = ysBottom; + } +} +*/ + + +// --------- OBSOLETE - replaced by GrTableManager::AdjustAssocsForOverlaps() --------------- +#if 0 + +/*---------------------------------------------------------------------------------------------- + Now that this segment is finished and has its associations set, handle any overlaps in + the associations between the previous segment and this one. + + Review: Think about whether we need to distinguish between before==kPosInfinity meaning + that the glyph is in the next segment vs. there is no association at all. + OBSOLETE +----------------------------------------------------------------------------------------------*/ +void Segment::AdjustForOverlapsWithPrevSeg() +{ + if (m_psegPrev) + { + AdjustBeforeArrayFromPrevSeg(); + m_psegPrev->AdjustAfterArrayFromNextSeg(); + } +} + +/*---------------------------------------------------------------------------------------------- + For any characters that are officially in this segment but are rendered in + the previous segment, initialize this segment's before array appropriately. Specifically, + set this segment's before value to something invalid--negative infinity, which will + never be overwritten. + OBSOLETE - replaced by AdjustAfterArrayFromNextSeg +----------------------------------------------------------------------------------------------*/ +void Segment::InitBeforeArrayFromPrevSeg() +{ + Assert(m_psegPrev); + + int ichwPrevMin = m_psegPrev->m_ichwMin; + int ichwPrevLim = m_psegPrev->m_ichwLim; +// int ichwPrevContextLim = +// m_psegPrev->m_ichwAssocsLim - m_psegPrev->m_ichwAssocsMin + m_psegPrev->m_ichwMin; + int cchwPrevAssocsMin = m_psegPrev->m_ichwAssocsMin; + int cchwPrevAssocsLim = m_psegPrev->m_ichwAssocsLim; + + // Loop over associations appended to the end of the previous segment; + // ichwPrev and ichwThis are relative to the start of their respective segments. + for (int ichwPrev = ichwPrevLim - ichwPrevMin; ichwPrev < cchwPrevAssocsLim; ++ichwPrev) + { + int ichwThis = ichwPrev - (ichwPrevLim - ichwPrevMin); // relative to start of this seg + if (m_psegPrev->m_prgisloutBefore[ichwPrev - cchwPrevAssocsMin] < kPosInfinity) + // The "before" value is in the previous segment, so make this segment's + // before value invalid. + m_prgisloutBefore[ichwThis - m_ichwAssocsMin] = kNegInfinity; + } +} + +/*---------------------------------------------------------------------------------------------- + For any associations that overlap between the previous segment and this, adjust + this segment's before array appropriately. Specifically, for any characters that + are rendered in both, set this segment's before value to something invalid. + OBSOLETE +----------------------------------------------------------------------------------------------*/ +void Segment::AdjustBeforeArrayFromPrevSeg() +{ + Assert(m_psegPrev); + + int ichwPrevMin = m_psegPrev->m_ichwMin; + int ichwPrevLim = m_psegPrev->m_ichwLim; + int ichwPrevAssocsMin = m_psegPrev->m_ichwAssocsMin; + int ichwPrevAssocsLim = m_psegPrev->m_ichwAssocsLim; + + // Loop over associations appended to the end of the previous segment + // (ie, rendered in the previous segment but officially in this one); + // ichwPrev and ichwThis are relative to the start of their respective segments. + for (int ichwPrev = ichwPrevLim - ichwPrevMin; ichwPrev < ichwPrevAssocsLim; ++ichwPrev) + { + int ichwThis = ichwPrev - (ichwPrevLim - ichwPrevMin); // relative to start of this seg + if (m_psegPrev->m_prgisloutBefore[ichwPrev - ichwPrevAssocsMin] < kPosInfinity) + // The "before" value is in the previous segment, so make this segment's + // before value invalid. + m_prgisloutBefore[ichwThis - m_ichwAssocsMin] = kNegInfinity; + } + // Loop over associations prepended to the start of this segment + // (ie, rendered in this segment but officially in the previous one); + // ichwPrev and ichwThis are relative to the start of their respective segments. + for (int ichwThis = m_ichwAssocsMin; ichwThis < 0; ++ichwThis) + { + int ichwPrev = ichwThis + (ichwPrevLim - ichwPrevMin); + if (m_psegPrev->m_prgisloutBefore[ichwPrev - ichwPrevAssocsMin] < kPosInfinity) + // The "before" value is in the previous segment, so make this segment's + // before value invalid. + m_prgisloutBefore[ichwThis - m_ichwAssocsMin] = kNegInfinity; + } +} + +/*---------------------------------------------------------------------------------------------- + For any associations that overlap between this segment and the next, adjust + this segment's after array appropriately. Specifically, for any characters that + are rendered in both, set this segment's after value to something invalid. + OBSOLETE +----------------------------------------------------------------------------------------------*/ +void Segment::AdjustAfterArrayFromNextSeg() +{ + Assert(m_psegNext); + + int ichwNextMin = m_psegNext->m_ichwMin; + int ichwNextContextMin = ichwNextMin + m_psegNext->m_ichwAssocsMin; + int ichwNextAssocsMin = m_psegNext->m_ichwAssocsMin; + + // Loop over associations prepended to the beginning of the following segment + // (ie, rendered in the next segment but officially in this one); + // ichwThis and ichwNext are relative to the start of their respective segments. + for (int ichwNext = cchwNextAssocsMin; ichwNext < 0; ++ichwNext) + { + int ichwThis = ichwNext + (m_ichwLim - m_ichwMin); + if (m_psegNext->m_prgisloutAfter[ichwNext - ichwNextAssocsMin] > kNegInfinity) + // The "after" value is in the next segment, so make this segment's + // after value invalid. + m_prgisloutAfter[ichwThis - m_ichwAssocsMin] = kPosInfinity; + } + + // Loop over associations appended to the end of this segment + // (ie, rendered in this segment but officially in the next one); + // ichwThis and ichwNext are relative to the start of their respective segments. + for (int ichwThis = m_ichwLim - m_ichwMin; ichwThis < m_cchwAssocsLim; ++ichwThis) + { + int ichwNext = ichwThis - (m_ichwLim - m_ichwMin); + if (m_psegNext->m_prgisloutAfter[ichwNext - ichwNextAssocsMin] > kNegInfinity) + // The "after" value is in the next segment, so make this segment's + // after value invalid. + m_prgisloutAfter[ichwThis - m_ichwAssocsMin] = kPosInfinity; + } +} + +#endif // -------------------------- END OF OBSOLETE CODE ---------------------------------- + + +/*---------------------------------------------------------------------------------------------- + Generate a list of all the glyphs that are attached to the base with the given index. + Note that we want to generate glyph indices, not slot indices. + + @param disloutCluster - indicates how far on either side of the base to look. +----------------------------------------------------------------------------------------------*/ +void Segment::ClusterMembersForGlyph(int isloutBase, int disloutCluster, + std::vector & visloutRet) +{ + for (int islout = max(0, isloutBase - disloutCluster); + islout < min(m_cslout, isloutBase + disloutCluster + 1); + islout++) + { + if (islout == isloutBase) + continue; // don't include the base itself + GrSlotOutput * pslout = m_prgslout + islout; + if (pslout->ClusterBase() == isloutBase) + { + visloutRet.push_back(islout); + } + } +} + +/*---------------------------------------------------------------------------------------------- + Record an underlying-to-surface association mapping, based on the fact that there is + a corresponding surface-to-underlying association in the streams. + + @param ichwUnder - character index relative to the official beginning of the segment + @param islotSurface - surface glyph it maps to +----------------------------------------------------------------------------------------------*/ +void Segment::RecordSurfaceAssoc(int ichwUnder, int islotSurface, int nDir) +{ + // If we are recording an association across the line boundary, make sure there + // is space for it. + EnsureSpaceAtLineBoundaries(ichwUnder); + + // For left-to-right chars, the before-value is the minimum of the previous + // and new values, and the after-value is the maximum. + if (nDir % 2 == 0) + { + // left-to-right + m_prgisloutBefore[ichwUnder - m_ichwAssocsMin] = + min(m_prgisloutBefore[ichwUnder - m_ichwAssocsMin], islotSurface); + m_prgisloutAfter[ ichwUnder - m_ichwAssocsMin] = + max(m_prgisloutAfter[ ichwUnder - m_ichwAssocsMin], islotSurface); + } + else + { + // right-to-left: the before-value is the max and the after-value is the min + m_prgisloutBefore[ichwUnder - m_ichwAssocsMin] = + max(m_prgisloutBefore[ichwUnder - m_ichwAssocsMin], islotSurface); + m_prgisloutAfter[ ichwUnder - m_ichwAssocsMin] = + min(m_prgisloutAfter[ ichwUnder - m_ichwAssocsMin], islotSurface); + } + + m_prgpvisloutAssocs[ichwUnder - m_ichwAssocsMin]->push_back(islotSurface); +} + +/*---------------------------------------------------------------------------------------------- + Record an underlying-to-surface ligature mapping, based on the fact that there is + a component.ref attribute in the surface stream. Note that if there was a previous + ligature value there, it will be overwritten. + + @param ichwUnder - character index relative to the official beginning of the segment + @param islotSurface - surface glyph it maps to + @param iComponent - which component this glyph represents +----------------------------------------------------------------------------------------------*/ +void Segment::RecordLigature(int ichwUnder, int islotSurface, int iComponent) +{ + // If we are recording a mapping across the line boundary, make sure there + // is space for it. + EnsureSpaceAtLineBoundaries(ichwUnder); + + Assert(m_prgisloutLigature[ichwUnder - m_ichwAssocsMin] == kNegInfinity); + + m_prgisloutLigature[ichwUnder - m_ichwAssocsMin] = islotSurface; + Assert(iComponent < kMaxComponentsPerGlyph); + m_prgiComponent[ ichwUnder - m_ichwAssocsMin] = sdata8(iComponent); +} + +/*---------------------------------------------------------------------------------------------- + The given slot is one that is rendered in the previous segment. + If it is associated with a character officially in this segment, mark the + before-association kNegInfinity. + + @param ichwUnder - character index relative to the official beginning of the segment + @param islot - processed glyph it maps to +----------------------------------------------------------------------------------------------*/ +void Segment::MarkSlotInPrevSeg(int ichwUnder, int /*islot*/) +{ + if (ichwUnder >= m_ichwAssocsMin) + m_prgisloutBefore[ichwUnder - m_ichwAssocsMin] = kNegInfinity; +} + +/*---------------------------------------------------------------------------------------------- + The given slot is one that is rendered in the following segment. + If it is associated with a character officially in this segment, mark the + after-association kPosInfinity. + + @param ichwUnder - character index relative to the official beginning of the segment + @param islot - processed glyph it maps to +----------------------------------------------------------------------------------------------*/ +void Segment::MarkSlotInNextSeg(int ichwUnder, int /*islot*/) +{ + if (ichwUnder < m_ichwAssocsLim) + m_prgisloutAfter[ichwUnder - m_ichwAssocsMin] = kPosInfinity; +} + +/*---------------------------------------------------------------------------------------------- + If we are recording an association across the line boundary (in either direction), + make sure there is space for it. This involves adding space to the beginning or + the end of the association arrays, and adjusting the min and lim indicators. +----------------------------------------------------------------------------------------------*/ +void Segment::EnsureSpaceAtLineBoundaries(int ichwUnder) +{ + int cchwNewMin = min(ichwUnder, m_ichwAssocsMin); + int cchwNewLim = max(ichwUnder+1, m_ichwAssocsLim); + if (cchwNewMin < m_ichwAssocsMin || cchwNewLim > m_ichwAssocsLim) + { + // Make space either at the beginning or the end of the arrays. + int cchwPreAdd = m_ichwAssocsMin - cchwNewMin; + int cchwPostAdd = cchwNewLim - m_ichwAssocsLim; + + int * prgisloutTmp = m_prgisloutBefore; + m_prgisloutBefore = new int[cchwNewLim - cchwNewMin]; + std::copy(prgisloutTmp, prgisloutTmp + (m_ichwAssocsLim - m_ichwAssocsMin), + m_prgisloutBefore + cchwPreAdd); + delete[] prgisloutTmp; + + prgisloutTmp = m_prgisloutAfter; + m_prgisloutAfter = new int[cchwNewLim - cchwNewMin]; + std::copy(prgisloutTmp, prgisloutTmp + (m_ichwAssocsLim - m_ichwAssocsMin), + m_prgisloutAfter + cchwPreAdd); + delete[] prgisloutTmp; + + std::vector ** ppvisloutTmp = m_prgpvisloutAssocs; + m_prgpvisloutAssocs = new std::vector * [cchwNewLim - cchwNewMin]; + std::swap_ranges(m_prgpvisloutAssocs + cchwPreAdd, + m_prgpvisloutAssocs + cchwPreAdd + + (m_ichwAssocsLim - m_ichwAssocsMin), ppvisloutTmp); + delete[] ppvisloutTmp; + + prgisloutTmp = m_prgisloutLigature; + m_prgisloutLigature = new int[cchwNewLim - cchwNewMin]; + std::copy(prgisloutTmp, prgisloutTmp + (m_ichwAssocsLim - m_ichwAssocsMin), + m_prgisloutLigature + cchwPreAdd); + delete[] prgisloutTmp; + + sdata8 * prgiCompTmp = m_prgiComponent; + m_prgiComponent = new sdata8[cchwNewLim - cchwNewMin]; + std::copy(prgiCompTmp, prgiCompTmp + (m_ichwAssocsLim - m_ichwAssocsMin), + m_prgiComponent + cchwPreAdd); + delete[] prgiCompTmp; + + // Initialize new slots. + int i; + for (i = 0; i < cchwPreAdd; ++i) + { + m_prgisloutBefore[i] = kPosInfinity; + m_prgisloutAfter[i] = kNegInfinity; + m_prgpvisloutAssocs[i] = new std::vector; + m_prgisloutLigature[i] = kNegInfinity; + m_prgiComponent[i] = 0; + } + for (i = m_ichwAssocsLim - m_ichwAssocsMin + cchwPreAdd; + i < m_ichwAssocsLim - m_ichwAssocsMin + cchwPreAdd + cchwPostAdd; + ++i) + { + m_prgisloutBefore[i] = kPosInfinity; + m_prgisloutAfter[i] = kNegInfinity; + m_prgpvisloutAssocs[i] = new std::vector; + m_prgisloutLigature[i] = kNegInfinity; + m_prgiComponent[i] = 0; + } + m_ichwAssocsMin = cchwNewMin; + m_ichwAssocsLim = cchwNewLim; + } +} + +/*---------------------------------------------------------------------------------------------- + Return the given output slot. +----------------------------------------------------------------------------------------------*/ +GrSlotOutput * Segment::OutputSlot(int islout) +{ + return m_prgslout + islout; +} + +/*---------------------------------------------------------------------------------------------- + Set the rendering engine to the current one. +----------------------------------------------------------------------------------------------*/ +void Segment::SetEngine(GrEngine * pgreng) +{ + //if (m_preneng) + // m_preneng->DecRefCount(); + m_preneng = pgreng; + //if (m_preneng) + // m_preneng->IncRefCount(); +} + +/*---------------------------------------------------------------------------------------------- + Set the font. +----------------------------------------------------------------------------------------------*/ +void Segment::SetFont(Font * pfont) +{ + m_pfont = pfont->copyThis(); + +// m_fBold = pfont->bold(); +// m_fItalic = pfont->italic(); + // Note that we store the character height (which does not include the internal leading), + // not the actual font height, ie, ascent + descent. This is what is used in the LOGFONT. + pfont->getFontMetrics(NULL, NULL, &m_xysEmSquare); // m_xysEmSquare = m_pixHeight +} + +/*---------------------------------------------------------------------------------------------- + Switch the font out. + ??? Do we need to change the member variables too? +----------------------------------------------------------------------------------------------*/ +void Segment::SwitchFont(Font * pfont) +{ + m_pfont = pfont; +} + +/*---------------------------------------------------------------------------------------------- + Return the engine implementation if it is a proper GrEngine, or NULL otherwise. +----------------------------------------------------------------------------------------------*/ +GrEngine * Segment::EngineImpl() +{ + return m_preneng; +} + +/*---------------------------------------------------------------------------------------------- + Set the justification agent, in case this segment will ever need to be stretched + or shrunk. +----------------------------------------------------------------------------------------------*/ +void Segment::SetJustifier(IGrJustifier * pgjus) +{ + m_pgjus = pgjus; + //if (pgjus) + // pgjus->JustifierObject(&m_pgjus); + //else + // m_pgjus = NULL; +} + +/*---------------------------------------------------------------------------------------------- + Set the graphics object to use the base font. +----------------------------------------------------------------------------------------------*/ +//void Segment::SetToBaseFont(IGrGraphics * pgg) +//{ +// if (m_fUseSepBase) +// EngineImpl()->SwitchGraphicsFont(pgg, true); +//} + +/*---------------------------------------------------------------------------------------------- + Restore the graphics object to use the font that it originally had when passed in to + the interface method. +----------------------------------------------------------------------------------------------*/ +//void Segment::RestoreFont(IGrGraphics * pgg) +//{ +// if (m_fUseSepBase) +// EngineImpl()->SwitchGraphicsFont(pgg, false); +//} + +/*---------------------------------------------------------------------------------------------- + Given a logical surface location, return the underlying position (relative to the + beginning of the string). NOTE that we are returning the index of the closest charater + (plus an indication of which side the click was on), not a position between characters. + + @param islout - output slot + @param xsOffset - x coordinate of physical click, relative to left of glyph; + kPosInfinity means all the way to the right; + kNegInfinity means all the way to the left + @param ysOffset - y coordinate of physical click, relative to TOP of segment (NOT + upwards from baseline); kPosInfinity means all the way at + the top; kNegInfinity means all the way at the bottom + @param dxsGlyphWidth - width of glyph clicked on, or 0 if irrelevant + @param dysGlyphHeight - actually line height -- CURRENTLY NOT USED + @param pfAfter - return true if they clicked on trailing side; possibly NULL +----------------------------------------------------------------------------------------------*/ +int Segment::LogicalSurfaceToUnderlying(int islout, float xsOffset, float ysClick, + float dxsGlyphWidth, float /*dysGlyphHeight*/, bool * pfAfter) +{ + Assert(islout >= 0); + Assert(islout < m_cslout); + + GrSlotOutput * pslout = OutputSlot(islout); + bool fGlyphRtl = SlotIsRightToLeft(pslout); + + int dichw; + bool fAfter, fRight; + + float ysForGlyph = pslout->YPosition(); + + float dysFontAscent = m_dysFontAscent; + ////GrResult res = GetFontAscentSourceUnits(pgg, &dysFontAscent); + ////if (ResultFailed(res)) + //// THROW(WARN(res)); + dysFontAscent += m_dysXAscent; + + float dysOffset = ysClick - (m_dysAscent - dysFontAscent); // relative to top of 0-baseline text + + // If the slot has components, see if the offset falls within one of them. + + if (pslout->NumberOfComponents() > 0) + { + GrEngine * pgreng = EngineImpl(); + if (!pgreng) + goto LNotLigature; + + GrGlyphTable * pgtbl = pgreng->GlyphTable(); + + for (int icomp = 0; icomp < pslout->NumberOfComponents(); icomp++) + { + float xsLeft, xsRight, ysTop, ysBottom; + + // TODO: Rework ComponentIndexForGlyph to take slati rather than iForGlyph. + int slati = pslout->ComponentId(icomp); + int iForGlyph = pgtbl->ComponentIndexForGlyph(pslout->GlyphID(), slati); + if (!pgtbl->ComponentBoxLogUnits(m_xysEmSquare, pslout->GlyphID(), iForGlyph, + m_mFontEmUnits, m_dysAscent, + &xsLeft, &ysTop, &xsRight, &ysBottom)) + { + continue; // component not defined + } + Assert(xsLeft <= xsRight); + Assert(ysTop <= ysBottom); + if (xsOffset < xsLeft || xsOffset > xsRight) + continue; + if ((dysOffset - ysForGlyph) < ysTop || (dysOffset - ysForGlyph) > ysBottom) + continue; + + // Click was within the component's box. + + fRight = (xsOffset - xsLeft > xsRight - xsOffset); + fAfter = (fGlyphRtl) ? !fRight : fRight; + if (pfAfter) + *pfAfter = fAfter; + + if (fAfter) + dichw = pslout->LastUnderlyingComponent(icomp); + else + dichw = pslout->FirstUnderlyingComponent(icomp); + Assert(m_ichwMin + dichw >= 0); + Assert(dichw < m_dichwLim); + + Assert(GrCharStream::AtUnicodeCharBoundary(m_pgts, m_ichwMin + dichw)); + + return m_ichwMin + dichw; + } + } + +LNotLigature: + + // No relevant ligature component. + // If the x-offset is less than half way across, + // answer the before-association; otherwise answer the after-association. + + if (xsOffset == kPosInfinity) + fRight = true; + else if (xsOffset == kNegInfinity) + fRight = false; + else + fRight = (xsOffset > (dxsGlyphWidth / 2)); + + fAfter = (fGlyphRtl) ? !fRight : fRight; + + int diCharAdj = 0; + if (fAfter) + { + dichw = pslout->AfterAssoc(); + if (pfAfter) + *pfAfter = true; + // The following should not be necessary because of the way associations are set up: + //while (!GrCharStream::AtUnicodeCharBoundary(m_pgts, ichwBase + dichw + diCharAdj)) + // diCharAdj++; + } + else + { + dichw = pslout->BeforeAssoc(); + if (pfAfter) + *pfAfter = false; + // The following should not be necessary because of the way associations are set up: + //while (!GrCharStream::AtUnicodeCharBoundary(m_pgts, ichwBase + dichw + diCharAdj)) + // diCharAdj--; + } + + if (dichw == kNegInfinity || dichw == kPosInfinity) + return dichw; + + // This should be true because of the way the associations are set up: + Assert(GrCharStream::AtUnicodeCharBoundary(m_pgts, m_ichwMin + dichw)); // + diCharAdj)); + + return m_ichwMin + dichw + diCharAdj; +} + +/*--------------------------------------------------------------------------------------------*/ + +int Segment::LogicalSurfaceToUnderlying(int islout, bool fBefore) +{ + if (fBefore) + return LogicalSurfaceToUnderlying(islout, kNegInfFloat, kNegInfFloat); + else + return LogicalSurfaceToUnderlying(islout, kPosInfFloat, kPosInfFloat); +} + +/*---------------------------------------------------------------------------------------------- + Given a physical surface location (an index into the glyph boxes), + return the underlying position, relative to the beginning of the string. + + @param igbb - index of glyph + @param xsOffset - relative to left side of glyph + @param ysOffset - downwards from top of segment (not upwards from baseline) +----------------------------------------------------------------------------------------------*/ +int Segment::PhysicalSurfaceToUnderlying( + int iginf, float xsOffset, float ysOffset, + float dxsGlyphWidth, float dysGlyphHeight, bool * pfAfter) +{ + int islout = iginf + m_isloutGinf0; + return LogicalSurfaceToUnderlying(islout, xsOffset, ysOffset, + dxsGlyphWidth, dysGlyphHeight, pfAfter); +} + +/*--------------------------------------------------------------------------------------------*/ + +int Segment::PhysicalSurfaceToUnderlying(int iginf, bool fBefore) +{ + int islout = iginf + m_isloutGinf0; + bool fGlyphRtl = SlotIsRightToLeft(OutputSlot(islout)); + if (fBefore == fGlyphRtl) + return PhysicalSurfaceToUnderlying(iginf, kPosInfFloat, kPosInfFloat); + else + return PhysicalSurfaceToUnderlying(iginf, kNegInfFloat, kNegInfFloat); +} + +/*---------------------------------------------------------------------------------------------- + Given an underlying position (relative to the beginning of the string), + return the logical surface location (ignoring right-to-left). + NOTE that ichw indicates a CHARACTER, not a location between characters. So ichw = 3, + fBefore = false indicates a selection between characters 3 and 4. + For surrogates, it indicates the FIRST of the pair of 16-bit chars. +----------------------------------------------------------------------------------------------*/ +int Segment::UnderlyingToLogicalSurface(int ichw, bool fBefore) +{ + int ichwSegOffset = ichw - m_ichwMin; + + if (ichwSegOffset < m_ichwAssocsMin) + return kNegInfinity; // probably rendered in previous segment + + + // if the buffers aren't even allocated, then it probably means there + // wasn't room for any glyphs, so the following segment is most likely +// else if (ichwSegOffset >= m_ichwAssocsLim) + else if (ichwSegOffset >= m_ichwAssocsLim || !m_prgisloutBefore || !m_prgisloutAfter) + return kPosInfinity; // probably rendered in following segment + + else if (fBefore) + { + int isloutRet; + int ichwBefore = ichwSegOffset; + // If no association has been made, loop forward to the next slot + // we are before. As a last resort, answer kPosInfinity, meaning we + // aren't before anything. + do + { + isloutRet = m_prgisloutBefore[ichwBefore - m_ichwAssocsMin]; + do { ++ichwBefore; } + while (!GrCharStream::AtUnicodeCharBoundary(m_pgts, ichwBefore)); + } while (isloutRet == kPosInfinity && ichwBefore < m_ichwAssocsLim); + return isloutRet; + } + else + { + int isloutRet; + int ichwBetween = ichwSegOffset; + // If no association has been made, loop backward to the previous slot + // we are after. As a last resort, answer kNegInfinity, meaning we + // aren't after anything. + do + { + isloutRet = m_prgisloutAfter[ichwBetween - m_ichwAssocsMin]; + do { --ichwBetween; } + while (!GrCharStream::AtUnicodeCharBoundary(m_pgts, ichwBetween)); + } while (isloutRet == kNegInfinity && ichwBetween >= 0); + return isloutRet; + } + Assert(false); // should never reach here +} + +/*---------------------------------------------------------------------------------------------- + Given an underlying position (relative to the beginning of the string), + return the physical surface location, the index into m_prgginf. +----------------------------------------------------------------------------------------------*/ +int Segment::UnderlyingToPhysicalSurface(int ichw, bool fBefore) +{ + int islout = UnderlyingToLogicalSurface(ichw, fBefore); + return LogicalToPhysicalSurface(islout); +} + +/*---------------------------------------------------------------------------------------------- + Given a logical position (index into output slots), return the physical position, + the index into the list of glyphs (m_prgginf). +----------------------------------------------------------------------------------------------*/ +int Segment::LogicalToPhysicalSurface(int islout) +{ + if (islout == kNegInfinity || islout == kPosInfinity) + return islout; + + Assert(m_prgginf[islout - m_isloutGinf0].logicalIndex() == (unsigned)(islout - m_isloutGinf0)); + + return islout - m_isloutGinf0; +} + +/*---------------------------------------------------------------------------------------------- + Given an underlying position (relative to the beginning of the string), + return the physical surface locations of all the associated surface glyphs. + OBSOLETE +----------------------------------------------------------------------------------------------*/ +#if 0 +void Segment::UnderlyingToPhysicalAssocs(int ichw, std::vector & viginf) +{ + int ichwSegOffset = ichw - m_ichwMin; + + if (ichwSegOffset < m_ichwAssocsMin) + return; // possibly rendered in previous segment + + else if (ichwSegOffset >= m_ichwAssocsLim) + return; // possibly rendered in following segment + + else + { + std::vector * pvisloutTmp = &(m_prgvisloutAssocs[ichwSegOffset - m_ichwAssocsMin]); + + for (size_t i = 0; i < pvisloutTmp->size(); i++) + { + int islout = (*pvisloutTmp)[i]; + Assert(islout != kNegInfinity); + Assert(islout != kPosInfinity); + viginf.push_back(LogicalToPhysicalSurface(islout)); + } + } +} +#endif + +/*---------------------------------------------------------------------------------------------- + Given an underlying character position (relative to the beginning of the string), + returns a vector containing the logical surface locations of all the associated + surface glyphs. + + Returns an empty vector (not something containing infinities) if the character is + "invisible." +----------------------------------------------------------------------------------------------*/ +std::vector Segment::UnderlyingToLogicalAssocs(int ichw) +{ + std::vector vnEmpty; + vnEmpty.clear(); + Assert(vnEmpty.size() == 0); + + int ichwSegOffset = ichw - m_ichwMin; + + if (ichwSegOffset < m_ichwAssocsMin) + return vnEmpty; // probably rendered in previous segment + + else if (ichwSegOffset >= m_ichwAssocsLim) + return vnEmpty; // probably rendered in following segment + + else if (m_prgpvisloutAssocs[ichwSegOffset - m_ichwAssocsMin] == NULL) + { + // Create a vector using the before and after values. + std::vector visloutRet; + int isloutBefore = m_prgisloutBefore[ichwSegOffset - m_ichwAssocsMin]; + int isloutAfter = m_prgisloutAfter[ichwSegOffset - m_ichwAssocsMin]; + if (isloutBefore != kPosInfinity && isloutBefore != kNegInfinity) + visloutRet.push_back(isloutBefore); + if (isloutAfter != kPosInfinity && isloutAfter != kNegInfinity && isloutBefore != isloutAfter) + { + visloutRet.push_back(isloutAfter); + } + return visloutRet; + } + else + { + std::vector * pvisloutRet = m_prgpvisloutAssocs[ichwSegOffset - m_ichwAssocsMin]; + return *pvisloutRet; + } +} + +/*---------------------------------------------------------------------------------------------- + Given an underlying character position (relative to the beginning of the string), + return an index of a slot in this segment that can used to test things like + InsertBefore. Don't return kNegInfinity or kPosInfinity except as a last resort. +----------------------------------------------------------------------------------------------*/ +int Segment::UnderlyingToLogicalInThisSeg(int ichw) +{ + int isloutTest = kNegInfinity; + std::vector vislout = UnderlyingToLogicalAssocs(ichw); + for (size_t iislout = 0; iislout < vislout.size(); iislout++) + { + isloutTest = vislout[iislout]; + if (isloutTest != kNegInfinity && isloutTest != kPosInfinity) + return isloutTest; + } + return isloutTest; +} + +/*---------------------------------------------------------------------------------------------- + Return true if the two characters map to exactly the same set of glyphs. +----------------------------------------------------------------------------------------------*/ +bool Segment::SameSurfaceGlyphs(int ichw1, int ichw2) +{ + std::vector vislout1 = UnderlyingToLogicalAssocs(ichw1); + std::vector vislout2 = UnderlyingToLogicalAssocs(ichw2); + + bool fRet = true; + if (vislout1.size() == 0 || vislout2.size() == 0) + fRet = false; + else if (vislout1.size() != vislout2.size()) + fRet = false; + else + { + for (size_t islout = 0; islout < vislout1.size(); islout++) + { + if (vislout1[islout] != vislout2[islout]) + { + fRet = false; + break; + } + } + } + return fRet; +} + +/*---------------------------------------------------------------------------------------------- + Return the direction level of the given character. +----------------------------------------------------------------------------------------------*/ +int Segment::DirLevelOfChar(int ichw, bool fBefore) +{ + if (m_twsh == ktwshOnlyWs) + return m_nDirDepth; + int islot = UnderlyingToLogicalSurface(ichw, fBefore); + if (islot == kNegInfinity || islot == kPosInfinity) + return 0; + int nDir = OutputSlot(islot)->DirLevel(); + if (nDir == -1) + // Not calculated: assume to be the top direction level. + nDir = TopDirLevel(); + + return nDir; +} + +/*---------------------------------------------------------------------------------------------- + Return whether the given character is right-to-left. +----------------------------------------------------------------------------------------------*/ +bool Segment::CharIsRightToLeft(int ichw, bool fBefore) +{ + int nDir = DirLevelOfChar(ichw, fBefore); + return static_cast((nDir % 2) != 0); +} + +/*---------------------------------------------------------------------------------------------- + Return whether the given slot is right-to-left. +----------------------------------------------------------------------------------------------*/ +bool Segment::SlotIsRightToLeft(GrSlotOutput * pslout) +{ + if (m_twsh == ktwshOnlyWs) + return (m_nDirDepth % 2 != 0)? true : false; + int nDir = pslout->DirLevel(); + if (nDir == -1) + nDir = TopDirLevel(); + return static_cast(nDir % 2 != 0)? true : false; +} + +/*---------------------------------------------------------------------------------------------- + Check to make sure that the attachments are valid. Specifically, for every glyph that + is part of a cluster, all glyphs between that glyph and its root must (ultimately) have + that root glyph as one of its roots. + OBSOLETE +----------------------------------------------------------------------------------------------*/ +#ifdef _DEBUG +void Segment::AssertValidClusters(GrSlotStream * psstrm) +#else +void Segment::AssertValidClusters(GrSlotStream *) +#endif +{ +#ifdef _DEBUG + for (int islot = 0; islot < psstrm->WritePos(); islot++) + { + GrSlotState * pslotThis = psstrm->SlotAt(islot); + GrSlotState * pslotRoot = pslotThis->AttachRoot(psstrm); + if (!pslotRoot) + continue; + Assert(pslotRoot != pslotThis); + + int inc = (pslotThis->PosPassIndex() > pslotRoot->PosPassIndex()) ? -1 : 1; + + for (int islot2 = pslotThis->PosPassIndex() + inc; + islot2 != pslotRoot->PosPassIndex(); + islot2 += inc) + { + GrSlotState * pslotMid = psstrm->SlotAt(islot2); + Assert(pslotMid->HasAsRoot(psstrm, pslotRoot)); + } + } +#endif // _DEBUG +} + +/*---------------------------------------------------------------------------------------------- + Return information about (editing) clusters as appropriate for Uniscribe, ie, consistent + with the ScriptShape funciton. + A cluster includes all attachments, all clumps of characters created by insert = false, + and clumps of reordered glyphs. + + prgiginfFirstOfCluster returns the first glyph of the cluster for each CHARACTER + (glyph indices returned are zero-based and refer to physical order--left-to-right, etc.). + pfClusterStart returns a flag for each GLYPH indicating whether it is the first (left-most) + of a cluster. + Both arrays are optional. + CORRECTION: for now we use strictly logical order. It's not clear whether physical + order is needed for right-to-left text or not. See note below. + + TODO: convert from GlyphInfo objects which are RTL. +----------------------------------------------------------------------------------------------*/ +GrResult Segment::getUniscribeClusters( + int * prgiginfFirstOfCluster, int cchMax, int * pcch, + bool * pfClusterStart, int cfMax, int * pcf) +{ + ChkGrOutPtr(pcch); + if (prgiginfFirstOfCluster) + ChkGrArrayArg(prgiginfFirstOfCluster, cchMax); + ChkGrOutPtr(pcf); + if (pfClusterStart) + ChkGrArrayArg(pfClusterStart, cfMax); + + GrResult res = kresOk; + + //SetUpGraphics(ichwBase, pgg, true); + + if (m_dxsWidth == -1) + ComputeDimensions(); + + Assert(m_dxsWidth >= 0); + Assert(m_dysAscent >= 0); + + if (pcch) + *pcch = m_dichwLim; + if (pcf) + *pcf = m_cginf; + if (cchMax < m_dichwLim) + { + if (cchMax == 0 && cfMax == 0) + res = kresFalse; // just asking for size information + else if (prgiginfFirstOfCluster || cchMax > 0) + res = kresInvalidArg; // not enough space + } + if (cfMax < m_cginf) + { + if (cchMax == 0 && cfMax == 0) + res = kresFalse; + else if (pfClusterStart || cfMax > 0) + res = kresInvalidArg; + } + if (res != kresOk) + { + //RestoreFont(pgg); + ReturnResult(res); + } + + // Generate a pair of arrays, indicating the first and last (logical) slots + // of the cluster for each character. Initially clusters are based just on + // character-to-glyph associations, but they expand as we process + // insert=false settings, attachments, and reordering. + + std::vector visloutBefore; + std::vector visloutAfter; + visloutBefore.resize(m_dichwLim); + visloutAfter.resize(m_dichwLim); + + int ich; + for (ich = 0; ich < m_dichwLim; ich++) + { + visloutBefore[ich] = m_prgisloutBefore[ich - m_ichwAssocsMin]; + visloutAfter[ich] = m_prgisloutAfter[ich - m_ichwAssocsMin]; + } + + if (m_dichwLim == 1) + { + // Only one character, therefore only one cluster. + visloutBefore[0] = m_isloutGinf0; + visloutAfter[0] = max(m_cginf - 1, 0) + m_isloutGinf0; + } + else + { + // Make all glyphs attached to each other part of a cluster, or glyphs where + // insertion is not allowed. + for (ich = 0; ich < m_dichwLim; ich++) + { + std::vector vislout = UnderlyingToLogicalAssocs(ich + m_ichwMin); + + if (vislout.size() == 0) + { + // No glyphs represent this character. Merge it with the previous + // character. + visloutBefore[ich] = (ich == 0) ? visloutBefore[ich + 1] : visloutBefore[ich - 1]; + visloutAfter[ich] = (ich == 0) ? visloutAfter[ich + 1] : visloutAfter[ich - 1]; + continue; + } + + size_t iislout; + for (iislout = 0; iislout < vislout.size(); iislout++) + { + int islout = vislout[iislout]; + if (!m_prgslout[islout].InsertBefore()) + { + // This glyph does not allow insertion before it; make its character part + // of the same cluster as the previous character. + if (ich > 0) + { + MergeUniscribeCluster(visloutBefore, visloutAfter, ich - 1, ich); + } +/* ++ // Keith Stribley's fix: ++ // NOTE: this is NOT always the same as the previous character, so ++ // check whether the next character actually has a glyph before this ++ // one ++ if ((ich == m_dichwLim - 1) || ++ (std::min(visloutBefore[ich + 1], visloutAfter[ich + 1]) > ++ std::max(visloutBefore[ich], visloutAfter[ich]))) ++ { ++ MergeUniscribeCluster(visloutBefore, visloutAfter, ich - 1, ich); ++ } ++ else ++ MergeUniscribeCluster(visloutBefore, visloutAfter, ich, ich + 1); +*/ + } + else if (m_prgslout[islout].ClusterBase() != -1 + && m_prgslout[islout].ClusterBase() != islout) + { + // This glyph is attached to something; make them part of the same cluster. + int isloutBase = m_prgslout[islout].ClusterBase(); + int ichBase = LogicalSurfaceToUnderlying(isloutBase, false) - m_ichwMin; + MergeUniscribeCluster(visloutBefore, visloutAfter, + ich, ichBase); + int ichBase1 = LogicalSurfaceToUnderlying(isloutBase, false) - m_ichwMin; + if (ichBase1 != ichBase) + MergeUniscribeCluster(visloutBefore, visloutAfter, + ich, ichBase1); + } + } + } + + // Handle reordering. Whenever the islout values get out of order, we need to + // merge into a single cluster. + for (ich = 0; ich < m_dichwLim - 1; ich++) + { + Assert(visloutBefore[ich] <= visloutAfter[ich]); + Assert(visloutBefore[ich] != kPosInfinity); + Assert(visloutBefore[ich] != kNegInfinity); + Assert(visloutAfter[ich] != kPosInfinity); + Assert(visloutAfter[ich] != kNegInfinity); + const int b1 = visloutBefore[ich]; + const int a1 = visloutAfter[ich]; + const int b2 = visloutBefore[ich + 1]; + const int a2 = visloutAfter[ich + 1]; + if (b1 == b2 && a1 == a2) + continue; // already a cluster + + if (std::min(b2, a2) <= std::max(b1, a1)) + { + MergeUniscribeCluster(visloutBefore, visloutAfter, ich, ich + 1); + } + } + } + + if (pfClusterStart) + { + // Initialize. + int iginf; + for (iginf = 0; iginf < m_cginf; iginf++) + pfClusterStart[iginf] = false; + } + + // To skip line-break slots; remember that the number of output slots equals the + // number of gbbs plus initial and/or final line-break slots if any. + // In this case the beginning of the first cluster indicates the first real glyph. + int isloutFirstReal = (m_dichwLim) ? ((m_fWsRtl)? visloutAfter[0] : visloutBefore[0]) : 0; + + // Kludge to make assertions below easier: + if (m_dichwLim > 0) + { + visloutBefore.push_back(visloutAfter.back() + 1); + visloutAfter.push_back(visloutAfter.back() + 1); + } + + // Convert (logical) slots to actual glyphs. + for (ich = 0; ich < m_dichwLim; ich++) + { + // NOTE: to treat the first of the cluster as the left-most, use visloutAfter for + // right-to-left situations. + + if (prgiginfFirstOfCluster) + prgiginfFirstOfCluster[ich] + = LogicalToPhysicalSurface((m_fWsRtl) ? visloutAfter[ich] : visloutBefore[ich]); + int clusterStartPos = ((m_fWsRtl) ? visloutAfter[ich] : visloutBefore[ich]) - isloutFirstReal; + if (pfClusterStart) + pfClusterStart[clusterStartPos] = true; + + Assert((visloutBefore[ich] == visloutBefore[ich + 1] && + visloutAfter[ich] == visloutAfter[ich + 1]) + || (visloutBefore[ich] <= visloutAfter[ich] && + visloutAfter[ich] < visloutBefore[ich + 1])); + } + + //RestoreFont(pgg); + + return kresOk; +} + + +// suppress GCC 4.3 warning for optimized min()/max() when called with (ich, ich+1) or similar +#ifdef __GNUC__ +#pragma GCC diagnostic ignored "-Wstrict-overflow" +#endif + +/*---------------------------------------------------------------------------------------------- + Merge the given characters into the same Uniscribe cluster. This means merging any + intervening characters as well. +----------------------------------------------------------------------------------------------*/ +void Segment::MergeUniscribeCluster( + std::vector & visloutBefore, std::vector & visloutAfter, + int ich1, int ich2) +{ + int ichStartOrig = min(ich1, ich2); + int ichStopOrig = max(ich1, ich2); + + int isloutMin = visloutBefore[ichStopOrig]; + int isloutMax = visloutAfter[ichStartOrig]; + + int ichStart = ichStopOrig; + int ichStop = ichStartOrig; + // Find the beginning of the cluster. + while (ichStart > 0 && + (ichStart > ichStartOrig + || visloutBefore[ichStart - 1] >= visloutBefore[ichStopOrig] + || visloutBefore[ichStart - 1] == visloutBefore[ichStart])) + { + ichStart--; + isloutMin = std::min(isloutMin, visloutBefore[ichStart]); + isloutMax = std::max(isloutMax, visloutAfter[ichStart]); + } + // Find end of cluster. + while (ichStop < m_dichwLim - 1 && + (ichStop < ichStopOrig + || visloutAfter[ichStop + 1] <= visloutAfter[ichStartOrig] + || visloutAfter[ichStop + 1] == visloutAfter[ichStop])) + { + ichStop++; + isloutMin = std::min(isloutMin, visloutBefore[ichStop]); + isloutMax = std::max(isloutMax, visloutAfter[ichStop]); + } + + int ich; + for (ich = ichStart; ich <= ichStop; ich++) + { + visloutBefore[ich] = isloutMin; + visloutAfter[ich] = isloutMax; + } +} + +/*---------------------------------------------------------------------------------------------- + Return information about the positioning of glyphs as appropriate for Uniscribe. + The advance widths returned are the natural ones (what would be applied if no smart + rendering were happening), and the x-offsets are the difference between the + natural location of the glyph and what is produced by Graphite. The y-offset + is the same as GetGlyphsAndPositions. + + This is an experimental method. Its behavior may change signficantly in the future. +----------------------------------------------------------------------------------------------*/ +/* +GrResult Segment::GetUniscribePositions( + Rect rs, Rect rd, int cgidMax, int *pcgidRet, + float * prgxd, float * prgyd, float * prgdxdAdv) +{ + ChkGrOutPtr(pcgidRet); + ChkGrArrayArg(prgxd, cgidMax); + ChkGrArrayArg(prgyd, cgidMax); + ChkGrArrayArg(prgdxdAdv, cgidMax); + + GrResult res; + + //SetUpGraphics(ichBase, pgg, true); + + Assert(m_dxsWidth >= 0); + Assert(m_dysAscent >= 0); + + *pcgidRet = m_cginf; + if (cgidMax < m_cginf) + { + res = (cgidMax == 0) ? kresFalse : kresInvalidArg; + //RestoreFont(pgg); + ReturnResult(res); + } + + if (m_dxsWidth < 0) + ComputeDimensions(); + + float * rgxdTmp = new float[cgidMax]; + float * rgdxdAdvTmp = new float[cgidMax]; + res = GetGlyphsAndPositions(rs, rd, cgidMax, pcgidRet, + NULL, rgxdTmp, prgyd, rgdxdAdvTmp); + if (ResultFailed(res)) + { + delete[] rgxdTmp; + delete[] rgdxdAdvTmp; + //RestoreFont(pgg); + ReturnResult(res); + } + + float xdLeft = SegmentPainter::ScaleX(0, rs, rd); + float xdXPosNatural = xdLeft; + for (int iginf = 0; iginf < *pcgidRet; iginf++) + { + int islout = iginf + m_isloutGinf0; + GrSlotOutput * pslout = OutputSlot(islout); + float dxsAdvNatural = pslout->AdvanceXMetric(); + float dxdAdvNatural = SegmentPainter::ScaleX(dxsAdvNatural, rs, rd) - xdLeft; + prgdxdAdv[iginf] = dxdAdvNatural; + prgxd[iginf] = rgxdTmp[iginf] - xdXPosNatural; + + xdXPosNatural += dxdAdvNatural; + } + + delete[] rgxdTmp; + delete[] rgdxdAdvTmp; + + //RestoreFont(pgg); + + ReturnResult(res); + +} +*/ + +/*---------------------------------------------------------------------------------------------- + Return information about the positioning of glyphs as appropriate for Uniscribe. + The advance widths returned are the natural ones (what would be applied if no smart + rendering were happening), and the x-offsets are the difference between the + natural location of the glyph and what is produced by Graphite. The y-offset + is the same as GetGlyphsAndPositions. + + This is an experimental method. Its behavior may change signficantly in the future. +----------------------------------------------------------------------------------------------*/ +/* +GrResult Segment::GetUniscribeGlyphsAndPositions( + Rect rs, Rect rd, int cgidMax, int *pcgidRet, utf16 * prgchGlyphs, + float * prgxd, float * prgyd, float * prgdxdAdv) +{ + ChkGrOutPtr(pcgidRet); + ChkGrArrayArg(prgxd, cgidMax); + ChkGrArrayArg(prgyd, cgidMax); + ChkGrArrayArg(prgdxdAdv, cgidMax); + + GrResult res; + + //SetUpGraphics(ichBase, pgg, true); + + Assert(m_dxsWidth >= 0); + Assert(m_dysAscent >= 0); + + *pcgidRet = m_cginf; + if (cgidMax < m_cginf) + { + res = (cgidMax == 0) ? kresFalse : kresInvalidArg; + //RestoreFont(pgg); + ReturnResult(res); + } + + if (m_dxsWidth < 0) + ComputeDimensions(); + + float * rgxdTmp = new float[cgidMax]; + float * rgdxdAdvTmp = new float[cgidMax]; + res = GetGlyphsAndPositions(rs, rd, cgidMax, pcgidRet, + prgchGlyphs, rgxdTmp, prgyd, rgdxdAdvTmp); + if (ResultFailed(res)) + { + delete[] rgxdTmp; + delete[] rgdxdAdvTmp; + //RestoreFont(pgg); + ReturnResult(res); + } + + float xdLeft = SegmentPainter::ScaleX(0, rs, rd); + float xdXPosNatural = xdLeft; + for (int iginf = 0; iginf < *pcgidRet; iginf++) + { + int islout = iginf + m_isloutGinf0; + GrSlotOutput * pslout = OutputSlot(islout); + float dxsAdvNatural = pslout->AdvanceXMetric(); + float dxdAdvNatural = SegmentPainter::ScaleX(dxsAdvNatural, rs, rd) - xdLeft; + prgdxdAdv[iginf] = dxdAdvNatural; + prgxd[iginf] = rgxdTmp[iginf] - xdXPosNatural; + + xdXPosNatural += dxdAdvNatural; + } + + delete[] rgxdTmp; + delete[] rgdxdAdvTmp; + + //RestoreFont(pgg); + + ReturnResult(res); +} +*/ + +/*---------------------------------------------------------------------------------------------- + Return the visual box for the given ligature component. Return (0,0,0,0) if the component + is not defined. +----------------------------------------------------------------------------------------------*/ +Rect Segment::ComponentRect(GrSlotOutput * pslout, int icomp) +{ + Rect rectRet; + rectRet.top = rectRet.bottom = rectRet.left = rectRet.right = 0; + if (icomp < 0 || icomp > pslout->NumberOfComponents()) + return rectRet; + + GrEngine * pgreng = EngineImpl(); + if (!pgreng) + return rectRet; + GrGlyphTable * pgtbl = pgreng->GlyphTable(); + if (!pgtbl) + return rectRet; + + float xsLeft, xsRight, ysTop, ysBottom; + + // TODO: Rework ComponentIndexForGlyph to take slati rather than iForGlyph. + int slati = pslout->ComponentId(icomp); + int iForGlyph = pgtbl->ComponentIndexForGlyph(pslout->GlyphID(), slati); + if (!pgtbl->ComponentBoxLogUnits(m_xysEmSquare, pslout->GlyphID(), iForGlyph, + m_mFontEmUnits, m_dysAscent, + &xsLeft, &ysTop, &xsRight, &ysBottom, + false)) // origin is baseline + { + return rectRet; + } + rectRet.top = ysTop; + rectRet.bottom = ysBottom; + rectRet.left = xsLeft; + rectRet.right = xsRight; + + return rectRet; +} + +/*---------------------------------------------------------------------------------------------- + Shift the glyphs physically by the given amount. This happens when a right-to-left + segment is changed from being end-of-line to not, so we have to account for the fact + that the trailing white-space was previous invisible but is now visible. +----------------------------------------------------------------------------------------------*/ +void Segment::ShiftGlyphs(float dxsShift) +{ + for (int islout = 0; islout < m_cslout; islout++) + { + GrSlotOutput * pslout = OutputSlot(islout); + pslout->AdjustPosXBy(dxsShift); + } + + //ShiftGlyphsPlatform(dxsShift); +} + +/*---------------------------------------------------------------------------------------------- + Find the glyph that best matches the given click location. + + @param xsClick - relative to start of segment + @param ysClick - relative to segment baseline +----------------------------------------------------------------------------------------------*/ +int Segment::GlyphHit(float xsClick, float ysClick) +{ + float xsLeft = kPosInfFloat; + float xsRight = kNegInfFloat; + + int iginf; + for (iginf = 0; iginf < m_cginf; iginf++) + { + GlyphInfo * pginf = m_prgginf + iginf; + xsLeft = min(xsLeft, pginf->origin()); + xsRight = max(xsRight, pginf->origin() + pginf->advanceWidth()); + } + + if (xsClick < xsLeft) + return m_fWsRtl ? m_cginf - 1 : 0; + else if (xsClick > xsRight) + return m_fWsRtl ? 0 : m_cginf - 1; + + int iginfHit; + std::vector viginfNear; + std::vector viginfHit; + std::vector viginfInside; + + // Find glyph which might contain click point. + + for (iginfHit = m_cginf; iginfHit-- > 0; ) + { + if (m_fWsRtl) + { + if (m_prgginf[iginfHit].bb().right >= xsClick) + break; + } + else + { + if (m_prgginf[iginfHit].bb().left <= xsClick) + break; + } + } + if (iginfHit < 0) // click within lsb of first glyph + { + return 0; + } + + // Find all BB that OVERLAP the click point (bb.left < XClick < bb.right). + for (iginf = iginfHit; iginf >= 0; iginf--) + { + Rect rectBB = m_prgginf[iginf].bb(); + if (rectBB.left <= xsClick && xsClick <= rectBB.right) + { + viginfNear.push_back(iginf); + } + } + + // Find all BB that CONTAIN the click point (considering the click's Y coor too). + int iiginf; + for (iiginf = 0; iiginf < (int)viginfNear.size(); iiginf++) + { + Rect rectBB = m_prgginf[viginfNear[iiginf]].bb(); + if (rectBB.bottom <= ysClick && ysClick <= rectBB.top) + { + viginfHit.push_back(viginfNear[iiginf]); + } + } + + if (viginfNear.size() > 2 && viginfHit.size() == 0) + { + // No hit along y-axis; find the closest thing. + float dy = float(10000000.0); + for (int iiginf2 = 0; iiginf2 < (int)viginfNear.size(); iiginf2++) + { + Rect rectBB = m_prgginf[viginfNear[iiginf2]].bb(); + if (fabsf(rectBB.top - ysClick) < dy) + { + dy = fabsf(rectBB.top - ysClick); + viginfHit.clear(); + viginfHit.push_back(viginfNear[iiginf2]); + } + if (fabsf(rectBB.bottom - ysClick) < dy) + { + dy = fabsf(rectBB.bottom - ysClick); + viginfHit.clear(); + viginfHit.push_back(viginfNear[iiginf2]); + } + } + } + + // Find all BB for which the click is within their advance width, if any. + for (iiginf = 0; iiginf < (int)viginfHit.size(); iiginf++) + { + //Rect rectBB = m_prgginf[viginfHit[iiginf]].bb(); -- ?? this tests the bounding box again :-/ + //if (rectBB.left <= xsClick && xsClick <= rectBB.right) + gr::GlyphInfo * pginf = m_prgginf + viginfHit[iiginf]; + if (pginf->advanceWidth() == 0 // advance width is irrelevant + || (pginf->origin() < xsClick && xsClick <= pginf->origin() + pginf->advanceWidth())) + { + viginfInside.push_back(viginfHit[iiginf]); + } + } + + // If no BB coincides in any way with the click point, take the BB whose leading edge + // is closest to the click point. + // There could be more than one BB with the same leading x coor. + if (viginfHit.size() == 0 && viginfNear.size() == 0 && viginfInside.size() == 0) + { + float xsLeading; + if (iginfHit + 1 == m_cginf) + { + viginfNear.push_back(iginfHit); + } + else if (!m_fWsRtl) + { + // Left-to-right: + xsLeading = m_prgginf[iginfHit + 1].bb().left; + for (iginf = iginfHit + 1; iginf < m_cginf; iginf++) + { + if (m_prgginf[iginf].bb().left == xsLeading) + viginfNear.push_back(iginf); + } + } + else + { + // Right-to-left: + xsLeading = m_prgginf[iginfHit].bb().right; + for (iginf = iginfHit; iginf < m_cginf; iginf++) + { + if (m_prgginf[iginf].bb().right == xsLeading) + viginfNear.push_back(iginf); + } + } + } + + Assert(viginfNear.size()); + + int iginfLoc; + + // Select the BB based on its leading edge, offset from baseline, position in final pass. + if (viginfInside.size()) + iginfLoc = SelectBb(viginfInside, m_fWsRtl); + else if (viginfHit.size()) + iginfLoc = SelectBb(viginfHit, m_fWsRtl); + else + iginfLoc = SelectBb(viginfNear, m_fWsRtl); + + return iginfLoc; +} + +/*---------------------------------------------------------------------------------------------- + Select the bounding box we will use for a mouse hit. + First select any glyph with a significantly smaller bounding box. + Then, select the BB with the left-most (LTR) or right-most (RTL) edge. + If more than one BB has same edge of interest, select the one that is closest to the + the baseline. + If that is a tie, select the one with the lowest islout. + + @param vigbb - list of indexes into m_prggbb + @param fRTL - writing system direction +----------------------------------------------------------------------------------------------*/ +int Segment::SelectBb(std::vector & viginf, bool fRTL) +{ + if (!viginf.size()) + { + Assert(false); + return -1; + } + + if (viginf.size() == 1) + return viginf[0]; + + // Find a glyph that has a signficantly smaller bounding box. + // The idea is that it is going to be harder to hit than the bigger glyph. + float smallestArea = float(1000000000.0); + float largestArea = 0.0; + size_t iiginfSmallest = 0; + size_t iiginf; + for (iiginf = 0; iiginf < viginf.size(); iiginf++) + { + gr::GlyphInfo * pginf = m_prgginf + viginf[iiginf]; + Rect rectBB = pginf->bb(); + float thisArea = (rectBB.right - rectBB.left) * (rectBB.top - rectBB.bottom); + if (smallestArea > thisArea) + { + smallestArea = thisArea; + iiginfSmallest = iiginf; + } + largestArea = max(largestArea, thisArea); + } + if (smallestArea * 2.0 < largestArea) + return viginf[iiginfSmallest]; + + // Find appropriate x coor of leading edge. + float xsLeading; + if (!fRTL) + xsLeading = m_prgginf[viginf[0]].bb().left; + else + xsLeading = m_prgginf[viginf[0]].bb().right; + + for (iiginf = 1; iiginf < viginf.size(); iiginf++) + { + Rect rectBB = m_prgginf[viginf[iiginf]].bb(); + if (!fRTL) + xsLeading = min(xsLeading, rectBB.left); + else + xsLeading = max(xsLeading, rectBB.right); + } + + // Find BBs with the leading edge. + std::vector viginfSameEdge; + for (iiginf = 0; iiginf < viginf.size(); iiginf++) + { + Rect rectBB = m_prgginf[viginf[iiginf]].bb(); + if (!fRTL) + { + if (rectBB.left == xsLeading) + viginfSameEdge.push_back(viginf[iiginf]); + } + else + { + if (rectBB.right == xsLeading) + viginfSameEdge.push_back(viginf[iiginf]); + } + } + + if (viginfSameEdge.size() == 1) + return viginfSameEdge[0]; + + // Find minimum distance from baseline. + float ysMin = fabsf(m_prgginf[viginfSameEdge[0]].yOffset()); + for (iiginf = 1; iiginf < viginfSameEdge.size(); iiginf++) + { + float ysThis = fabsf(m_prgginf[viginfSameEdge[iiginf]].yOffset()); + ysMin = min(ysMin, ysThis); + } + + // Find BBs with minimum distance from baseline. + std::vector viginfSameY; + for (iiginf = 0; iiginf < viginfSameEdge.size(); iiginf++) + { + if (fabsf(m_prgginf[viginfSameEdge[iiginf]].yOffset()) == ysMin) + viginfSameY.push_back(viginfSameEdge[iiginf]); + } + + if (viginfSameY.size() == 1) + return viginfSameY[0]; + + // Find minimum index of current candidates. + int islout = m_prgginf[viginfSameY[0]].logicalIndex(); + for (iiginf = 1; iiginf < viginfSameY.size(); iiginf++) + { + int isloutThis = m_prgginf[viginfSameY[iiginf]].logicalIndex(); + islout = min(islout, isloutThis); + } + + // Find BB with minimum islout - islout should be unique for all glyphs. + for (iiginf = 0; iiginf < viginfSameY.size(); iiginf++) + { + if (m_prgginf[viginfSameY[iiginf]].logicalIndex() == (unsigned)islout) + return viginfSameY[iiginf]; + } + + Assert(false); + return -1; // needed to stop compiler warning +} + +/*---------------------------------------------------------------------------------------------- + Return the right-most glyph on the physical surface. If there are ties, it will + prefer the one that is logically closest to the edge. +----------------------------------------------------------------------------------------------*/ +int Segment::RightMostGlyph() +{ + float xsRight = kNegInfFloat; + int iginfRet = -1; + for (int iginf = 0; iginf < m_cginf; iginf++) + { + float xsThis = m_prgginf[iginf].bb().right; + // For RTL, we prefer the glyph that is logically first; for LTR we prefer logically last. + if (xsThis > xsRight || (!m_fWsRtl && xsRight == xsThis)) + { + xsRight = xsThis; + iginfRet = iginf; + } + } + return iginfRet; +} + +/*---------------------------------------------------------------------------------------------- + Return the left-most glyph on the physical surface. If there are ties, it will + prefer the one that is logically closest to the edge. +----------------------------------------------------------------------------------------------*/ +int Segment::LeftMostGlyph() +{ + float xsLeft = kPosInfFloat; + int iginfRet = -1; + for (int iginf = 0; iginf < m_cginf; iginf++) + { + float xsThis = m_prgginf[iginf].bb().left; + // For RTL, we prefer the glyph that is logically last; for LTR we prefer logically first. + if (xsThis < xsLeft || (m_fWsRtl && xsLeft == xsThis)) + { + xsLeft = xsThis; + iginfRet = iginf; + } + } + return iginfRet; +} + +/*---------------------------------------------------------------------------------------------- + Convert from em-units to logical units. +----------------------------------------------------------------------------------------------*/ +float Segment::EmToLogUnits(int m) +{ + return GrEngine::GrIFIMulDiv(m, m_xysEmSquare, m_mFontEmUnits); +} + +/*---------------------------------------------------------------------------------------------- + Return the line-break pseudo glyph ID. +----------------------------------------------------------------------------------------------*/ +gid16 Segment::LBGlyphID() +{ + return m_preneng->LBGlyphID(); +} + +} // namespace gr diff --git a/Build/source/libs/graphite/engine-2.4/src/segment/SegmentAux.cpp b/Build/source/libs/graphite/engine-2.4/src/segment/SegmentAux.cpp new file mode 100644 index 00000000000..7e4fffd07a7 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/src/segment/SegmentAux.cpp @@ -0,0 +1,252 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 2005 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: SegmentAux.cpp +Responsibility: Sharon Correll +Last reviewed: Not yet. + +Description: + Implements auxiliary class that work with Segment: + - GlyphInfo + - GlyphIterator + - LayoutEnvironment +-------------------------------------------------------------------------------*//*:End Ignore*/ + +//:>******************************************************************************************** +//:> Include files +//:>******************************************************************************************** +#include "Main.h" +#ifdef _MSC_VER +#pragma hdrstop +#endif +// any other headers (not precompiled) +#ifndef _WIN32 +#include +#endif + +//:>******************************************************************************************** +//:> Forward declarations +//:>******************************************************************************************** + +//:>******************************************************************************************** +//:> Local Constants and static variables +//:>******************************************************************************************** + +namespace gr +{ + +//:>******************************************************************************************** +//:> GlyphInfo methods +//:>******************************************************************************************** + +gid16 GlyphInfo::glyphID() +{ + return m_pslout->m_chwActual; +} + +gid16 GlyphInfo::pseudoGlyphID() +{ + if (m_pslout->m_chwActual == m_pslout->m_chwGlyphID) + return 0; // not a pseudo-glyph + return m_pslout->m_chwGlyphID; +} + +bool GlyphInfo::isAttached() const throw() +{ + return m_pslout->IsPartOfCluster(); +} + +gr::GlyphIterator GlyphInfo::attachedClusterBase() const throw() +{ + const int islout = m_pslout->ClusterBase(); + + // Since we are not passing an array, the constructor expects a ginf index, not a slout index. + return GlyphIterator(*m_pseg, ((islout >= 0) ? islout : m_islout) - m_pseg->m_isloutGinf0); +} + +float GlyphInfo::attachedClusterAdvance() const throw() +{ + return m_pslout->ClusterAdvance(); +} + +std::pair GlyphInfo::attachedClusterGlyphs() const +{ + std::vector visloutClusterMembers; + m_pslout->ClusterMembers(m_pseg, m_islout, visloutClusterMembers); + RcVector * qvislout = new RcVector(visloutClusterMembers); + return std::make_pair( + GlyphSetIterator(*m_pseg, 0, qvislout), + GlyphSetIterator(*m_pseg, visloutClusterMembers.size(), qvislout)); +} + +size_t GlyphInfo::logicalIndex() +{ + if (m_pseg->OutputSlot(0)->IsLineBreak()) + return m_islout - 1; + else + return m_islout; +} + +float GlyphInfo::origin() +{ + return m_pslout->XPosition(); +} + +float GlyphInfo::advanceWidth() // logical units +{ + return m_pslout->m_xsAdvanceX; +} + +float GlyphInfo::advanceHeight() // logical units; zero for horizontal fonts +{ + Font & font = m_pseg->getFont(); + return m_pslout->GlyphMetricLogUnits(&font, kgmetAdvHeight); +} + +float GlyphInfo::yOffset() +{ + return m_pslout->YPosition(); +} + +Rect GlyphInfo::bb() // logical units +{ + return m_pslout->BoundingBox(m_pseg->getFont()); +} + +bool GlyphInfo::isSpace() +{ + return m_pslout->IsSpace(); +} + +// first char associated with this glyph, relative to start of the text-source +toffset GlyphInfo::firstChar() +{ + return m_pseg->LogicalSurfaceToUnderlying(m_islout, true); +} + +// last char associated with this glyph, relative to start of the text-source +toffset GlyphInfo::lastChar() +{ + return m_pseg->LogicalSurfaceToUnderlying(m_islout, false); +} + +unsigned int GlyphInfo::directionality() +{ + return m_pslout->Directionality(); +} + +// Embedding depth +unsigned int GlyphInfo::directionLevel() +{ + return m_pslout->DirLevel(); +} + +bool GlyphInfo::insertBefore() +{ + return m_pslout->InsertBefore(); +} + +int GlyphInfo::breakweight() +{ + return m_pslout->BreakWeight(); +} + +float GlyphInfo::maxStretch(size_t level) +{ + return m_pslout->MaxStretch(m_pseg, (int)level); +} + +float GlyphInfo::maxShrink(size_t level) +{ + return m_pslout->MaxShrink(m_pseg, (int)level); +} + +float GlyphInfo::stretchStep(size_t level) +{ + return m_pslout->StretchStep(m_pseg, (int)level); +} + +byte GlyphInfo::justWeight(size_t level) +{ + return byte(m_pslout->JustWeight((int)level)); +} + +float GlyphInfo::justWidth(size_t level) +{ + return m_pslout->JustWidth(m_pseg, (int)level); +} + +float GlyphInfo::measureStartOfLine() +{ + return m_pslout->MeasureSolLogUnits(m_pseg); +} + +float GlyphInfo::measureEndOfLine() +{ + return m_pslout->MeasureEolLogUnits(m_pseg); +} + +size_t GlyphInfo::numberOfComponents() +{ + return m_pslout->NumberOfComponents(); +} + +Rect GlyphInfo::componentBox(size_t icomp) +{ + return m_pseg->ComponentRect(m_pslout, icomp); +} + +toffset GlyphInfo::componentFirstChar(size_t icomp) +{ + Assert((int)icomp < m_pslout->NumberOfComponents()); + return m_pslout->FirstUnderlyingComponent(icomp) + m_pseg->startCharacter(); +} +toffset GlyphInfo::componentLastChar(size_t icomp) +{ + Assert((int)icomp < m_pslout->NumberOfComponents()); + return m_pslout->LastUnderlyingComponent(icomp) + m_pseg->startCharacter(); +} + +bool GlyphInfo::erroneous() +{ + return m_pseg->Erroneous(); +} + + +//:>******************************************************************************************** +//:> GlyphIterator methods +//:>******************************************************************************************** + +// Constructor +GlyphIterator::GlyphIterator(Segment & seg, size_t iginf) +: m_pginf(seg.m_prgginf + iginf) +{} + +// Copy constructor. +// Check if the incoming iterator is null, as we cannot dereference +// it to get the segment, and create a null GlyphIterator. +// Technically this might better be an assert as converting a null +// GlyphSetIterator into a null GlyphIterator is pointless and suggests +// some kind of error. +GlyphIterator::GlyphIterator(const GlyphSetIterator & sit) +: m_pginf((sit == GlyphSetIterator()) + ? 0 + : sit->segment().m_prgginf + sit->logicalIndex()) +{} + +/*---------------------------------------------------------------------------------------------- + Dereference the iterator, returning a GlyphInfo object. +----------------------------------------------------------------------------------------------*/ + +GlyphSetIterator::reference GlyphSetIterator::operator*() const +{ + assert(m_pseg != 0); + + return m_pseg->m_prgginf[(*m_vit) - m_pseg->m_isloutGinf0]; +} + + +} // namespace gr diff --git a/Build/source/libs/graphite/engine-2.4/src/segment/TransductionLog.cpp b/Build/source/libs/graphite/engine-2.4/src/segment/TransductionLog.cpp new file mode 100644 index 00000000000..7876083c5a0 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/src/segment/TransductionLog.cpp @@ -0,0 +1,2187 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 2000, 2001 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: TransductionLog.cpp +Responsibility: Sharon Correll +Last reviewed: Not yet. + +Description: + Contains the functions for writing a log of the transduction process. +----------------------------------------------------------------------------------------------*/ + +//:>******************************************************************************************** +//:> Include files +//:>******************************************************************************************** +#include "Main.h" + +#ifdef _MSC_VER +#pragma hdrstop +#endif +#include +#include + +//:End Ignore + +//:>******************************************************************************************** +//:> Forward declarations +//:>******************************************************************************************** + +//:>******************************************************************************************** +//:> Local Constants and static variables +//:>******************************************************************************************** + +namespace gr +{ + +//:>******************************************************************************************** +//:> Methods +//:>******************************************************************************************** + +#define SP_PER_SLOT 7 +#define LEADING_SP 15 +#define MAX_SLOTS 128 + +/*---------------------------------------------------------------------------------------------- + Output a file showing a log of the transduction process and the resulting segment. +----------------------------------------------------------------------------------------------*/ +//bool GrTableManager::WriteTransductionLog(GrCharStream * pchstrm, Segment * psegRet, +// int cbPrevSegDat, byte * pbPrevSegDat, byte * pbNextSegDat, int * pcbNextSegDat) +//{ +//#ifdef TRACING +// std::string staFile; +// if (!LogFileName(staFile)) +// return false; +// +// std::ofstream strmOut; +// if (cbPrevSegDat > 0) +// strmOut.open(staFile.c_str(), std::ios::app); // append +// else +// strmOut.open(staFile.c_str()); +// if (strmOut.fail()) +// return false; +// +// WriteXductnLog(strmOut, pchstrm, psegRet, cbPrevSegDat, pbPrevSegDat); +// +// strmOut.close(); +// return true; +//#else +// return false; +//#endif // TRACING +//} + +#ifdef TRACING +bool GrTableManager::WriteTransductionLog(std::ostream * pstrmLog, + GrCharStream * pchstrm, Segment * psegRet, int cbPrevSegDat, byte * pbPrevSegDat) +#else +bool GrTableManager::WriteTransductionLog(std::ostream *,GrCharStream *, + Segment *, int, byte *) +#endif // !TRACING +{ +#ifdef TRACING + if (!pstrmLog) + return false; + std::ostream & strmOut = *pstrmLog; + WriteXductnLog(strmOut, pchstrm, psegRet, cbPrevSegDat, pbPrevSegDat); + return true; +#else + return false; +#endif // !TRACING +} + +/*---------------------------------------------------------------------------------------------- + Append to the file, showing the surface/underlying mappings. This must be done after + figuring out all the associations. + + Also write the final glyph positions, since they are now determined. +----------------------------------------------------------------------------------------------*/ +//bool GrTableManager::WriteAssociationLog(GrCharStream * pchstrm, Segment * psegRet) +//{ +//#ifdef TRACING +// std::string staFile; +// if (!LogFileName(staFile)) +// return false; +// +// std::ofstream strmOut; +// strmOut.open(staFile.c_str(), std::ios::app); // append +// if (strmOut.fail()) +// return false; +// +// LogFinalPositions(strmOut); +// +// strmOut << "\n\n- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n\n"; +// +// psegRet->LogUnderlyingToSurface(this, strmOut, pchstrm); +// psegRet->LogSurfaceToUnderlying(this, strmOut); +// +// strmOut << "\n\n=======================================================================\n\n"; +// +// strmOut.close(); +// return true; +//#else +// return false; +//#endif // TRACING +//} + + +#ifdef TRACING +bool GrTableManager::WriteAssociationLog(std::ostream * pstrmLog, + GrCharStream * pchstrm, Segment * psegRet) +#else +bool GrTableManager::WriteAssociationLog(std::ostream *, + GrCharStream *, Segment *) +#endif +{ +#ifdef TRACING + if (!pstrmLog) + return false; + + std::ostream & strmOut = *pstrmLog; + LogFinalPositions(strmOut); + + strmOut << "\n\n- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n\n"; + + psegRet->LogUnderlyingToSurface(this, strmOut, pchstrm); + psegRet->LogSurfaceToUnderlying(this, strmOut); + + strmOut << "\n\n=======================================================================\n\n"; + + return true; +#else + return false; +#endif // TRACING +} + +#ifdef TRACING + +/*---------------------------------------------------------------------------------------------- + Generate the name of the file where the log will be written. It goes in the directory + defined by either the TEMP or TMP environment variable. + + TODO: remove +----------------------------------------------------------------------------------------------*/ +//bool GrTableManager::LogFileName(std::string & staFile) +//{ +// char * pchTmpEnv = getenv("TEMP"); +// if (pchTmpEnv == 0) +// pchTmpEnv = getenv("TMP"); +// if (pchTmpEnv == 0) +// return false; +// +// staFile.assign(pchTmpEnv); +// if (staFile[staFile.size() - 1] != '\\') +// staFile.append("\\"); +// staFile.append("gr_xductn.log"); +// +// return true; +//} + +/*---------------------------------------------------------------------------------------------- + Output a file showing a log of the transduction process and the resulting segment. +----------------------------------------------------------------------------------------------*/ +void GrTableManager::WriteXductnLog(std::ostream & strmOut, + GrCharStream * pchstrm, Segment * /*psegRet*/, + int cbPrevSegDat, byte * pbPrevSegDat) +{ + if (cbPrevSegDat == 0) + LogUnderlying(strmOut, pchstrm, 0); + else + { + Assert(*(pbPrevSegDat + 4) == 0); // skip offset for first pass + LogUnderlying(strmOut, pchstrm, *(pbPrevSegDat + 3)); + } + + LogPass1Input(strmOut); + + for (int ipass = 1; ipass < m_cpass; ipass++) + { + if (cbPrevSegDat == 0) + LogPassOutput(strmOut, ipass, 0); + else + LogPassOutput(strmOut, ipass, *(pbPrevSegDat + 4 + ipass)); + } + + // Do this later, after outputting final positions: + //strmOut << "\n\n- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n\n"; +} + +/*---------------------------------------------------------------------------------------------- + Write out a log of the underlying input. +----------------------------------------------------------------------------------------------*/ +void GrTableManager::LogUnderlying(std::ostream & strmOut, GrCharStream * pchstrm, + int cchwBackup) +{ + strmOut << "UNDERLYING INPUT\n\n"; + + int rgnChars[MAX_SLOTS]; + bool rgfNewRun[MAX_SLOTS]; + std::fill_n(rgfNewRun, MAX_SLOTS, false); + GrFeatureValues rgfval[MAX_SLOTS]; + int cchwMaxRawChars; + + int cnUtf32 = pchstrm->GetLogData(this, rgnChars, rgfNewRun, rgfval, + cchwBackup, &cchwMaxRawChars); + cnUtf32 = min(cnUtf32, MAX_SLOTS); + + int ichw; + + // For UTF-8 and surrogate representation: + utf16 rgchwChars2[MAX_SLOTS]; + utf16 rgchwChars3[MAX_SLOTS]; + utf16 rgchwChars4[MAX_SLOTS]; + utf16 rgchwChars5[MAX_SLOTS]; + utf16 rgchwChars6[MAX_SLOTS]; + int rgcchwRaw[MAX_SLOTS]; + + if (cchwMaxRawChars > 1) + { + cchwMaxRawChars = min(cchwMaxRawChars, 6); // max of 6 raw (UTF-8 or UTF-16) chars per slot + pchstrm->GetLogDataRaw(this, cnUtf32, cchwBackup, cchwMaxRawChars, + rgnChars, rgchwChars2, rgchwChars3, rgchwChars4, rgchwChars5, rgchwChars6, + rgcchwRaw); + } + else + { + for (ichw = 0; ichw < cnUtf32; ichw++) + { + rgcchwRaw[ichw] = 1; + rgchwChars2[ichw] = 0; + rgchwChars3[ichw] = 0; + rgchwChars4[ichw] = 0; + rgchwChars5[ichw] = 0; + rgchwChars6[ichw] = 0; + } + } + + LogUnderlyingHeader(strmOut, pchstrm->Min(), (pchstrm->Min() + cnUtf32 - cchwBackup), + cchwBackup, rgcchwRaw); + + // Text + strmOut << "Text: "; // 15 spaces + for (ichw = 0; ichw < cnUtf32; ichw++) + { + if (rgnChars[ichw] < 0x0100 && rgchwChars2[ichw] == 0) // ANSI + strmOut << (char)rgnChars[ichw] << " "; // 6 spaces + else if (rgnChars[ichw] == knLRM) + strmOut << " "; + else if (rgnChars[ichw] == knRLM) + strmOut << " "; + else if (rgnChars[ichw] == knLRO) + strmOut << " "; + else if (rgnChars[ichw] == knRLO) + strmOut << " "; + else if (rgnChars[ichw] == knLRE) + strmOut << " "; + else if (rgnChars[ichw] == knRLE) + strmOut << " "; + else if (rgnChars[ichw] == knPDF) + strmOut << " "; + else + strmOut << ". "; + } + strmOut << "\n"; + + // Unicode + strmOut << "Unicode: "; + for (ichw = 0; ichw < cnUtf32; ichw++) + LogHexInTable(strmOut, utf16(rgnChars[ichw])); + strmOut << "\n"; + for (int icchRaw = 2; icchRaw <= cchwMaxRawChars; icchRaw++) + { + strmOut << " "; + for (ichw = 0; ichw < cnUtf32; ichw++) + { + utf16 chw; + switch (icchRaw) + { + case 2: chw = rgchwChars2[ichw]; break; + case 3: chw = rgchwChars3[ichw]; break; + case 4: chw = rgchwChars4[ichw]; break; + case 5: chw = rgchwChars5[ichw]; break; + case 6: chw = rgchwChars6[ichw]; break; + default: chw = 0; + } + if (chw == 0) + strmOut << ". "; + else + LogHexInTable(strmOut, chw); + } + strmOut << "\n"; + } + + // Runs + strmOut << "Runs: "; + int crun = 0; + for (ichw = 0; ichw < cnUtf32; ichw++) + { + if (rgfNewRun[ichw]) + { + crun++; + strmOut << "|" << crun << ((crun < 10) ? " " : " "); + } + else + strmOut << ". "; + } + strmOut << "\n"; + + // Features + strmOut << "Features and character properties:\n"; + crun = 0; + for (ichw = 0; ichw < cnUtf32; ichw++) + { + if (rgfNewRun[ichw]) + { + crun++; + strmOut << " Run " << crun << ": "; + rgfval[ichw].WriteXductnLog(this, strmOut); + + } + } +} + + +void GrFeatureValues::WriteXductnLog(GrTableManager * ptman, std::ostream & strmOut) +{ + bool fFirst = true; + for (int i = 0; i < kMaxFeatures; i++) + { + if (m_rgnFValues[i] != 0) + { + GrFeature * pfeat = ptman->Feature(i); + if (!fFirst) + strmOut << ","; + strmOut << pfeat->ID() << "=" << m_rgnFValues[i]; + fFirst = false; + } + } + if (fFirst) + strmOut << "all features=0"; + + strmOut << "\n\n"; +} + +/*---------------------------------------------------------------------------------------------- + Loop through the input stream of underlying characters, storing information in the + arrays for the log. + ENHANCE SharonC: do we need to show the underline properties? +----------------------------------------------------------------------------------------------*/ +int GrCharStream::GetLogData(GrTableManager * ptman, int * rgchl, bool * rgfNewRun, + GrFeatureValues * rgfval, int cchrBackup, int * pcchrMax) +{ + Assert(cchrBackup <= m_cchrBackedUp); + + int ichrPosToStop = m_ichrPos; + int ichrStart = m_ichrMin - max(cchrBackup, m_cchrBackedUp); + + *pcchrMax = 0; + + // Restart the stream. + m_ichrPos = ichrStart; + m_ichrRunMin = 0; + m_ichrRunLim = 0; + m_ichrRunOffset = kPosInfinity; + m_vislotNextChunkMap.clear(); + + int cchrSkipBackup = m_cchrBackedUp - cchrBackup; + + int c = 0; + int cchr = 0; + + while (m_ichrPos < ichrPosToStop) + { + if ((c < MAX_SLOTS) && (m_ichrPos >= m_ichrRunLim)) + { + rgfNewRun[c] = true; + } + + GrFeatureValues fval; + int ichrOffset, cchrThis; + int chl = NextGet(ptman, &fval, &ichrOffset, &cchrThis); + cchr += cchrThis; + if (cchr <= cchrSkipBackup) + {} // ignore - this is before the pre-segment stuff that we want to skip + else if (c < MAX_SLOTS) + { + rgchl[c] = chl; + *pcchrMax = max(*pcchrMax, cchrThis); + if (rgfNewRun[c]) + { + rgfval[c] = fval; + } + c++; + } + } + + ////return (m_ichwPos - (m_ichwMin - cchwBackup)); + return c; +} + +/*---------------------------------------------------------------------------------------------- + If any of the characters are comprised of surrogates or UTF-8, fill in the arrays with + the raw (UTF-16 or UTF-8) chars for display. To do this we get the raw characters + directly from the text source. +----------------------------------------------------------------------------------------------*/ +void GrCharStream::GetLogDataRaw(GrTableManager * /*ptman*/, int cchl, int cchrBackup, + int /*cchrMaxRaw*/, int * prgchl, + utf16 * prgchw2, utf16 * prgchw3, utf16 * prgchw4, utf16 * prgchw5, utf16 * prgchw6, + int * prgcchr) +{ + for (int i = 0; i < cchl; i++) + { + prgchw2[i] = 0; + } + + int ichrLim = m_ichrPos; + int ichrMin = m_ichrMin - cchrBackup; + + int cchrRange = ichrLim - ichrMin; + int ichr; + utf16 * prgchwRunText = new utf16[cchrRange]; + utf8 * prgchsRunText8 = NULL; + + UtfType utf = m_pgts->utfEncodingForm(); + + switch (utf) + { + case kutf8: + prgchsRunText8 = new utf8[cchrRange]; + m_pgts->fetch(ichrMin, cchrRange, prgchsRunText8); + for (ichr = 0; ichr < cchrRange; ichr++) + prgchwRunText[ichr] = (utf16)prgchsRunText8[ichr]; // zero-extend into UTF-16 buffer + break; + case kutf16: + m_pgts->fetch(ichrMin, cchrRange, prgchwRunText); + break; + default: + case kutf32: // this method should never have been called + Assert(false); + for (int ichrLp = 0; ichrLp < cchrRange; ichrLp++) + { + prgcchr[ichrLp] = 1; + prgchw2[ichrLp] = 0; + prgchw3[ichrLp] = 0; + prgchw4[ichrLp] = 0; + prgchw5[ichrLp] = 0; + prgchw6[ichrLp] = 0; + } + return; + } + + ichr = ichrMin; + int ichl = 0; + while (ichr < ichrLim) + { + int cchrThis = 1; + // Replace 32-bit char with (first) 16-bit or 8-bit char. + prgchl[ichl] = (int)prgchwRunText[ichr - ichrMin]; + prgcchr[ichr] = cchrThis; + ichr++; + + while (!AtUnicodeCharBoundary(prgchwRunText, cchrRange, ichr - ichrMin, utf)) + { + cchrThis++; + switch (cchrThis) + { + case 2: prgchw2[ichl] = prgchwRunText[ichr - ichrMin]; break; + case 3: prgchw3[ichl] = prgchwRunText[ichr - ichrMin]; break; + case 4: prgchw4[ichl] = prgchwRunText[ichr - ichrMin]; break; + case 5: prgchw5[ichl] = prgchwRunText[ichr - ichrMin]; break; + case 6: prgchw6[ichl] = prgchwRunText[ichr - ichrMin]; break; + default: + break; + } + prgcchr[ichr] = cchrThis; + ichr++; + } + switch (cchrThis) + { + case 1: + prgchw2[ichl] = 0; + // fall through + case 2: + prgchw3[ichl] = 0; + // fall through + case 3: + prgchw4[ichl] = 0; + // fall through + case 4: + prgchw5[ichl] = 0; + // fall through + case 5: + prgchw6[ichl] = 0; + } + ichl++; + } + + delete[] prgchwRunText; + delete[] prgchsRunText8; +} + +/*---------------------------------------------------------------------------------------------- + Output the glyph IDs generated by the glyph generation pass (pass 0). +----------------------------------------------------------------------------------------------*/ +void GrTableManager::LogPass1Input(std::ostream & strmOut) +{ + strmOut << "INPUT TO PASS 1\n\n"; + + GrSlotStream * psstrm = OutputStream(0); + + LogSlotHeader(strmOut, psstrm->WritePos(), SP_PER_SLOT, LEADING_SP); + + LogSlotGlyphs(strmOut, psstrm); + + strmOut << "\n"; +} + +/*---------------------------------------------------------------------------------------------- + Output the the results of pass. +----------------------------------------------------------------------------------------------*/ +void GrTableManager::LogPassOutput(std::ostream & strmOut, int ipass, int cslotSkipped) +{ + strmOut << "\n"; + + GrPass * ppass = Pass(ipass); + GrSlotStream * psstrmIn = InputStream(ipass); + GrSlotStream * psstrmOut = OutputStream(ipass); + + int islot; + // Mark each slot with its index in the input and output streams. + for (islot = 0; islot < psstrmIn->ReadPos(); islot++) + psstrmIn->SlotAt(islot)->m_islotTmpIn = islot; + + for (islot = 0; islot < psstrmOut->WritePos(); islot++) + psstrmOut->SlotAt(islot)->m_islotTmpOut = islot; + + ppass->LogRulesFiredAndFailed(strmOut, psstrmIn, m_ipassJust1); + + strmOut << "\nOUTPUT OF PASS " << ipass; + //if (dynamic_cast(ppass)) + // strmOut << " (bidi)"; + //else if (dynamic_cast(ppass)) + //{ + // if (ipass >= m_ipassJust1) + // strmOut << " (justification)"; + // else + // strmOut << " (substitution)"; + //} + //else if (dynamic_cast(ppass)) + // strmOut << " (positioning)"; + //else if (dynamic_cast(ppass)) + // strmOut << " (linebreak)"; + strmOut << "\n"; + + ppass->LogInsertionsAndDeletions(strmOut, psstrmOut); + + LogSlotHeader(strmOut, psstrmOut->WritePos(), SP_PER_SLOT, LEADING_SP); + + LogSlotGlyphs(strmOut, psstrmOut); + + bool fAnyPseudos = false; + if (dynamic_cast(ppass)) + { + for (islot = 0; islot < psstrmOut->WritePos(); islot++) + { + GrSlotState * pslotTmp = psstrmOut->SlotAt(islot); + if (pslotTmp->GlyphID() != pslotTmp->ActualGlyphForOutput(this)) + { + fAnyPseudos = true; + break; + } + } + } + if (fAnyPseudos) + { + strmOut << "Actual glyphs: "; + for (islot = 0; islot < psstrmOut->WritePos(); islot++) + { + GrSlotState * pslotTmp = psstrmOut->SlotAt(islot); + if (pslotTmp->GlyphID() != pslotTmp->ActualGlyphForOutput(this)) + LogHexInTable(strmOut, pslotTmp->ActualGlyphForOutput(this)); + else + strmOut << ". "; + } + strmOut << "\n"; + } + + LogAttributes(strmOut, ipass); + + // Do this later, after we're sure the positions have been set: + //if (ipass == m_cpass - 1) + // LogFinalPositions(strmOut); + + if (cslotSkipped > 0) + { + strmOut << "\n "; + for (islot = 0; islot < cslotSkipped; islot++) + strmOut << "SKIP "; + strmOut << "\n"; + } + + // If this was the pass just before the justification routines get run, output a + // special line that just shows the results, ie, the values of justify.width. + // TODO: adjust this when measure mode get functioning. + if (ipass == m_ipassJust1 - 1 && ShouldLogJustification() + && m_engst.m_jmodi == kjmodiJustify) + { + strmOut << "\nJUSTIFICATION\n\n"; + LogSlotHeader(strmOut, psstrmOut->WritePos(), SP_PER_SLOT, LEADING_SP); + LogSlotGlyphs(strmOut, psstrmOut); + LogAttributes(strmOut, ipass, true); + } +} + +/*---------------------------------------------------------------------------------------------- + Write the list of rules fired and failed for a given pass. +----------------------------------------------------------------------------------------------*/ +void GrPass::LogRulesFiredAndFailed(std::ostream & strmOut, GrSlotStream * psstrmIn, int ipassJust1) +{ + strmOut << "PASS " << m_ipass; + if (dynamic_cast(this)) + strmOut << " (bidi)"; + else if (dynamic_cast(this)) + { + if (m_ipass >= ipassJust1) + strmOut << " (justification)"; + else + strmOut << " (substitution)"; + } + else if (dynamic_cast(this)) + strmOut << " (positioning)"; + else if (dynamic_cast(this)) + strmOut << " (linebreak)"; + + strmOut << "\n\n" ; + + if (m_cbPassConstraint > 0 && m_prgbPConstraintBlock != NULL) + m_pzpst->LogPassConstraints(strmOut); + + if (!dynamic_cast(this)) + m_pzpst->LogRulesFiredAndFailed(strmOut, psstrmIn); +} + +void PassState::LogPassConstraints(std::ostream & strmOut) +{ + if (m_crngrec == 0) + {} + else if (m_crngrec == 1) + { + if (m_rgrngrec[0].m_fSucceeds) + strmOut << "Pass constraint passed\n\n"; + else + strmOut << "Pass constraint failed\n\n"; + } + else + { + strmOut << "Pass constraint:\n"; + for (int irngrec = 0; irngrec < m_crngrec; irngrec++) + { + strmOut << " " << m_rgrngrec[irngrec].m_islotMin << ".." << m_rgrngrec[irngrec].m_islotLim-1 << ": "; + strmOut << ((m_rgrngrec[irngrec].m_fSucceeds) ? "passed\n" : "failed\n"); + } + strmOut << "\n"; + } +} + +void PassState::LogRulesFiredAndFailed(std::ostream & strmOut, GrSlotStream * /*psstrmIn*/) +{ + strmOut << "Rules matched: "; + if (m_crulrec == 0) + strmOut << "none"; + strmOut << "\n"; + + for (int irulrec = 0; irulrec < m_crulrec; irulrec++) + { + if (m_rgrulrec[irulrec].m_fFired) + strmOut << " * "; + else + strmOut << " "; + + strmOut << m_rgrulrec[irulrec].m_islot << ". "; + + if (m_rgrulrec[irulrec].m_irul == PassState::kHitMaxRuleLoop) + strmOut << "hit MaxRuleLoop\n"; + else if (m_rgrulrec[irulrec].m_irul == PassState::kHitMaxBackup) + strmOut << "hit MaxBackup\n"; + else + { + strmOut << "rule " << m_ipass << "." << m_rgrulrec[irulrec].m_irul; + + if (m_rgrulrec[irulrec].m_fFired) + strmOut << " FIRED\n"; + else + strmOut << " failed\n"; + } + } +} + +/*---------------------------------------------------------------------------------------------- + Write out the marks on top of the slot table indicating insertions and deletions. +----------------------------------------------------------------------------------------------*/ +void GrPass::LogInsertionsAndDeletions(std::ostream & strmOut, GrSlotStream * psstrmOut) +{ + m_pzpst->LogInsertionsAndDeletions(strmOut, psstrmOut); +} + +void PassState::LogInsertionsAndDeletions(std::ostream & strmOut, GrSlotStream * psstrmOut) +{ + int cslotDel = m_rgcslotDeletions[0]; + bool fIns; + if (cslotDel > 1) + strmOut << "\n DEL-" << cslotDel; + else if (cslotDel == 1) + strmOut << "\n DEL "; + else + strmOut << "\n "; + + for (int islot = 0; islot < psstrmOut->WritePos(); islot++) + { + cslotDel = (islot + 1 >= MAX_SLOTS) ? 0 : m_rgcslotDeletions[islot + 1]; + fIns = (islot >= MAX_SLOTS) ? 0 : m_rgfInsertion[islot]; + + if (fIns) + { + strmOut << "INS"; + if (cslotDel > 0) + { + if (cslotDel > 1) + strmOut << "/D-" << cslotDel; + else + strmOut << "/DEL"; + } + else + strmOut << " "; + + } + else if (cslotDel > 0) + { + if (cslotDel >= 10) + strmOut << "DEL-" << cslotDel << " "; + else if (cslotDel > 1) + strmOut << " DEL-" << cslotDel << " "; + else + strmOut << " DEL "; + } + else + strmOut << ". "; + } + + strmOut << "\n"; +} + +/*---------------------------------------------------------------------------------------------- + Write out a line for each slot attribute that changed during the pass. + + @param fJustWidths - a special pass that writes out just the effects of the justification + routines, ie, the values of justify.width +----------------------------------------------------------------------------------------------*/ +void GrTableManager::LogAttributes(std::ostream & strmOut, int ipass, + bool fJustWidths) +{ + // Figure out which slot attributes were modified for some slot during the pass. + bool * prgfMods = new bool[kslatMax + NumUserDefn() - 1]; + + bool fPreJust = (!fJustWidths && ipass == m_ipassJust1 - 1 && ShouldLogJustification()); + bool fPostJust = ((fJustWidths || ipass == m_ipassJust1) && ShouldLogJustification()); + + int ccomp; // max number of components per slot + int cassoc; // max number of associations per slot + SlotAttrsModified(ipass, prgfMods, fPreJust, &ccomp, &cassoc); + + if (fPreJust) + { + // prgfMods[kslatJStretch] = true; + // prgfMods[kslatJShrink] = true; + // prgfMods[kslatJStep] = true; + // prgfMods[kslatWeight] = true; + prgfMods[kslatJWidth] = false; // output j.width in its own line (we call this + // method with fJustWidths == true) + } + else if (fPostJust) + prgfMods[kslatJWidth] = true; + + GrPass * ppass = Pass(ipass); + GrPass * ppassNext = (ipass < m_cpass - 1) ? Pass(ipass + 1) : NULL; + GrSlotStream * psstrm = OutputStream(ipass); + + if (fJustWidths) + {} + else if (dynamic_cast(ppass)) + { + // Special stuff for Bidi pass: + // Log value of directionality attribute. + strmOut << "directionality "; + int islot; + for (islot = 0; islot < psstrm->WritePos(); islot++) + { + GrSlotState * pslot = psstrm->SlotAt(islot); + LogDirCodeInTable(strmOut, pslot->DirProcessed()); + } + strmOut << "\n"; + + // Log final direction level for bidi pass. + strmOut << "dir level: "; + for (islot = 0; islot < psstrm->WritePos(); islot++) + { + GrSlotState * pslot = psstrm->SlotAt(islot); + LogInTable(strmOut, pslot->DirLevel()); + } + strmOut << "\n"; + } + else if (ppassNext && dynamic_cast(ppassNext)) + { + // Next pass is Bidi: log input values of directionality attribute that are input for it. + strmOut << "directionality "; + for (int islot = 0; islot < psstrm->WritePos(); islot++) + { + GrSlotState * pslot = psstrm->SlotAt(islot); + LogDirCodeInTable(strmOut, pslot->Directionality()); + } + strmOut << "\n"; + } + + for (int slat = 0; slat < kslatMax + NumUserDefn() - 1; slat++) + { + int cIndexLim = 1; + if (slat == kslatCompRef) + cIndexLim = ccomp; + else if (slat == kslatUserDefn) + cIndexLim = 1; // kMaxUserDefinedSlotAttributes; + + if (fJustWidths && slat != kslatJWidth) + continue; + + bool fValidAttr = true; + for (int iIndex = 0; iIndex < cIndexLim; iIndex++) + { + if (prgfMods[slat]) + { + switch(slat) + { + case kslatAdvX: strmOut << "advance.x "; break; + case kslatAdvY: strmOut << "advance.y "; break; + case kslatAttTo: strmOut << "att.to "; break; + case kslatAttAtX: strmOut << "att.at.x "; break; + case kslatAttAtY: strmOut << "att.at.y "; break; + case kslatAttAtGpt: strmOut << "att.at.gpt "; break; + case kslatAttAtXoff: strmOut << "att.at.xoff "; break; + case kslatAttAtYoff: strmOut << "att.at.yoff "; break; + case kslatAttWithX: strmOut << "att.with.x "; break; + case kslatAttWithY: strmOut << "att.with.y "; break; + case kslatAttWithGpt: strmOut << "att.with.gpt "; break; + case kslatAttWithXoff: strmOut << "att.with.xoff "; break; + case kslatAttWithYoff: strmOut << "att.with.yoff "; break; + case kslatAttLevel: strmOut << "att.level "; break; + case kslatBreak: strmOut << "breakweight "; break; + case kslatCompRef: strmOut << "component " << iIndex + 1 // 1-based + << " "; break; + case kslatDir: strmOut << "dir "; break; + case kslatInsert: strmOut << "insert "; break; + case kslatMeasureSol: strmOut << "measure.sol "; break; + case kslatMeasureEol: strmOut << "measure.eol "; break; + case kslatJStretch: strmOut << "j.stretch "; break; + case kslatJShrink: strmOut << "j.shrink "; break; + case kslatJStep: strmOut << "j.step "; break; + case kslatJWeight: strmOut << "j.weight "; break; + case kslatJWidth: strmOut << "j.width "; break; + case kslatPosX: + case kslatPosY: + Assert(false); + break; + case kslatShiftX: strmOut << "shift.x "; break; + case kslatShiftY: strmOut << "shift.y "; break; + case kslatSegsplit: strmOut << "segsplit "; break; + default: + if (kslatUserDefn <= slat && + slat < kslatUserDefn + NumUserDefn()) + { + strmOut << "user" << (slat - kslatUserDefn + 1) // 1-based + << ((iIndex >= 9) ? " " : " "); + } + else + { + // Invalid attribute: + Warn("bad slot attribute"); + fValidAttr = false; + break; + } + } + + if (!fValidAttr) + break; // out of iIndex loop + + for (int islot = 0; islot < psstrm->WritePos(); islot++) + { + GrSlotState * pslot = psstrm->SlotAt(islot); + pslot->LogSlotAttribute(this, strmOut, ipass, slat, iIndex, + fPreJust, fPostJust); + } + + strmOut << "\n"; + } + } + } + + if (fJustWidths) + goto LDone; + + for (int iassoc = 0; iassoc < cassoc; iassoc++) + { + // Log associations. Put them on one line it that will work; otherwise use several. + bool fBoth = (cassoc <= 2); + bool fAfter = (iassoc == (cassoc - 1)); + if (fBoth) + strmOut << "assocs "; + else if (iassoc == 0) + strmOut << "assocs-before "; + else if (fAfter) + strmOut << " -after "; + else + strmOut << " -other "; + + for (int islot = 0; islot < psstrm->WritePos(); islot++) + { + GrSlotState * pslot = psstrm->SlotAt(islot); + pslot->LogAssociation(this, strmOut, ipass, iassoc, fBoth, fAfter); + } + + strmOut << "\n"; + + if (fBoth) + break; + } + + if (cassoc == 0 && dynamic_cast(ppass)) + { + strmOut << "assocs "; + + // Log associations for all slots moved during the Bidi pass. + for (int islot = 0; islot < psstrm->WritePos(); islot++) + { + GrSlotState * pslot = psstrm->SlotAt(islot); + if (pslot->m_islotTmpIn != pslot->m_islotTmpOut) + LogInTable(strmOut, pslot->m_islotTmpIn); + else + strmOut << ". "; + } + + strmOut << "\n"; + } + +LDone: + + delete[] prgfMods; +} + +/*---------------------------------------------------------------------------------------------- + Write out the final positions. +----------------------------------------------------------------------------------------------*/ +void GrTableManager::LogFinalPositions(std::ostream & strmOut) +{ + GrSlotStream * psstrm = OutputStream(m_cpass - 1); + + strmOut << "x position: "; + for (int islot = 0; islot < psstrm->WritePos(); islot++) + { + GrSlotState * pslot = psstrm->SlotAt(islot); + if (pslot->IsLineBreak(LBGlyphID())) + { + strmOut << ". "; + continue; + } + LogInTable(strmOut, pslot->XPosition()); + } + strmOut << "\n"; + + strmOut << "y position: "; + for (int islot = 0; islot < psstrm->WritePos(); islot++) + { + GrSlotState * pslot = psstrm->SlotAt(islot); + if (pslot->IsLineBreak(LBGlyphID())) + { + strmOut << ". "; + continue; + } + LogInTable(strmOut, pslot->YPosition()); + } + strmOut << "\n"; +} +#endif // TRACING + +/*---------------------------------------------------------------------------------------------- + Write out the final underlying-to-surface associations. +----------------------------------------------------------------------------------------------*/ +#ifdef TRACING +void Segment::LogUnderlyingToSurface(GrTableManager * ptman, std::ostream & strmOut, + GrCharStream * pchstrm) +#else +void Segment::LogUnderlyingToSurface(GrTableManager *, std::ostream &, + GrCharStream *) +#endif +{ +#ifdef TRACING + strmOut << "\n\nUNDERLYING TO SURFACE MAPPINGS\n\n"; + + size_t cassocs = 0; + int fLigs = false; + int ichw; + for (ichw = 0; ichw < (m_ichwAssocsLim - m_ichwAssocsMin); ichw++) + { + if (m_prgpvisloutAssocs[ichw]) + cassocs = max(cassocs, m_prgpvisloutAssocs[ichw]->size()); + if (m_prgisloutLigature[ichw] != kNegInfinity) + fLigs = true; + } + +// ptman->LogSlotHeader(strmOut, m_ichwAssocsLim, SP_PER_SLOT, LEADING_SP, m_ichwAssocsMin); + ptman->LogUnderlyingHeader(strmOut, pchstrm->Min(), (pchstrm->Min() + m_ichwAssocsLim), + -m_ichwAssocsMin, NULL); + + int rgnChars[MAX_SLOTS]; + bool rgfNewRun[MAX_SLOTS]; + std::fill_n(rgfNewRun, MAX_SLOTS, false); + GrFeatureValues rgfval[MAX_SLOTS]; + int cchwMaxRawChars; + + int cchw = pchstrm->GetLogData(ptman, rgnChars, rgfNewRun, rgfval, + -m_ichwAssocsMin, &cchwMaxRawChars); + cchw = min(cchw, MAX_SLOTS); + + utf16 rgchwChars2[MAX_SLOTS]; + utf16 rgchwChars3[MAX_SLOTS]; + utf16 rgchwChars4[MAX_SLOTS]; + utf16 rgchwChars5[MAX_SLOTS]; + utf16 rgchwChars6[MAX_SLOTS]; + int rgcchwRaw[MAX_SLOTS]; + if (cchwMaxRawChars > 1) + { + cchwMaxRawChars = min(cchwMaxRawChars, 6); + pchstrm->GetLogDataRaw(ptman, cchw, -m_ichwAssocsMin, cchwMaxRawChars, + rgnChars, rgchwChars2, rgchwChars3, rgchwChars4, rgchwChars5, rgchwChars6, + rgcchwRaw); + } + else + { + for (ichw = 0 ; ichw <(m_ichwAssocsLim - m_ichwAssocsMin); ichw++) + { + rgcchwRaw[ichw] = 1; + rgchwChars2[ichw] = 0; + rgchwChars3[ichw] = 0; + rgchwChars4[ichw] = 0; + rgchwChars5[ichw] = 0; + rgchwChars6[ichw] = 0; + } + } + + // Text + strmOut << "Text: "; // 15 spaces + int inUtf32 = 0; + for (ichw = 0; ichw < (m_ichwAssocsLim - m_ichwAssocsMin); ichw++) + { + utf16 chw, chwNext; + switch (rgcchwRaw[ichw]) + { + default: + case 1: chw = utf16(rgnChars[inUtf32]); chwNext = rgchwChars2[inUtf32]; break; + case 2: chw = rgchwChars2[inUtf32]; chwNext = rgchwChars3[inUtf32]; break; + case 3: chw = rgchwChars3[inUtf32]; chwNext = rgchwChars4[inUtf32]; break; + case 4: chw = rgchwChars4[inUtf32]; chwNext = rgchwChars5[inUtf32]; break; + case 5: chw = rgchwChars5[inUtf32]; chwNext = rgchwChars6[inUtf32]; break; + case 6: chw = rgchwChars6[inUtf32]; chwNext = 0; break; + } + if (rgcchwRaw[ichw] == 1 && chwNext == 0 && chw < 0x0100) // ANSI + strmOut << (char)chw << " "; // 6 spaces + else + strmOut << ". "; // 7 spaces + if (chwNext == 0) + inUtf32++; + } + strmOut << "\n"; + + // Unicode + strmOut << "Unicode: "; + inUtf32 = 0; + for (ichw = 0; ichw < (m_ichwAssocsLim - m_ichwAssocsMin); ichw++) + { + utf16 chw, chwNext; + switch (rgcchwRaw[ichw]) + { + default: + case 1: chw = utf16(rgnChars[inUtf32]); chwNext = rgchwChars2[inUtf32]; break; + case 2: chw = rgchwChars2[inUtf32]; chwNext = rgchwChars3[inUtf32]; break; + case 3: chw = rgchwChars3[inUtf32]; chwNext = rgchwChars4[inUtf32]; break; + case 4: chw = rgchwChars4[inUtf32]; chwNext = rgchwChars5[inUtf32]; break; + case 5: chw = rgchwChars5[inUtf32]; chwNext = rgchwChars6[inUtf32]; break; + case 6: chw = rgchwChars6[inUtf32]; chwNext = 0; break; + } + ptman->LogHexInTable(strmOut, chw, chwNext != 0); + if (chwNext == 0) + inUtf32++; + } + strmOut << "\n"; + + strmOut << "before "; + for (ichw = 0; ichw < (m_ichwAssocsLim - m_ichwAssocsMin); ichw++) + { + if (rgcchwRaw[ichw] > 1) + // continuation of Unicode codepoint + strmOut << ". "; + else if (m_prgisloutBefore[ichw] == kNegInfinity) + strmOut << "<-- "; + else if (m_prgisloutBefore[ichw] == kPosInfinity) + strmOut << "--> "; + else + ptman->LogInTable(strmOut, m_prgisloutBefore[ichw]); + } + strmOut <<"\n"; + + for (int ix = 1; ix < signed(cassocs) - 1; ix++) //(cassocs > 2) + { + if (ix == 1) + strmOut << "other "; + else + strmOut << " "; + for (ichw = 0; ichw < (m_ichwAssocsLim - m_ichwAssocsMin); ichw++) + { + std::vector * pvislout = m_prgpvisloutAssocs[ichw]; + if (pvislout == NULL) + strmOut << ". "; + else if (signed(pvislout->size()) <= ix) + strmOut << ". "; + else if ((*pvislout)[ix] != m_prgisloutAfter[ichw]) + ptman->LogInTable(strmOut, (*pvislout)[ix]); + else + strmOut << ". "; + } + strmOut << "\n"; + } + + strmOut << "after "; + for (ichw = 0; ichw < (m_ichwAssocsLim - m_ichwAssocsMin); ichw++) + { + if (rgcchwRaw[ichw] > 1) + // continuation of Unicode codepoint + strmOut << ". "; + else if (m_prgisloutAfter[ichw] == kNegInfinity) + strmOut << "<-- "; + else if (m_prgisloutAfter[ichw] == kPosInfinity) + strmOut << "--> "; + else + ptman->LogInTable(strmOut, m_prgisloutAfter[ichw]); + } + strmOut <<"\n"; + + if (fLigs) + { + strmOut << "ligature "; + for (ichw = 0; ichw < (m_ichwAssocsLim - m_ichwAssocsMin); ichw++) + { + if (rgcchwRaw[ichw] > 1) + // continuation of Unicode codepoint + strmOut << ". "; + else if (m_prgisloutLigature[ichw] != kNegInfinity) + ptman->LogInTable(strmOut, m_prgisloutLigature[ichw]); + else + strmOut << ". "; + } + strmOut << "\n"; + + strmOut << "component "; + for (ichw = 0; ichw < (m_ichwAssocsLim - m_ichwAssocsMin); ichw++) + { + if (rgcchwRaw[ichw] > 1) + // continuation of Unicode codepoint + strmOut << ". "; + else if (m_prgisloutLigature[ichw] != kNegInfinity) + ptman->LogInTable(strmOut, m_prgiComponent[ichw] + 1); // 1-based + else + strmOut << ". "; + } + strmOut << "\n"; + } + + strmOut << "\n"; +#endif +} + +/*---------------------------------------------------------------------------------------------- + Write out the final surface-to-underlying associations. +----------------------------------------------------------------------------------------------*/ +#ifdef TRACING +void Segment::LogSurfaceToUnderlying(GrTableManager * ptman, std::ostream & strmOut) +#else +void Segment::LogSurfaceToUnderlying(GrTableManager *, std::ostream &) +#endif +{ +#ifdef TRACING + strmOut << "\nSURFACE TO UNDERLYING MAPPINGS\n\n"; + + ptman->LogSlotHeader(strmOut, m_cslout, SP_PER_SLOT, LEADING_SP); + + int ccomp = 0; + + strmOut << "Glyph IDs: "; + int islout; + for (islout = 0; islout < m_cslout; islout++) + { + GrSlotOutput * psloutTmp = m_prgslout + islout; + if (psloutTmp->SpecialSlotFlag() == kspslLbInitial || + psloutTmp->SpecialSlotFlag() == kspslLbFinal) + { + strmOut << "# "; + } + else + { + ptman->LogHexInTable(strmOut, psloutTmp->GlyphID()); + ccomp = max(ccomp, psloutTmp->NumberOfComponents()); + } + } + strmOut << "\n"; + + bool fAnyPseudos = false; + for (islout = 0; islout < m_cslout; islout++) + { + GrSlotOutput * psloutTmp = m_prgslout + islout; + if (psloutTmp->GlyphID() != psloutTmp->ActualGlyphForOutput(ptman)) + { + fAnyPseudos = true; + break; + } + } + if (fAnyPseudos) + { + strmOut << "Actual glyphs: "; + for (islout = 0; islout < m_cslout; islout++) + { + GrSlotOutput * psloutTmp = m_prgslout + islout; + if (psloutTmp->GlyphID() != psloutTmp->ActualGlyphForOutput(ptman)) + ptman->LogHexInTable(strmOut, psloutTmp->ActualGlyphForOutput(ptman)); + else + strmOut << ". "; + } + strmOut << "\n"; + } + + strmOut << "before "; + for (islout = 0; islout < m_cslout; islout++) + { + GrSlotOutput * psloutTmp = m_prgslout + islout; + if (psloutTmp->SpecialSlotFlag() == kspslLbInitial || + psloutTmp->SpecialSlotFlag() == kspslLbFinal) + { + strmOut << ". "; + } + else + ptman->LogInTable(strmOut, psloutTmp->BeforeAssoc()); + } + strmOut << "\n"; + + strmOut << "after "; + for (islout = 0; islout < m_cslout; islout++) + { + GrSlotOutput * psloutTmp = m_prgslout + islout; + if (psloutTmp->SpecialSlotFlag() == kspslLbInitial || + psloutTmp->SpecialSlotFlag() == kspslLbFinal) + { + strmOut << ". "; + } + else + ptman->LogInTable(strmOut, psloutTmp->AfterAssoc()); + } + strmOut << "\n"; + + for (int icomp = 0; icomp < ccomp; icomp++) + { + strmOut << "component " << icomp + 1 // 1=based + << " "; + for (islout = 0; islout < m_cslout; islout++) + { + GrSlotOutput * psloutTmp = m_prgslout + islout; + if (psloutTmp->SpecialSlotFlag() == kspslLbInitial || + psloutTmp->SpecialSlotFlag() == kspslLbFinal) + { + strmOut << ". "; + } + else if (icomp < psloutTmp->NumberOfComponents()) + { + if (psloutTmp->FirstUnderlyingComponent(icomp) + != psloutTmp->LastUnderlyingComponent(icomp)) // $$$$$ + { + // Multiple characters represented by this component. + char rgch[10]; + std::string strTmp; + sprintf(rgch, "%d", psloutTmp->FirstUnderlyingComponent(icomp)); + strTmp += rgch; + std::memset(rgch, 0, 10); + sprintf(rgch, "%d", psloutTmp->LastUnderlyingComponent(icomp)); + strTmp += "/"; + strTmp += rgch; + if (std::strlen(strTmp.c_str()) > SP_PER_SLOT-1) + strmOut << "****** "; + else + { + while (std::strlen(strTmp.c_str()) < SP_PER_SLOT) // pad with spaces + strTmp += " "; + strmOut << strTmp; + } + } + else + ptman->LogInTable(strmOut, psloutTmp->FirstUnderlyingComponent(icomp)); // $$$$$ + } + else + strmOut << ". "; + } + strmOut << "\n"; + } +#endif +} + +#ifdef TRACING +/*---------------------------------------------------------------------------------------------- + Write out the header lines for the underlying data. +----------------------------------------------------------------------------------------------*/ +void GrTableManager::LogUnderlyingHeader(std::ostream & strmOut, int iMin, + int iLim, int cBackup, int * prgichr) +{ + strmOut << "string "; + int i, iLabel; + int * pichr = prgichr; + for (i = iMin - cBackup, iLabel = i; i < iLim; i++, iLabel++, pichr++) + { + while (prgichr && *pichr > 1) + { + // continuation of upper-plane char + iLabel++; + pichr++; + } + LogInTable(strmOut, iLabel); + } + strmOut << "\n"; + + strmOut << "segment "; + pichr = prgichr; + for (i = 0 - cBackup, iLabel = i; i < (iLim - iMin); i++, iLabel++, pichr++) + { + while (prgichr && *pichr > 1) + { + // continuation of upper-plane char + iLabel++; + pichr++; + } + LogInTable(strmOut, iLabel); + } + strmOut << "\n\n"; +} + +/*---------------------------------------------------------------------------------------------- + Write out the header lines for the slot contents. +----------------------------------------------------------------------------------------------*/ +void GrTableManager::LogSlotHeader(std::ostream & strmOut, int islotLim, + int /*cspPerSlot*/, int cspLeading, int islotMin) +{ + islotLim = min(islotLim, MAX_SLOTS); + + int isp, islot; + + for (isp = 0; isp < cspLeading; isp++) + strmOut << " "; + + for (islot = islotMin; islot < islotLim; islot++) + LogInTable(strmOut, islot); + strmOut << "\n\n"; + +/**** + if (cslot >= 100) + { + for (isp = 0; isp < cspLeading; isp++) + strmOut << " "; + + for (islot = 0; islot < 100; islot++) + { + for (isp = 0; isp < cspPerSlot; isp++) + strmOut << " "; + } + + for (islot = 100; islot < cslot; islot++) + { + strmOut << "1"; + for (isp = 1; isp < cspPerSlot; isp++) + strmOut << " "; + } + } + + if (cslot > 10) + { + for (isp = 0; isp < cspLeading; isp++) + strmOut << " "; + + for (islot = 0; islot < 10; islot++) + { + for (isp = 0; isp < cspPerSlot; isp++) + strmOut << " "; + } + + for (islot = 10; islot < cslot; islot++) + { + if (true) // (islot % 10 == 0) + { + if (islot >= 100) + strmOut << ((islot - 100) / 10); + else + strmOut << (islot / 10); + } + else + strmOut << " "; + + for (isp = 1; isp < cspPerSlot; isp++) + strmOut << " "; + } + strmOut << "\n"; + } + + for (isp = 0; isp < cspLeading; isp++) + strmOut << " "; + + for (islot = 0; islot < cslot; islot++) + { + strmOut << (islot % 10); + for (isp = 1; isp < cspPerSlot; isp++) + strmOut << " "; + + } + strmOut << "\n"; +****/ +} + +/*---------------------------------------------------------------------------------------------- + Write out the glyph numbers for the given stream. +----------------------------------------------------------------------------------------------*/ +void GrTableManager::LogSlotGlyphs(std::ostream & strmOut, GrSlotStream * psstrm) +{ + strmOut << "Glyph IDs: "; + int islot; + for (islot = 0; islot < psstrm->WritePos(); islot++) + { + GrSlotState * pslotTmp = psstrm->SlotAt(islot); + if (pslotTmp->IsLineBreak(LBGlyphID())) + strmOut << "# "; + else + LogHexInTable(strmOut, pslotTmp->GlyphID()); + } + strmOut << "\n"; +} + +/*---------------------------------------------------------------------------------------------- + Return flags indicating which attributes were modified for some slot during the pass + and therefore need a line in the log file. + + The 'pfMods' array has one flag per slot attribute; the final group are the user- + definable attributes. 'pccomp' returns the maximum number of ligature components + in this pass. Associations are assumed to have changed if anything else for the slot did. +----------------------------------------------------------------------------------------------*/ +void GrTableManager::SlotAttrsModified(int ipass, bool * rgfMods, bool fPreJust, + int * pccomp, int * pcassoc) +{ + // Zero the flags + std::fill_n(rgfMods, kslatMax + NumUserDefn() - 1, false); + *pccomp = 0; + *pcassoc = 0; + + //GrSlotStream * psstrmIn = InputStream(ipass); + GrSlotStream * psstrmOut = OutputStream(ipass); + + for (int islot = 0; islot < psstrmOut->WritePos(); islot++) + { + GrSlotState * pslot = psstrmOut->SlotAt(islot); + Assert(pslot->PassModified() <= ipass); + if (pslot->PassModified() < ipass && !fPreJust) + continue; // not modified during this pass + + pslot->SlotAttrsModified(rgfMods, fPreJust, pccomp, pcassoc); + } +} + +void GrSlotState::SlotAttrsModified(bool * rgfMods, bool fPreJust, int * pccomp, int * pcassoc) +{ + // To handle reprocessing, in which case there may be a chain of slots modified + // in the same pass: + GrSlotState * pslotPrev = m_pslotPrevState; + while (pslotPrev && pslotPrev->PassModified() == PassModified()) + pslotPrev = pslotPrev->m_pslotPrevState; + + if (!pslotPrev) + { + // Inserted slot? + if (m_fAdvXSet) + rgfMods[kslatAdvX] = true; + if (m_fAdvYSet) + rgfMods[kslatAdvY] = true; + + if (m_srAttachTo != 0) + rgfMods[kslatAttTo] = true; + + if (m_mAttachAtX != kNotYetSet || m_mAttachAtY != 0) + { // always do these in pairs + rgfMods[kslatAttAtX] = true; + rgfMods[kslatAttAtY] = true; + } + if (m_nAttachAtGpoint != kNotYetSet) + rgfMods[kslatAttAtGpt] = true; + if (m_mAttachAtXOffset != 0 || m_mAttachAtYOffset != 0) + { // always do these in pairs + rgfMods[kslatAttAtXoff] = true; + rgfMods[kslatAttAtYoff] = true; + } + + if (m_mAttachWithX != kNotYetSet || m_mAttachWithY != 0) + { // always do these in pairs + rgfMods[kslatAttWithX] = true; + rgfMods[kslatAttWithY] = true; + } + if (m_nAttachWithGpoint != kNotYetSet) + rgfMods[kslatAttWithGpt] = true; + if (m_mAttachWithXOffset != 0 || m_mAttachWithYOffset != 0) + { // always do these in pairs + rgfMods[kslatAttWithXoff] = true; + rgfMods[kslatAttWithYoff] = true; + } + + if (m_nAttachLevel != 0) + rgfMods[kslatAttLevel] = true; + + if (m_lb != kNotYetSet8) + rgfMods[kslatBreak] = true; + if (m_dirc != kNotYetSet8) + rgfMods[kslatDir] = true; + if (m_fInsertBefore != true) + rgfMods[kslatInsert] = true; + + if (m_mMeasureSol != kNotYetSet && m_mMeasureSol != 0) + rgfMods[kslatMeasureSol] = true; + if (m_mMeasureEol != kNotYetSet && m_mMeasureEol != 0) + rgfMods[kslatMeasureEol] = true; + + if (m_mJStretch0 != kNotYetSet && m_mJStretch0 != 0) + rgfMods[kslatJStretch] = true; + if (m_mJShrink0 != kNotYetSet && m_mJShrink0 != 0) + rgfMods[kslatJShrink] = true; + if (m_mJStep0 != kNotYetSet && m_mJStep0 != 0) + rgfMods[kslatJStep] = true; + if (m_nJWeight0 != 0 && m_nJWeight0 != 1) + rgfMods[kslatJWeight] = true; + if (m_mJWidth0 != kNotYetSet && m_mJWidth0 != 0) + rgfMods[kslatJWidth] = true; + + if (m_mShiftX != 0) + rgfMods[kslatShiftX] = true; + if (m_mShiftY != 0) + rgfMods[kslatShiftY] = true; + + int i; + for (i = 0; i < m_cnCompPerLig; i++) + { + if (CompRef(i) != NULL) + rgfMods[kslatCompRef] = true; + if (CompRef(i)) + *pccomp = max(*pccomp, i + 1); // max number of ligatures in this pass + } + + for (i = 0; i < m_cnUserDefn; i++) + { + if (UserDefn(i) != 0) + rgfMods[kslatUserDefn + i] = true; + } + } + else + { + if (m_fAdvXSet && m_mAdvanceX != pslotPrev->m_mAdvanceX) + rgfMods[kslatAdvX] = true; + if (m_fAdvYSet && m_mAdvanceY != pslotPrev->m_mAdvanceY) + rgfMods[kslatAdvY] = true; + + if (m_srAttachTo != pslotPrev->m_srAttachTo) + rgfMods[kslatAttTo] = true; + + if (m_mAttachAtX != pslotPrev->m_mAttachAtX || m_mAttachAtY != pslotPrev->m_mAttachAtY) + { + rgfMods[kslatAttAtX] = true; + rgfMods[kslatAttAtY] = true; + } + if (m_nAttachAtGpoint != pslotPrev->m_nAttachAtGpoint) + rgfMods[kslatAttAtGpt] = true; + if (m_mAttachAtXOffset != pslotPrev->m_mAttachAtXOffset || + m_mAttachAtYOffset != pslotPrev->m_mAttachAtYOffset) + { + rgfMods[kslatAttAtXoff] = true; + rgfMods[kslatAttAtYoff] = true; + } + + if (m_mAttachWithX != pslotPrev->m_mAttachWithX || + m_mAttachWithY != pslotPrev->m_mAttachWithY) + { + rgfMods[kslatAttWithX] = true; + rgfMods[kslatAttWithY] = true; + } + if (m_nAttachWithGpoint != pslotPrev->m_nAttachWithGpoint) + rgfMods[kslatAttWithGpt] = true; + if (m_mAttachWithXOffset != pslotPrev->m_mAttachWithXOffset || + m_mAttachWithYOffset != pslotPrev->m_mAttachWithYOffset) + { + rgfMods[kslatAttWithXoff] = true; + rgfMods[kslatAttWithYoff] = true; + } + + if (m_nAttachLevel != pslotPrev->m_nAttachLevel) + rgfMods[kslatAttLevel] = true; + + if (m_lb != pslotPrev->m_lb) + rgfMods[kslatBreak] = true; + if (m_dirc != pslotPrev->m_dirc) + rgfMods[kslatDir] = true; + if (m_fInsertBefore != pslotPrev->m_fInsertBefore) + rgfMods[kslatInsert] = true; + + if (m_mMeasureSol != pslotPrev->m_mMeasureSol) + rgfMods[kslatMeasureSol] = true; + if (m_mMeasureEol != pslotPrev->m_mMeasureEol) + rgfMods[kslatMeasureEol] = true; + + if (m_mJStretch0 != pslotPrev->m_mJStretch0 || (fPreJust && m_mJStretch0 != 0)) + rgfMods[kslatJStretch] = true; + if (m_mJShrink0 != pslotPrev->m_mJShrink0 || (fPreJust && m_mJShrink0 != 0)) + rgfMods[kslatJShrink] = true; + if (m_mJStep0 != pslotPrev->m_mJStep0 || (fPreJust && m_mJStep0 != 0)) + rgfMods[kslatJStep] = true; + if (m_nJWeight0 != pslotPrev->m_nJWeight0 || (fPreJust && m_nJWeight0 != 0)) + rgfMods[kslatJWeight] = true; + if (m_mJWidth0 != pslotPrev->m_mJWidth0) + rgfMods[kslatJWidth] = true; + + if (m_mShiftX != pslotPrev->m_mShiftX) + rgfMods[kslatShiftX] = true; + if (m_mShiftY != pslotPrev->m_mShiftY) + rgfMods[kslatShiftY] = true; + + int i; + for (i = 0; i < m_cnCompPerLig; i++) + { + if (CompRef(i) != pslotPrev->CompRef(i)) + rgfMods[kslatCompRef] = true; + if (CompRef(i)) + *pccomp = max(*pccomp, i + 1); // max number of ligatures in this pass + } + + for (i = 0; i < m_cnUserDefn; i++) + { + if (UserDefn(i) != pslotPrev->UserDefn(i)) + rgfMods[kslatUserDefn + i] = true; + } + } + + *pcassoc = max(*pcassoc, AssocsSize()); +} + +/*---------------------------------------------------------------------------------------------- + Log the value of the slot attribute for the given slot, if it changed. +----------------------------------------------------------------------------------------------*/ +void GrSlotState::LogSlotAttribute(GrTableManager * ptman, + std::ostream & strmOut, int ipass, int slat, int iIndex, + bool fPreJust, bool fPostJust) +{ + if (m_ipassModified != ipass && !fPreJust && !fPostJust) + { + strmOut << ". "; + return; + } + + // To handle reprocessing, in which case there may be a chain of slots modified + // in the same pass: + GrSlotState * pslotPrev = m_pslotPrevState; + while (pslotPrev && pslotPrev->PassModified() == PassModified()) + pslotPrev = pslotPrev->m_pslotPrevState; + + // General-purpose variables for em-unit attributes: + int mThis = 0; + int mPrev = 0; + switch (slat) + { + case kslatShiftX: + mThis = m_mShiftX; + mPrev = (pslotPrev) ? pslotPrev->m_mShiftX : 0; + break; + case kslatShiftY: + mThis = m_mShiftY; + mPrev = (pslotPrev) ? pslotPrev->m_mShiftY : 0; + break; + case kslatMeasureSol: + mThis = m_mMeasureSol; + mPrev = (pslotPrev) ? pslotPrev->m_mMeasureSol : 0; + break; + case kslatMeasureEol: + mThis = m_mMeasureEol; + mPrev = (pslotPrev) ? pslotPrev->m_mMeasureEol : 0; + break; + case kslatJStretch: + mThis = m_mJStretch0; + mPrev = (pslotPrev) ? pslotPrev->m_mJStretch0 : 0; + mPrev = (fPreJust && mThis > 0) ? -1 : mPrev; // log it even if it didn't change + break; + case kslatJShrink: + mThis = m_mJShrink0; + mPrev = (pslotPrev) ? pslotPrev->m_mJShrink0 : 0; + mPrev = (fPreJust && mThis > 0) ? -1 : mPrev; // log it even if it didn't change + break; + case kslatJStep: + mThis = m_mJStep0; + mPrev = (pslotPrev) ? pslotPrev->m_mJStep0 : 0; + mPrev = (fPreJust && mThis > 1) ? -1 : mPrev; // log it even if it didn't change + break; + case kslatJWeight: + mThis = m_nJWeight0; + mPrev = (pslotPrev) ? pslotPrev->m_nJWeight0 : 0; + mPrev = (fPreJust && mThis > 1) ? -1 : mPrev; // log it even if it didn't change + break; + case kslatJWidth: + mThis = m_mJWidth0; + mPrev = (pslotPrev) ? pslotPrev->m_mJWidth0 : 0; + mPrev = (fPostJust && mThis > 0) ? -1 : mPrev; // log it even if it didn't change + break; + default: + // don't use these variables + break; + } + + switch (slat) + { + case kslatAdvX: + if (m_fAdvXSet && (!pslotPrev || m_mAdvanceX != pslotPrev->m_mAdvanceX)) + { + ptman->LogInTable(strmOut, m_mAdvanceX); + return; + } + break; + case kslatAdvY: + if (m_fAdvYSet && (!pslotPrev || m_mAdvanceY != pslotPrev->m_mAdvanceY)) + { + ptman->LogInTable(strmOut, m_mAdvanceY); + return; + } + break; + + case kslatAttTo: + if (m_srAttachTo != (pslotPrev ? pslotPrev->m_srAttachTo : 0)) + { + ptman->LogInTable(strmOut, m_srAttachTo); + return; + } + break; + + case kslatAttAtX: // always do these in pairs + case kslatAttAtY: + if (m_mAttachAtX != (pslotPrev ? pslotPrev->m_mAttachAtX : static_cast(kNotYetSet)) || + m_mAttachAtY != (pslotPrev ? pslotPrev->m_mAttachAtY : 0)) + { + ptman->LogInTable(strmOut, + ((slat == kslatAttAtX) ? m_mAttachAtX : m_mAttachAtY)); + return; + } + break; + case kslatAttAtGpt: + if (m_nAttachAtGpoint != (pslotPrev ? pslotPrev->m_nAttachAtGpoint : static_cast(kNotYetSet))) + { + ptman->LogInTable(strmOut, + ((m_nAttachAtGpoint == kGpointZero) ? 0 : m_nAttachAtGpoint)); + return; + } + break; + case kslatAttAtXoff: // always do these in pairs + case kslatAttAtYoff: + if (m_mAttachAtXOffset != (pslotPrev ? pslotPrev->m_mAttachAtXOffset : 0) || + m_mAttachAtYOffset != (pslotPrev ? pslotPrev->m_mAttachAtYOffset : 0)) + { + ptman->LogInTable(strmOut, + ((slat == kslatAttAtXoff) ? m_mAttachAtXOffset : m_mAttachAtYOffset)); + return; + } + break; + + case kslatAttWithX: // always do these in pairs + case kslatAttWithY: + if (m_mAttachWithX != (pslotPrev ? pslotPrev->m_mAttachWithX : static_cast(kNotYetSet)) || + m_mAttachWithY != (pslotPrev ? pslotPrev->m_mAttachWithY : 0)) + { + ptman->LogInTable(strmOut, + ((slat == kslatAttWithX) ? m_mAttachWithX : m_mAttachWithY)); + return; + } + break; + case kslatAttWithGpt: + if (m_nAttachWithGpoint != (pslotPrev ? pslotPrev->m_nAttachWithGpoint : static_cast(kNotYetSet))) + { + ptman->LogInTable(strmOut, + ((m_nAttachWithGpoint == kGpointZero) ? 0 : m_nAttachWithGpoint)); + return; + } + break; + case kslatAttWithXoff: // always do these in pairs + case kslatAttWithYoff: + if (m_mAttachWithXOffset != (pslotPrev ? pslotPrev->m_mAttachWithXOffset : 0) || + m_mAttachWithYOffset != (pslotPrev ? pslotPrev->m_mAttachWithYOffset : 0)) + { + ptman->LogInTable(strmOut, + ((slat == kslatAttWithXoff) ? m_mAttachWithXOffset : m_mAttachWithYOffset)); + return; + } + break; + + case kslatAttLevel: + if (m_nAttachLevel != (pslotPrev ? pslotPrev->m_nAttachLevel : 0)) + { + ptman->LogInTable(strmOut, m_nAttachLevel); + return; + } + break; + + case kslatBreak: + if (m_lb != (pslotPrev ? pslotPrev->m_lb : static_cast(kNotYetSet8))) + { + ptman->LogBreakWeightInTable(strmOut, m_lb); + return; + } + break; + case kslatDir: + if (m_dirc != (pslotPrev ? pslotPrev->m_dirc : static_cast(kNotYetSet8))) + { + ptman->LogDirCodeInTable(strmOut, m_dirc); + return; + } + break; + case kslatInsert: + if (m_fInsertBefore != (pslotPrev ? pslotPrev->m_fInsertBefore : true)) + { + if (m_fInsertBefore) + strmOut << "true "; + else + strmOut << "false "; + return; + } + break; + + case kslatJWeight: + if (m_mJStretch0 == 0 && m_mJShrink0 == 0) + mPrev = mThis; // don't log; weight is irrelevant + // fall through + case kslatShiftX: + case kslatShiftY: + case kslatMeasureSol: + case kslatMeasureEol: + case kslatJStretch: + case kslatJShrink: + case kslatJStep: + case kslatJWidth: + if (mThis != mPrev) + { + ptman->LogInTable(strmOut, mThis); + return; + } + break; + + case kslatCompRef: + if (CompRef(iIndex) != (pslotPrev ? pslotPrev->CompRef(iIndex) : 0)) + { + GrSlotState * pslotComp = reinterpret_cast(CompRef(iIndex)); + ptman->LogInTable(strmOut, pslotComp->m_islotTmpIn); + return; + } + break; + + default: + if (kslatUserDefn <= slat && slat <= kslatUserDefn + m_cnUserDefn) + { + int iTmp = slat - kslatUserDefn; + if (UserDefn(iTmp) != (pslotPrev ? pslotPrev->UserDefn(iTmp) : 0)) + { + ptman->LogInTable(strmOut, UserDefn(iTmp)); + return; + } + } + else + gAssert(false); + } + + strmOut << ". "; +} + +/*---------------------------------------------------------------------------------------------- + Log the value of the association, if the slot changed. +----------------------------------------------------------------------------------------------*/ +void GrSlotState::LogAssociation(GrTableManager * ptman, + std::ostream & strmOut, int ipass, int iassoc, bool fBoth, bool fAfter) +{ + if (m_ipassModified != ipass) + { + strmOut << ". "; + return; + } + + if (fBoth) + { + GrSlotState * pslotBefore = (m_vpslotAssoc.size()) ? m_vpslotAssoc[0] : NULL; + GrSlotState * pslotAfter = (m_vpslotAssoc.size()) ? m_vpslotAssoc.back() : NULL; + // handle possible reprocessing + while (pslotBefore && pslotBefore->PassModified() == m_ipassModified) + pslotBefore = pslotBefore->m_pslotPrevState; + while (pslotAfter && pslotAfter->PassModified() == m_ipassModified) + pslotAfter = pslotAfter->m_pslotPrevState; + + int nBefore, nAfter; + + + int csp = 4; + if (pslotBefore) + { + nBefore = pslotBefore->m_islotTmpIn; + strmOut << nBefore; + if (nBefore > 99) csp--; + if (nBefore > 9) csp--; + } + else + { + strmOut << "??"; + csp--; + } + if (pslotAfter) + { + nAfter = pslotAfter->m_islotTmpIn; + strmOut << "/" << nAfter; + if (nAfter > 99) csp--; + if (nAfter > 9) csp--; + } + else + { + if (pslotBefore) + { + strmOut << "/" << "??"; + csp--; + } + else + csp = 5; + } + + for (int isp = 0; isp < csp; isp++) + strmOut << " "; + } + + else if (fAfter) + { + Assert(m_vpslotAssoc.size()); + GrSlotState * pslotAfter = m_vpslotAssoc.back(); + // handle possible reprocessing + while (pslotAfter && pslotAfter->PassModified() == m_ipassModified) + pslotAfter = pslotAfter->m_pslotPrevState; + + if (pslotAfter) + { + int nAfter = pslotAfter->m_islotTmpIn; + ptman->LogInTable(strmOut, nAfter); + } + else + strmOut << "?? "; + } + else if (iassoc < signed(m_vpslotAssoc.size())) + { + GrSlotState * pslot = m_vpslotAssoc[iassoc]; + // handle possible reprocessing + while (pslot && pslot->PassModified() == m_ipassModified) + pslot = pslot->m_pslotPrevState; + + if (pslot) + { + int n = pslot->m_islotTmpIn; + ptman->LogInTable(strmOut, n); + } + else + strmOut << "?? "; + } + else + strmOut << ". "; +} + +/*---------------------------------------------------------------------------------------------- + Write a hex value (a glyphID or Unicode codepoint) into the table. +----------------------------------------------------------------------------------------------*/ +void GrTableManager::LogInTable(std::ostream & strmOut, int n) +{ + if (n == kNegInfinity) + { + strmOut << "-inf "; + return; + } + if (n == kPosInfinity) + { + strmOut << "+inf "; + return; + } + if (n > 999999) + { + strmOut << "****** "; + return; + } + if (n < -99999) + { + strmOut << "-***** "; + return; + } + + strmOut << n; + int csp = SP_PER_SLOT - 1; + + if (abs(n) > 99999) csp--; + if (abs(n) > 9999) csp--; + if (abs(n) > 999) csp--; + if (abs(n) > 99) csp--; + if (abs(n) > 9) csp--; + + if (n < 0) csp--; + + for (int isp = 0; isp < csp; isp++) + strmOut << " "; +} + +void GrTableManager::LogInTable(std::ostream & strmOut, float n) +{ + if (n == kNegInfFloat) + { + strmOut << "-inf "; + return; + } + if (n == kPosInfFloat) + { + strmOut << "+inf "; + return; + } + if (n > 9999) + { + strmOut << "****.* "; + return; + } + if (n < -999) + { + strmOut << "-***.* "; + return; + } + + int csp = SP_PER_SLOT - 4; + + int nInt = (int)(fabsf(n)); + int nTenths = (int)fabsf((fabsf(n) - float(nInt) + 0.05f) * 10); + if (nTenths >= 10) + { + nTenths = 0; + nInt++; + } + + if (nInt >= 1000) csp--; + if (nInt >= 100) csp--; + if (nInt >= 10) csp--; + + if (n < 0) csp--; + + for (int isp = 0; isp < csp; isp++) + strmOut << " "; + if (n < 0) + strmOut << "-"; + strmOut << nInt << "." << nTenths << " "; +} + +/*---------------------------------------------------------------------------------------------- + Write a hex value (a glyphID or Unicode codepoint) into the table. +----------------------------------------------------------------------------------------------*/ +void GrTableManager::LogHexInTable(std::ostream & strmOut, utf16 chw, bool fPlus) +{ + //char rgch[20]; + if (chw <= 0x0fff) strmOut << "0"; + if (chw <= 0x00ff) strmOut << "0"; + if (chw <= 0x000f) strmOut << "0"; + + strmOut << std::hex << chw << std::dec; + + for (int i = 4; i < SP_PER_SLOT - 2; i++) + strmOut << " "; + + if (fPlus) + strmOut << "+ "; + else + strmOut << " "; +} + +/*---------------------------------------------------------------------------------------------- + Write a directionality code to the table. +----------------------------------------------------------------------------------------------*/ +void GrTableManager::LogDirCodeInTable(std::ostream & strmOut, int dirc) +{ + switch (dirc) + { + case kdircUnknown: strmOut << "??? "; break; + case kdircNeutral: strmOut << "ON "; break; + case kdircL: strmOut << "L "; break; + case kdircR: strmOut << "R "; break; + case kdircRArab: strmOut << "AR "; break; + case kdircEuroNum: strmOut << "EN "; break; + case kdircEuroSep: strmOut << "ES "; break; + case kdircEuroTerm: strmOut << "ET "; break; + case kdircArabNum: strmOut << "AN "; break; + case kdircComSep: strmOut << "CS "; break; + case kdircWhiteSpace: strmOut << "WS "; break; + case kdircBndNeutral: strmOut << "BN "; break; + case kdircNSM: strmOut << "NSM "; break; + case kdircLRO: strmOut << "LRO "; break; + case kdircRLO: strmOut << "RLO "; break; + case kdircLRE: strmOut << "LRE "; break; + case kdircRLE: strmOut << "RLE "; break; + case kdircPDF: strmOut << "PDF "; break; + case kdircPdfL: strmOut << "PDF-L "; break; + case kdircPdfR: strmOut << "PDF-R "; break; + case kdircLlb: strmOut << "L "; break; + case kdircRlb: strmOut << "R "; break; + default: LogInTable(strmOut, dirc); break; + } +} + +/*---------------------------------------------------------------------------------------------- + Write a breakweight code to the table. +----------------------------------------------------------------------------------------------*/ +void GrTableManager::LogBreakWeightInTable(std::ostream & strmOut, int lb) +{ + if (lb < 0) + { + lb = lb * -1; + switch (lb) + { + case klbWsBreak: strmOut << "-ws "; break; + case klbWordBreak: strmOut << "-word "; break; + case klbHyphenBreak: strmOut << "-intra "; break; + case klbLetterBreak: strmOut << "-lettr "; break; + case klbClipBreak: strmOut << "-clip "; break; + default: LogInTable(strmOut, lb); break; + } + } + else + { + switch (lb) + { + case klbNoBreak: strmOut << "none "; break; + case klbWsBreak: strmOut << "ws "; break; + case klbWordBreak: strmOut << "word "; break; + case klbHyphenBreak: strmOut << "intra "; break; + case klbLetterBreak: strmOut << "letter "; break; + case klbClipBreak: strmOut << "clip "; break; + default: LogInTable(strmOut, lb); break; + } + } +} + +#endif // TRACING + +} // namespace gr diff --git a/Build/source/libs/graphite/engine-2.4/src/segment/resource.h b/Build/source/libs/graphite/engine-2.4/src/segment/resource.h new file mode 100644 index 00000000000..775418f76bf --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/src/segment/resource.h @@ -0,0 +1,15 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by Graphite.rc +// + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 101 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/Build/source/libs/graphite/engine-2.4/test/Makefile.am b/Build/source/libs/graphite/engine-2.4/test/Makefile.am new file mode 100644 index 00000000000..96570ad125a --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/test/Makefile.am @@ -0,0 +1,2 @@ +SUBDIRS = ProfileHarness RegressionTest +EXTRA_DIST = fonterrors diff --git a/Build/source/libs/graphite/engine-2.4/test/ProfileHarness/CMakeLists.txt b/Build/source/libs/graphite/engine-2.4/test/ProfileHarness/CMakeLists.txt new file mode 100644 index 00000000000..47f9c55df1b --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/test/ProfileHarness/CMakeLists.txt @@ -0,0 +1,8 @@ +project(profile-graphite) + +add_executable(profile-graphite + GrUtfTextSrc.cpp + ProfileHarness.cpp + ) + +target_link_libraries(profile-graphite graphite) diff --git a/Build/source/libs/graphite/engine-2.4/test/ProfileHarness/GrUtfTextSrc.cpp b/Build/source/libs/graphite/engine-2.4/test/ProfileHarness/GrUtfTextSrc.cpp new file mode 100644 index 00000000000..3b51db1ea9b --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/test/ProfileHarness/GrUtfTextSrc.cpp @@ -0,0 +1,310 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: NPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Netscape Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is sila.mozdev.org code. + * + * The Initial Developer of the Original Code is + * Keith Stribley. + * Portions created by the Initial Developer are Copyright (C) 2004 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the NPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the NPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "GrUtfTextSrc.h" + + + +GrUtfTextSrc::GrUtfTextSrc() +: mLength(0), + mBufferLength8(64), mBufferLength16(64), mBufferLength32(64), + mData8(NULL), mData16(NULL), mData32(NULL), + mType(gr::kutf16), + mForeground(gr::kclrBlack), mBackground(gr::kclrTransparent), + mSelectForeground(0), mSelectBackground(0), + mIsSelected(false), + mFont(NULL), + mRtl(false) +{ + +} + +GrUtfTextSrc::~GrUtfTextSrc() +{ + if (mData8) delete [] mData8; + if (mData16) delete [] mData16; + if (mData32) delete [] mData32; + mSelectionVector.clear(); +} + +bool GrUtfTextSrc::setText(const char * pszText, int len) +{ + return setText((gr::utf8*)pszText, len); +} + +bool GrUtfTextSrc::setText(const gr::utf8 * pszText, int len) +{ + mType = gr::kutf8; + mLength = len; + if (!checkBuffer8()) return false; + + for(size_t i = 0; i < mLength; i++) + { + mData8[i] = pszText[i]; + // stray line feeds and other control characters from the html file + // cause artificial truncation of segments + if (mData8[i] < 0x0020)//(pszText[i] == '\n' || pszText[i] == '\r') + mData8[i] = 0x20; // ZWSP + } + mData8[mLength] = '\0'; // zero-terminate + mSelectionVector.clear(); + mIsSelected = false; + return true; +} + + +bool GrUtfTextSrc::setText(const gr::utf16 * pszText, int len) +{ + mType = gr::kutf16; + mLength = len; + if (!checkBuffer16()) return false; + + for(size_t i = 0; i < mLength; i++) + { + mData16[i] = pszText[i]; + // stray line feeds and other control characters from the html file + // cause artificial truncation of segments + if (mData16[i] < 0x0020)//(pszText[i] == '\n' || pszText[i] == '\r') + mData16[i] = 0x200B; // ZWSP + } + mData16[mLength] = '\0'; // zero-terminate + mSelectionVector.clear(); + mIsSelected = false; + return true; +} + +bool GrUtfTextSrc::setText(const gr::utf32 * pszText, int len) +{ + mType = gr::kutf32; + mLength = len; + if (!checkBuffer32()) return false; + + for(size_t i = 0; i < mLength; i++) + { + mData32[i] = pszText[i]; + } + mData32[mLength] = '\0'; // zero-terminate + mSelectionVector.clear(); + mIsSelected = false; + return true; +} + +bool GrUtfTextSrc::checkBuffer8(void) +{ + if (!mData8 || mBufferLength8 < mLength + 1) + { + do + { + mBufferLength8 *= 2; + } while (mBufferLength8 < mLength + 1); + if (mData8) delete [] mData8; + mData8 = new gr::utf8[mBufferLength8]; + } + return (mData8) ? true : false; +} + +bool GrUtfTextSrc::checkBuffer16(void) +{ + if (!mData16 || mBufferLength16 < mLength + 1) + { + do + { + mBufferLength16 *= 2; + } while (mBufferLength16 < mLength + 1); + if (mData16) delete [] mData16; + mData16 = new gr::utf16[mBufferLength16]; + } + return (mData16) ? true : false; +} + +bool GrUtfTextSrc::checkBuffer32(void) +{ + if (!mData32 || mBufferLength32 < mLength + 1) + { + do + { + mBufferLength32 *= 2; + } while (mBufferLength32 < mLength + 1); + if (mData32) delete [] mData32; + mData32 = new gr::utf32[mBufferLength32]; + } + return (mData32) ? true : false; +} + +size_t GrUtfTextSrc::fetch(gr::toffset ichMin, size_t cch, gr::utf8 * prgchwBuffer) +{ + assert(cch <= mLength); + if (cch > mLength) + { + return 0; + } + std::copy(mData8 + ichMin, mData8 + ichMin + cch, prgchwBuffer); + return (cch - ichMin); +} + +size_t GrUtfTextSrc::fetch(gr::toffset ichMin, size_t cch, gr::utf16 * prgchwBuffer) +{ + assert(cch <= mLength); + if (cch > mLength) + { + return 0; + } + std::copy(mData16 + ichMin, mData16 + ichMin + cch, prgchwBuffer); + return (cch - ichMin); +} + +size_t GrUtfTextSrc::fetch(gr::toffset ichMin, size_t cch, gr::utf32 * prgchwBuffer) +{ + assert(cch <= mLength); + if (cch > mLength) + { + return 0; + } + std::copy(mData32 + ichMin, mData32 + ichMin + cch, prgchwBuffer); + return (cch - ichMin); +} + + +bool GrUtfTextSrc::getRightToLeft(gr::toffset /*ich*/) +{ + return mRtl; // assumes src only contains one direction +} + +unsigned int GrUtfTextSrc::getDirectionDepth(gr::toffset /*ich*/) +{ + return (mRtl) ? 1 : 0; // TBD +} + +std::pair GrUtfTextSrc::propertyRange(gr::toffset ich) +{ + std::pair range(0, mLength); + if (mIsSelected) + { + bool selectState = mSelectionVector[ich]; + // find start + int s = ich - 1; + int e = ich + 1; + if (s > -1) + for ( ; s >= 0; s--) + { + if (mSelectionVector[s] != selectState) + { + s++; // backup + break; + } + } + if (s < 0) s = 0; + // find end + for ( ; e < static_cast(mLength); e++) + { + if (mSelectionVector[e] != selectState) + { + // don't need to backup for end + break; + } + } + range.first = s; + range.second = e; + } + return range; +} + +size_t GrUtfTextSrc::getFontFeatures(gr::toffset /*ich*/, gr::FeatureSetting * /*prgfset*/) +{ + return 0; +} + +void GrUtfTextSrc::getColors(gr::toffset ich, int * pclrFore, int * pclrBack) +{ + // selections are handled here + if (mIsSelected && mSelectionVector[ich]) + { + *pclrFore = mSelectForeground; + *pclrBack = mSelectBackground; + } + else + { + *pclrFore = mForeground; + *pclrBack = mBackground; + } +} + + +// these should be called I hope +float +GrUtfTextSrc::getFontSize(gr::toffset /*ich*/) +{ + assert(mFont); + return mPointSize; +} + +bool +GrUtfTextSrc::getBold(gr::toffset /*ich*/) +{ + assert(mFont); +// NS_ASSERTION(false, "unexpected call to getBold"); +// return false; + return mFont->bold(); +} + +bool +GrUtfTextSrc::getItalic(gr::toffset /*ich*/) +{ + assert(mFont); + //NS_ASSERTION(false, "unexpected call to getItalic"); + //return false; + return mFont->italic(); +} + +gr::isocode GrUtfTextSrc::getLanguage(gr::toffset /*ich*/) +{ + gr::isocode unknown; + std::fill_n(unknown.rgch, 4, '\0'); + return unknown; +} + diff --git a/Build/source/libs/graphite/engine-2.4/test/ProfileHarness/GrUtfTextSrc.h b/Build/source/libs/graphite/engine-2.4/test/ProfileHarness/GrUtfTextSrc.h new file mode 100644 index 00000000000..4acc413ee56 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/test/ProfileHarness/GrUtfTextSrc.h @@ -0,0 +1,147 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: NPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Netscape Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is sila.mozdev.org code. + * + * The Initial Developer of the Original Code is + * Keith Stribley. + * Portions created by the Initial Developer are Copyright (C) 2004 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the NPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the NPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ +#ifdef _MSC_VER +#pragma once +#endif +#ifndef GRUTFTXTSRC_INCLUDED +#define GRUTFTXTSRC_INCLUDED + +#include +#include + +#include +#include +#include + +class nsIGrSegWrapper; + +/*----------------------------------------------------------------------------- + Class: ITextSource + This class provides an interface of a text source for the Graphite engine. +------------------------------------------------------------------------------*/ +class GrUtfTextSrc : public gr::IColorTextSource +{ +public: + GrUtfTextSrc(); + ~GrUtfTextSrc(); + bool setText(const gr::utf8 * pszText, int len); + bool setText(const char * pszText, int len); + bool setText(const gr::utf16 * pszText, int len); + bool setText(const gr::utf32 * pszText, int len); + void setColors(int foreground, int background) + { + mForeground = foreground; + mBackground = background; + }; + //void setSelectionDetails(nsIGrSegWrapper * wrapper); + void setFont(gr::Font * font) { mFont = font; }; + void setPointSize(float & pointSize) { mPointSize = pointSize; }; + // -------------------------------------------------------------------------- + // New V2 interface: + + virtual gr::UtfType utfEncodingForm() { return mType; }; + virtual size_t getLength() { return mLength; }; + virtual size_t fetch(gr::toffset ichMin, size_t cch, gr::utf32 * prgchBuffer); + virtual size_t fetch(gr::toffset ichMin, size_t cch, gr::utf16 * prgchwBuffer); + virtual size_t fetch(gr::toffset ichMin, size_t cch, gr::utf8 * prgchsBuffer); + virtual gr::GrResult getFaceName(int /*ich*/, unsigned int /*cchMax*/, + gr::utf16 * prgchFaceName, unsigned int * pcchLen) + { + prgchFaceName[0] = 0; + *pcchLen = 0; + return gr::kresNotImpl; + }; + //virtual std::wstring getFaceName(int ich) { return mFont->getFaceName(); }; + virtual float getFontSize(gr::toffset ich); + virtual bool getBold(gr::toffset ich); + virtual bool getItalic(gr::toffset ich); + virtual bool getRightToLeft(gr::toffset ich); + virtual unsigned int getDirectionDepth(gr::toffset ich); + virtual float getVerticalOffset(gr::toffset /*ich*/) { return 0;}; + virtual gr::isocode getLanguage(gr::toffset ich); + + virtual std::pair propertyRange(gr::toffset ich); + virtual size_t getFontFeatures(gr::toffset ich, gr::FeatureSetting * prgfset); + virtual bool sameSegment(gr::toffset /*ich1*/, gr::toffset /*ich2*/) { return true; }; + virtual bool featureVariations() { return false; }; + +protected: + bool checkBuffer8(); + bool checkBuffer16(); + bool checkBuffer32(); + +private: + size_t mLength; + size_t mBufferLength8; + size_t mBufferLength16; + size_t mBufferLength32; + gr::utf8 * mData8; + gr::utf16 * mData16; + gr::utf32 * mData32; + gr::UtfType mType; + int mForeground; + int mBackground; + int mSelectForeground; + int mSelectBackground; + bool mIsSelected; + std::wstring mFaceName; + std::vector mSelectionVector; + gr::Font * mFont; + bool mRtl; + float mPointSize; + +public: // methods that will go + // Temporary--eventually these will be of interest only to SegmentPainter. + virtual void getColors(gr::toffset ich, int * pclrFore, int * pclrBack); + + // Shouldn't be here! + virtual gr::GrResult Fetch(int /*ichMin*/, int /*ichLim*/, gr::utf16 * /*prgchBuf*/) { return gr::kresNotImpl; }; + virtual gr::GrResult get_Length(int * /*pcch*/) { return gr::kresNotImpl; }; + virtual gr::GrResult GetFontVariations(int /*ich*/, + wchar_t * /*prgchFontVar*/, int /*ichMax*/, int * /*pich*/, + int * /*pichMin*/, int * /*pichLim*/) { return gr::kresNotImpl; }; + +}; + + +#if !defined(GR_NAMESPACE) +using namespace gr; +#endif + +#endif // !GRUTFTXTSRC_INCLUDED + diff --git a/Build/source/libs/graphite/engine-2.4/test/ProfileHarness/Makefile.am b/Build/source/libs/graphite/engine-2.4/test/ProfileHarness/Makefile.am new file mode 100644 index 00000000000..07d07348eff --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/test/ProfileHarness/Makefile.am @@ -0,0 +1,14 @@ +AUTOMAKE_OPTIONS = 1.6 + +noinst_PROGRAMS = profile-graphite + +AM_CPPFLAGS = -I$(top_srcdir)/include + +profile_graphite_LDFLAGS = -L$(top_builddir)/src -lgraphite + +profile_graphite_SOURCES = \ + GrUtfTextSrc.cpp GrUtfTextSrc.h \ + ProfileHarness.cpp + +#dist-hook: +# rm -f grregtest.log tracelog.txt diff --git a/Build/source/libs/graphite/engine-2.4/test/ProfileHarness/ProfileHarness.cpp b/Build/source/libs/graphite/engine-2.4/test/ProfileHarness/ProfileHarness.cpp new file mode 100644 index 00000000000..d6dee68ee0e --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/test/ProfileHarness/ProfileHarness.cpp @@ -0,0 +1,476 @@ +/*----------------------------------------------------------------------------- +Copyright (C) 2007 SIL International + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: +Responsibility: Sharon Correll +Last reviewed: Not yet. + +Description: +A simple console app that creates a segment using FileFont and dumps a +diagnostic table of the resulting glyph vector to the console. +If graphite has been built with -DTRACING then it will also produce a +diagnostic log of the segment creation in grSegmentLog.txt +-----------------------------------------------------------------------------*/ + +//#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +///#include +#include +#include +#include +#include +#include +#include + +#include "GrUtfTextSrc.h" + +typedef std::pair< gr::GlyphIterator, gr::GlyphIterator > GlyphRange; + +#ifndef HAVE_STRTOF +float strtof(char * text, char ** /*ignore*/) +{ + return static_cast(atof(text)); +} +#endif + +#ifndef HAVE_STRTOL +long strtol(char * text, char ** /*ignore*/) +{ + return atol(text); +} +#endif + +struct Parameters +{ + const char * textFile; + const char * fontFile; + float pointSize; + int dpi; + bool lineStart; + bool lineEnd; + bool useLineFill; + bool useCodes; + float width; + int textArgIndex; + gr::utf16 * pText16; + gr::utf32 * pText32; + size_t charLength; + size_t offset; +}; + +#ifdef HAVE_ICONV +void +convertUtf8ToUtf32(char* pText, Parameters & parameters) +{ + int length = strlen(reinterpret_cast(pText)); + //gr::utf8 * pText = reinterpret_cast(argv[2]); + // convert text to utf32 using iconv because its easier to debug string placements + size_t bytesLeft = length; + size_t outBytesLeft = (length + 1) * sizeof(gr::utf32); + size_t outBufferSize = outBytesLeft; + gr::utf32 * text32 = new gr::utf32[length + 1]; + iconv_t utf8to32 = iconv_open("utf32","utf8"); + assert(utf8to32 != (iconv_t)(-1)); + char * pText32 = reinterpret_cast(&text32[0]); + size_t convertLength = iconv(utf8to32, &pText, &bytesLeft, &pText32, &outBytesLeft); + if (convertLength == size_t(-1)) perror("iconv failed:"); + size_t charLength = (outBufferSize - outBytesLeft) / sizeof(gr::utf32); + assert(convertLength != size_t(-1)); + // size_t offset = 0; + // offset by 1 to avoid bom + if (text32[0] == 0xfeff) + { + parameters.offset = 1; + charLength--; + } + std::cout << "String has " << charLength << " characters (" << length << " bytes)" << std::endl; + size_t ci; + for (ci = 0; ci < 10 && ci < charLength; ci++) + { + std::cout << std::setw(4) << ci << '\t'; + } + std::cout << std::endl; + for (ci = 0; ci < charLength; ci++) + { + std::cout << std::setw(4) << std::hex + << text32[ci+parameters.offset] << '\t'; + if (((ci + 1) % 10) == 0) std::cout << std::endl; + } + std::cout << std::endl; + parameters.charLength = charLength; + parameters.pText32 = text32; + iconv_close(utf8to32); +} +#endif + +bool parseArgs(int argc, char *argv[], Parameters & parameters) +{ + int mainArgOffset = 0; + bool argError = false; + char* pText = NULL; + typedef enum + { + NONE, + POINT_SIZE, + DPI, + LINE_START, + LINE_END, + LINE_FILL, + CODES + } TestOptions; + TestOptions option = NONE; + char * pIntEnd = NULL; + char * pFloatEnd = NULL; + long lTestSize = 0; + float fTestSize = 0.0f; + for (int a = 1; a < argc; a++) + { + switch (option) + { + case DPI: + pIntEnd = NULL; + lTestSize = strtol(argv[a],&pIntEnd, 10); + if (lTestSize > 0 && lTestSize < INT_MAX && lTestSize != LONG_MAX) + { + parameters.dpi = lTestSize; + } + else + { + fprintf(stderr,"Invalid dpi %s\n", argv[a]); + } + option = NONE; + break; + case POINT_SIZE: + pFloatEnd = NULL; + fTestSize = strtof(argv[a],&pFloatEnd); + // what is a reasonable maximum here + if (fTestSize > 0 && fTestSize < 5000.0f) + { + parameters.pointSize = fTestSize; + } + else + { + fprintf(stderr,"Invalid point size %s\n", argv[a]); + argError = true; + } + option = NONE; + break; + case LINE_FILL: + pFloatEnd = NULL; + fTestSize = strtof(argv[a],&pFloatEnd); + // what is a good max width? + if (fTestSize > 0 && fTestSize < 10000) + { + parameters.width = fTestSize; + } + else + { + fprintf(stderr,"Invalid line width %s\n", argv[a]); + argError = true; + } + option = NONE; + break; + default: + option = NONE; + if (argv[a][0] == '-') + { + if (strcmp(argv[a], "-pt") == 0) + { + option = POINT_SIZE; + } + else if (strcmp(argv[a], "-dpi") == 0) + { + option = DPI; + } + else if (strcmp(argv[a], "-ls") == 0) + { + option = NONE; + parameters.lineStart = true; + } + else if (strcmp(argv[a], "-le") == 0) + { + option = NONE; + parameters.lineEnd = true; + } + else if (strcmp(argv[a], "-linefill") == 0) + { + option = LINE_FILL; + parameters.useLineFill = true; + } + else if (strcmp(argv[a], "-codes") == 0) + { + option = NONE; + parameters.useCodes = true; + // must be less than argc + parameters.pText32 = new gr::utf32[argc]; + printf("\nText codes\n"); + } + else + { + argError = true; + fprintf(stderr,"Unknown option %s\n",argv[a]); + } + } + else if (mainArgOffset == 0) + { + parameters.textFile = argv[a]; + mainArgOffset++; + } + else if (mainArgOffset == 1) + { + parameters.fontFile = argv[a]; + mainArgOffset++; + } + else if (parameters.useCodes) + { + pIntEnd = NULL; + mainArgOffset++; + gr::utf32 code = strtol(argv[a],&pIntEnd, 16); + if (code > 0) + { + parameters.pText32[parameters.charLength++] = code; + if (parameters.charLength % 10 == 0) + printf("%4x\n",code); + else + printf("%4x\t",code); + } + else + { + fprintf(stderr,"Invalid dpi %s\n", argv[a]); + } + } + else if (mainArgOffset == 1) + { + mainArgOffset++; + pText = argv[a]; + parameters.textArgIndex = a; + } + else + { + argError = true; + fprintf(stderr,"too many arguments %s\n",argv[a]); + } + } + } + if (mainArgOffset < 2) argError = true; + else + { + if (!parameters.useCodes && pText != NULL) + { +#ifdef HAVE_ICONV + convertUtf8ToUtf32(pText, parameters); +#else + fprintf(stderr,"Only the -codes option is supported on Win32\r\n"); + argError = true; +#endif + } + else + { + ///parameters.pText32[parameters.charLength] = 0; + printf("\n"); + } + } + return (argError) ? false : true; +} + + +void initParameters(Parameters & parameters) +{ + parameters.textFile = ""; + parameters.fontFile = ""; + parameters.pointSize = 12.0f; + parameters.dpi = 72; + parameters.lineStart = false; + parameters.lineEnd = false; + parameters.useLineFill = false; + parameters.useCodes = false; + parameters.width = 100.0f; + parameters.pText16 = NULL; + parameters.pText32 = NULL; + parameters.textArgIndex = 0; + parameters.charLength = 0; + parameters.offset = 0; +} + + + +int runGraphite(Parameters parameters) +{ + int returnCode = 0; + FILE * file = fopen(parameters.fontFile, "rb"); + gr::FileFont * fileFont = NULL; + + // Put the text into an array of string, each string is one paragraph. + std::ifstream textFileStrm(parameters.textFile); + std::cout << "FILE: " << parameters.textFile << "\n"; + std::string stringArray[100]; + + std::stringbuf buf; + textFileStrm >> &buf; + std::cout << "read " << buf.str().length() << " characters" << std::endl; + std::cout << "====BEGIN===" << buf.str() << "====END====" << std::endl; + const std::string strTemp = buf.str(); + stringArray[0] = strTemp; + int cpara = 1; + + try + { + if (file) + { + fileFont = new gr::FileFont(file, parameters.pointSize, parameters.dpi); + if (!fileFont || !fileFont->isValid()) + { + fprintf(stderr,"graphitejni:Invalid font!"); + delete fileFont; + fileFont = NULL; + return 2; + } + printf("Font: %s bold=%d italic=%d %4.1fpt dpi %d\n", + parameters.fontFile, + fileFont->bold(), fileFont->italic(), + parameters.pointSize, parameters.dpi); + bool isGraphite = fileFont->fontHasGraphiteTables(); + if (!isGraphite) + { + fprintf(stderr,"graphitejni: %s does not have graphite tables", + parameters.fontFile); + delete fileFont; + fileFont = NULL; + return 3; + } + } + else + { + fprintf(stderr, "Failed to open %s\n", parameters.fontFile); + return 4; + } + + for (int ipara = 0; ipara < cpara; ipara++) + { + GrUtfTextSrc textSrc; + gr::LayoutEnvironment layout; + + textSrc.setText(stringArray[ipara].data(), stringArray[ipara].length()); + textSrc.setPointSize(parameters.pointSize); + textSrc.setFont(fileFont); + + layout.setStartOfLine(parameters.lineStart); + layout.setEndOfLine(parameters.lineEnd); + layout.setDumbFallback(true); + layout.setJustifier(NULL); + + gr::Segment * pSegment = NULL; + //try + //{ + if (parameters.useLineFill) + { + pSegment = new gr::LineFillSegment(fileFont, &textSrc, &layout, + 0, stringArray[ipara].length(), + parameters.width); + printf("LineFillSegment overing char %d - %d\nline start=%d line end=%d\n", + pSegment->startCharacter(), pSegment->stopCharacter(), + parameters.lineStart, parameters.lineEnd); + } + else + { + pSegment = new gr::RangeSegment(fileFont, &textSrc, &layout, + 0, stringArray[ipara].length()); + printf("RangeSegment covering char %d - %d\nline start=%d line end=%d\n", + pSegment->startCharacter(), pSegment->stopCharacter(), + parameters.lineStart, parameters.lineEnd); + } + //} + //catch (...) + //{ + // printf("Exception occurred while creating segment\n"); + // returnCode = 5; + // throw; + //} + + if (!pSegment) return returnCode; + + // for justifier testing + /* + gr::GrJustifier justifier; + pSegment->SetJustifier(&justifier); + gr::Segment * justified = gr::Segment::JustifiedSegment(*pSegment, 2.0f * advanceWidth); + delete justified; + */ + + delete pSegment; + } + } + catch (...) + { + printf("Exception occurred\n"); + returnCode = 5; + } + + delete fileFont; + + return returnCode; +} + +#ifdef _MSC_VER + +int _tmain(int argc, _TCHAR* argv[]) +{ + Parameters parameters; + initParameters(parameters); + + if (!parseArgs(argc, argv, parameters)) + { + fprintf(stderr,"Usage: %s [options] textfile fontfile \n",argv[0]); + return 1; + } + // UTF16 arguments + //if (parameters.textArgIndex > 0) + //{ + // parameters.pText16 = reinterpret_cast(argv[parameters.textArgIndex]); + // std::wstring text(parameters.pText16); + // parameters.charLength = text.size(); + // for (int i = 0; i < text.size(); i++) + // { + // if (i % 10 == 0) + // printf("\r\n%4x", text[i]); + // else + // printf("\t%4x", text[i]); + // } + //} + //else + //{ + // assert(parameters.pText32); + //} + + return runGraphite(parameters); +} + +#else + +int main(int argc, char *argv[]) +{ + + Parameters parameters; + initParameters(parameters); + + if (!parseArgs(argc, argv, parameters)) + { + fprintf(stderr,"Usage: %s [options] textfile fontfile \n",argv[0]); + return 1; + } + return runGraphite(parameters); +} + +#endif diff --git a/Build/source/libs/graphite/engine-2.4/test/ProfileHarness/makefile.vc b/Build/source/libs/graphite/engine-2.4/test/ProfileHarness/makefile.vc new file mode 100644 index 00000000000..5f42ba97b3b --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/test/ProfileHarness/makefile.vc @@ -0,0 +1,111 @@ +!IF "$(OS)" == "Windows_NT" +NULL= +!ELSE +NULL=nul +!ENDIF + +!IF "$(CFG)" == "" +CFG=DEBUG +!ENDIF + +!IF "$(CFG)" == "RELEASE" + +OUTDIR=.\release +INTDIR=.\release_temp + +all : "$(OUTDIR)\ProfileHarness.exe" + +clean : + @- rd /s/q .\release_temp + +realclean : clean + @- rd /s/q .\release + +CPP_PROJ=/nologo /MT /W3 /GR /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /c +LINK32_FLAGS=kernel32.lib user32.lib advapi32.lib shell32.lib uuid.lib graphite.lib /nologo /subsystem:console /incremental:no /machine:I386 /out:"$(OUTDIR)\ProfileHarness.exe" /libpath:"..\..\release" +BSC32_FLAGS=/nologo /o"$(OUTDIR)\ProfileHarness.bsc" + +!ELSEIF "$(CFG)" == "DEBUG" + +OUTDIR=.\debug +INTDIR=.\debug_temp + +all : "$(OUTDIR)\ProfileHarness.exe" "$(OUTDIR)\ProfileHarness.bsc" + +clean : + @- rd /s/q .\debug_temp + +realclean : clean + @- rd /s/q .\debug + +CPP_PROJ=/nologo /MTd /W3 /Gm /GR /GX /GZ /ZI /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR"$(INTDIR)\\" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /c +LINK32_FLAGS=kernel32.lib user32.lib advapi32.lib shell32.lib uuid.lib graphite.lib /nologo /subsystem:console /incremental:yes /pdb:"$(OUTDIR)\ProfileHarness.pdb" /debug /machine:I386 /out:"$(OUTDIR)\ProfileHarness.exe" /libpath:"..\..\debug" +BSC32_FLAGS=/nologo /o"$(OUTDIR)\ProfileHarness.bsc" + +!ENDIF + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +"$(INTDIR)" : + if not exist "$(INTDIR)/$(NULL)" mkdir "$(INTDIR)" + +.cpp{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cpp{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +{$(APPLIB)}.cpp{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +{$(APPLIB)}.cpp{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +{$(TEXTSRCDIR)}.cpp{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +{$(TEXTSRCDIR)}.cpp{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + + +CPP=cl.exe +RSC=rc.exe +BSC32=bscmake.exe +LINK32=link.exe + +LINK32_OBJS= \ + "$(INTDIR)\ProfileHarness.obj" \ + "$(INTDIR)\GrUtfTextSrc.obj" \ + +"$(OUTDIR)\ProfileHarness.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +BSC32_SBRS= \ + "$(INTDIR)\ProfileHarness.sbr" \ + "$(INTDIR)\GrUtfTextSrc.sbr" + +"$(OUTDIR)\ProfileHarness.bsc" : "$(OUTDIR)" $(BSC32_SBRS) + $(BSC32) @<< + $(BSC32_FLAGS) $(BSC32_SBRS) +<< + + +"$(INTDIR)\ProfileHarness.obj" "$(INTDIR)\ProfileHarness.sbr" : ".\ProfileHarness.cpp" "$(INTDIR)" +"$(INTDIR)\GrTxtSrc.obj" "$(INTDIR)\GrUtfTextSrc.sbr" : ".\GrUtfTextSrc.cpp" "$(INTDIR)" + + diff --git a/Build/source/libs/graphite/engine-2.4/test/RegressionTest/CMakeLists.txt b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/CMakeLists.txt new file mode 100644 index 00000000000..268a2d09a53 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/CMakeLists.txt @@ -0,0 +1,14 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0 FATAL_ERROR) +project(gr-regression-test) + +include_directories(${PROJECT_SOURCE_DIR}/../../include/graphite) + +add_executable(gr-regression-test + GrJustifier.cpp + RegressionTest.cpp + SimpleTextSrc.cpp + TestCase.cpp + stdafx.cpp + ) + +target_link_libraries(gr-regression-test graphite) diff --git a/Build/source/libs/graphite/engine-2.4/test/RegressionTest/GrJustifier.cpp b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/GrJustifier.cpp new file mode 100644 index 00000000000..208b76e5730 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/GrJustifier.cpp @@ -0,0 +1,563 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 2003 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: GrJustifier.cpp +Responsibility: Sharon Correll +Last reviewed: Not yet. + +Description: + A default justification agent for Graphite. +-------------------------------------------------------------------------------*//*:End Ignore*/ + +//:>******************************************************************************************** +//:> Include files +//:>******************************************************************************************** +//#include "main.h" // This is used by clients, so main.h is not available + +#pragma hdrstop +// any other headers (not precompiled) +#include "GrClient.h" +#include "ITextSource.h" +#include "IGrJustifier.h" +#include "GraphiteProcess.h" +#include "GrDebug.h" + +#include "GrJustifier.h" + +#ifdef WIN32 +#include +#endif + +//:>******************************************************************************************** +//:> Global constants +//:>******************************************************************************************** + +const int g_cnPrimes = 7; +static const int g_rgnPrimes[] = +{ + 2, 3, 5, 7, 11, 13, 17, // these primes will allow a range of weights up to 255 + // 19, 23, 31, 37, 41, 43, 47, 53, 59, 61 +}; + +//:>******************************************************************************************** +//:> Forward declarations +//:>******************************************************************************************** + +//:>******************************************************************************************** +//:> Methods +//:>******************************************************************************************** + +/*---------------------------------------------------------------------------------------------- + Constructors. +----------------------------------------------------------------------------------------------*/ +GrJustifier::GrJustifier() +{ + m_cref = 1; // COM-like behavior +} + + +/*---------------------------------------------------------------------------------------------- + Destructor. +----------------------------------------------------------------------------------------------*/ +GrJustifier::~GrJustifier() +{ +} + +/*---------------------------------------------------------------------------------------------- + Determine how to adjust the widths of the glyphs to get a justified effect. + Return kresFalse if we can't achieve the desired width. +----------------------------------------------------------------------------------------------*/ +gr::GrResult GrJustifier::adjustGlyphWidths(gr::GraphiteProcess * pgje, + int iGlyphMin, int iGlyphLim, + float dxCurrentWidthArg, float dxDesiredWidthArg) +{ + if (dxCurrentWidthArg == dxDesiredWidthArg) + return gr::kresOk; // no stretch needed + + int dxCurrentWidth = (int)dxCurrentWidthArg; + int dxDesiredWidth = (int)dxDesiredWidthArg; + + bool fShrinking = (dxDesiredWidth < dxCurrentWidth); + + // First, get the relevant values for each glyph out of the Graphite engine. + + int dxsStretchAvail = 0; + std::vector viGlyphs; + std::vector vdxStretchLeft; + std::vector vdxStep; + std::vector vnWeight; + std::vector vdxWidth; + std::vector vdxStretchOrig; + bool fStep = false; + int nMaxWt = 1; + int cUnits = 0; // glyph-weight units + int cStretchable = 0; + for (int iGlyph = iGlyphMin; iGlyph < iGlyphLim; iGlyph++) + { + int dx; + pgje->getGlyphAttribute(iGlyph, + (fShrinking ? gr::kjgatShrink : gr::kjgatStretch), 1, &dx); + if (dx > 0) + { + int dxStep = 0; + pgje->getGlyphAttribute(iGlyph, gr::kjgatStep, 1, &dxStep); + if (fShrinking) + dxStep = (dxStep > 0) ? 0 : dxStep; // step is applicable if it is negative + else // stretching + dxStep = (dxStep < 0) ? 0 : dxStep; // step is applicable if it is positive + if (dxStep != 0) + { + // Get the actual number of steps allowed. This is more accurate than + // trying to calculate it, due to rounding when converting between + // font units and pixels. + int cSteps; + pgje->getGlyphAttribute(iGlyph, gr::kjgatStretchInSteps, 1, &cSteps); + dx = abs(dxStep * cSteps); + fStep = true; + } + dxStep = abs(dxStep); + + int nWt; + pgje->getGlyphAttribute(iGlyph, gr::kjgatWeight, 1, &nWt); + nWt = max(nWt, 0); + nMaxWt = max(nMaxWt, nWt); + + viGlyphs.push_back(iGlyph); + vdxStretchLeft.push_back(dx); + vdxStep.push_back(dxStep); + vnWeight.push_back(nWt); + vdxWidth.push_back(0); + vdxStretchOrig.push_back(dx); + + dxsStretchAvail += dx; + cUnits += nWt; + cStretchable++; + } + } + + int dxStretchNeeded = dxDesiredWidth - dxCurrentWidth; + if (fShrinking) + dxStretchNeeded *= -1; // always a positive number + int dxStretchAchieved = 0; + bool fIgnoreStepGlyphs = false; + int iiGlyph; + std::vector vnMFactor; + + if (viGlyphs.size() > 0) + { + + // The way weights are handled is the following: we calculate the least common multiple + // of all the weights, and then scale each stretch value accordingly before distributing + // widths. In other words, we put the stretch values into an alternate "common" scaled + // system based on the LCM. "cUnits" represents the total number of stretch-units + // available, where each glyph contributes a number of units equal to its weight. + // To get into this scaled system, small-weight stretches are scaled by a large amount + // and large-weight stretches are scaled by a small amount. After assigning the width, + // we do the reverse scaling on that width. Since large-weight stretches are scaled + // back by less, this results in more width being assigned to glyphs with a large weight. + + int nLcm = 1; + if (nMaxWt > 1) + nLcm = Lcm(vnWeight, vnMFactor); + else + { + vnMFactor.push_back(1); // weight 0 - bogus + vnMFactor.push_back(1); // weight 1 + } + + // Loop over the glyphs until we have assigned all the available space. (If a small amount + // is left over it will be distributed using a special method.) + +LMainLoop: + + int dxStretchStillNeeded = dxStretchNeeded - dxStretchAchieved; + int dxNonStepMore = 0; + int dxNonStepLess = 0; + while (cUnits > 0 && dxStretchStillNeeded >= cStretchable) + // && dxStretchStillNeeded * nLcm >= cUnits) + { + // This is the scaled stretch per glyph, that is, in the scaled system of the LCM. + int dxwStretchPerGlyph = dxStretchStillNeeded * nLcm / cUnits; + + // Recalculate these for the next round: + cUnits = 0; + cStretchable = 0; + + for (iiGlyph = 0; iiGlyph < (signed)viGlyphs.size(); iiGlyph++) + { + if (vdxStep[iiGlyph] > 0 && fIgnoreStepGlyphs) + continue; // leave step-glyphs as they are + + int nWt = vnWeight[iiGlyph]; + int dxwThis = vdxStretchLeft[iiGlyph] * vnMFactor[nWt]; // weighted stretch + dxwThis = min(dxwStretchPerGlyph, dxwThis); + int dxThis = dxwThis / vnMFactor[nWt]; // scale back to unweighted stretch + vdxWidth[iiGlyph] += dxThis; + dxStretchAchieved += dxThis; + vdxStretchLeft[iiGlyph] -= dxThis; + if (vdxStretchLeft[iiGlyph] > 0) + { + cUnits += nWt; // can do some more on the next round + cStretchable++; + } + + // Keep track of how much we could adjust in either direction + // on the second round to handle steps. + if (vdxStep[iiGlyph] == 0) + { + dxNonStepMore += vdxStretchOrig[iiGlyph] - vdxWidth[iiGlyph]; + dxNonStepLess += vdxWidth[iiGlyph]; + } + } + dxStretchStillNeeded = dxStretchNeeded - dxStretchAchieved; + } + + Assert(dxStretchAchieved <= dxStretchNeeded); + + // Make adjustments so that the step values are honored. + + if (fStep // there are some step-glyphs + && !fIgnoreStepGlyphs) // and we didn't already do this + { + // First make some basic adjustments, alternating making more and fewer steps + // and see how much that buys us. + int dxAdjusted = 0; + int cNonStepUnits = 0; + int cStretchableNonStep = 0; + bool fReloop = false; + for (iiGlyph = 0; iiGlyph < (signed)viGlyphs.size(); iiGlyph++) + { + if (vdxStep[iiGlyph] > 1) + { + int dxRem = vdxWidth[iiGlyph] % vdxStep[iiGlyph]; + int dxFewer = vdxWidth[iiGlyph] - dxRem; // round down + int dxMore = dxFewer + vdxStep[iiGlyph]; // round up + int dxAdd = dxMore - vdxWidth[iiGlyph]; + if (dxRem == 0) + { // Step is okay; no adjustment needed. + } + else if ( + // this glyph has stretch available to make more steps: + (dxMore <= vdxStretchOrig[iiGlyph]) + // and we need at least this much extra: + && (dxAdd + dxStretchAchieved <= dxStretchNeeded) + // and we still have enough slack in the non-step-glyphs: + && (dxNonStepLess - dxAdjusted - dxAdd > 0) + // and we don't have to adjust much to get to the next step + // (we're 75% of the way there): + && ((dxRem > ((vdxStep[iiGlyph] * 3) << 2)) + // or this glyph has a high weight: + || (vnWeight[iiGlyph] > (nMaxWt >> 2)) + // or we've removed a fair amount already: + || (dxAdjusted < (dxAdd * -2)) + // or we don't have enough slack to remove more: + || (dxNonStepMore + dxAdjusted - dxRem < 0))) + { + // Use the next larger number of steps. + vdxWidth[iiGlyph] += dxAdd; + dxStretchAchieved += dxAdd; + dxAdjusted += dxAdd; + fReloop = true; + } + else + { + // Use the next smaller number of steps. + vdxWidth[iiGlyph] -= dxRem; + dxStretchAchieved -= dxRem; + dxAdjusted -= dxRem; + fReloop = true; + } + } + else if (vdxStep[iiGlyph] == 0) + { + cNonStepUnits += vnWeight[iiGlyph]; + cStretchableNonStep++; + } + } + + if (cNonStepUnits < cUnits || cStretchableNonStep < cStretchable) + { + // Even if no step-glyphs need to be adjusted, there is a different number + // of (non-step) glyphs to divide the space over. (The first time through + // there may not have been enough space per glyph to run the main loop, + // but now there may be.) + fReloop = true; + } + + // Any left over adjustments need to be made by adjusting the items with + // step = 1 (ie, the glyphs that allow fine-grained adjustments). + // Do the main loop again, but only adjust the non-step glyphs. + if (fReloop) + { + cUnits = cNonStepUnits; + cStretchable = cStretchableNonStep; + fIgnoreStepGlyphs = true; + goto LMainLoop; + } + } + + // Divide up any remainder that is due to rounding errors. + + int dxRemainder = dxStretchNeeded - dxStretchAchieved; + if (0 < dxRemainder && dxRemainder < cStretchable) + { + if (cStretchable < (signed)viGlyphs.size() || fStep) + { + // Make sub-lists using the glyphs that are still stretchable. + std::vector vdxStretchRem; + std::vector vdxWidthRem; + std::vector viiGlyphsRem; + for (iiGlyph = 0; iiGlyph < (signed)viGlyphs.size(); iiGlyph++) + { + if (vdxStretchLeft[iiGlyph] > 0 && vdxStep[iiGlyph] == 0) + { + viiGlyphsRem.push_back(iiGlyph); + vdxStretchRem.push_back(vdxStretchLeft[iiGlyph]); + vdxWidthRem.push_back(vdxWidth[iiGlyph]); + } + } + Assert(viiGlyphsRem.size() == size_t(cStretchable)); + DistributeRemainder(vdxWidthRem, vdxStretchRem, dxRemainder, 0, vdxWidthRem.size(), + &dxStretchAchieved); + for (int iiiGlyph = 0; iiiGlyph < cStretchable; iiiGlyph++) + { + int ivGlyph = viiGlyphsRem[iiiGlyph]; + vdxStretchLeft[ivGlyph] = vdxStretchRem[iiiGlyph]; + vdxWidth[ivGlyph] = vdxWidthRem[iiiGlyph]; + } + } + else + { + // All glyphs are still stretchable. + DistributeRemainder(vdxWidth, vdxStretchLeft, dxRemainder, 0, vdxWidth.size(), + &dxStretchAchieved); + } + } + // otherwise we assume left-over is cannot be handled + + // Assign the widths to the glyphs. + + for (iiGlyph = 0; iiGlyph < (signed)viGlyphs.size(); iiGlyph++) + { + int dxThis = vdxWidth[iiGlyph] * ((fShrinking) ? -1 : 1); + if (vdxStep[iiGlyph] == 0) + pgje->setGlyphAttribute(viGlyphs[iiGlyph], gr::kjgatWidth, 1, dxThis); + else + { + // Set the actual number of steps allowed. This is more accurate than + // setting the pixels and then converting to font em-units. + Assert(int(dxThis) % vdxStep[iiGlyph] == 0); // width divides evenly into steps + int cSteps = dxThis/vdxStep[iiGlyph]; + pgje->setGlyphAttribute(viGlyphs[iiGlyph], gr::kjgatWidthInSteps, 1, cSteps); + } + } + } +//LLeave: + + if (dxStretchAchieved == dxStretchNeeded) + return gr::kresOk; + else + { +#ifdef WIN32 + wchar_t rgchw[20]; + std::fill_n(rgchw, 20, L'\0'); + _itow(dxStretchNeeded - dxStretchAchieved, rgchw, 10); + std::wstring strTmp(L"justification failed by "); + strTmp += rgchw; + strTmp += L" units (width needed = "; + std::fill_n(rgchw, 10, L'\0'); + _itow(dxDesiredWidth, rgchw, 10); + strTmp += rgchw; + strTmp += L")\n"; + OutputDebugString(strTmp.c_str()); +#else + Assert(fprintf(stderr, + "justification failed by %d units (width needed = %d)\n", + dxStretchNeeded - dxStretchAchieved, dxDesiredWidth)); +#endif + return gr::kresFalse; + } +} + +/*---------------------------------------------------------------------------------------------- + Distribute the remainder of the width evenly over the stretchable glyphs. +----------------------------------------------------------------------------------------------*/ +void GrJustifier::DistributeRemainder(std::vector & vdxWidths, std::vector & vdxStretch, + int dx, int iiMin, int iiLim, + int * pdxStretchAchieved) +{ + if (dx == 0) + return; + + Assert(dx <= iiLim - iiMin); + if (iiMin + 1 == iiLim) + { + int dxThis = min(dx, vdxStretch[iiMin]); + Assert(dxThis == 1); // we're never adjusting by more than 1, and the glyph should be + // adjustable by that much + vdxWidths[iiMin] += dxThis; + vdxStretch[iiMin] -= dxThis; + *pdxStretchAchieved += dxThis; + } + else + { + int iiMid = (iiLim + iiMin) / 2; + int dxHalf1 = dx / 2; + int dxHalf2 = dx - dxHalf1; + DistributeRemainder(vdxWidths, vdxStretch, dxHalf1, iiMin, iiMid, pdxStretchAchieved); + DistributeRemainder(vdxWidths, vdxStretch, dxHalf2, iiMid, iiLim, pdxStretchAchieved); + } +} + +/*---------------------------------------------------------------------------------------------- + Return the least common multiple of the given weights. Also return + a std::vector of multiplicative factors for each weight. +----------------------------------------------------------------------------------------------*/ +int GrJustifier::Lcm(std::vector & vnWeights, std::vector & vnMFactors) +{ + // The basic algorithm is to factor each weight into primes, counting how many times + // each prime occurs in the factorization. The LCM is the multiple of the primes + // with each prime raised to maximum power encountered within the factorizations. + // Example: weights = [2, 4, 5, 10] + // 2 = 2^1 + // 4 = 2^2 + // 5 = 5^1 + // 10 = 2^1 * 5^1 + // So the LCM = 2^2 * 5^1 = 20. + + std::vector vnPowersForLcm; + int inPrime; + for (inPrime = 0; inPrime < g_cnPrimes; inPrime++) + vnPowersForLcm.push_back(0); + + std::vector vnPowersPerPrime; + vnPowersPerPrime.resize(g_cnPrimes); + int nWtMax = 1; + for (int inWt = 0; inWt < (signed)vnWeights.size(); inWt++) + { + int inMax = PrimeFactors(vnWeights[inWt], vnPowersPerPrime); + for (inPrime = 0; inPrime <= inMax; inPrime++) + vnPowersForLcm[inPrime] = max(vnPowersForLcm[inPrime], vnPowersPerPrime[inPrime]); + nWtMax = max(nWtMax, vnWeights[inWt]); + } + + int nLcm = 1; + for (inPrime = 0; inPrime < g_cnPrimes; inPrime++) + nLcm = nLcm * NthPower(g_rgnPrimes[inPrime], vnPowersForLcm[inPrime]); + + // For each weight, calculate the multiplicative factor. This is the value by which + // to multiply stretch values of this weight in order to get them properly proportioned. + // Note that weights that are not used will have bogus factors. + vnMFactors.push_back(nLcm); // bogus, for weight 0 + for (int nWt = 1; nWt <= nWtMax; nWt++) + { + vnMFactors.push_back(nLcm / nWt); + } + return nLcm; +} + +/*---------------------------------------------------------------------------------------------- + Return a std::vector indicating the prime factors of n. The values of the std::vector correspond + to the primes in g_rgnPrimes: [2, 3, 5, 7, ...]; they are the powers to which each + prime should be raised. For instance, 20 = 2^2 * 5^1, so the result would contain + [2, 0, 1, 0, 0, ...]. + The returned int is index of the highest prime in the list that we found. +----------------------------------------------------------------------------------------------*/ +int GrJustifier::PrimeFactors(int n, std::vector & vnPowersPerPrime) +{ + // Short-cut for common cases: + switch (n) + { + case 0: + case 1: + vnPowersPerPrime[0] = 0; + return 0; + case 2: + vnPowersPerPrime[0] = 1; // 2^1 + return 0; + case 3: + vnPowersPerPrime[0] = 0; + vnPowersPerPrime[1] = 1; // 3^1 + return 1; + case 4: + vnPowersPerPrime[0] = 2; // 2^2 + return 0; + case 5: + vnPowersPerPrime[0] = 0; + vnPowersPerPrime[1] = 0; + vnPowersPerPrime[2] = 1; // 5^1 + return 2; + case 6: + vnPowersPerPrime[0] = 1; // 2^1 + vnPowersPerPrime[1] = 1; // 3^1 + return 1; + case 7: + vnPowersPerPrime[0] = 0; + vnPowersPerPrime[1] = 0; + vnPowersPerPrime[2] = 0; + vnPowersPerPrime[3] = 1; // 7^1 + return 3; + case 8: + vnPowersPerPrime[0] = 3; // 2^3 + return 0; + case 9: + vnPowersPerPrime[0] = 0; + vnPowersPerPrime[1] = 2; // 3^2 + return 1; + case 10: + vnPowersPerPrime[0] = 1; // 2^1 + vnPowersPerPrime[1] = 0; + vnPowersPerPrime[2] = 1; // 5^1 + return 2; + default: + break; + } + + // Otherwise use the general algorithm: suck out prime numbers one by one, + // keeping track of how many we have of each. + + int inPrime; + for (inPrime = 0; inPrime < g_cnPrimes; inPrime++) + vnPowersPerPrime[inPrime] = 0; + + int nRem = n; + for (inPrime = 0; inPrime < g_cnPrimes; inPrime++) + { + while (nRem % g_rgnPrimes[inPrime] == 0) + { + vnPowersPerPrime[inPrime] += 1; + nRem = nRem / g_rgnPrimes[inPrime]; + } + if (nRem == 1) + break; + } + Assert(n > 255 || nRem == 1); + return inPrime; +} + +/*---------------------------------------------------------------------------------------------- + Return nX raised to the nY power. +----------------------------------------------------------------------------------------------*/ +int GrJustifier::NthPower(int nX, int nY) +{ + int nRet = 1; + for (int i = 0; i < nY; i++) + nRet *= nX; + return nRet; +} + +/*---------------------------------------------------------------------------------------------- + Determine how much shrinking is possible for low-end justification. +----------------------------------------------------------------------------------------------*/ +//GrResult GrJustifier::suggestShrinkAndBreak(GraphiteProcess * pgje, +// int iGlyphMin, int iGlyphLim, int dxsWidth, LgLineBreak lbPref, LgLineBreak lbMax, +// int * pdxShrink, LgLineBreak * plbToTry) +//{ +// *pdxShrink = 0; +// *plbToTry = lbPref; +// return kresOk; +//} + diff --git a/Build/source/libs/graphite/engine-2.4/test/RegressionTest/GrJustifier.h b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/GrJustifier.h new file mode 100644 index 00000000000..ea5fc21bec9 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/GrJustifier.h @@ -0,0 +1,82 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 2003 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: GrJustifier.h +Responsibility: Sharon Correll +Last reviewed: Not yet. + +Description: + A default justification agent for Graphite. +-------------------------------------------------------------------------------*//*:End Ignore*/ +#pragma once +#ifndef GRJUSTIFIER_INCLUDED +#define GRJUSTIFIER_INCLUDED + +/*---------------------------------------------------------------------------------------------- + Class: GrJustifier + This class provides a basic justification/layout algorithm for applications that use + Graphite. +----------------------------------------------------------------------------------------------*/ +class GrJustifier : public gr::IGrJustifier +{ +public: + // Constructor: + GrJustifier(); + ~GrJustifier(); + +/* + virtual long IncRefCount(void) + { + return InterlockedIncrement(&m_cref); + } + virtual long DecRefCount(void) + { + long cref = InterlockedDecrement(&m_cref); + if (cref == 0) { + m_cref = 1; + delete this; + } + return cref; + } +*/ + + virtual gr::GrResult adjustGlyphWidths(gr::GraphiteProcess * pfgje, + int iGlyphMin, int iGlyphLim, + float dxCurrWidth, float dxDesiredWidth); + + //virtual GrResult suggestShrinkAndBreak(GraphiteProcess * pfgjwe, + // int iGlyphMin, int iGlyphLim, int dxsWidth, LgLineBreak lbPref, LgLineBreak lbMax, + // int * pdxShrink, LgLineBreak * plbToTry); + + // Return a Graphite-compatible justifier that can be stored in a Graphite segment. + // TODO: remove + //virtual void JustifierObject(IGrJustifier ** ppgjus) + //{ + // *ppgjus = this; + //} + + // When a segment is being destroyed, there is nothing to do, since this is a pointer + // to an object that is allocated elsewhere. + // TODO: remove + //virtual void DeleteJustifierPtr() + //{ + //} + +protected: + long m_cref; + + gr::GraphiteProcess * m_pgreng; + + void DistributeRemainder(std::vector & vdxWidths, std::vector & vdxStretch, + int dx, int iiMin, int iiLim, + int * pdxStretchAchieved); + int Lcm(std::vector & vnWeights, std::vector & vnMFactors); + int PrimeFactors(int n, std::vector & vnPowersPerPrime); + int NthPower(int nX, int nY); +}; + + +#endif // !GRJUSTIFIER_INCLUDED diff --git a/Build/source/libs/graphite/engine-2.4/test/RegressionTest/Makefile.am b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/Makefile.am new file mode 100644 index 00000000000..788c47dd47f --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/Makefile.am @@ -0,0 +1,41 @@ +AUTOMAKE_OPTIONS = 1.6 + +EXTRA_DIST = \ + burmeseText.wpx \ + romanText.wpx \ + xlineText.wpx \ + grtest_arabic.ttf \ + grtest_badVersion.ttf \ + grtest_badCmap.ttf \ + grtest_burmese.ttf \ + grtest_burmese2.ttf \ + grtest_burmese3.ttf \ + grtest_roman.ttf \ + grtest_taiviet.ttf \ + grtest_xline.ttf \ + grtest_pconstraints.ttf \ + xline.gdl \ + Makefile.vc \ + makedebug.bat \ + readme.txt + +noinst_PROGRAMS = regression-test + +AM_CPPFLAGS = -I$(top_srcdir)/include/graphite + +regression_test_LDFLAGS = -L$(top_builddir)/src -lgraphite + +regression_test_SOURCES = \ + main.h \ + stdafx.cpp stdafx.h \ + RegressionTest.cpp \ + TestCase.cpp TestCase.h \ + RtTextSrc.h \ + SimpleTextSrc.cpp SimpleTextSrc.h \ + GrJustifier.cpp GrJustifier.h + +check-local: regression-test + $(top_builddir)/test/RegressionTest/regression-test -p $(srcdir) + +dist-hook: + rm -f grregtest.log tracelog.txt diff --git a/Build/source/libs/graphite/engine-2.4/test/RegressionTest/Makefile.vc b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/Makefile.vc new file mode 100644 index 00000000000..d069afbf282 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/Makefile.vc @@ -0,0 +1,121 @@ +!IF "$(OS)" == "Windows_NT" +NULL= +!ELSE +NULL=nul +!ENDIF + +TARGET=RegressionTest +REGT_SRC=. +REGT_RES=. +REGT_APPLIB=..\..\..\examples\applib + + +!IF "$(CFG)" == "" +CFG=DEBUG +!ENDIF + +!IF "$(CFG)" == "RELEASE" + +OUTDIR=.\release +INTDIR=.\release_temp + +all : "$(OUTDIR)\$(TARGET).exe" + +clean : + @- rd /s/q $(INTDIR) + +realclean : clean + @- rd /s/q $(OUTDIR) + +CPP_PROJ=/nologo /MT /W3 /GR /EHsc /O2 /I "." /I "../../examples/applib" /I "../../include" /I "../../include/graphite" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_UNICODE" /D "UNICODE" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /c +RSC_PROJ=/l 0x409 /fo"$(INTDIR)\$(TARGET).res" /d "NDEBUG" +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib graphite.lib /nologo /subsystem:console /incremental:no /machine:I386 /out:"$(OUTDIR)\$(TARGET).exe" /libpath:"..\..\release" +BSC32_FLAGS=/nologo /o"$(OUTDIR)\$(TARGET).bsc" + +!ELSEIF "$(CFG)" == "DEBUG" + +OUTDIR=.\debug +INTDIR=.\debug_temp + +all : "$(OUTDIR)\$(TARGET).exe" "$(OUTDIR)\$(TARGET).bsc" + +clean : + @- rd /s/q $(INTDIR) + +realclean : clean + @- rd /s/q $(OUTDIR) + +CPP_PROJ=/nologo /MTd /W3 /Gm /GR /EHsc /RTC1 /ZI /Od /I "." /I "../../examples/applib" /I "../../include" /I "../../include/graphite" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_UNICODE" /D "UNICODE" /FR"$(INTDIR)\\" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /c +RSC_PROJ=/l 0x409 /fo"$(INTDIR)\$(TARGET).res" /d "_DEBUG" +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib graphite.lib /nologo /subsystem:console /incremental:yes /pdb:"$(OUTDIR)\$(TARGET).pdb" /debug /machine:I386 /out:"$(OUTDIR)\$(TARGET).exe" /libpath:"..\..\debug" +BSC32_FLAGS=/nologo /o"$(OUTDIR)\$(TARGET).bsc" + +!ENDIF + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +"$(INTDIR)" : + if not exist "$(INTDIR)/$(NULL)" mkdir "$(INTDIR)" + +{$(REGT_SRC)}.cpp{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +{$(REGT_SRC)}.cpp{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +{$(REGT_APPLIB)}.cpp{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +{$(REGT_APPLIB)}.cpp{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + + + +CPP=cl.exe +RSC=rc.exe +BSC32=bscmake.exe +LINK32=link.exe + +LINK32_OBJS= \ + "$(INTDIR)\RegressionTest.obj" \ + "$(INTDIR)\TestCase.obj" \ + "$(INTDIR)\GrJustifier.obj" \ + "$(INTDIR)\SimpleTextSrc.obj" \ + +# "$(INTDIR)\RegressionTest.res" + +"$(OUTDIR)\$(TARGET).exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +BSC32_SBRS= \ + "$(INTDIR)\RegressionTest.sbr" \ + "$(INTDIR)\TestCase.sbr" \ + "$(INTDIR)\GrJustifier.sbr" \ + "$(INTDIR)\SimpleTextSrc.sbr" \ +# + +"$(OUTDIR)\$(TARGET).bsc" : "$(OUTDIR)" $(BSC32_SBRS) + $(BSC32) @<< + $(BSC32_FLAGS) $(BSC32_SBRS) +<< + +"$(INTDIR)\RegressionTest.obj" "$(INTDIR)\RegressionTest.sbr" : "$(REGT_SRC)\RegressionTest.cpp" "$(INTDIR)" +"$(INTDIR)\TestCase.obj" "$(INTDIR)\TestCase.sbr" : "$(REGT_SRC)\TestCase.cpp" "$(INTDIR)" +"$(INTDIR)\GrJustifier.obj" "$(INTDIR)\GrJustifier.sbr" : "$(REGT_APPLIB)\GrJustifier.cpp" "$(INTDIR)" +"$(INTDIR)\SimpleTextSrc.obj" "$(INTDIR)\SimpleTextSrc.sbr" : "$(REGT_APPLIB)\SimpleTextSrc.cpp" "$(INTDIR)" + + +"$(INTDIR)\$(TARGET).res" : "$(REGT_RES)\$(TARGET).rc" "$(INTDIR)" + $(RSC) $(RSC_PROJ) "$(REGT_RES)\$(TARGET).rc" + diff --git a/Build/source/libs/graphite/engine-2.4/test/RegressionTest/Makefile.vc8 b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/Makefile.vc8 new file mode 100644 index 00000000000..bde55dfb88d --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/Makefile.vc8 @@ -0,0 +1,120 @@ +!IF "$(OS)" == "Windows_NT" +NULL= +!ELSE +NULL=nul +!ENDIF + +TARGET=RegressionTest +REGT_SRC=. +REGT_RES=. +REGT_APPLIB=..\..\..\examples\applib + + +!IF "$(CFG)" == "" +CFG=DEBUG +!ENDIF + +!IF "$(CFG)" == "RELEASE" + +OUTDIR=.\release +INTDIR=.\release_temp + +all : "$(OUTDIR)\$(TARGET).exe" + +clean : + @- rd /s/q $(INTDIR) + +realclean : clean + @- rd /s/q $(OUTDIR) + +CPP_PROJ=/nologo /MT /W3 /GR /EHsc /O2 /I "." /I "../../examples/applib" /I "../../include" /I "../../include/graphite" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_UNICODE" /D "UNICODE" /D_SCL_SECURE_NO_WARNINGS /D_CRT_SECURE_NO_WARNINGS /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /c +RSC_PROJ=/l 0x409 /fo"$(INTDIR)\$(TARGET).res" /d "NDEBUG" +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib graphite.lib /nologo /subsystem:console /incremental:no /machine:I386 /out:"$(OUTDIR)\$(TARGET).exe" /libpath:"..\..\release_vc8" +BSC32_FLAGS=/nologo /o"$(OUTDIR)\$(TARGET).bsc" + +!ELSEIF "$(CFG)" == "DEBUG" + +OUTDIR=.\debug +INTDIR=.\debug_temp + +all : "$(OUTDIR)\$(TARGET).exe" "$(OUTDIR)\$(TARGET).bsc" + +clean : + @- rd /s/q $(INTDIR) + +realclean : clean + @- rd /s/q $(OUTDIR) + +CPP_PROJ=/nologo /MTd /W3 /Gm /GR /EHsc /RTC1 /ZI /Od /I "." /I "../../examples/applib" /I "../../include" /I "../../include/graphite" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_UNICODE" /D "UNICODE" /D_SCL_SECURE_NO_WARNINGS /D_CRT_SECURE_NO_WARNINGS /FR"$(INTDIR)\\" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /c +RSC_PROJ=/l 0x409 /fo"$(INTDIR)\$(TARGET).res" /d "_DEBUG" +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib graphite.lib /nologo /subsystem:console /incremental:yes /pdb:"$(OUTDIR)\$(TARGET).pdb" /debug /machine:I386 /out:"$(OUTDIR)\$(TARGET).exe" /libpath:"..\..\debug_vc8" +BSC32_FLAGS=/nologo /o"$(OUTDIR)\$(TARGET).bsc" + +!ENDIF + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +"$(INTDIR)" : + if not exist "$(INTDIR)/$(NULL)" mkdir "$(INTDIR)" + +{$(REGT_SRC)}.cpp{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +{$(REGT_SRC)}.cpp{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +{$(REGT_APPLIB)}.cpp{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +{$(REGT_APPLIB)}.cpp{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + + + +CPP=cl.exe +RSC=rc.exe +BSC32=bscmake.exe +LINK32=link.exe + +LINK32_OBJS= \ + "$(INTDIR)\RegressionTest.obj" \ + "$(INTDIR)\TestCase.obj" \ + "$(INTDIR)\GrJustifier.obj" \ + "$(INTDIR)\SimpleTextSrc.obj" \ + +# "$(INTDIR)\RegressionTest.res" + +"$(OUTDIR)\$(TARGET).exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +BSC32_SBRS= \ + "$(INTDIR)\RegressionTest.sbr" \ + "$(INTDIR)\TestCase.sbr" \ + "$(INTDIR)\GrJustifier.sbr" \ + "$(INTDIR)\SimpleTextSrc.sbr" \ +# + +"$(OUTDIR)\$(TARGET).bsc" : "$(OUTDIR)" $(BSC32_SBRS) + $(BSC32) @<< + $(BSC32_FLAGS) $(BSC32_SBRS) +<< + +"$(INTDIR)\RegressionTest.obj" "$(INTDIR)\RegressionTest.sbr" : "$(REGT_SRC)\RegressionTest.cpp" "$(INTDIR)" +"$(INTDIR)\TestCase.obj" "$(INTDIR)\TestCase.sbr" : "$(REGT_SRC)\TestCase.cpp" "$(INTDIR)" +"$(INTDIR)\GrJustifier.obj" "$(INTDIR)\GrJustifier.sbr" : "$(REGT_APPLIB)\GrJustifier.cpp" "$(INTDIR)" +"$(INTDIR)\SimpleTextSrc.obj" "$(INTDIR)\SimpleTextSrc.sbr" : "$(REGT_APPLIB)\SimpleTextSrc.cpp" "$(INTDIR)" + + +"$(INTDIR)\$(TARGET).res" : "$(REGT_RES)\$(TARGET).rc" "$(INTDIR)" + $(RSC) $(RSC_PROJ) "$(REGT_RES)\$(TARGET).rc" diff --git a/Build/source/libs/graphite/engine-2.4/test/RegressionTest/RegressionTest.cpp b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/RegressionTest.cpp new file mode 100644 index 00000000000..c9761ebda55 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/RegressionTest.cpp @@ -0,0 +1,755 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 2004 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: RegressionTest.cpp +Responsibility: Sharon Correll +Last reviewed: Not yet. + +Description: + Main file for the Graphite regression test program. +-------------------------------------------------------------------------------*//*:End Ignore*/ + +#include "main.h" +#include "MemoryUsage.h" +#include + +//:>******************************************************************************************** +//:> Global variables +//:>******************************************************************************************** +std::ofstream g_strmLog; // log file output stream +std::ofstream g_strmTrace; // debugger trace for selected tests +std::ofstream g_strmMemUsage; + +int g_errorCount; + +// HDC g_hdc; // device-context for bogus window on which to do drawing + +bool g_debugMode = false; +bool g_silentMode = false; + +int g_itcaseStart = 0; // adjust to skip to a certain test + +SegmentMemoryUsage g_smu; +FontMemoryUsage g_fmu; +const int TestCase::kAbsent; + +std::string g_fontPath = "."; +#ifdef _WIN32 +#define PATH_SEP "\\" +#else +#define PATH_SEP "/" +#endif + +// Forward defintions. +int WriteLog(int); +void CopyWstringToUtf16(std::wstring textStr, gr::utf16 * utf16Buf, int bufSize); + +//:>******************************************************************************************** +//:> Functions +//:>******************************************************************************************** + +/*---------------------------------------------------------------------------------------------- + Main function. +----------------------------------------------------------------------------------------------*/ + +int main(int argc, char* argv[]) +{ +#ifdef _MSC_VER + _CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | _CRTDBG_LEAK_CHECK_DF); +#endif // WIN32 + + int iargc = 1; + while (iargc < argc) + { + if ((strcmp(argv[iargc], "/d") == 0) || (strcmp(argv[iargc], "-d") == 0)) + { + g_debugMode = true; + } + if ((strcmp(argv[iargc], "/s") == 0) || (strcmp(argv[iargc], "-s") == 0)) + { + g_silentMode = true; + } + if ((strcmp(argv[iargc], "/p") == 0) || (strcmp(argv[iargc], "-p") == 0)) + { + iargc++; + if (iargc < argc) + { + g_fontPath = argv[iargc]; + } + } + iargc++; + } + + if (!g_silentMode) + { + std::cout << "Graphite Regression Test\n"; + std::cout << "Files path is " << g_fontPath << "\n"; + if (g_debugMode) + std::cout << "In debug mode\n"; + + int nMajorVersion; + int nMinorVersion; + int nBugFixVersion; + gr::EngineVersion(&nMajorVersion, &nMinorVersion, &nBugFixVersion); + std::cout << "Engine Version is " << nMajorVersion << "." << nMinorVersion << "." << nBugFixVersion << "\n\n"; + } + + // Start a new log. + g_strmLog.open("grregtest.log"); + if (g_strmLog.fail()) + { + std::cout << "Unable to open log file."; + return -1; + } + + g_errorCount = 0; + +// g_hdc = ::GetDC(NULL); + + WriteToLog("Graphite Regression Test\n\n"); + + // Initialize the tracelog file. + g_strmTrace.open("tracelog.txt"); + g_strmTrace.close(); + + TestCase * ptcaseList = NULL; + int numberOfTests = TestCase::SetupTests(&ptcaseList); + + RunTests(numberOfTests, ptcaseList); + + WriteToLog("\n==============================================\n"); + g_strmLog << "\n\nTOTAL NUMBER OF ERRORS: " << g_errorCount << "\n"; + if (!g_silentMode) + std::cout << "\n\nTOTAL NUMBER OF ERRORS: " << g_errorCount << "\n"; + + g_strmLog.close(); + + ////EngineInstance::DeleteEngines(); + TestCase::DeleteTests(); + +// ::ReleaseDC(NULL, g_hdc); + + // Output segment memory usage information. + //g_strmMemUsage.open("SegMemoryUsage.log"); + //g_smu.prettyPrint(g_strmMemUsage); + //g_strmMemUsage.close(); + + return g_errorCount; +} + +/*---------------------------------------------------------------------------------------------- + Run the tests. +----------------------------------------------------------------------------------------------*/ +void RunTests(int numberOfTests, TestCase * ptcaseList) +{ + Segment * psegPrev = NULL; + RtTextSrc * ptsrcPrev = NULL; + Segment * psegRet = NULL; + RtTextSrc * ptsrcRet = NULL; + + for (int itcase = g_itcaseStart; itcase < numberOfTests; itcase++) + { + TestCase * ptcase = ptcaseList + itcase; + WriteToLog("\n----------------------------------------------\n"); + WriteToLog("Test: "); + + if (!g_silentMode) + std::cout << "Test " << ptcase->TestName() << "..."; + WriteToLog(ptcase->TestName()); + WriteToLog("\n"); + + RunOneTestCase(ptcase, psegPrev, &psegRet, &ptsrcRet); + + delete psegPrev; + delete ptsrcPrev; + psegPrev = psegRet; + ptsrcPrev = ptsrcRet; + psegRet = NULL; + ptsrcRet = NULL; + } + + delete psegPrev; + delete ptsrcPrev; +} + +/*---------------------------------------------------------------------------------------------- + Run a single test case. +----------------------------------------------------------------------------------------------*/ +int RunOneTestCase(TestCase * ptcase, Segment * psegPrev, Segment ** ppsegRet, RtTextSrc ** pptsrcRet) +{ + if (ptcase->Skip()) + { + std::cout << "\nskipped\n"; + g_strmLog << "skipping\n"; + *ppsegRet = NULL; + return 0; + } + +#ifdef _WIN32 + // Break into the debugger if requested. + if (ptcase->RunDebugger() && ::IsDebuggerPresent()) + { + ::DebugBreak(); + } +#endif + + int errorCount = 0; + + gr::utf16 text[1024]; + CopyWstringToUtf16(ptcase->Text(), text, 1024); + + *ppsegRet = NULL; + SegmentPainter * ppainter = NULL; + std::pair iterPair; + GlyphIterator gitBegin; + GlyphIterator gitEnd; + + //LOGFONT lf; + //memset(&lf, '\0', sizeof(LOGFONT)); + //lf.lfCharSet = DEFAULT_CHARSET; + //lf.lfHeight = (signed(ptcase->FontSize()) * -96) / 72; // 96 = resolution, 72 = points per inch + //lf.lfWeight = 400; + //lf.lfItalic = FALSE; + //wcscpy(lf.lfFaceName, ptcase->FontName().data()); + //HDC hdc = CreateDC(TEXT("DISPLAY"), NULL, NULL, NULL); + //HFONT hfont = CreateFontIndirect(&lf); + //HFONT hfontOld = (HFONT)::SelectObject(hdc, hfont); // restore before destroying the DC. + //WinFont winfont(hdc); + + FileFont font(g_fontPath + PATH_SEP + ptcase->FontFile(), float(signed(ptcase->FontSize())), 96, 96); + + if (!font.isValid()) + { + OutputError(ptcase, std::string("ERROR: reading font file: \"") + ptcase->FontFile() + "\" at path \"" + g_fontPath + "\"; remaining tests skipped"); + *ppsegRet = NULL; + errorCount++; + return WriteLog(errorCount); + } + + // Set up the text source. + *pptsrcRet = new RtTextSrc(&(text[0])); + RtTextSrc * ptsrc = *pptsrcRet; + (*pptsrcRet)->setFeatures(ptcase->Features()); + (*pptsrcRet)->setRightToLeft(ptcase->Rtl()); + + // Generate a segment. + LayoutEnvironment layout; + layout.setDumbFallback(ptcase->DumbFallback()); + layout.setStartOfLine(true); + layout.setRightToLeft(ptcase->ParaRtl()); + if (ptcase->InitWithPrevSeg()) + layout.setPrevSegment(psegPrev); + + if (ptcase->TraceLog()) + { + g_strmTrace.open("tracelog.txt", std::ios::app); + g_strmTrace << "Test: " << ptcase->TestName() << "\n\n"; + layout.setLoggingStream(&g_strmTrace); + } + + try + { + if (ptcase->AvailWidth() < 10000) + { + layout.setBestBreak(ptcase->PrefBreak()); + layout.setWorstBreak(ptcase->WorstBreak()); + layout.setTrailingWs(ptcase->Twsh()); + *ppsegRet = new LineFillSegment(&font, ptsrc, &layout, + ptcase->FirstChar(), ptsrc->getLength(), + (float)ptcase->AvailWidth(), + ptcase->Backtrack()); + } + else + { + *ppsegRet = new RangeSegment(&font, ptsrc, &layout); + } + } + catch (...) + { + if (!ptcase->NoSegment()) + { + if (ptcase->BadFont() && !ptcase->DumbFallback()) + // Weird situation. + OutputError(ptcase, "ERROR: bad font with no fallback, yet a segment was expected???"); + else + OutputError(ptcase, "ERROR: generating segment; remaining tests skipped"); + errorCount++; + } + // else segment creation failed as expected + + // NB: failure to create a segment due to throwing an exception seems to result in a memory + // leak--the FontCache object FontFace::s_pFontCache does not get deleted. + + *ppsegRet = NULL; + return WriteLog(errorCount); + } + + if (ptcase->TraceLog()) + { + g_strmTrace << "\n\n*********************************************************************************************************************\n\n"; + g_strmTrace.close(); + } + + if ((*ppsegRet) && (*ppsegRet)->segmentTermination() == kestNothingFit) + { + delete *ppsegRet; + *ppsegRet = NULL; + } + + if ((*ppsegRet) == NULL && !ptcase->NoSegment()) + { + OutputError(ptcase, "ERROR: segment not created; remaining tests skipped"); + errorCount++; + return WriteLog(errorCount); + } + else if (ptcase->NoSegment()) + { + if (*ppsegRet) + { + OutputError(ptcase, "ERROR: segment created when none expected"); + errorCount++; + } + delete *ppsegRet; + *ppsegRet = NULL; + return WriteLog(errorCount); + } + + Segment * pseg = *ppsegRet; + + pseg->calculateMemoryUsage(g_smu); + + // Calculate and output font memory usage. + //g_fmu = Font::calculateMemoryUsage(); + //g_strmMemUsage.open("fontMemoryUsage.log"); + //g_fmu.prettyPrint(g_strmMemUsage); + //g_strmMemUsage.close(); + + // Test results. + int segMin = pseg->startCharacter(); + int segLim = pseg->stopCharacter(); + if ((segLim - segMin) != ptcase->CharCount()) + { + OutputErrorWithValues(ptcase, "ERROR: number of characters in segment", -1, + (segLim - segMin), ptcase->CharCount()); + errorCount++; + } + + int segWidth = (int)pseg->advanceWidth(); + if (segWidth != ptcase->SegWidth()) + { + OutputErrorWithValues(ptcase, "ERROR: width of segment", -1, + segWidth, ptcase->SegWidth()); + errorCount++; + } + + iterPair = pseg->glyphs(); + gitBegin = iterPair.first; + gitEnd = iterPair.second; + int cGlyphs = gitEnd - gitBegin; + if (cGlyphs != ptcase->GlyphCount()) + { + OutputErrorWithValues(ptcase, "ERROR: number of glyphs", -1, + cGlyphs, ptcase->GlyphCount()); + errorCount++; + } + else + { + GlyphIterator gitThis = gitBegin; + for (int iglyph = 0; gitThis != gitEnd; ++gitThis, iglyph++) + { + if ((*gitThis).glyphID() != ptcase->GlyphID(iglyph)) + { + OutputErrorWithValues(ptcase, "ERROR: glyph id ", iglyph, + (*gitThis).glyphID(), ptcase->GlyphID(iglyph)); + errorCount++; + } + if (int((*gitThis).origin()) != ptcase->XPos(iglyph)) + { + OutputErrorWithValues(ptcase, "ERROR: glyph x-position ", iglyph, + int((*gitThis).origin()), ptcase->XPos(iglyph)); + errorCount++; + } + if (int((*gitThis).yOffset()) != ptcase->YPos(iglyph)) + { + OutputErrorWithValues(ptcase, "ERROR: glyph y-position ", iglyph, + int((*gitThis).yOffset()), ptcase->YPos(iglyph)); + errorCount++; + } + if (int((*gitThis).advanceWidth()) != ptcase->AdvWidth(iglyph)) + { + OutputErrorWithValues(ptcase, "ERROR: advance width ", iglyph, + int((*gitThis).advanceWidth()), ptcase->AdvWidth(iglyph)); + errorCount++; + } + if (ptcase->BbTests()) + { + gr::Rect rectBb = (*gitThis).bb(); + if (int(rectBb.left) != ptcase->BbLeft(iglyph)) + { + OutputErrorWithValues(ptcase, "ERROR: bb left ", iglyph, + int(rectBb.left), ptcase->BbLeft(iglyph)); + errorCount++; + } + if (int(rectBb.right) != ptcase->BbRight(iglyph)) + { + OutputErrorWithValues(ptcase, "ERROR: bb right ", iglyph, + int(rectBb.right), ptcase->BbRight(iglyph)); + errorCount++; + } + if (int(rectBb.top) != ptcase->BbTop(iglyph)) + { + OutputErrorWithValues(ptcase, "ERROR: bb top ", iglyph, + int(rectBb.top), ptcase->BbTop(iglyph)); + errorCount++; + } + if (int(rectBb.bottom) != ptcase->BbBottom(iglyph)) + { + OutputErrorWithValues(ptcase, "ERROR: bb bottom ", iglyph, + int(rectBb.bottom), ptcase->BbBottom(iglyph)); + errorCount++; + } + } + } + } + + ppainter = new SegmentNonPainter(pseg); + + if (segLim == ptcase->CharCount()) + { + for (int ichar = 0; ichar < segLim; ichar++) + { + LgIpValidResult ipvr = ppainter->isValidInsertionPoint(ichar); + if ((ipvr == kipvrOK && !ptcase->InsPtFlag(ichar)) // TODO: handle kipvrUnknown + || (ipvr != kipvrOK && ptcase->InsPtFlag(ichar))) + { + OutputErrorWithValues(ptcase, "ERROR: valid insertion point ", ichar, + (ipvr == kipvrOK), ptcase->InsPtFlag(ichar)); + errorCount++; + } + } + } + + int c2gi = 0; + while (c2gi < ptcase->CharToGlyphCount()) + { + int ichar = ptcase->CharToGlyphItem(c2gi++); + int glyphCount = ptcase->CharToGlyphItem(c2gi++); + std::pair glyphSet = pseg->charToGlyphs(ichar); + gr::GlyphSetIterator gitStart = glyphSet.first; + gr::GlyphSetIterator gitStop = glyphSet.second; + if ((gitStop - gitStart) != glyphCount) + { + OutputErrorWithValues(ptcase, "ERROR: number of glyphs for char ", ichar, + gitStop - gitStart, glyphCount); + errorCount++; + c2gi += glyphCount; + } + else + { + GlyphSetIterator glyphLp = glyphSet.first; + for (int ig = 0; ig < glyphCount; ig++) + { + if (static_cast((*glyphLp).logicalIndex()) != ptcase->CharToGlyphItem(c2gi)) + { + OutputErrorWithValues(ptcase, "ERROR: glyph for char ", ichar, + (*glyphLp).logicalIndex(), ptcase->CharToGlyphItem(c2gi)); + errorCount++; + } + c2gi++; + glyphLp++; + } + } + } + + int att = 0; + while (att < ptcase->AttachedGlyphCount()) + { + int iglyph = ptcase->AttachedGlyphItem(att++); + if (iglyph > cGlyphs) + { + OutputError(ptcase, "ERROR: non-existent glyph in attachment test ", iglyph); + errorCount++; + att++; + att += ptcase->AttachedGlyphItem(att) + 1; + continue; + } + + GlyphIterator gitThis = gitBegin + iglyph; + GlyphIterator gitBase = gitThis->attachedClusterBase(); + int ibase = gitBase->logicalIndex(); + if (ibase != ptcase->AttachedGlyphItem(att)) + { + OutputErrorWithValues(ptcase, "ERROR: attachment base for glyph ", iglyph, + ibase, ptcase->AttachedGlyphItem(att)); + errorCount++; + } + att++; + std::pair glyphSet = gitThis->attachedClusterGlyphs(); + gr::GlyphSetIterator gitStart = glyphSet.first; + gr::GlyphSetIterator gitStop = glyphSet.second; + int glyphCount = ptcase->AttachedGlyphItem(att++); + if ((gitStop - gitStart) != glyphCount) + { + OutputErrorWithValues(ptcase, "ERROR: number of attachments for glyph ", iglyph, + gitStop - gitStart, glyphCount); + errorCount++; + att += glyphCount; + } + else + { + GlyphSetIterator glyphLp = glyphSet.first; + for (int ig = 0; ig < glyphCount; ig++) + { + if (static_cast((*glyphLp).logicalIndex()) != ptcase->AttachedGlyphItem(att)) + { + OutputErrorWithValues(ptcase, "ERROR: attachment for glyph ", iglyph, + (*glyphLp).logicalIndex(), ptcase->AttachedGlyphItem(att)); + errorCount++; + } + att++; + glyphLp++; + } + } + } + + for (int iclicktest = 0; iclicktest < ptcase->NumberOfClickTests(); iclicktest++) + { + gr::Point ptClick; + ptClick.x = static_cast(ptcase->XClick(iclicktest)); + ptClick.y = static_cast(ptcase->YClick(iclicktest)); + int charIndex; + bool assocPrev; + ppainter->pointToChar(ptClick, &charIndex, &assocPrev); + if (charIndex != ptcase->ClickCharIndex(iclicktest)) + { + OutputErrorWithValues(ptcase, "ERROR: char index from click ", iclicktest, + charIndex, ptcase->ClickCharIndex(iclicktest)); + errorCount++; + continue; + } + if (assocPrev != ptcase->ClickAssocPrev(iclicktest)) + { + OutputErrorWithValues(ptcase, "ERROR: assoc-prev from click ", iclicktest, + assocPrev, ptcase->ClickAssocPrev(iclicktest)); + errorCount++; + } + gr::Rect rect1, rect2; + ppainter->positionsOfIP(charIndex, assocPrev, + false, &rect1, &rect2); + if (ptcase->Sel1Top(iclicktest) == TestCase::kAbsent) + { + if (rect1.top != 0 || rect1.bottom != 0 || rect1.left != 0 || rect1.right != 0) + { + OutputError(ptcase, "ERROR: IP prim rect found ", iclicktest); + errorCount++; + } + } + else if (rect1.top == 0 && rect1.bottom == 0 && rect1.left == 0 && rect1.right == 0) + { + OutputError(ptcase, "ERROR: IP prim rect not found ", iclicktest); + errorCount++; + } + else + { + if ((int)rect1.top != ptcase->Sel1Top(iclicktest)) + { + OutputErrorWithValues(ptcase, "ERROR: IP prim rect top ", iclicktest, + int(rect1.top), ptcase->Sel1Top(iclicktest)); + errorCount++; + } + if ((int)rect1.bottom != ptcase->Sel1Bottom(iclicktest)) + { + OutputErrorWithValues(ptcase, "ERROR: IP prim rect bottom ", iclicktest, + int(rect1.bottom), ptcase->Sel1Bottom(iclicktest)); + errorCount++; + } + if ((int)rect1.left != ptcase->Sel1Left(iclicktest)) + { + OutputErrorWithValues(ptcase, "ERROR: IP prim rect left ", iclicktest, + int(rect1.left), ptcase->Sel1Left(iclicktest)); + errorCount++; + } + } + + if (ptcase->Sel2Top(iclicktest) == TestCase::kAbsent) + { + if (rect2.top != 0 || rect2.bottom != 0 || rect2.left != 0 || rect2.right != 0) + { + OutputError(ptcase, "ERROR: IP sec rect found when not expected ", iclicktest); + errorCount++; + } + } + else if (rect2.top == 0 && rect2.bottom == 0 && rect2.left == 0 && rect2.right == 0) + { + OutputError(ptcase, "ERROR: IP sec rect not found ", iclicktest); + errorCount++; + } + else + { + if ((int)rect2.top != ptcase->Sel2Top(iclicktest)) + { + OutputErrorWithValues(ptcase, "ERROR: IP sec rect top ", iclicktest, + int(rect2.top), ptcase->Sel2Top(iclicktest)); + errorCount++; + } + if ((int)rect2.bottom != ptcase->Sel2Bottom(iclicktest)) + { + OutputErrorWithValues(ptcase, "ERROR: IP sec rect bottom ", iclicktest, + int(rect2.bottom), ptcase->Sel2Bottom(iclicktest)); + errorCount++; + } + if ((int)rect2.left != ptcase->Sel2Left(iclicktest)) + { + OutputErrorWithValues(ptcase, "ERROR: IP sec rect left ", iclicktest, + int(rect2.left), ptcase->Sel2Left(iclicktest)); + errorCount++; + } + } + } + + ////if (contextBlockOut != ptcase->OutputContextBlockSize()) + ////{ + //// OutputErrorWithValues(ptcase, "ERROR: output context block size ", -1, + //// (int)contextBlockOut, (int)ptcase->OutputContextBlockSize()); + //// errorCount++; + ////} + ////else if (!ptcase->CompareContextBlock(pContextBlockOut)) + ////{ + //// OutputError(ptcase, "ERROR: output context block"); + //// errorCount++; + ////} + delete ppainter; + + return WriteLog(errorCount); +} + + +/*---------------------------------------------------------------------------------------------- + Write the error count to the log. +----------------------------------------------------------------------------------------------*/ +int WriteLog(int errorCount) +{ + WriteToLog("\nError count = "); + WriteToLog(errorCount); + WriteToLog("\n"); + + if (!g_silentMode) + { + if (errorCount == 0) + std::cout << "ok\n"; + else + std::cout << "FAILED\n"; + } + + + //delete pseg; // don't delete these; they are passed back to the calling method + //delete ptsrc; + + // Delete device context + //DeleteObject(SelectObject(hdc, hfontOld)); + //DeleteDC(hdc); + + g_errorCount += errorCount; + return errorCount; +} + +/*---------------------------------------------------------------------------------------------- + Copy a std::wstring (whose bytes can be of various sizes on different platforms) + to a buffer of UTF16. +----------------------------------------------------------------------------------------------*/ +void CopyWstringToUtf16(std::wstring textStr, gr::utf16 * utf16Buf, int bufSize) +{ + std::fill_n(utf16Buf, bufSize, L'\0'); + int cc = textStr.length(); + for (int i = 0; i < cc; i++) + utf16Buf[i] = textStr[i]; +} + +/*---------------------------------------------------------------------------------------------- + Output information about an error. +----------------------------------------------------------------------------------------------*/ +void OutputError(TestCase * ptcase, std::string strErr, int i) +{ + OutputErrorAux(ptcase, strErr, i, false, 0, 0); +} + +void OutputErrorWithValues(TestCase * ptcase, std::string strErr, int i, + int valueFound, int valueExpected) +{ + OutputErrorAux(ptcase, strErr, i, true, valueFound, valueExpected); +} + +void OutputErrorAux(TestCase * /*ptcase*/, std::string strErr, int i, + bool showValues, int valueFound, int valueExpected) +{ +// if (g_debugMode) +// ::DebugBreak(); + + if (!g_silentMode) + { + //std::cout << ptcase->TestName() << ": "; + std::cout << strErr; + if (i > -1) + { + std::cout << "[" << i << "]"; + } + std::cout << "\n "; + } + + WriteToLog(strErr, i, showValues, valueFound, valueExpected); + + WriteToLog("\n"); +} + +/*---------------------------------------------------------------------------------------------- + Write some text to the log file. +----------------------------------------------------------------------------------------------*/ +bool WriteToLog(std::string str, int i) +{ + if (g_strmLog.fail()) + { + std::cout << "Error opening log file."; + return false; + } + g_strmLog << str; + if (i > -1) + g_strmLog << "[" << i << "]"; + g_strmLog.flush(); + return true; +} + +bool WriteToLog(std::string str, int i, + bool showValues, int valueFound, int valueExpected) +{ + if (g_strmLog.fail()) + { + std::cout << "Error opening log file."; + return false; + } + g_strmLog << str; + if (i > -1) + g_strmLog << "[" << i << "]"; + if (showValues) + { + g_strmLog << "; found " << valueFound << " not " << valueExpected; + } + g_strmLog.flush(); + return true; +} + + +bool WriteToLog(int n) +{ + if (g_strmLog.fail()) + { + std::cout << "Error opening log file."; + return false; + } + g_strmLog << n; + g_strmLog.flush(); + return true; +} + diff --git a/Build/source/libs/graphite/engine-2.4/test/RegressionTest/RtTextSrc.h b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/RtTextSrc.h new file mode 100644 index 00000000000..df6b5074880 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/RtTextSrc.h @@ -0,0 +1,74 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 1999, 2001 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: RtTextSrc.h +Responsibility: Sharon Correll +Last reviewed: Not yet. + +Description: A text-source for the RegressionTest app. + +-------------------------------------------------------------------------------*//*:End Ignore*/ +#pragma once +#ifndef RTTXTSRC_INCLUDED +#define RTTXTSRC_INCLUDED + +#include + +/*---------------------------------------------------------------------------------------------- + Class: RtTextSrc + This class extends the SimpleTextSource to allow setting of features. +----------------------------------------------------------------------------------------------*/ +class RtTextSrc : public SimpleTextSrc +{ +public: + RtTextSrc(gr::utf16 * pszText) : SimpleTextSrc(pszText) + { + m_fRtl = false; + memset(m_fset, 0, MAXFEAT * sizeof(FeatureSetting)); + } + + void setFeatures(FeatureSetting * fset) + { + m_cFeats = 0; + for (int i = 0; i < MAXFEAT; i++) + { + if (fset[i].id > 0) + { + m_fset[i].id = fset[i].id; + m_fset[i].value = fset[i].value; + m_cFeats++; + } + } + } + + virtual size_t getFontFeatures(toffset /*ich*/, FeatureSetting * prgfset) + { + // Note: size of prgfset buffer = gr::kMaxFeatures = 64 + std::copy(m_fset, m_fset + MAXFEAT, prgfset); + return m_cFeats; + } + + virtual bool getRightToLeft(toffset /*ich*/) + { + return m_fRtl; + } + virtual unsigned int getDirectionDepth(toffset /*ich*/) + { + return ((m_fRtl == 1) ? 1 : 0); + } + void setRightToLeft(bool f) + { + m_fRtl = f; + } + +protected: + bool m_fRtl; + int m_cFeats; + FeatureSetting m_fset[MAXFEAT]; +}; + + +#endif // !RTTXTSRC_INCLUDED diff --git a/Build/source/libs/graphite/engine-2.4/test/RegressionTest/SimpleTextSrc.cpp b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/SimpleTextSrc.cpp new file mode 100644 index 00000000000..1acc1e41dbe --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/SimpleTextSrc.cpp @@ -0,0 +1,90 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 1999, 2001 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: SimpleTextSrc.cpp +Responsibility: Sharon Correll +Last reviewed: Not yet. + +Description: + A simple text source that shows how to use this interface within Graphite. +-------------------------------------------------------------------------------*//*:End Ignore*/ + +//:>******************************************************************************************** +//:> Include files +//:>******************************************************************************************** +#pragma hdrstop +// any other headers (not precompiled) + +#include "GrClient.h" +#include "GrDebug.h" +#include "ITextSource.h" +#include "SimpleTextSrc.h" + +//:>******************************************************************************************** +//:> Initialization and destruction +//:>******************************************************************************************** + +/*---------------------------------------------------------------------------------------------- + Constructors. +----------------------------------------------------------------------------------------------*/ +SimpleTextSrc::SimpleTextSrc(gr::utf16 * pszText) +{ + m_cref = 1; // COM-like behavior + + //m_cchLength = wcslen(pszText); // don't use wcslen, it's not cross-platform + m_cchLength = 0; + for (gr::utf16 * pch = pszText; *pch != 0; pch++) + m_cchLength++; + m_prgchText = new gr::utf16[m_cchLength + 1]; + std::copy(pszText, pszText + m_cchLength, m_prgchText); + m_prgchText[m_cchLength] = 0; // zero-terminate +} + +/*---------------------------------------------------------------------------------------------- + Destructor. +----------------------------------------------------------------------------------------------*/ +SimpleTextSrc::~SimpleTextSrc() +{ + delete[] m_prgchText; +} + +//:>******************************************************************************************** +//:> Interface methods +//:>******************************************************************************************** +/*---------------------------------------------------------------------------------------------- + Get the specified range of text +----------------------------------------------------------------------------------------------*/ +size_t SimpleTextSrc::fetch(toffset ichMin, size_t cch, gr::utf16 * prgchwBuffer) +{ + size_t ichRet = min(cch, size_t(m_cchLength - ichMin)); + std::copy(m_prgchText + ichMin, m_prgchText+ichMin + ichRet, prgchwBuffer); + return ichRet; +} + +/*---------------------------------------------------------------------------------------------- + Return true if the text uses a right-to-left writing system. +----------------------------------------------------------------------------------------------*/ +bool SimpleTextSrc::getRightToLeft(toffset /*ich*/) +{ + return false; +} + +/*---------------------------------------------------------------------------------------------- + Return the depth of embedding of the writing system. +----------------------------------------------------------------------------------------------*/ +unsigned int SimpleTextSrc::getDirectionDepth(toffset /*ich*/) +{ + return 0; +} + +/*---------------------------------------------------------------------------------------------- + Return the vertical offset of the text. This simple implementation provides no + vertical offset. +----------------------------------------------------------------------------------------------*/ +float SimpleTextSrc::getVerticalOffset(toffset /*ich*/) +{ + return 0; +} diff --git a/Build/source/libs/graphite/engine-2.4/test/RegressionTest/SimpleTextSrc.h b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/SimpleTextSrc.h new file mode 100644 index 00000000000..e5abdbe24c1 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/SimpleTextSrc.h @@ -0,0 +1,119 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 1999, 2001 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: SimpleTextSrc.h +Responsibility: Sharon Correll +Last reviewed: Not yet. + +Description: + A simple text source that shows how to use this interface within Graphite. +-------------------------------------------------------------------------------*//*:End Ignore*/ +#pragma once +#ifndef GRTXTSRC_INCLUDED +#define GRTXTSRC_INCLUDED + +using namespace gr; + +/*---------------------------------------------------------------------------------------------- + Class: SimpleTextSrc + This class provides a simple implementation for a text source for the Graphite engine. + There are no paragraph properties of interest and one set of character properties that + apply to the entire string. + + This class is a subclass of IColorTextSource so that it can be used by the + WinSegmentPainter class, which expects the getColors method to be defined. +----------------------------------------------------------------------------------------------*/ +class SimpleTextSrc : public IColorTextSource +{ +public: + // Constructor: + SimpleTextSrc(gr::utf16 * pszText); + ~SimpleTextSrc(); + +/* + virtual long IncRefCount(void) + { + return InterlockedIncrement(&m_cref); + } + virtual long DecRefCount(void) + { + long cref = InterlockedDecrement(&m_cref); + if (cref == 0) { + m_cref = 1; + delete this; + } + return cref; + } +*/ + // ------------------------------------------------------------------------------- + // Interface methods: + + virtual UtfType utfEncodingForm() + { + return kutf16; + } + virtual size_t getLength() + { + return m_cchLength; + } + virtual size_t fetch(toffset /*ichMin*/, size_t /*cch*/, utf32 * /*prgchBuffer*/) + { + throw; + } + virtual size_t fetch(toffset ichMin, size_t cch, gr::utf16 * prgchwBuffer); + virtual size_t fetch(toffset /*ichMin*/, size_t /*cch*/, utf8 * /*prgchsBuffer*/) + { + throw; + }; + + virtual bool getRightToLeft(toffset ich); + virtual unsigned int getDirectionDepth(toffset ich); + virtual float getVerticalOffset(toffset ich); + + virtual isocode getLanguage(toffset /*ich*/) + { + isocode ret; + ret.rgch[0] = 'e'; ret.rgch[1] = 'n'; ret.rgch[2] = 0; ret.rgch[3] = 0; + return ret; + } + + virtual std::pair propertyRange(toffset /*ich*/) + { + std::pair pairRet; + pairRet.first = 0; + pairRet.second = m_cchLength; + return pairRet; + } + + virtual size_t getFontFeatures(toffset /*ich*/, FeatureSetting * /*prgfset*/) + { + return 0; // no features in this simple implementation + } + + virtual bool sameSegment(toffset /*ich1*/, toffset /*ich2*/) + { + return true; + } + + virtual bool featureVariations() + { + return false; + } + + virtual void getColors(toffset /*ich*/, int * pclrFore, int * pclrBack) + { + *pclrFore = kclrBlack; + *pclrBack = kclrTransparent; + } + +protected: + long m_cref; + gr::utf16 * m_prgchText; + int m_cchLength; +}; + + +#endif // !GRTXTSRC_INCLUDED diff --git a/Build/source/libs/graphite/engine-2.4/test/RegressionTest/TestCase.cpp b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/TestCase.cpp new file mode 100644 index 00000000000..09544114364 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/TestCase.cpp @@ -0,0 +1,2650 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 2004 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: TestCase.cpp +Responsibility: Sharon Correll +Last reviewed: Not yet. + +Description: + File to set up test cases for the Graphite regression test program. + +How to add a test: + 1. Add the name of your test method to the class declaration in TestCase.h. + 2. Increment the g_numberOfTests constant in this file. + 3. Add a call to your test method in the SetupTests method in this file. + 4. Copy one of the existing test methods such as SetupSimpleTest and change the name + and data. + +Things that still need testing: + Ligatures (there is one small test of this) + Justification + Fake italic +-------------------------------------------------------------------------------*//*:End Ignore*/ + +#include "main.h" +#include + +//:>******************************************************************************************** +//:> Test constants and methods +//:>******************************************************************************************** + +const int g_numberOfTests = 31; // *** increment as tests are added *** + +TestCase * g_ptcaseList; // list of test cases + +namespace gr { // and it was SC who got rid of the byte defn in GrPlatform.h! +typedef unsigned char byte; +} + + +/*---------------------------------------------------------------------------------------------- + Create the list of tests. +----------------------------------------------------------------------------------------------*/ +int TestCase::SetupTests(TestCase ** pptcaseList) +{ + g_ptcaseList = new TestCase[g_numberOfTests]; + int cptcase = 0; + + // The number of methods called here should equal g_numberOfTests above. + g_ptcaseList[cptcase].SetupSimpleTest(); cptcase++; + g_ptcaseList[cptcase].SetupSimpleBacktrackTest(); cptcase++; + g_ptcaseList[cptcase].SetupSurrogateTest(); cptcase++; + g_ptcaseList[cptcase].SetupBurmese1(); cptcase++; + g_ptcaseList[cptcase].SetupBurmese2(); cptcase++; + g_ptcaseList[cptcase].SetupBurmese3(); cptcase++; + g_ptcaseList[cptcase].SetupBurmese4(); cptcase++; + g_ptcaseList[cptcase].SetupRoman(); cptcase++; + g_ptcaseList[cptcase].SetupRomanFeatures(); cptcase++; + g_ptcaseList[cptcase].SetupStackingAndBridging(); cptcase++; + g_ptcaseList[cptcase].SetupNoWhiteSpace(); cptcase++; + g_ptcaseList[cptcase].SetupNoWhiteSpaceNoSeg(); cptcase++; + g_ptcaseList[cptcase].SetupOnlyWhiteSpace(); cptcase++; + g_ptcaseList[cptcase].SetupCrossLine1(); cptcase++; + g_ptcaseList[cptcase].SetupCrossLine2(); cptcase++; + g_ptcaseList[cptcase].SetupCrossLine3(); cptcase++; + g_ptcaseList[cptcase].SetupCrossLine4(); cptcase++; + g_ptcaseList[cptcase].SetupArabic1(); cptcase++; + g_ptcaseList[cptcase].SetupArabic2(); cptcase++; + g_ptcaseList[cptcase].SetupTaiViet1(); cptcase++; + g_ptcaseList[cptcase].SetupTaiViet2(); cptcase++; + g_ptcaseList[cptcase].SetupBurmesePositioning1(); cptcase++; + g_ptcaseList[cptcase].SetupBurmesePositioning2(); cptcase++; + g_ptcaseList[cptcase].SetupBurmeseFeature1(); cptcase++; + g_ptcaseList[cptcase].SetupBurmeseFeature2(); cptcase++; + g_ptcaseList[cptcase].SetupCharisPConstraint(); cptcase++; + g_ptcaseList[cptcase].SetupDevanagari(); cptcase++; + g_ptcaseList[cptcase].SetupKernGlat2(); cptcase++; + g_ptcaseList[cptcase].SetupDumbFallback1(); cptcase++; + g_ptcaseList[cptcase].SetupDumbFallback2(); cptcase++; + g_ptcaseList[cptcase].SetupBadFont(); cptcase++; + +// g_ptcaseList[cptcase].SetupBugTest(); cptcase++; +// g_ptcaseList[cptcase].SetupBugTest_GentiumNfc(); cptcase++; + // *** Add more method calls here. *** + + assert(cptcase == g_numberOfTests); + + *pptcaseList = g_ptcaseList; + + return g_numberOfTests; +} + +/*---------------------------------------------------------------------------------------------- + Set up a simple test. +----------------------------------------------------------------------------------------------*/ +void TestCase::SetupSimpleTest() +{ + m_testName = "Simple"; + //m_debug = true; + //m_traceLog = true; + //m_skip = true; + + // Input: + m_fontName = L"Graphite Test Roman"; + m_fontFile = "grtest_roman.ttf"; + m_text = L"This is a test."; // text to render + m_fontSize = 12; // font size in points + m_prefBreak = klbWordBreak; // preferred break-weight + m_availWidth = 500; // width available for segment + m_bold = false; + m_italic = false; + m_rtl = false; + m_backtrack = false; + + // Output: + m_segWidth = 86; // physical width of segment + + const int charCnt = 15; // number of characters in the segment + + // need charCnt elements in this array: + bool insPtFlags[] = { + true, true, true, true, true, true, true, true, true, true, + true, true, true, true, true + }; + + const int glyphCnt = 15; // number of glyphs in the segment + + // need glyphCnt elements in these arrays: + gid16 glyphList[] = {55, 75, 76, 86, 3, 76, 86, 3, 68, 3, 87, 72, 86, 87, 17}; + int xPositions[] = { 0, 9, 17, 22, 28, 33, 37, 43, 48, 55, 60, 64, 71, 77, 82}; + int yPositions[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + int advWidths[] = { 9, 8, 4, 6, 4, 4, 6, 4, 7, 4, 4, 7, 6, 4, 4}; + + int bbLefts[] = { 0, 9, 18, 22, 28, 33, 38, 43, 48, 55, 60, 65, 72, 78, 83}; + int bbRights[] = { 9, 17, 21, 27, 33, 37, 43, 48, 55, 60, 64, 71, 77, 82, 85}; + int bbTops[] = {10, 11, 10, 7, 0, 10, 7, 0, 7, 0, 9, 7, 7, 9, 1}; + int bbBottoms[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + + int charsToGlyphs[] = { + 1, 1, 1, 2, 1, 2, 3, 1, 3, 4, 1, 4, 5, 1, 5, 6, 1, 6, 7, 1, 7 + }; + int c2gCount = 21; + + // Each line in clickStuff represents one click test with the following items: + // click x-coord, click y-coord, char index, assoc-prev, + // prim sel Top, prim sel bottom, prim sel left, + // sec sel Top, sec sel bottom, sec sel left + // Y-coordinates are offsets from segment top; ie, (0,0) is segment top-left. + const int clickTestCnt = 3; + int clickStuff[] = { + 11, 25, 1, false, 0, 24, 8, kAbsent, kAbsent, kAbsent, // below baseline + 42, 5, 7, true, 0, 24, 42, kAbsent, kAbsent, kAbsent, // near top of text + 90, 16, 15, true, 0, 24, 85, kAbsent, kAbsent, kAbsent // near baseline + }; + + // Finish setting up test case. + SetCharCount(charCnt); + SetGlyphCount(glyphCnt); + SetGlyphList(glyphList); + SetXPositions(xPositions); + SetYPositions(yPositions); + SetAdvWidths(advWidths); + SetBBs(bbLefts, bbRights, bbTops, bbBottoms); + SetInsPtFlags(insPtFlags); + SetCharsToGlyphs(charsToGlyphs, c2gCount); + SetClickTests(clickTestCnt, clickStuff); +} + +/*---------------------------------------------------------------------------------------------- + Set up a simple test with backtracking. +----------------------------------------------------------------------------------------------*/ +void TestCase::SetupSimpleBacktrackTest() +{ + m_testName = "Simple Backtrack"; + //m_debug = true; + //m_traceLog = true; + //m_skip = true; + + // Input: + m_fontName = L"Graphite Test Roman"; + m_fontFile = "grtest_roman.ttf"; + m_text = L"This is a test."; // text to render + m_fontSize = 12; // font size in points + m_prefBreak = klbWordBreak; // preferred break-weight + m_availWidth = 500; // width available for segment + m_bold = false; + m_italic = false; + m_rtl = false; + m_backtrack = true; + + // Output: + m_segWidth = 55; // physical width of segment + + const int charCnt = 10; // number of characters in the segment + + // need charCnt elements in this array: + bool insPtFlags[] = { + true, true, true, true, true, true, true, true, true, true + }; + + const int glyphCnt = 10; // number of glyphs in the segment + + // need glyphCnt elements in these arrays: + gid16 glyphList[] = {55, 75, 76, 86, 3, 76, 86, 3, 68, 3}; + int xPositions[] = { 0, 9, 17, 22, 28, 33, 37, 43, 48, 55}; + int yPositions[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + int advWidths[] = { 9, 8, 4, 6, 4, 4, 6, 4, 7, 4}; + + const int contextBlockOutSize = 10; + gr::byte contextBlockOut[] = { 15, 1, 0, 0, 0, 0, 0, 0, 0, 0 }; + + // Finish setting up test case. + SetCharCount(charCnt); + SetGlyphCount(glyphCnt); + SetGlyphList(glyphList); + SetXPositions(xPositions); + SetYPositions(yPositions); + SetAdvWidths(advWidths); + SetBBs(NULL, NULL, NULL, NULL); + SetInsPtFlags(insPtFlags); + SetOutputContextBlock(contextBlockOutSize, contextBlockOut); +} + +/*---------------------------------------------------------------------------------------------- + Set up a test that includes surrogates. +----------------------------------------------------------------------------------------------*/ +void TestCase::SetupSurrogateTest() +{ + m_testName = "Surrogates"; + //m_debug = true; + //m_traceLog = true; + //m_skip = true; + + // Input: + m_fontName = L"Graphite Test Roman"; + m_fontFile = "grtest_roman.ttf"; + m_text = L"abXXcdYYe"; // text to render + m_text[2] = 0xD835; + m_text[3] = 0xDD13; + m_text[6] = 0xD835; + m_text[7] = 0xDD10; + m_fontSize = 12; // font size in points + m_prefBreak = klbWordBreak; // preferred break-weight + m_availWidth = 500; // width available for segment + m_bold = false; + m_italic = false; + m_rtl = false; + m_backtrack = false; + + // Output: + m_segWidth = 65; // physical width of segment + + const int charCnt = 9; // number of characters in the segment + + // need charCnt elements in this array: + bool insPtFlags[] = { + true, true, true, false, true, true, true, false, true + }; + + const int glyphCnt = 7; // number of glyphs in the segment + + // need glyphCnt elements in these arrays: + gid16 glyphList[] = {68, 69,1227, 70, 71,1015, 72}; + int xPositions[] = { 0, 7, 15, 27, 34, 42, 58}; + int yPositions[] = { 0, 0, 0, 0, 0, 0, 0}; + int advWidths[] = { 7, 8, 12, 7, 8, 15, 7}; + + int bbLefts[] = { 0, 7, 15, 28, 35, 43, 59}; + int bbRights[] = { 7, 14, 26, 34, 42, 57, 65}; + int bbTops[] = { 7, 11, 10, 7, 11, 10, 7}; + int bbBottoms[] = { 0, 0, -3, 0, 0, 0, 0}; + + int charsToGlyphs[] = { + 0, 1, 0, 1, 1, 1, 2, 1, 2, 3, 0, 4, 1, 3, 5, 1, 4, 6, 1, 5, 7, 0, + 8, 1, 6, + }; + int c2gCount = 25; + + // Each line in clickStuff represents one click test with the following items: + // click x-coord, click y-coord, char index, assoc-prev, + // prim sel Top, prim sel bottom, prim sel left, + // sec sel Top, sec sel bottom, sec sel left + // Y-coordinates are offsets from segment top; ie, (0,0) is segment top-left. + const int clickTestCnt = 3; + int clickStuff[] = { + 17, 25, 2, false, 0, 24, 14, kAbsent, kAbsent, kAbsent, // below baseline + 25, 5, 4, true, 0, 24, 26, kAbsent, kAbsent, kAbsent, // near top of text + 55, 16, 8, true, 0, 24, 57, kAbsent, kAbsent, kAbsent // near baseline + }; + + // Finish setting up test case. + SetCharCount(charCnt); + SetGlyphCount(glyphCnt); + SetGlyphList(glyphList); + SetXPositions(xPositions); + SetYPositions(yPositions); + SetAdvWidths(advWidths); + SetBBs(bbLefts, bbRights, bbTops, bbBottoms); + SetInsPtFlags(insPtFlags); + SetCharsToGlyphs(charsToGlyphs, c2gCount); + SetClickTests(clickTestCnt, clickStuff); +} + +/*---------------------------------------------------------------------------------------------- + A set of tests using Burmese, to test complex positioning and non-white-space + linebreaking. +----------------------------------------------------------------------------------------------*/ +void TestCase::SetupBurmese1() +{ + m_testName = "Burmese 1"; + //m_debug = true; + //m_traceLog = true; + //m_skip = true; + + // Input: + m_fontName = L"Graphite Test Burmese"; + m_fontFile = "grtest_burmese.ttf"; + m_text = BurmeseText(); + m_fontSize = 20; // font size in points + m_prefBreak = klbWordBreak; // preferred break-weight + m_availWidth = 300; // width available for segment + m_bold = false; + m_italic = false; + m_backtrack = false; + + // Output: + m_segWidth = 281; // physical width of segment + + SetupBurmeseAux( + 64, // character count + 45, // glyph count + 5); // number of click-tests + + // Each group = glyph-index, base, number of attached, glyphs, attached-glyph-indices + int attachments[] = { + 0,0,0, 1,1,0, 2,2,2,3,4, 3,2,0, 4,2,0, 5,5,1,6, 6,5,0, 7,7,3,8,9,10, + 8,7,0, 9,7,0, 10,7,0, 11,11,0, 12,12,0, 13,13,0, 14,14,0, 15,15,0, + 16,16,1,17, 17,16,0, 18,18,1,19, 19,18,0, 20,20,1,21, 21,20,0, 22,22,1,23, + 23,22,0, 24,24,0, 25,25,0 + }; + int attCount = sizeof(attachments) / sizeof(int); + SetAttachedClusters(attachments, attCount); + + const int contextBlockOutSize = 11; + gr::byte contextBlockOut[] = { 20, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + SetOutputContextBlock(contextBlockOutSize, contextBlockOut); +} + +void TestCase::SetupBurmese2() +{ + m_testName = "Burmese 2"; + //m_debug = true; + //m_traceLog = true; + //m_skip = true; + + // Input: + m_fontName = L"Graphite Test Burmese"; + m_fontFile = "grtest_burmese.ttf"; + + m_text = BurmeseText(); + m_fontSize = 20; // font size in points + m_prefBreak = klbWordBreak; // preferred break-weight + m_availWidth = 275; // width available for segment + m_bold = false; + m_italic = false; + m_backtrack = false; + + // Output: + m_segWidth = 215; // physical width of segment + + SetupBurmeseAux( + 47, // character count + 33, // glyph count + 3); // number of click-tests + + const int contextBlockOutSize = 11; + gr::byte contextBlockOut[] = { 20, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + SetOutputContextBlock(contextBlockOutSize, contextBlockOut); +} + +void TestCase::SetupBurmese3() +{ + m_testName = "Burmese 3"; + //m_debug = true; + //m_traceLog = true; + //m_skip = true; + + // Input: + m_fontName = L"Graphite Test Burmese"; + m_fontFile = "grtest_burmese.ttf"; + + m_text = BurmeseText(); + m_fontSize = 20; // font size in points + m_prefBreak = klbWordBreak; // preferred break-weight + m_availWidth = 75; // width available for segment + m_bold = false; + m_italic = false; + m_backtrack = false; + + // Output: + m_segWidth = 73; // physical width of segment + + SetupBurmeseAux( + 19, // character count + 13, // glyph count + 2); // number of click-tests + + const int contextBlockOutSize = 11; + gr::byte contextBlockOut[] = { 20, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + SetOutputContextBlock(contextBlockOutSize, contextBlockOut); +} + +void TestCase::SetupBurmese4() +{ + m_testName = "Burmese 4"; + //m_traceLog = true; + //m_debug = true; + //m_skip = true; + + // Input: + m_fontName = L"Graphite Test Burmese"; + m_fontFile = "grtest_burmese.ttf"; + + m_text = BurmeseText(); + m_fontSize = 20; // font size in points + m_prefBreak = klbWsBreak; // preferred break-weight + m_worstBreak = klbHyphenBreak; // worst-case break-weight + m_availWidth = 30; // width available for segment + m_bold = false; + m_italic = false; + m_backtrack = false; + + // Output: + m_noSegment = true; + m_segWidth = 0; // physical width of segment + + SetupBurmeseAux( + 0, // character count + 0, // glyph count + 0); // number of click-tests +} + +void TestCase::SetupBurmeseAux(int charCnt, int glyphCnt, int clickTestCnt) +{ + m_rtl = false; + + // need charCnt elements in this array: + bool insPtFlags[] = { + true, true, false, false, false, true, false, false, false, false, // 0 - 9 + true, false, false, true, false, false, false, true, true, true, // 10 - 19 + true, false, true, true, false, false, true, false, false, false, // 20 - 29 + false, true, false, false, true, false, false, false, true, true, // 30 - 39 + true, true, true, true, true, true, true, true, true, false, // 40 - 49 + true, true, true, false, false, false, true, false, false, true, // 50 - 59 + false, false, false, true + }; + + // need glyphCnt elements in these arrays: + // 0 10 20 30 40 + gid16 glyphList[] = {105,174,158,202,231,162,231,148,223,219,229,248, 3,226,162,173,216,231,177,195,115,231,170,204,243, 3,197,216,172,216, 3,233, 3,226,179,162,216,170,204,158,202,115,231,229, 3}; + int xPositions[] = { 0, 17, 20, 22, 28, 29, 38, 40, 50, 55, 56, 57, 73, 79, 89, 99,102,109,110,111,120,129,130,131,140,143,149,167,174,191,198,205,215,222,232,234,245,252,253,262,264,271,280,278,281}; + int yPositions[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + int advWidths[] = { 17, 2, 9, 4, 0, 10, 0, 17, 2, 0, 0, 15, 6, 10, 10, 2, 7, 0, 10, 9, 9, 0, 10, 7, 2, 6, 17, 7, 17, 7, 6, 10, 6, 10, 13, 10, 7, 10, 7, 9, 4, 9, 0, 0, 6}; + + int bbLefts[] = { 0, 10, 21, 23, 23, 30, 33, 41, 51, 49, 53, 58, 73, 80, 90, 96,100,103,111,109,121,123,131,132,141,143,150,165,175,189,198,206,215,223,233,235,243,253,254,263,265,272,275,275,281}; + int bbRights[] = { 16, 19, 28, 25, 28, 39, 38, 56, 54, 55, 56, 72, 79, 88, 98,101,109,109,119,119,129,129,139,138,142,149,166,173,190,197,205,214,222,231,244,244,251,261,260,271,267,280,280,278,288}; + int bbTops[] = { 7, 7, 7, -1, 15, 7, 15, 7, -1, 15, -2, 15, 0, 7, 7, 7, 7, 15, 7, -1, 7, 15, 7, -1, 7, 0, 7, 7, 7, 7, 0, 7, 0, 7, 16, 7, 7, 7, -1, 7, -1, 7, 15, -2, 0}; + int bbBottoms[] = { 0, -7, -1, -7, 9, 0, 9, 0, -7, 9, -5, 0, 0, 0, 0, -7, 0, 9, -4, -7, 0, 9, 0, -7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -7, 0, 0, 0, -7, -1, -7, 0, 9, -5, 0}; + + // Each group = char-index, number of glyphs, glyph-indices. + int charsToGlyphs[] = { + 0, 1, 0, 1, 1, 1, 2, 1, 1, 3, 1, 1, 4, 1, 1, 5, 1, 2, 6, 1, 3, 7, 1, 3, + 8, 1, 4, 9, 1, 4, 10, 1, 5, 11, 1, 6, 12, 1, 6, 13, 1, 7 + }; + int c2gCount = sizeof(charsToGlyphs) / sizeof(int); + + // Each line in clickStuff represents one click test with the following items: + // click x-coord, click y-coord, char index, assoc-prev, + // prim sel Top, prim sel bottom, prim sel left, + // sec sel Top, sec sel bottom, sec sel left + // Y-coordinates are offsets from segment top; ie, (0,0) is segment top-left. + int clickStuff[] = { + 10, 25, 1, true, 0, 25, 16, kAbsent, kAbsent, kAbsent, + 40, 5, 13, false, 0, 25, 39, kAbsent, kAbsent, kAbsent, + 93, 40, 19, false, 0, 25, 88, 0, 25, 77, + 251, 5, 52, true, 0, 25,251, kAbsent, kAbsent, kAbsent, + 235, 30, 48, false, -1, 27,230, 7, 19,243, + }; + + // Finish setting up test case. + SetCharCount(charCnt); + SetGlyphCount(glyphCnt); + SetGlyphList(glyphList); + SetXPositions(xPositions); + SetYPositions(yPositions); + SetAdvWidths(advWidths); + SetCharsToGlyphs(charsToGlyphs, c2gCount); + SetBBs(bbLefts, bbRights, bbTops, bbBottoms); + SetInsPtFlags(insPtFlags); + SetClickTests(clickTestCnt, clickStuff); +} + +std::wstring TestCase::BurmeseText() +{ + std::wstring strRet; + wchar_t charData[] = { + 0x1000, 0x1039, 0x101a, 0x1039, 0x101d, 0x1014, 0x1039, 0x101f, 0x1039, 0x200c, + 0x1015, 0x1039, 0x200c, 0x1010, 0x102f, 0x102d, 0x1037, 0x104f, 0x0020, 0x1015, + 0x1039, 0x101a, 0x1031, 0x102c, 0x1039, 0x200c, 0x101b, 0x1039, 0x101d, 0x1039, + 0x101f, 0x1004, 0x1039, 0x200c, 0x1019, 0x1039, 0x101f, 0x102f, 0x104a, 0x0020, + 0x101e, 0x102c, 0x101a, 0x102c, 0x0020, 0x1040, 0x0020, 0x1015, 0x1039, 0x101b, + 0x1031, 0x102c, 0x1019, 0x1039, 0x101f, 0x102f, 0x1014, 0x1039, 0x101f, 0x1004, + 0x1039, 0x200c, 0x1037, 0x0020, 0x1021, 0x1031, 0x102c, 0x1004, 0x1039, 0x200c, + 0x1019, 0x1039, 0x101b, 0x1004, 0x1039, 0x200c, 0x1019, 0x1039, 0x101f, 0x102f, + 0x1010, 0x102f, 0x102d, 0x1037, 0x101e, 0x100a, 0x1039, 0x200c, 0x0020, 0x1000, + 0x1039, 0x101a, 0x1039, 0x101d, 0x1014, 0x102f, 0x1039, 0x200c, 0x1015, 0x1039, + 0x200c, 0x1010, 0x102f, 0x102d, 0x1037, 0x104f, 0x0000 + }; + strRet.assign(charData); + return strRet; +} + +/*---------------------------------------------------------------------------------------------- + A set of tests using Roman script, which tests stacking diacritics, many-to-one glyphs, + and features. +----------------------------------------------------------------------------------------------*/ +void TestCase::SetupRoman() +{ + m_testName = "Roman"; + //m_debug = true; + //m_traceLog = true; + //m_skip = true; + + // Input: + m_fontName = L"Graphite Test Roman"; + m_fontFile = "grtest_roman.ttf"; + m_text = RomanText(); // text to render + m_fontSize = 36; // font size in points + m_prefBreak = klbWordBreak; // preferred break-weight + m_availWidth = 500; // width available for segment + m_bold = false; + m_italic = false; + m_rtl = false; + m_backtrack = false; + + // Output: + m_segWidth = 278; // physical width of segment + + const int charCnt = 26; // number of characters in the segment + + // need charCnt elements in this array: + bool insPtFlags[] = { + true, true, true, true, true, true, true, true, true, true, + true, true, true, true, true, true, true, true, true, true, + true, true, true, true, true, true + }; + + const int glyphCnt = 24; // number of glyphs in the segment + + // need glyphCnt elements in these arrays: + // 0 10 20 + gid16 glyphList[] = {72,1815,1768, 83,1789, 86, 74,1943,1956,1926,1061, 68,1777,1755,805,1815, 44,1815, 80,1833,1768,1855,1838,637}; + int xPositions[] = { 0, 23, 23, 21, 41, 45, 64, 88, 98, 112, 116,148, 171, 171,170, 188,183, 203, 199, 230, 230, 230, 230,236}; + int yPositions[] = { 0, 0, 10, 0, -6, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 10, 0, 0, 0, 10, 20, 0}; + int advWidths[] = {21, 0, 0, 24, 0, 18, 24, 13, 13, 4, 31, 21, 0, 0, 13, 0, 15, 0, 37, 0, 0, 0, 0, 41}; + + // Each group = glyph-index, base, number of attached, glyphs, attached-glyph-indices + int attachments[] = { + 0,0,2,1,2, 1,0,0, 2,0,0, 3,3,0, 4,4,0, 5,5,0, 6,6,0, 7,7,2,8,9, + 8,7,0, 9,7,0, 10,10,0, 11,11,2,12,13, 12,11,0, 13,11,0, 14,14,1,15, 15,14,0, + 16,16,1,17, 17,16,0, 18,18,4,19,20,21,22, 19,18,0, 20,18,0, 21,18,0, 22,18,0, + 23,23,0 + }; + int attCount = sizeof(attachments) / sizeof(int); + + // Each line in clickStuff represents one click test with the following items: + // click x-coord, click y-coord, char index, assoc-prev, + // prim sel Top, prim sel bottom, prim sel left, + // sec sel Top, sec sel bottom, sec sel left + // Y-coordinates are offsets from segment top; ie, (0,0) is segment top-left. + const int clickTestCnt = 5; + int clickStuff[] = { + 10, 15, 2, false, 0, 21, 1, 20, 39, 18, + 61, 50, 6, true, 0, 72, 63, kAbsent, kAbsent, kAbsent, + 90, 40, 7, false, 0, 72, 87, kAbsent, kAbsent, kAbsent, + 260, 40, 25, true, 0, 73,263, kAbsent, kAbsent, kAbsent, // ligature + 267, 40, 25, false, 0, 73,263, kAbsent, kAbsent, kAbsent, // ligature + }; + + // Finish setting up test case. + SetCharCount(charCnt); + SetGlyphCount(glyphCnt); + SetGlyphList(glyphList); + SetXPositions(xPositions); + SetYPositions(yPositions); + SetAdvWidths(advWidths); + SetBBs(NULL, NULL, NULL, NULL); + SetAttachedClusters(attachments, attCount); + SetInsPtFlags(insPtFlags); + SetClickTests(clickTestCnt, clickStuff); +} + +void TestCase::SetupRomanFeatures() +{ + m_testName = "Roman Features"; + //m_debug = true; + //m_traceLog = true; + //m_skip = true; + + // Input: + m_fontName = L"Graphite Test Roman"; + m_fontFile = "grtest_roman.ttf"; + m_text = RomanText(); // text to render + m_fontSize = 36; // font size in points + m_prefBreak = klbWordBreak; // preferred break-weight + m_availWidth = 500; // width available for segment + m_bold = false; + m_italic = false; + m_rtl = false; + m_backtrack = false; + + m_fset[0].id = 1024; m_fset[0].value = 2; // capital eng with tail + m_fset[1].id = 1026; m_fset[1].value = 1; // tone numbers + m_fset[2].id = 1029; m_fset[2].value = 1; // vietnamese diacritics + m_fset[3].id = 1032; m_fset[3].value = 1; // literacy alternates + m_fset[4].id = 1034; m_fset[4].value = 1; // y-hook alternate (default) + m_fset[5].id = 1051; m_fset[5].value = 0; // diacritic selection + m_fset[6].id = 0; + + // Output: + m_segWidth = 307; // physical width of segment + + const int charCnt = 26; // number of characters in the segment + + // need charCnt elements in this array: + bool insPtFlags[] = { + true, false, false, true, true, true, true, true, true, true, + true, true, false, false, true, false, true, false, true, false, + false, false, false, true, true, true + }; + + const int glyphCnt = 23; // number of glyphs in the segment + + // need glyphCnt elements in these arrays: + // 0 10 20 + gid16 glyphList[] = {72,1815,1768, 83,1789, 86,681,1659,1667,1662,1056,274,1778, 805,1815, 44,1815, 80,1833,1768,1855,1838,637}; + int xPositions[] = { 0, 23, 23, 21, 41, 45, 64, 87, 104, 121, 138,173, 174, 198, 217, 211, 231, 227, 258, 258, 258, 258,265}; + int yPositions[] = { 0, 0, 10, 0, -6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 10, 20, 0}; + int advWidths[] = {21, 0, 0, 24, 0, 18, 23, 17, 17, 17, 34, 24, 24, 13, 0, 15, 0, 37, 0, 0, 0, 0, 41}; + + // Each line in clickStuff represents one click test with the following items: + // click x-coord, click y-coord, char index, assoc-prev, + // prim sel Top, prim sel bottom, prim sel left, + // sec sel Top, sec sel bottom, sec sel left + // Y-coordinates are offsets from segment top; ie, (0,0) is segment top-left. + const int clickTestCnt = 3; + int clickStuff[] = { + 10, 15, 3, true, 0, 72, 20, kAbsent, kAbsent, kAbsent, + 116, 5, 9, true, 0, 72, 120, kAbsent, kAbsent, kAbsent, + 90, 40, 7, false, 0, 72, 86, kAbsent, kAbsent, kAbsent + }; + + // Finish setting up test case. + SetCharCount(charCnt); + SetGlyphCount(glyphCnt); + SetGlyphList(glyphList); + SetXPositions(xPositions); + SetYPositions(yPositions); + SetAdvWidths(advWidths); + SetBBs(NULL, NULL, NULL, NULL); + SetInsPtFlags(insPtFlags); + SetClickTests(clickTestCnt, clickStuff); +} + +std::wstring TestCase::RomanText() +{ + std::wstring strRet; + wchar_t charData[] = { + 0x0065, 0x0303, 0x0300, 0x0070, 0x0361, 0x0073, 0x0067, 0x02e8, 0x02e5, 0x02e7, + 0x014a, 0x0061, 0x0302, 0x0301, 0x0069, 0x0303, 0x0049, 0x0303, 0x006d, 0x033c, + 0x0300, 0x0308, 0x0304, 0x0066, 0x0066, 0x0069, 0x0000 + }; + strRet.assign(charData); + return strRet; +} + +/*---------------------------------------------------------------------------------------------- + A set of tests for handling complex diacritic stacking and bridging. +----------------------------------------------------------------------------------------------*/ +void TestCase::SetupStackingAndBridging() +{ + m_testName = "Roman Stacking and Bridging"; + //m_debug = true; + //m_traceLog = true; + //m_skip = true; + + // Input: + m_fontName = L"Graphite Test Roman"; + m_fontFile = "grtest_roman.ttf"; + m_fontSize = 36; // font size in points + m_prefBreak = klbWordBreak; // preferred break-weight + m_availWidth = 500; // width available for segment + m_bold = false; + m_italic = false; + m_rtl = false; + m_backtrack = false; + + // text to render + wchar_t charData[] = { + 0x0061,0x035d,0x0061,0x0020,0x0074,0x035d,0x0061,0x0020,0x0061,0x0300, + 0x0300,0x035d,0x0061,0x0020,0x0283,0x0300,0x0300,0x035d,0x0061,0x0020, + 0x0061,0x0316,0x0316,0xf176,0x0061,0x0020,0x0283,0x0300,0x0300,0xf176, + 0x0061,0x0020,0x0061,0x0316,0x0316,0xf176,0x0061,0x0020,0x0283,0x035d, + 0xf176,0x0061,0x0000 + }; + m_text.assign(charData); + + // Output: + m_segWidth = 414; // physical width of segment + + const int charCnt = 42; // number of characters in the segment + + // need charCnt elements in this array: + bool insPtFlags[] = { + true, true, true, true, true, true, true, true, true, true, + true, true, true, true, true, true, true, true, true, true, + true, true, true, true, true, true, true, true, true, true, + true, true, true, true, true, true, true, true, true, true, + true, true, + }; + + const int glyphCnt = 42; // number of glyphs in the segment + + // 68 = a, 97 = t, 1305 = esh, 1768 = upper grave, 1765 = lower grave, 1802 = upper bridge, + // 1801 = lower bridge + + // need glyphCnt elements in these arrays: + // 0 10 20 30 40 + gid16 glyphList[] = {68,1802, 68, 3, 87,1802, 68, 3, 68,1768,1768,1802, 68, 3,1305,1768,1768,1802, 68, 3, 68,1765,1765,1801, 68, 3,1305,1768,1768,1801, 68, 3, 68,1765,1765,1801, 68, 3,1305,1802,1801, 68}; + int xPositions[] = { 0, 21, 21, 42, 56, 73, 69, 91, 105, 127, 127, 126, 126,147, 161, 181, 181, 178,177,199,212, 235, 235, 234,234,255, 269, 289, 289, 286,285,307,320, 343, 343, 342,342,363, 377, 393, 393,393}; + int yPositions[] = { 0, -7, 0, 0, 0, -1, 0, 0, 0, 0, 10, 12, 0, 0, 0, 10, 20, 23, 0, 0, 0, 0, -9, -17, 0, 0, 0, 10, 20, -6, 0, 0, 0, 0, -9, -17, 0, 0, 0, 3, -6, 0}; + int advWidths[] = {21, 0, 21, 13, 13, 0, 21, 13, 21, 0, 0, 0, 21, 13, 16, 0, 0, 0, 21, 13, 21, 0, 0, 0, 21, 13, 16, 0, 0, 0, 21, 13, 21, 0, 0, 0, 21, 13, 16, 0, 0, 21}; + + int bbLefts[] = { 1, 0, 23, 42, 56, 52, 71, 91, 106, 108, 108, 105, 128,147, 159, 162, 162, 157,179,199,214, 217, 217, 213,235,255, 267, 270, 270, 265,287,307,322, 325, 325, 321,343,363, 375, 373, 373,395}; + int bbRights[] = {21, 41, 42, 56, 69, 93, 91,105, 126, 119, 119, 146, 147,161, 178, 173, 173, 198,199,212,234, 228, 228, 254,255,269, 286, 281, 281, 306,306,320,342, 336, 336, 362,363,377, 394, 413, 414,414}; + int bbTops [] = {22, 33, 22, 0, 28, 40, 22, 0, 22, 32, 42, 54, 22, 0, 33, 42, 53, 64, 22, 0, 22, -3, -13, -26, 22, 0, 33, 42, 53, -15, 22, 0, 22, -3, -13, -26, 22, 0, 33, 44, -15, 22}; + int bbBottoms [] = { 0, 26, 0, 0, 0, 33, 0, 0, 0, 24, 34, 47, 0, 0, -10, 34, 44, 57, 0, 0, 0, -11, -21, -32, 0, 0, -10, 34, 44, -21, 0, 0, 0, -11, -21, -32, 0, 0, -10, 38, -21, 0}; + + // Each group = glyph-index, base, number of attached, glyphs, attached-glyph-indices + int attachments[] = { + 0,0,0, 1,1,0, 2,2,0, 3,3,0, 4,4,0, 5,5,0, 6,6,0, 7,7,0, + 8,8,2,9,10, 9,8,0, 10,8,0, 11,11,0, 12,12,0, 13,13,0, 14,14,2,15,16, + 15,14,0, 16,14,0, 17,17,0, 18,18,0, 19,19,0, 20,20,2,21,22, 21,20,0, + 22,20,0, 23,23,0, 24,24,0, 25,25,0, 26,26,2,27,28, 27,26,0, 28,26,0, + 29,29,0, 30,30,0, 31,31,0, 32,32,2,33,34, 33,32,0, 34,32,0, 35,35,0, + 36,36,0, 37,37,0, 38,38,0, 39,39,0, 40,40,0, 41,41,0 + }; + int attCount = sizeof(attachments) / sizeof(int); + + // Each line in clickStuff represents one click test with the following items: + // click x-coord, click y-coord, char index, assoc-prev, + // prim sel Top, prim sel bottom, prim sel left, + // sec sel Top, sec sel bottom, sec sel left + // Y-coordinates are offsets from segment top; ie, (0,0) is segment top-left. + const int clickTestCnt = 6; + int clickStuff[] = { + 109, 25, 9, false, 10, 32, 105, 30, 56, 125, // first grave on 4th a + 178, 26, 15, true, 19, 66, 176, 3, 21, 159, // top of 1st esh, right side + 220, 84, 23, false, 68, 89, 210, 65, 83, 228, // first lower bridge diac + 271, 40, 26, false, 0, 72, 266, kAbsent, kAbsent, kAbsent, // second esh, left side + 271, 65, 26, false, 0, 72, 266, kAbsent, kAbsent, kAbsent, // just below second esh, left side + 271, 68, 29, false, 57, 78, 262, 0, 17, 280 // lower bridge diac under esh, left side + }; + + // Finish setting up test case. + SetCharCount(charCnt); + SetGlyphCount(glyphCnt); + SetGlyphList(glyphList); + SetXPositions(xPositions); + SetYPositions(yPositions); + SetAdvWidths(advWidths); + SetBBs(bbLefts, bbRights, bbTops, bbBottoms); + SetInsPtFlags(insPtFlags); + SetAttachedClusters(attachments, attCount); + SetClickTests(clickTestCnt, clickStuff); +} + +/*---------------------------------------------------------------------------------------------- + A set of tests for handling trailing whitespace. +----------------------------------------------------------------------------------------------*/ +void TestCase::SetupNoWhiteSpace() +{ + m_testName = "No white space"; + //m_debug = true; + //m_traceLog = true; + //m_skip = true; + + // Input: + m_fontName = L"Graphite Test Roman"; + m_fontFile = "grtest_roman.ttf"; + m_text = L"The quick brown fox."; // text to render + m_fontSize = 12; // font size in points + m_prefBreak = klbWordBreak; // preferred break-weight + m_availWidth = 150; // width available for segment + m_bold = false; + m_italic = false; + m_rtl = false; + m_backtrack = false; + m_twsh = ktwshNoWs; + m_paraRtl = true; + + // Output: + m_segWidth = 115; // physical width of segment + + const int charCnt = 16; // number of characters in the segment + + // need charCnt elements in this array: + bool insPtFlags[] = { + true, true, true, true, true, true, true, true, true, true, + true, true, true, true, true, true + }; + + const int glyphCnt = 16; // number of glyphs in the segment + + // need glyphCnt elements in these arrays: + gid16 glyphList[] = {55, 75, 72, 3, 3, 84, 88, 76, 70, 78, 3, 69, 85, 82, 90, 81}; + int xPositions[] = { 0, 9, 17, 24, 29, 34, 42, 50, 54, 61, 69, 74, 82, 87, 95,107}; + int yPositions[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + int advWidths[] = { 9, 8, 7, 4, 4, 8, 8, 4, 7, 8, 4, 8, 5, 8, 11, 8}; + + const int contextBlockOutSize = 10; + gr::byte contextBlockOut[] = { 15, 1, 0, 0, 0, 0, 0, 0, 0, 0 }; + + // Finish setting up test case. + SetCharCount(charCnt); + SetGlyphCount(glyphCnt); + SetGlyphList(glyphList); + SetXPositions(xPositions); + SetYPositions(yPositions); + SetAdvWidths(advWidths); + SetBBs(NULL, NULL, NULL, NULL); + SetInsPtFlags(insPtFlags); + SetClickTests(0, NULL); + SetOutputContextBlock(contextBlockOutSize, contextBlockOut); +} + +void TestCase::SetupNoWhiteSpaceNoSeg() +{ + m_testName = "No white space - no segment"; + //m_debug = true; + //m_traceLog = true; + //m_skip = true; + + // Input: + m_fontName = L"Graphite Test Roman"; + m_fontFile = "grtest_roman.ttf"; + m_text = L"The quick brown fox."; // text to render + m_firstChar = 15; // spaces after brown + m_fontSize = 12; // font size in points + m_prefBreak = klbWordBreak; // preferred break-weight + m_availWidth = 2; // width available for segment + m_bold = false; + m_italic = false; + m_rtl = false; + m_backtrack = false; + m_twsh = ktwshNoWs; + m_paraRtl = true; + + // Output: + m_noSegment = true; + m_segWidth = 0; // physical width of segment + + const int charCnt = 0; // number of characters in the segment + + const int glyphCnt = 0; // number of glyphs in the segment + + // Finish setting up test case. + SetCharCount(charCnt); + SetGlyphCount(glyphCnt); +} + +void TestCase::SetupOnlyWhiteSpace() +{ + m_testName = "Only white space"; + //m_debug = true; + //m_traceLog = true; + //m_skip = true; + + // Input: + m_fontName = L"Graphite Test Roman"; + m_fontFile = "grtest_roman.ttf"; + m_text = L" fox."; // text to render + m_fontSize = 12; // font size in points + m_prefBreak = klbWordBreak; // preferred break-weight + m_availWidth = 2; // width available for segment + m_bold = false; + m_italic = false; + m_rtl = false; + m_backtrack = false; + m_twsh = ktwshOnlyWs; + m_paraRtl = true; + + // Output: + m_segWidth = 0; // physical width of segment - visible + + const int charCnt = 3; // number of characters in the segment + // need charCnt elements in this array: + bool insPtFlags[] = { true, true, true }; + + const int glyphCnt = 3; // number of glyphs in the segment + // need glyphCnt elements in these arrays: + gid16 glyphList[] = { 3, 3, 3 }; + int xPositions[] = { -4, -9,-13 }; + int yPositions[] = { 0, 0, 0 }; + int advWidths[] = { 4, 4, 4 }; + + // TODO: add click tests when the bug fix with upstream tr white space is integrated. + // Each line in clickStuff represents one click test with the following items: + // click x-coord, click y-coord, char index, assoc-prev, + // prim sel Top, prim sel bottom, prim sel left, + // sec sel Top, sec sel bottom, sec sel left + // Y-coordinates are offsets from segment top; ie, (0,0) is segment top-left. + const int clickTestCnt = 6; + int clickStuff[] = { + 2, 25, 0, false, 0, 24, -1, kAbsent, kAbsent, kAbsent, + -1, 5, 0, false, 0, 24, -1, kAbsent, kAbsent, kAbsent, + -6, -3, 1, false, 0, 24, -5, kAbsent, kAbsent, kAbsent, + -8, -3, 2, true, 0, 24, -10, kAbsent, kAbsent, kAbsent, + -13, 40, 3, true, 0, 24, -14, kAbsent, kAbsent, kAbsent, + -18, 0, 3, true, 0, 24, -14, kAbsent, kAbsent, kAbsent + }; + + // Finish setting up test case. + SetCharCount(charCnt); + SetGlyphCount(glyphCnt); + SetGlyphList(glyphList); + SetXPositions(xPositions); + SetYPositions(yPositions); + SetAdvWidths(advWidths); + SetBBs(NULL, NULL, NULL, NULL); + SetInsPtFlags(insPtFlags); + SetClickTests(clickTestCnt, clickStuff); +} + +/*---------------------------------------------------------------------------------------------- + A set of tests of cross-line contextualization. +----------------------------------------------------------------------------------------------*/ +void TestCase::SetupCrossLine1() +{ + m_testName = "Cross-line 1"; + //m_debug = true; + //m_traceLog = true; + //m_skip = true; + + // Input: + m_fontName = L"Graphite Test CrossLine"; + m_fontFile = "grtest_xline.ttf"; + m_text = CrossLineText(); // "abcddddefx@ghijkmmmmn$yopppppqrsss$z@tttwwww"; + m_fontSize = 30; // font size in points + m_prefBreak = klbHyphenBreak; // preferred break-weight + m_availWidth = 350; // width available for segment + m_bold = false; + m_italic = false; + m_rtl = false; + m_backtrack = false; + + // Output: + m_segWidth = 312; // physical width of segment + + const int charCnt = 10; // number of characters in the segment + + // need charCnt elements in this array: + bool insPtFlags[] = { + true, true, true, true, true, true, true, true, true, true + }; + + const int glyphCnt = 13; // number of glyphs in the segment + + // need glyphCnt elements in these arrays: + gid16 glyphList[] = {30, 67, 68, 69, 70, 70, 70, 70, 71, 72, 34, 90, 32 }; + int xPositions[] = { 0, 40, 58, 79, 97,118,139,160,180,199,213,251,272 }; + int yPositions[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + int advWidths[] = {40, 18, 20, 18, 20, 20, 20, 20, 18, 13, 38, 20, 40 }; + + // TODO: add click tests + // Each line in clickStuff represents one click test with the following items: + // click x-coord, click y-coord, char index, assoc-prev, + // prim sel Top, prim sel bottom, prim sel left, + // sec sel Top, sec sel bottom, sec sel left + // Y-coordinates are offsets from segment top; ie, (0,0) is segment top-left. + const int clickTestCnt = 0; + int * clickStuff = NULL; + //int clickStuff[] = ; + //{ + // 10, 25, 1, false, 0, 24, 9, kAbsent, kAbsent, kAbsent, + //}; + + const int contextBlockOutSize = 9; + gr::byte contextBlockOut[] = { 20, 1, 0, 2, 0, 0, 4, 0, 0, 0 }; + + // Finish setting up test case. + SetCharCount(charCnt); + SetGlyphCount(glyphCnt); + SetGlyphList(glyphList); + SetXPositions(xPositions); + SetYPositions(yPositions); + SetAdvWidths(advWidths); + SetBBs(NULL, NULL, NULL, NULL); + SetInsPtFlags(insPtFlags); + SetClickTests(clickTestCnt, clickStuff); + SetOutputContextBlock(contextBlockOutSize, contextBlockOut); +} + +void TestCase::SetupCrossLine2() +{ + m_testName = "Cross-line 2"; + //m_debug = true; + //m_traceLog = true; + //m_skip = true; + + // Input: + m_fontName = L"Graphite Test CrossLine"; + m_fontFile = "grtest_xline.ttf"; + m_text = CrossLineText(); // "abcddddefx@ghijkmmmmn$yopppppqrsss$z@tttwwww"; + m_firstChar = 10; + m_fontSize = 30; // font size in points + m_prefBreak = klbHyphenBreak; // preferred break-weight + m_availWidth = 400; // width available for segment + m_bold = false; + m_italic = false; + m_rtl = false; + m_backtrack = false; + m_initWithPrev = true; + + const int contextBlockInSize = 9; // output from Cross-line 1 + gr::byte contextBlockIn[] = { 20, 1, 0, 2, 0, 0, 4, 0, 0, 0 }; + + // Output: + m_segWidth = 395; // physical width of segment + + const int charCnt = 13; // number of characters in the segment + + // need charCnt elements in this array: + bool insPtFlags[] = { + false, true, true, true, true, true, true, true, true, true, true, true, true + }; + + const int glyphCnt = 15; // number of glyphs in the segment + + // need glyphCnt elements in these arrays: + gid16 glyphList[] = {30, 34, 73, 74, 75, 76, 77, 79, 79, 79, 79, 80, 6, 91, 32 }; + int xPositions[] = { 0, 40, 78, 99,119,131,143,163,196,228,260,293,314,334,355 }; + int yPositions[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + int advWidths[] = {40, 38, 20, 20, 11, 11, 20, 32, 32, 32, 32, 20, 20, 20, 40 }; + + // TODO: add click tests + // Each line in clickStuff represents one click test with the following items: + // click x-coord, click y-coord, char index, assoc-prev, + // prim sel Top, prim sel bottom, prim sel left, + // sec sel Top, sec sel bottom, sec sel left + // Y-coordinates are offsets from segment top; ie, (0,0) is segment top-left. + const int clickTestCnt = 0; + int * clickStuff = NULL; + //int clickStuff[] = ; + //{ + // 10, 25, 1, false, 0, 24, 9, kAbsent, kAbsent, kAbsent, + //}; + + const int contextBlockOutSize = 9; + gr::byte contextBlockOut[] = { 20, 1, 0, 3, 0, 0, 4, 0, 0, 0 }; + + // Finish setting up test case. + SetCharCount(charCnt); + SetGlyphCount(glyphCnt); + SetGlyphList(glyphList); + SetXPositions(xPositions); + SetYPositions(yPositions); + SetAdvWidths(advWidths); + SetBBs(NULL, NULL, NULL, NULL); + SetInsPtFlags(insPtFlags); + SetClickTests(clickTestCnt, clickStuff); + SetInputContextBlock(contextBlockInSize, contextBlockIn); + SetOutputContextBlock(contextBlockOutSize, contextBlockOut); +} + +void TestCase::SetupCrossLine3() +{ + m_testName = "Cross-line 3"; + //m_debug = true; + //m_traceLog = true; + //m_skip = true; + + // Input: + m_fontName = L"Graphite Test CrossLine"; + m_fontFile = "grtest_xline.ttf"; + m_text = CrossLineText(); // "abcddddefx@ghijkmmmmn$yopppppqrsss$z@tttwwww"; + m_firstChar = 23; + m_fontSize = 30; // font size in points + m_prefBreak = klbHyphenBreak; // preferred break-weight + m_availWidth = 400; // width available for segment + m_bold = false; + m_italic = false; + m_rtl = false; + m_backtrack = false; + m_initWithPrev = true; + + const int contextBlockInSize = 9; // output from Cross-line 2 + gr::byte contextBlockIn[] = { 20, 1, 0, 3, 0, 0, 4, 0, 0, 0 }; + + // Output: + m_segWidth = 358; // physical width of segment + + const int charCnt = 13; // number of characters in the segment + + // need charCnt elements in this array: + bool insPtFlags[] = { + true, true, true, true, true, true, true, true, true, true, true, false, true + }; + + const int glyphCnt = 16; // number of glyphs in the segment + + // need glyphCnt elements in these arrays: + gid16 glyphList[] = {30, 81, 6, 82, 82, 82, 82, 82, 83, 84, 85, 85, 85, 34, 8, 92 }; + int xPositions[] = { 0, 40, 60, 81,102,123,144,164,185,206,220,236,253,269,307,339 }; + int yPositions[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + int advWidths[] = {40, 20, 20, 20, 20, 20, 20, 20, 20, 14, 16, 16, 16, 38, 32, 18 }; + + // TODO: add click tests + // Each line in clickStuff represents one click test with the following items: + // click x-coord, click y-coord, char index, assoc-prev, + // prim sel Top, prim sel bottom, prim sel left, + // sec sel Top, sec sel bottom, sec sel left + // Y-coordinates are offsets from segment top; ie, (0,0) is segment top-left. + const int clickTestCnt = 0; + int * clickStuff = NULL; + //int clickStuff[] = ; + //{ + // 10, 25, 1, false, 0, 24, 9, kAbsent, kAbsent, kAbsent, + //}; + + const int contextBlockOutSize = 9; + gr::byte contextBlockOut[] = { 20, 1, 0, 3, 0, 0, 4, 0, 0, 0 }; + + // Finish setting up test case. + SetCharCount(charCnt); + SetGlyphCount(glyphCnt); + SetGlyphList(glyphList); + SetXPositions(xPositions); + SetYPositions(yPositions); + SetAdvWidths(advWidths); + SetBBs(NULL, NULL, NULL, NULL); + SetInsPtFlags(insPtFlags); + SetClickTests(clickTestCnt, clickStuff); + SetInputContextBlock(contextBlockInSize, contextBlockIn); + SetOutputContextBlock(contextBlockOutSize, contextBlockOut); +} + +void TestCase::SetupCrossLine4() +{ + m_testName = "Cross-line 4"; + //m_debug = true; + //m_traceLog = true; + //m_skip = true; + + // Input: + m_fontName = L"Graphite Test CrossLine"; + m_fontFile = "grtest_xline.ttf"; + m_text = CrossLineText(); // "abcddddefx@ghijkmmmmn$yopppppqrsss$z@tttwwww"; + m_firstChar = 36; + m_fontSize = 30; // font size in points + m_prefBreak = klbHyphenBreak; // preferred break-weight + m_availWidth = 400; // width available for segment + m_bold = false; + m_italic = false; + m_rtl = false; + m_backtrack = false; + m_initWithPrev = true; + + const int contextBlockInSize = 9; // output from Cross-line 3 + gr::byte contextBlockIn[] = { 20, 1, 0, 3, 0, 0, 4, 0, 0, 0 }; + + // Output: + m_segWidth = 248; // physical width of segment + + const int charCnt = 8; // number of characters in the segment + + // need charCnt elements in this array: + bool insPtFlags[] = { + false, true, true, true, true, true, true, true + }; + + const int glyphCnt = 10; // number of glyphs in the segment + + // need glyphCnt elements in these arrays: + gid16 glyphList[] = { 8, 6, 86, 86, 86, 89, 89, 89, 89, 32 }; + int xPositions[] = { 0, 32, 53, 64, 76, 87,117,147,177,208 }; + int yPositions[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + int advWidths[] = {32, 20, 11, 11, 11, 30, 30, 30, 30, 40 }; + + // TODO: add click tests + // Each line in clickStuff represents one click test with the following items: + // click x-coord, click y-coord, char index, assoc-prev, + // prim sel Top, prim sel bottom, prim sel left, + // sec sel Top, sec sel bottom, sec sel left + // Y-coordinates are offsets from segment top; ie, (0,0) is segment top-left. + const int clickTestCnt = 0; + int * clickStuff = NULL; + //int clickStuff[] = ; + //{ + // 10, 25, 1, false, 0, 24, 9, kAbsent, kAbsent, kAbsent, + //}; + + const int contextBlockOutSize = 0; + gr::byte * contextBlockOut = NULL; + + // Finish setting up test case. + SetCharCount(charCnt); + SetGlyphCount(glyphCnt); + SetGlyphList(glyphList); + SetXPositions(xPositions); + SetYPositions(yPositions); + SetAdvWidths(advWidths); + SetBBs(NULL, NULL, NULL, NULL); + SetInsPtFlags(insPtFlags); + SetClickTests(clickTestCnt, clickStuff); + SetInputContextBlock(contextBlockInSize, contextBlockIn); + SetOutputContextBlock(contextBlockOutSize, contextBlockOut); +} + +std::wstring TestCase::CrossLineText() +{ + // The equivalent data is in the "xlineTest.wpx" file. + std::wstring strRet; + strRet.assign(L"abcddddefx@ghijkmmmmn$yopppppqrsss$z@tttwwww"); + return strRet; +} + +/*---------------------------------------------------------------------------------------------- + A set of tests using Arabic: RTL, bidi, and embedded direction codes. +----------------------------------------------------------------------------------------------*/ +void TestCase::SetupArabic1() +{ + m_testName = "Arabic 1"; + //m_debug = true; + //m_traceLog = true; + //m_skip = true; + + // Input: + m_fontName = L"Graphite Test Arabic"; + m_fontFile = "grtest_arabic.ttf"; + m_text = ArabicText(); + m_fontSize = 20; // font size in points + m_prefBreak = klbWordBreak; // preferred break-weight + m_availWidth = 1000; // width available for segment + m_bold = false; + m_italic = false; + m_backtrack = false; + + // Output: + m_segWidth = 409; // physical width of segment + + SetupArabicAux( + 61, // character count + 61); // glyph count + + // Each group = glyph-index, base, number of attached, glyphs, attached-glyph-indices + int attachments[] = { + 0,0,0, 1,1,1,2, 2,1,0, 3,3,4,4,5,6,7, 4,3,0, 5,3,0, 6,3,0, 7,3,0, + 8,8,0, 9,9,4,10,11,12,13, 10,9,0, 11,9,0, 12,9,0, 13,9,0, 14,14,0, + 15,15,0, 16,16,1,17, 17,16,0, 18,18,1,19, 19,18,0 // etc + }; + int attCount = sizeof(attachments) / sizeof(int); + SetAttachedClusters(attachments, attCount); + + // Each line in clickStuff represents one click test with the following items: + // click x-coord, click y-coord, char index, assoc-prev, + // prim sel Top, prim sel bottom, prim sel left, + // sec sel Top, sec sel bottom, sec sel left + // Y-coordinates are offsets from segment top; ie, (0,0) is segment top-left. + int clickStuff[] = { + 199, 13, 37, true, 0, 35,196, kAbsent, kAbsent, kAbsent, + 396, 13, 3, false, 8, 26,399, 10, 19, 397, + 396, 8, 6, true, 3, 15,391, 9, 22, 394, + 222, 5, 32, true, 0, 35,225, kAbsent, kAbsent, kAbsent, + 217, 5, 31, false, 0, 35,215, 0, 35, 246, + }; + SetClickTests(4, clickStuff); +} + +void TestCase::SetupArabic2() +{ + m_testName = "Arabic 2"; + //m_debug = true; + //m_traceLog = true; + //m_skip = true; + + // Input: + m_fontName = L"Graphite Test Arabic"; + m_fontFile = "grtest_arabic.ttf"; + m_text = ArabicText(); + m_fontSize = 20; // font size in points + m_prefBreak = klbWordBreak; // preferred break-weight + m_availWidth = 230; // width available for segment-break after number + m_bold = false; + m_italic = false; + m_backtrack = false; + + // Output: + m_segWidth = 193; // physical width of segment + + SetupArabicAux( + 35, // character count + 35); // glyph count + + // The x-positions are different for a shorter segment: + // 0 10 20 30 + int xPositions[] = {188,183,184,177,178,178,170,169,162,150,154,154,153,155,139,132,127,127,115,118,108,102, 84, 77, 77, 72, 65, 46, 46, 37, 31, 20, 10, 0, -6}; + SetXPositions(xPositions); +} + +void TestCase::SetupArabicAux(int charCnt, int glyphCnt) +{ + m_rtl = true; + + // need charCnt elements in this array: + bool insPtFlags[] = { + true, true, true, true, true, true, true, true, true, true, // 0 - 9 + true, true, true, true, true, true, true, true, true, true, // 10 - 19 + true, true, true, true, true, true, true, true, true, true, // 20 - 29 + true, true, true, true, true, true, true, true, true, true, // 30 - 39 + true, true, true, true, true, true, true, true, true, true, // 40 - 49 + true, true, true, true, true, true, true, true, true, true, // 50 - 59 + true + }; + + // need glyphCnt elements in these arrays: + // 0 10 20 30 40 50 60 + gid16 glyphList[] = {785,658,907,1182,913,907,1192,907, 3,811,914,909,911,934,592, 3,785,909,621,911, 12, 3,321, 3,236,659,731,555,925,961, 3,992,991,990, 3,821,924,712,474,882,527, 3,411,924,950, 3,236,990,991,992,993,995,236, 3,821,769,455,290,839,620,961}; + int xPositions[] = {404,400,401, 393,394,394, 386,385,379,366,370,370,370,371,355,348,343,343,331,334,324,318,300,293,293,289,281,263,262,254,247,237,226,216,209,197,197,189,179,172,154,147,135,139,127,120,120,110, 99, 89, 79, 68, 68, 62, 50, 41, 36, 29, 19, 8, 0}; + int yPositions[] = { 0, 0, -5, 0, 0, 4, 0, 0, 0, 0, -5, -3, -2, 4, 0, 0, 0, 1, 0, -3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + int advWidths[] = { 4, 4, 0, 6, 0, 0, 6, 0, 6, 12, 0, 0, 0, 0, 11, 6, 4, 0, 11, 0, 7, 6, 17, 6, 0, 4, 7, 18, 0, 8, 6, 10, 10, 10, 6, 11, 0, 7, 9, 7, 17, 6, 11, 0, 8, 6, 0, 10, 10, 10, 10, 10, 0, 6, 11, 9, 4, 6, 9, 11, 8}; + + // Finish setting up test case. + SetCharCount(charCnt); + SetGlyphCount(glyphCnt); + SetGlyphList(glyphList); + SetXPositions(xPositions); + SetYPositions(yPositions); + SetAdvWidths(advWidths); + SetBBs(NULL, NULL, NULL, NULL); + SetInsPtFlags(insPtFlags); +} + +std::wstring TestCase::ArabicText() +{ + std::wstring strRet; + wchar_t charData[] = { + 0x0628, 0x0628, 0x064e, 0x0644, 0x064e, 0x0654, 0x0627, 0x064e, 0x0020, 0x0686, + 0x0650, 0x0652, 0x0655, 0x06e0, 0x06a8, 0x0020, 0x0628, 0x0650, 0x06b9, 0x0652, + 0x0029, 0x0020, 0x0628, 0x0020, 0x200d, 0x062a, 0x06a8, 0x0633, 0x0670, 0x061b, + 0x0020, 0x06f1, 0x06f2, 0x06f3, 0x0020, 0x0633, 0x0670, 0x0639, 0x062f, 0x0645, + 0x067e, 0x0020, 0x0644, 0x0670, 0x060c, 0x0020, 0x202e, 0x06f1, 0x06f2, 0x06f3, + 0x06f4, 0x06f5, 0x202c, 0x0020, 0x0633, 0x0647, 0x0627, 0x0631, 0x0639, 0x0646, + 0x061b, 0x0000 + }; + strRet.assign(charData); + return strRet; +} + +/*---------------------------------------------------------------------------------------------- + A set of tests that uses Tai Viet script to test positioning. +----------------------------------------------------------------------------------------------*/ +void TestCase::SetupTaiViet1() +{ + m_testName = "Tai Viet Collisions"; + //m_debug = true; + //m_traceLog = true; + //m_skip = true; + + // Input: + m_fontName = L"Graphite Test TaiViet"; + m_fontFile = "grtest_taiviet.ttf"; + m_fontSize = 36; // font size in points + m_prefBreak = klbWordBreak; // preferred break-weight + m_availWidth = 2000; // width available for segment + m_bold = false; + m_italic = false; + m_rtl = false; + m_backtrack = false; + m_text = TaiVietText(); + + m_fset[0].id = 2001; m_fset[0].value = 2; // vowel position = final consonant + m_fset[1].id = 1051; m_fset[1].value = 0; // diacritic selection = off + m_fset[2].id = 2102; m_fset[2].value = 0; // collision avoidance = off + m_fset[3].id = 0; + + // Output: + m_segWidth = 946; // physical width of segment + + const int charCnt = 46; // number of characters in the segment + + // need charCnt elements in this array: + bool insPtFlags[] = { + true, true, false, true, true, true, false, true, true, true, + false, false, true, true, false, true, true, false, false, true, + true, false, false, true, true, false, false, true, true, false, + false, true, true, false, true, true, false, false, true, true, + false, true, true, true, false, false + }; + + const int glyphCnt = 46; // number of glyphs in the segment + + // need glyphCnt elements in these arrays: + // 0 10 20 30 40 + gid16 glyphList[] = {59, 70, 71, 65, 59, 70, 71, 23, 32, 175, 70, 65, 55, 70, 73, 55, 175, 184,185, 55, 76, 184,185, 55, 77, 70, 185, 41, 77, 70, 23, 56,175, 65, 27, 93, 70,185, 53, 69, 81, 50, 27,175, 70, 23}; + int xPositions[] = { 0, 72, 47, 72,101, 174,149,174, 206, 281, 283, 251, 283,352, 316, 352, 418, 425,386,425,493, 495,458, 495,556,559, 528, 559, 623, 623,591,623,706, 676, 706, 776,777,738, 777, 836, 816,843,880,944,946,912}; + int yPositions[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 0, 0, 5, 13, 0, 0, 5, 22, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 19, 0, 0, 8, 0, 0, 0, 5, 21, 0}; + int advWidths[] = {47, 0, 24, 29, 47, 0, 24, 32, 44, 0, 0, 29, 33, 0, 36, 33, 0, 0, 26, 33, 0, 0, 26, 33, 0, 0, 26, 32, 0, 0, 32, 52, 0, 29, 32, 0, 0, 26, 39, 0, 26, 36, 32, 0, 0, 32}; + + int bbLefts[] = { 5, 45, 52, 73,106, 147,154,177, 209, 254, 257, 252, 286,326, 322, 355, 391, 414,390,428,463, 484, 462,498,540,532, 532, 562, 607, 597,594,627,679, 677, 709, 744,751,742, 784, 825, 820,849,883,917,919,915}; + int bbRights[] = {72, 72, 63, 97,174, 174,165,211, 277, 281, 283, 276, 349,352, 355, 419, 418, 422,409,491,494, 491, 481,561,553,559, 551, 621, 620, 623,628,681,706, 701, 756, 776,777,761, 835, 833, 840,882,930,944,946,949}; + int bbTops [] = {60, 50, 25, 25, 60, 50, 25, 41, 60, 49, 66, 25, 60, 50, 40, 60, 55, 65, 36, 60, 56, 74, 36, 60, -5, 55, 36, 60, -5, 50, 41, 40, 49, 25, 55, 56, 69, 36, 55, 61, 41, 40, 55, 55, 71, 41}; + int bbBottoms [] = { 0, 35, 0, 0, 0, 35, 0, 0, 0, 34, 50, 0, 0, 35, 0, 0, 39, 51, 0, 0, 40, 60, 0, 0,-27, 40, 0, 0, -27, 35, 0, 0, 34, 0, 0, 40, 54, 0, 0, 45, 0, 0, 0, 39, 56, 0}; + + // Each group = glyph-index, base, number of attached, glyphs, attached-glyph-indices + int attachments[] = { + 0,0,0, 1,2,0, 2,2,1,1, 3,3,0, 4,4,0, 5,6,0, 6,6,1,5, 7,7,0, + 8,8,0, 9,11,0, 10,11,0, 11,11,2,9,10, 12,12,0, 13,14,0, 14,14,1,13, + 15,15,0, 16,18,0, 17,18,0, 18,18,2,16,17, 19,19,0, 20,22,0, 21,22,0, + 22,22,2,20,21, 23,23,0, 24,26,0, 25,26,0, 26,26,2,24,25, 27,27,0, 28,30,0, + 29,30,0, 30,30,2,28,29, 31,31,0, 32,33,0, 33,33,1,32, 34,34,0, 35,37,0, + 36,37,0, 37,37,2,35,36, 38,38,0, 39,40,0, 40,40,1,39, 41,41,0, 42,42,0, + 43,45,0, 44,45,0, 45,45,2,43,44 + }; + int attCount = sizeof(attachments) / sizeof(int); + + // Each line in clickStuff represents one click test with the following items: + // click x-coord, click y-coord, char index, assoc-prev, + // prim sel Top, prim sel bottom, prim sel left, + // sec sel Top, sec sel bottom, sec sel left + // Y-coordinates are offsets from segment top; ie, (0,0) is segment top-left. + const int clickTestCnt = 4; + int clickStuff[] = { + 55, 40, 1, true, 0,100, 46, kAbsent, kAbsent, kAbsent, + 65, 20, 1, false, 0,100, 46, kAbsent, kAbsent, kAbsent, // adjust to the left to get a valid IP? + 95, 84, 4, true, 0,100, 100, kAbsent, kAbsent, kAbsent, + 104, 40, 4, false, 0,100, 100, kAbsent, kAbsent, kAbsent + }; + + // Finish setting up test case. + SetCharCount(charCnt); + SetGlyphCount(glyphCnt); + SetGlyphList(glyphList); + SetXPositions(xPositions); + SetYPositions(yPositions); + SetAdvWidths(advWidths); + SetBBs(bbLefts, bbRights, bbTops, bbBottoms); + SetInsPtFlags(insPtFlags); + SetAttachedClusters(attachments, attCount); + SetClickTests(clickTestCnt, clickStuff); +} + +/*---------------------------------------------------------------------------------------------- + A set of tests that uses Tai Viet script to test positioning. +----------------------------------------------------------------------------------------------*/ +void TestCase::SetupTaiViet2() +{ + m_testName = "Tai Viet No Collisions"; + //m_debug = true; + //m_traceLog = true; + //m_skip = true; + + // Input: + m_fontName = L"Graphite Test TaiViet"; + m_fontFile = "grtest_taiviet.ttf"; + m_fontSize = 36; // font size in points + m_prefBreak = klbWordBreak; // preferred break-weight + m_availWidth = 2000; // width available for segment + m_bold = false; + m_italic = false; + m_rtl = false; + m_backtrack = false; + m_text = TaiVietText(); + + m_fset[0].id = 2001; m_fset[0].value = 2; // vowel position = final consonant + m_fset[1].id = 1051; m_fset[1].value = 1; // diacritic selection = on + m_fset[2].id = 2102; m_fset[2].value = 1; // collision avoidance = off + m_fset[3].id = 0; + + // Output: + m_segWidth = 947; // physical width of segment + + const int charCnt = 46; // number of characters in the segment + + // need charCnt elements in this array: + bool insPtFlags[] = { + true, true, true, true, true, true, true, true, true, true, + true, true, true, true, true, true, true, true, true, true, + true, true, true, true, true, true, true, true, true, true, + true, true, true, true, true, true, true, true, true, true, + true, true, true, true, true, true + }; + + const int glyphCnt = 46; // number of glyphs in the segment + + // need glyphCnt elements in these arrays: + // 0 10 20 30 40 + gid16 glyphList[] = {59, 70, 71, 65, 59, 70, 71, 23, 32, 175, 70, 65, 55, 70, 73, 55, 175, 184,185, 55, 76, 184,185, 55, 77, 70, 185, 41, 77, 70, 23, 56,175, 65, 27, 93, 70,185, 53, 69, 81, 50, 27,175, 70, 23}; + int xPositions[] = { 0, 82, 47, 72,101, 184,149,174, 206, 281, 283, 251, 283,359, 316, 352, 418, 431,386,425,496, 508,458, 497,559,578, 530, 561, 626, 635,593,626,709, 678, 708, 778,780,740, 780, 853, 819,846,882,942,947,914}; + int yPositions[] = { 0, -3, 0, 0, 0, -3, 0, 0, 0, 0, 22, 0, 0, 0, 0, 0, 0, 9, 0, 0, 2, 20, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, -4, 0, 0, 5, 25, 0, 0, 8, 0, 0, 0, 0, 23, 0}; + int advWidths[] = {47, 0, 24, 29, 47, 0, 24, 32, 44, 0, 0, 29, 33, 0, 36, 33, 0, 0, 26, 33, 0, 0, 26, 33, 0, 0, 26, 32, 0, 0, 32, 52, 0, 29, 32, 0, 0, 26, 39, 0, 26, 36, 32, 0, 0, 32}; + + int bbLefts[] = { 5, 56, 52, 73,106, 158,154,177, 209, 254, 257, 252, 286,333, 322, 355, 391, 420,390,428,466, 497, 462,500,542,552, 534, 564, 609, 609,597,629,682, 679, 711, 747,753,744, 786, 842, 823,851,885,916,921,918}; + int bbRights[] = {72, 82, 63, 97,174, 184,165,211, 277, 281, 283, 276, 349,359, 355, 419, 418, 427,409,491,496, 504, 481,564,555,578, 553, 624, 622, 635,630,684,709, 703, 758, 778,780,763, 837, 850, 842,885,932,942,947,951}; + int bbTops [] = {60, 46, 25, 25, 60, 46, 25, 41, 60, 49, 73, 25, 60, 50, 40, 60, 50, 60, 36, 60, 54, 72, 36, 60, -5, 52, 36, 60, -5, 50, 41, 40, 45, 25, 55, 56, 75, 36, 55, 61, 41, 40, 55, 50, 73, 41}; + int bbBottoms [] = { 0, 31, 0, 0, 0, 31, 0, 0, 0, 34, 57, 0, 0, 35, 0, 0, 34, 46, 0, 0, 37, 57, 0, 0,-27, 36, 0, 0, -27, 35, 0, 0, 29, 0, 0, 40, 60, 0, 0, 45, 0, 0, 0, 34, 58, 0}; + + // Each group = glyph-index, base, number of attached, glyphs, attached-glyph-indices + int attachments[] = { + 0,0,0, 1,2,0, 2,2,1,1, 3,3,0, 4,4,0, 5,6,0, 6,6,1,5, 7,7,0, + 8,8,0, 9,11,0, 10,11,0, 11,11,2,9,10, 12,12,0, 13,14,0, 14,14,1,13, + 15,15,0, 16,18,0, 17,18,0, 18,18,2,16,17, 19,19,0, 20,22,0, 21,22,0, + 22,22,2,20,21, 23,23,0, 24,26,0, 25,26,0, 26,26,2,24,25, 27,27,0, 28,30,0, + 29,30,0, 30,30,2,28,29, 31,31,0, 32,33,0, 33,33,1,32, 34,34,0, 35,37,0, + 36,37,0, 37,37,2,35,36, 38,38,0, 39,40,0, 40,40,1,39, 41,41,0, 42,42,0, + 43,45,0, 44,45,0, 45,45,2,43,44 + }; + int attCount = sizeof(attachments) / sizeof(int); + + // Each line in clickStuff represents one click test with the following items: + // click x-coord, click y-coord, char index, assoc-prev, + // prim sel top, prim sel bottom, prim sel left, + // sec sel top, sec sel bottom, sec sel left + // Y-coordinates are offsets from segment top; ie, (0,0) is segment top-left. + const int clickTestCnt = 4; + int clickStuff[] = { + 55, 40, 2, false, 35, 65, 49, 14, 39, 82, + 65, 20, 1, false, 0,100, 50, kAbsent, kAbsent, kAbsent, + 95, 84, 4, true, 0,100, 100, kAbsent, kAbsent, kAbsent, + 104, 40, 4, false, 0,100, 100, kAbsent, kAbsent, kAbsent + }; + + // Finish setting up test case. + SetCharCount(charCnt); + SetGlyphCount(glyphCnt); + SetGlyphList(glyphList); + SetXPositions(xPositions); + SetYPositions(yPositions); + SetAdvWidths(advWidths); + SetBBs(bbLefts, bbRights, bbTops, bbBottoms); + SetInsPtFlags(insPtFlags); + SetAttachedClusters(attachments, attCount); + SetClickTests(clickTestCnt, clickStuff); +} + +std::wstring TestCase::TaiVietText() +{ + std::wstring strRet; + wchar_t charData[] = { + 0xe00f,0xe042,0xe031,0xe02b,0xe00f,0xe042,0xe031,0xe025,0xe021,0xe033, + 0xe042,0xe02b,0xe01c,0xe042,0xe03e,0xe01c,0xe033,0xe040,0xe009,0xe01c, + 0xe039,0xe040,0xe009,0xe01c,0xe035,0xe042,0xe009,0xe024,0xe035,0xe042, + 0xe025,0xe01b,0xe033,0xe02b,0xe00a,0xe030,0xe042,0xe009,0xe01e,0xe040, + 0xe03b,0xe019,0xe00a,0xe033,0xe042,0xe025,0x0000 + }; + strRet.assign(charData); + return strRet; +} + +/*---------------------------------------------------------------------------------------------- + A set of tests that uses the new Burmese encoding, specifically to test rules that + calculate the "position" slot attribute on attached glyphs...tricky stuff. +----------------------------------------------------------------------------------------------*/ +void TestCase::SetupBurmesePositioning1() +{ + m_testName = "Burmese Positioning LineBreakSeg"; + //m_debug = true; + //m_traceLog = true; + //m_skip = true; + + // Input: + m_fontName = L"Graphite Test Burmese Two"; + m_fontFile = "grtest_burmese2.ttf"; + m_fontSize = 36; // font size in points + m_prefBreak = klbWordBreak; // preferred break-weight--irrelevant + m_availWidth = 2000; // width available for segment--make a LineBreakSegment + m_bold = false; + m_italic = false; + m_rtl = false; + m_backtrack = false; + m_text = BurmesePositioningText(); + + // Output: + m_segWidth = 193; // physical width of segment + + const int charCnt = 12; // number of characters in the segment + + // need charCnt elements in this array: + bool insPtFlags[] = { + true, false, false, false, true, true, true, true, true, false, + true, true, true + }; + + const int glyphCnt = 11; // number of glyphs in the segment + + // need glyphCnt elements in these arrays: + // 0 10 20 30 40 + gid16 glyphList[] = {169,239,213,219,230, 99, 3,238, 99, 205, 220}; + int xPositions[] = { 0, 43, 44, 51, 53, 61,108,125, 133, 178, 180}; + int yPositions[] = { 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0}; + int advWidths[] = { 46, 9, 0, 0, 55, 46, 17, 55, 46, 0, 12}; + + int bbLefts[] = { 2, 24, 26, 44, 56, 63,108,129, 136, 159, 183}; + int bbRights[] = { 43, 41, 41, 51,105,105,125,178, 178, 175, 190}; + int bbTops [] = { 21, -3, 39, -7, 44, 21, 0, 44, 21, 42, 21}; + int bbBottoms [] = { 0,-21, 26,-14,-21, 0, 0,-21, 0, 25, 0}; + + // Each group = glyph-index, base, number of attached glyphs, attached-glyph-indices + int attachments[] = { + 0,0,3,1,2,3, 1,0,0, 2,0,0, 3,0,0, 4,4,1,5, 5,4,0, 6,6,0, + 7,7,2,8,9, 8,7,0, 9,7,0, 10,10,0 + }; + int attCount = sizeof(attachments) / sizeof(int); + + // Finish setting up test case. + SetCharCount(charCnt); + SetGlyphCount(glyphCnt); + SetGlyphList(glyphList); + SetXPositions(xPositions); + SetYPositions(yPositions); + SetAdvWidths(advWidths); + SetBBs(bbLefts, bbRights, bbTops, bbBottoms); + SetInsPtFlags(insPtFlags); + SetAttachedClusters(attachments, attCount); +// SetClickTests(clickTestCnt, clickStuff); +} + +void TestCase::SetupBurmesePositioning2() +{ + m_testName = "Burmese Positioning RangeSeg"; + //m_debug = true; + //m_traceLog = true; + //m_skip = true; + + // Input: + m_fontName = L"Graphite Test Burmese Two"; + m_fontFile = "grtest_burmese2.ttf"; + m_fontSize = 36; // font size in points + m_prefBreak = klbWordBreak; // preferred break-weight--irrelevant + m_availWidth = 10000; // width available for segment--make a RangeSegment + m_bold = false; + m_italic = false; + m_rtl = false; + m_backtrack = false; + m_text = BurmesePositioningText(); + + // Output: + m_segWidth = 193; // physical width of segment + + const int charCnt = 12; // number of characters in the segment + + // need charCnt elements in this array: + bool insPtFlags[] = { + true, false, false, false, true, true, true, true, true, false, + true, true, true + }; + + const int glyphCnt = 11; // number of glyphs in the segment + + // need glyphCnt elements in these arrays: + // 0 10 20 30 40 + gid16 glyphList[] = {169,239,213,219,230, 99, 3,238, 99, 205, 220}; + int xPositions[] = { 0, 43, 44, 51, 53, 61,108,125, 133, 178, 180}; + int yPositions[] = { 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0}; + int advWidths[] = { 46, 9, 0, 0, 55, 46, 17, 55, 46, 0, 12}; + + int bbLefts[] = { 2, 24, 26, 44, 56, 63,108,129, 136, 159, 183}; + int bbRights[] = { 43, 41, 41, 51,105,105,125,178, 178, 175, 190}; + int bbTops [] = { 21, -3, 39, -7, 44, 21, 0, 44, 21, 42, 21}; + int bbBottoms [] = { 0,-21, 26,-14,-21, 0, 0,-21, 0, 25, 0}; + + // Each group = glyph-index, base, number of attached glyphs, attached-glyph-indices + int attachments[] = { + 0,0,3,1,2,3, 1,0,0, 2,0,0, 3,0,0, 4,4,1,5, 5,4,0, 6,6,0, + 7,7,2,8,9, 8,7,0, 9,7,0, 10,10,0 + }; + int attCount = sizeof(attachments) / sizeof(int); + + // Finish setting up test case. + SetCharCount(charCnt); + SetGlyphCount(glyphCnt); + SetGlyphList(glyphList); + SetXPositions(xPositions); + SetYPositions(yPositions); + SetAdvWidths(advWidths); + SetBBs(bbLefts, bbRights, bbTops, bbBottoms); + SetInsPtFlags(insPtFlags); + SetAttachedClusters(attachments, attCount); +// SetClickTests(clickTestCnt, clickStuff); +} + + +std::wstring TestCase::BurmesePositioningText() +{ + std::wstring strRet; + wchar_t charData[] = { + 0x1018,0x103d,0x1032,0x1037,0x1000,0x103c,0x0020,0x1000,0x103c,0x102d, + 0x102f,0x1038,0x0000 + }; + strRet.assign(charData); + return strRet; +} + +/*---------------------------------------------------------------------------------------------- + Test pass constraints. +----------------------------------------------------------------------------------------------*/ +void TestCase::SetupBurmeseFeature1() +{ + m_testName = "Burmese Pass Constraint Fails"; + //m_debug = true; + //m_traceLog = true; + //m_skip = true; + + // Note: this font has the table rule-version set very high (8.0) in order to test the + // CheckRuleValidity routine. + + // Input: + m_fontName = L"Graphite Test Burmese Three"; + m_fontFile = "grtest_burmese3.ttf"; + m_fontSize = 36; // font size in points + m_prefBreak = klbWordBreak; // preferred break-weight--irrelevant + m_availWidth = 2000; // width available for segment--make a LineBreakSegment + m_bold = false; + m_italic = false; + m_rtl = false; + m_backtrack = false; + m_text = BurmeseFeatureText(); + + m_fset[0].id = 0x646F7463; m_fset[0].value = 0; // 0x646F7463 = "dotc" + m_fset[1].id = 0; + + // Output: + m_segWidth = 147; // physical width of segment + + const int charCnt = 7; // number of characters in the segment + + // need charCnt elements in this array: + bool insPtFlags[] = { + true, true, true, true, true, true, true + }; + + const int glyphCnt = 7; // number of glyphs in the segment + + // need glyphCnt elements in these arrays: + gid16 glyphList[] = {180, 3,210,137, 3,213,156}; + int xPositions[] = { 0, 45, 62, 76,103,120,120}; + int yPositions[] = { 0, 0, 0, 0, 0, 0, 0}; + int advWidths[] = { 45, 17, 13, 26, 17, 0, 27}; + + int bbLefts[] = { 2, 45, 64, 79,103,103,123}; + int bbRights[] = { 42, 62, 77,100,120,118,145}; + int bbTops [] = { 21, 0, 20, 21, 0, 41, 21}; + int bbBottoms [] = { 0, 0,-21,-21, 0, 28, 0}; + + // Each group = glyph-index, base, number of attached glyphs, attached-glyph-indices + int attachments[] = { + 0,0,0, 1,1,0, 2,2,0, 3,3,0 + }; + int attCount = sizeof(attachments) / sizeof(int); + + // Finish setting up test case. + SetCharCount(charCnt); + SetGlyphCount(glyphCnt); + SetGlyphList(glyphList); + SetXPositions(xPositions); + SetYPositions(yPositions); + SetAdvWidths(advWidths); + SetBBs(bbLefts, bbRights, bbTops, bbBottoms); + SetInsPtFlags(insPtFlags); + SetAttachedClusters(attachments, attCount); +// SetClickTests(clickTestCnt, clickStuff); +} + +void TestCase::SetupBurmeseFeature2() +{ + m_testName = "Burmese Pass Constraint Succeeds"; + //m_debug = true; + //m_traceLog = true; + //m_skip = true; + + // Note: this font has the table rule-version set very high (8.0) in order to test the + // CheckRuleValidity routine. + + // Input: + m_fontName = L"Graphite Test Burmese Three"; + m_fontFile = "grtest_burmese3.ttf"; + m_fontSize = 36; // font size in points + m_prefBreak = klbWordBreak; // preferred break-weight--irrelevant + m_availWidth = 2000; // width available for segment--make a LineBreakSegment + m_bold = false; + m_italic = false; + m_rtl = false; + m_backtrack = false; + m_text = BurmeseFeatureText(); + + m_fset[0].id = 0x646F7463; m_fset[0].value = 1; // 0x646F7463 = "dotc" + m_fset[1].id = 0; + + // Output: + m_segWidth = 193; // physical width of segment + + const int charCnt = 7; // number of characters in the segment + + // need charCnt elements in this array: + bool insPtFlags[] = { + true, true, true, true, true, true, true + }; + + const int glyphCnt = 9; // number of glyphs in the segment + + // need glyphCnt elements in these arrays: + gid16 glyphList[] = {180, 3,361,211,137, 3,361,213,156}; + int xPositions[] = { 0, 45, 62, 84, 92,119,136,163,166}; + int yPositions[] = { 0, 0, 0, 0, 0, 0, 0, -1, 0}; + int advWidths[] = { 45, 17, 29, 0, 26, 17, 29, 0, 27}; + + int bbLefts[] = { 2, 45, 65, 72, 95,119,139,145,169}; + int bbRights[] = { 42, 62, 89, 86,116,136,164,160,191}; + int bbTops [] = { 21, 0, 23, -4, 21, 0, 23, 39, 21}; + int bbBottoms [] = { 0, 0, -1,-21,-21, 0, -1, 26, 0}; + + // Each group = glyph-index, base, number of attached glyphs, attached-glyph-indices + int attachments[] = { + 0,0,0, 1,1,0, 2,2,1,3, 3,2,0, 4,4,0, 5,5,0 + }; + int attCount = sizeof(attachments) / sizeof(int); + + // Finish setting up test case. + SetCharCount(charCnt); + SetGlyphCount(glyphCnt); + SetGlyphList(glyphList); + SetXPositions(xPositions); + SetYPositions(yPositions); + SetAdvWidths(advWidths); + SetBBs(bbLefts, bbRights, bbTops, bbBottoms); + SetInsPtFlags(insPtFlags); + SetAttachedClusters(attachments, attCount); +// SetClickTests(clickTestCnt, clickStuff); +} + +std::wstring TestCase::BurmeseFeatureText() +{ + std::wstring strRet; + wchar_t charData[] = { + 0x101c,0x0020,0x1030,0x100c,0x0020,0x1032,0x1013,0x0000 + }; + strRet.assign(charData); + return strRet; +} + + +/*---------------------------------------------------------------------------------------------- + Another pass constraint test. +----------------------------------------------------------------------------------------------*/ +void TestCase::SetupCharisPConstraint() +{ + m_testName = "Charis PConstraint"; + //m_debug = true; + //m_traceLog = true; + //m_skip = true; + + // Input: + m_fontName = L"Graphite Text Charis PConstr"; + m_fontFile = "grtest_pconstraints.ttf"; + m_fontSize = 20; // font size in points + m_prefBreak = klbWordBreak; // preferred break-weight + m_availWidth = 2000; // width available for segment + m_bold = false; + m_italic = false; + m_rtl = false; + m_backtrack = false; + wchar_t charData[] = { + 0x0073,0x0061,0x0067,0x0065,0x0000 + }; + m_text.assign(charData); + + m_fset[0].id = 1032; m_fset[0].value = 1; // 1032 = literacy alternates + m_fset[1].id = 0; + + // Output: + m_segWidth = 53; // physical width of segment + + const int charCnt = 4; // number of characters in the segment + + // need charCnt elements in this array: + bool insPtFlags[] = { + true, true, true, true + }; + + const int glyphCnt = 4; // number of glyphs in the segment + + gid16 glyphList[] = { 86,320,1056, 72}; + int xPositions[] = { 0, 10, 25, 40}; + int yPositions[] = { 0, 0, 0, 0}; + int advWidths[] = { 10, 15, 14, 13}; + + int bbLefts[] = { 0, 11, 26, 41}; + int bbRights[] = { 9, 24, 38, 52}; + int bbTops [] = { 13, 13, 13, 13}; + int bbBottoms [] = { 0, 0, -6, 0}; + + // Each group = glyph-index, base, number of attached glyphs, attached-glyph-indices + int attachments[] = { + 0,0,0, 1,1,0, 2,2,0, 3,3,0 + }; + int attCount = sizeof(attachments) / sizeof(int); + + // Finish setting up test case. + SetCharCount(charCnt); + SetGlyphCount(glyphCnt); + SetGlyphList(glyphList); + SetXPositions(xPositions); + SetYPositions(yPositions); + SetAdvWidths(advWidths); + SetBBs(bbLefts, bbRights, bbTops, bbBottoms); + SetInsPtFlags(insPtFlags); + SetAttachedClusters(attachments, attCount); +// SetClickTests(clickTestCnt, clickStuff); + +} + +/*---------------------------------------------------------------------------------------------- + A set of tests that uses Devanagari script. +----------------------------------------------------------------------------------------------*/ +void TestCase::SetupDevanagari() +{ + m_testName = "Devanagari 1"; + //m_debug = true; + //m_traceLog = true; + //m_skip = true; + + // Input: + m_fontName = L"Graphite Test Devanagari"; + m_fontFile = "grtest_devanagari.ttf"; + m_fontSize = 36; // font size in points + m_prefBreak = klbWordBreak; // preferred break-weight + m_availWidth = 340; // width available for segment + m_bold = false; + m_italic = false; + m_rtl = false; + m_backtrack = false; + m_text = DevanagariText(); + + //m_fset[0].id = 2001; m_fset[0].value = 2; // vowel position = final consonant + //m_fset[1].id = 1051; m_fset[1].value = 1; // diacritic selection = on + //m_fset[2].id = 2102; m_fset[2].value = 1; // collision avoidance = off + //m_fset[3].id = 0; + + // Output: + m_segWidth = 336; // physical width of segment + + const int charCnt = 35; // number of characters in the segment (line break happened) + + // need charCnt elements in this array: + bool insPtFlags[] = { + true, false, true, true, true, false, true, true, true, true, + true, true, true, true, true, true, true, false, true, true, + false, true, true, true, false, true, false, true, true, true, + true, false, true, true + }; + + const int glyphCnt = 23; // number of glyphs in the segment + + // need glyphCnt elements in these arrays: + // 0 10 19 + gid16 glyphList[] = {740, 3,622,655,656,809,304,622, 3,304,474,280, 3,526,303,654, 3,725,301, 3,699,328, 3}; + int xPositions[] = { 0, 30, 44, 65, 70, 71, 71, 84,110,125,138,167,168,182,217,232,232,247,272,285,299,320,336}; + int yPositions[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, -4, 0}; + int advWidths[] = { 30, 14, 26, 0, 0, 0, 13, 26, 14, 13, 26, 0, 14, 34, 13, 0, 14, 25, 13, 14, 36, 0, 14}; + + int bbLefts[] = { -2, 30, 42, 54, 58, 71, 69, 82,110,123,136,149,168,186,204,221,232,245,260,285,297,308,336}; + int bbRights[] = { 32, 44, 73, 72, 69, 71, 97,112,125,150,166,167,182,219,236,225,247,274,287,299,338,330,350}; + int bbTops [] = { 30, 0, 30, -2, 45, 0, 42, 30, 0, 42, 30, 46, 0, 31, 45, -4, 0, 30, 45, 0, 30, -5, 0}; + int bbBottoms [] = {-11, 0, -2,-15, 30, 0, 0, -2, 0, 0, 0, 34, 0, 0, 0, -8, 0,-10, 0, 0, -4,-19, 0}; + + // Each group = glyph-index, base, number of attached, glyphs, attached-glyph-indices + int attachments[] = { + 0,0,0, 1,1,0, 2,2,2,3,4, 3,2,0, 4,2,0, 5,5,0, 6,6,0, 7,7,0, + 8,8,0, 9,9,0, 10,10,1,11, 11,10,0, 12,12,0, 13,13,0, 14,14,1,15, 15,14,0, + 16,16,0, 17,17,0, 18,18,0, 19,19,0, 20,20,1,21, 21,20,0, 22,22,0 + }; + int attCount = sizeof(attachments) / sizeof(int); + + // Each group = char-index, number of glyphs, glyph-indices. + int charsToGlyphs[] = { + 0, 1, 0, 1, 1, 0, 2, 1, 0, 3, 1, 1, 4, 1, 4, 5, 1, 4, 6, 1, 2, 7, 1, 3, 8, 1, 5, + 9, 1, 7, 10, 1, 6, 11, 1, 8, 12, 1, 10, 13, 1, 9, 14, 1, 11, 15, 1, 12, 16, 1, 14, 17, 1, 14, + 18, 1, 13, 19, 1, 14, 20, 1, 15, 21, 1, 14, 22, 1, 16, 23, 1, 18, 24, 1, 18, 25, 1, 17, 26, 1, 17, + 27, 1, 17, 28, 1, 18, 29, 1, 19, 30, 1, 20, 31, 1, 20, 32, 1, 20, 33, 1, 21, 34, 1, 22 + }; + int c2gCount = sizeof(charsToGlyphs) / sizeof(int); + + // Each line in clickStuff represents one click test with the following items: + // click x-coord, click y-coord, char index, assoc-prev, + // prim sel top, prim sel bottom, prim sel left, + // sec sel top, sec sel bottom, sec sel left + // Y-coordinates are offsets from segment top; ie, (0,0) is segment top-left. + // TODO: fix these + const int clickTestCnt = 3; + int clickStuff[] = { + 333, 14, 32, true, 13, 33, 332, 32, 50,299, // top half of ligature + 311, 40, 32, false, 30, 50, 298, 13, 32,334, // bottom half of ligature + 311, 61, 33, false, 46, 66, 305, 32, 50,334 // lower attached ukar + }; + + // Finish setting up test case. + SetCharCount(charCnt); + SetGlyphCount(glyphCnt); + SetGlyphList(glyphList); + SetXPositions(xPositions); + SetYPositions(yPositions); + SetAdvWidths(advWidths); + SetBBs(bbLefts, bbRights, bbTops, bbBottoms); + SetInsPtFlags(insPtFlags); + SetAttachedClusters(attachments, attCount); + SetCharsToGlyphs(charsToGlyphs, c2gCount); + SetClickTests(clickTestCnt, clickStuff); +} + +std::wstring TestCase::DevanagariText() +{ + std::wstring strRet; + wchar_t charData[] = { + 0x092e,0x094d,0x0932,0x0020,0x0930,0x094d,0x0939,0x094d,0x200c,0x0939, + 0x093f,0x0020,0x091f,0x093f,0x0901,0x0020,0x0930,0x094d,0x0927,0x094c, + 0x093c,0x0901,0x0020,0x0930,0x094d,0x091f,0x094d,0x0920,0x094c,0x0020, + 0x0915,0x094d,0x0915,0x0942,0x0020,0x0921,0x093f,0x0000 + + }; + strRet.assign(charData); + return strRet; +} + +/*---------------------------------------------------------------------------------------------- + Test kerning that uses a large number of glyph attributes and therefore needs version 2 + of the Glat table. +----------------------------------------------------------------------------------------------*/ +void TestCase::SetupKernGlat2() +{ + m_testName = "Kern Glat2"; + //m_debug = true; + //m_traceLog = true; + //m_skip = true; + + // Input: + m_fontName = L"Graphite Test Kern Glat2"; + m_fontFile = "grtest_kernglat2.ttf"; + m_fontSize = 36; // font size in points + m_prefBreak = klbWordBreak; // preferred break-weight + m_availWidth = 1000; // width available for segment + m_bold = false; + m_italic = false; + m_rtl = false; + m_backtrack = false; + m_text = L"ch AW ox"; // text to render + + // Output: + m_segWidth = 181; // physical width of segment + + const int charCnt = 8; // number of characters in the segment + + // need charCnt elements in this array: + bool insPtFlags[] = { + true, true, true, true, true, true, true, true + }; + + const int glyphCnt = 8; // number of glyphs in the segment + + // need glyphCnt elements in these arrays: + gid16 glyphList[] = { 70, 75, 3, 36, 58, 3, 82, 91}; + int xPositions[] = { 0, 20, 46, 57, 83,123,134,157}; + int yPositions[] = { 0, 0, 0, 0, 0, 0, 0, 0}; + int advWidths[] = { 20, 25, 10, 28, 37, 10, 24, 23}; + + int bbLefts[] = { 1, 21, 46, 57, 83,123,136,158}; + int bbRights[] = { 19, 46, 57, 85,122,134,156,181}; + int bbTops [] = { 22, 36, 0, 30, 29, 0, 22, 21}; + int bbBottoms [] = { 0, 0, 0, 0, 0, 0, 0, 0}; + + // These tests are not particularly relevant: + + // Each group = glyph-index, base, number of attached, glyphs, attached-glyph-indices + //int attachments[] = { + // 0,0,0, 1,1,0, 2,2,2,3,4, 3,2,0, 4,2,0, 5,5,0, 6,6,0, 7,7,0, + // 8,8,0, 9,9,0, 10,10,1,11, 11,10,0, 12,12,0, 13,13,0, 14,14,1,15, 15,14,0, + // 16,16,0, 17,17,0, 18,18,0, 19,19,0, 20,20,1,21, 21,20,0, 22,22,0 + //}; + //int attCount = sizeof(attachments) / sizeof(int); + + // Each group = char-index, number of glyphs, glyph-indices. + //int charsToGlyphs[] = { + // 0, 1, 0, 1, 1, 0, 2, 1, 0, 3, 1, 1, 4, 1, 4, 5, 1, 4, 6, 1, 2, 7, 1, 3, 8, 1, 5, + // 9, 1, 7, 10, 1, 6, 11, 1, 8, 12, 1, 10, 13, 1, 9, 14, 1, 11, 15, 1, 12, 16, 1, 14, 17, 1, 14, + // 18, 1, 13, 19, 1, 14, 20, 1, 15, 21, 1, 14, 22, 1, 16, 23, 1, 18, 24, 1, 18, 25, 1, 17, 26, 1, 17, + // 27, 1, 17, 28, 1, 18, 29, 1, 19, 30, 1, 20, 31, 1, 20, 32, 1, 20, 33, 1, 21, 34, 1, 22 + //}; + //int c2gCount = sizeof(charsToGlyphs) / sizeof(int); + + // Each line in clickStuff represents one click test with the following items: + // click x-coord, click y-coord, char index, assoc-prev, + // prim sel top, prim sel bottom, prim sel left, + // sec sel top, sec sel bottom, sec sel left + // Y-coordinates are offsets from segment top; ie, (0,0) is segment top-left. + // TODO: fix these + //const int clickTestCnt = 3; + //int clickStuff[] = { + // 333, 14, 32, true, 13, 33, 332, 32, 50,299, // top half of ligature + // 311, 40, 32, false, 30, 50, 298, 13, 32,334, // bottom half of ligature + // 311, 61, 33, false, 46, 66, 305, 32, 50,334 // lower attached ukar + //}; + + // Finish setting up test case. + SetCharCount(charCnt); + SetGlyphCount(glyphCnt); + SetGlyphList(glyphList); + SetXPositions(xPositions); + SetYPositions(yPositions); + SetAdvWidths(advWidths); + SetBBs(bbLefts, bbRights, bbTops, bbBottoms); + SetInsPtFlags(insPtFlags); +// SetAttachedClusters(attachments, attCount); +// SetCharsToGlyphs(charsToGlyphs, c2gCount); +// SetClickTests(clickTestCnt, clickStuff); +} + +/*---------------------------------------------------------------------------------------------- + Set up a test where the font is bad and we revert to dumb rendering +----------------------------------------------------------------------------------------------*/ +void TestCase::SetupDumbFallback1() +{ + m_testName = "Dumb Fallback 1"; + //m_debug = true; + //m_traceLog = true; + //m_skip = true; + + // Input: + m_fontName = L"GrErr BadVersion"; + m_fontFile = "grtest_badVersion.ttf"; + m_text = RomanText(); // text to render + m_fontSize = 12; // font size in points + m_prefBreak = klbWordBreak; // preferred break-weight + m_availWidth = 500; // width available for segment + m_bold = false; + m_italic = false; + m_rtl = false; + m_backtrack = false; + m_dumbFallback = true; + + // Output: + m_badFont = true; + m_segWidth = 196; // physical width of segment + + const int charCnt = 26; // number of characters in the segment + + // need charCnt elements in this array: + bool insPtFlags[] = { + true, true, true, true, true, true, true, true, true, true, + true, true, true, true, true, true, true, true, true, true, + true, true, true, true, true, true + }; + + const int glyphCnt = 26; // number of glyphs in the segment + + // need glyphCnt elements in these arrays: + // 0 10 20 + gid16 glyphList[] = {71, 0, 0, 82, 0, 85, 73, 0, 0, 0, 0, 67, 0, 0, 75, 0, 43, 0, 79, 0, 0, 0, 0, 72, 72, 75}; + int xPositions[] = { 0, 7, 15, 23, 31, 39, 46, 54, 62, 70, 78, 86, 93,101,109,114,122,128,136,149,157,165,173,181,186,192}; + int yPositions[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + int advWidths[] = { 7, 8, 8, 8, 8, 6, 8, 8, 8, 8, 8, 7, 8, 8, 4, 8, 5, 8, 12, 8, 8, 8, 8, 5, 5, 4}; + + const int clickTestCnt = 0; + int * clickStuff = NULL; + + // Finish setting up test case. + SetCharCount(charCnt); + SetGlyphCount(glyphCnt); + SetGlyphList(glyphList); + SetXPositions(xPositions); + SetYPositions(yPositions); + SetAdvWidths(advWidths); + SetBBs(NULL, NULL, NULL, NULL); + SetInsPtFlags(insPtFlags); + SetClickTests(clickTestCnt, clickStuff); +} + +/*---------------------------------------------------------------------------------------------- + Now make sure we will get a crash when we turn dumb rendering off for the same font. +----------------------------------------------------------------------------------------------*/ +void TestCase::SetupDumbFallback2() +{ + m_testName = "Dumb Fallback 2"; + //m_debug = true; + //m_traceLog = true; + //m_skip = true; + + // Input: + m_fontName = L"GrErr BadVersion"; + m_fontFile = "grtest_badVersion.ttf"; + m_text = L"This is a test."; // text to render + m_fontSize = 12; // font size in points + m_prefBreak = klbWordBreak; // preferred break-weight + m_availWidth = 500; // width available for segment + m_bold = false; + m_italic = false; + m_rtl = false; + m_backtrack = false; + m_dumbFallback = false; + + // Output: + m_badFont = true; + m_noSegment = true; + m_segWidth = 0; // physical width of segment + + const int charCnt = 0; // number of characters in the segment + + const int glyphCnt = 0; // number of glyphs in the segment + + // Finish setting up test case. + SetCharCount(charCnt); + SetGlyphCount(glyphCnt); +} + +/*---------------------------------------------------------------------------------------------- + Now make sure we will get a crash when we turn dumb rendering off for the same font. + Also produces a memory leak. +----------------------------------------------------------------------------------------------*/ +void TestCase::SetupBadFont() +{ + m_testName = "Bad Font"; + //m_debug = true; + //m_traceLog = true; + m_skip = true; ///////////////////////// + + // Input: + // The font has been corrupted so that the size of the cmap in the directory is invalid. + m_fontName = L"Graphite Test Roman"; + m_fontFile = "grtest_badCmap.ttf"; + m_text = L"This is a test."; // text to render + m_fontSize = 12; // font size in points + m_prefBreak = klbWordBreak; // preferred break-weight + m_availWidth = 500; // width available for segment + m_bold = false; + m_italic = false; + m_rtl = false; + m_backtrack = false; + m_dumbFallback = true; // wants to do dumb fall-back, but can't because the font is totally invalid + + // Output: + m_badFont = true; + m_noSegment = true; + m_segWidth = 0; // physical width of segment + + const int charCnt = 0; // number of characters in the segment + + const int glyphCnt = 0; // number of glyphs in the segment + + // Finish setting up test case. + SetCharCount(charCnt); + SetGlyphCount(glyphCnt); +} +// *** Add more methods here. *** + + +//:>******************************************************************************************** +//:> Utility methods. +//:>******************************************************************************************** + +/*---------------------------------------------------------------------------------------------- + Delete the list of tests. +----------------------------------------------------------------------------------------------*/ +void TestCase::DeleteTests() +{ + delete[] g_ptcaseList; +} + +/*---------------------------------------------------------------------------------------------- + Constructor: initialize test case with default values. +----------------------------------------------------------------------------------------------*/ +TestCase::TestCase() +{ + m_testName = "Unknown"; + m_debug = false; + m_traceLog = false; + m_skip = false; + + m_fontName.erase(); + m_fontFile.erase(); + m_text.erase(); // text to render + m_fontSize = 12; // font size in points + m_prefBreak = klbWordBreak; // preferred break-weight + m_worstBreak = klbClipBreak; // worst-case break-weight + m_availWidth = 500; // width available for segment + m_bold = false; + m_italic = false; + m_backtrack = false; + m_twsh = ktwshAll; + m_paraRtl = false; + m_firstChar = 0; + m_contextBlockInSize = 0; + m_contextBlockIn = NULL; + m_initWithPrev = false; + memset(m_fset, 0, MAXFEAT * sizeof(FeatureSetting)); + m_dumbFallback = true; + + m_badFont = false; + m_noSegment = false; // yes, a segment should be generated + m_charCount = 0; + m_glyphCount = 0; + m_glyphArray = NULL; + m_xPositions = NULL; + m_yPositions = NULL; + m_advWidths = NULL; + m_bbLefts = NULL; + m_bbRights = NULL; + m_bbTops = NULL; + m_bbBottoms = NULL; + m_insPointFlags = NULL; + m_charsToGlyphs = NULL; + m_c2gCount = 0; + m_attGlyphs = NULL; + m_attGCount = 0; + m_contextBlockOutSize = 0; + m_contextBlockOut = NULL; + + m_clickTestCount = 0; + m_clickTests = NULL; +} + +/*---------------------------------------------------------------------------------------------- + Destructor. +----------------------------------------------------------------------------------------------*/ +TestCase::~TestCase() +{ + delete[] m_glyphArray; + delete[] m_xPositions; + delete[] m_yPositions; + delete[] m_advWidths; + delete[] m_bbLefts; + delete[] m_bbRights; + delete[] m_bbTops; + delete[] m_bbBottoms; + delete[] m_insPointFlags; + delete[] m_charsToGlyphs; + delete[] m_attGlyphs; + delete[] m_clickTests; + delete[] m_contextBlockIn; + delete[] m_contextBlockOut; +} + +/*---------------------------------------------------------------------------------------------- + Setters. +----------------------------------------------------------------------------------------------*/ +void TestCase::SetCharCount(int charCount) +{ + m_charCount = charCount; + m_insPointFlags = new bool[charCount]; +} + +void TestCase::SetGlyphCount(int glyphCount) +{ + m_glyphCount = glyphCount; + m_glyphArray = new gid16[glyphCount]; + m_xPositions = new int[glyphCount]; + m_yPositions = new int[glyphCount]; + m_advWidths = new int[glyphCount]; + m_bbLefts = new int[glyphCount]; + m_bbRights = new int[glyphCount]; + m_bbTops = new int[glyphCount]; + m_bbBottoms = new int[glyphCount]; +} + +void TestCase::SetGlyphList(gid16 * glyphList) +{ + for (int i = 0; i < m_glyphCount; i++) + m_glyphArray[i] = glyphList[i]; +} + +void TestCase::SetXPositions(int * xPosList) +{ + for (int i = 0; i < m_glyphCount; i++) + m_xPositions[i] = xPosList[i]; +} + +void TestCase::SetYPositions(int * yPosList) +{ + for (int i = 0; i < m_glyphCount; i++) + m_yPositions[i] = yPosList[i]; +} + +void TestCase::SetAdvWidths(int * advWidths) +{ + for (int i = 0; i < m_glyphCount; i++) + m_advWidths[i] = advWidths[i]; +} + +void TestCase::SetBBs(int * bbLefts, int * bbRights, int * bbTops, int * bbBottoms) +{ + if (bbLefts == NULL) // no bb tests + { + delete[] m_bbLefts; + delete[] m_bbRights; + delete[] m_bbTops; + delete[] m_bbBottoms; + m_bbLefts = NULL; + m_bbRights = NULL; + m_bbTops = NULL; + m_bbBottoms = NULL; + return; + } + + for (int i = 0; i < m_glyphCount; i++) + { + m_bbLefts[i] = bbLefts[i]; + m_bbRights[i] = bbRights[i]; + m_bbTops[i] = bbTops[i]; + m_bbBottoms[i] = bbBottoms[i]; + } +} + +void TestCase::SetInsPtFlags(bool * flags) +{ + for (int i = 0; i < m_charCount; i++) + m_insPointFlags[i] = flags[i]; +} + +void TestCase::SetCharsToGlyphs(int * stuff, int count) +{ + m_c2gCount = count; + m_charsToGlyphs = new int[count]; + for (int i = 0; i < count; i++) + m_charsToGlyphs[i] = stuff[i]; +} + +void TestCase::SetAttachedClusters(int * stuff, int count) +{ + m_attGCount = count; + m_attGlyphs = new int[count]; + for (int i = 0; i < count; i++) + m_attGlyphs[i] = stuff[i]; +} + +const int ClickTest::fieldCnt; +void TestCase::SetClickTests(int clickTestCount, int * clickStuff) +{ + const int fc = ClickTest::fieldCnt; + + m_clickTestCount = clickTestCount; + m_clickTests = new ClickTest[clickTestCount]; + for (int i = 0; i < clickTestCount; i++) + { + m_clickTests[i].xClick = clickStuff[(i * fc) + 0]; + m_clickTests[i].yClick = clickStuff[(i * fc) + 1]; + m_clickTests[i].charIndex = clickStuff[(i * fc) + 2]; + m_clickTests[i].assocPrev = clickStuff[(i * fc) + 3]; + m_clickTests[i].sel1Top = clickStuff[(i * fc) + 4]; + m_clickTests[i].sel1Bottom = clickStuff[(i * fc) + 5]; + m_clickTests[i].sel1Left = clickStuff[(i * fc) + 6]; + m_clickTests[i].sel2Top = clickStuff[(i * fc) + 7]; + m_clickTests[i].sel2Bottom = clickStuff[(i * fc) + 8]; + m_clickTests[i].sel2Left = clickStuff[(i * fc) + 9]; + } +} + +void TestCase::SetInputContextBlock(int contextBlockInSize, gr::byte * pContextBlockIn) +{ + m_contextBlockInSize = contextBlockInSize; + if (contextBlockInSize == 0) + { + m_contextBlockIn = NULL; + } + else + { + m_contextBlockIn = new gr::byte[contextBlockInSize]; + std::copy(pContextBlockIn, pContextBlockIn + contextBlockInSize, m_contextBlockIn); + } +} + +void TestCase::SetOutputContextBlock(int contextBlockOutSize, gr::byte * pContextBlockOut) +{ + m_contextBlockOutSize = contextBlockOutSize; + m_contextBlockOut = new gr::byte[contextBlockOutSize]; + std::copy(pContextBlockOut, pContextBlockOut + contextBlockOutSize, m_contextBlockOut); +} + + +/****************************************************************************/ + +// Temporary methods for testing bugs. + +void TestCase::SetupBugTest() +{ + m_testName = "Bug Test"; + m_traceLog = true; + m_debug = true; + m_skip = false; + + // Input: + //m_fontName = L"Padauk"; + //m_fontFile = "grtest_infinity.ttf"; + //wchar_t charData[] = { 0x101e, 0x1032, 0x1015, 0x103c, 0x103d, 0x103e, 0x102d, 0x1038, 0x0000 }; + //m_text.assign(charData); + //int charCnt = 8; + + m_fontName = L"SILDoulos Kern Test Temp"; + ///m_fontFile = "kern_temp_gr.ttf"; + m_fontFile = "kern_glat2_gr.ttf"; + wchar_t charData[] = { + 0x003E, 0x0061, // >a + 0x003E, 0x003E, 0x003E, 0x0062, // >>>b + 0x003C, 0x0063, // >B + 0x0000 }; + m_text.assign(charData); + int charCnt = 14; + + m_fontSize = 20; // font size in points + m_prefBreak = klbWsBreak; // preferred break-weight + m_worstBreak = klbHyphenBreak; // worst-case break-weight + m_availWidth = 1000; // width available for segment + m_bold = false; + m_italic = false; + m_backtrack = false; + m_rtl = false; + + // Output: + m_noSegment = false; + m_segWidth = 52; // physical width of segment + + // need charCnt elements in this array: + bool insPtFlags[] = { + true, false, true, true, false, false, false, true + }; + + int glyphCnt = 7; + // need glyphCnt elements in these arrays: + gid16 glyphList[] = {105,174,158,202,231,162,231}; + int xPositions[] = { 0, 17, 20, 22, 28, 29, 38}; + int yPositions[] = { 0, 0, 0, 0, 0, 0, 0}; + int advWidths[] = { 17, 2, 9, 4, 0, 10, 0}; + + int bbLefts[] = { 0, 10, 21, 23, 23, 30, 33}; + int bbRights[] = { 16, 19, 28, 25, 28, 39, 38}; + int bbTops[] = { 7, 7, 7, -1, 15, 7, 15}; + int bbBottoms[] = { 0, -7, -1, -7, 9, 0, 9}; + + // Each group = char-index, number of glyphs, glyph-indices. + int charsToGlyphs[] = { + 0, 1, 0, 1, 1, 1, 2, 1, 3, 3, 1, 2, 4, 1, 4, 5, 0, 6, 1, 5, 7, 1, 6 + }; + int c2gCount = sizeof(charsToGlyphs) / sizeof(int); + + // Finish setting up test case. + SetCharCount(charCnt); + SetGlyphCount(glyphCnt); + SetGlyphList(glyphList); + SetXPositions(xPositions); + SetYPositions(yPositions); + SetAdvWidths(advWidths); + SetCharsToGlyphs(charsToGlyphs, c2gCount); + SetBBs(bbLefts, bbRights, bbTops, bbBottoms); + SetInsPtFlags(insPtFlags); +} + + +void TestCase::SetupBugTest_GentiumNfc() +{ + m_testName = "Bug Test"; + m_traceLog = true; + m_debug = false; + m_skip = true; + + // Input: + m_fontName = L"GentiumPlus"; + m_fontFile = "gentium_r_gr.ttf"; + + wchar_t charData[] = { +// 0x1EBF, // e-circum-acute 769 (x301) "g1ebf" +// 0x1EA5, // a-circum-acute 233 (xE9) "g1ea5" + 0x0105, // a-ogonek + 0x01eb, // o-ogonek 1741 "g01eb" + 0x01ed, // o-ogonek-macron + 0x0000 }; + m_text.assign(charData); + int charCnt = 3; + + m_fontSize = 20; // font size in points + m_prefBreak = klbWsBreak; // preferred break-weight + m_worstBreak = klbHyphenBreak; // worst-case break-weight + m_availWidth = 1000; // width available for segment + m_bold = false; + m_italic = false; + m_backtrack = false; + m_rtl = false; + + m_fset[0].id = 1058; m_fset[0].value = 1; // small caps + m_fset[1].id = 1029; m_fset[1].value = 1; // viet + m_fset[2].id = 1043; m_fset[2].value = 1; // ogonek + m_fset[3].id = 0; + + // Output: + m_noSegment = false; + m_segWidth = 52; // physical width of segment + + // need charCnt elements in this array: + bool insPtFlags[] = { + true, false, true, true, false, false, false, true + }; + + int glyphCnt = 3; + // need glyphCnt elements in these arrays: + gid16 glyphList[] = {105,174,158,202,231,162,231}; + int xPositions[] = { 0, 17, 20, 22, 28, 29, 38}; + int yPositions[] = { 0, 0, 0, 0, 0, 0, 0}; + int advWidths[] = { 17, 2, 9, 4, 0, 10, 0}; + + int bbLefts[] = { 0, 10, 21, 23, 23, 30, 33}; + int bbRights[] = { 16, 19, 28, 25, 28, 39, 38}; + int bbTops[] = { 7, 7, 7, -1, 15, 7, 15}; + int bbBottoms[] = { 0, -7, -1, -7, 9, 0, 9}; + + // Each group = char-index, number of glyphs, glyph-indices. + int charsToGlyphs[] = { + 0, 1, 0, 1, 1, 1, 2, 1, 3, 3, 1, 2, 4, 1, 4, 5, 0, 6, 1, 5, 7, 1, 6 + }; + int c2gCount = sizeof(charsToGlyphs) / sizeof(int); + + // Finish setting up test case. + SetCharCount(charCnt); + SetGlyphCount(glyphCnt); + SetGlyphList(glyphList); + SetXPositions(xPositions); + SetYPositions(yPositions); + SetAdvWidths(advWidths); + SetCharsToGlyphs(charsToGlyphs, c2gCount); + SetBBs(bbLefts, bbRights, bbTops, bbBottoms); + SetInsPtFlags(insPtFlags); +} diff --git a/Build/source/libs/graphite/engine-2.4/test/RegressionTest/TestCase.h b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/TestCase.h new file mode 100644 index 00000000000..755c27dc1d4 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/TestCase.h @@ -0,0 +1,256 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 2004 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: TestCase.h +Responsibility: Sharon Correll +Last reviewed: Not yet. + +Description: + Definition of TestCase class for Graphite regression test program. +-------------------------------------------------------------------------------*//*:End Ignore*/ + +#ifdef _MSC_VER +#pragma once +#endif +#ifndef TESTCASE_H +#define TESTCASE_H 1 + +#define NO_EXCEPTIONS 1 + +class TestCase +{ +public: + // Methods to set up test cases. + void SetupSimpleTest(); + void SetupSimpleBacktrackTest(); + void SetupSurrogateTest(); // TODO: add a test for UTF-8 + void SetupBurmese1(); + void SetupBurmese2(); + void SetupBurmese3(); + void SetupBurmese4(); + void SetupRoman(); + void SetupRomanFeatures(); + void SetupStackingAndBridging(); + void SetupNoWhiteSpace(); + void SetupNoWhiteSpaceNoSeg(); + void SetupOnlyWhiteSpace(); + void SetupCrossLine1(); + void SetupCrossLine2(); + void SetupCrossLine3(); + void SetupCrossLine4(); + void SetupArabic1(); + void SetupArabic2(); + void SetupTaiViet1(); + void SetupTaiViet2(); + void SetupBurmesePositioning1(); + void SetupBurmesePositioning2(); + void SetupBurmeseFeature1(); + void SetupBurmeseFeature2(); + void SetupCharisPConstraint(); + void SetupDevanagari(); + void SetupKernGlat2(); + void SetupDumbFallback1(); + void SetupDumbFallback2(); + void SetupBadFont(); + void SetupBugTest(); + void SetupBugTest_GentiumNfc(); + // *** Add more methods here. *** + +protected: + // Auxiliary functions to set up test cases. + void SetupBurmeseAux(int charCount, int glyphCount, int clickTestCount); + void SetupArabicAux(int charCount, int glyphCount); + std::wstring BurmeseText(); + std::wstring RomanText(); + std::wstring CrossLineText(); + std::wstring ArabicText(); + std::wstring TaiVietText(); + std::wstring BurmesePositioningText(); + std::wstring BurmeseFeatureText(); + std::wstring DevanagariText(); + +public: + const static int kAbsent = -100; // not present in data + +public: + // constructor: + TestCase(); + // destructor: + ~TestCase(); + + static int SetupTests(TestCase **); + static void DeleteTests(); + + // Getters: + std::string TestName() { return m_testName; } + bool RunDebugger() { return m_debug; } + bool TraceLog() { return m_traceLog; } + bool Skip() { return m_skip; } + + std::wstring Text() { return m_text; } + std::wstring FontName() { return m_fontName; } + std::string FontFile() { return m_fontFile; } + size_t FontSize() { return m_fontSize; } + LineBrk PrefBreak() { return m_prefBreak; } + LineBrk WorstBreak() { return m_worstBreak; } + int FeatureID(int i) { return m_fset[i].id; } + int FeatureValue(int i) { return m_fset[i].value; } + FeatureSetting * Features() { return m_fset; } + int AvailWidth() { return m_availWidth; } + bool Backtrack() { return m_backtrack; } + TrWsHandling Twsh() { return m_twsh; } + bool Rtl() { return m_rtl; } + bool ParaRtl() { return m_paraRtl; } + size_t FirstChar() { return m_firstChar; } + bool DumbFallback() { return m_dumbFallback; } + size_t InputContextBlock(gr::byte ** ppContextBlock) + { + *ppContextBlock = m_contextBlockIn; + return m_contextBlockInSize; + } + + bool InitWithPrevSeg() { return m_initWithPrev; } + bool BadFont() { return m_badFont; } + bool NoSegment() { return m_noSegment; } + int SegWidth() { return m_segWidth; } + int CharCount() { return m_charCount; } + int GlyphCount() { return m_glyphCount; } + + int GlyphID(int i) { return m_glyphArray[i]; } + int XPos(int i) { return m_xPositions[i]; } + int YPos(int i) { return m_yPositions[i]; } + int AdvWidth(int i) { return m_advWidths[i]; } + int BbLeft(int i) { return m_bbLefts[i]; } + int BbRight(int i) { return m_bbRights[i]; } + int BbTop(int i) { return m_bbTops[i]; } + int BbBottom(int i) { return m_bbBottoms[i]; } + bool BbTests() { return (m_bbLefts != NULL); } + + int InsPtFlag(int i) { return m_insPointFlags[i]; } + + int CharToGlyphCount() { return m_c2gCount; } + int CharToGlyphItem(int i) { return m_charsToGlyphs[i]; } + int AttachedGlyphCount() { return m_attGCount; } // that is, the lenght of the data + int AttachedGlyphItem(int i) { return m_attGlyphs[i]; } + + int NumberOfClickTests() { return m_clickTestCount; } + int XClick(int i) { return m_clickTests[i].xClick; } + int YClick(int i) { return m_clickTests[i].yClick; } + int ClickCharIndex(int i) { return m_clickTests[i].charIndex; } + bool ClickAssocPrev(int i) { return (bool)m_clickTests[i].assocPrev; } + int Sel1Top(int i) { return m_clickTests[i].sel1Top; } + int Sel1Bottom(int i) { return m_clickTests[i].sel1Bottom; } + int Sel1Left(int i) { return m_clickTests[i].sel1Left; } + int Sel2Top(int i) { return m_clickTests[i].sel2Top; } + int Sel2Bottom(int i) { return m_clickTests[i].sel2Bottom; } + int Sel2Left(int i) { return m_clickTests[i].sel2Left; } + size_t OutputContextBlockSize() { return m_contextBlockOutSize; } + bool CompareContextBlock(gr::byte * pResult) + { + for (size_t i = 0; i < m_contextBlockOutSize; i++) + { + if (m_contextBlockOut[i] != pResult[i]) + return false; + } + return true; + } + + struct ClickTest + { + int xClick; + int yClick; + int charIndex; + int assocPrev; // boolean: 0 or 1 + int sel1Top; + int sel1Bottom; + int sel1Left; // we only need left or right, not both + int sel2Top; + int sel2Bottom; + int sel2Left; + + const static int fieldCnt = 10; + }; + +protected: + std::string m_testName; + bool m_debug; // break into the debugger when running this test + bool m_traceLog; // generate a logging file (tracelog.txt) for this test; if this is turned on for + // more than one test, the tests will be appended + bool m_skip; + +#define MAXFEAT 10 + + // Input parameters: + std::wstring m_text; // default: none + std::wstring m_fontName; // default: empty + std::string m_fontFile; // default: empty + size_t m_fontSize; // default: 12 + LineBrk m_prefBreak; // default: word-break + LineBrk m_worstBreak; // default: clip-break + FeatureSetting m_fset[MAXFEAT]; // default: none + int m_availWidth; // default: 100 + bool m_bold; // default: false + bool m_italic; // default: false + bool m_rtl; // default: false + bool m_backtrack; // default: false + TrWsHandling m_twsh; // default: ktwshAll + bool m_paraRtl; // default: false + size_t m_firstChar; // default: 0 + size_t m_contextBlockInSize; // default: 0 + gr::byte * m_contextBlockIn; // default: NULL -- DELETE + bool m_initWithPrev; // default: false + bool m_dumbFallback; // default: true + // start of line flag + // resolution + // justification + + // Output: + bool m_badFont; // default: false + bool m_noSegment; // no segment should be generated + int m_segWidth; + int m_charCount; + int m_glyphCount; + gid16 * m_glyphArray; + int * m_xPositions; + int * m_yPositions; + int * m_advWidths; + int * m_bbLefts; + int * m_bbRights; + int * m_bbTops; + int * m_bbBottoms; + bool * m_insPointFlags; + int * m_charsToGlyphs; // char-to-glyph mappings + int m_c2gCount; + int * m_attGlyphs; // attachment clusters + int m_attGCount; + int m_clickTestCount; + ClickTest * m_clickTests; + size_t m_contextBlockOutSize; + gr::byte * m_contextBlockOut; + // glyphs-to-chars + // pdichwContext + // arrow key behavior + // etc. + + // Setters: + void SetCharCount(int charCount); + void SetGlyphCount(int glyphCount); + void SetGlyphList(gid16 * glyphList); + void SetXPositions(int * posList); + void SetYPositions(int * posList); + void SetAdvWidths(int * advWidths); + void SetBBs(int * bbLefts, int * bbRights, int * bbTops, int * bbBottoms); + void SetInsPtFlags(bool * flags); + void SetCharsToGlyphs(int * stuff, int count); + void SetAttachedClusters(int * stuff, int count); + void SetClickTests(int clickTestCount, int * clickStuff); + void SetInputContextBlock(int contextBlockInSize, gr::byte * contextBlockIn); + void SetOutputContextBlock(int contextBlockOutSize, gr::byte * contextBlockIn); +}; + + +#endif // !TESTCASE_H + diff --git a/Build/source/libs/graphite/engine-2.4/test/RegressionTest/arabicText.wpx b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/arabicText.wpx new file mode 100644 index 00000000000..62fee81be5b --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/arabicText.wpx @@ -0,0 +1,137 @@ + + + + + + + + Arabic, Standard + + + Ara + + + + Scheherazade Graphite Alpha + Scheherazade Graphite Alpha + Charis SIL + Courier + arb + standard + Arabic Demo + + + + DefaultCollation + + + Latin1_General_CI_AI + + + + + + + + Normal + + + Normal + + + + + Bulleted List + + Normal + Bulleted List + + + + + + Heading 1 + + Normal + Heading 1 + + + + + + Heading 2 + + Normal + Heading 2 + + + + + + Heading 3 + + Normal + Heading 3 + + + + + + Numbered List + + Normal + Numbered List + + + + + + External Link + + Normal + External Link + + + + + + + + + + + + + + ببَلَٔاَ چِْٕ۠ڨ بِڹْ) ب ‍تڨسٰ؛ ۱۲۳ سٰعدمپ لٰ، ‮۱۲۳۴۵‬ سهارعن؛ + + + + + + + + + + + + + + + + + + + + arabicText.wpx + + + + + &[page],&[date] + + + + + + diff --git a/Build/source/libs/graphite/engine-2.4/test/RegressionTest/bridgingStackingText.wpx b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/bridgingStackingText.wpx new file mode 100644 index 00000000000..d91ecea8262 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/bridgingStackingText.wpx @@ -0,0 +1,158 @@ + + + + + + + + English + + + Eng + + + + The standard alphabetic representation of English (United States style). + + + + + Times New Roman + Arial + Charis SIL + Courier New + en + standard + + + + Default Collation + + + Latin1_General_CI_AI + + + + Case Sensitive + + + Latin1_General_CS_AI + + + + + + + + Normal + + + Normal + + + + + Bulleted List + + Normal + Bulleted List + + + + + + Heading 1 + + Normal + Heading 1 + + + + + + Heading 2 + + Normal + Heading 2 + + + + + + Heading 3 + + Normal + Heading 3 + + + + + + Numbered List + + Normal + Numbered List + + + + + + External Link + + Normal + External Link + + + + + + + + + + + + + + + + + + + + + + + + a͝a t͝a à̀͝a ʃ̀̀͝a a̖̖a ʃ̀̀a a̖̖a ʃ͝a + + + + + + + + + + + + + + + + + + + + bridgingDiacTest.wpx + + + + + &[page],&[date] + + + + + + diff --git a/Build/source/libs/graphite/engine-2.4/test/RegressionTest/burmese2Position.wpx b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/burmese2Position.wpx new file mode 100644 index 00000000000..c4e9a5976db --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/burmese2Position.wpx @@ -0,0 +1,167 @@ + + + + + + + + English + + + Eng + + + + The standard alphabetic representation of English (United States style). + + + + + 1051=0 + Times New Roman + Arial + Charis SIL + Courier New + ' - ! " & ( ) , . / : ; ? [ ] { } a A b B c C d D e E f F g G h H i I j J k K l L m M n N o O p P q Q r R s S t T u U v V w W x X y Y z Z ” “ ’ ‘ –  + <?xml version="1.0" encoding="utf-16"?> <MatchedPairs> <pair open="(" close=")" closedByPara="true" /> <pair open="[" close="]" closedByPara="true" /> </MatchedPairs> + <?xml version="1.0" encoding="utf-16"?> <PunctuationPatterns> <pattern value=", " context="WordFinal" valid="true" /> <pattern value=". " context="WordFinal" valid="true" /> <pattern value=" “" context="WordInitial" valid="true" /> <pattern value="; " context="WordFinal" valid="true" /> <pattern value=".” " context="WordFinal" valid="true" /> <pattern value=": " context="WordFinal" valid="true" /> <pattern value="? " context="WordFinal" valid="true" /> <pattern value=" ‘" context="WordInitial" valid="true" /> <pattern value="–" context="WordMedial" valid="true" /> <pattern value="! " context="WordFinal" valid="true" /> <pattern value="?” " context="WordFinal" valid="true" /> <pattern value=",” " context="WordFinal" valid="true" /> <pattern value=" (" context="WordInitial" valid="true" /> <pattern value=".’ " context="WordFinal" valid="true" /> <pattern value="– " context="WordFinal" valid="true" /> <pattern value="!” " context="WordFinal" valid="true" /> <pattern value=") " context="WordFinal" valid="true" /> <pattern value="," context="WordMedial" valid="false" /> <pattern value=",’ " context="WordFinal" valid="true" /> <pattern value="?’ " context="WordFinal" valid="true" /> <pattern value=".) " context="WordFinal" valid="true" /> <pattern value="); " context="WordFinal" valid="true" /> <pattern value="!’ " context="WordFinal" valid="true" /> <pattern value="), " context="WordFinal" valid="true" /> <pattern value="/" context="WordMedial" valid="false" /> <pattern value="” " context="WordFinal" valid="true" /> <pattern value="). " context="WordFinal" valid="true" /> <pattern value="’? " context="WordFinal" valid="true" /> <pattern value="’ " context="WordFinal" valid="true" /> <pattern value=" ”" context="WordInitial" valid="false" /> <pattern value="’?” " context="WordFinal" valid="true" /> <pattern value="’" context="WordMedial" valid="false" /> <pattern value="”; " context="WordFinal" valid="false" /> <pattern value="): " context="WordFinal" valid="true" /> <pattern value="”–" context="WordMedial" valid="true" /> <pattern value="’–" context="WordMedial" valid="true" /> <pattern value="”? " context="WordFinal" valid="true" /> <pattern value="’; " context="WordFinal" valid="true" /> <pattern value="”– " context="WordFinal" valid="true" /> <pattern value=" ’" context="WordInitial" valid="false" /> <pattern value=")– " context="WordFinal" valid="true" /> <pattern value="?”– " context="WordFinal" valid="true" /> <pattern value=".”) " context="WordFinal" valid="true" /> <pattern value=" [" context="WordInitial" valid="true" /> <pattern value=".] " context="WordFinal" valid="true" /> <pattern value="!’: " context="WordFinal" valid="false" /> <pattern value="!– " context="WordFinal" valid="false" /> <pattern value=" “(" context="WordInitial" valid="false" /> <pattern value="’!” " context="WordFinal" valid="false" /> <pattern value="?”) " context="WordFinal" valid="true" /> <pattern value="?”–" context="WordMedial" valid="true" /> <pattern value="?’– " context="WordFinal" valid="false" /> <pattern value="’. " context="WordFinal" valid="false" /> <pattern value="!”–" context="WordMedial" valid="false" /> <pattern value=" (“" context="WordInitial" valid="true" /> <pattern value="?– " context="WordFinal" valid="false" /> <pattern value="- " context="WordFinal" valid="false" /> <pattern value="?) " context="WordFinal" valid="true" /> <pattern value=".)” " context="WordFinal" valid="true" /> <pattern value="!”? " context="WordFinal" valid="false" /> <pattern value="”), " context="WordFinal" valid="true" /> <pattern value="”: " context="WordFinal" valid="true" /> </PunctuationPatterns> + <?xml version="1.0" encoding="utf-16"?> <QuotationMarks LangUsedFrom="en" ContinueAcrossParas="true"> <FirstLevelBegin>“</FirstLevelBegin> <FirstLevelEnd>”</FirstLevelEnd> <SecondLevelBegin>‘</SecondLevelBegin> <SecondLevelEnd>’</SecondLevelEnd> </QuotationMarks> + en + en + standard + + + + Default Collation + + + Latin1_General_CI_AI + + + + + + + Padauk + Padauk + Charis SIL + Courier + my + my + keyman + Burmese Unicode 0.03 + + + + Latin1_General_CI_AI + + + + + + + + Normal + + + Normal + + + + + Bulleted List + + Normal + Bulleted List + + + + + + Heading 1 + + Normal + Heading 1 + + + + + + Heading 2 + + Normal + Heading 2 + + + + + + Heading 3 + + Normal + Heading 3 + + + + + + Numbered List + + Normal + Numbered List + + + + + + External Link + + Normal + External Link + + + + + + + + + + + + + + ဘွဲ့ကြ + + ကြိုး + + + + + + + + + + + + + + + + + + + + burmesePosition.wpx + + + + + &[page],&[date] + + + + + + diff --git a/Build/source/libs/graphite/engine-2.4/test/RegressionTest/burmeseFeature.wpx b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/burmeseFeature.wpx new file mode 100644 index 00000000000..96825baa49d --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/burmeseFeature.wpx @@ -0,0 +1,185 @@ + + + + + + + + English + + + Eng + + + + The standard alphabetic representation of English (United States style). + + + + + 1051=0 + Times New Roman + Arial + Charis SIL + Courier New + ' - ! " & ( ) , . / : ; ? [ ] { } a A b B c C d D e E f F g G h H i I j J k K l L m M n N o O p P q Q r R s S t T u U v V w W x X y Y z Z ” “ ’ ‘ –  + <?xml version="1.0" encoding="utf-16"?> <MatchedPairs> <pair open="(" close=")" closedByPara="true" /> <pair open="[" close="]" closedByPara="true" /> </MatchedPairs> + <?xml version="1.0" encoding="utf-16"?> <PunctuationPatterns> <pattern value=", " context="WordFinal" valid="true" /> <pattern value=". " context="WordFinal" valid="true" /> <pattern value=" “" context="WordInitial" valid="true" /> <pattern value="; " context="WordFinal" valid="true" /> <pattern value=".” " context="WordFinal" valid="true" /> <pattern value=": " context="WordFinal" valid="true" /> <pattern value="? " context="WordFinal" valid="true" /> <pattern value=" ‘" context="WordInitial" valid="true" /> <pattern value="–" context="WordMedial" valid="true" /> <pattern value="! " context="WordFinal" valid="true" /> <pattern value="?” " context="WordFinal" valid="true" /> <pattern value=",” " context="WordFinal" valid="true" /> <pattern value=" (" context="WordInitial" valid="true" /> <pattern value=".’ " context="WordFinal" valid="true" /> <pattern value="– " context="WordFinal" valid="true" /> <pattern value="!” " context="WordFinal" valid="true" /> <pattern value=") " context="WordFinal" valid="true" /> <pattern value="," context="WordMedial" valid="false" /> <pattern value=",’ " context="WordFinal" valid="true" /> <pattern value="?’ " context="WordFinal" valid="true" /> <pattern value=".) " context="WordFinal" valid="true" /> <pattern value="); " context="WordFinal" valid="true" /> <pattern value="!’ " context="WordFinal" valid="true" /> <pattern value="), " context="WordFinal" valid="true" /> <pattern value="/" context="WordMedial" valid="false" /> <pattern value="” " context="WordFinal" valid="true" /> <pattern value="). " context="WordFinal" valid="true" /> <pattern value="’? " context="WordFinal" valid="true" /> <pattern value="’ " context="WordFinal" valid="true" /> <pattern value=" ”" context="WordInitial" valid="false" /> <pattern value="’?” " context="WordFinal" valid="true" /> <pattern value="’" context="WordMedial" valid="false" /> <pattern value="”; " context="WordFinal" valid="false" /> <pattern value="): " context="WordFinal" valid="true" /> <pattern value="”–" context="WordMedial" valid="true" /> <pattern value="’–" context="WordMedial" valid="true" /> <pattern value="”? " context="WordFinal" valid="true" /> <pattern value="’; " context="WordFinal" valid="true" /> <pattern value="”– " context="WordFinal" valid="true" /> <pattern value=" ’" context="WordInitial" valid="false" /> <pattern value=")– " context="WordFinal" valid="true" /> <pattern value="?”– " context="WordFinal" valid="true" /> <pattern value=".”) " context="WordFinal" valid="true" /> <pattern value=" [" context="WordInitial" valid="true" /> <pattern value=".] " context="WordFinal" valid="true" /> <pattern value="!’: " context="WordFinal" valid="false" /> <pattern value="!– " context="WordFinal" valid="false" /> <pattern value=" “(" context="WordInitial" valid="false" /> <pattern value="’!” " context="WordFinal" valid="false" /> <pattern value="?”) " context="WordFinal" valid="true" /> <pattern value="?”–" context="WordMedial" valid="true" /> <pattern value="?’– " context="WordFinal" valid="false" /> <pattern value="’. " context="WordFinal" valid="false" /> <pattern value="!”–" context="WordMedial" valid="false" /> <pattern value=" (“" context="WordInitial" valid="true" /> <pattern value="?– " context="WordFinal" valid="false" /> <pattern value="- " context="WordFinal" valid="false" /> <pattern value="?) " context="WordFinal" valid="true" /> <pattern value=".)” " context="WordFinal" valid="true" /> <pattern value="!”? " context="WordFinal" valid="false" /> <pattern value="”), " context="WordFinal" valid="true" /> <pattern value="”: " context="WordFinal" valid="true" /> </PunctuationPatterns> + <?xml version="1.0" encoding="utf-16"?> <QuotationMarks LangUsedFrom="en" ContinueAcrossParas="true"> <FirstLevelBegin>“</FirstLevelBegin> <FirstLevelEnd>”</FirstLevelEnd> <SecondLevelBegin>‘</SecondLevelBegin> <SecondLevelEnd>’</SecondLevelEnd> </QuotationMarks> + en + en + standard + + + + Default Collation + + + Latin1_General_CI_AI + + + + + + + Padauk + Padauk + Charis SIL + Courier + my + my + keyman + Burmese Unicode 0.03 + + + + Latin1_General_CI_AI + + + + + + + + Normal + + + Normal + + + + + Bulleted List + + Normal + Bulleted List + + + + + + Heading 1 + + Normal + Heading 1 + + + + + + Heading 2 + + Normal + Heading 2 + + + + + + Heading 3 + + Normal + Heading 3 + + + + + + Numbered List + + Normal + Numbered List + + + + + + External Link + + Normal + External Link + + + + + + + + + + + + + + လ ူဌ ဲဓ + + + + + + + + + + လ ူဌ ဲဓ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + burmeseFeature.wpx + + + + + &[page],&[date] + + + + + + diff --git a/Build/source/libs/graphite/engine-2.4/test/RegressionTest/burmeseText.wpx b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/burmeseText.wpx new file mode 100644 index 00000000000..94d699a2a1c --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/burmeseText.wpx @@ -0,0 +1,138 @@ + + + + + + + + Burmese + + + + + + + + + Padauk + Arial + Courier + my + keyman + Burmese Unicode 0.03 + + + + DefaultCollation + + + Latin1_General_CI_AI + + + + + + + + Normal + + + Normal + + + + + Bulleted List + + Normal + Bulleted List + + + + + + Heading 1 + + Normal + Heading 1 + + + + + + Heading 2 + + Normal + Heading 2 + + + + + + Heading 3 + + Normal + Heading 3 + + + + + + Numbered List + + Normal + Numbered List + + + + + + External Link + + Normal + External Link + + + + + + + + + + + + + + က္ယ္ဝန္ဟ္‌ပ္‌တုိ့၏ ပ္ယော္‌ရ္ဝ္ဟင္‌မ္ဟု၊ + + + + + + + + + + + + + + + + + + + + brumeseText.wpx + + + + + &[page],&[date] + + + + + + diff --git a/Build/source/libs/graphite/engine-2.4/test/RegressionTest/devanagariText.wpx b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/devanagariText.wpx new file mode 100644 index 00000000000..518cbd2353d --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/devanagariText.wpx @@ -0,0 +1,144 @@ + + + + + + + + Hindi + + + + for testing Devanagari font + + + + + Annapurna SIL RC1 + Arial + Charis SIL + Courier + xhin + xhin + standard + + + + DefaultCollation + + + Latin1_General_CI_AI + + + + + + + + Normal + + + Normal + + + + + Bulleted List + + Normal + Bulleted List + + + + + + Heading 1 + + Normal + Heading 1 + + + + + + Heading 2 + + Normal + Heading 2 + + + + + + Heading 3 + + Normal + Heading 3 + + + + + + Numbered List + + Normal + Numbered List + + + + + + External Link + + Normal + External Link + + + + + + + + + + + + + + म्ल + र्ह्‌हि + + िँ + र्ध + ौ़ँ र्ट्ठौ क्कू डि + + + + + + + + + + + + + + + + + + + + devanagariText.wpx + + + + + &[page],&[date] + + + + + + diff --git a/Build/source/libs/graphite/engine-2.4/test/RegressionTest/grtest_arabic.ttf b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/grtest_arabic.ttf new file mode 100644 index 00000000000..df25e54b3f3 Binary files /dev/null and b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/grtest_arabic.ttf differ diff --git a/Build/source/libs/graphite/engine-2.4/test/RegressionTest/grtest_badCmap.ttf b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/grtest_badCmap.ttf new file mode 100644 index 00000000000..d66c725f12e Binary files /dev/null and b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/grtest_badCmap.ttf differ diff --git a/Build/source/libs/graphite/engine-2.4/test/RegressionTest/grtest_badVersion.ttf b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/grtest_badVersion.ttf new file mode 100644 index 00000000000..babe42e5352 Binary files /dev/null and b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/grtest_badVersion.ttf differ diff --git a/Build/source/libs/graphite/engine-2.4/test/RegressionTest/grtest_burmese.ttf b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/grtest_burmese.ttf new file mode 100644 index 00000000000..ab253fbbfd6 Binary files /dev/null and b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/grtest_burmese.ttf differ diff --git a/Build/source/libs/graphite/engine-2.4/test/RegressionTest/grtest_burmese2.ttf b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/grtest_burmese2.ttf new file mode 100644 index 00000000000..1501a7e06d3 Binary files /dev/null and b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/grtest_burmese2.ttf differ diff --git a/Build/source/libs/graphite/engine-2.4/test/RegressionTest/grtest_burmese3.ttf b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/grtest_burmese3.ttf new file mode 100644 index 00000000000..451f42789ca Binary files /dev/null and b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/grtest_burmese3.ttf differ diff --git a/Build/source/libs/graphite/engine-2.4/test/RegressionTest/grtest_devanagari.ttf b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/grtest_devanagari.ttf new file mode 100644 index 00000000000..b2b50e99e92 Binary files /dev/null and b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/grtest_devanagari.ttf differ diff --git a/Build/source/libs/graphite/engine-2.4/test/RegressionTest/grtest_kernglat2.ttf b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/grtest_kernglat2.ttf new file mode 100644 index 00000000000..b114a4e88fa Binary files /dev/null and b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/grtest_kernglat2.ttf differ diff --git a/Build/source/libs/graphite/engine-2.4/test/RegressionTest/grtest_pconstraints.ttf b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/grtest_pconstraints.ttf new file mode 100644 index 00000000000..673fbb42df4 Binary files /dev/null and b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/grtest_pconstraints.ttf differ diff --git a/Build/source/libs/graphite/engine-2.4/test/RegressionTest/grtest_roman.ttf b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/grtest_roman.ttf new file mode 100644 index 00000000000..2001ff6b5ac Binary files /dev/null and b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/grtest_roman.ttf differ diff --git a/Build/source/libs/graphite/engine-2.4/test/RegressionTest/grtest_taiviet.ttf b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/grtest_taiviet.ttf new file mode 100644 index 00000000000..3bf4a662b11 Binary files /dev/null and b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/grtest_taiviet.ttf differ diff --git a/Build/source/libs/graphite/engine-2.4/test/RegressionTest/grtest_xline.ttf b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/grtest_xline.ttf new file mode 100644 index 00000000000..537a4b9532a Binary files /dev/null and b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/grtest_xline.ttf differ diff --git a/Build/source/libs/graphite/engine-2.4/test/RegressionTest/main.h b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/main.h new file mode 100644 index 00000000000..fb52a58b4ec --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/main.h @@ -0,0 +1,102 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 2004 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: Main.h +Responsibility: Sharon Correll +Last reviewed: Not yet. + +Description: + Header files to include in the Graphite regression test program. +-------------------------------------------------------------------------------*//*:End Ignore*/ + +#ifdef _MSC_VER +#pragma once +#endif +#ifndef GRCOMPILER_H +#define GRCOMPILER_H 1 + +#define NO_EXCEPTIONS 1 + +// For some reason, WINVER defaults to zero and is not set to something reasonable soon enough: +#ifdef _WIN32 +#ifndef WINVER +#define WINVER 0x0500 +#endif +#endif + +#ifdef _WIN32 +// To allow call to IsDebuggerPresent: +#define _WIN32_WINNT WINVER +#endif + +//:>******************************************************************************************** +//:> Include files +//:>******************************************************************************************** +#include "stdafx.h" +////#include "resource.h" +// #include +#include +#include +#include +////#include +#include +#include + +#ifdef _WIN32 +#include "windows.h" +#ifdef _MSC_VER +#include +#endif +#endif // _WIN32 +#include + +////using std::max; +////using std::min; + +#include "GrCommon.h" +#include "GrPlatform.h" + +////////#include "LgCharPropsStub.h" + +#include "GrConstants.h" +///#include "TtfUtil.h" +///#include "Tt.h" + +#include "GrClient.h" +#include "ITextSource.h" +#include "SimpleTextSrc.h" +#include "IGrEngine.h" +#include "IGrJustifier.h" +#include "GrJustifier.h" +#include "SegmentAux.h" +#include "Font.h" +// #include "WinFont.h" +#include "FileFont.h" +#include "Segment.h" +#include "SegmentPainter.h" +// #include "WinSegmentPainter.h" + +#include "TestCase.h" +#include "RtTextSrc.h" + + +//:>******************************************************************************************** +//:> Functions +//:>******************************************************************************************** +void RunTests(int numberOfTests, TestCase * ptcaseList); +int RunOneTestCase(TestCase * ptcase, Segment * psegPrev, Segment ** ppsegRet, RtTextSrc ** pptsrcRet); +void OutputError(TestCase * ptcase, std::string strErr, int i = -1); +void OutputErrorWithValues(TestCase * ptcase, std::string strErr, int i, + int valueFound, int valueExpected); +void OutputErrorAux(TestCase * ptcase, std::string strErr, int i, + bool showValues, int valueFound, int valueExpected); +bool WriteToLog(std::string str, int i = -1); +bool WriteToLog(std::string str, int i, + bool showValues, int valueFound, int valueExpected); +bool WriteToLog(int n); + +#endif //!WRCOMPILER_H + diff --git a/Build/source/libs/graphite/engine-2.4/test/RegressionTest/makedebug.bat b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/makedebug.bat new file mode 100644 index 00000000000..94d09eb720a --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/makedebug.bat @@ -0,0 +1,2 @@ +cls +nmake CFG=DEBUG -f makefile.vc \ No newline at end of file diff --git a/Build/source/libs/graphite/engine-2.4/test/RegressionTest/readme.txt b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/readme.txt new file mode 100644 index 00000000000..e9f7facad20 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/readme.txt @@ -0,0 +1,19 @@ +Graphite Regression Test + +COMPILING +Use makedebug.bat to build a debug version. Creating a release version is not supported. + +RUNNING +Extract the fonts from the fonts.zip file and install them. + +Options: +/d - breaks into the debugger (if any) when an error occurs +/s - silent mode; does not write to the standard output but only to the log file + +The program generates a file called grregtest.log with a list of errors. + +A file called tracelog.txt will be output for the tests for which tracing is turned on. + +ADDING TESTS +See TestCase.cpp. + diff --git a/Build/source/libs/graphite/engine-2.4/test/RegressionTest/romanText.wpx b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/romanText.wpx new file mode 100644 index 00000000000..594cc886a0f --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/romanText.wpx @@ -0,0 +1,206 @@ + + + + + + + + English + + + Eng + + + + The standard alphabetic representation of English (United States style). + + + + + Times New Roman + Arial + Charis SIL + Courier New + en + standard + + + + Default Collation + + + Latin1_General_CI_AI + + + + Case Sensitive + + + Latin1_General_CS_AI + + + + + + + + Normal + + + Normal + + + + + + + + Bulleted List + + Normal + Bulleted List + + + + + + Heading 1 + + Normal + Heading 1 + + + + + + Heading 2 + + Normal + Heading 2 + + + + + + Heading 3 + + Normal + Heading 3 + + + + + + Numbered List + + Normal + Numbered List + + + + + + External Link + + Normal + External Link + + + + + + + + + + + + + + ẽ̀p͡sg˨˥˧ŊấĩĨm̼̀̈̄ffi + + + + + + + + + + with features: + + + + + + + + + + ẽ̀p͡sg˨˥˧ŊấĩĨm̼̀̈̄ffi + + + + + + + + + + + + + + + + + + + + stacking and bridging: + + + + + + + + + + a͝a t͝a à̀͝a + ʃ̀̀͝a + a̖̖a + ʃ̀̀a + + a̖̖a + + + + + + + + + + + + + + + + + + + + romanText.wpx + + + + + &[page],&[date] + + + + + + diff --git a/Build/source/libs/graphite/engine-2.4/test/RegressionTest/stdafx.cpp b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/stdafx.cpp new file mode 100644 index 00000000000..7f699d258e2 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/stdafx.cpp @@ -0,0 +1,8 @@ +// stdafx.cpp : source file that includes just the standard includes +// RegressionTest.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file diff --git a/Build/source/libs/graphite/engine-2.4/test/RegressionTest/stdafx.h b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/stdafx.h new file mode 100644 index 00000000000..c5e242de5cb --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/stdafx.h @@ -0,0 +1,12 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#pragma once + + +#include +// #include + +// TODO: reference additional headers your program requires here diff --git a/Build/source/libs/graphite/engine-2.4/test/RegressionTest/taivietText.wpx b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/taivietText.wpx new file mode 100644 index 00000000000..964c4968611 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/taivietText.wpx @@ -0,0 +1,162 @@ + + + + + + + + Tai Dam + + + + 2001=0,2005=0,2101=1,1051=1,2102=1 + Tai Heritage Graphite + Arial + Charis SIL + Courier + blt_TV + standard + + + + Latin1_General_CI_AI + + + + + + + + Normal + + + Normal + + + + + Bulleted List + + Normal + Bulleted List + + + + + + Heading 1 + + Normal + Heading 1 + + + + + + Heading 2 + + Normal + Heading 2 + + + + + + Heading 3 + + Normal + Heading 3 + + + + + + Numbered List + + Normal + Numbered List + + + + + + External Link + + Normal + External Link + + + + + + + + + + + + + + + + + + + + + + + +  + + + + + + + + + + + + + + + + + + + +  +  + + + + + + + + + + + + + + + + + + + + collision_examples.wpx + + + + + &[page],&[date] + + + + + + diff --git a/Build/source/libs/graphite/engine-2.4/test/RegressionTest/xline.gdl b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/xline.gdl new file mode 100644 index 00000000000..70bfa15902a --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/xline.gdl @@ -0,0 +1,146 @@ + +/********************************************************************************* + File: xline.gdl + + For testing cross-line contextualization. + + Compile with stddr.ttf + + To test, type something like these examples: + abc$x + abcx@ + abc$x@ + and force a line break after the x. +*********************************************************************************/ + +#include "stddef.gdh" + +Bidi = false; + +#define duplicated user1 + + +table(glyph) {MUnits = 1000 } + + g_A = codepoint("A"); + g_B = codepoint("B"); + g_C = codepoint("C"); + g_D = codepoint("D"); + g_E = codepoint("E"); + g_F = codepoint("F"); + g_G = codepoint("G"); + + g_a = codepoint("a"); + g_b = codepoint("b"); + g_c = codepoint("c"); + g_d = codepoint("d"); + g_e = codepoint("e"); + g_f = codepoint("f"); + g_g = codepoint("g"); + + g_x = codepoint("x"); + g_y = codepoint("y"); + g_z = codepoint("z"); + + g_asterisk = codepoint("*") { ptCenter = point(bb.width/2, bb.height/2) }; + g_dollar = codepoint("$") { xWid = aw }; + g_hash = codepoint("#"); + g_at = codepoint("@") { xWid = aw }; + g_amp = codepoint("&") {xWid = aw }; + g_percent = codepoint("%"); + + g_leftArrow = codepoint("<") { xWid = aw }; + g_rightArrow = codepoint(">") { xWid = aw }; + + clsUpper = codepoint("ABCDEFGHIJKLMNOPQRSTUVWXYZ") + { ptCenter = point(bb.width/2, ascent/2) }; + clsLower = codepoint("abcdefghijklmnopqrstuvwxyz"); + + clsMyAny = glyphid(2..216) { justify.stretch = 700m }; + + g_m = codepoint("m"); + g_Mlig = codepoint("M") { + component.one = box(0,0, bb.width/2, ascent); + component.two = box(bb.width/2,0, bb.width,ascent) }; + + gSpace = U+0020 { justify.stretch = 3000m }; + + clsXYZ = (g_x g_y g_z); + +endtable; // glyph + + +table(lb) + + // Allow non-optimal linebreaks after x, y, or z. + clsXYZ {break = BREAK_INTRA}; + +endtable; // lb + + +table(sub) + +pass(1) + + // Switch the $ and @ if they are both there, and insert & after the one on the first + // line and before the one on the second line. Note that these rules supercede the rule + // to insert the left- and right-arrows. + g_dollar _ _ g_at > @7 g_amp:7 g_amp:1 @1 + / _ _ ANY? # {break == BREAK_INTRA} ANY? _ _ ; + + g_dollar + clsXYZ {measure.endofline = g_at.aw - g_dollar.aw + g_amp.aw} + ANY {measure.startofline = g_dollar.aw - g_at.aw + g_amp.aw} + g_at; + g_dollar + clsXYZ {measure.endofline = g_at.aw - g_dollar.aw + g_amp.aw} + g_at {measure.startofline = g_dollar.aw - g_at.aw + g_amp.aw}; + + + // Just copy the $ to the following segment. + g_dollar _ > @1 {duplicated = true} g_dollar:1 + / _ {duplicated == false} ANY? ^ # {break == BREAK_INTRA} ANY? _ ; + + g_dollar + clsXYZ {measure.endofline = g_rightArrow.aw} + ANY {measure.startofline = g_dollar.aw + g_leftArrow.aw}; + + + // Just copy the @ to the previous segment. + _ g_at > g_at:5 @5 {duplicated = true} + / _ ANY? ^ # {break == BREAK_INTRA} ANY? _ {duplicated == false}; + + clsXYZ {measure.endofline = g_at.aw + g_rightArrow.aw} + ANY {measure.startofline = g_leftArrow.aw} + g_at; + + clsXYZ {measure.endofline = g_at.aw + g_rightArrow.aw} + g_at {measure.startofline = g_leftArrow.aw}; + + + // Insert a '<' at the beginning of the line and a '>' at the end. + _ > g_leftArrow / # _; + _ > g_rightArrow / clsMyAny _ # ^ ; + + clsMyAny {measure {startofline = g_leftArrow.aw; endofline = g_rightArrow.aw}}; + +endpass; + +pass(2) + + // Don't stretch trailing white space. + gSpace {justify.stretch = 0} / _ [gSpace [gSpace [gSpace gSpace?]? ]? ]? # ; + // In fact, don't stretch any line-boundary glyph. + clsMyAny {justify.stretch = 0} / _ #; + + +endpass; + +endtable; // sub + + +table(pos) + + clsMyAny {adv.x += justify.width}; + +endtable; // pos diff --git a/Build/source/libs/graphite/engine-2.4/test/RegressionTest/xlineText.wpx b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/xlineText.wpx new file mode 100644 index 00000000000..a8d51fefda7 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/test/RegressionTest/xlineText.wpx @@ -0,0 +1,132 @@ + + + + + + + + English + + + + Times New Roman + Arial + Courier New + en + standard + + + + DefaultCollation + + + Latin1_General_CI_AI + + + + + + + + Normal + + + Normal + + + + + Bulleted List + + Normal + Bulleted List + + + + + + Heading 1 + + Normal + Heading 1 + + + + + + Heading 2 + + Normal + Heading 2 + + + + + + Heading 3 + + Normal + Heading 3 + + + + + + Numbered List + + Normal + Numbered List + + + + + + External Link + + Normal + External Link + + + + + + + + + + + + + + abcddddefx@ghijkmmmmn$yopppppqrsss$z@tttwwww + + + + + + + + + + + + + + + + + + + + xline_test.wpx + + + + + &[page],&[date] + + + + + + diff --git a/Build/source/libs/graphite/engine-2.4/test/examples/burmese/Padauk.ttf b/Build/source/libs/graphite/engine-2.4/test/examples/burmese/Padauk.ttf new file mode 100644 index 00000000000..16a2ed864d9 Binary files /dev/null and b/Build/source/libs/graphite/engine-2.4/test/examples/burmese/Padauk.ttf differ diff --git a/Build/source/libs/graphite/engine-2.4/test/examples/burmese/bh1.utx b/Build/source/libs/graphite/engine-2.4/test/examples/burmese/bh1.utx new file mode 100644 index 00000000000..9dcaa5c3459 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/test/examples/burmese/bh1.utx @@ -0,0 +1,4 @@ +ကျွနှ်ပ်တို့၏ ပျော်ရွှင်မှု၊ သာယာ ၀ ပြောမှုနှင့် အောင်မြင်မှုတို့သည် ကျွနု်ပ်တို့၏ ကျန်းမာခြင်းအပေါ်တွင် အများကြီး မှီခိုနေပါသည်။ ပညာတတ်ရန်၊ ကြွယ်၀ချမ်းသာရန်နှင့် ကြိုးပမ်း လုပ်ဆောင်မှုအားလုံး အောင်မြင်စေရန်အတွက် ကျန်းမာရေးသည် အထူးပင် အရေးကြီးပါသည်။ ကျန်းမာရေးမပြည့်စုံလျှင် ကျွနု်ပ်တို့၏ ပညာရေး၊ စီးပွားရေး မြှင့်တင်မှုလုပ်ငန်းများ လုပ်နိုင်လိမ့်မည် မဟုတ်ပါ။ သို့ဖြစ်၍ အစဥ်သဖြင့် ကျန်းမာနေရန် ကျွနု်ပ်တို့ ကြိုးစားကြရပါမည်။ +ကျွန်းမာရေးနှင့် ပြည့်စုံရန်အတွက် ဆောင်ရွက်ရန် နည်းလမ်းများကို သိရှိလိုက်နာရပါမည်။ အစားအသောက်၊ အအိပ်အနေ၊ လေ့ကျင့်ခန်းနှင့် သန့်ရှင်းမှုတို့သည် ကျန်းမာရေးအတွက် လိုအပ်ချက်များ ဖြစ်ပါသည်။ အစားအစာသည် အသက်ရှင်မှုအတွက် အထူးလိုအပ်ချက် ဖြစ်ပါသည်။ ကျွနု်ပ်တို့သည် အသက် ရှင်နေနိုင်ရန် အစာစားရခြင်းဖြစ်ပြီး စားသောက်ရန် အသက်ရှင်နေခြင်း မဟုတ််ပါ။ ကျန်းမာမှုအတွက် သင့်တော်သည့် ပရိုတိန်း၊ သတ္တုဓာတ်များနှင့် ဗီတာမင်များ များစွာပါ၀င်သည့် အစာများကို ရယူစားသုံးရန် လိုအပ်ပါသည်။ ကျွနု်ပ်တို့နှင့် လျှော်ကန်သင့် မြတ်မည့် အိပ်စက်အနားယူမှုမှာလည်း အရေးကြီးပါသည်။ ကျွနု်ပ်တို့၏ ခန္ဓာကိုယ်မှ ကြွက်သားများနှင့် အသားမျှင်များအား ထိန်းသိမ်းပြုပြင်မှုအတွက် အိပ်စက်ခြင်းနှင့် နားနေခြင်းတို့ အညီအမျှ လိုအပ်ပါသည်။ ထို့ကြောင့် လုံလောက်စွာ အိပ်စက်နားနေရပါမည်။ +ကိုယ်ကာယလေ့ကျင့်ခန်းများနှင့် သန့်ရှင်းမှုတို့လည်း အရေးကြီး လိုအပ်ပါသည်။ လမ်းလျှောက်ခြင်းနှင့် အိမ်တွင်း လေ့ကျင့်ခန်းများသည် အစားအသောက်စားလိုစိတ်နှင့် စိတ်ရွှင်လန်းမှုတို့ကို တိုးပွားစေပါသည်။ တစ်ကိုယ်ရေသန့်ရှင်းရေးက ကျန်းမာမှုကို အထောက်အကူပြုပါသည်။ နေ့စဥ် ရေချိုးခြင်း၊ အစာမစားမီနှင့် စားပြီးတိုင်း လက်များကို စနစ်တကျဆေးကြော ရပါမည်။ +အထက်ပါ ကျန်းမာရေး နည်းလမ်းများကို လိုက်နာဆောင်ရွက်ပါက ကျွနု်ပ်တို့ တစ်သက်တာအတွက် ကျန်းမာရေးနှင့်ပြည့်စုံနေမည်မှာ သေချာပါသည်။ ကျွနု်ပ်တို့ ကျန်းမာနေလျှင် စီးပွားဥစ္စာပြည့်စုံခြင်း၊ ပညာရေးပြည့်စုံခြင်းနှင့် အခြားအောင်မြင်မှုများကို စွမ်းဆောင်နိုင်ပါမည်။ သို့ပါ၍ ကျန်းမာခြင်းသည် ချမ်းသာခြင်းဖြစ်ကြောင်းနှင့် ကျန်းမာခြင်းသည် ချမ်းသာခြင်းထက် ပိုမိုကောင်းမွန်သည်ဟု ဆိုရမည် ဖြစ်ပါသည်။ diff --git a/Build/source/libs/graphite/engine-2.4/test/examples/khmer/cloudsku2.txt b/Build/source/libs/graphite/engine-2.4/test/examples/khmer/cloudsku2.txt new file mode 100644 index 00000000000..6026347f841 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/test/examples/khmer/cloudsku2.txt @@ -0,0 +1,29 @@ +ពពក +១-ពពកនៅលើមេឃគឺ​ជា​តំណក់ទឹក​តូចៗ​ជា​ច្រើន​ ។ +២-ពពកមើលទៅឃើញស្អាត ​ហើយ​មាន​ប្រយោជន៍​ចំញេះមនុស្សដែរ​​ ។​ +៣-ពពកគឺជាប្រភពនៃទឹកភ្លៀង ដែលរុក្ខជាតិ​ នឹង​សត្វទាំងឡាយត្រូវការ​ ។​ +៤-ទឹកភ្លៀង​បង្អុរពីលើ "ពពក" ទៅក្នុង​ទន្លេ​ដែល​ជា​ទី​កន្លែង​សំរាប់យើងរកត្រី​ ​។​ +៥-ទឹក​អ​ណ្ដូង​របស់​យើង​ក៏មក​ពី​ទឹក​ភ្លៀង​ដែរ​ ។​ +៦-យើងប្រើទឹកសំរាប់ហូប​ សំរាប់ដាំស្ល​ និងសំ​រាប់​ងូត​ទឹក​សំរាប់បោកគក់​ ។​ +៧-នៅពេលថ្ងៃ​ ពពកផ្ដល់ម្លប់អោយ​យើង​ពី​កំ​ដៅ​ព្រះអាទិត្យ​​ ។ +៨-ប្រសិនបើមានពពកនៅពេលយប់​ នោះ​នឹង​​ អាច​​ការពារកំដៅពីចំហាយផែនដី ។​ ហេតុ​ដូច្នេះ​ហើយ​ទើប​ធ្វើអោយយើងមានអារម្មណ៍កក់ក្ដៅ​នៅ​ពេល​យប់​ដែលមានពពកច្រើន​​ ។ +៩-ពេលខ្លះពពកធ្វើអោយមានភ្លៀងធ្លាក់យ៉ាង​ខ្លាំង​ និងធ្វើអោយមានទឹកជំនន់​ទឹក​ទន្លេ​ជន់​ឡើងយ៉ាងខ្លាំង​ហើយផ្ទះសំបែង​ជា​ច្រើន​បាន​ត្រូវ​លិចលង់ ​។​ +១០-ទឹកជំនន់បំផ្លិចបំផ្លាញផលដំណាំជាច្រើន​​ ។ +១១-សត្វជាច្រើនបានលង់ទឹកស្លាប់​​​ ។ +១២-មានផ្ទាំងដីធ្លាក់បាក់ចុះមកជាច្រើន​ ។​ +១៣-ប៉ុន្ដែនៅទីណាដែលគ្មានពពកច្រើន​ ទីកន្លែង​នោះ​ខ្វះ​ខាតទឹក ​ ​និង​ក្លាយទៅជាវាល​រហោ​ស្ថាន​ ។ អត់​មាន​ដើម​ឈើ​រុក្ខជាតិ​រស់ ស្វត​និង​មនុស្ស​ក៏​មិន​អាច​រស់​នៅ​ទី​នោះ​បាន​ដែរ​ ។​​ ​ + +CLOUDS +1 The clouds in the sky are made up of little drops of water. +2 Clouds are pretty to look at as well as useful to man. +3 Clouds are the source of rain, which is needed by both plants and animals. +4 Rain from the clouds fills the rivers where we get fish. +5 Our wells are also filled by the rain that falls from the clouds. +6 We use water for drinking, for cooking and for washing. +7 During the day, the clouds provide shade from the heat of the sun. +8 If there are clouds at night, they prevent the heat from the surface of the earth from rising. So that is why we feel warm on a cloudy night. +9 Sometimes clouds bring heavy rains and floods. Rivers overflow and houses get flooded. +10 The floods destroy crops. +11 Animals are drowned. +12 There are landslides. +13 But in places where there are not many clouds, there is less water and the place becomes a desert in which no plants grow and no animals and people live. diff --git a/Build/source/libs/graphite/engine-2.4/test/examples/khmer/mond40gr6.ttf b/Build/source/libs/graphite/engine-2.4/test/examples/khmer/mond40gr6.ttf new file mode 100644 index 00000000000..a4a784c9026 Binary files /dev/null and b/Build/source/libs/graphite/engine-2.4/test/examples/khmer/mond40gr6.ttf differ diff --git a/Build/source/libs/graphite/engine-2.4/test/fonterrors/errBadGloc.ttf b/Build/source/libs/graphite/engine-2.4/test/fonterrors/errBadGloc.ttf new file mode 100644 index 00000000000..6cce2701493 Binary files /dev/null and b/Build/source/libs/graphite/engine-2.4/test/fonterrors/errBadGloc.ttf differ diff --git a/Build/source/libs/graphite/engine-2.4/test/fonterrors/errBadGloc2.ttf b/Build/source/libs/graphite/engine-2.4/test/fonterrors/errBadGloc2.ttf new file mode 100644 index 00000000000..89c54507f58 Binary files /dev/null and b/Build/source/libs/graphite/engine-2.4/test/fonterrors/errBadGloc2.ttf differ diff --git a/Build/source/libs/graphite/engine-2.4/test/fonterrors/errBadPass.ttf b/Build/source/libs/graphite/engine-2.4/test/fonterrors/errBadPass.ttf new file mode 100644 index 00000000000..82ae6b66c7a Binary files /dev/null and b/Build/source/libs/graphite/engine-2.4/test/fonterrors/errBadPass.ttf differ diff --git a/Build/source/libs/graphite/engine-2.4/test/fonterrors/errBadStackMachine.ttf b/Build/source/libs/graphite/engine-2.4/test/fonterrors/errBadStackMachine.ttf new file mode 100644 index 00000000000..27350bef70c Binary files /dev/null and b/Build/source/libs/graphite/engine-2.4/test/fonterrors/errBadStackMachine.ttf differ diff --git a/Build/source/libs/graphite/engine-2.4/test/fonterrors/errBadSubs.ttf b/Build/source/libs/graphite/engine-2.4/test/fonterrors/errBadSubs.ttf new file mode 100644 index 00000000000..8027c72b79a Binary files /dev/null and b/Build/source/libs/graphite/engine-2.4/test/fonterrors/errBadSubs.ttf differ diff --git a/Build/source/libs/graphite/engine-2.4/test/fonterrors/errBadVersion.ttf b/Build/source/libs/graphite/engine-2.4/test/fonterrors/errBadVersion.ttf new file mode 100644 index 00000000000..babe42e5352 Binary files /dev/null and b/Build/source/libs/graphite/engine-2.4/test/fonterrors/errBadVersion.ttf differ diff --git a/Build/source/libs/graphite/engine-2.4/test/fonterrors/errGarbageFsm.ttf b/Build/source/libs/graphite/engine-2.4/test/fonterrors/errGarbageFsm.ttf new file mode 100644 index 00000000000..7909e115949 Binary files /dev/null and b/Build/source/libs/graphite/engine-2.4/test/fonterrors/errGarbageFsm.ttf differ diff --git a/Build/source/libs/graphite/engine-2.4/test/fonterrors/errGarbageGlat.ttf b/Build/source/libs/graphite/engine-2.4/test/fonterrors/errGarbageGlat.ttf new file mode 100644 index 00000000000..012e6b5d5b2 Binary files /dev/null and b/Build/source/libs/graphite/engine-2.4/test/fonterrors/errGarbageGlat.ttf differ diff --git a/Build/source/libs/graphite/engine-2.4/test/fonterrors/errGarbageSilf.ttf b/Build/source/libs/graphite/engine-2.4/test/fonterrors/errGarbageSilf.ttf new file mode 100644 index 00000000000..b540a0d4dd5 Binary files /dev/null and b/Build/source/libs/graphite/engine-2.4/test/fonterrors/errGarbageSilf.ttf differ diff --git a/Build/source/libs/graphite/engine-2.4/test/fonterrors/errSilfVerMismatch.ttf b/Build/source/libs/graphite/engine-2.4/test/fonterrors/errSilfVerMismatch.ttf new file mode 100644 index 00000000000..9088e11ea9a Binary files /dev/null and b/Build/source/libs/graphite/engine-2.4/test/fonterrors/errSilfVerMismatch.ttf differ diff --git a/Build/source/libs/graphite/engine-2.4/test/fonterrors/errSubsUnderflow.ttf b/Build/source/libs/graphite/engine-2.4/test/fonterrors/errSubsUnderflow.ttf new file mode 100644 index 00000000000..a7b04a1e146 Binary files /dev/null and b/Build/source/libs/graphite/engine-2.4/test/fonterrors/errSubsUnderflow.ttf differ diff --git a/Build/source/libs/graphite/engine-2.4/test/fonterrors/errTooManyClasses.ttf b/Build/source/libs/graphite/engine-2.4/test/fonterrors/errTooManyClasses.ttf new file mode 100644 index 00000000000..9c73c9a38a1 Binary files /dev/null and b/Build/source/libs/graphite/engine-2.4/test/fonterrors/errTooManyClasses.ttf differ diff --git a/Build/source/libs/graphite/engine-2.4/test/fonterrors/fonterrors.gdl b/Build/source/libs/graphite/engine-2.4/test/fonterrors/fonterrors.gdl new file mode 100644 index 00000000000..862284a2440 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/test/fonterrors/fonterrors.gdl @@ -0,0 +1,43 @@ + +/********************************************************************************* + File: fonterrors.gdl + + For seeing some basic Graphite behavior. This version is used to generate + fonts that can be deliberately corrupted to test error handling in the + engine. + + Compile with Std SILDoulos (stddr.ttf). +*********************************************************************************/ + +#include "stddef.gdh" + +Bidi = false; + + +table(glyph) + + clsUpperVowel = codepoint("AEIOU"); + clsLowerVowel = codepoint("aeiou"); + + clsUpperCons = codepoint("BCDFGHJKLMNPQRSTVWXYZ"); + clsLowerCons = codepoint("bcdfghjklmnpqrstvwxyz"); + + clsDigit = codepoint("0123456789") {tSuper = 400m}; + +endtable; // glyph + + +table(sub) + + clsUpperVowel > clsLowerVowel; + clsLowerCons > clsUpperCons; + +endtable; + + +table(pos) + + clsDigit {shift.y += tSuper}; + +endtable; + diff --git a/Build/source/libs/graphite/engine-2.4/test/fonterrors/readme.txt b/Build/source/libs/graphite/engine-2.4/test/fonterrors/readme.txt new file mode 100644 index 00000000000..943b2853cf6 --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/test/fonterrors/readme.txt @@ -0,0 +1,43 @@ +FONTS FOR TESTING ERROR HANDLING + +This directory constains a set of fonts that have been deliberately corrupted in order to test Graphite's error recovery capabilities. + +The "correct" behavior of the font is that vowels are rendered as lowercase, consonants as uppercase, and digits are raised vertically. For some of the fonts, recovery will be adequate to show some smart behaviors; for others the engine will revert to pure dumb rendering. + + +* GrErr BadGloc - errBadGloc.ttf + The stated number of attributes exceeds actual number. This actually should not cause any real error, since the attributes are never read. + +* GrErr BadGloc2 - errBadGloc2.ttf + The stated number of attributes is less than actual number. This causes attributes greater than the number specified to have the value zero. + +* GrErr BadPass - errBadPass.ttf + One of the offsets to the pass information points off to somewhere nonsensical. + +* GrErr BadStackMachine - errStackMachine.ttf + Extra bytes have been inserted into the stack machine commands for both of the substitution rules. The engine manages to recover and handle the rule correctly in this case. (Reproduce using lowercase consonants or uppercase vowels.) + +* GrErr BadSubs - errSubs.ttf + A PutSubs command references a non-existent replacement class. This causes the glyph to appear as a square box. (Reproduce using lowercase consonants or uppercase vowels.) + +* GrErr BadVersion - errBadVersion.ttf + Bad version numbers are recorded in the Silf, Gloc, Glat, and Feat tables. Reading the Silf table will trigger an error being thrown, and the font will fall back to dumb rendering. + +* GrErr GarbageFsm - errGarbageFsm.ttf + The state table portions of the FSMs have been overwritten with garbage. Font will fall back to dumb rendering when any rules are fired. + +* GrErr GarbageGlat - errGarbageGlat.ttf + A section of Glat is overwritten with garbage. The "normal" behavior of the font is to raise the digits by 400m. But the lower digits (1 and 2) have been corrupted so they should simply not show that behavior. + +* GrErr GarbageSilf - errGarbageSilf.ttf + A section of Silf table is overwritten with garbage. Font will fall back to dumb rendering. + +* GrErr SilfVersionMismatch - errSilfVerMismatch.ttf + The Silf table claims to be version 1.0, but is actually version 2.0. Font will fall back to dumb rendering. + +* GrErr SubsUnderflow - errSubsUnderflow.ttf + A bogus command is inserted into the stack machine commands for both the substitution rules, causing an underflow when running the rules. The engine manages to recover and handle the rule correctly in this case. (Reproduce using lowercase consonants or uppercase vowels.) + +* GrErr TooManyClasses - errTooManyClasses.ttf + Very large number of classes in the list of replacement classes, larger than are actually there. + diff --git a/Build/source/libs/graphite/engine-2.4/uninstalled-top.pc.in b/Build/source/libs/graphite/engine-2.4/uninstalled-top.pc.in new file mode 100644 index 00000000000..e6dff4bb12e --- /dev/null +++ b/Build/source/libs/graphite/engine-2.4/uninstalled-top.pc.in @@ -0,0 +1,6 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +priv_includedir=@abs_srcdir@/src +includedir=@abs_srcdir@/include +libdir=@abs_builddir@/src/.libs +version=@VERSION@ diff --git a/Build/source/libs/graphite/include/graphite/Makefile.in b/Build/source/libs/graphite/include/graphite/Makefile.in index 11e834d52ae..ef0407aa03b 100644 --- a/Build/source/libs/graphite/include/graphite/Makefile.in +++ b/Build/source/libs/graphite/include/graphite/Makefile.in @@ -38,7 +38,7 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ subdir = include/graphite ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/../../m4/kpse-warnings.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/version.ac $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d diff --git a/Build/source/libs/graphite/version.ac b/Build/source/libs/graphite/version.ac new file mode 100644 index 00000000000..32329626e10 --- /dev/null +++ b/Build/source/libs/graphite/version.ac @@ -0,0 +1,11 @@ +dnl +dnl Copyright (C) 2012 Peter Breitenlohner +dnl +dnl This file is free software; the copyright holder +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl +dnl -------------------------------------------------------- +dnl +dnl m4-include this file to define the current silgraphite version (silgraphite/engine source tree) +m4_define([silgraphite_version], [2.4]) -- cgit v1.2.3