font style support for feature label. r=erilem (closes #3051)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@11744 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -28,7 +28,8 @@
|
||||
symbolizer: {
|
||||
graphic: false,
|
||||
label: "Label for invisible point",
|
||||
labelSelect: true
|
||||
labelSelect: true,
|
||||
fontStyle: "italic"
|
||||
},
|
||||
filter: new OpenLayers.Filter.Comparison({
|
||||
type: "==",
|
||||
|
||||
@@ -387,6 +387,7 @@ OpenLayers.Feature.Vector = OpenLayers.Class(OpenLayers.Feature, {
|
||||
* 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.
|
||||
*/
|
||||
|
||||
@@ -333,7 +333,11 @@ OpenLayers.Renderer.Canvas = OpenLayers.Class(OpenLayers.Renderer, {
|
||||
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 =
|
||||
|
||||
@@ -712,6 +712,9 @@ OpenLayers.Renderer.SVG = OpenLayers.Class(OpenLayers.Renderer.Elements, {
|
||||
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;
|
||||
|
||||
@@ -606,6 +606,9 @@ OpenLayers.Renderer.SVG2 = OpenLayers.Class(OpenLayers.Renderer.NG, {
|
||||
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.LABEL_VSHIFT = {
|
||||
*/
|
||||
OpenLayers.Renderer.SVG2.preventDefault = function(e) {
|
||||
e.preventDefault && e.preventDefault();
|
||||
};
|
||||
};
|
||||
|
||||
@@ -855,6 +855,9 @@ OpenLayers.Renderer.VML = OpenLayers.Class(OpenLayers.Renderer.Elements, {
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user