Author Topic: Remake of OSX's Dictionary  (Read 8611 times)

Offline OS923

  • Platinum Member (500+ Posts)
  • *****
  • Posts: 517
Remake of OSX's Dictionary
« on: April 17, 2016, 02:26:09 AM »
I can read OSX dictionaries into a REALbasic program. This works fine on Windows, but on OS 9 the weird pronunciation characters are replaced with question marks.

Then I read this:
Quote
Because OS 9 can't draw Unicode directly; we have to convert to the encoding associated with the font you're using. But our code that does this conversion is clever enough to short-cut the process when your string contains only ASCII characters, and you're converting from one ASCII superset to another (e.g., UTF-8 to MacRoman). That's why it's faster when there are no non-ASCII characters in your string.
Do I have to install a special Unicode font and script?


Offline OS923

  • Platinum Member (500+ Posts)
  • *****
  • Posts: 517
Re: Remake of OSX's Dictionary
« Reply #1 on: April 25, 2016, 07:31:34 AM »
I made a test page with all different Unicode characters which are used in the American dictionary.
Then I tried the code2000 font on Windows.
Some characters were missing.

I didn't find such a font for OS 9.

Is it possible to convert OSX fonts to OS 9 fonts?

Offline MacTron

  • Global Moderator
  • Platinum Member (500+ Posts)
  • *****
  • Posts: 2087
  • keep it simple
Re: Remake of OSX's Dictionary
« Reply #2 on: April 25, 2016, 09:23:56 AM »
Is it possible to convert OSX fonts to OS 9 fonts?
If the fonts are in truetype format, then it can work on Mac Os 9. But you'll need a converter, probably.

BTW: Long time ago I had worked in a little project that use unicode text. I have used the WASTE text engine to deal with UTF8 and UTF16 encodings.
ATSUI and WorldScript II can be used also.
« Last Edit: April 25, 2016, 09:36:15 AM by MacTron »
Please don't PM about things that are not private.

Offline OS923

  • Platinum Member (500+ Posts)
  • *****
  • Posts: 517
Re: Remake of OSX's Dictionary
« Reply #3 on: April 28, 2016, 07:13:56 AM »
I'm going to try the Google Noto fonts.

Offline OS923

  • Platinum Member (500+ Posts)
  • *****
  • Posts: 517
Re: Remake of OSX's Dictionary
« Reply #4 on: May 03, 2016, 03:22:16 AM »
REALbasic 5.5.5 has unicode support, but some characters are drawn as 2 characters, like a letter followed by an accent.

I had 2 possible solutions:
  • draw the special characters as pictures.
  • make a temporary HTML file and open it in the browser.
I consider doing them both.

Offline OS923

  • Platinum Member (500+ Posts)
  • *****
  • Posts: 517
Re: Remake of OSX's Dictionary
« Reply #5 on: May 03, 2016, 03:24:50 AM »
I converted the dictionary to a 7-bit ASCII Scheme expression without backslash.
Then I converted it to a binary format that contains the dictionary, thesaurus and index.
It's half the size of the original.

Offline OS923

  • Platinum Member (500+ Posts)
  • *****
  • Posts: 517
Re: Remake of OSX's Dictionary
« Reply #6 on: May 03, 2016, 03:27:30 AM »
The versions for Windows and Linux will be able to draw all characters as text.

Offline MacTron

  • Global Moderator
  • Platinum Member (500+ Posts)
  • *****
  • Posts: 2087
  • keep it simple
Re: Remake of OSX's Dictionary
« Reply #7 on: May 03, 2016, 12:27:59 PM »
REALbasic 5.5.5 has unicode support, but some characters are drawn as 2 characters, like a letter followed by an accent.

but it seems that it can't deal well with UTF-16 (2 bytes per char) ...
Please don't PM about things that are not private.

Offline OS923

  • Platinum Member (500+ Posts)
  • *****
  • Posts: 517
Re: Remake of OSX's Dictionary
« Reply #8 on: June 01, 2016, 03:27:25 AM »
Is there a plugin for REALbasic which can show the Unicode correctly?

Offline OS923

  • Platinum Member (500+ Posts)
  • *****
  • Posts: 517
