1

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

Marmite Bomber
  • 19,886
  • 4
  • 26
  • 53

1 Answers1

1

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!

EvangelosK
  • 11
  • 2
  • So basically it is not possible to change the font size *without recompiling of UMLGraph*? – Marmite Bomber Jul 04 '19 at 04:01
  • Well, as you suggested there is a default value for edgeFontSize that in your case needs to change and since you need to be able to change the size for every diagram I suggest that you declare edgeFontSize in the similar way that edgeFontName is declared and run a new build of UMLGraph. – EvangelosK Jul 05 '19 at 00:02
  • Can you provide some information how to *build* UMLGraph, I only *installed* it up to now. – Marmite Bomber Jul 05 '19 at 05:06
  • In order to build the project from the top (if you want to add some new features) you can use an IDE (eg. Eclipse), import UMLGraph as a project and run a maven build after the changes you have made. As for the problem for the edgeFontSize, I realize that Options class should be set at runtime. So if edgeFontSize is set to the desired value and Options is set at runtime, that should solve the problem. Please, point out any bug you face. – EvangelosK Jul 06 '19 at 10:15