How can I limit or clip text in SVG?

前端 未结 5 1594
傲寒
傲寒 2021-02-06 23:36

I have done a table in SVG, and I want to fill it with data dynamically. That means that I don\'t know how much space the text takes, and I want to clip or hide the overlapping

5条回答
  •  不思量自难忘°
    2021-02-07 00:16

    As Marcin said in point (2) of his answer (unfortunately downvoted but actually this is a good point) an alternative way to achieve the effect is to overpaint the part not wanted with a white rectangle.

    
    
    
    
    Orange     
    Pear       
    Banana     
    Pomegranate
    
    
    
    
    
    
    12
    7
    9
    2
    
    
    
    
    

    svg overlay sample

    Reference to the SVG specification: SVG 2.0 Rendering Order

提交回复
热议问题