Updated version to 1.0.2.
[zpb-ttf.git] / hhea.lisp
blobf01d862c20f2746dc593c319340bba02827ba485
1 ;;; Copyright (c) 2006 Zachary Beane, All Rights Reserved
2 ;;;
3 ;;; Redistribution and use in source and binary forms, with or without
4 ;;; modification, are permitted provided that the following conditions
5 ;;; are met:
6 ;;;
7 ;;; * Redistributions of source code must retain the above copyright
8 ;;; notice, this list of conditions and the following disclaimer.
9 ;;;
10 ;;; * Redistributions in binary form must reproduce the above
11 ;;; copyright notice, this list of conditions and the following
12 ;;; disclaimer in the documentation and/or other materials
13 ;;; provided with the distribution.
14 ;;;
15 ;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESSED
16 ;;; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 ;;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 ;;; ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
19 ;;; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 ;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
21 ;;; GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 ;;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23 ;;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
24 ;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 ;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 ;;;
27 ;;; Loading data from the "hhea" table.
28 ;;;
29 ;;; http://www.microsoft.com/OpenType/OTSpec/hhea.htm
30 ;;; http://developer.apple.com/fonts/TTRefMan/RM06/Chap6hhea.html
31 ;;;
32 ;;; $Id: hhea.lisp,v 1.4 2006/02/18 23:13:43 xach Exp $
34 (in-package #:zpb-ttf)
36 (defmethod load-hhea-info ((font-loader font-loader))
37 (seek-to-table "hhea" font-loader)
38 (with-slots (input-stream ascender descender line-gap)
39 font-loader
40 (let ((version (read-fixed input-stream)))
41 (check-version "\"hhea\" table" version #x00010000))
42 (setf ascender (read-fword input-stream)
43 descender (read-fword input-stream)
44 line-gap (read-fword input-stream))))
46 (defmethod horizontal-metrics-count ((font-loader font-loader))
47 (seek-to-table "hhea" font-loader)
48 (with-slots (input-stream) font-loader
49 ;; Skip to the end, since all we care about is the last item
50 (advance-file-position input-stream 34)
51 (read-uint16 input-stream)))