Skip to content

Commit

Permalink
same spacing between all lines. #5
Browse files Browse the repository at this point in the history
  • Loading branch information
wissenbach committed Mar 16, 2017
1 parent 3c89047 commit f68712f
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
3 changes: 3 additions & 0 deletions svg_rendering/page/js-gen/transcript-configuration-faust.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ if(window.Faust === undefined) {
// overlay : "overlay",
overlay : "none",
stripWhitespace : ['overw'],
// distance from top of one line to top of the following line
lineSpacingValue: "20",
lineSpacingUnit: "pt",
initialize : function (layoutState) {
layoutState.idMap = {};
},
Expand Down
19 changes: 18 additions & 1 deletion svg_rendering/page/js-gen/transcript-svg.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ if(window.FaustTranscript === undefined) {
result.setAttribute('width', '0.1em');
result.setAttribute('style', 'visibility: hidden;');
//TODO dynamically calculate from context line height
var height = String(this.vSpaceHeight * 1.5) + 'em';
var height = String(Faust.TranscriptConfiguration.lineSpacingValue * this.vSpaceHeight)
+ Faust.TranscriptConfiguration.lineSpacingUnit;
result.setAttribute('height', height);
return result;
};
Expand Down Expand Up @@ -200,6 +201,22 @@ if(window.FaustTranscript === undefined) {
return line;
};

FaustTranscript.Line.prototype.getExt = function(coordRotation) {
var matrix = this.view.viewportElement.createSVGMatrix();
// create artificial element with real line width but fixed height
var originalLineWidth = this.constructor.superclass.getExt.call(this, 0)
var extElement = this.svgDocument().createElementNS(SVG_NS, "rect");
this.view.insertBefore(extElement, this.view.childNodes[0]);
extElement.setAttribute("width", originalLineWidth);
extElement.setAttribute("height", String(Faust.TranscriptConfiguration.lineSpacingValue)
+ Faust.TranscriptConfiguration.lineSpacingUnit);
matrix = matrix.rotate(coordRotation);
var bbox = SvgUtils.boundingBox(extElement, matrix).width;
this.view.removeChild(extElement);
return bbox;
};


FaustTranscript.Text.prototype.createView = function() {
// wrapper will contain text decorations
var wrapper = this.svgDocument().createElementNS(SVG_NS, "g");
Expand Down
2 changes: 1 addition & 1 deletion svg_rendering/page/js-gen/transcript.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ if(window.FaustTranscript === undefined) {


if (this.previous()) {
var yourJoint = this.lineAttrs['interline'] ? 0.75 : 1.5;;
var yourJoint = this.lineAttrs['interline'] ? 0.5 : 1;;
if (Faust.TranscriptConfiguration.overlay === "overlay") {
//yourJoint = ("between" in this.lineAttrs)? 1 : 1;
yourJoint = ("over" in this.lineAttrs)? 0.1 : yourJoint;
Expand Down

0 comments on commit f68712f

Please sign in to comment.