1 /*
2 * Linear Thresholds for advance width calculation Table
3 *
4 * Copyright © 1997-1998 Herbert Duerr
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
15 *
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; if not, write to the Free Softaware
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 *
20 */
21
22 #include "ttf.h"
23
LtshTable(RandomAccessFile & f,int offset,int length)24 LtshTable::LtshTable(RandomAccessFile &f, int offset, int length):
25 RandomAccessFile(f, offset, length)
26 {
27 /* version = */readUShort();
28 numGlyphs = readUShort();
29 }
30
31 int
getLinearThreshold(int glyphNo)32 LtshTable::getLinearThreshold(int glyphNo)
33 {
34 if (glyphNo < 0 || glyphNo >= numGlyphs)
35 return 0;
36
37 seekAbsolute(4 + glyphNo);
38
39 int yPel = readUByte();
40 debug("ltsh::getThreshold(glyphNo = %d) = %d\n", glyphNo, yPel);
41
42 return yPel;
43 }
44