<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">#!/usr/bin/perl
# -*- coding: utf-8; -*-
# Copyright (C) 2008 Vladimir Volovich.
# You may freely use, modify and/or distribute this file.
#
# Generate additional patterns (for some language), to be used in case
# there is an alternative hyphen character available.
#
# It enables the hyphenation of words containing explicit hyphens
# when using fonts with \hyphenchar\font &lt;&gt; `\- (e.g. T1 or T2A encoding).
#
# sample usage: perl make-exhyph.pl ru &gt; exhyph-ru.tex

use strict;
use utf8;
binmode(STDOUT, ":utf8");

my %alphabet = (
  'ru' =&gt; [ qw( Ð° Ð± Ð² Ð³ Ð´ Ðµ Ñ‘ Ð¶ Ð· Ð¸ Ð¹ Ðº Ð» Ð¼ Ð½ Ð¾ Ð¿ Ñ€ Ñ Ñ‚ Ñƒ Ñ„ Ñ… Ñ† Ñ‡ Ñˆ Ñ‰ ÑŠ Ñ‹ ÑŒ Ñ ÑŽ Ñ ) ],
  'uk' =&gt; [ qw( Ð° Ð± Ð² Ð³ Ò‘ Ð´ Ðµ Ñ” Ð¶ Ð· Ð¸ Ñ– Ñ— Ð¹ Ðº Ð» Ð¼ Ð½ Ð¾ Ð¿ Ñ€ Ñ Ñ‚ Ñƒ Ñ„ Ñ… Ñ† Ñ‡ Ñˆ Ñ‰ ÑŒ ÑŽ Ñ ' ) ]
);

my $lang = $ARGV[0];
die "unspecified lang" if ! defined $lang;
die "invalid lang" if ! exists $alphabet{$lang};

my @alphabet = @{$alphabet{$lang}};

print &lt;&lt;\EOF;
\begingroup
\lccode45=45 % Make hyphen "-" a word constituent
\patterns{
8-7
--8
EOF

for my $l (@alphabet) {
  print ".${l}-8\n";
}

for my $l1 (@alphabet) {
  for my $l2 (@alphabet) {
    print "-${l1}8${l2}8\n8${l1}8${l2}-\n";
  }
}

print &lt;&lt;\EOF;
}
\endgroup
EOF
</pre></body></html>