Class FontRenderer

  • All Implemented Interfaces:
    IResourceManagerReloadListener
    Direct Known Subclasses:
    EaglerFontRenderer

    public class FontRenderer
    extends java.lang.Object
    implements IResourceManagerReloadListener
    + This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code. Minecraft 1.8.8 bytecode is (c) 2015 Mojang AB. "Do not distribute!" Mod Coder Pack v9.18 deobfuscation configs are (c) Copyright by the MCP Team EaglercraftX 1.8 patch files are (c) 2022-2023 LAX1DUDE. All Rights Reserved. WITH THE EXCEPTION OF PATCH FILES, MINIFIED JAVASCRIPT, AND ALL FILES NORMALLY FOUND IN AN UNMODIFIED MINECRAFT RESOURCE PACK, YOU ARE NOT ALLOWED TO SHARE, DISTRIBUTE, OR REPURPOSE ANY FILE USED BY OR PRODUCED BY THE SOFTWARE IN THIS REPOSITORY WITHOUT PRIOR PERMISSION FROM THE PROJECT AUTHOR. NOT FOR COMMERCIAL OR MALICIOUS USE (please read the 'LICENSE' file this repo's root directory for more info)
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void drawSplitString​(java.lang.String str, int x, int y, int wrapWidth, int textColor)
      + Splits and draws a String with wordwrap (maximum length is parameter k)
      int drawString​(java.lang.String text, float x, float y, int color, boolean dropShadow)
      + Draws the specified string.
      int drawString​(java.lang.String text, int x, int y, int color)
      + Draws the specified string.
      int drawStringWithShadow​(java.lang.String text, float x, float y, int color)
      + Draws the specified string with a shadow.
      boolean getBidiFlag()
      + Get bidiFlag that controls if the Unicode Bidirectional Algorithm should be run before rendering any string
      int getCharWidth​(char character)
      + Returns the width of this character as rendered.
      int getColorCode​(char character)  
      static java.lang.String getFormatFromString​(java.lang.String text)
      + Digests a string for nonprinting formatting characters then returns a string containing only that formatting.
      int getStringWidth​(java.lang.String text)
      + Returns the width of this string.
      boolean getUnicodeFlag()
      + Get unicodeFlag controlling whether strings should be rendered with Unicode fonts instead of the default.png font.
      java.util.List<java.lang.String> listFormattedStringToWidth​(java.lang.String str, int wrapWidth)
      + Breaks a string into a list of pieces that will fit a specified width.
      void onResourceManagerReload​(IResourceManager resourceManager)  
      protected void renderStringAtPos​(java.lang.String parString1, boolean parFlag)
      + Render a single line string at the current (posX,posY) and update posX
      protected void resetStyles()
      + Reset all style flag fields in the class to false; called at the start of string rendering
      void setBidiFlag​(boolean bidiFlagIn)
      + Set bidiFlag to control if the Unicode Bidirectional Algorithm should be run before rendering any string.
      void setUnicodeFlag​(boolean unicodeFlagIn)
      + Set unicodeFlag controlling whether strings should be rendered with Unicode fonts instead of the default.png font.
      int splitStringWidth​(java.lang.String parString1, int parInt1)
      + Returns the width of the wordwrapped String (maximum length is parameter k)
      java.lang.String trimStringToWidth​(java.lang.String text, int width)
      + Trims a string to fit a specified Width.
      java.lang.String trimStringToWidth​(java.lang.String text, int width, boolean reverse)
      + Trims a string to fit a specified Width.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • unicodePageLocations

        protected static final ResourceLocation[] unicodePageLocations
      • charWidth

        protected int[] charWidth
        + Array of width of all the characters in default.png
      • FONT_HEIGHT

        public int FONT_HEIGHT
        + the height in pixels of default text
      • glyphWidth

        protected byte[] glyphWidth
        + Array of the start/end column (in upper/lower nibble) for every glyph in the /font directory.
      • colorCode

        protected int[] colorCode
        + Array of RGB triplets defining the 16 standard chat colors followed by 16 darker version of the same colors for drop shadows.
      • posX

        protected float posX
      • posY

        protected float posY
      • unicodeFlag

        protected boolean unicodeFlag
      • bidiFlag

        protected boolean bidiFlag
      • red

        protected float red
      • blue

        protected float blue
      • green

        protected float green
      • alpha

        protected float alpha
      • textColor

        protected int textColor
      • randomStyle

        protected boolean randomStyle
      • boldStyle

        protected boolean boldStyle
      • italicStyle

        protected boolean italicStyle
      • underlineStyle

        protected boolean underlineStyle
      • strikethroughStyle

        protected boolean strikethroughStyle
    • Method Detail

      • drawStringWithShadow

        public int drawStringWithShadow​(java.lang.String text,
                                        float x,
                                        float y,
                                        int color)
        + Draws the specified string with a shadow.
      • drawString

        public int drawString​(java.lang.String text,
                              int x,
                              int y,
                              int color)
        + Draws the specified string.
      • drawString

        public int drawString​(java.lang.String text,
                              float x,
                              float y,
                              int color,
                              boolean dropShadow)
        + Draws the specified string.
      • resetStyles

        protected void resetStyles()
        + Reset all style flag fields in the class to false; called at the start of string rendering
      • renderStringAtPos

        protected void renderStringAtPos​(java.lang.String parString1,
                                         boolean parFlag)
        + Render a single line string at the current (posX,posY) and update posX
      • getStringWidth

        public int getStringWidth​(java.lang.String text)
        + Returns the width of this string. Equivalent of FontMetrics.stringWidth(String s).
      • getCharWidth

        public int getCharWidth​(char character)
        + Returns the width of this character as rendered.
      • trimStringToWidth

        public java.lang.String trimStringToWidth​(java.lang.String text,
                                                  int width)
        + Trims a string to fit a specified Width.
      • trimStringToWidth

        public java.lang.String trimStringToWidth​(java.lang.String text,
                                                  int width,
                                                  boolean reverse)
        + Trims a string to fit a specified Width.
      • drawSplitString

        public void drawSplitString​(java.lang.String str,
                                    int x,
                                    int y,
                                    int wrapWidth,
                                    int textColor)
        + Splits and draws a String with wordwrap (maximum length is parameter k)
      • splitStringWidth

        public int splitStringWidth​(java.lang.String parString1,
                                    int parInt1)
        + Returns the width of the wordwrapped String (maximum length is parameter k)
      • setUnicodeFlag

        public void setUnicodeFlag​(boolean unicodeFlagIn)
        + Set unicodeFlag controlling whether strings should be rendered with Unicode fonts instead of the default.png font.
      • getUnicodeFlag

        public boolean getUnicodeFlag()
        + Get unicodeFlag controlling whether strings should be rendered with Unicode fonts instead of the default.png font.
      • setBidiFlag

        public void setBidiFlag​(boolean bidiFlagIn)
        + Set bidiFlag to control if the Unicode Bidirectional Algorithm should be run before rendering any string.
      • listFormattedStringToWidth

        public java.util.List<java.lang.String> listFormattedStringToWidth​(java.lang.String str,
                                                                           int wrapWidth)
        + Breaks a string into a list of pieces that will fit a specified width.
      • getFormatFromString

        public static java.lang.String getFormatFromString​(java.lang.String text)
        + Digests a string for nonprinting formatting characters then returns a string containing only that formatting.
      • getBidiFlag

        public boolean getBidiFlag()
        + Get bidiFlag that controls if the Unicode Bidirectional Algorithm should be run before rendering any string
      • getColorCode

        public int getColorCode​(char character)