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

Font cutoff with bold italics #3001

Closed
itsjustdel opened this issue May 23, 2022 · 3 comments
Closed

Font cutoff with bold italics #3001

itsjustdel opened this issue May 23, 2022 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@itsjustdel
Copy link
Contributor

Describe the bug:

Last letter of text cropped when using bold italic google font Poppins

To Reproduce:

Steps to reproduce the behaviour:

  1. Download Poppins font family Poppins
  2. Extract OpenSans-BoldItalic.ttf
  3. Bundle with fyne bundle Poppins-BoldItalic.ttf >> bundled.go
  4. Run and look at top right of the the last letter

Screenshots:

ddddd

Example code:


import (
	"image/color"

	"fyne.io/fyne/v2"
	"fyne.io/fyne/v2/app"
	"fyne.io/fyne/v2/canvas"
	"fyne.io/fyne/v2/container"
	"fyne.io/fyne/v2/theme"
)

type myTheme struct{}

func (m myTheme) Color(name fyne.ThemeColorName, variant fyne.ThemeVariant) color.Color {
	return theme.DefaultTheme().Color(name, variant)
}

func (m myTheme) Font(style fyne.TextStyle) fyne.Resource {

	return resourceStaticFontsPoppinsBoldItalicTtf
}

func (m myTheme) Icon(name fyne.ThemeIconName) fyne.Resource {
	return theme.DefaultTheme().Icon(name)
}

func (m myTheme) Size(name fyne.ThemeSizeName) float32 {
	return theme.DefaultTheme().Size(name)
}

func main() {
	myApp := app.New()
	w := myApp.NewWindow("Text")

	text := canvas.NewText("DDDDdd", color.White)
	text.TextSize = 42

	var _ fyne.Theme = (*myTheme)(nil)
	myApp.Settings().SetTheme(&myTheme{})

	vBox := container.NewVBox(
		container.NewCenter(text),
	)

	w.SetContent(vBox)
	w.Resize(fyne.NewSize(240, 360))

	w.ShowAndRun()
}

Device (please complete the following information):

  • OS: Windows
  • Version: 10
  • Go version: 1.8
  • Fyne version: 2.1.4
@itsjustdel itsjustdel added the unverified A bug that has been reported but not verified label May 23, 2022
@andydotxyz andydotxyz added bug Something isn't working and removed unverified A bug that has been reported but not verified labels May 23, 2022
@andydotxyz andydotxyz self-assigned this May 23, 2022
@andydotxyz
Copy link
Member

andydotxyz commented May 23, 2022

It seems to be possible to cause this to happen without the custom font...

package main

import (
	"image/color"

	"fyne.io/fyne/v2"
	"fyne.io/fyne/v2/app"
	"fyne.io/fyne/v2/canvas"
	"fyne.io/fyne/v2/container"
)

func main() {
	myApp := app.New()
	w := myApp.NewWindow("Text")

	text := canvas.NewText("DDDDdd", color.White)
	text.TextStyle.Bold = true
	text.TextStyle.Italic = true
	text.TextSize = 42

	vBox := container.NewVBox(
		container.NewCenter(text),
	)

	w.SetContent(vBox)
	w.Resize(fyne.NewSize(240, 360))

	w.ShowAndRun()
}

Screenshot 2022-05-23 at 17 13 02

@itsjustdel
Copy link
Contributor Author

So it can, same behaviour on Windows
image

@andydotxyz
Copy link
Member

This is now on develop branch for testing prior to v2.2.0 release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants