Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions pinc/Project.inc
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ class Project
{
use CharSuiteSet;

public const int MAX_CUSTOM_CODEPOINTS = 32;

private ?string $_create_source = null;
public string $nameofwork;
public ?string $state;
Expand Down Expand Up @@ -475,9 +477,12 @@ class Project
$errors[] = _("The set of custom characters must be unique.");
}

// only allow 32 characters
if (count($codepoints) > 32) {
$errors[] = _("A maximum of 32 custom characters are allowed.");
// Restrict the number of custom codepoints
if (count($codepoints) > MAX_CUSTOM_CODEPOINTS) {
$errors[] = sprintf(
_("A maximum of %d custom characters are allowed."),
MAX_CUSTOM_CODEPOINTS
);
}

// prevent disallowed characters from being added
Expand Down
9 changes: 8 additions & 1 deletion tools/project_manager/editproject.php
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,14 @@ public function show_visible_controls(): void
$project_charsuites = $this->project->get_charsuites(false);
}
$this->row(_("Character Suites"), format_charsuite_list($this->charsuites, $project_charsuites));
$this->row(_("Custom Characters"), format_text_field($this->project->custom_chars, 'custom_chars'));
$this->row(
_("Custom Characters"),
format_text_field(
$this->project->custom_chars,
'custom_chars',
maxlength: Project::MAX_CUSTOM_CODEPOINTS
)
);

$this->row(_("Genre"), format_genre_list($this->project->genre));

Expand Down