Created
July 3, 2012 23:23
-
-
Save roundrobin/3044119 to your computer and use it in GitHub Desktop.
just another inlet to tributary
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
var width = 557 | |
var height = 190 | |
var font_size = 557 | |
var x = 58 | |
var y = 119 | |
var rect = g.append("rect") | |
.attr("width",width) | |
.attr("height",height) | |
.attr("fill","black") | |
.attr("x",x) | |
.attr("y",y) | |
var text1 = g.append("text") | |
.attr("fill","red") | |
.attr("x",x) | |
.attr("y",y) | |
.attr("font-size",font_size) | |
.text("Heyg|gggggggggggrrrrrrrrwerwegggfdfgf") | |
.style('dominant-baseline','text-before-edge') | |
.style('font-family','') | |
var boundingBoxOfTextNode = text1.node().getBBox(); | |
var textLength = text1.node().getComputedTextLength(); | |
var a1 = width; | |
var b1 = font_size; | |
var c1 = textLength; | |
text1.attr("font-size",(a1 * (b1/c1))) | |
var a = height; | |
var b = font_size; | |
var c = boundingBoxOfTextNode.height; | |
text1.attr("font-size",(a * (b/c))) | |
console.log((a * (b/c)),a1 * (b1/c1),'Aspect Box',width/height,"Apect Text",textLength/boundingBoxOfTextNode.height) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment