Package javafx.scene.text

Examples of javafx.scene.text.Font


  }

  @Test
  public void fontFromObjectWithPositiveHeightDelta() {
    URI uri = URI.createURI("font://Arial/+1/");
    Font font = cellFactory.fontFromObject(uri);
    assertEquals(Font.getDefault().getSize() + 1, font.getSize(), 0);
  }
View Full Code Here


  }

  @Test
  public void fontFromObjectWithNegativeHeightDelta() {
    URI uri = URI.createURI("font://Arial/-2/");
    Font font = cellFactory.fontFromObject(uri);
    assertEquals(Font.getDefault().getSize() - 2, font.getSize(), 0);
  }
View Full Code Here

  @Test
  public void fontFromObjectWithoutHeight() {
    URI uri = URI.createURI("font://Arial//");
    cellFactory.fontFromObject(uri);
    Font font = cellFactory.fontFromObject(uri);
    assertEquals("Arial", font.getName());
  }
View Full Code Here

  }

  @Test
  public void fontFromObjectBold() {
    URI uri = URI.createURI("font://Arial/8/bold");
    Font font = cellFactory.fontFromObject(uri);
    assertEquals("Arial Bold", font.getName());
    assertEquals(8, font.getSize(), 0);
  }
View Full Code Here

  }

  @Test
  public void fontFromObjectItalic() {
    URI uri = URI.createURI("font://Arial/8/italic");
    Font font = cellFactory.fontFromObject(uri);
    assertEquals("Arial Italic", font.getName());
    assertEquals(8, font.getSize(), 0);
  }
View Full Code Here

  }

  @Test
  public void fontFromObjectBoldAndItalic() {
    URI uri = URI.createURI("font://Arial/8/bold+italic");
    Font font = cellFactory.fontFromObject(uri);
    assertEquals("Arial Bold Italic", font.getName());
    assertEquals(8, font.getSize(), 0);
  }
View Full Code Here

  }

  @Test
  public void fontFromObjectItalicAndBold() {
    URI uri = URI.createURI("font://Arial/8/italic+bold");
    Font font = cellFactory.fontFromObject(uri);
    assertEquals("Arial Bold Italic", font.getName());
    assertEquals(8, font.getSize(), 0);
  }
View Full Code Here

  @Test
  public void applyItemProviderFont() {
    IItemFontProvider fontProvider = mock(IItemFontProvider.class);
    Object item = new Object();
    URI fontURI = URI.createURI("font://Arial/8/");
    Font font = new Font(8);
    when(fontProvider.getFont(item)).thenReturn(fontURI);
    when(adapterFactory.adapt(item, IItemFontProvider.class)).thenReturn(fontProvider);
    when(cellFactory.fontFromObject(fontURI)).thenReturn(font);
    Cell<?> cell = new Cell<>();
    cellFactory.applyItemProviderFont(item, cell, adapterFactory);
View Full Code Here

 
  Font createFont(int style) {
    switch (style) {
    case StyleRange.BOLD:
    {
      Font f = Font.font(getSkinnable().getFont().getFamily(), FontWeight.BOLD, getSkinnable().getFont().getSize());
      return f;
    }
    case StyleRange.ITALIC:
    {
      Font f = Font.font(getSkinnable().getFont().getFamily(), FontPosture.ITALIC, getSkinnable().getFont().getSize());
      return f;
    }
    case StyleRange.BOLD | StyleRange.ITALIC:
    {
      Font f = Font.font(getSkinnable().getFont().getFamily(), FontWeight.BOLD, FontPosture.ITALIC, getSkinnable().getFont().getSize());
      return f;
   
    }
    return null;
  }
View Full Code Here

TOP

Related Classes of javafx.scene.text.Font

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.