2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
10 package eu
.etaxonomy
.taxeditor
.model
;
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
;
17 import eu
.etaxonomy
.taxeditor
.preference
.Resources
;
25 public class FontResources
{
27 private static FontResources instance
;
29 public static FontResources
getInstance(){
31 instance
= new FontResources();
36 private static FontRegistry fontRegistry
;
38 public FontRegistry
getFontRegistry() {
39 if (fontRegistry
== null) {
40 fontRegistry
= new FontRegistry();
41 initializeFontRegistry(fontRegistry
);
46 public static Font
getFont(String key
){
47 return getInstance().getFontRegistry().get(key
);
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
);
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
)});