The Birdfont Source Code


All Repositories / birdfont.git / blob – RSS feed

OtfInputStream.vala in libbirdfont/OpenFontFormat

This file is a part of the Birdfont project.

Contributing

Send patches or pull requests to johan.mattsson.m@gmail.com.
Clone this repository: git clone https://github.com/johanmattssonm/birdfont.git

Revisions

View the latest version of libbirdfont/OpenFontFormat/OtfInputStream.vala.
Merge ../birdfont-2.x
1 /* 2 Copyright (C) 2012, 2013 Johan Mattsson 3 4 This library is free software; you can redistribute it and/or modify 5 it under the terms of the GNU Lesser General Public License as 6 published by the Free Software Foundation; either version 3 of the 7 License, or (at your option) any later version. 8 9 This library is distributed in the hope that it will be useful, but 10 WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 Lesser General Public License for more details. 13 */ 14 15 namespace BirdFont { 16 17 /** Reader for otf data types. */ 18 public class OtfInputStream : GLib.Object { 19 20 public FileInputStream fin; 21 public DataInputStream din; 22 23 public OtfInputStream (FileInputStream i) throws Error { 24 din = new DataInputStream (i); 25 fin = i; 26 } 27 28 public void seek (int64 pos) throws Error 29 requires (fin.can_seek ()) { 30 int64 p = fin.tell (); 31 fin.seek (pos - p, SeekType.CUR); 32 } 33 34 public uint8 read_byte () throws Error { 35 return din.read_byte (); 36 } 37 38 public void close () { 39 try { 40 fin.close (); 41 din.close (); 42 } catch (GLib.IOError e) { 43 warning (e.message); 44 } 45 } 46 } 47 48 } 49