Package: uPrintGen
μPrintGenCreates a microprint representation of text or a text file, with rules set by a configuration file. These rules highlight rows with different background and text colors depending on the rules added.UsageConsole commandInstalling the package through pip makes the commandgenerate_microprintavailable through the terminal. It accepts three parameters.-iThe text file to generate as a microprint. Required-cThe configuration file pathname. Optional, default:config.json-oThe name of the file to be saved. Optional, default:microprint.svgExamplegenerate_microprint -i log.txt -o test2.svg -c config_2.jsonAs a packageAt the same time, the package can be imported from a Python program and used in two ways:From text_filefrom uprintgen import SVGMicroprintGenerator

svg = SVGMicroprintGenerator.from_text_file(
    file_path="example.txt", config_file_path="config.json", output_filename="microprint.svg"
    )

svg.render_microprint()Which will save the microprint with the defined name and configuration file.From textfrom uprintgen import SVGMicroprintGenerator

example= "blablablabla..."

svg = SVGMicroprintGenerator(text=example, config_file_path="config.json", 
    output_filename="microprint.svg")

svg.render_microprint()Configuration fileThe generator accepts a JSON configuration file with a set of settings that it can change, those settings and their default values are as followsVisual configurationsRuleDescriptionDefaultscaleChanges the scale of the font in the generated microprint.1vertical_spacingChanges the vertical spacing between each row.1microprint_widthChanges the width of the microprint (or each column if there's more than one).120max_microprint_heightChanges the max height of the microprint. If "number_of_columns" is set, this parameter is not used. The microprint will be divided in columns to fulfill the desired height.Total log height. No limitnumber_of_columnsChanges the number of columns to render. If this parameter is set, "max_microprint_height" is not used. The height of the microprint will be set automatically to fulfill the desired number of columns.1column_gap_sizeChanges the size of the gap between columns.0.2column_gap_colorChanges the color of the gap between columns.whitedefault_colorsThese define the default colors that are used in case no color  was defined for a certain rule. If this section is not present, both colors will be the default ones.Background color:whiteText color:blackfont-familyThis sets the font-family of the svg. If the first font is not available or cannot be loaded in the system, the next one is going to be used.monospaceAdditional fonts (insideadditional_fonts)This section contains fonts to be embedded to the svg.If the fonts work natively in the place where you want to see the svg, there's no need todo this. Monospace fonts recommended.It has two subsections.google_fontsandtruetype_fonts.Google fonts (insidegoogle_fonts)This sub-section contains fonts to be loaded from google fonts.RuleDescriptionDefaultnameThe name to assign the embedded font. This name is the one that needs to be used when setting the font-family of the microprint.Requiredgoogle_font_urlThe url from where to load the google font.RequiredTrueType fonts (insidetruetype_fonts)This sub-section contains fonts to be loaded from the repo, as a TrueType font file.RuleDescriptionDefaultnameThe name to assign the embedded font. This name is the one that needs to be used when setting the font-family of the microprint.Requiredtruetype_fileThe path to the truetype font file. Includes the name of the file with the extension.RequiredLine rules (insideline_rules)This section contains all the rules for the colors of the microprintRuleDescriptionDefaultincludesIf the row matches any of the rules inside this array, it uses this rule's colors. As long as no excludes match. Can be strings or regex.[]excludesIf the row matches any of the rules inside this array, the rule will not be used.[]text_colorText color the rule will use in case the rule is matched.The default text color defined in the configuration filebackground_colorBackground color the rule will use in case the rule is matched.The default background color defined in the configuration fileExample{
  "scale": 2,
  "vertical_spacing": 1.4,
  "microprint_width": 140,
  "max_microprint_height": 300,
  "number_of_columns": 4,
  "column_gap_size": 0.3,
  "column_gap_color": "red",
  "default_colors": {
    "background_color": "rgb(30, 30, 30)",
    "text_color": "white"
  },
  "line_rules":  [
    {
      "includes": [
        "(?:^|\\W)error(?:$|\\W)(?!code)",
        "panicked",
        "failed",
        "stacktrace"
      ],
      "excludes": [
        "checking",
        "compiling",
        "(?:^|\\W)0(?:$|\\W)",
        "info"
      ],
      "text_color": "red",
      "background_color": "#910404"
    },
    {
      "includes": [
        "installing"
      ],
      "text_color": "white",
      "background_color": "green"
    },
    {
      "includes": [
        "warning"
      ],
      "text_color": "black",
      "background_color": "yellow"
    }
  ],
  "additional_fonts": {
    "google_fonts": [
      {
        "name": "Anton",
        "google_font_url": "https://fonts.googleapis.com/css?family=Anton"
      },
      {
        "name": "Acme",
        "google_font_url": "https://fonts.googleapis.com/css?family=Acme"
      }
    ],
    "truetype_fonts": [
      {
        "name": "NotoSans",
        "truetype_file": "./fonts/NotoSans-Regular.ttf"
      }
    ]
  },
  "font-family": "Acme, Anton, NotoSans, Sans, Cursive"
}