Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/exports/ChartExportFontMapper.java @ 9119:36c80c7fd02f
missing files Veg'Zone, FontMapper
author | gernotbelger |
---|---|
date | Tue, 05 Jun 2018 10:25:48 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
9118:431f1c269be5 | 9119:36c80c7fd02f |
---|---|
1 /** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde | |
2 * Software engineering by | |
3 * Björnsen Beratende Ingenieure GmbH | |
4 * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt | |
5 * | |
6 * This file is Free Software under the GNU AGPL (>=v3) | |
7 * and comes with ABSOLUTELY NO WARRANTY! Check out the | |
8 * documentation coming with Dive4Elements River for details. | |
9 */ | |
10 package org.dive4elements.river.exports; | |
11 | |
12 import java.awt.Font; | |
13 import java.io.IOException; | |
14 | |
15 import com.lowagie.text.DocumentException; | |
16 import com.lowagie.text.ExceptionConverter; | |
17 import com.lowagie.text.pdf.BaseFont; | |
18 import com.lowagie.text.pdf.FontMapper; | |
19 | |
20 /** | |
21 * @author Domenico Nardi Tironi | |
22 * | |
23 */ | |
24 public class ChartExportFontMapper implements FontMapper { | |
25 | |
26 @Override | |
27 public Font pdfToAwt(final BaseFont font, final int size) { | |
28 throw new UnsupportedOperationException(); | |
29 } | |
30 | |
31 @Override | |
32 public BaseFont awtToPdf(final Font font) { | |
33 try { | |
34 | |
35 if (font.isItalic()) { | |
36 if (font.isBold()) | |
37 return BaseFont.createFont("fonts/Roboto/Roboto-BoldItalic.ttf", BaseFont.IDENTITY_H, false); | |
38 else | |
39 return BaseFont.createFont("fonts/Roboto/Roboto-Italic.ttf", BaseFont.IDENTITY_H, false); | |
40 } else { | |
41 if (font.isBold()) | |
42 return BaseFont.createFont("fonts/Roboto/Roboto-Bold.ttf", BaseFont.IDENTITY_H, false); | |
43 else | |
44 return BaseFont.createFont("fonts/Roboto/Roboto-Regular.ttf", BaseFont.IDENTITY_H, false); | |
45 } | |
46 } | |
47 catch (DocumentException | IOException e) { | |
48 e.printStackTrace(); | |
49 throw new ExceptionConverter(e); | |
50 } | |
51 } | |
52 } |