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

Tooltip doesn't display unicode character #422

Closed
ghost opened this issue Nov 14, 2016 · 11 comments
Closed

Tooltip doesn't display unicode character #422

ghost opened this issue Nov 14, 2016 · 11 comments
Assignees

Comments

@ghost
Copy link

ghost commented Nov 14, 2016

image 3
My swing application can't display unicode character in tooltip text. I guess it's a font issue. But I don't know how to change the font used by tooltip.

@mgarin mgarin self-assigned this Nov 14, 2016
@mgarin
Copy link
Owner

mgarin commented Nov 14, 2016

Yep, that is a used font issue - there was a similar question before: #97

Shortly - you can replace used fonts by assigning new values to various public static fields in WebLookAndFeel class. And you need to do that before initializing L&F, otherwise it will not have any effect.

I will be addressing currently poor way of handling fonts in v1.3.0, you can follow issue #331 to recieve updates for any related changes made.

@ghost
Copy link
Author

ghost commented Nov 14, 2016

I change the WebLookAndFeel.globalTooltipFont, but it doesn't work.
image 1

    static void test5() {
        WebLookAndFeel.globalTooltipFont= new Font("微软雅黑", Font.PLAIN, 13);
        WebLookAndFeel.initializeManagers();

        WebFrame frame = new WebFrame("Test");
        frame.setLayout(new FlowLayout());
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setSize(480, 360);

        WebButton button=new WebButton("你好,世界");
        frame.add(button);
        TooltipManager.setTooltip(button, "你好,世界", TooltipWay.down, 0);

        frame.setVisible(true);
    }

mgarin added a commit that referenced this issue Nov 14, 2016
- WebCustomTooltip.java - Temporary fix for global font inheritance [ #422 ]
@mgarin
Copy link
Owner

mgarin commented Nov 14, 2016

Okay, I was slightly wrong with the suggestion above.
There are two reasons why it doesn't work for you:

  1. Fonts specified in static fields of WebLookAndFeel class are only used when WebLaF is installed as application L&F due to the way component fonts are installed
  2. Custom tooltips represented by WebCustomTooltip component work differently and that component currently has a small issue with inheriting font specified in WebLookAndFeel.globalTooltipFont

I have pushed a small fix for the 2nd problem ( 9aea23e ), but it will only be included in snapshot builds of v1.2.9 styling version and the final v1.2.9 release.

You can find build containing ( 9aea23e ) change here:
https://oss.sonatype.org/content/repositories/snapshots/com/weblookandfeel/

I'm not really sure which version you are currently using, so if it is problematic to move to newer version right now - you can simply change font in toolTipFont field instead of globalTooltipFont, that should do the trick.

@mgarin
Copy link
Owner

mgarin commented Nov 14, 2016

Just in case - build is still in progress and new artifacts will be uploaded to maven in a few minutes, make sure you will try today's version in case you will.

@mgarin mgarin added this to the v1.2.9 milestone Nov 14, 2016
@ghost
Copy link
Author

ghost commented Nov 15, 2016

I change the value of WebLookAndFeel.toolTipFont as you said, but still doesn't work. I'm using [ v1.29 ] [ pre-release ] complete version downloaded from http://weblookandfeel.com/.
At https://oss.sonatype.org/content/repositories/snapshots/com/weblookandfeel/, I only find core version. Where can I get complete version?

@mgarin
Copy link
Owner

mgarin commented Nov 15, 2016

Yes, you are using a quite old version where WebLookAndFeel.toolTipFont was not yet used for custom tooltips. In that version it would be quite problematic to change the font.

Regarding the link I gave - there are no complete version there as it is a maven build for separate modules. If you want to use that one - you will need core and ui artifacts plus all dependency libraries.

And about complete and some other artifacts - I will upload those tomorrow to the site, but eventually I will be getting rid of those (at least from the one that includes dependencies as well) as there are multiple issues that it could cause, so I strongly recommend using separate module builds and dependencies. It should also be quite easy if you have a maven project - in that case you can simply add a dependency in it to get everything required.

@mgarin
Copy link
Owner

mgarin commented Nov 15, 2016

And generally - I am planning to make some major enhancements to the project structure as it is already huge and constantly growing in size. You can check those out here - #336 - these changes will be coming with v1.3.0 release.

@ghost
Copy link
Author

ghost commented Nov 15, 2016

Now I'm using weblaf-core-1.2.9-20161114.190243-77.jar and weblaf-ui-1.2.9-20161114.190438-77.jar. However, some classes and methods are not available any more, such as TitledBorderPainter, WebFrame, ToolbarStyle, WebPanel.setPainter() and WebButton.createIconWebButton().
Do I forget to add any necessary artifacts? And where can I get source code of corresponding version?

@mgarin
Copy link
Owner

mgarin commented Nov 15, 2016

Some classes like TitledBorderPainter and WebFrame are still there, they just got their package changed. You can simply remove your current import in IDE and add the new offered one.

Some classes and methods like WebPanel.setPainter(...) got renamed. That specific method was renamed to setCustomPainter(...) to emphasize its impact on the component.

Some classes and methods actually got removed like ToolbarStyle and WebButton.createIconWebButton(). Instead of those cutom things you can pass specific StyleId instances into component constructor or into setStyleId(...) methods of Web-components. For example StyleId.toolbarAttachedNorth and StyleId.buttonIcon for the toolbar and button. You can also find a lot more predefined styles in StyleId class for each existing component.

And no, you didn't forget anything. Right now you need core and ui modules from WebLaF and dependency libraries: XStream, Slf4j, Svg Salamander, Jericho HTML and Java Image Scaling ( + optional RSyntaxTextArea one ) - to run any WebLaF-based application.

You can find sources near the artifacts at the snapshot repository:
https://oss.sonatype.org/content/repositories/snapshots/com/weblookandfeel/
For example for an artifact weblaf-core-1.2.9-20161114.190243-77.jar there is a sources JAR file called weblaf-core-1.2.9-20161114.190243-77-sources.jar, as well as JavaDoc one if you need that too.

@mgarin
Copy link
Owner

mgarin commented Nov 15, 2016

I have now uploaded the updated artifacts to the site:
http://weblookandfeel.com/downloads/styling/
You can find complete build there if you are still having issues with the separate artifacts.

@mgarin
Copy link
Owner

mgarin commented Dec 6, 2016

I guess this issue should be fixed so I will close it.
You can still follow #331 to get notifications about the new fonts manager.

@mgarin mgarin closed this as completed Dec 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant