Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SVG Font-family does not apply after convert to png(Splash screen) #16399

Closed
denhaandrei opened this issue Jul 27, 2023 · 7 comments · Fixed by #16100
Closed

SVG Font-family does not apply after convert to png(Splash screen) #16399

denhaandrei opened this issue Jul 27, 2023 · 7 comments · Fixed by #16100
Labels
area-single-project Splash Screen, Multi-Targeting, MauiFont, MauiImage, MauiAsset, Resizetizer external fixed-in-8.0.20 fixed-in-9.0.0-preview.4.10690 platform/android 🤖 platform/iOS 🍎 s/needs-attention Issue has more information and needs another look t/bug Something isn't working
Milestone

Comments

@denhaandrei
Copy link

denhaandrei commented Jul 27, 2023

Description

Font 'Poppins' after conversion does not apply to the result PNG files: obj\Debug\net7.0-android\resizetizer\r\drawable (any folders)

I'm using the following SVG file:

<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="413.852" height="808.197" viewBox="0 0 413.852 808.197">
  <defs>
	<style>
		@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@800');
		.st0{fill:#223F3B;}
		.st1{fill:#5AC87A;}
	</style>
	  <pattern id="pattern" x="0" y="0" width="30" height="31" viewBox="0 0 30 31" patternUnits="userSpaceOnUse" >
		  <rect x="0" y="0" width="30" height="31" fill="#ffffff"/>
		  <path d="M-12.627,0H-21.6a1.07,1.07,0,0,0-1.062,1.075A1.071,1.071,0,0,0-21.6,2.152h7.908v7.975A1.069,1.069,0,0,0-12.627,11.2a1.068,1.068,0,0,0,1.061-1.076V1.075A1.068,1.068,0,0,0-12.627,0" transform="translate(24.996 9.291)" fill="rgba(82,190,41,0.1)"/>
	  </pattern>
  </defs>
	<rect x="0" y="0" width="413.852" height="808.197" opacity="0.999" fill="url(#pattern)"/>
  <g transform="translate(87.526 250) scale(1.5)">
	<g id="Text" transform="translate(77.589 0)">
		<text y="70" font-family="Poppins" font-size="15" fill="#404D3A" text-anchor="middle">Test message with font</text>
		<text y="90" font-size="15" fill="#404D3A" text-anchor="middle">Test message without font</text>
	</g>
  </g>
</svg>

Steps to Reproduce

  1. Create a MAUI App solution
  2. Paste the following svg to existing splash.svg
  3. Change in proj file:
    to
  4. Clean bin and obj folders if build project previously
  5. Run on the Android 10 where full screen splash supported or see result png in folder: \obj\Debug\net7.0-android\resizetizer\r\drawable-xxxhdpi
  6. The result png and opened svg are not the same, font-family does not apply

Please note

  1. the same issue for iOS font do not apply after publish to test flight
  2. the same when I use @font-face {
    font-family: 'PoppinsBoldBase64';
    src: url('data:font/truetype;base64,AAEAA...... and font-family="PoppinsBoldBase64"

Link to public reproduction project repository

https://github.com/denhaandrei/BadSvgConverter.App

Version with bug

7.0.49

Last version that worked well

NOT work

Affected platforms

iOS, Android

Affected platform versions

I think all Android/IOS, because issue with convert svg

Did you find any workaround?

No response

Relevant log output

No response

@denhaandrei denhaandrei added the t/bug Something isn't working label Jul 27, 2023
@denhaandrei denhaandrei changed the title SVG Font-family does not apply after convert to png(Splash screen)) SVG Font-family does not apply after convert to png(Splash screen) Jul 27, 2023
@jsuarezruiz jsuarezruiz added the area-single-project Splash Screen, Multi-Targeting, MauiFont, MauiImage, MauiAsset, Resizetizer label Jul 27, 2023
@PureWeen
Copy link
Member

@denhaandrei did this work in 6.0 ?

@PureWeen PureWeen added the s/needs-info Issue needs more info from the author label Jul 27, 2023
@ghost
Copy link

ghost commented Jul 27, 2023

Hi @denhaandrei. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

@denhaandrei
Copy link
Author

denhaandrei did this work in 6.0 ?

Previously not tested. Miss question "Last version that worked well"

After the test, it does not work at 6.0 too.

@ghost ghost added s/needs-attention Issue has more information and needs another look and removed s/needs-info Issue needs more info from the author labels Jul 28, 2023
@moljac
Copy link
Contributor

moljac commented Jul 28, 2023

This is not directly maui issue. namely managed libraries used by resizetizer
have issues converting some (complex) SVG images to PNG.

Workaround would be to convert SVG to PNG using reliable converters.

  • original

    ! OK - github does not render font correctly
    splash.svg
    splash

  • resizetizer

    ! OK - font
    resizetizer-splash.png
    resizetizer-splash

  • Chrome browser - screenshot MacOSX

    OK
    chrome-browser-splash

  • inkscape

    ! OK - font
    inkscape-splash

Online Converters

I work on collecting reported issues in MAUI repo, so I can open issues on GitHub in relevant repositories.

@denhaandrei
Copy link
Author

denhaandrei commented Aug 11, 2023

Hello, @moljac

I understand that the issue is not dotnet/maui, but MAUI uses some packages to convert .svg automatically.
Thanks for your help. Wait and check it after the update packages.

Unfortunately, we can`t use the converter on the splash screen, because the application can have different resolutions on different devices. So we continue to use .svg without font applying.

Please note, only "Chrome browser - screenshot MacOSX"(windows the same) is expected.

Thanks,
Andrew

@moljac
Copy link
Contributor

moljac commented Aug 14, 2023

I understand that the issue is not dotnet/maui, but MAUI uses some packages to convert .svg automatically.

I understand you completely. There are expectations which are not fulfilled.

My suggestion is: please open issue in Svg.Net repo too (with svg that has issue and expected png output).

Thanks for your help. Wait and check it after the update packages.

You re welcome. This is the reason we are here.

Unfortunately, we can`t use the converter on the splash screen, because the application can have different resolutions on different devices. So we continue to use .svg without font applying.

I understand. This must be fixed. Only the problem is where and how fast. Rewriting everything could cause more issues.

Please note, only "Chrome browser - screenshot MacOSX"(windows the same) is expected.

Thanks for the info. It was quite confusing when I saw several online converters having issues (similar incorrect output)

@moljac
Copy link
Contributor

moljac commented Aug 22, 2023

Issue created in Svg.Net repo

svg-net/SVG#1068

Closing this issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-single-project Splash Screen, Multi-Targeting, MauiFont, MauiImage, MauiAsset, Resizetizer external fixed-in-8.0.20 fixed-in-9.0.0-preview.4.10690 platform/android 🤖 platform/iOS 🍎 s/needs-attention Issue has more information and needs another look t/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants