[OpenLayers-Commits] r11744 - in trunk/openlayers: examples
lib/OpenLayers/Feature lib/OpenLayers/Renderer
commits-20090109 at openlayers.org
commits-20090109 at openlayers.org
Tue Mar 29 05:54:01 EDT 2011
Author: fredj
Date: 2011-03-29 02:54:00 -0700 (Tue, 29 Mar 2011)
New Revision: 11744
Modified:
trunk/openlayers/examples/symbolizers-fill-stroke-graphic.html
trunk/openlayers/lib/OpenLayers/Feature/Vector.js
trunk/openlayers/lib/OpenLayers/Renderer/Canvas.js
trunk/openlayers/lib/OpenLayers/Renderer/SVG.js
trunk/openlayers/lib/OpenLayers/Renderer/SVG2.js
trunk/openlayers/lib/OpenLayers/Renderer/VML.js
Log:
font style support for feature label. r=erilem (closes #3051)
Modified: trunk/openlayers/examples/symbolizers-fill-stroke-graphic.html
===================================================================
--- trunk/openlayers/examples/symbolizers-fill-stroke-graphic.html 2011-03-29 09:50:33 UTC (rev 11743)
+++ trunk/openlayers/examples/symbolizers-fill-stroke-graphic.html 2011-03-29 09:54:00 UTC (rev 11744)
@@ -28,7 +28,8 @@
symbolizer: {
graphic: false,
label: "Label for invisible point",
- labelSelect: true
+ labelSelect: true,
+ fontStyle: "italic"
},
filter: new OpenLayers.Filter.Comparison({
type: "==",
Modified: trunk/openlayers/lib/OpenLayers/Feature/Vector.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Feature/Vector.js 2011-03-29 09:50:33 UTC (rev 11743)
+++ trunk/openlayers/lib/OpenLayers/Feature/Vector.js 2011-03-29 09:54:00 UTC (rev 11744)
@@ -387,6 +387,7 @@
* fontOpacity - {Number} Opacity (0-1) for the label
* fontFamily - {String} The font family for the label, to be provided like in CSS.
* fontSize - {String} The font size for the label, to be provided like in CSS.
+ * fontStyle - {String} The font style for the label, to be provided like in CSS.
* fontWeight - {String} The font weight for the label, to be provided like in CSS.
* display - {String} Symbolizers will have no effect if display is set to "none". All other values have no effect.
*/
Modified: trunk/openlayers/lib/OpenLayers/Renderer/Canvas.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Renderer/Canvas.js 2011-03-29 09:50:33 UTC (rev 11743)
+++ trunk/openlayers/lib/OpenLayers/Renderer/Canvas.js 2011-03-29 09:54:00 UTC (rev 11744)
@@ -333,7 +333,11 @@
this.setCanvasStyle("reset");
this.canvas.fillStyle = style.fontColor;
this.canvas.globalAlpha = style.fontOpacity || 1.0;
- var fontStyle = style.fontWeight + " " + style.fontSize + " " + style.fontFamily;
+ var fontStyle = [style.fontStyle ? style.fontStyle : "normal",
+ "normal", // "font-variant" not supported
+ style.fontWeight ? style.fontWeight : "normal",
+ style.fontSize ? style.fontSize : "10px",
+ style.fontFamily ? style.fontFamily : "sans-serif"].join(" ");
if (this.canvas.fillText) {
// HTML5
var labelAlign =
Modified: trunk/openlayers/lib/OpenLayers/Renderer/SVG.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Renderer/SVG.js 2011-03-29 09:50:33 UTC (rev 11743)
+++ trunk/openlayers/lib/OpenLayers/Renderer/SVG.js 2011-03-29 09:54:00 UTC (rev 11744)
@@ -712,6 +712,9 @@
if (style.fontWeight) {
label.setAttributeNS(null, "font-weight", style.fontWeight);
}
+ if (style.fontStyle) {
+ label.setAttributeNS(null, "font-style", style.fontStyle);
+ }
if(style.labelSelect === true) {
label.setAttributeNS(null, "pointer-events", "visible");
label._featureId = featureId;
Modified: trunk/openlayers/lib/OpenLayers/Renderer/SVG2.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Renderer/SVG2.js 2011-03-29 09:50:33 UTC (rev 11743)
+++ trunk/openlayers/lib/OpenLayers/Renderer/SVG2.js 2011-03-29 09:54:00 UTC (rev 11744)
@@ -606,6 +606,9 @@
if (style.fontWeight) {
text.setAttributeNS(null, "font-weight", style.fontWeight);
}
+ if (style.fontStyle) {
+ text.setAttributeNS(null, "font-style", style.fontStyle);
+ }
if(style.labelSelect === true) {
text.setAttributeNS(null, "pointer-events", "visible");
text._featureId = featureId;
@@ -790,4 +793,4 @@
*/
OpenLayers.Renderer.SVG2.preventDefault = function(e) {
e.preventDefault && e.preventDefault();
-};
\ No newline at end of file
+};
Modified: trunk/openlayers/lib/OpenLayers/Renderer/VML.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Renderer/VML.js 2011-03-29 09:50:33 UTC (rev 11743)
+++ trunk/openlayers/lib/OpenLayers/Renderer/VML.js 2011-03-29 09:54:00 UTC (rev 11744)
@@ -855,6 +855,9 @@
if (style.fontWeight) {
textbox.style.fontWeight = style.fontWeight;
}
+ if (style.fontStyle) {
+ textbox.style.fontStyle = style.fontStyle;
+ }
if(style.labelSelect === true) {
label._featureId = featureId;
textbox._featureId = featureId;
More information about the Commits
mailing list