Changing EdgeFontSize in UMLGraph

70 Views Asked by At

I try to change the font size for the associotion text in UMLGraph using the @opt edgefontsize but it seems that a default font size is used.

Note that the option @opt edgefontname works fine.

I'm on UMLGraph doclet version R5_7_2-32-g40b5a6

Here a demonstration - all fonts are increased to 22, but the association text remains small.

/**
 * @hidden  
 * @opt postfixpackage
 * @opt nodefontclassname "Arial Bold"
 * @opt nodefontclassabstractname "Arial Italic"
 * @opt nodefontclasssize 22
 * 
 * @opt nodefontname "Arial"
 * @opt nodefontabstractname "Times New Roman Italic"
 * @opt nodefontsize 22
 * 
 * @opt nodefonttagname "Courier New Italic"
 * @opt nodefonttagsize 22
 * 
 * @opt nodefontpackagename "Comic Sans MS"
 * @opt nodefontpackagesize 22
 * 
 * @opt edgefontname "Courier New Italic"
 * @opt edgefontsize 22
 * @opt types 
 */
 class UMLOptions{} 



/**
 * @opt attributes  
 * @assoc  " "  " " parent_id B  
 */

class A {
public int id;
}

/**
 * @opt attributes    
*/  
class B {
public int id;
}

Result

enter image description here

1

There are 1 best solutions below

4
On

If you open the class Options (file Options.java) of the UMLGraph package you can see that the edgeFontSize is declared as

double edgeFontSize = 10;

Thus, it is set to a specific constant value. Plus, you can also see that the edgeFontName is declared as

String edgeFontName = Font.DEFAULT_FONT;

So edgeFondSize has a fixed value (which is 10) as a default font size and this is the reason why the size did not change when you set it to 22. On the other hand, edgeFontName is not fixed with a specific value and that's why it changes when you choose "Courier New Italic" or "Arial" etc.

In conclusion, one way to deal with the problem is that you define another value for edgeFontSize (e.g. 22) or to declare edgeFontSize in a similar way as edgeFontName. Its your call.

I really hope, that helps!