mangiare
31-07-2012, 21:38
ciao a tutti ho creato in JAVA un editorpane contente del testo html che visualizza dei link, ora voglio applicare un font esterno personalizzato quindi ho creato uno stylesheet e tramite l'addrule ho caricato il font come se fosse una pagina html.Il font perņ non viene caricato potete aiutarmi?grazie
editorPane = new JEditorPane("text/html","");
HTMLEditorKit kit = new HTMLEditorKit();
Document doc = kit.createDefaultDocument();
editorPane.setEditorKit(kit);
editorPane.setDocument(doc);
StyleSheet styleSheet = kit.getStyleSheet();
styleSheet.addRule("@font-face { font-family: 'metal'; src: local(metal.ttf),format('truetype');}");
editorPane.setText("\n <font font face='metal'<a href='"+c+"'>" + s+"</a></font>");
editorPane = new JEditorPane("text/html","");
HTMLEditorKit kit = new HTMLEditorKit();
Document doc = kit.createDefaultDocument();
editorPane.setEditorKit(kit);
editorPane.setDocument(doc);
StyleSheet styleSheet = kit.getStyleSheet();
styleSheet.addRule("@font-face { font-family: 'metal'; src: local(metal.ttf),format('truetype');}");
editorPane.setText("\n <font font face='metal'<a href='"+c+"'>" + s+"</a></font>");