control Font Style of text on graphs?

control Font Style of text on graphs? - It is possible control Font Style of text displayed on graphs? - Сообщения

#1 Опубликовано: 04.12.2024 21:44:46
Oscar Campo

Oscar Campo

124 сообщений из 298 понравились пользователям.

Группа: Moderator

Please see the following image...

[albumimg]1722[/albumimg]

Fonts on graphs.sm (5 КиБ) скачан 28 раз(а).

How to Control Font Style on Graphs in SMath?
Maybe is possible implement on x-y graph plugin?

best,
Oscar
#2 Опубликовано: 04.12.2024 22:55:51
francesco rapuano

francesco rapuano

12 сообщений из 38 понравились пользователям.

Группа: User

Hi Oascar,

probably my answer is not strictly related with your question but I see that you want to create like a callout with a textual part enclosed in a rectangle.
Just for the callout part probably can be of some help this post here
Then you can add a rectangular shape and overlap to it a label text always using the XY Plot Plugin.(Hoping that the textual part is not hidden by the rectangualr one .. but if the rectangle is not filled should be feasible the thing t least from a conceptual viewpoint)
Obviuosly it is a longer process despite your one .

Take care and best regards

Franco
#3 Опубликовано: 04.12.2024 23:29:31
Oscar Campo

Oscar Campo

124 сообщений из 298 понравились пользователям.

Группа: Moderator

Wrote

Hi Oascar,

probably my answer is not strictly related with your question but I see that you want to create like a callout with a textual part enclosed in a rectangle.
Just for the callout part probably can be of some help this post here
Then you can add a rectangular shape and overlap to it a label text always using the XY Plot Plugin.(Hoping that the textual part is not hidden by the rectangualr one .. but if the rectangle is not filled should be feasible the thing t least from a conceptual viewpoint)
Obviuosly it is a longer process despite your one .

Take care and best regards

Franco



Thanks Franco,
Your post about callouts on XY Plot plugin was my inspiration. The problem is that the text is independant of the zoom you apply on the graph and the lines defined by points ar totally dependant of the zoom. in this case, mix a rectangle and text will create a degenerate callout when somebody try to change the zoom on a graph:

[albumimg]1723[/albumimg]

Fonts on graphs 2.sm (17 КиБ) скачан 20 раз(а).
#4 Опубликовано: 04.12.2024 23:46:52
Davide Carpi

Davide Carpi

1415 сообщений из 2872 понравились пользователям.

Группа: Moderator

You might have something related to the font family too? i.e. seems it isn't a monospaced font, that is a cornerstone in ascii drawings.
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#5 Опубликовано: 04.12.2024 23:58:56
Вячеслав Мезенцев

Вячеслав Мезенцев

1402 сообщений из 1708 понравились пользователям.

Группа: Moderator

X-Y Plot uses 'Courier' font family for text labels.

xyplot-text-lablels-font-family.jpg
Russia ☭ forever, Viacheslav N. Mezentsev
#6 Опубликовано: 05.12.2024 00:00:16
Oscar Campo

Oscar Campo

124 сообщений из 298 понравились пользователям.

Группа: Moderator

Wrote

You might have something related to the font family too? i.e. seems it isn't a monospaced font, that is a cornerstone in ascii drawings.



I have tested it with a freshly installed version of SMath and it is the same.
The point is that the text (monospaced) in the native SMath graphics is displayed correctly, but not in the graph plotted by the x-y graph plugin. There is no way to control which font is used for the text in the x-y plugin through the settings. It would be really amazing if you could choose which font you would like to use.
#7 Опубликовано: 05.12.2024 00:05:38
Davide Carpi

Davide Carpi

1415 сообщений из 2872 понравились пользователям.

Группа: Moderator

Wrote

X-Y Plot uses 'Courier' font family for text labels.



