Servis-Rhino 4211B Betriebsanweisung Seite 219

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 298
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 218
See also:
Dojo GFX documentation – 1.9
Vector graphics with Dojo's GFX
Dive Into Dojo GFX
Dojo GFX Vector Fonts
Vector fonts are fully scalable text items. To use, we need to require "dojox/gfx/VectorText".
First we create an SVG font definition. After the font definition has been created we load the font.
A font called "Gillius.svg" is available in the "dojox/gfx/resources" folder.
var url = require.toUrl("dojox/gfx/resources/Gillius.svg");
var font = gfx.VectorFont(url);
var txtArgs = {
text: "Now is the time for all good men to come to a rest. Plus, the rain in Spain falls mainly
on the plain!",
x: 0, y: 0,
width: 100, height: 100,
align: "start",
fitting: dojox.gfx.vectorFontFitting.FLOW,
leading: 1.2
};
var fontArgs = {
size: "12pt", family: "Gillius"
};
var master = surface.createGroup();
var g = font.draw(master, txtArgs, fontArgs, "#a36e2c");
The txtArgs parameter of the draw method contains the following:
fitting: One of either FLOW, FIT or NONE. If FIT is supplied, this causes the text to fit
as best it can the group area and hence the font size is ignored.
See also:
Custom fonts with dojox.gfx
Dojo and CSS
Some of the Dijit widgets supplied with Dojo provide their own CSS files. In addition, any custom
widgets you build may also require their own CSS. Normally we include these CSS files with the
<link> attribute, however there are circumstances where we might not be able to do that.
Imagine that we have written a Dojo widget that runs in a Dojo environment framework we have no
control over. We simply don't know the root URL for Dojo and hence don't know what to include
in our HTML.
One possible solution is to have our CSS loaded by knowing which module/package it is in. Here is
an example fragment of code which will do just that:
function insertModuleCSS(moduleCSSPath) {
// Locate the document's <head> node
var headNode = query("head")[0];
// Get the URL to the CSS file
var path = require.toUrl(moduleCSSPath);
// Check to see if the <link> already exists. If it does, there is nothing
Page 219
Seitenansicht 218
1 2 ... 214 215 216 217 218 219 220 221 222 223 224 ... 297 298

Kommentare zu diesen Handbüchern

Keine Kommentare