00001 00002 // 00003 // This file is part of the MADELINE 2 program 00004 // written by Edward H. Trager and Ritu Khanna 00005 // Copyright (c) 2005 by the 00006 // Regents of the University of Michigan. 00007 // All Rights Reserved. 00008 // 00009 // The latest version of this program is available from: 00010 // 00011 // http://eyegene.ophthy.med.umich.edu/madeline/ 00012 // 00013 // Released under the GNU General Public License. 00014 // A copy of the GPL is included in the distribution 00015 // package of this software, or see: 00016 // 00017 // http://www.gnu.org/copyleft/ 00018 // 00019 // ... for licensing details. 00020 // 00022 00023 #ifndef DRAWINGLABELMANAGER_INCLUDED 00024 #define DRAWINGLABELMANAGER_INCLUDED 00025 00026 #include "ScriptCodes.h" 00027 #include "UnicodeScript.h" 00028 #include "Utf8String.h" 00029 #include "LabelSet.h" 00030 #include <string> 00031 #include <map> 00032 00033 // 00034 // For font metrics 00035 // and Postscript output: 00036 // 00037 #include "LASiWrapper.h" 00038 00040 // 00041 // DrawingLabelManager 00042 // 00044 class DrawingLabelManager{ 00045 00046 00047 public: 00048 // 00049 // Constructor: 00050 // 00051 DrawingLabelManager(); 00052 00053 // 00054 // setLASiWrapper 00055 // 00056 void setLASiWrapper(LASiWrapper* plasiWrapper); 00057 // 00058 // setLabelSet 00059 // 00060 void setLabelSet(const LabelSet* labelSet); 00061 // 00062 // fitStringToLabelWidth(): 00063 // 00064 std::string fitStringToLabelWidth(UTF8String label); 00065 00066 private: 00067 friend class DrawingLabelManagerLoader; 00068 00069 // 00070 // The _latinBlock is basic Latin (ASCII): 00071 // 00072 static UnicodeScript _latinScript; 00073 00074 // 00075 // The _aggregateBlock sample is sufficient for determining 00076 // good line spacing metrics for most Unicode blocks beyond basic Latin: 00077 // 00078 static UnicodeScript _aggregatedScripts; 00079 // 00080 // The following set of _unicodeBlocks consists primarily of Indic and Indic-derived scripts 00081 // which have vowels or other diacritical marks both above and below the consonants 00082 // which requires greater inter-line spacing: 00083 // 00084 static std::map<SCRIPTCODE,UnicodeScript> _unicodeScripts; 00085 00086 bool _hasUnicode; 00087 bool _hasIndicOrArabic; 00088 00089 double _yMaximum; 00090 double _yMinimum; 00091 double _lineHeight; 00092 00093 unsigned _labelCount; 00094 00095 LASiWrapper* _pLASiWrapper; 00096 }; 00097 00098 00100 // 00101 // DrawingLabelManagerLoader 00102 // 00103 // is the Friend class that 00104 // initializes the DrawingLabel 00105 // class: 00106 // 00108 class DrawingLabelManagerLoader 00109 { 00110 public: 00111 static DrawingLabelManagerLoader drawingLabelManagerLoader; 00112 00113 DrawingLabelManagerLoader(); 00114 00115 }; 00116 00117 00118 #endif