DevicesUsing Native Fonts with a Loftware NiceLabel Driver

If you are printing to a device using a Loftware NiceLabel driver, you cannot select a native font from the device in Label Design Label Design . However, you can still use a device's native font by performing the following steps. Note that WYSIWYG in Label Design Label Design does not apply in this case.

  1. Configure the fields on the label template to use the device's native font.
    1. In Label Design Label Design, open the label template.
    2. Select each fixed text, variable text, and/or barcode field, and in the Properties pane, select Native for Send Field As.
    3. For each fixed text, variable text, and/or barcode field, on the Home tab, select the same TrueType font.

      Example

      On the Home tab, select TrueType > Arial for all fields.

    4. Save the label template.
  2. Add a print stream script to map the Loftware-specified font to the native device font.
    1. In Devices Devices, open the device that is using the Loftware NiceLabel driver (Family: Server and Model: Loftware).
    2. On the Advanced tab, select Enabled for Advanced Troubleshooting. The Print Stream Scripting panel is displayed.
    3. In the Print Stream Scripting panel, select the Apply Script check box.
    4. Copy and paste the following into the Script field, replacing FONT NAME IN LOFTWARE and NATIVE FONT NAME ON DEVICE with the appropriate values.

      Important: The fontNameLoftware value must exactly match the name of the font selected in Label Design Label Design, and the fontNameDevice value must exactly match the name of the font on the device.

      Copy
      LOG.info("STARTING FONT REPLACEMENT PSS");

      var stream = PRINTSTREAM.getRawStream();
      var stringStream = new java.lang.String(stream);
      var fontNameSpectrum = "FONT NAME IN LOFTWARE";
      var fontNameDevice = "NATIVE FONT NAME ON DEVICE";

      if(stringStream.indexOf(fontSearchMarker) != -1){
          LOG.info("Editing font name.");
          stringStream = stringStream.replace(fontNameSpectrum, fontNameDevice);
          PRINTSTREAM.setResultStream(stringStream.getBytes());
      }

      LOG.info(stringStream);

      Example

      If you selected Arial for the font in Label Design Label Design, and the native font name on the device is "9 high International", then use the following print stream script.

      Copy
      LOG.info("STARTING FONT REPLACEMENT PSS");

      var stream = PRINTSTREAM.getRawStream();
      var stringStream = new java.lang.String(stream);
      var fontNameSpectrum = "Arial";
      var fontNameDevice = "9 high International";

      if(stringStream.indexOf(fontSearchMarker) != -1){
          LOG.info("Editing font name.");
          stringStream = stringStream.replace(fontNameSpectrum, fontNameDevice);
          PRINTSTREAM.setResultStream(stringStream.getBytes());
      }

      LOG.info(stringStream);
    5. Save the device.