Use bitflags for opentype font flags 🏁

This commit is contained in:
Laurenz 2019-02-28 10:50:15 +01:00
parent 4d4824aa08
commit 5e135db872

View File

@ -10,7 +10,7 @@ use pdf::font::{
Type0Font, CMapEncoding, CIDFont, CIDFontType, CIDSystemInfo, Type0Font, CMapEncoding, CIDFont, CIDFontType, CIDSystemInfo,
WidthRecord, FontDescriptor, FontFlags, EmbeddedFont, GlyphUnit WidthRecord, FontDescriptor, FontFlags, EmbeddedFont, GlyphUnit
}; };
use opentype::{OpenTypeReader, tables::{self, NameEntry}}; use opentype::{OpenTypeReader, tables::{self, NameEntry, MacStyleFlags}};
/// A type that is a sink for documents that can be written in the _PDF_ format. /// A type that is a sink for documents that can be written in the _PDF_ format.
@ -214,7 +214,7 @@ impl<'a, W: Write> PdfCreator<'a, W> {
flags.set(FontFlags::FIXED_PITCH, font_data.post.is_fixed_pitch); flags.set(FontFlags::FIXED_PITCH, font_data.post.is_fixed_pitch);
flags.set(FontFlags::SERIF, base_font.contains("Serif")); flags.set(FontFlags::SERIF, base_font.contains("Serif"));
flags.insert(FontFlags::SYMBOLIC); flags.insert(FontFlags::SYMBOLIC);
flags.set(FontFlags::ITALIC, (font_data.head.mac_style & 1) != 0); flags.set(FontFlags::ITALIC, font_data.head.mac_style.contains(MacStyleFlags::ITALIC));
flags.insert(FontFlags::SMALL_CAP); flags.insert(FontFlags::SMALL_CAP);
self.writer.write_obj(id + 2, self.writer.write_obj(id + 2,