You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I need the ability to select two or more text objects and align them horizontally based on their individual baselines. This feature would ensure that text objects with different font sizes, line heights, or font families can be aligned along a common baseline, ensuring a uniform appearance in the layout. How do I implement function getBaselinePosition
vartext1=newText('Hello',{left: 100,top: 100,fontSize: 40,});vartext2=newText('World',{fontFamliy: 'xxx',left: 200,top: 150,fontSize: 60,});canvas.add(text1,text2);functiongetBaselinePosition(text){// calculate its baseline based on its font metrics}varbaseline1=getBaselinePosition(text1);varbaseline2=getBaselinePosition(text2);if(baseline1>baseline2){text2.top+=baseline1-baseline2;}else{text1.top+=baseline2-baseline1;}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I need the ability to select two or more text objects and align them horizontally based on their individual baselines. This feature would ensure that text objects with different font sizes, line heights, or font families can be aligned along a common baseline, ensuring a uniform appearance in the layout. How do I implement function
getBaselinePosition
Beta Was this translation helpful? Give feedback.
All reactions