1 /*
2 * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
424 fis.close();
425 } catch (IOException e) {
426 if (FontUtilities.debugFonts()) {
427 warning("IOException reading from "+fcFile.toString());
428 }
429 return;
430 }
431 String version = (String)props.get("version");
432 if (version == null || !version.equals(fileVersion)) {
433 return;
434 }
435
436 // If there's a new, different fontconfig installed on the
437 // system, we invalidate our fontconfig file.
438 String fcVersionStr = (String)props.get("fcversion");
439 if (fcVersionStr != null) {
440 int fcVersion;
441 try {
442 fcVersion = Integer.parseInt(fcVersionStr);
443 if (fcVersion != 0 &&
444 fcVersion != fcm.getFontConfigVersion()) {
445 return;
446 }
447 } catch (Exception e) {
448 if (FontUtilities.debugFonts()) {
449 warning("Exception parsing version " + fcVersionStr);
450 }
451 return;
452 }
453 }
454
455 // If we can locate the fontconfig cache dirs, then compare the
456 // time stamp of those with our properties file. If we are out
457 // of date then re-generate.
458 long lastModified = fcFile.lastModified();
459 int cacheDirIndex = 0;
460 while (cacheDirIndex<4) { // should never be more than 2 anyway.
461 String dir = (String)props.get("cachedir."+cacheDirIndex);
462 if (dir == null) {
463 break;
464 }
|
1 /*
2 * Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
424 fis.close();
425 } catch (IOException e) {
426 if (FontUtilities.debugFonts()) {
427 warning("IOException reading from "+fcFile.toString());
428 }
429 return;
430 }
431 String version = (String)props.get("version");
432 if (version == null || !version.equals(fileVersion)) {
433 return;
434 }
435
436 // If there's a new, different fontconfig installed on the
437 // system, we invalidate our fontconfig file.
438 String fcVersionStr = (String)props.get("fcversion");
439 if (fcVersionStr != null) {
440 int fcVersion;
441 try {
442 fcVersion = Integer.parseInt(fcVersionStr);
443 if (fcVersion != 0 &&
444 fcVersion != FontConfigManager.getFontConfigVersion()) {
445 return;
446 }
447 } catch (Exception e) {
448 if (FontUtilities.debugFonts()) {
449 warning("Exception parsing version " + fcVersionStr);
450 }
451 return;
452 }
453 }
454
455 // If we can locate the fontconfig cache dirs, then compare the
456 // time stamp of those with our properties file. If we are out
457 // of date then re-generate.
458 long lastModified = fcFile.lastModified();
459 int cacheDirIndex = 0;
460 while (cacheDirIndex<4) { // should never be more than 2 anyway.
461 String dir = (String)props.get("cachedir."+cacheDirIndex);
462 if (dir == null) {
463 break;
464 }
|