static { final Logger logger; Palette<FontStyle> pal; Throwable error; String msg; pal = null; error = null; logger = Configuration.getGlobalLogger(); try (final __LaTeXDefaultFontPaletteBuilder cspb = new __LaTeXDefaultFontPaletteBuilder()) { FontPaletteXMLInput.getInstance() .use() .setLogger(Configuration.getGlobalLogger()) .setDestination(cspb) .addResource(LaTeXDefaultFontPalette.class, "latex.fontPalette") .create() .call(); //$NON-NLS-1$ pal = cspb.getResult(); } catch (final Throwable t) { error = t; pal = null; try { ErrorUtils.logError( logger, // "Error while loading the default font palette for the LaTeX Document Driver. This will creating LaTeX documents using this palette impossible.", //$NON-NLS-1$ error, true); error, true, RethrowMode.AS_RUNTIME_EXCEPTION); } catch (final Throwable a) { error = a; } } if (pal != null) { INSTANCE = ((LaTeXDefaultFontPalette) pal); ERROR = null; } else { INSTANCE = null; msg = "Could not load LaTeX default font palette."; // $NON-NLS-1$ ERROR = ((error != null) ? new UnsupportedOperationException(msg, error) : new UnsupportedOperationException(msg)); } }
/** {@inheritDoc} */ @Override protected void postProcess( final Set<IStyle> usedStyles, final ArrayListView<ImmutableAssociation<Path, IFileType>> paths) { Path path; String s; char ch; int i; try { for (final String name : new String[] {_XHTML10Document.CSS_DEFAULT, _XHTML10Document.CSS_PRINT}) { path = PathUtils.normalize(this.getDocumentFolder().resolve(name)); try (final OutputStream os = PathUtils.openOutputStream(path)) { try (final OutputStreamWriter osw = new OutputStreamWriter(os)) { try (final BufferedWriter bw = new BufferedWriter(osw)) { this.__createStyles(bw, usedStyles); try (final InputStream is = _XHTML10Document.class.getResourceAsStream(name)) { try (final InputStreamReader isr = new InputStreamReader(is)) { try (final BufferedReader br = new BufferedReader(isr)) { while ((s = br.readLine()) != null) { s = TextUtils.prepare(s); if (s != null) { i = s.indexOf(':'); if (i > 0) { ch = ':'; } else { i = s.indexOf('{'); if (i > 0) { ch = '{'; } else { i = s.indexOf('}'); if (i > 0) { ch = '}'; } else { ch = 0; } } } if (i > 0) { bw.write(s.substring(0, i).trim()); bw.write(ch); bw.write(s.substring(i + 1).trim()); } else { bw.write(s); } } } } } } } } } catch (final Throwable t) { ErrorUtils.logError( this.getLogger(), // "Error while building Cascading Style Sheet (CSS) for XHTML 1.0 Document. This will make the document look odd.", //$NON-NLS-1$ t, true, RethrowMode.AS_RUNTIME_EXCEPTION); } this.getFileCollector().addFile(path, EWebFileTypes.CSS); } } finally { super.postProcess(usedStyles, paths); } }