Search in sources :

Example 1 with OldFontTable

use of org.apache.poi.hwpf.model.OldFontTable in project poi by apache.

the class TestHWPFOldDocument method testOldFontTableEncoding.

@Test
public void testOldFontTableEncoding() throws IOException {
    HWPFOldDocument doc = HWPFTestDataSamples.openOldSampleFile("Bug51944.doc");
    OldFontTable oldFontTable = doc.getOldFontTable();
    assertEquals(5, oldFontTable.getFontNames().length);
    assertEquals("細明體", oldFontTable.getFontNames()[0].getMainFontName());
    assertEquals(HwmfFont.WmfCharset.CHINESEBIG5_CHARSET.getCharset(), Charset.forName("Big5"));
    assertEquals("Times New Roman", oldFontTable.getFontNames()[1].getMainFontName());
    doc.close();
}
Also used : HWPFOldDocument(org.apache.poi.hwpf.HWPFOldDocument) OldFontTable(org.apache.poi.hwpf.model.OldFontTable) Test(org.junit.Test)

Example 2 with OldFontTable

use of org.apache.poi.hwpf.model.OldFontTable in project poi by apache.

the class TestHWPFOldDocument method testOldFontTableAltName.

@Test
public void testOldFontTableAltName() throws IOException {
    HWPFOldDocument doc = HWPFTestDataSamples.openOldSampleFile("Bug60942b.doc");
    OldFontTable oldFontTable = doc.getOldFontTable();
    assertEquals(5, oldFontTable.getFontNames().length);
    assertEquals("Roboto", oldFontTable.getFontNames()[3].getMainFontName());
    assertEquals("arial", oldFontTable.getFontNames()[3].getAltFontName());
    assertEquals("Roboto", oldFontTable.getFontNames()[4].getMainFontName());
    assertEquals("arial", oldFontTable.getFontNames()[4].getAltFontName());
}
Also used : HWPFOldDocument(org.apache.poi.hwpf.HWPFOldDocument) OldFontTable(org.apache.poi.hwpf.model.OldFontTable) Test(org.junit.Test)

Aggregations

HWPFOldDocument (org.apache.poi.hwpf.HWPFOldDocument)2 OldFontTable (org.apache.poi.hwpf.model.OldFontTable)2 Test (org.junit.Test)2