Hello, why are the fonts used in the project not applied to the generated svg file when we use SvgVectorOutput?
What should be done to solve this problem?
[Done] SvgVectorOutput and fonts
Re: SvgVectorOutput and fonts
Please provide a working example which shows the problem.
Re: SvgVectorOutput and fonts
Hi
If you are a windows user
The vector lib deals only with the installed fonts
If you are a windows user
The vector lib deals only with the installed fonts
Egypt my love
Re: SvgVectorOutput and fonts
For example, when I run the following code:
I get the following result, which is not correct.
When I manually change font-family="t" to font-family="tahoma", the result is correct.
Code: Select all
If OpenWindow(0, 0, 0, 500, 250, "VectorDrawing", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
CanvasGadget(0, 0, 0, 500, 250)
LoadFont(0, "tahoma", 20, #PB_Font_Italic)
If StartVectorDrawing(SvgVectorOutput("nt.svg",500,250))
VectorFont(FontID(0), 125)
Text$ = "Sample"
; draw text
MovePathCursor(25, 25)
DrawVectorText(Text$)
; draw logical bounding box
AddPathBox(25, 25, VectorTextWidth(Text$), VectorTextHeight(Text$))
VectorSourceColor(RGBA(0, 0, 255, 255))
DashPath(2, 10)
; draw visible bounding box
AddPathBox(25 + VectorTextWidth(Text$, #PB_VectorText_Visible|#PB_VectorText_Offset),
25 + VectorTextHeight(Text$, #PB_VectorText_Visible|#PB_VectorText_Offset),
VectorTextWidth(Text$, #PB_VectorText_Visible),
VectorTextHeight(Text$, #PB_VectorText_Visible))
VectorSourceColor(RGBA(255, 0, 0, 255))
DashPath(2, 10)
; draw baseline
MovePathCursor(25, 25 + VectorTextHeight(Text$, #PB_VectorText_Baseline))
AddPathLine(VectorTextWidth(Text$), 0, #PB_Path_Relative)
VectorSourceColor(RGBA(0, 255, 0, 255))
DashPath(2, 10)
StopVectorDrawing()
EndIf
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
EndIf
When I manually change font-family="t" to font-family="tahoma", the result is correct.
Code: Select all
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="500pt" height="250pt" viewBox="0 0 500 250">
<defs>
</defs>
<text xml:space="preserve" x="25" y="150.061" font-family="t" font-size="125" font-weight="400" font-style="italic" stroke="none" fill-rule="evenodd" fill="#000000">Sample</text>
<path stroke-dasharray="10" stroke-dashoffset="0" fill="none" stroke-width="2" stroke="#0000FF" d="M 25 25 L 428.687 25 L 428.687 175.879 L 25 175.879 Z "/>
<path stroke-dasharray="10" stroke-dashoffset="0" fill="none" stroke-width="2" stroke="#FF0000" d="M 31.546 55.0903 L 441.454 55.0903 L 441.454 175.208 L 31.546 175.208 Z "/>
<path stroke-dasharray="10" stroke-dashoffset="0" fill="none" stroke-width="2" stroke="#00FF00" d="M 25 150.061 L 428.687 150.061 "/>
</svg>
Re: SvgVectorOutput and fonts
This looks like a bug.
Only "t" is wrong.
A moderator should move this in the bug section for investigation.
Only "t" is wrong.
A moderator should move this in the bug section for investigation.
- Mindphazer
- Enthusiast
- Posts: 460
- Joined: Mon Sep 10, 2012 10:41 am
- Location: Savoie
Re: SvgVectorOutput and fonts
Strange, the code runs fine here (on Windows and MacOS, PB 6.21)
The generated .svg has the full font name (on MacOS, for a reason i don't understand, tahoma is replaced by system Font, but if you try Arial or Courier, it works fine)
The generated .svg has the full font name (on MacOS, for a reason i don't understand, tahoma is replaced by system Font, but if you try Arial or Courier, it works fine)
MacBook Pro 16" M4 Pro - 24 Gb - MacOS 15.4.1 - Iphone 15 Pro Max - iPad at home
...and unfortunately... Windows at work...
...and unfortunately... Windows at work...
Re: SvgVectorOutput and fonts
I'm trying it on Windows and I'm having this problem for all fonts. 

Re: SvgVectorOutput and fonts
OS Window
Works with PB v6.12 but not since v6.20.
So a bug
Works with PB v6.12 but not since v6.20.
So a bug
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive