139 familyNames.put(name.toLowerCase(requestedLocale), name); |
139 familyNames.put(name.toLowerCase(requestedLocale), name); |
140 } |
140 } |
141 } |
141 } |
142 } |
142 } |
143 |
143 |
144 protected void registerFontsInDir(String dirName, boolean useJavaRasterizer, int fontRank, boolean defer, boolean resolveSymLinks) { |
144 protected void registerFontsInDir(final String dirName, boolean useJavaRasterizer, |
145 loadNativeDirFonts(dirName); |
145 int fontRank, boolean defer, boolean resolveSymLinks) { |
|
146 |
|
147 String[] files = AccessController.doPrivileged((PrivilegedAction<String[]>) () -> { |
|
148 return new File(dirName).list(getTrueTypeFilter()); |
|
149 }); |
|
150 |
|
151 if (files == null) { |
|
152 return; |
|
153 } else { |
|
154 for (String f : files) { |
|
155 loadNativeDirFonts(dirName+File.separator+f); |
|
156 } |
|
157 } |
146 super.registerFontsInDir(dirName, useJavaRasterizer, fontRank, defer, resolveSymLinks); |
158 super.registerFontsInDir(dirName, useJavaRasterizer, fontRank, defer, resolveSymLinks); |
147 } |
159 } |
148 |
160 |
149 private native void loadNativeDirFonts(String dirName); |
161 private native void loadNativeDirFonts(String fontPath); |
150 private native void loadNativeFonts(); |
162 private native void loadNativeFonts(); |
151 |
163 |
152 void registerFont(String fontName, String fontFamilyName) { |
164 void registerFont(String fontName, String fontFamilyName) { |
153 final CFont font = new CFont(fontName, fontFamilyName); |
165 final CFont font = new CFont(fontName, fontFamilyName); |
154 |
166 |