Display component name on two lines in Dymola - modelica

I would like the name of a custom component in Dymola to be displayed on two lines.
When I use %name or %paramName (where paramName is the name of a String parameter of the component) in the TextBox, the name gets written on one line, even when there is space for two, and even when i try to use any of the following: \n, <br>, \\n...
So the only solution I found so far was to create two parameters, nameLine1 and nameLine2, and to use them inside the TextBox, where I can put each parameter on a different line easily by using S+RET.
Yet I find this solution quite cumbersome. Is there any way to do it more easily?
             
             
             
             
   

No, I think not. That's a very general problem Dymola/Modelica has with text boxes in the graphical layer. There is no auto-wrap.
You have two options (unless you go for your multi-parameter-solution). Make sure that there is not font size set (which is the default), then:
Use text box with non-zero width. Dymola will try truncate the text (but it's not very good at it)
Use a text box with zero width. Dymola will automatically adjust the width to the content.
Oh, there is a third, maybe not so bad option: Don't use so long names.

Related

How can I inject custom line breaks on a symbol layer label?

Is there a way to override the default "text-max-width" label wrapping and inject my own custom line breaks on a symbol feature label? Unfortunately for my current uses, "text-max-width" is strictly defined by em units and not actual character limits.
I'm attempting to break at specific characters and was hoping that setting "text-max-width" to 0 would give me control over line breaks. Currently if I inject "\n" within my string while "text-max-width" = 0, those custom breaks will be ignored and the label will instead be drawn as a single line.
Is there currently a way to work around this in mapbox-gl-js; or would this type of functionality be a new feature?
Just for clarification: \n in text-field is supported since v0.24.0. text-max-width defaults to 10em. Setting it to 0 disables all wrapping, including \n, in v0.33.1.
This may feel wrong, but setting text-max-width to Infinity should work.
The code responsible for text wrapping is in src/symbol/shaping.js, starting withshapeText(..., maxSize, ...). A quick look didn't reveal any problems with using Infinity, but I also found no other way.

Expandable text fields in PDF Forms, with Adobe Acrobat

I think this should be a relatively straightforward question to answer: is it possible in Adobe Acrobat only (not LiveCycle) to create text fields/boxes which automatically expand with their text? Scrollbars are not what we're looking for; the box itself must expand so that all the text is printable, as well as be saveable, printable and accessible.
Thank you.
Adobe Propaganda would say, this is not possible, and you will need XFA/LiveCycle Designer to do it.
It is possible, and I had it in practical use in some forms (not anymore, because they completely changed their forms system). It is "a little bit messy", and it only works with growing, but not with shrinking (although there may be some more fiddling needed to make it possible).
There is another alternative, which could work, if some tolerance is given to the precision. In this alternative, we count characters and line breaks, and change the size of the field accordingly.
Finally, the cheapass solution would be setting the font size to automatic, and let it change so that the contents fits into the field.

Apache fop : Unable to handle if single Word in text is larger than the containing block

I am new to fop , will be greatful if i get help from someone...,
I am not using XSLT tranformation but creating XSLFO file directly using Java code. Everything works fine but the problem comes when particular word(long text without space) is inserted into a cell of a table-column . That bigger word is overlapping the successive block.
I have an fo:block element in fo:table-cell which is in fo:table-row of a fo:table. This table has 6 columns, obviously column width is small. Now, when a Word in the block is larger than the block it is overlapping the next block. Give me some attribute value or any other solution to change my XSLFO file ,so that the bigger word breaks into the new line at end of the column.
Thanks in advance...
The things you need to look into are:
For the fo:table-cell: number-columns-spanned="3"
For setting the width of fo:table-column: column-width="proportional-column-width(1.5)"
The number-columns-spanned is used as attribute of and provides you with a means to select a bigger area where your fo:block fits.
The column-width makes it easy to define absolute width or, when using proportional-column-width, a width relative to the other columns.
I don't know of a way that lets FOP break words into multiple parts when they don't fit.

How to prevent line breaks with jasper-reports HTML export when using textfield truncation?

Using iReport 4.5.0, I'm setting these two properties and values:
net.sf.jasperreports.text.truncate.at.char=true
net.sf.jasperreports.text.truncate.suffix=...
The intent is to add "..." to the end of textfields whenever they must be truncated, and that the truncation determination happens at the character level, rather than at the word level. This works as expected when exporting to PDF. However, when exporting to HTML, the last truncated token (with the suffix appended) will often, though not always, wrap incorrectly. (It does this even though StretchType is set to No Stretch.) Example:
If I change net.sf.jasperreports.text.truncate.at.char=false (so that it breaks on words instead of characters) it seems to work more often, but only because word breaks usually leave more space for the suffix. The unexpected line wrapping still occurs with word breaks, especially if I increase the length of the given suffix.
My best guess is that the HTML exporter measurement isn't precisely calculating the width required by the given suffix (if it's calculating it at all).
Can anyone confirm?
Any suggestions as to a workaround?
It seems like with StretchType set to No Stretch, that the HTML exporter should probably also set white-space:nowrap. However, although that would prevent the line from wrapping, the end of the suffix would be partially hidden (due to overflow:hidden styling).
"My best guess is that the HTML exporter measurement isn't precisely calculating the width required by the given suffix (if it's calculating it at all)."
I confirm that this is surely the reason.
But there's not really a simple workaround. Your PDF is good, so you're doing something right. Well... you're doing lots of things right. ;-)
In HTML you don't know--in a very fundamental way--the precise details of the font that will render the text. You can certainly specify the font. But the client machine might not have it. Or it might have one that is the same... but not quite the same. Or the client might choose to use a different font or different size via various client-side override mechanisms.
If you try different fonts, you should notice slightly different results. You may be able to find one that works better more often. (Clearly, this isn't 100% perfect.)
If you aren't using Font Extensions, then you should. If you are using Font Extensions, then you can specify the list of fonts in descending preference that ought to be used in the HTML. This should give you enough control to get behavior that is good in a large number of cases. Often you can make it perfect in all of the cases that you care about.

Best way to represent format for presentation of cells in a grid?

I am building a dynamic reporting feature for a client. They want to create new stored procedures, and have them correspond to new reports. We are using T-SQL and each cell in a grid/report can have its own formatting and/or functionality.
I'm looking for a format specification to identify presentation, color and conditionals for data... for instance, I am thinking of something like this:
{data}|{format}
123.56|$#,##0.00
Results in ... $123.56
I am looking for standard ways to represent the formatting field, with the potential for colors and conditionals. Is there some standard out there already?
It all depends on what you're looking for. You have to ask yourself what types of formatting you wish to apply. Here's some cases you might want to consider:
In-line formatting
Do you want to have a cell that contains mixed formatting (e.g. "1234.567" shows bold, regular and italic in a single cell)?
Multi-column based output
Do you want to output a value in a cell that's based on multiple cells?
Cell1="1234"
Cell2="56"
Cell3={Cell1}.{Cell2}
---> which would output "1234.56"
If don't need either of those things, then all you want to do is provide a single format for the entire cell. Let's divide it into the two formatting elements: transformations and visual effects:
Formatting "1234.5678" into "1234.56" is a transformation. It has to be done by code that knows how to interpret the value as a number, and how to turn that number into the textual string of digit-characters.
Making a cell blue, or the text red, or bold - these are all visual transformations that are merely a set of attributes regarding the display of data in a cell. We don't care here about the type of data in the cell, since we just have to put pixels on a screen.
So, to bottom-line this: it's all about what you want to happen. If you're producing HTML reports, then HTML & CSS are very convenient methods for describing the visual-effects formatting of the cell, since you won't have to convert it twice.
As far as I know, there's only a couple of standards for encoding visual-effects display, and they are similar to SGML - TeX, HTML, PostScript, etc; they all have "tags" (sometimes with "attributes") to modify the display of the content within the tag.
Which leaves us the transformational formatting. There were two common approaches to this. The first is procedural. You list a set of transformations you wish to do on the data to turn it into text. Nowadays, we often use substitution masks, like in your example, $#,##0.00, or like in sprintf's %.2f, etc.
Again, just choose a formatting specifier that is the simplest to use in your environment. If you're coding in a language that accepts a certain format, then use it!