Re: Remake of OSX's Dictionary
« Reply #9 on: June 07, 2016, 06:03:03 AM »
I fragmalyzed REALbasic 5.5.5.
It doesn't use Text Services while this is necessary for Unicode support.
Thus OSX's Dictionary can't be remade with REALbasic 5.5.5.

Offline OS923

  • Platinum Member (500+ Posts)
  • *****
  • Posts: 517
Re: Remake of OSX's Dictionary
« Reply #10 on: June 15, 2016, 06:08:23 AM »
I remade it with REALbasic 5.5.5.
On OS9 the weird characters are replaced with ? but I don't care.
It's still very useful.
It looks OK on Windows.
Now I'm adding custom style with preferences.

Offline InsectorX

  • Enthusiast Member (25+ Posts)
  • ***
  • Posts: 34
  • new to the forums
Re: Remake of OSX's Dictionary
« Reply #11 on: June 16, 2016, 10:47:26 PM »
Sounds cool, I'd love a copy whenever it's "ready".  even with some question marks, it sounds cool

I'm impressed
Power Macintosh 8600/300
w/ PowerLogix 350Mhz G3 upgrade
Running Mac OS 9.2.2  &  8.6

Offline OS923

  • Platinum Member (500+ Posts)
  • *****
  • Posts: 517
Re: Remake of OSX's Dictionary
« Reply #12 on: June 17, 2016, 10:33:33 AM »
See attachment for preview.

Offline OS923

  • Platinum Member (500+ Posts)
  • *****
  • Posts: 517
Re: Remake of OSX's Dictionary
« Reply #13 on: June 18, 2016, 02:34:52 AM »
There are still problems with the style on Windows.

Offline OS923

  • Platinum Member (500+ Posts)
  • *****
  • Posts: 517
Re: Remake of OSX's Dictionary
« Reply #14 on: June 23, 2016, 05:28:25 AM »

Offline DieHard

  • Administrator
  • Platinum Member (500+ Posts)
  • *****
  • Posts: 1680
Re: Remake of OSX's Dictionary
« Reply #15 on: June 23, 2016, 09:39:33 AM »
That is really nifty to have this available on OS 9.. I will definitely download, thanks for all the effort :)

Offline OS923

  • Platinum Member (500+ Posts)
  • *****
  • Posts: 517
Re: Remake of OSX's Dictionary
« Reply #16 on: January 26, 2019, 01:40:11 AM »
I rewrote this program in C++. See attachment.

Offline MacTron

  • Global Moderator
  • Platinum Member (500+ Posts)
  • *****
  • Posts: 2087
  • keep it simple
Re: Remake of OSX's Dictionary
« Reply #17 on: January 26, 2019, 04:08:46 AM »
Thank you for sharing your work.
But unfortunately I couldn't try it because it closes immediately after open it, not even show a window ...
I have booted with a brand new standar 9.2.2 System folder in a G4 MDD and the result is the same.
Please don't PM about things that are not private.

Offline OS923

  • Platinum Member (500+ Posts)
  • *****
  • Posts: 517
