Changeset 883


Ignore:
Timestamp:
02/12/14 17:19:30 (10 years ago)
Author:
ngw8
Message:

Bug fixes with webparser: pages with no titles no longer throw an exception and CSS 'sans-serif' is now converted to Java's 'SansSerif', rather than trying to use Arial Unicode, which isn't always available.
Dropping 'convert' on a jfxbrowser now uses the new method of conversion.

Location:
trunk/src/org/expeditee
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/io/WebParser.java

    r848 r883  
    302302                        final MutableInt horizontalCount = new MutableInt(0);
    303303
    304                         final String pageTitle = webEngine.getTitle();
     304                        final String pageTitle;
     305                       
     306                        if (webEngine.getTitle() != null) {
     307                                pageTitle = webEngine.getTitle();
     308                        } else {
     309                                pageTitle = "Untitled Page";
     310                        }
    305311
    306312                        final Progress progressBar = MessageBay.displayProgress("Converting web page");
     
    12541260                                for (int j = 0; j < typefaces.length && !fontFound; j++) {
    12551261                                        if (typefaces[j].toLowerCase().equals("sans-serif")) {
    1256                                                 typefaces[j] = "Arial Unicode MS";
    1257                                         } else if (typefaces[j].toLowerCase().equals("serif")) {
    1258                                                 typefaces[j] = "Times New Roman";
     1262                                                typefaces[j] = "SansSerif";
    12591263                                        } else if ((typefaces[j].toLowerCase().equals("arial"))) {
    12601264                                                // Have to use Arial Unicode, otherwise unicode characters display incorrectly
     1265                                                // It seems that not all systems have this font (including some Windows machines),
     1266                                                // but as long as the website has a general font type specified (e.g. "font-family: Arial, Sans-Serif"),
     1267                                                // there should be no noticeable difference.
    12611268                                                typefaces[j] = "Arial Unicode MS";
     1269                                        } else if ((typefaces[j].toLowerCase().equals("monospace"))) {
     1270                                                typefaces[j] = "monospaced";
    12621271                                        }
    12631272
  • trunk/src/org/expeditee/items/widgets/JfxBrowser.java

    r877 r883  
    704704        public void getFrame() {
    705705                try {
    706                         WebParser.parsePage(this._webEngine, DisplayIO.getCurrentFrame());
     706                        WebParser.parsePageSimple(this, _webEngine, _webView, DisplayIO.getCurrentFrame());
    707707                } catch (Exception e) {
    708708                        e.printStackTrace();
Note: See TracChangeset for help on using the changeset viewer.