### Home Classes Methods

### In Files

- lib/prawn/font/dfont.rb

### Parent

Prawn::Font::TTF

### Methods

- ::font_count
- ::named_fonts

### Files

- COPYING
- HACKING
- LICENSE
- README

### Class/Module Index

Quicksearch

- Prawn
- Prawn::Core
- Prawn::Document
- Prawn::Document::Annotations
- Prawn::Document::BoundingBox
- Prawn::Document::ColumnBox
- Prawn::Document::Destinations
- Prawn::Document::GraphicsState
- Prawn::Document::Internals
- Prawn::Document::PageGeometry
- Prawn::Document::Snapshot
- Prawn::Encoding
- Prawn::Errors
- Prawn::Font
- Prawn::Font::AFM
- Prawn::Font::DFont
- Prawn::Font::TTF
- Prawn::Graphics
- Prawn::Graphics::CapStyle
- Prawn::Graphics::Color
- Prawn::Graphics::Dash
- Prawn::Graphics::JoinStyle
- Prawn::Graphics::Transformation
- Prawn::Graphics::Transparency
- Prawn::Images
- Prawn::Images::JPG
- Prawn::Images::PNG
- Prawn::Measurements
- Prawn::Outline
- Prawn::Stamp
- Prawn::Text
- Prawn::Text::Box
- Prawn::Text::LineWrap
- File
- Numeric

No matching classes.

# Prawn::Font::DFont

### Public Class Methods

font_count(file) click to toggle source

Returns the number of fonts contained in the dfont file.

    # File lib/prawn/font/dfont.rb, line 28
    def self.font_count(file)
      TTFunk::ResourceFile.open(file) do |f|
        return f.map["sfnt"][:list].length
      end
    end

named_fonts(file) click to toggle source

Returns a list of the names of all named fonts in the given dfont file. Note that fonts are not required to be named in a dfont file, so the list may be empty even if the file does contain fonts. Also, note that the list is returned in no particular order, so the first font in the list is not necessarily the font at index 0 in the file.

    # File lib/prawn/font/dfont.rb, line 20
    def self.named_fonts(file)
      TTFunk::ResourceFile.open(file) do |f|
        return f.resources_for("sfnt")
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.