<commit_before>{ stdenv, fetchurl, unzip
, bdftopcf, mkfontscale
}:

stdenv.mkDerivation {
  pname = "dina-font";
  version = "2.92";

  src = fetchurl {
    url = "http://www.donationcoder.com/Software/Jibz/Dina/downloads/Dina.zip";
    sha256 = "1kq86lbxxgik82aywwhawmj80vsbz3hfhdyhicnlv9km7yjvnl8z";
  };

  nativeBuildInputs =
    [ unzip bdftopcf mkfontscale ];

  patchPhase = "sed -i 's/microsoft-cp1252/ISO8859-1/' *.bdf";

  buildPhase = ''
    newName() {
      test "''${1:5:1}" = i && _it=Italic || _it=
      case ''${1:6:3} in
        400) test -z $it && _weight=Medium ;;
        700) _weight=Bold ;;
      esac
      _pt=''${1%.bdf}
      _pt=''${_pt#*-}
      echo "Dina$_weight$_it$_pt"
    }

    # convert bdf fonts to pcf
    for i in *.bdf; do
      bdftopcf -t -o $(newName "$i").pcf "$i"
    done
    gzip -n -9 *.pcf
  '';

  installPhase = ''
    install -D -m 644 -t "$out/share/fonts/misc" *.pcf.gz
    install -D -m 644 -t "$bdf/share/fonts/misc" *.bdf
    mkfontdir "$out/share/fonts/misc"
  '';

  outputs = [ "out" "bdf" ];

  meta = with stdenv.lib; {
    description = "A monospace bitmap font aimed at programmers";
    longDescription = ''
      Dina is a monospace bitmap font, primarily aimed at programmers. It is
      relatively compact to allow a lot of code on screen, while (hopefully)
      clear enough to remain readable even at high resolutions.
    '';
    homepage = https://www.donationcoder.com/Software/Jibz/Dina/;
    downloadPage = https://www.donationcoder.com/Software/Jibz/Dina/;
    license = licenses.free;
    maintainers = [ maintainers.prikhi ];
  };
}<commit_msg>dina: generate otb files with fontforge<commit_after>{ stdenv, fetchurl, unzip
, bdftopcf, mkfontscale, fontforge
}:

stdenv.mkDerivation {
  pname = "dina-font";
  version = "2.92";

  src = fetchurl {
    url = "http://www.donationcoder.com/Software/Jibz/Dina/downloads/Dina.zip";
    sha256 = "1kq86lbxxgik82aywwhawmj80vsbz3hfhdyhicnlv9km7yjvnl8z";
  };

  nativeBuildInputs =
    [ unzip bdftopcf mkfontscale fontforge ];

  patchPhase = "sed -i 's/microsoft-cp1252/ISO8859-1/' *.bdf";

  buildPhase = ''
    newName() {
      test "''${1:5:1}" = i && _it=Italic || _it=
      case ''${1:6:3} in
        400) test -z $it && _weight=Medium ;;
        700) _weight=Bold ;;
      esac
      _pt=''${1%.bdf}
      _pt=''${_pt#*-}
      echo "Dina$_weight$_it$_pt"
    }

    # convert bdf fonts to pcf
    for i in *.bdf; do
      bdftopcf -t -o $(newName "$i").pcf "$i"
    done
    gzip -n -9 *.pcf

    # convert bdf fonts to otb
    for i in *.bdf; do
      fontforge -lang=ff -c "Open(\"$i\"); Generate(\"$(newName $i).otb\")"
    done
  '';

  installPhase = ''
    install -D -m 644 -t "$out/share/fonts/misc" *.pcf.gz
    install -D -m 644 -t "$bdf/share/fonts/misc" *.bdf
    install -D -m 644 -t "$otb/share/fonts/misc" *.otb
    mkfontdir "$out/share/fonts/misc"
    mkfontdir "$bdf/share/fonts/misc"
    mkfontdir "$otb/share/fonts/misc"
  '';

  outputs = [ "out" "bdf" "otb" ];

  meta = with stdenv.lib; {
    description = "A monospace bitmap font aimed at programmers";
    longDescription = ''
      Dina is a monospace bitmap font, primarily aimed at programmers. It is
      relatively compact to allow a lot of code on screen, while (hopefully)
      clear enough to remain readable even at high resolutions.
    '';
    homepage = https://www.donationcoder.com/Software/Jibz/Dina/;
    downloadPage = https://www.donationcoder.com/Software/Jibz/Dina/;
    license = licenses.free;
    maintainers = [ maintainers.prikhi ];
  };
}
{'fraction_non_alphanumeric': 0.1528787031861375, 'fraction_numerical': 0.02655114589155953, 'mean_word_length': 2.6670081967213113, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 6, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4490634', 'n_tokens_mistral': 1484, 'n_tokens_neox': 1360, 'n_words': 320}