1 |
46260bb5
|
Patrick Plitzner
|
/**
|
2 |
|
|
* Copyright (C) 2007 EDIT
|
3 |
|
|
* European Distributed Institute of Taxonomy
|
4 |
|
|
* http://www.e-taxonomy.eu
|
5 |
|
|
*
|
6 |
|
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7 |
|
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8 |
|
|
*/
|
9 |
|
|
|
10 |
|
|
package eu.etaxonomy.taxeditor.model;
|
11 |
|
|
|
12 |
|
|
import org.eclipse.jface.resource.FontRegistry;
|
13 |
|
|
import org.eclipse.swt.SWT;
|
14 |
|
|
import org.eclipse.swt.graphics.Font;
|
15 |
|
|
import org.eclipse.swt.graphics.FontData;
|
16 |
|
|
|
17 |
|
|
import eu.etaxonomy.taxeditor.preference.Resources;
|
18 |
|
|
|
19 |
|
|
/**
|
20 |
|
|
*
|
21 |
|
|
* @author pplitzner
|
22 |
|
|
* @since Nov 1, 2017
|
23 |
|
|
*
|
24 |
|
|
*/
|
25 |
|
|
public class FontResources {
|
26 |
|
|
|
27 |
|
|
private static FontResources instance;
|
28 |
|
|
|
29 |
|
|
public static FontResources getInstance(){
|
30 |
|
|
if(instance == null){
|
31 |
|
|
instance = new FontResources();
|
32 |
|
|
}
|
33 |
|
|
return instance;
|
34 |
|
|
}
|
35 |
|
|
|
36 |
|
|
private static FontRegistry fontRegistry;
|
37 |
|
|
|
38 |
|
|
public FontRegistry getFontRegistry() {
|
39 |
|
|
if (fontRegistry == null) {
|
40 |
|
|
fontRegistry = new FontRegistry();
|
41 |
|
|
initializeFontRegistry(fontRegistry);
|
42 |
|
|
}
|
43 |
|
|
return fontRegistry;
|
44 |
|
|
}
|
45 |
|
|
|
46 |
|
|
public static Font getFont(String key){
|
47 |
|
|
return getInstance().getFontRegistry().get(key);
|
48 |
|
|
}
|
49 |
|
|
|
50 |
|
|
protected void initializeFontRegistry(FontRegistry registry) {
|
51 |
|
|
registerFont(registry, Resources.ACCEPTED_TAXON_FONT, "Georgia", 12, SWT.NORMAL);
|
52 |
|
|
registerFont(registry, Resources.SYNONYM_FONT, "Georgia", 10, SWT.NORMAL);
|
53 |
|
|
registerFont(registry, Resources.MISAPPLIEDNAME_FONT, "Georgia", 10, SWT.NORMAL);
|
54 |
|
|
registerFont(registry, Resources.CONCEPT_FONT, "Georgia", 10, SWT.NORMAL);
|
55 |
|
|
registerFont(registry, Resources.FONT_DEFAULT_PROMPT, "Georgia", 10, SWT.NORMAL);
|
56 |
|
|
registerFont(registry, Resources.FONT_SEARCH_VIEW_ACCEPTED, "Arial", 10, SWT.NORMAL);
|
57 |
|
|
registerFont(registry, Resources.FONT_SEARCH_VIEW_SYNONYM, "Arial", 10, SWT.ITALIC);
|
58 |
|
|
registerFont(registry, Resources.FONT_SEARCH_VIEW_OTHER, "Lucida Grande", 11, SWT.NORMAL);
|
59 |
|
|
}
|
60 |
|
|
|
61 |
|
|
private void registerFont(FontRegistry registry, String key, String name, int height, int style) {
|
62 |
|
|
registry.put(key, new FontData[]{new FontData(name, height, style)});
|
63 |
|
|
}
|
64 |
|
|
}
|