summaryrefslogtreecommitdiff
path: root/Build/source/texk/ttfdump/libttf/ttfutil.c
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2006-01-17 21:41:51 +0000
committerKarl Berry <karl@freefriends.org>2006-01-17 21:41:51 +0000
commit487ca4806cc046076293cf6cc5fbba0db282bac7 (patch)
tree847b412ab5158dd7bdd7ed7e5a4cc3fbca94be32 /Build/source/texk/ttfdump/libttf/ttfutil.c
parenta3d3111bfe26b8e5f5bc6049dfb2a4ca2edc7881 (diff)
texk 1
git-svn-id: svn://tug.org/texlive/trunk@1485 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/ttfdump/libttf/ttfutil.c')
-rw-r--r--Build/source/texk/ttfdump/libttf/ttfutil.c57
1 files changed, 57 insertions, 0 deletions
diff --git a/Build/source/texk/ttfdump/libttf/ttfutil.c b/Build/source/texk/ttfdump/libttf/ttfutil.c
new file mode 100644
index 00000000000..d2ae4f31580
--- /dev/null
+++ b/Build/source/texk/ttfdump/libttf/ttfutil.c
@@ -0,0 +1,57 @@
+#include <stdio.h>
+#include "ttf.h"
+#include "ttfutil.h"
+
+/* $Id: ttfutil.c,v 1.1.1.1 1998/06/05 07:47:52 robert Exp $ */
+
+#ifndef lint
+static char vcid[] = "$Id: ttfutil.c,v 1.1.1.1 1998/06/05 07:47:52 robert Exp $";
+#endif /* lint */
+
+/* FixedSplit: split Fixed in to two interger (16.16) */
+void FixedSplit(Fixed f,int b[])
+{
+ b[0] = f & 0xff00;
+ b[1] = f >> 16;
+}
+
+/*
+ * Invert byte order within each 16-bits of an array.
+ */
+void
+TwoByteSwap(unsigned char *buf, int nbytes)
+{
+ register unsigned char c;
+
+ for (; nbytes > 0; nbytes -= 2, buf += 2)
+ {
+ c = buf[0];
+ buf[0] = buf[1];
+ buf[1] = c;
+ }
+}
+
+/*
+ * Invert byte order within each 32-bits of an array.
+ */
+
+void
+FourByteSwap(unsigned char *buf, int nbytes)
+{
+ register unsigned char c;
+
+ for (; nbytes > 0; nbytes -= 4, buf += 4)
+ {
+ c = buf[0];
+ buf[0] = buf[3];
+ buf[3] = c;
+ c = buf[1];
+ buf[1] = buf[2];
+ buf[2] = c;
+ }
+}
+
+void ttfError(char * msg)
+{
+ fprintf(stderr,"%s",msg);
+}