Font in Oscar screenshot is definetly not Courier. It might be possible that the font is not installed on Oscar PC? .NET overrides the requested typeface if not found (that's the reason behind the FontFamily.GenericMonospace/FontFamily.GenericSerif etc options to initialize a font).
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#8 Опубликовано: 05.12.2024 00:07:29
Oscar Campo

Oscar Campo

124 сообщений из 298 понравились пользователям.

Группа: Moderator

Wrote

X-Y Plot uses 'Courier' font family for text labels.

...



Please,
Can you change the font of text labels on settings and check if they really change the font inside the graph? I tried to do that but nothing happens, only can change font of axes, labels, legend, and, Title. Nothing of that affects the text inside the graph.
#9 Опубликовано: 05.12.2024 00:21:48
francesco rapuano

francesco rapuano

12 сообщений из 38 понравились пользователям.

Группа: User

You are completely right Oscar , I have seen this zooming problem and differences in behaviour of shapes and text labels unlukily .
The only possibility to mitigate it is to define in a rigid way a drawing frame and ask the end user to avoid zooming ( it is probably a too restrictive approach ) .

Obviously if the usage of the documentation/program developed is for publishing or presentation purposes this issues are less important.

Other possibilities to write text labels is with a program/utilities from Razonar , If I remeber correctly they came from a Mathcad sheet conversion and don't know if the zooming issue is present in this program too.

Best regards

Franco
#10 Опубликовано: 05.12.2024 00:24:51
Oscar Campo

Oscar Campo

124 сообщений из 298 понравились пользователям.

Группа: Moderator

Wrote

Wrote

X-Y Plot uses 'Courier' font family for text labels.



Font in Oscar screenshot is definetly not Courier. It might be possible that the font is not installed on Oscar PC? .NET overrides the requested typeface if not found (that's the reason behind the FontFamily.GenericMonospace/FontFamily.GenericSerif etc options to initialize a font).



Here is a screenshot with courier font family (I had installed):

[albumimg]1724[/albumimg]
[albumimg]1725[/albumimg]
#11 Опубликовано: 05.12.2024 00:35:16
Davide Carpi

Davide Carpi

1415 сообщений из 2872 понравились пользователям.

Группа: Moderator

Wrote

Here is a screenshot with courier font family (I had installed):



I guessed so, since the built-in plot has a monospaced font.

What I mean is that if the Font in the plugin is initialized with a specific name (f.e. "Courier" ) and the actual font name is different (f.e. "Courier New" ) it migth not match (because are two similar but different fonts) and fall back to a standard font picked by the framework.

It is possible that you need the Courier (without new) font.

(like this - I don't have the simple "Courier" type too in Windows by default)

Файл не найден. Файл не найден.
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#12 Опубликовано: 05.12.2024 00:40:41
Вячеслав Мезенцев

Вячеслав Мезенцев

1402 сообщений из 1708 понравились пользователям.

Группа: Moderator

Wrote

Please,
Can you change the font of text labels on settings and check if they really change the font inside the graph? I tried to do that but nothing happens, only can change font of axes, labels, legend, and, Title. Nothing of that affects the text inside the graph.


Something like that

xyplot-text-lablels-set-font.jpg

It looks like the 2D Plot is using the "Courier New" font.
Russia ☭ forever, Viacheslav N. Mezentsev
2 пользователям понравился этот пост
Davide Carpi 05.12.2024 00:41:00, francesco rapuano 05.12.2024 00:47:00
#13 Опубликовано: 05.12.2024 01:12:47
Oscar Campo

Oscar Campo

124 сообщений из 298 понравились пользователям.

Группа: Moderator

Wrote


Something like that

xyplot-text-lablels-set-font.jpg

It looks like the 2D Plot is using the "Courier New" font.



I installed "Courier" font. Nothing happens... I tried on 3 different devices where I have installed SMath and I can't reproduce the same as your screenshot... (why?)

[albumimg]1726[/albumimg]


#14 Опубликовано: 05.12.2024 01:22:28
Вячеслав Мезенцев

Вячеслав Мезенцев

1402 сообщений из 1708 понравились пользователям.

Группа: Moderator

Not so fast. This is a new feature. Only I have implemented it so far.
Russia ☭ forever, Viacheslav N. Mezentsev
2 пользователям понравился этот пост
Davide Carpi 05.12.2024 01:26:00, Oscar Campo 05.12.2024 01:45:00
#15 Опубликовано: 05.12.2024 01:45:13
Oscar Campo

Oscar Campo

124 сообщений из 298 понравились пользователям.

Группа: Moderator

Wrote

Not so fast. This is a new feature. Only I have implemented it so far.



Ok...!!!

I'm waiting for that!!
#16 Опубликовано: 05.12.2024 13:22:29
francesco rapuano

francesco rapuano

12 сообщений из 38 понравились пользователям.

Группа: User

Hi Oscar,

just for completeness and information this is the post from Alvaro I was referring to ,with it there are no zooming issues because the font is vectorial , if I remeber correctly there are 2 fonts family .
Probably in this case the limiting factor is the time involved to write something on the plotting area; make me wonder if it is possible to optimize the execution time saving the vector font table avoiding that it is recalculated each time the program starts and improving the assembly of the writing label from this table , for sure Alvaro can be of better help on this topic.

Take care and best regards

Franco
2 пользователям понравился этот пост
Oscar Campo 05.12.2024 18:33:00, Alvaro Diaz Falconi 05.12.2024 22:05:00
#17 Опубликовано: 05.12.2024 21:37:18
⚜ Kenny Lemens, P.E. ᵂᴵ

⚜ Kenny Lemens, P.E. ᵂᴵ

74 сообщений из 164 понравились пользователям.

Группа: User

Greetings,

Since we are on the subject of text, one feature I would request is the ability to plot text directly onto the graph:
SMath_DrawTextOnGraph.png

I use this technique for creating dimensions on screen (and by extension, leaders). I try to limit the native 'draw text on top of graph' as graph labels (things that don't require any specific zoom to look nice, like the USC Icon in AutoCAD).

The problem is that each letter needs to be mapped; there should be a way to convert a font into plot data, but I don't know how to go about that.

May this be of Good Help;
⚜ Kenny Lemens, P.E. ᵂᴵ
"No matter where you go, there you are." -Buckaroo BanzaiHotkeys: https://en.smath.com/forum/resource.ashx?a=45771&b=2
#18 Опубликовано: 05.12.2024 22:13:19
Alvaro Diaz Falconi

Alvaro Diaz Falconi

992 сообщений из 1674 понравились пользователям.

Группа: User

Wrote

Hi Oscar,

just for completeness and information this is the post from Alvaro I was referring to ,with it there are no zooming issues because the font is vectorial , if I remeber correctly there are 2 fonts family .
Probably in this case the limiting factor is the time involved to write something on the plotting area; make me wonder if it is possible to optimize the execution time saving the vector font table avoiding that it is recalculated each time the program starts and improving the assembly of the writing label from this table , for sure Alvaro can be of better help on this topic.

Take care and best regards

Franco



About speeding up the script execution, you can use that file to generate a string (for faster copy and paste) and use this function to represent it. This is because there is no NaN in SMath, otherwise it would be much easier.

Clipboard01.png

Another technique could be XYPlot's new image embedding functionality. Here I copied and pasted a clipping from Oscar's example, but you could just as well generate SVG text and pass it to XYPlot.

Clipboard02.png

DrawingText - JustTheText.sm (38 КиБ) скачан 32 раз(а).

Best regards.
Alvaro.

2 пользователям понравился этот пост
francesco rapuano 06.12.2024 02:22:00, Oscar Campo 06.12.2024 06:41:00
#19 Опубликовано: 06.12.2024 02:26:47
francesco rapuano

francesco rapuano

12 сообщений из 38 понравились пользователям.

Группа: User

Sorry Alvaro but what is txtStr ?
I imagine that is a the text string to plot but how has been created and from what ? Using part of the program you developed previously to draw text in XY Plot ? and however is fast this part not as the original program at least for me .

Best regards

Franco
#20 Опубликовано: 06.12.2024 06:27:10
Alvaro Diaz Falconi

Alvaro Diaz Falconi

992 сообщений из 1674 понравились пользователям.

Группа: User

Wrote

Sorry Alvaro but what is txtStr ?
I imagine that is a the text string to plot but how has been created and from what ? Using part of the program you developed previously to draw text in XY Plot ? ...



You imagine well. It is from here:

txt.png

DrawingText TXT.sm (325 КиБ) скачан 29 раз(а).

Wrote

... in XY Plot ?



It is not designed for XYPlot, but for native SMath Plot, although it works in both. This version is for XYPlot, which can obviously include more options.

xysm.png

DrawingText - JustTheText XYPlot.sm (35 КиБ) скачан 26 раз(а).

Wrote

... and however is fast this part not as the original program at least for me .



Maybe in your system. You can see my timings in the original post, at left of the margin. It take more than one minute for the entire worksheet in my system. BTW, like in Microsoft Word or Adobe PDF: you can choose if you want to embed the fonts in the document or not.

With this for include vectorial text in a graphic, there is no need to include the source in the document, with the fonts definitions and procedures to draw them; just a string and an auxiliary function, necessary because (I insist) SMath does not have NaN, because if it had, the function would not be necessary.

In any case, if Viacheslav includes the option to display scalable and orientable text in its plugin, this utility would almost lose all its meaning. Maybe just for some special effect.

[albumimg]1727[/albumimg]

Best regards.
Alvaro.
2 пользователям понравился этот пост
Oscar Campo 06.12.2024 06:43:00, francesco rapuano 06.12.2024 14:20:00
  • Новые сообщения Новые сообщения
  • Нет новых сообщений Нет новых сообщений