summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/xetexdir/XeTeX_ext.c
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/texk/web2c/xetexdir/XeTeX_ext.c')
-rw-r--r--Build/source/texk/web2c/xetexdir/XeTeX_ext.c72
1 files changed, 52 insertions, 20 deletions
diff --git a/Build/source/texk/web2c/xetexdir/XeTeX_ext.c b/Build/source/texk/web2c/xetexdir/XeTeX_ext.c
index a6b55929882..4fbb13986db 100644
--- a/Build/source/texk/web2c/xetexdir/XeTeX_ext.c
+++ b/Build/source/texk/web2c/xetexdir/XeTeX_ext.c
@@ -1,31 +1,33 @@
/****************************************************************************\
Part of the XeTeX typesetting system
- copyright (c) 1994-2006 by SIL International
- written by Jonathan Kew
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
+ copyright (c) 1994-2008 by SIL International
+ copyright (c) 2009 by Jonathan Kew
+
+ Written by Jonathan Kew
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
the following conditions:
-The above copyright notice and this permission notice shall be
+The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL SIL INTERNATIONAL BE LIABLE FOR
-ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE
+FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-Except as contained in this notice, the name of SIL International
-shall not be used in advertising or otherwise to promote the sale,
-use or other dealings in this Software without prior written
-authorization from SIL International.
+Except as contained in this notice, the name of the copyright holders
+shall not be used in advertising or otherwise to promote the sale,
+use or other dealings in this Software without prior written
+authorization from the copyright holders.
\****************************************************************************/
/* XeTeX_ext.c
@@ -2046,6 +2048,36 @@ getnativecharsidebearings(integer font, integer ch, scaled* lsb, scaled* rsb)
}
scaled
+getglyphbounds(integer font, integer edge, integer gid)
+{
+/* edge codes 1,2,3,4 => L T R B */
+ float a, b;
+
+#ifdef XETEX_MAC
+ if (fontarea[font] == AAT_FONT_FLAG) {
+ ATSUStyle style = (ATSUStyle)(fontlayoutengine[font]);
+ if (edge & 1)
+ GetGlyphSidebearings_AAT(style, gid, &a, &b);
+ else
+ GetGlyphHeightDepth_AAT(style, gid, &a, &b);
+ }
+ else
+#endif
+ if (fontarea[font] == OTGR_FONT_FLAG) {
+ XeTeXLayoutEngine engine = (XeTeXLayoutEngine)fontlayoutengine[font];
+ if (edge & 1)
+ getGlyphSidebearings(engine, gid, &a, &b);
+ else
+ getGlyphHeightDepth(engine, gid, &a, &b);
+ }
+ else {
+ fprintf(stderr, "\n! Internal error: bad native font flag\n");
+ exit(3);
+ }
+ return X2Fix((edge <= 2) ? a : b);
+}
+
+scaled
getnativecharic(integer f, integer c)
{
scaled lsb, rsb;