File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed
main/java/com/itextpdf/io/font
test/java/com/itextpdf/io/font Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -215,7 +215,11 @@ protected void setFixedPitch(boolean isFixedPitch) {
215
215
}
216
216
217
217
protected void setBold (boolean isBold ) {
218
- fontNames .setMacStyle (fontNames .getMacStyle () | FontNames .BOLD_FLAG );
218
+ if (isBold ) {
219
+ fontNames .setMacStyle (fontNames .getMacStyle () | FontNames .BOLD_FLAG );
220
+ } else {
221
+ fontNames .setMacStyle (fontNames .getMacStyle () & (~FontNames .BOLD_FLAG ));
222
+ }
219
223
}
220
224
221
225
protected void setBbox (int [] bbox ) {
Original file line number Diff line number Diff line change 8
8
import java .io .IOException ;
9
9
10
10
@ Category (UnitTest .class )
11
- public class FontFactoryTest {
11
+ public class FontProgramTest {
12
12
13
13
@ Test
14
14
public void exceptionMessageTest () throws IOException {
@@ -18,4 +18,13 @@ public void exceptionMessageTest() throws IOException {
18
18
Assert .assertEquals ("font.file some-font.ttf not.found" , ex .getMessage ());
19
19
}
20
20
}
21
+
22
+ @ Test
23
+ public void boldTest () throws IOException {
24
+ FontProgram fp = FontFactory .createFont (FontConstants .HELVETICA );
25
+ fp .setBold (true );
26
+ Assert .assertTrue ("Bold expected" , (fp .getPdfFontFlags () & (1 << 18 )) != 0 );
27
+ fp .setBold (false );
28
+ Assert .assertTrue ("Not Bold expected" , (fp .getPdfFontFlags () & (1 << 18 )) == 0 );
29
+ }
21
30
}
You can’t perform that action at this time.
0 commit comments