Sha256: 1fb027a3b3d7de27c1c2cc27390efc9ad8b530318973c4754f0d667bc676d205

Contents?: true

Size: 1.1 KB

Versions: 16

Compression:

Stored size: 1.1 KB

Contents

package magic

import (
	"bytes"
)

var (
	// Woff matches a Web Open Font Format file.
	Woff = prefix([]byte("wOFF"))
	// Woff2 matches a Web Open Font Format version 2 file.
	Woff2 = prefix([]byte("wOF2"))
	// Otf matches an OpenType font file.
	Otf = prefix([]byte{0x4F, 0x54, 0x54, 0x4F, 0x00})
)

// Ttf matches a TrueType font file.
func Ttf(raw []byte, limit uint32) bool {
	if !bytes.HasPrefix(raw, []byte{0x00, 0x01, 0x00, 0x00}) {
		return false
	}
	return !MsAccessAce(raw, limit) && !MsAccessMdb(raw, limit)
}

// Eot matches an Embedded OpenType font file.
func Eot(raw []byte, limit uint32) bool {
	return len(raw) > 35 &&
		bytes.Equal(raw[34:36], []byte{0x4C, 0x50}) &&
		(bytes.Equal(raw[8:11], []byte{0x02, 0x00, 0x01}) ||
			bytes.Equal(raw[8:11], []byte{0x01, 0x00, 0x00}) ||
			bytes.Equal(raw[8:11], []byte{0x02, 0x00, 0x02}))
}

// Ttc matches a TrueType Collection font file.
func Ttc(raw []byte, limit uint32) bool {
	return len(raw) > 7 &&
		bytes.HasPrefix(raw, []byte("ttcf")) &&
		(bytes.Equal(raw[4:8], []byte{0x00, 0x01, 0x00, 0x00}) ||
			bytes.Equal(raw[4:8], []byte{0x00, 0x02, 0x00, 0x00}))
}

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
ruby_snowflake_client-1.3.7 ext/vendor/github.com/gabriel-vasile/mimetype/internal/magic/font.go
ruby_snowflake_client-1.3.6 ext/vendor/github.com/gabriel-vasile/mimetype/internal/magic/font.go
ruby_snowflake_client-1.3.5 ext/vendor/github.com/gabriel-vasile/mimetype/internal/magic/font.go
ruby_snowflake_client-1.3.4 ext/vendor/github.com/gabriel-vasile/mimetype/internal/magic/font.go
ruby_snowflake_client-1.3.4.pre.debug ext/vendor/github.com/gabriel-vasile/mimetype/internal/magic/font.go
ruby_snowflake_client-1.3.3.pre.debug ext/vendor/github.com/gabriel-vasile/mimetype/internal/magic/font.go
ruby_snowflake_client-1.3.2 ext/vendor/github.com/gabriel-vasile/mimetype/internal/magic/font.go
ruby_snowflake_client-1.3.1 ext/vendor/github.com/gabriel-vasile/mimetype/internal/magic/font.go
ruby_snowflake_client-1.3.0 ext/vendor/github.com/gabriel-vasile/mimetype/internal/magic/font.go
ruby_snowflake_client-1.2.1 ext/vendor/github.com/gabriel-vasile/mimetype/internal/magic/font.go
ruby_snowflake_client-1.2.0 ext/vendor/github.com/gabriel-vasile/mimetype/internal/magic/font.go
ruby_snowflake_client-1.1.1 ext/vendor/github.com/gabriel-vasile/mimetype/internal/magic/font.go
ruby_snowflake_client-1.1.0 ext/vendor/github.com/gabriel-vasile/mimetype/internal/magic/font.go
ruby_snowflake_client-1.0.2 ext/vendor/github.com/gabriel-vasile/mimetype/internal/magic/font.go
ruby_snowflake_client-1.0.1 ext/vendor/github.com/gabriel-vasile/mimetype/internal/magic/font.go
ruby_snowflake_client-1.0.0 ext/vendor/github.com/gabriel-vasile/mimetype/internal/magic/font.go