Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TTFFont.parse should call *Table constructors with explicit @tag param #306

Merged
merged 3 commits into from
Sep 15, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions lib/font/table.coffee
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
class Table
constructor: (@file, @tag) ->
@tag ?= @constructor.name.replace('Table', '').toLowerCase()
constructor: (@file) ->
info = @file.directory.tables[@tag]
@exists = !!info

Expand Down
4 changes: 4 additions & 0 deletions lib/font/tables/cmap.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ Table = require '../table'
Data = require '../../data'

class CmapTable extends Table
constructor: ->
@tag = 'cmap'
super

parse: (data) ->
data.pos = @offset

Expand Down
4 changes: 4 additions & 0 deletions lib/font/tables/glyf.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ Table = require '../table'
Data = require '../../data'

class GlyfTable extends Table
constructor: ->
@tag = 'glyf'
super

parse: (data) ->
# We're not going to parse the whole glyf table, just the glyfs we need. See below.
@cache = {}
Expand Down
4 changes: 4 additions & 0 deletions lib/font/tables/head.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ Table = require '../table'
Data = require '../../data'

class HeadTable extends Table
constructor: ->
@tag = 'head'
super

parse: (data) ->
data.pos = @offset

Expand Down
4 changes: 4 additions & 0 deletions lib/font/tables/hhea.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ Table = require '../table'
Data = require '../../data'

class HheaTable extends Table
constructor: ->
@tag = 'hhea'
super

parse: (data) ->
data.pos = @offset

Expand Down
4 changes: 4 additions & 0 deletions lib/font/tables/hmtx.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ Table = require '../table'
Data = require '../../data'

class HmtxTable extends Table
constructor: ->
@tag = 'hmtx'
super

parse: (data) ->
data.pos = @offset

Expand Down
4 changes: 4 additions & 0 deletions lib/font/tables/loca.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ Table = require '../table'
Data = require '../../data'

class LocaTable extends Table
constructor: ->
@tag = 'loca'
super

parse: (data) ->
data.pos = @offset
format = @file.head.indexToLocFormat
Expand Down
4 changes: 4 additions & 0 deletions lib/font/tables/maxp.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ Table = require '../table'
Data = require '../../data'

class MaxpTable extends Table
constructor: ->
@tag = 'maxp'
super

parse: (data) ->
data.pos = @offset

Expand Down
4 changes: 4 additions & 0 deletions lib/font/tables/name.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ Data = require '../../data'
utils = require '../utils'

class NameTable extends Table
constructor: ->
@tag = 'name'
super

parse: (data) ->
data.pos = @offset

Expand Down
4 changes: 4 additions & 0 deletions lib/font/tables/post.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ Table = require '../table'
Data = require '../../data'

class PostTable extends Table
constructor: ->
@tag = 'post'
super

parse: (data) ->
data.pos = @offset

Expand Down