How to Subtract a Vector Path from a Rectangle in Sketch - sketch-3

How does one subtract a vector path in Sketch. Shapes are straightforward and text is also doable. The white lines in the attached images need to be cuts through the rectangle. Suggestions?

You need to convert the vector-path to outlines first.
Select the desired element with outlines
Choose inside the menu: Layer > Convert to Outlines (⇧⌘O)
Select the elements you want to combine
Choose (Subtract, Intersect or Difference)
Update: added an inline GIF for better visual reference

Related

Letter Spacing on Curves SVG Makes Letters Tilted Using D3

When I add letter-spacing style to my text on path in D3, it tilts the letters and they don't follow nicely the circle anymore (see highlighted letters on image 2)
You can see my D3 code in this notebook
I've tried to do it in InkScape and it looks like it handles the letter-spacing differently (see image 3)
The style in the inkscape for the text is
font-size:17.6389px;line-height:1.25;text-align:center;text-decoration-color:#000000;letter-spacing:5.29167px;writing-mode:vertical-lr;text-anchor:middle;white-space:pre;fill:#990000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:3.77953;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers;stop-color:#000000
and for textPath is
font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:17.6389px;font-family:Arial;-inkscape-font-specification:Arial
I've tried to use some of these attributes, but I cannot get the same result in D3. I would like the letters to be straight as in InkScape
Thanks for your help.
It might be impossible to center the letter with the letter-spacing attribute to be tilted symetrically.
I ended up creating a function that add non-breakable spaces between every character d.data.split("").join("\xa0".repeat(d.space)) where d.data is the text and d.space is the number of spaces inbetween every letter. This is just good for me now and give the following result.

Is there a quick way to find the correct coordinate parameters for get_overlapping?

it's pretty tedious working out the dimensions of an image then halving it and adding it on every time I want to check whether something is overlapping.
You likely want to use bbox.
This 'returns the bounding box for all matching items', i.e. the rectangle outline of the picture you want to get the coordinates of.
coords = canvas.bbox(item)
or
coords = canvas.bbox("itemtag")
In the case of multiple items with the same tag, it will use the first item given that tag.

How to combine to shapes into one? Sketch

I have just installed sketch and I am trying to create a circle with a tick sign inside.
The issue is that whenever I use the Union option to merge the circle and tick sign the tick sign is hidden. Here are the steps.
Insert -> Shape -> Oval
Insert -> Vector
I draw the tick sign
Select all layers specified above and click on union.
Tick sign is no longer shown inside the circle.
You can select both and create a symbol. Then export the symbol. You don't need union for this since you don't have any of the two shapes protruding outside the other.
The union creates a newer shape with the outer boundaries of the elements. In your case, the check mark is inside the circle and the result is just the circle. The right operation would be:
1 convert the check mark into an outline (Shift + Cmd + O)
2 select the circle and the checkmark
3 use the option subtract so the new shape would be the circle minus the checkmark.
You can just Group the two layers in step 4, rather than Union. Wouldn't that accomplish what you're looking to do?

Overbraces in Excel

From Googling I've only found "regular" braces, i.e. } in varying sizes. I want to achieve an overbrace spanning some columns in a table. I only want the overbrace (where the brace "starting first" is an overbrace, and the latter an underbrace) and the x over it in the example is not needed.
Is there a way to achieve an overbrace in Excel?
Seems to me better suited to Super User but I am not sure I understand the requirement since you say you know abut "regular" braces. If you would like something like this:
show first with and lower down without the x, it may be achieved with insertion of a shape object: INSERT > Illustrations - Shapes, Right Brace in the case of Excel 2013.
Then rotating, stretching and moving the shape to suit, the handles for which are shown:
and colour adjusted with Shape Outline.

svg concatenate text of different styles

I am using d3 to create an axis label inside an svg element. Part of the label is constant (string literal) and part of it varies as the user clicks around. To emphasize that it changes, I want it to be bold, while the rest of the text is normal weight. Aligning these two text elements, to each other and the rest of the drawing, has turned out to be quite difficult.
Also, it seems trailing spaces in text elements are ignored, making it harder to do the concatenation. And if there's a way to change styles within a text element, that would work too.
Here is a very hacky way of doing it, in that it won't work with three pieces of text (because text-anchor), and the result is hard to center (do I really need to go use getBBox()?).
function renderLabel(dynamicText){
svg.select(".label").remove();
var label = svg.append("g")
.attr("class", "label")
label.append("text")
.attr("text-anchor", "end")
.text("The Axis is Based On ");
label.append("text")
.attr("text-anchor", "start")
.style("font-weight", "bold")
.attr("transform", "translate(6,0)") //space
.text(dynamicText);
}
In general, I would like to be able to append/concatenate any number of string variables, each with distinct styles, in a way that "looks good" as a sentence, and can be centered. Please tell me there's a better way to do it.
Instead of using separate text elements, use one text element with two tspan elements nested inside. If you do not set separate positioning attributes on the tspan, they will naturally line up as one row of text.
https://developer.mozilla.org/en-US/docs/Web/SVG/Element/tspan

Resources