Summary: | [Contributions] Provide a way to add a custom fonts to a product | ||
---|---|---|---|
Product: | [Eclipse Project] Platform | Reporter: | Timo Kinnunen <timo.kinnunen> |
Component: | UI | Assignee: | Platform UI Triaged <platform-ui-triaged> |
Status: | NEW --- | QA Contact: | |
Severity: | enhancement | ||
Priority: | P3 | ||
Version: | 4.5 | ||
Target Milestone: | --- | ||
Hardware: | All | ||
OS: | All | ||
Whiteboard: |
Description
Timo Kinnunen
2015-01-13 16:24:27 EST
As a proof of concept, I added a property to product definition which looks like this: <property name="fontList" value="SourceCodePro-Black.ttf,SourceCodePro-Bold.ttf,SourceCodePro-ExtraLight.ttf,SourceCodePro-Light.ttf,SourceCodePro-Medium.ttf,SourceCodePro-Regular.ttf,SourceCodePro-Semibold.ttf"/> And then I added this code to o.e.ui.internal.Workbench before the code that runs the legacy workbench: // add custom fonts before running workbench String fontList = Platform.getProduct().getProperty("fontList"); if(fontList != null) { String[] fonts = fontList.split(","); Bundle bundle = Platform.getProduct().getDefiningBundle(); if(bundle != null) { String location = bundle.getLocation().replace("reference:file:", ""); for(String font : fonts) { String file = Paths.get(location, font).toAbsolutePath().toString(); display.loadFont(file); } } } And this works for me on Windows 8. I figure the custom fonts need to be loaded pretty early in the startup process before the splash screen gets displayed so an extension point may not be suitable. |