music - java how to draw a G-clef and F-clef using points or curves -


i making music app using graphics 2d, , have managed draw stave , music notes. trying draw g-clef

image of g-clef

and f-clef

image of f-clef

if there possible way it, appreciate.

nb: have looked around 2 days , have seen questions similar haven't yet seen solution.

using points , curves not best way. @david, found out unicodes work best. use unicode in printing string,

import java.awt.font; import java.awt.graphics; import java.awt.graphics2d; import java.awt.renderinghints;  import javax.swing.jframe;  public class unicodetext { public static void main(string[] args) { jframe f = new jframe() {   public void paint(graphics g) {     graphics2d g2 = (graphics2d) g;     g2.setrenderinghint(renderinghints.key_antialiasing,         renderinghints.value_antialias_on);      font font = new font("bravura", font.plain, 32);      g2.setfont(font);     g2.drawstring("\ud834\udd1e", 40, 80);// gclef     g2.drawstring("\ud834\udd22", 40, 80);// fclef   } }; f.setsize(200,200); f.setvisible(true); } } 

download "bravura" font here , find unicode standard chart here

hope helps someone.


Comments