summaryrefslogtreecommitdiff
path: root/utf8fontfile_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'utf8fontfile_test.go')
-rw-r--r--utf8fontfile_test.go380
1 files changed, 380 insertions, 0 deletions
diff --git a/utf8fontfile_test.go b/utf8fontfile_test.go
new file mode 100644
index 0000000..0d808be
--- /dev/null
+++ b/utf8fontfile_test.go
@@ -0,0 +1,380 @@
+/*
+ * Copyright (c) 2013-2019 Kurt Jung (Gmail: kurt.w.jung)
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+package gofpdf
+
+import (
+ "io/ioutil"
+ "os"
+ "testing"
+)
+
+var testFontData = []byte{
+ 0, 1, 0, 0, 0, 10, 0, 128, 0, 3, 0, 32, 79, 83, 47, 50, 159,
+ 99, 23, 238, 0, 0, 0, 172, 0, 0, 0, 96, 99, 109, 97, 112, 206,
+ 122, 158, 30, 0, 0, 1, 12, 0, 0, 0, 98, 103, 108, 121, 102, 42,
+ 32, 194, 143, 0, 0, 1, 112, 0, 0, 4, 76, 104, 101, 97, 100, 17,
+ 101, 20, 54, 0, 0, 5, 188, 0, 0, 0, 54, 104, 104, 101, 97, 12,
+ 17, 9, 201, 0, 0, 5, 244, 0, 0, 0, 36, 104, 109, 116, 120, 27,
+ 88, 2, 101, 0, 0, 6, 24, 0, 0, 0, 28, 108, 111, 99, 97, 3, 252,
+ 5, 12, 0, 0, 6, 52, 0, 0, 0, 16, 109, 97, 120, 112, 0, 49, 1,
+ 111, 0, 0, 6, 68, 0, 0, 0, 32, 110, 97, 109, 101, 33, 238, 45,
+ 114, 0, 0, 6, 100, 0, 0, 13, 229, 112, 111, 115, 116, 255, 134,
+ 0, 50, 0, 0, 20, 76, 0, 0, 0, 32, 0, 3, 3, 211, 1, 144, 0, 5,
+ 0, 0, 2, 138, 2, 88, 0, 0, 0, 75, 2, 138, 2, 88, 0, 0, 1, 94,
+ 0, 50, 1, 69, 0, 0, 2, 11, 5, 0, 0, 0, 0, 0, 0, 0, 48, 0, 0,
+ 3, 43, 223, 60, 16, 0, 0, 0, 22, 0, 0, 0, 0, 71, 79, 79, 71,
+ 0, 64, 0, 0, 255, 255, 3, 112, 255, 136, 0, 0, 4, 136, 1, 64,
+ 96, 46, 1, 7, 0, 0, 0, 0, 2, 31, 2, 221, 0, 0, 0, 32, 0, 6, 0,
+ 0, 0, 1, 0, 3, 0, 1, 0, 0, 0, 12, 0, 4, 0, 80, 0, 0, 0, 14, 0,
+ 8, 0, 2, 0, 6, 78, 45, 89, 125, 96, 168, 101, 135, 255, 1, 255,
+ 12, 255, 255, 0, 0, 78, 45, 89, 125, 96, 168, 101, 135, 255,
+ 1, 255, 12, 255, 255, 177, 212, 166, 133, 159, 91, 154, 125,
+ 1, 5, 0, 249, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 1, 0, 2, 0, 3, 0, 4, 0, 6, 0, 5, 0, 0, 0, 0, 0, 5, 0, 100,
+ 255, 136, 3, 132, 3, 112, 0, 3, 0, 6, 0, 9, 0, 12, 0, 15, 0,
+ 0, 23, 17, 33, 17, 1, 1, 33, 1, 1, 17, 1, 33, 1, 1, 17, 1, 100,
+ 3, 32, 254, 112, 1, 62, 253, 132, 1, 94, 1, 62, 253, 100, 2,
+ 124, 254, 194, 254, 162, 1, 62, 120, 3, 232, 252, 24, 2, 29,
+ 1, 153, 254, 62, 254, 103, 3, 50, 252, 165, 1, 153, 1, 194, 252,
+ 206, 1, 153, 0, 0, 0, 3, 0, 100, 255, 180, 3, 131, 3, 69, 0,
+ 3, 0, 7, 0, 23, 0, 0, 1, 33, 17, 33, 1, 33, 17, 33, 37, 33, 17,
+ 35, 53, 33, 17, 35, 17, 33, 21, 35, 17, 33, 53, 51, 2, 24, 1,
+ 31, 254, 225, 254, 149, 1, 30, 254, 226, 1, 107, 1, 107, 76,
+ 254, 225, 77, 254, 226, 73, 1, 103, 77, 1, 65, 1, 9, 254, 247,
+ 1, 9, 73, 254, 44, 57, 254, 188, 1, 68, 62, 1, 217, 178, 0, 3,
+ 0, 30, 255, 178, 3, 188, 3, 68, 0, 8, 0, 45, 0, 80, 0, 0, 1,
+ 35, 6, 6, 7, 22, 23, 54, 54, 55, 23, 6, 6, 7, 22, 22, 23, 7,
+ 38, 39, 6, 6, 7, 38, 38, 39, 54, 54, 55, 38, 38, 39, 54, 54,
+ 55, 35, 53, 51, 54, 54, 55, 23, 6, 6, 7, 51, 5, 21, 35, 17, 20,
+ 6, 7, 6, 6, 39, 38, 38, 39, 22, 22, 55, 50, 53, 17, 35, 53, 51,
+ 53, 54, 54, 55, 33, 53, 33, 55, 23, 6, 6, 7, 21, 1, 94, 141,
+ 13, 31, 16, 60, 55, 31, 44, 43, 45, 12, 52, 41, 36, 60, 20, 50,
+ 38, 65, 42, 104, 62, 7, 27, 13, 59, 100, 40, 39, 83, 39, 18,
+ 36, 16, 92, 105, 11, 17, 5, 73, 7, 16, 11, 145, 2, 76, 220, 19,
+ 23, 23, 75, 58, 4, 16, 8, 44, 74, 11, 22, 231, 231, 38, 77, 31,
+ 254, 179, 1, 128, 17, 51, 37, 100, 53, 2, 51, 65, 124, 53, 39,
+ 44, 67, 162, 168, 11, 135, 215, 83, 31, 59, 26, 61, 49, 60, 66,
+ 98, 35, 14, 35, 10, 29, 95, 64, 33, 62, 26, 54, 141, 76, 69,
+ 53, 104, 47, 5, 46, 102, 51, 217, 71, 254, 180, 33, 35, 9, 8,
+ 5, 1, 16, 39, 16, 1, 1, 1, 19, 1, 76, 71, 114, 32, 90, 43, 69,
+ 4, 37, 55, 118, 46, 96, 0, 9, 0, 38, 255, 198, 3, 174, 3, 71,
+ 0, 21, 0, 31, 0, 41, 0, 51, 0, 69, 0, 79, 0, 95, 0, 118, 0, 128,
+ 0, 0, 1, 33, 6, 7, 38, 38, 39, 54, 54, 55, 23, 6, 7, 33, 55,
+ 23, 6, 6, 7, 39, 54, 54, 7, 55, 30, 2, 23, 7, 46, 2, 3, 7, 46,
+ 2, 39, 55, 30, 2, 3, 23, 6, 6, 7, 38, 38, 39, 54, 54, 55, 17,
+ 20, 6, 7, 6, 6, 35, 38, 38, 39, 22, 50, 55, 50, 54, 53, 17, 1,
+ 39, 62, 2, 55, 23, 14, 2, 19, 23, 6, 6, 7, 17, 35, 17, 6, 6,
+ 7, 38, 38, 39, 54, 54, 19, 51, 50, 54, 54, 55, 22, 22, 23, 14,
+ 2, 35, 35, 34, 38, 38, 53, 53, 51, 21, 20, 22, 37, 55, 30, 2,
+ 23, 7, 46, 2, 3, 77, 254, 136, 47, 57, 9, 35, 12, 51, 83, 25,
+ 69, 15, 18, 1, 118, 12, 51, 19, 43, 19, 63, 11, 25, 91, 60, 26,
+ 49, 40, 11, 64, 11, 39, 47, 150, 62, 12, 46, 56, 27, 57, 28,
+ 56, 48, 136, 68, 25, 73, 39, 10, 34, 12, 39, 66, 240, 14, 21,
+ 19, 63, 47, 3, 14, 7, 35, 56, 9, 10, 6, 254, 18, 70, 20, 38,
+ 32, 11, 67, 13, 31, 35, 137, 66, 18, 45, 25, 72, 23, 49, 24,
+ 7, 31, 11, 69, 127, 182, 230, 28, 27, 12, 2, 13, 40, 16, 5, 24,
+ 54, 50, 239, 58, 65, 25, 74, 29, 1, 143, 65, 24, 44, 35, 8, 71,
+ 7, 33, 42, 2, 166, 78, 56, 10, 29, 8, 44, 130, 70, 17, 37, 38,
+ 3, 14, 43, 92, 30, 13, 19, 52, 115, 28, 30, 71, 69, 28, 33, 28,
+ 71, 73, 254, 128, 36, 24, 61, 64, 26, 33, 25, 62, 60, 1, 160,
+ 19, 59, 112, 38, 9, 26, 7, 35, 99, 134, 254, 219, 28, 30, 8,
+ 9, 3, 15, 36, 14, 1, 1, 6, 8, 1, 36, 253, 88, 32, 29, 76, 78,
+ 32, 27, 32, 80, 77, 3, 76, 22, 37, 71, 35, 254, 106, 1, 61, 26,
+ 48, 20, 11, 37, 10, 52, 155, 253, 23, 16, 50, 50, 10, 15, 3,
+ 63, 68, 26, 17, 45, 40, 173, 172, 22, 12, 193, 25, 35, 81, 77,
+ 31, 29, 31, 79, 83, 0, 0, 0, 0, 3, 0, 40, 255, 181, 3, 195, 3,
+ 74, 0, 7, 0, 14, 0, 41, 0, 0, 1, 7, 38, 38, 39, 55, 22, 22, 23,
+ 33, 22, 22, 23, 54, 54, 37, 35, 6, 6, 7, 22, 22, 23, 6, 6, 7,
+ 38, 39, 6, 6, 7, 38, 38, 39, 54, 55, 38, 38, 39, 35, 53, 33,
+ 2, 66, 81, 9, 42, 23, 77, 23, 45, 141, 254, 88, 39, 109, 70,
+ 67, 102, 1, 22, 157, 43, 116, 75, 83, 202, 119, 13, 29, 9, 243,
+ 167, 84, 207, 125, 7, 28, 11, 246, 162, 77, 119, 44, 154, 3,
+ 128, 2, 177, 26, 31, 89, 37, 22, 35, 86, 133, 95, 169, 71, 68,
+ 166, 101, 118, 192, 77, 70, 104, 29, 13, 40, 16, 69, 150, 73,
+ 110, 40, 14, 42, 13, 70, 137, 80, 194, 113, 73, 0, 1, 0, 135,
+ 255, 149, 1, 74, 0, 235, 0, 18, 0, 0, 23, 39, 54, 54, 55, 6,
+ 34, 35, 34, 38, 53, 52, 54, 51, 50, 22, 21, 20, 6, 157, 22, 58,
+ 64, 4, 4, 8, 5, 31, 44, 45, 31, 41, 44, 94, 107, 53, 24, 72,
+ 51, 1, 36, 35, 35, 37, 62, 53, 81, 118, 0, 0, 0, 2, 0, 170, 255,
+ 251, 1, 74, 2, 236, 0, 5, 0, 17, 0, 0, 55, 3, 39, 51, 7, 3, 7,
+ 34, 38, 53, 52, 54, 51, 50, 22, 21, 20, 6, 217, 24, 3, 120, 2,
+ 25, 33, 33, 47, 47, 33, 33, 47, 47, 242, 1, 132, 118, 118, 254,
+ 124, 247, 42, 37, 35, 43, 43, 35, 37, 42, 0, 1, 0, 0, 0, 1, 1,
+ 6, 184, 191, 195, 30, 95, 15, 60, 245, 0, 1, 3, 232, 0, 0, 0,
+ 0, 209, 164, 13, 252, 0, 0, 0, 0, 217, 37, 193, 92, 252, 22,
+ 251, 232, 11, 112, 7, 16, 0, 0, 0, 3, 0, 2, 0, 0, 0, 0, 0, 0,
+ 0, 1, 0, 0, 4, 136, 254, 192, 0, 0, 11, 184, 252, 22, 255, 73,
+ 11, 112, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7,
+ 3, 232, 0, 100, 3, 232, 0, 100, 3, 232, 0, 30, 3, 232, 0, 38,
+ 3, 232, 0, 40, 3, 232, 0, 135, 3, 232, 0, 170, 0, 0, 0, 44, 0,
+ 88, 0, 212, 1, 158, 1, 230, 2, 6, 2, 38, 0, 0, 0, 0, 0, 7, 1,
+ 110, 0, 41, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 32, 1, 134, 0, 1, 0, 0, 0, 0, 0, 0, 0,
+ 74, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 24, 0, 74, 0, 1, 0, 0, 0,
+ 0, 0, 2, 0, 7, 0, 98, 0, 1, 0, 0, 0, 0, 0, 3, 0, 38, 0, 105,
+ 0, 1, 0, 0, 0, 0, 0, 4, 0, 24, 0, 74, 0, 1, 0, 0, 0, 0, 0, 5,
+ 0, 58, 0, 143, 0, 1, 0, 0, 0, 0, 0, 6, 0, 21, 0, 201, 0, 1, 0,
+ 0, 0, 0, 0, 7, 0, 34, 0, 222, 0, 1, 0, 0, 0, 0, 0, 8, 0, 26,
+ 1, 0, 0, 1, 0, 0, 0, 0, 0, 9, 0, 195, 1, 26, 0, 1, 0, 0, 0, 0,
+ 0, 10, 0, 128, 1, 221, 0, 1, 0, 0, 0, 0, 0, 11, 0, 31, 2, 93,
+ 0, 1, 0, 0, 0, 0, 0, 12, 0, 26, 2, 124, 0, 1, 0, 0, 0, 0, 0,
+ 13, 1, 75, 2, 150, 0, 1, 0, 0, 0, 0, 0, 14, 0, 26, 3, 225, 0,
+ 1, 0, 0, 0, 0, 0, 16, 0, 16, 3, 251, 0, 3, 0, 1, 4, 9, 0, 0,
+ 0, 148, 4, 11, 0, 3, 0, 1, 4, 9, 0, 1, 0, 48, 4, 159, 0, 3, 0,
+ 1, 4, 9, 0, 2, 0, 14, 4, 207, 0, 3, 0, 1, 4, 9, 0, 3, 0, 76,
+ 4, 221, 0, 3, 0, 1, 4, 9, 0, 4, 0, 48, 4, 159, 0, 3, 0, 1, 4,
+ 9, 0, 5, 0, 116, 5, 41, 0, 3, 0, 1, 4, 9, 0, 6, 0, 42, 5, 157,
+ 0, 3, 0, 1, 4, 9, 0, 7, 0, 68, 5, 199, 0, 3, 0, 1, 4, 9, 0, 8,
+ 0, 52, 6, 11, 0, 3, 0, 1, 4, 9, 0, 9, 1, 186, 6, 63, 0, 3, 0,
+ 1, 4, 9, 0, 10, 1, 10, 7, 249, 0, 3, 0, 1, 4, 9, 0, 11, 0, 62,
+ 9, 3, 0, 3, 0, 1, 4, 9, 0, 12, 0, 52, 9, 65, 0, 3, 0, 1, 4, 9,
+ 0, 13, 2, 150, 9, 117, 0, 3, 0, 1, 4, 9, 0, 14, 0, 52, 12, 11,
+ 0, 3, 0, 1, 4, 9, 0, 16, 0, 32, 12, 63, 67, 111, 112, 121, 114,
+ 105, 103, 104, 116, 32, 169, 32, 50, 48, 49, 52, 44, 32, 50,
+ 48, 49, 53, 32, 65, 100, 111, 98, 101, 32, 83, 121, 115, 116,
+ 101, 109, 115, 32, 73, 110, 99, 111, 114, 112, 111, 114, 97,
+ 116, 101, 100, 32, 40, 104, 116, 116, 112, 58, 47, 47, 119, 119,
+ 119, 46, 97, 100, 111, 98, 101, 46, 99, 111, 109, 47, 41, 46,
+ 78, 111, 116, 111, 32, 83, 97, 110, 115, 32, 67, 74, 75, 32,
+ 83, 67, 32, 82, 101, 103, 117, 108, 97, 114, 82, 101, 103, 117,
+ 108, 97, 114, 49, 46, 48, 48, 52, 59, 71, 79, 79, 71, 59, 78,
+ 111, 116, 111, 83, 97, 110, 115, 67, 74, 75, 115, 99, 45, 82,
+ 101, 103, 117, 108, 97, 114, 59, 65, 68, 79, 66, 69, 86, 101,
+ 114, 115, 105, 111, 110, 32, 49, 46, 48, 48, 52, 59, 80, 83,
+ 32, 49, 46, 48, 48, 52, 59, 104, 111, 116, 99, 111, 110, 118,
+ 32, 49, 46, 48, 46, 56, 50, 59, 109, 97, 107, 101, 111, 116,
+ 102, 46, 108, 105, 98, 50, 46, 53, 46, 54, 51, 52, 48, 54, 78,
+ 111, 116, 111, 83, 97, 110, 115, 67, 74, 75, 115, 99, 45, 82,
+ 101, 103, 117, 108, 97, 114, 78, 111, 116, 111, 32, 105, 115,
+ 32, 97, 32, 116, 114, 97, 100, 101, 109, 97, 114, 107, 32, 111,
+ 102, 32, 71, 111, 111, 103, 108, 101, 32, 73, 110, 99, 46, 65,
+ 100, 111, 98, 101, 32, 83, 121, 115, 116, 101, 109, 115, 32,
+ 73, 110, 99, 111, 114, 112, 111, 114, 97, 116, 101, 100, 82,
+ 121, 111, 107, 111, 32, 78, 73, 83, 72, 73, 90, 85, 75, 65, 32,
+ 40, 107, 97, 110, 97, 32, 38, 32, 105, 100, 101, 111, 103, 114,
+ 97, 112, 104, 115, 41, 59, 32, 80, 97, 117, 108, 32, 68, 46,
+ 32, 72, 117, 110, 116, 32, 40, 76, 97, 116, 105, 110, 44, 32,
+ 71, 114, 101, 101, 107, 32, 38, 32, 67, 121, 114, 105, 108, 108,
+ 105, 99, 41, 59, 32, 87, 101, 110, 108, 111, 110, 103, 32, 90,
+ 72, 65, 78, 71, 32, 40, 98, 111, 112, 111, 109, 111, 102, 111,
+ 41, 59, 32, 83, 97, 110, 100, 111, 108, 108, 32, 67, 111, 109,
+ 109, 117, 110, 105, 99, 97, 116, 105, 111, 110, 44, 32, 83, 111,
+ 111, 45, 121, 111, 117, 110, 103, 32, 74, 65, 78, 71, 32, 38,
+ 32, 74, 111, 111, 45, 121, 101, 111, 110, 32, 75, 65, 78, 71,
+ 32, 40, 104, 97, 110, 103, 117, 108, 32, 101, 108, 101, 109,
+ 101, 110, 116, 115, 44, 32, 108, 101, 116, 116, 101, 114, 115,
+ 32, 38, 32, 115, 121, 108, 108, 97, 98, 108, 101, 115, 41, 68,
+ 114, 46, 32, 75, 101, 110, 32, 76, 117, 110, 100, 101, 32, 40,
+ 112, 114, 111, 106, 101, 99, 116, 32, 97, 114, 99, 104, 105,
+ 116, 101, 99, 116, 44, 32, 103, 108, 121, 112, 104, 32, 115,
+ 101, 116, 32, 100, 101, 102, 105, 110, 105, 116, 105, 111, 110,
+ 32, 38, 32, 111, 118, 101, 114, 97, 108, 108, 32, 112, 114, 111,
+ 100, 117, 99, 116, 105, 111, 110, 41, 59, 32, 77, 97, 115, 97,
+ 116, 97, 107, 97, 32, 72, 65, 84, 84, 79, 82, 73, 32, 40, 112,
+ 114, 111, 100, 117, 99, 116, 105, 111, 110, 32, 38, 32, 105,
+ 100, 101, 111, 103, 114, 97, 112, 104, 32, 101, 108, 101, 109,
+ 101, 110, 116, 115, 41, 104, 116, 116, 112, 58, 47, 47, 119,
+ 119, 119, 46, 103, 111, 111, 103, 108, 101, 46, 99, 111, 109,
+ 47, 103, 101, 116, 47, 110, 111, 116, 111, 47, 104, 116, 116,
+ 112, 58, 47, 47, 119, 119, 119, 46, 97, 100, 111, 98, 101, 46,
+ 99, 111, 109, 47, 116, 121, 112, 101, 47, 84, 104, 105, 115,
+ 32, 70, 111, 110, 116, 32, 83, 111, 102, 116, 119, 97, 114, 101,
+ 32, 105, 115, 32, 108, 105, 99, 101, 110, 115, 101, 100, 32,
+ 117, 110, 100, 101, 114, 32, 116, 104, 101, 32, 83, 73, 76, 32,
+ 79, 112, 101, 110, 32, 70, 111, 110, 116, 32, 76, 105, 99, 101,
+ 110, 115, 101, 44, 32, 86, 101, 114, 115, 105, 111, 110, 32,
+ 49, 46, 49, 46, 32, 84, 104, 105, 115, 32, 70, 111, 110, 116,
+ 32, 83, 111, 102, 116, 119, 97, 114, 101, 32, 105, 115, 32, 100,
+ 105, 115, 116, 114, 105, 98, 117, 116, 101, 100, 32, 111, 110,
+ 32, 97, 110, 32, 34, 65, 83, 32, 73, 83, 34, 32, 66, 65, 83,
+ 73, 83, 44, 32, 87, 73, 84, 72, 79, 85, 84, 32, 87, 65, 82, 82,
+ 65, 78, 84, 73, 69, 83, 32, 79, 82, 32, 67, 79, 78, 68, 73, 84,
+ 73, 79, 78, 83, 32, 79, 70, 32, 65, 78, 89, 32, 75, 73, 78, 68,
+ 44, 32, 101, 105, 116, 104, 101, 114, 32, 101, 120, 112, 114,
+ 101, 115, 115, 32, 111, 114, 32, 105, 109, 112, 108, 105, 101,
+ 100, 46, 32, 83, 101, 101, 32, 116, 104, 101, 32, 83, 73, 76,
+ 32, 79, 112, 101, 110, 32, 70, 111, 110, 116, 32, 76, 105, 99,
+ 101, 110, 115, 101, 32, 102, 111, 114, 32, 116, 104, 101, 32,
+ 115, 112, 101, 99, 105, 102, 105, 99, 32, 108, 97, 110, 103,
+ 117, 97, 103, 101, 44, 32, 112, 101, 114, 109, 105, 115, 115,
+ 105, 111, 110, 115, 32, 97, 110, 100, 32, 108, 105, 109, 105,
+ 116, 97, 116, 105, 111, 110, 115, 32, 103, 111, 118, 101, 114,
+ 110, 105, 110, 103, 32, 121, 111, 117, 114, 32, 117, 115, 101,
+ 32, 111, 102, 32, 116, 104, 105, 115, 32, 70, 111, 110, 116,
+ 32, 83, 111, 102, 116, 119, 97, 114, 101, 46, 104, 116, 116,
+ 112, 58, 47, 47, 115, 99, 114, 105, 112, 116, 115, 46, 115, 105,
+ 108, 46, 111, 114, 103, 47, 79, 70, 76, 78, 111, 116, 111, 32,
+ 83, 97, 110, 115, 32, 67, 74, 75, 32, 83, 67, 0, 67, 0, 111,
+ 0, 112, 0, 121, 0, 114, 0, 105, 0, 103, 0, 104, 0, 116, 0, 32,
+ 0, 169, 0, 32, 0, 50, 0, 48, 0, 49, 0, 52, 0, 44, 0, 32, 0, 50,
+ 0, 48, 0, 49, 0, 53, 0, 32, 0, 65, 0, 100, 0, 111, 0, 98, 0,
+ 101, 0, 32, 0, 83, 0, 121, 0, 115, 0, 116, 0, 101, 0, 109, 0,
+ 115, 0, 32, 0, 73, 0, 110, 0, 99, 0, 111, 0, 114, 0, 112, 0,
+ 111, 0, 114, 0, 97, 0, 116, 0, 101, 0, 100, 0, 32, 0, 40, 0,
+ 104, 0, 116, 0, 116, 0, 112, 0, 58, 0, 47, 0, 47, 0, 119, 0,
+ 119, 0, 119, 0, 46, 0, 97, 0, 100, 0, 111, 0, 98, 0, 101, 0,
+ 46, 0, 99, 0, 111, 0, 109, 0, 47, 0, 41, 0, 46, 0, 78, 0, 111,
+ 0, 116, 0, 111, 0, 32, 0, 83, 0, 97, 0, 110, 0, 115, 0, 32, 0,
+ 67, 0, 74, 0, 75, 0, 32, 0, 83, 0, 67, 0, 32, 0, 82, 0, 101,
+ 0, 103, 0, 117, 0, 108, 0, 97, 0, 114, 0, 82, 0, 101, 0, 103,
+ 0, 117, 0, 108, 0, 97, 0, 114, 0, 49, 0, 46, 0, 48, 0, 48, 0,
+ 52, 0, 59, 0, 71, 0, 79, 0, 79, 0, 71, 0, 59, 0, 78, 0, 111,
+ 0, 116, 0, 111, 0, 83, 0, 97, 0, 110, 0, 115, 0, 67, 0, 74, 0,
+ 75, 0, 115, 0, 99, 0, 45, 0, 82, 0, 101, 0, 103, 0, 117, 0, 108,
+ 0, 97, 0, 114, 0, 59, 0, 65, 0, 68, 0, 79, 0, 66, 0, 69, 0, 86,
+ 0, 101, 0, 114, 0, 115, 0, 105, 0, 111, 0, 110, 0, 32, 0, 49,
+ 0, 46, 0, 48, 0, 48, 0, 52, 0, 59, 0, 80, 0, 83, 0, 32, 0, 49,
+ 0, 46, 0, 48, 0, 48, 0, 52, 0, 59, 0, 104, 0, 111, 0, 116, 0,
+ 99, 0, 111, 0, 110, 0, 118, 0, 32, 0, 49, 0, 46, 0, 48, 0, 46,
+ 0, 56, 0, 50, 0, 59, 0, 109, 0, 97, 0, 107, 0, 101, 0, 111, 0,
+ 116, 0, 102, 0, 46, 0, 108, 0, 105, 0, 98, 0, 50, 0, 46, 0, 53,
+ 0, 46, 0, 54, 0, 51, 0, 52, 0, 48, 0, 54, 0, 78, 0, 111, 0, 116,
+ 0, 111, 0, 83, 0, 97, 0, 110, 0, 115, 0, 67, 0, 74, 0, 75, 0,
+ 115, 0, 99, 0, 45, 0, 82, 0, 101, 0, 103, 0, 117, 0, 108, 0,
+ 97, 0, 114, 0, 78, 0, 111, 0, 116, 0, 111, 0, 32, 0, 105, 0,
+ 115, 0, 32, 0, 97, 0, 32, 0, 116, 0, 114, 0, 97, 0, 100, 0, 101,
+ 0, 109, 0, 97, 0, 114, 0, 107, 0, 32, 0, 111, 0, 102, 0, 32,
+ 0, 71, 0, 111, 0, 111, 0, 103, 0, 108, 0, 101, 0, 32, 0, 73,
+ 0, 110, 0, 99, 0, 46, 0, 65, 0, 100, 0, 111, 0, 98, 0, 101, 0,
+ 32, 0, 83, 0, 121, 0, 115, 0, 116, 0, 101, 0, 109, 0, 115, 0,
+ 32, 0, 73, 0, 110, 0, 99, 0, 111, 0, 114, 0, 112, 0, 111, 0,
+ 114, 0, 97, 0, 116, 0, 101, 0, 100, 0, 82, 0, 121, 0, 111, 0,
+ 107, 0, 111, 0, 32, 0, 78, 0, 73, 0, 83, 0, 72, 0, 73, 0, 90,
+ 0, 85, 0, 75, 0, 65, 0, 32, 137, 127, 88, 90, 109, 188, 91, 80,
+ 0, 32, 0, 40, 0, 107, 0, 97, 0, 110, 0, 97, 0, 32, 0, 38, 0,
+ 32, 0, 105, 0, 100, 0, 101, 0, 111, 0, 103, 0, 114, 0, 97, 0,
+ 112, 0, 104, 0, 115, 0, 41, 0, 59, 0, 32, 0, 80, 0, 97, 0, 117,
+ 0, 108, 0, 32, 0, 68, 0, 46, 0, 32, 0, 72, 0, 117, 0, 110, 0,
+ 116, 0, 32, 0, 40, 0, 76, 0, 97, 0, 116, 0, 105, 0, 110, 0, 44,
+ 0, 32, 0, 71, 0, 114, 0, 101, 0, 101, 0, 107, 0, 32, 0, 38, 0,
+ 32, 0, 67, 0, 121, 0, 114, 0, 105, 0, 108, 0, 108, 0, 105, 0,
+ 99, 0, 41, 0, 59, 0, 32, 0, 87, 0, 101, 0, 110, 0, 108, 0, 111,
+ 0, 110, 0, 103, 0, 32, 0, 90, 0, 72, 0, 65, 0, 78, 0, 71, 0,
+ 32, 95, 32, 101, 135, 159, 153, 0, 32, 0, 40, 0, 98, 0, 111,
+ 0, 112, 0, 111, 0, 109, 0, 111, 0, 102, 0, 111, 0, 41, 0, 59,
+ 0, 32, 0, 83, 0, 97, 0, 110, 0, 100, 0, 111, 0, 108, 0, 108,
+ 0, 32, 0, 67, 0, 111, 0, 109, 0, 109, 0, 117, 0, 110, 0, 105,
+ 0, 99, 0, 97, 0, 116, 0, 105, 0, 111, 0, 110, 0, 32, 192, 176,
+ 179, 204, 206, 228, 187, 164, 178, 200, 207, 0, 199, 116, 193,
+ 88, 0, 44, 0, 32, 0, 83, 0, 111, 0, 111, 0, 45, 0, 121, 0, 111,
+ 0, 117, 0, 110, 0, 103, 0, 32, 0, 74, 0, 65, 0, 78, 0, 71, 0,
+ 32, 199, 165, 194, 24, 198, 1, 0, 32, 0, 38, 0, 32, 0, 74, 0,
+ 111, 0, 111, 0, 45, 0, 121, 0, 101, 0, 111, 0, 110, 0, 32, 0,
+ 75, 0, 65, 0, 78, 0, 71, 0, 32, 172, 21, 200, 252, 197, 240,
+ 0, 32, 0, 40, 0, 104, 0, 97, 0, 110, 0, 103, 0, 117, 0, 108,
+ 0, 32, 0, 101, 0, 108, 0, 101, 0, 109, 0, 101, 0, 110, 0, 116,
+ 0, 115, 0, 44, 0, 32, 0, 108, 0, 101, 0, 116, 0, 116, 0, 101,
+ 0, 114, 0, 115, 0, 32, 0, 38, 0, 32, 0, 115, 0, 121, 0, 108,
+ 0, 108, 0, 97, 0, 98, 0, 108, 0, 101, 0, 115, 0, 41, 0, 68, 0,
+ 114, 0, 46, 0, 32, 0, 75, 0, 101, 0, 110, 0, 32, 0, 76, 0, 117,
+ 0, 110, 0, 100, 0, 101, 0, 32, 0, 40, 0, 112, 0, 114, 0, 111,
+ 0, 106, 0, 101, 0, 99, 0, 116, 0, 32, 0, 97, 0, 114, 0, 99, 0,
+ 104, 0, 105, 0, 116, 0, 101, 0, 99, 0, 116, 0, 44, 0, 32, 0,
+ 103, 0, 108, 0, 121, 0, 112, 0, 104, 0, 32, 0, 115, 0, 101, 0,
+ 116, 0, 32, 0, 100, 0, 101, 0, 102, 0, 105, 0, 110, 0, 105, 0,
+ 116, 0, 105, 0, 111, 0, 110, 0, 32, 0, 38, 0, 32, 0, 111, 0,
+ 118, 0, 101, 0, 114, 0, 97, 0, 108, 0, 108, 0, 32, 0, 112, 0,
+ 114, 0, 111, 0, 100, 0, 117, 0, 99, 0, 116, 0, 105, 0, 111, 0,
+ 110, 0, 41, 0, 59, 0, 32, 0, 77, 0, 97, 0, 115, 0, 97, 0, 116,
+ 0, 97, 0, 107, 0, 97, 0, 32, 0, 72, 0, 65, 0, 84, 0, 84, 0, 79,
+ 0, 82, 0, 73, 0, 32, 103, 13, 144, 232, 107, 99, 140, 180, 0,
+ 32, 0, 40, 0, 112, 0, 114, 0, 111, 0, 100, 0, 117, 0, 99, 0,
+ 116, 0, 105, 0, 111, 0, 110, 0, 32, 0, 38, 0, 32, 0, 105, 0,
+ 100, 0, 101, 0, 111, 0, 103, 0, 114, 0, 97, 0, 112, 0, 104, 0,
+ 32, 0, 101, 0, 108, 0, 101, 0, 109, 0, 101, 0, 110, 0, 116, 0,
+ 115, 0, 41, 0, 104, 0, 116, 0, 116, 0, 112, 0, 58, 0, 47, 0,
+ 47, 0, 119, 0, 119, 0, 119, 0, 46, 0, 103, 0, 111, 0, 111, 0,
+ 103, 0, 108, 0, 101, 0, 46, 0, 99, 0, 111, 0, 109, 0, 47, 0,
+ 103, 0, 101, 0, 116, 0, 47, 0, 110, 0, 111, 0, 116, 0, 111, 0,
+ 47, 0, 104, 0, 116, 0, 116, 0, 112, 0, 58, 0, 47, 0, 47, 0, 119,
+ 0, 119, 0, 119, 0, 46, 0, 97, 0, 100, 0, 111, 0, 98, 0, 101,
+ 0, 46, 0, 99, 0, 111, 0, 109, 0, 47, 0, 116, 0, 121, 0, 112,
+ 0, 101, 0, 47, 0, 84, 0, 104, 0, 105, 0, 115, 0, 32, 0, 70, 0,
+ 111, 0, 110, 0, 116, 0, 32, 0, 83, 0, 111, 0, 102, 0, 116, 0,
+ 119, 0, 97, 0, 114, 0, 101, 0, 32, 0, 105, 0, 115, 0, 32, 0,
+ 108, 0, 105, 0, 99, 0, 101, 0, 110, 0, 115, 0, 101, 0, 100, 0,
+ 32, 0, 117, 0, 110, 0, 100, 0, 101, 0, 114, 0, 32, 0, 116, 0,
+ 104, 0, 101, 0, 32, 0, 83, 0, 73, 0, 76, 0, 32, 0, 79, 0, 112,
+ 0, 101, 0, 110, 0, 32, 0, 70, 0, 111, 0, 110, 0, 116, 0, 32,
+ 0, 76, 0, 105, 0, 99, 0, 101, 0, 110, 0, 115, 0, 101, 0, 44,
+ 0, 32, 0, 86, 0, 101, 0, 114, 0, 115, 0, 105, 0, 111, 0, 110,
+ 0, 32, 0, 49, 0, 46, 0, 49, 0, 46, 0, 32, 0, 84, 0, 104, 0, 105,
+ 0, 115, 0, 32, 0, 70, 0, 111, 0, 110, 0, 116, 0, 32, 0, 83, 0,
+ 111, 0, 102, 0, 116, 0, 119, 0, 97, 0, 114, 0, 101, 0, 32, 0,
+ 105, 0, 115, 0, 32, 0, 100, 0, 105, 0, 115, 0, 116, 0, 114, 0,
+ 105, 0, 98, 0, 117, 0, 116, 0, 101, 0, 100, 0, 32, 0, 111, 0,
+ 110, 0, 32, 0, 97, 0, 110, 0, 32, 0, 34, 0, 65, 0, 83, 0, 32,
+ 0, 73, 0, 83, 0, 34, 0, 32, 0, 66, 0, 65, 0, 83, 0, 73, 0, 83,
+ 0, 44, 0, 32, 0, 87, 0, 73, 0, 84, 0, 72, 0, 79, 0, 85, 0, 84,
+ 0, 32, 0, 87, 0, 65, 0, 82, 0, 82, 0, 65, 0, 78, 0, 84, 0, 73,
+ 0, 69, 0, 83, 0, 32, 0, 79, 0, 82, 0, 32, 0, 67, 0, 79, 0, 78,
+ 0, 68, 0, 73, 0, 84, 0, 73, 0, 79, 0, 78, 0, 83, 0, 32, 0, 79,
+ 0, 70, 0, 32, 0, 65, 0, 78, 0, 89, 0, 32, 0, 75, 0, 73, 0, 78,
+ 0, 68, 0, 44, 0, 32, 0, 101, 0, 105, 0, 116, 0, 104, 0, 101,
+ 0, 114, 0, 32, 0, 101, 0, 120, 0, 112, 0, 114, 0, 101, 0, 115,
+ 0, 115, 0, 32, 0, 111, 0, 114, 0, 32, 0, 105, 0, 109, 0, 112,
+ 0, 108, 0, 105, 0, 101, 0, 100, 0, 46, 0, 32, 0, 83, 0, 101,
+ 0, 101, 0, 32, 0, 116, 0, 104, 0, 101, 0, 32, 0, 83, 0, 73, 0,
+ 76, 0, 32, 0, 79, 0, 112, 0, 101, 0, 110, 0, 32, 0, 70, 0, 111,
+ 0, 110, 0, 116, 0, 32, 0, 76, 0, 105, 0, 99, 0, 101, 0, 110,
+ 0, 115, 0, 101, 0, 32, 0, 102, 0, 111, 0, 114, 0, 32, 0, 116,
+ 0, 104, 0, 101, 0, 32, 0, 115, 0, 112, 0, 101, 0, 99, 0, 105,
+ 0, 102, 0, 105, 0, 99, 0, 32, 0, 108, 0, 97, 0, 110, 0, 103,
+ 0, 117, 0, 97, 0, 103, 0, 101, 0, 44, 0, 32, 0, 112, 0, 101,
+ 0, 114, 0, 109, 0, 105, 0, 115, 0, 115, 0, 105, 0, 111, 0, 110,
+ 0, 115, 0, 32, 0, 97, 0, 110, 0, 100, 0, 32, 0, 108, 0, 105,
+ 0, 109, 0, 105, 0, 116, 0, 97, 0, 116, 0, 105, 0, 111, 0, 110,
+ 0, 115, 0, 32, 0, 103, 0, 111, 0, 118, 0, 101, 0, 114, 0, 110,
+ 0, 105, 0, 110, 0, 103, 0, 32, 0, 121, 0, 111, 0, 117, 0, 114,
+ 0, 32, 0, 117, 0, 115, 0, 101, 0, 32, 0, 111, 0, 102, 0, 32,
+ 0, 116, 0, 104, 0, 105, 0, 115, 0, 32, 0, 70, 0, 111, 0, 110,
+ 0, 116, 0, 32, 0, 83, 0, 111, 0, 102, 0, 116, 0, 119, 0, 97,
+ 0, 114, 0, 101, 0, 46, 0, 104, 0, 116, 0, 116, 0, 112, 0, 58,
+ 0, 47, 0, 47, 0, 115, 0, 99, 0, 114, 0, 105, 0, 112, 0, 116,
+ 0, 115, 0, 46, 0, 115, 0, 105, 0, 108, 0, 46, 0, 111, 0, 114,
+ 0, 103, 0, 47, 0, 79, 0, 70, 0, 76, 0, 78, 0, 111, 0, 116, 0,
+ 111, 0, 32, 0, 83, 0, 97, 0, 110, 0, 115, 0, 32, 0, 67, 0, 74,
+ 0, 75, 0, 32, 0, 83, 0, 67, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0,
+ 255, 131, 0, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0}
+
+func TestUTF8CutFont(t *testing.T) {
+ in := testFontData
+ out := UTF8CutFont(in, "中")
+ if len(out) == 0 {
+ t.Fatal()
+ }
+ tf, err := ioutil.TempFile(os.TempDir(), "mcuts*.ttf")
+ if err != nil {
+ t.Fatal(err)
+ }
+ fn := tf.Name()
+ t.Log(fn)
+ defer os.Remove(fn)
+ ioutil.WriteFile(fn, out, 0644)
+ ttf, err := TtfParse(fn)
+ if err != nil {
+ t.Fatal(err)
+ }
+ chars := ttf.Chars
+ if l := len(chars); l != 1 {
+ t.Fatal(l)
+ }
+ if _, ok := chars[uint16(rune('中'))]; !ok {
+ t.Fatal(chars)
+ }
+}