fiddling with text formatting

This commit is contained in:
George Saines 2014-02-24 15:51:10 -08:00
parent ab8d63f545
commit 8192a6153d

View file

@ -54,17 +54,19 @@ module.exports = class Label extends CocoClass
buildLabelOptions: -> buildLabelOptions: ->
o = {} o = {}
st = {dialogue: 'D', say: 'S', name: 'N'}[@style] st = {dialogue: 'D', say: 'S', name: 'N'}[@style]
o.marginX = {D: 5, S: 2, N: 3}[st] o.marginX = {D: 5, S: 6, N: 3}[st]
o.marginY = {D: 6, S: 2, N: 3}[st] o.marginY = {D: 6, S: 6, N: 3}[st]
o.fontWeight = {D: "bold", S: "bold", N: "bold"}[st]
o.shadow = {D: false, S: true, N: true}[st] o.shadow = {D: false, S: true, N: true}[st]
o.fontSize = {D: 25, S: 19, N: 14}[st] o.shadowColor = {D: "#FFF", S: "#000", N: "#FFF"}[st]
o.fontSize = {D: 25, S: 12, N: 12}[st]
fontFamily = {D: "Arial", S: "Arial", N: "Arial"}[st] fontFamily = {D: "Arial", S: "Arial", N: "Arial"}[st]
o.fontDescriptor = "#{o.fontSize}px #{fontFamily}" o.fontDescriptor = "#{o.fontWeight} #{o.fontSize}px #{fontFamily}"
o.fontColor = {D: "#000", S: "#000", N: "#00a"}[st] o.fontColor = {D: "#000", S: "#FFF", N: "#00a"}[st]
o.backgroundFillColor = {D: "white", S: "rgba(255, 255, 255, 0.2)", N: "rgba(255, 255, 255, 0.5)"}[st] o.backgroundFillColor = {D: "white", S: "rgba(255, 255, 255, 0.3)", N: "rgba(255, 255, 255, 0.5)"}[st]
o.backgroundStrokeColor = {D: "black", S: "rgba(0, 0, 0, 0.2)", N: "rgba(0, 0, 0, 0.0)"}[st] o.backgroundStrokeColor = {D: "black", S: "rgba(0, 0, 0, .4)", N: "rgba(0, 0, 0, 0.0)"}[st]
o.backgroundStrokeStyle = {D: 2, S: 1, N: 1}[st] o.backgroundStrokeStyle = {D: 2, S: 1, N: 1}[st]
o.backgroundBorderRadius = {D: 10, S: 5, N: 3}[st] o.backgroundBorderRadius = {D: 10, S: 3, N: 3}[st]
o.layerPriority = {D: 10, S: 5, N: 5}[st] o.layerPriority = {D: 10, S: 5, N: 5}[st]
maxWidth = {D: 300, S: 300, N: 180}[st] maxWidth = {D: 300, S: 300, N: 180}[st]
maxWidth = Math.max @camera.canvasWidth / 2 - 100, maxWidth # Does this do anything? maxWidth = Math.max @camera.canvasWidth / 2 - 100, maxWidth # Does this do anything?
@ -79,7 +81,7 @@ module.exports = class Label extends CocoClass
label.lineHeight = o.fontSize + 2 label.lineHeight = o.fontSize + 2
label.x = o.marginX label.x = o.marginX
label.y = o.marginY label.y = o.marginY
label.shadow = new createjs.Shadow "#FFF", 1, 1, 0 if o.shadow label.shadow = new createjs.Shadow o.shadowColor, 1, 1, 0 if o.shadow
label.layerPriority = o.layerPriority label.layerPriority = o.layerPriority
label.name = "Sprite Label - #{@style}" label.name = "Sprite Label - #{@style}"
o.textHeight = label.getMeasuredHeight() o.textHeight = label.getMeasuredHeight()