Change font size in WEKA Explorer - weka

I need to be able to use the WEKA Explorer GUI but make the font size bigger for displaying to an audience. I was able to change the fonts for some parts of the text by modifying the call to java in the file RunWeka.ini Specifically, I changed the first uncommented line to
cmd_default=javaw -Dswing.aatext=true -Dswing.plaf.metal.controlFont=Tahoma-plain-18 -Dswing.plaf.metal.userFont=Tahoma-plain-18 -Dfile.encoding=#fileEncoding# -Xmx#maxheap# -Djava.net.useSystemProxies=#systemProxies# #javaOpts# -classpath "#wekajar#;#cp#" #mainclass#
The difference from what comes with the Weka distribution is that I added the first three arguments - the ones that begin with -Dswing. This changes the font size in many places but fails to change a few places as marked in the screen shot below.
Does anyone know how to change the font size for the remaining text? Another argument to java?

Related

Clear font.ttf from unused glyphs

For example I want to use this .ttf font file:
https://www.onlinewebfonts.com/download/3b2646a48566403a55f62ceddbecbe18
It contains 29,064 glyphs.
I want to leave in it only the letters I use.
A short example: どこでもタップしてプレイ
So, from 29,064 it will be only 12 characters left. In my actual situation if will be around 300 glyphs.
Basically, I want to dramatically decrease it's file-size by removing unused glyphs
Is there a way to implement this by some script? I'm on macOS.
Or some app can do this and how exactly? Is there a real life example?
upd: answer from this question not working, throwing errors:
./subset.pl --chars="どこでもタップしてプレイ" /Users/User/Desktop/1.ttf /Users/User/Desktop/2.ttf
Wide character in subroutine entry at Font/Subsetter.pm line 1496.
In that question there are recommendation of use fixed this bug repo: https://github.com/fnp/librarian/blob/master/librarian/font-optimizer/subset.pl
And with it executing same command gives another errors:
Uses unhandled table 'BASE'
Uses forbidden table 'CFF '
As font file I used that from first link, just renamed it to 1.ttf

New Symbolic Color in Pango Span Text

First time poster; long time admirer of the Stack Overflow angels.
I'm having an issue with colors in span text that are controlled by Pango.
Long Version:
I'm updating an old UI program which has C++ code guts with GTK, XML (written by Glade), and an RC stylesheet handling the graphics. Some of our colored markup text is hard-coded in the XML. Some of it is dynamically set in the C++ code.
The problem is, that when the program runs on our older systems, the color referenced by span text as 'green' shows up as #00FF00. On our newer systems, 'green' is showing up as #008000.
Example of code printing to a label widget:
gtk_label_set_markup((GtkLabel *) TitleBarLabel, "<span color='green'>Orbital Cannon Positioning</span>");
I'm fairly certain that Pango is in control of the span text markup. I found that the difference between the greens is exactly the difference between X11 and W3C color lists (https://en.wikipedia.org/wiki/X11_color_names#Clashes_between_web_and_X11_colors).
It seems that our old systems are using X11 and our new ones are using W3C, which makes sense.
I could just replace all instances of 'green' with '#00FF00' but if we wanted to change the colors in the future, we'd have to go through the whole thing again. I'd much rather have the colors changeable through a stylesheet instead of baked into the code.
C++ Code:
GtkWidget * TitleBarLabel;
TitleBarLabel = GTK_WIDGET (get_builder_object (builder, "TitleBarLabel"));
gtk_label_set_markup((GtkLabel *) TitleBarLabel, "<span color='#00FF00'>Death Ray Power Status</span>");
I can create a GdkColor at run-time and gdk_color_parse it with values from a config file, and then use gtk_widget_modify_text() to apply the color to the label widgets. But then that doesn't work for all of the hard-coded span text in the XML. Also, we have pleanty of labels with bits of text colored differently inside the same line.
C++ Code:
GdkColor pass_color;
gdk_color_parse("#00FF00", &pass_color);
gtk_widget_modify_text(TitleBarLabel, GTK_STATE_NORMAL, &pass_color);
I can make a style in my RC file for each color and link every single label that would use that color at run-time. But we'd have to remove all markup coloring and add lots of code for grabbing widgets that we never bothered with before and code for setting names of widgets instead of just printing to them with new span text. It gets the desired result of having the colors changeable in a stylesheet but it's a massive undertaking and it's not intuitive for our veteran engineers who are used to using the color attributes.
RC File:
style "pass_color"
{
fg[NORMAL] = #00FF00
}
widget "*TitleBarLabel_Pass" style "pass_color"
C++ Code:
gtk_widget_set_name(TitleBarLabel, "TitleBarLabel_Pass");
Short Version:
Ideally, I would like to be able to make a new color at run-time that we can link with span text in such faction:
<span color='MyNewColor'>Weather Manipulation Settings</span>
Or maybe even create a new tag that applies specific attributes, like:
<span><MyNewColor>Shark Tank pH Balance</MyNewColor></span>
But I doubt that's possible.
I tried playing around with pango_attr_type_register(), pango_attr_foreground_new(), and friends, but I couldn't figure out how attributes work of if they could even do what I thought they did. After much research, it looks like an 'attribute' is just a one-time setting on a single string of text. And not a new value that can be called in line with span text, as I hoped.
Is anything like this remotely possible without rebuilding all of Pango?
Is there a different work around that would get me a stylesheet like setup?
At this point, I'm open to suggestions.
Version Specs:
Computers showing green as #00FF00
OS: Linux Slackware 13.37 and below
GTK: 2.24.4
Pango: 1.28.4
Computers showing green as #008000
OS: Linux Slackware 14.1
GTK: 2.24.20
Pango: 1.34.1
If you are able to use GTK 3.x, I would suggest doing that, where this is much easier to do using CSS. There is even a way to use multiple CSS styles for different regions in the same label, though it is awkward.
In GTK 2, as you noted, you can reference widgets by their name property in your RC file:
widget "shark-tank-ph-label" style "green-text"
style "green-text" {
text[NORMAL] = #008000
}
I would recommend taking this approach even if it's not what you're used to. Refactoring once to remove the hardcoded colors from your labels will make it much easier the next time you have to change something like this, and will also make your code closer to how things would work in GTK 3.x should you decide to make a port in the future.

