Skip to content

Commit

Permalink
Working IPA Keyboard
Browse files Browse the repository at this point in the history
  • Loading branch information
GiggyMantis committed Oct 28, 2024
1 parent 9230c1c commit 2503895
Show file tree
Hide file tree
Showing 8 changed files with 137 additions and 63 deletions.
78 changes: 50 additions & 28 deletions control.tscn
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
[gd_scene load_steps=7 format=3 uid="uid://b3kp4yvs1tsvk"]
[gd_scene load_steps=8 format=3 uid="uid://b3kp4yvs1tsvk"]

[ext_resource type="Script" path="res://scripts/Main.gd" id="1_77o4d"]
[ext_resource type="Texture2D" uid="uid://dqxenyuy7cq8p" path="res://textures/github-mark-white.svg" id="2_gxdx2"]
[ext_resource type="Script" path="res://scripts/DictionaryContainer.gd" id="3_ba2fa"]
[ext_resource type="Texture2D" uid="uid://dhiglb0caii3k" path="res://textures/email.svg" id="3_t7ds3"]
[ext_resource type="Texture2D" uid="uid://b8nrxeivn87uy" path="res://textures/image.svg" id="4_2l70c"]
[ext_resource type="Script" path="res://scripts/SoundChangeTool.gd" id="5_8aktb"]
[ext_resource type="Script" path="res://scripts/IPAKeyboardTool.gd" id="7_y4eos"]

[node name="Control" type="Control" node_paths=PackedStringArray("open_file_button", "save_file_button", "new_project_button", "translation_settings", "part_of_speech_list")]
layout_mode = 3
Expand All @@ -32,7 +33,7 @@ color = Color(0.121569, 0.121569, 0.121569, 1)
layout_mode = 0
offset_right = 1152.0
offset_bottom = 40.0
current_tab = 4
current_tab = 5

[node name="HOME_MENU" type="Control" parent="TabManager"]
visible = false
Expand Down Expand Up @@ -210,12 +211,44 @@ script = ExtResource("3_ba2fa")
add_button = NodePath("../../DictionaryAdd")
delete_button = NodePath("../../DictionaryRemove")

[node name="GRAMMAR_MODULE" type="Control" parent="TabManager"]
visible = false
layout_mode = 2
metadata/_tab_index = 3

[node name="PartOfSpeechList" type="TextEdit" parent="TabManager/GRAMMAR_MODULE"]
layout_mode = 0
offset_left = 16.0
offset_top = 48.0
offset_right = 368.0
offset_bottom = 538.0
tooltip_text = "ADD_WORD_CLASS"
text = "noun
adjective
adverb
verb
adposition
interjection
conjunction
pronoun
phrase"
placeholder_text = "ADD_WORD_CLASS"

[node name="BriefGrammarOverview" type="TextEdit" parent="TabManager/GRAMMAR_MODULE"]
layout_mode = 0
offset_left = 426.0
offset_top = 48.0
offset_right = 1126.0
offset_bottom = 538.0
tooltip_text = "BRIEF_GRAMMAR_OVERVIEW_TOOLTIP"
placeholder_text = "BRIEF_GRAMMAR_OVERVIEW_TOOLTIP"

[node name="SOUND_CHANGE_TOOL" type="Control" parent="TabManager" node_paths=PackedStringArray("button")]
visible = false
layout_mode = 2
script = ExtResource("5_8aktb")
button = NodePath("Apply")
metadata/_tab_index = 3
metadata/_tab_index = 4

[node name="Categories" type="TextEdit" parent="TabManager/SOUND_CHANGE_TOOL"]
layout_mode = 1
Expand Down Expand Up @@ -280,33 +313,22 @@ offset_bottom = 78.0
button_pressed = true
text = "APPLY_REWRITE_OUTPUT"

[node name="GRAMMAR_MODULE" type="Control" parent="TabManager"]
[node name="IPA_KEYBOARD_TOOL" type="Control" parent="TabManager"]
layout_mode = 2
metadata/_tab_index = 4
script = ExtResource("7_y4eos")
metadata/_tab_index = 5

[node name="PartOfSpeechList" type="TextEdit" parent="TabManager/GRAMMAR_MODULE"]
[node name="Keyboard" type="GridContainer" parent="TabManager/IPA_KEYBOARD_TOOL"]
layout_mode = 0
offset_left = 16.0
offset_top = 48.0
offset_right = 368.0
offset_bottom = 538.0
tooltip_text = "ADD_WORD_CLASS"
text = "noun
adjective
adverb
verb
adposition
interjection
conjunction
pronoun
phrase"
placeholder_text = "ADD_WORD_CLASS"
offset_left = 15.0
offset_top = 200.0
offset_right = 815.0
offset_bottom = 500.0
columns = 20

