Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit adds: * makes the generator inspect a given font and extract needed information about glyphs and their aspect ratio * support for managed webfonts in qx.ui.basic.Image * support for managed webfonts in qx.ui.table.cellrenderer.Image * extends the Image demo in the demobrowser * adds a new IconFont demo in the demobrowser * adds some documentation for using font images
- Loading branch information
Showing
30 changed files
with
903 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
/cache/ | ||
/api/ | ||
/build/ | ||
/test/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// call only through config.json, for macro settings | ||
{ | ||
"jobs" : | ||
{ | ||
"make-font-map" : | ||
{ | ||
"desc" : "Build a font mapping from glyphname to unicode id", | ||
|
||
"let" : | ||
{ | ||
"RESPATH" : "./source/resource", | ||
"QXRESPATH" : "${QOOXDOO_PATH}/framework/source/resource" | ||
}, | ||
|
||
"font-map" : | ||
{ | ||
"fonts" : | ||
{ | ||
"${RESPATH}/demobrowser/demo/fonts/fontawesome-webfont.ttf" : | ||
{ | ||
"prefix": [ "${RESPATH}" ], | ||
"alias" : "FontAwesome", | ||
"size" : 40 | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
136 changes: 136 additions & 0 deletions
136
application/demobrowser/source/class/demobrowser/demo/showcase/IconFont.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
/* ************************************************************************ | ||
qooxdoo - the new era of web development | ||
http://qooxdoo.org | ||
Copyright: | ||
2016 GONICUS Gmbh, Germany, http://www.gonicus.de | ||
License: | ||
MIT: https://opensource.org/licenses/MIT | ||
See the LICENSE file in the project's top-level directory for details. | ||
Authors: | ||
* Cajus Pollmeier (cajus) | ||
************************************************************************ */ | ||
/* ************************************************************************ | ||
************************************************************************ */ | ||
|
||
/** | ||
* This is the main application class of your custom application "showcase_i18n" | ||
* | ||
* @tag showcase | ||
* | ||
* @asset(demobrowser/demo/fonts/fontawesome-webfont*) | ||
* @asset(qx/icon/${qx.icontheme}/16/*) | ||
*/ | ||
qx.Class.define("demobrowser.demo.showcase.IconFont", | ||
{ | ||
extend : qx.application.Standalone, | ||
|
||
|
||
/* | ||
***************************************************************************** | ||
MEMBERS | ||
***************************************************************************** | ||
*/ | ||
|
||
members : | ||
{ | ||
_table : null, | ||
_container : null, | ||
|
||
/** | ||
* This method contains the initial application code and gets called | ||
* during startup of the application | ||
*/ | ||
main : function() | ||
{ | ||
// Call super class | ||
this.base(arguments); | ||
|
||
this._initFont(); | ||
|
||
/* Set locale to english to avoid language mix if browser locale is | ||
* non-english. */ | ||
qx.locale.Manager.getInstance().setLocale("en"); | ||
|
||
this._container = new qx.ui.window.Window("Icon table for FontAwesome", "icon/16/apps/office-spreadsheet.png").set({ | ||
width: 600, | ||
height: 400, | ||
contentPadding : [ 0, 0, 0, 0 ], | ||
showClose: false, | ||
showMinimize: false | ||
}); | ||
this._container.setLayout(new qx.ui.layout.VBox()); | ||
this._container.open(); | ||
|
||
this.getRoot().add(this._container, {left: 50, top: 10}); | ||
|
||
this._table = this._createTable(); | ||
|
||
this._container.add(this._table, {flex: 1}); | ||
}, | ||
|
||
_createTable : function() | ||
{ | ||
// table model | ||
var tableModel = new qx.ui.table.model.Simple(); | ||
tableModel.setColumns([ "Unicode", "Glyph", "Image" ]); | ||
|
||
var res = qx.$$resources; | ||
|
||
var rowData = []; | ||
for (var key in res) { | ||
if (res.hasOwnProperty(key) && key.startsWith("@FontAwesome/")) { | ||
rowData.push([ "0x" + res[key][2].toString(16), key.split("/")[1], key]); | ||
} | ||
} | ||
|
||
tableModel.setData(rowData); | ||
|
||
var table = new qx.ui.table.Table(tableModel); | ||
var renderer = new qx.ui.table.cellrenderer.Image(16, 16); | ||
table.getTableColumnModel().setDataCellRenderer(2, renderer); | ||
|
||
return table; | ||
}, | ||
|
||
_initFont : function() | ||
{ | ||
var currentFont = qx.theme.manager.Font.getInstance().getTheme(); | ||
|
||
// Add font definitions | ||
var config = { | ||
fonts: { | ||
"FontAwesome": { | ||
size: 40, | ||
lineHeight: 1, | ||
comparisonString : "\uf1e3\uf1f7\uf11b\uf19d", | ||
family: ["FontAwesome"], | ||
sources: [ | ||
{ | ||
family: "FontAwesome", | ||
source: [ | ||
"demobrowser/demo/fonts/fontawesome-webfont.ttf" , "demobrowser/demo/fonts/fontawesome-webfont.woff" | ||
] | ||
} | ||
] | ||
} | ||
} | ||
}; | ||
|
||
qx.Theme.define("demobrowser.theme.icon.Font", config); | ||
qx.Theme.include(currentFont, demobrowser.theme.icon.Font); | ||
} | ||
}, | ||
|
||
destruct : function() { | ||
this._disposeObjects("_table", "_container"); | ||
} | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
application/demobrowser/source/demo/showcase/IconFont.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | ||
<script type="text/javascript" src="../helper.js"></script> | ||
</head> | ||
<body> | ||
|
||
</body> | ||
</html> |
Empty file.
Empty file.
1 change: 1 addition & 0 deletions
1
application/demobrowser/source/resource/demobrowser/demo/fonts/fontawesome-webfont.meta
Large diffs are not rendered by default.
Oops, something went wrong.
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.