Winapi: edit control not expanding its buffer

According to MSDN:
When the system creates an edit control, it automatically creates a text buffer, sets its initial size, and increases the size as necessary.
Yeah, only it doesn't. I have an edit control in my app that shows various logs, and I keep adding text to it using EM_SETSEL message (to find the end of the text in control's buffer) and EM_REPLACESEL message (to append some text to it). I don't know if it's a best way, but it's been working well so far. Today, however, I found out that if I try to append some text when there are lots of logs in edit control already, my app fails to do so. Maximum lenght of text that's shown in it is equal to 30k characters and when I try to append any more logs, it just fails, nothing happens. At first I set it as read-ony edit control, but nothing changes if I make it editable. Just when I try to type more than 30k characters in it, it acts as if I wasn't typing anything.
And now: I know that you can handle buffer expanding by yourself, but that's not the case here. If it is written that it should be expanded automatically, why doesn't it occur? Maybe I accidentaly set something that stops the application from increasing the buffer's size? I don't know and I can't find any answer to that, so I was just wondering if there's any way to actually make my application to expand that buffer on its own.
You need to set a text limit with the EM_LIMITTEXT message. Otherwise:
Before EM_LIMITTEXT is called, the default limit for the amount of
text a user can enter in an edit control is 32,767 characters.

How to get paper.print() to work?

I have been trying to get the following Raphael code to just write something on the screen with no luck!
paper.print(30, 15, "TEXT", paper.getFont("Arial"), 20).attr({fill: "black"});
Is there anything else you need to do to get the text in the paper?!?!!?
You need to cufonize a font, being sure to indicate that the cufonized font should register itself with Raphael, and include the resulting .js file before you can use getFont to retrieve it (there are no fonts available by default). If you check, I'm reasonably sure you'll find that paper.getFont("Arial") is returning undefined.
Cufon essentially converts every glyph in a provided font into its vector equivalent -- Raphael simply transforms and sequences those paths to produce output.

Get a font filename based on Font Name and Style (Bold/Italic)

This has been driving me crazy all day.
I need to get a font filename (eg. Arial.ttf) based on its name (Arial in this case) and whether it is bold, italic or both. Using those pieces of information, I need to find the font file so I can use it for rendering.
Some more examples:
Calibri, Bold would resolve to calibrib.ttf.
Calibri, Italic would resolve to calibrii.ttf.
Any ideas on how I could achieve this in C++ (Win32)
First, to my knowledge, there is no reliable way to do that.
The Windows API deals with font families and mappings, not with font files, which are dealt with at a lower level. Also note that even if you manage to get the file name of a font, no rendering function (that I know of) will accept it, so what will you do with it?
That said, you can look in the registry key HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Fonts in order to obtain the file name of a font from its logical name. An implementation of that solution can be found here.
Related to the earlier posts, this seems to be a reliable way:
1) Read the registered Windows font list from
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Fonts\
You will obtain file names and alternate file paths here.
The Font names are not useful as they can change with user's locale.
2) Load the TrueType files (.ttf, .ttc, .otf):
Use FreeType https://www.freetype.org/). Just initialize the freetype library and load face with FT_New_Face(library, path, 0, &face).
3) Obtain the font Family name using FreeType.
Use FT_Get_Sfnt_Name_Count() and FT_Get_Sfnt_Name() to obtain the string table.
You will need to check if the encoding is Ansi, UTF16 or other, as some strings will be in multiple different languages and encodings.
4) Obtain the OS2 TrueType properties.
Use (TT_OS2 *) FT_Get_Sfnt_Table (face, ft_sfnt_os2) to get the OS2 structure.
Interpret the structure using docs like https://www.microsoft.com/typography/otspec/os2.htm#fc
5) Now you have font file path, family name, style properties and other information. Build a list of these and function to search for a file based on font family and style.
This Code Project project does what you want. As-is it fails on Windows 7 because the GetWinVer function stops at XP. It is trivial to add the case for Windows 7.
You normally do this by calling CreateFontIndirect and then getting the system to render. Perhaps you could explain why you can't use this standard approach.
One solution would be to access the font files and extract the name from the name table to create your own lookup (an STL map would be a simple way of doing that). Details of the TTF file format can be found here.