Re: Remake of OSX's Dictionary
« Reply #18 on: January 28, 2019, 03:03:14 AM »
You need to have 300 MB of free memory and I think that it requires that you install the Unicode support (which you didn't because your system is "brand new"). (I never tried it without Unicode support.) If I remember correctly, on the install CD there's an "Extras" folder with a "Unicode" folder. This contains 3 files and if you drag this to the system folder then it installs 4 things, because the script file contains also another thing. You also need to install the "Noto Sans" font (which is included in the download). It doesn't work without the font.

Offline IIO

  • Platinum Member (500+ Posts)
  • *****
  • Posts: 2285
  • new to the forums
Re: Remake of OSX's Dictionary
« Reply #19 on: January 28, 2019, 04:41:57 AM »
sitx :P
"It is true that the "pre-emptive multitasking" advantage present in OS X can be illustrated by downloading CD-ROM ISOs and rendering chaos theory formulas while simultaneously instant messaging and posting on FaceBook what you ate... but in reality, what did you create?"
- DieHard, random forum troll at macos9lives.com

Offline MacTron

  • Global Moderator
  • Platinum Member (500+ Posts)
  • *****
  • Posts: 2087
  • keep it simple
Re: Remake of OSX's Dictionary
« Reply #20 on: January 28, 2019, 08:04:42 AM »
You also need to install the "Noto Sans" font (which is included in the download). It doesn't work without the font.
That's was the issue. Once I have installed "Noto Sans" font the app worked.
Please don't PM about things that are not private.

Offline ELN

  • Gold Member (200+ Posts)
  • *****
  • Posts: 291
  • new to the forums
Re: Remake of OSX's Dictionary
« Reply #21 on: January 28, 2019, 07:56:51 PM »
No chance of bundling the font in the app’s resource fork? This is a very cool tool!

Offline OS923

  • Platinum Member (500+ Posts)
  • *****
  • Posts: 517
Re: Remake of OSX's Dictionary
« Reply #22 on: January 29, 2019, 02:42:02 AM »
If you install the Unicode support then you can type Unicode in the windows.

Unfortunately printing will crash. I tried to print in WorldText and it crashed too. Is there a program/printer combination that doesn't crash when trying to print Unicode?

Offline WillyWonka

  • Valued Member (10+ Posts)
  • **
  • Posts: 22
  • New Member
Re: Remake of OSX's Dictionary
« Reply #23 on: February 01, 2019, 02:54:01 AM »
Does this app accept custom dictionaries?

The reference dictionary in Spanish is the Real Academia de la Lengua, which I use under OS X as it was converted to Dictionary.app format using DictUnifier.

The bundled Spanish dictionary in dictionary.app is well... poor.

Offline OS923

  • Platinum Member (500+ Posts)
  • *****
  • Posts: 517
Re: Remake of OSX's Dictionary
« Reply #24 on: February 01, 2019, 05:22:55 AM »
Does this app accept custom dictionaries?
No, I convert the XML to a binary format that contains Unicode instead of UTF-8.

If you send me a download link for this Real Academia de la Lengua converted to Dictionary.app format then I'll look into it. Does this contain also a thesaurus? The program was written for dictionary + thesaurus combination.

Offline OS923

  • Platinum Member (500+ Posts)
  • *****
  • Posts: 517
Re: Remake of OSX's Dictionary
« Reply #25 on: February 07, 2019, 04:39:21 AM »
I improved the program with error messages.

Offline OS923

  • Platinum Member (500+ Posts)
  • *****
  • Posts: 517
Re: Remake of OSX's Dictionary
« Reply #26 on: February 11, 2019, 04:06:01 AM »
There's a flaw in the multilingual text engine. You have to move the file position to 0 before you call TXNSave if you change the data fork (after Save As). I'll correct this in the next version.

Offline OS923

  • Platinum Member (500+ Posts)
  • *****
  • Posts: 517
Re: Remake of OSX's Dictionary
« Reply #27 on: April 09, 2019, 06:19:56 AM »
I rewrote the Dictionary program. The difficult stuff is part of the OS 9.3 SDK as DictionaryLib. The rest is open source and in English, less than 2000 lines of code. Then you can make dictionary programs for other languages.

Offline OS923

  • Platinum Member (500+ Posts)
  • *****
  • Posts: 517
Re: Remake of OSX's Dictionary
« Reply #28 on: May 29, 2019, 09:42:54 AM »
I reverted to the previous version because this was easier to maintain.

Offline OS923

  • Platinum Member (500+ Posts)
  • *****
  • Posts: 517
Re: Remake of OSX's Dictionary
« Reply #29 on: May 29, 2019, 09:44:06 AM »
See in the attachment the new version. It uses 200 MB of memory instead of 300 MB, it's 20% faster and it can export as HTML.

Offline OS923

  • Platinum Member (500+ Posts)
  • *****
  • Posts: 517
Re: Remake of OSX's Dictionary
« Reply #30 on: June 04, 2019, 06:35:40 AM »
The maximum text length was miscalculated. The explanation for "break", "get", "go" and "run" could not be displayed. But now I have it right with a verification procedure.

Offline OS923

  • Platinum Member (500+ Posts)
  • *****
  • Posts: 517
Re: Remake of OSX's Dictionary
« Reply #31 on: June 06, 2019, 02:21:13 AM »
I removed the code for opening Textension documents because this program isn't meant to be a Unicode editor. I removed the AppleScript support from PowerPlant. I added a Quit handler. I simplified the menus.