File tree Expand file tree Collapse file tree 1 file changed +27
-1
lines changed
MigraDocCore.DocumentObjectModel/MigraDoc/MigraDoc.DocumentObjectModel Expand file tree Collapse file tree 1 file changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -63,7 +63,7 @@ public XSize MeasureString(string text, UnitType unitType)
63
63
if ( ! Enum . IsDefined ( typeof ( UnitType ) , unitType ) )
64
64
throw new ArgumentException ( ) ;
65
65
66
- XSize size = graphics . MeasureString ( text , this . xFont ) ;
66
+ XSize size = graphics . MeasureString ( text , this . XFont ) ;
67
67
switch ( unitType )
68
68
{
69
69
case UnitType . Point :
@@ -121,6 +121,32 @@ public Font Font
121
121
}
122
122
}
123
123
}
124
+
125
+ /// <summary>
126
+ /// Gets the xfont used for measurement.
127
+ /// </summary>
128
+ private Font XFont
129
+ {
130
+ get {
131
+ if ( this . xFont == null )
132
+ {
133
+ var style = XFontStyle . Regular ;
134
+ if ( this . Font . Bold )
135
+ {
136
+ style |= XFontStyle . Bold ;
137
+ }
138
+ if ( this . Font . Italic )
139
+ {
140
+ style |= XFontStyle . Italic ;
141
+ }
142
+
143
+ this . xFont = new XFont ( this . Font . Name , this . Font . Size , style ) ;
144
+ }
145
+
146
+ return this . xFont ;
147
+ }
148
+ }
149
+
124
150
Font font ;
125
151
XFont xFont ;
126
152
XGraphics graphics ;
You can’t perform that action at this time.
0 commit comments