[node name="BriefGrammarOverview" type="TextEdit" parent="TabManager/GRAMMAR_MODULE"]
[node name="TextEdit" type="TextEdit" parent="TabManager/IPA_KEYBOARD_TOOL"]
layout_mode = 0
offset_left = 426.0
offset_top = 48.0
offset_right = 1126.0
offset_bottom = 538.0
tooltip_text = "BRIEF_GRAMMAR_OVERVIEW_TOOLTIP"
placeholder_text = "BRIEF_GRAMMAR_OVERVIEW_TOOLTIP"
offset_left = 15.0
offset_top = 15.0
offset_right = 815.0
offset_bottom = 180.0
5 changes: 5 additions & 0 deletions ipa_characters.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pbɓtdɗʈɖcɟʄȶȡkɡɠqɢʛʡʔmɱnɳɲȵŋɴʙⱱrɾɽʀɸβfvθðszʃʒʂʐçʝɕʑxɣχʁħʕʜʢhɦʍwɥʋɹɻjɰɬɮꞎlɫɭʎȴʟɺɧʘǀǃǂǁʦʣʧʤʨʥꭧꭦ
iyɨʉɯuɪʏʊeøɘɵɤoəɛœɜɞʌɔɐæɶaɑɒɚɝ
˩˨˧˦˥↓↑↗↘
◌̊◌̈◌̽◌̃◌͊◌͋◌̚◌ᵊ◌͡◌◌ː◌ˑ◌̆◌ʰ◌˭◌ʼ◌ⁿ◌ˡ◌ʷ◌ʲ◌ˤ◌ˠ◌ˀ◌̥◌̬◌̤◌̰◌͓◌̨◌̹◌̜◌̮◌̼◌̪◌̺◌̻◌̟◌̠◌̩◌̯◌͜◌◌̙◌̘◌̞◌̝◌̴◌˞◌̋◌́◌̄◌̀◌̏◌᷈◌᷅◌᷄◌̂◌̌
ˈˌ/[]∅|‖.‿⟨⟩
35 changes: 0 additions & 35 deletions phonology_module_wip.tscn

This file was deleted.

4 changes: 4 additions & 0 deletions project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ project/assembly_name="Glossorola"
version_control/plugin_name="GitPlugin"
version_control/autoload_on_startup=true

[gui]

theme/custom_font="res://textures/NotoSans-Regular.ttf"

[internationalization]

locale/translations=PackedStringArray("res://translation/translation.en.translation", "res://translation/translation.es.translation", "res://translation/translation.pt_BR.translation")
Expand Down
7 changes: 7 additions & 0 deletions scripts/IPAButton.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
extends Button
class_name IPAButton

signal _ipa_key_pressed

func _pressed():
_ipa_key_pressed.emit(text)
37 changes: 37 additions & 0 deletions scripts/IPAKeyboardTool.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
extends Control

const IPA_CHARACTERS_FILE_LOCATION = "res://ipa_characters.txt"

func _ready():
var load_file = FileAccess.open(IPA_CHARACTERS_FILE_LOCATION, FileAccess.READ)
var lines = load_file.get_as_text()

var diacritic = false

for char in lines:
# Ignore whitespace chars
if char.strip_edges(true, true).is_empty():
continue

if char == "◌":
diacritic = true
continue

if diacritic:
diacritic = false
if char == "͡" or char == "͜":
create_button("◌" + char + "◌")
continue
create_button("◌" + char)
else:
create_button(char)


func create_button(c: String):
var b = IPAButton.new()
b.text = c
b._ipa_key_pressed.connect(_button_pressed)
$Keyboard.add_child(b)

func _button_pressed(c: String):
$TextEdit.text += c.replace("◌","")
Binary file added textures/NotoSans-Regular.ttf
Binary file not shown.
34 changes: 34 additions & 0 deletions textures/NotoSans-Regular.ttf.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[remap]

importer="font_data_dynamic"
type="FontFile"
uid="uid://bcp48nqyj4gjt"
path="res://.godot/imported/NotoSans-Regular.ttf-a831e082a52645a3e688e40ab8539031.fontdata"

[deps]

source_file="res://textures/NotoSans-Regular.ttf"
dest_files=["res://.godot/imported/NotoSans-Regular.ttf-a831e082a52645a3e688e40ab8539031.fontdata"]

[params]

Rendering=null
antialiasing=1
generate_mipmaps=false
disable_embedded_bitmaps=true
multichannel_signed_distance_field=false
msdf_pixel_range=8
msdf_size=48
allow_system_fallback=true
force_autohinter=false
hinting=1
subpixel_positioning=1
oversampling=0.0
Fallbacks=null
fallbacks=[]
Compress=null
compress=true
preload=[]
language_support={}
script_support={}
opentype_features={}

0 comments on commit 2503895

Please sign in to comment.