nus-cs2103-AY1718S1 / forum

Discussion Forum
5 stars 0 forks source link

How to fix help window gibberish text on mac #208

Open caoliangnus opened 6 years ago

caoliangnus commented 6 years ago

For Mac users, please refer to this PR

Before:

screen shot 2017-11-11 at 12 54 37 am

After:

screen shot 2017-11-11 at 12 54 57 am
damithc commented 6 years ago

Nice đź‘Ť Confirmed works on all three OS: Windows, Linux, OS-X?

caoliangnus commented 6 years ago

I am not sure about Linux system. For Windows, it has no such problem. For OS-X, I can confirm that it works.

damithc commented 6 years ago

I am not sure about Linux system. For Windows, it has no such problem. For OS-X, I can confirm that it works.

I meant, does it work on Windows after the fix? Fixing it for one platform can break it on another.

caoliangnus commented 6 years ago

Yes, it works.

image

caoliangnus commented 6 years ago

I realised that Google Map unable to load the page. Please see below for the solution.

Solution: Change: private static final String USER_AGENT = "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko";

to: private static final String USER_AGENT = "Mozilla/5.0 (Windows NT 5.1; rv:7.0.1) Gecko/20100101 Firefox/7.0.1";

Before:

screen shot 2017-11-11 at 12 33 12 pm

After: image

ZY-Ang commented 6 years ago

Thanks for the reuse offer. Works on Ubuntu 16.04 LTS

image

damithc commented 6 years ago

Thanks for the reuse offer. Works on Ubuntu 16.04 LTS

Nice.

@caoliangnus I encourage you to submit this fix as a PR to se-edu/addressbook-level4 , after the exams of course.

@Zhiyuan-Amos FYI

ZY-Ang commented 6 years ago

@damithc @Zhiyuan-Amos I'm assuming @caoliangnus used this source https://stackoverflow.com/questions/41952734/javafx-webview-font-issue-on-mac for the fix.

Note that it might be hacky and probably using the other method in the comments, i.e. engine.setUserAgent(engine.getUserAgent().replace("Macintosh‌​; ", "")); might be better

As he said, setting the user agent to trick the system into thinking it is windows may not be such a good idea. Apparently Oracle knows about it and is a fix in Java 9: http://bugs.java.com/bugdatabase/view_bug.do?bug_id=JDK-8088205

However for the simplicity's sake, @caoliangnus's implementation should suffice