Shape Text Questions

My first question, is what is the default unit assigned to a font size in a shape?

I was following the tutorial on applying styles to the text, and came into a bit of a roadblock. So when you set the font size, what unit of measurement is it using?

Specifically this line : shape.Char(0).Size.Value = 0.##

I’ve played around with it and for me, any value above .8 will make the text disappear. Anything below that seems to work, it’s just that I cannot figure out the unit of measurement.

My second question is regarding the situation where a word in the text field of a shape is too big to fit inside said Shape. The default behavior appears to be adding a bunch of blank lines to the text, which makes the text appear outside the box. Is there a way to override that default behavior?

Hi Cameron,


Thank you for contacting support. Please note, the unit measurement of font size is inch. One inch is equal to 72 points. You could see the font size in “PT” under shapesheet ( “Character” tab ).
CameronHicks:
I’ve played around with it and for me, any value above .8 will make the text disappear. Anything below that seems to work, it’s just that I cannot figure out the unit of measurement.
Regarding the matter of text disappearing, please check font scale value under shapesheet (“Character” tab) and make sure that it’s 100%. You can set the font scale as follows:
shape.Chars[0].FontScale = new DoubleValue(100, MeasureConst.PER);
CameronHicks:
My second question is regarding the situation where a word in the text field of a shape is too big to fit inside said Shape. The default behavior appears to be adding a bunch of blank lines to the text, which makes the text appear outside the box. Is there a way to override that default behavior?
When we add a big size word to Visio diagram shape, it mimics this default behavior. We can see the whole word outside the box. If you are facing an issue with your sample diagram, then please share it with us. We’ll take a closer look and reply you accordingly.

We hope, this helps. Please let us know in case of any further assistance or questions.

Thank you for replying.

Here's the sample program that I have. It's more or less straight from your example files from your Github page :

Public Shared Sub Main(ByVal args() As String)
' The path to the documents directory.
Dim dataDir As String = Path.GetFullPath("../../../Data/")

'Set license (you can add 10 shapes without setting a license)
'License lic = new License();
'lic.SetLicense(dataDir + "Aspose.Total.lic");

' Load masters from any existing diagram, stencil or template
' and add in the new diagram
Dim visioStencil As String = dataDir & "Basic Shapes.vss"

' Create a new diagram
Dim diagram1 As New Diagram(visioStencil)

Dim rect1 As Long = rectangle(diagram1, "Bunch of short words", 1, 2)

Dim rect2 As Long = rectangle(diagram1, "Short words VeryLongWord more short words", 3, 4)

'Save the diagram
diagram1.Save(dataDir & "Output.pdf", SaveFileFormat.PDF)


Shared Function rectangle(ByRef diagram As Diagram, ByVal text As String, ByVal xpos As Double, ByVal ypos As Double) As Long

Dim width As Double = 0.5, height As Double = 1


'Add a new rectangle shape
Dim rectangleId As Long = diagram.AddShape(xpos, ypos, width, height, "Rectangle", 0)

'Set the new shape's properties
Dim shape As Shape = diagram.Pages(0).Shapes.GetShape(rectangleId)
shape.Text.Value.Add(New Txt(text))
shape.Name = "Rectangle1"


Return rectangleId

End Function



Hi Cameron,


Thank you for providing sample code. We have tested your sample code against the latest build of Aspose.Diagram 5.4.0 and managed to replicate the problem of blank area within the shape’s text. We have logged this issue under ticket id DIAGRAMNET-50498 in our issue tracking system. Your post has also been linked to this issue. We’ll keep you informed regarding any available updates. We’re sorry for the inconvenience caused.

Hi Cameron,


Thank you for being patient. We have a good news for you that the issue id DIAGRAMNET-50498 has now been resolved. If there is no issue in the QA phase, then this fix will be included in the next version of Aspose.Diagram for .NET 5.7.0. We’ll inform you via this forum thread as soon as the new release is published.

The issues you have found earlier (filed as DIAGRAMNET-50498) have been fixed in Aspose.Diagram for .NET 5.7.0.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.