X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Ffont.cc;h=cbfb999a47ef6be4db642c802ae79f6da92e45d9;hb=635c3ae7aee1cad4b871fcf0ddf02a8be1cdce78;hp=5a568a63e3fabcf679c4a47447975deea2707209;hpb=59886567974bd3e79d30a4a9425d86d50bf425f3;p=libdcp.git diff --git a/src/font.cc b/src/font.cc index 5a568a63..cbfb999a 100644 --- a/src/font.cc +++ b/src/font.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2014 Carl Hetherington + Copyright (C) 2015 Carl Hetherington This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,65 +17,24 @@ */ +/** @file src/font.cc + * @brief Font class. + */ + #include "font.h" -#include "xml.h" -#include "text.h" -#include using std::string; -using std::list; -using boost::shared_ptr; -using boost::optional; + using namespace dcp; -Font::Font (shared_ptr node) +Font::Font (boost::filesystem::path file) + : Asset (file) { - text = node->content (); - - id = node->optional_string_attribute ("Id").get_value_or (""); - size = node->optional_number_attribute ("Size").get_value_or (0); - italic = node->optional_bool_attribute ("Italic"); - optional c = node->optional_string_attribute ("Color"); - if (c) { - color = Color (c.get ()); - } - optional const e = node->optional_string_attribute ("Effect"); - if (e) { - effect = string_to_effect (e.get ()); - } - c = node->optional_string_attribute ( "EffectColor"); - if (c) { - effect_color = Color (c.get ()); - } - subtitle_nodes = type_children (node, "Subtitle"); - font_nodes = type_children (node, "Font"); - text_nodes = type_children (node, "Text"); + } -Font::Font (list > const & font_nodes) - : size (0) - , italic (false) - , color ("FFFFFFFF") - , effect_color ("FFFFFFFF") +string +Font::pkl_type (Standard) const { - for (list >::const_iterator i = font_nodes.begin(); i != font_nodes.end(); ++i) { - if (!(*i)->id.empty ()) { - id = (*i)->id; - } - if ((*i)->size != 0) { - size = (*i)->size; - } - if ((*i)->italic) { - italic = (*i)->italic.get (); - } - if ((*i)->color) { - color = (*i)->color.get (); - } - if ((*i)->effect) { - effect = (*i)->effect.get (); - } - if ((*i)->effect_color) { - effect_color = (*i)->effect_color.get (); - } - } + return "application/ttf"; }