1 50 package com.lowagie.text.rtf.direct; 51 52 59 public class RtfFontTableParser { 60 63 private RtfImportHeader importHeader = null; 64 67 private String fontNr = ""; 68 71 private String fontName = ""; 72 73 78 public RtfFontTableParser(RtfImportHeader importHeader) { 79 this.importHeader = importHeader; 80 this.fontNr = ""; 81 this.fontName = ""; 82 } 83 84 91 public void handleCloseGroup(int groupLevel) { 92 if(groupLevel == 3 && !this.fontNr.equals("") && !this.fontName.equals("")) { 93 this.importHeader.importFont(this.fontNr, this.fontName); 94 this.fontNr = ""; 95 this.fontName = ""; 96 } 97 } 98 99 106 public void handleCtrlWord(String ctrlWord, int groupLevel) { 107 if(RtfColorTableParser.stringMatches(ctrlWord, "\\f") && groupLevel == 3) { 108 this.fontNr = ctrlWord.substring(2); 109 } 110 } 111 112 119 public void handleText(String text, int groupLevel) { 120 if(text.indexOf(';') >= 0 && groupLevel == 3) { 121 this.fontName = text.substring(0, text.indexOf(';')); 122 } 123 } 124 } 125 | Popular Tags |