00001 /* -*- mode: C++; tab-width: 4; c-basic-offset: 4; -*- */ 00002 00003 /* AbiSource 00004 * 00005 * Copyright (C) 2007 Philippe Milot <PhilMilot@gmail.com> 00006 * 00007 * This program is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU General Public License 00009 * as published by the Free Software Foundation; either version 2 00010 * of the License, or (at your option) any later version. 00011 * 00012 * This program is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with this program; if not, write to the Free Software 00019 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00020 * 02110-1301 USA. 00021 */ 00022 00023 #ifndef _OXML_FONTMANAGER_H_ 00024 #define _OXML_FONTMANAGER_H_ 00025 00026 // Internal includes 00027 #include <OXML_Types.h> 00028 00029 // External includes 00030 #include <map> 00031 #include <memory> 00032 #include <string> 00033 00034 /* \class OXML_FontManager 00035 * \brief This class handles all the font-related activities. 00036 * OXML_FontManager has two main purposes. The first is to keep track of mappings 00037 * between a character range and a specific script. The character range is either 00038 * ASCII, East-Asian, Complex, or H-ANSI. The script is a string in the ISO-15924 00039 * standard format. 00040 * The second purpose of OXML_FontManager is to analyze a font face name and validate 00041 * it against the document's FontTable part to ensure that the proper font face is 00042 * used (this is not yet implemented). 00043 */ 00044 class OXML_FontManager 00045 { 00046 public: 00047 OXML_FontManager(); 00048 00049 inline std::string getDefaultFont() { return m_defaultFont; } 00050 00051 std::string getValidFont(OXML_FontLevel level, OXML_CharRange range); 00052 std::string getValidFont(std::string name); 00053 00054 void mapRangeToScript(OXML_CharRange range, std::string script); 00055 00056 private: 00057 std::string m_defaultFont; 00058 00059 typedef std::map<OXML_CharRange, std::string> OXML_RangeToScriptMap; 00060 OXML_RangeToScriptMap m_major_rts; 00061 OXML_RangeToScriptMap m_minor_rts; 00062 }; 00063 00064 typedef std::shared_ptr<OXML_FontManager> OXML_SharedFontManager; 00065 00066 #endif //_OXML_FONTMANAGER_H_ 00067