Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
31 changed files
with
282 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
members = [ | ||
"otf", | ||
"pdfrs", | ||
"pdfrs-afm", | ||
"pdfrs-macros", | ||
"serde_pdf", | ||
] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
[package] | ||
name = "pdfrs-afm" | ||
version = "0.1.0" | ||
authors = ["Markus Ast <m@rkusa.st>"] | ||
edition = "2018" | ||
|
||
[dependencies] | ||
lazy_static = "1.4" | ||
|
||
[build-dependencies] | ||
regex = "1.1" | ||
itertools = "0.9" | ||
Inflector = "0.11" | ||
|
||
[features] | ||
default = ["helvetica"] | ||
|
||
all_fonts = [ | ||
"courier_bold", | ||
"courier_bold_oblique", | ||
"courier_oblique", | ||
"courier", | ||
"helvetica_bold", | ||
"helvetica_bold_oblique", | ||
"helvetica_oblique", | ||
"helvetica", | ||
"symbol", | ||
"times_bold", | ||
"times_bold_italic", | ||
"times_italic", | ||
"times_roman", | ||
"zapf_dingbats", | ||
] | ||
|
||
courier_bold = [] | ||
courier_bold_oblique = [] | ||
courier_oblique = [] | ||
courier = [] | ||
helvetica_bold = [] | ||
helvetica_bold_oblique = [] | ||
helvetica_oblique = [] | ||
helvetica = [] | ||
symbol = [] | ||
times_bold = [] | ||
times_bold_italic = [] | ||
times_italic = [] | ||
times_roman = [] | ||
zapf_dingbats = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
//! This module contains built-in PDF (AFM) fonts. When using those fonts, it is not necessary | ||
//! to embed a font into the document, since each PDF reader provides them. However, compared to | ||
//! embedding fonts, those AFM fonts only have a limited set of available characters. | ||
//! | ||
//! Each AFM font needs to be enabled via a Cargo feature. Only `HELVETICA` is enabled as part of | ||
//! the default feature set. The following features for enabling AFM fonts are available: | ||
//! `courier_bold`, `courier_bold_oblique`, `courier_oblique`, `courier`, `helvetica_bold`, | ||
//! `helvetica_bold_oblique`, `helvetica_oblique`, `helvetica`, `symbol`, `times_bold`, | ||
//! `times_bold_italic`, `times_italic`, `times_roman`, `zapf_dingbats`. | ||
|
||
#[macro_use] | ||
extern crate lazy_static; | ||
|
||
use std::collections::HashMap; | ||
|
||
#[derive(Default)] | ||
pub struct AfmFont { | ||
pub cap_height: i32, | ||
pub x_height: i32, | ||
pub ascender: i32, | ||
pub descender: i32, | ||
pub italic_angle: f32, | ||
pub underline_position: i32, | ||
pub underline_thickness: i32, | ||
pub font_bbox: (i32, i32, i32, i32), | ||
pub font_name: &'static str, | ||
pub full_name: &'static str, | ||
pub family_name: &'static str, | ||
pub character_set: &'static str, | ||
pub glyph_widths: HashMap<u8, u32>, | ||
pub kerning: HashMap<(u32, u32), i32>, | ||
} | ||
|
||
#[cfg(feature = "courier_bold")] | ||
include!(concat!(env!("OUT_DIR"), "/courier_bold.rs")); | ||
#[cfg(feature = "courier_bold_oblique")] | ||
include!(concat!(env!("OUT_DIR"), "/courier_bold_oblique.rs")); | ||
#[cfg(feature = "courier_oblique")] | ||
include!(concat!(env!("OUT_DIR"), "/courier_oblique.rs")); | ||
#[cfg(feature = "courier")] | ||
include!(concat!(env!("OUT_DIR"), "/courier.rs")); | ||
#[cfg(feature = "helvetica_bold")] | ||
include!(concat!(env!("OUT_DIR"), "/helvetica_bold.rs")); | ||
#[cfg(feature = "helvetica_bold_oblique")] | ||
include!(concat!(env!("OUT_DIR"), "/helvetica_bold_oblique.rs")); | ||
#[cfg(feature = "helvetica_oblique")] | ||
include!(concat!(env!("OUT_DIR"), "/helvetica_oblique.rs")); | ||
#[cfg(feature = "helvetica")] | ||
include!(concat!(env!("OUT_DIR"), "/helvetica.rs")); | ||
#[cfg(feature = "symbol")] | ||
include!(concat!(env!("OUT_DIR"), "/symbol.rs")); | ||
#[cfg(feature = "times_bold")] | ||
include!(concat!(env!("OUT_DIR"), "/times_bold.rs")); | ||
#[cfg(feature = "times_bold_italic")] | ||
include!(concat!(env!("OUT_DIR"), "/times_bold_italic.rs")); | ||
#[cfg(feature = "times_italic")] | ||
include!(concat!(env!("OUT_DIR"), "/times_italic.rs")); | ||
#[cfg(feature = "times_roman")] | ||
include!(concat!(env!("OUT_DIR"), "/times_roman.rs")); | ||
#[cfg(feature = "zapf_dingbats")] | ||
include!(concat!(env!("OUT_DIR"), "/zapf_dingbats.rs")); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.