krutidev to unicode convertor - ms word macro

2,752 views
Skip to first unread message

V S Rawat

unread,
Dec 24, 2015, 11:17:12 AM12/24/15
to th
My version of krutidev 010 to Unicode convertor macro has taken a
workable shape.


I am calling it "universal" convertor, because it reads the conversion
table from a file, so whichever conversion table you provide to it, it
will convert that font to unicode.

Currently only krutidev 010 conversion table is ready, which can also be
used for Ankit and other fonts having the same or similar conversion
table as unicode.

soon I will prepare conversion tables for other fonts, and then it will
convert those fonts.

Then I will also add reverse conversion (unicode to other fonts), which
is not just conversion table but actual vba coding will also be required.

Then it will work as universal convertor.
--

Enclosed is the xlsx file which is work file for conversion table
creation. It might be helpful for developers, and is not used by actual
conversion.

Then, there is
Kruti Dev 010_to_Arial Unicode MS.txt
which has the actual conversion table read by the macro while
conversion. it will be required for macro to run, and you need to change
the drive/ folder/ path names to match where you save this file.

when the macro runs, it creates a
Kruti Dev 010_to_Arial Unicode MS_out.txt
file, which will be helpful for debugging if there are any conversion
errors.

And the actual macro is in macro_universal_convertor.txt
You need to copy this macro to a word file's macro in VBA window.

While copying the macro to vba, ENSURE that top definition lines (all
lines above first (sub universal_convertor ) line ) goes to the very top
of your macros, even above all other existing macros in your vba,
otherwise it will not run. Some definitions are not used in this macro,
but they will help you setup and fine tune other macros for your system.

Please try it and give feedback if you are facing any difficulties in
setting it up or running it, or it has any conversion errors.

Feel free to ask any questions and to give any suggestions.

Thanks.
--
Rawat
krdev_font_master.xlsx
Kruti Dev 010_to_Arial Unicode MS.txt
macro_universal_convertor.txt

V S Rawat

unread,
Dec 26, 2015, 3:48:24 AM12/26/15
to th
now, presenting SHREE-DEV-0714E font to Unicode convertor

enclosed file
SHREE-DEV-0714E_to_Arial Unicode MS.txt
has the conversion table

just copy this file to the location where you have set your previously
posted macro to pick files from - to the same folder from where the
macro had read the krutidev conversion table file.

Only one change was required in the macro, that too, to add this new
font's name. So, open the macro, and where you see these lines

'Name of the source properietary font to be converted to target,
must be exactly as displayed in ms word FONT box
'oFontFrom = "Kruti Dev 010"
'oFontFrom = "Ankit"
oFontFrom = "SHREE-DEV-0714E"

just "comment" out the previous font name line, and add this line.
oFontFrom = "SHREE-DEV-0714E"

Please run the macro. it will run without needing any other change in
the coding.

Thanks.
--
Rawat
SHREE-DEV-0714E_to_Arial Unicode MS.txt

V S Rawat

unread,
Dec 26, 2015, 3:49:43 AM12/26/15
to th
That is the beauty of this macro,
that. it doesn't hard code the conversion table in the macro coding. it
reads the conversion table from a file, which anyone can quickly and
easily made in word or excel or text, without needing to know or learn
javascript or vba.

It took me some 2 hours to create this conversion table and then, some
2-3 runs to refine the conversion to the peculiarities of this font.

1. in this font, nuqta is placed BEFORE the character, not after the
character as happened in krutidev.

2. in this font there are $ and > adding dummy spaces of reduced length
so as to fit the character width of क ट ढ ड etc. to other characters,
those needed to be replaced with null, a concept that was not there in
krutidev.

3. in this font, there were mu µ and ‹, two different characters used
for nuqta, whereas there as only one char in krutidev.

etc.

Thanks.
--
Rawat

V S Rawat

unread,
Dec 26, 2015, 5:37:36 AM12/26/15
to th
Please find conversion tables for
Baraha Devanagari_to_Arial Unicode MS.txt
BRH Devanagari_to_Arial Unicode MS.txt

as the char map for BRH Devanagari RN is same as that for BRH
Devanagari, this convertor will work on both the fonts.

Just add these lines to the macro and keep only one font uncommented
that you wish to convert and comment out all other lines.
'oFontFrom = "Kruti Dev 010"
'oFontFrom = "Ankit"
'oFontFrom = "SHREE-DEV-0714E"
'oFontFrom = "Baraha Devanagari"
'oFontFrom = "BRH Devanagari"
oFontFrom = "BRH Devanagari RN"

Baraha Devanagari conversion I have not tried, but it is likely to work,
I had created the conversion table using foxreplace for some client, but
couldn't locate the text to try it out.

If you have any text written in some font, please send the text to me by
private message and I will create the conversion table for that text and
try out on the text and post the table here.

A single macro is converting all these different fonts without needing
any single code change.

Thanks.
--
Rawat
Baraha Devanagari_to_Arial Unicode MS.txt
BRH Devanagari_to_Arial Unicode MS_out.txt

V S Rawat

unread,
Dec 26, 2015, 9:42:30 AM12/26/15
to th
Please find the conversion table for Shusha font to Unicode.

Add this line to the macro.
oFontFrom = "Shusha"

Thanks.
--
Rawat

On 12/24/2015 9:47 PM, V S Rawat wrote:
Shusha_to_Arial Unicode MS.txt

V S Rawat

unread,
Dec 27, 2015, 12:38:09 AM12/27/15
to th
GurbaniHindi and Yogesh_Light - Hindi to unicode conversion tables.

Add these lines to macro code
'oFontFrom = "GurbaniHindi"
oFontFrom = "Yogesh_Light - Hindi"

These are not tested as I couldn't locate text written in these fonts.
So, if any problems occur during conversion, you can tweak the
conversion table and it will be corrected or drop a line to me.

Thanks.
--
Rawat


On 12/24/2015 9:47 PM, V S Rawat wrote:
Yogesh_Light - Hindi_to_Arial Unicode MS.txt
GurbaniHindi_to_Arial Unicode MS.txt

V S Rawat

unread,
Mar 8, 2016, 8:26:33 AM3/8/16
to th
सुयश जी,
इस पूरी थ्रेड को पढ़ लीजिएगा।

इसमें कई भागों में कई कनवर्जन टेबल दी थीं, वो सब चाहिए होंगी।

--
Rawat

On 12/24/2015 9:47 PM, V S Rawat wrote:

V S Rawat

unread,
Mar 8, 2016, 8:42:13 AM3/8/16
to th
सुयश जी,

यह लेटेस्ट मैक्रो है और सारे कनवर्जन टेबल्स इस .7z फ़ाइल में हैं। इन्हें मैक्रो में दिए गए
फ़ोल्डर में डालिएगा, या फिर जिस फ़ोल्डर में डालें उसका नाम मैक्रो में डाल दीजिएगा।

बाकी जानकारी इस पूरी थ्रेड को पढ़ लीजिएगा।
--
Rawat
cnvtable.7z
macro_universal_convertor.txt

Suyash

unread,
Mar 8, 2016, 11:31:53 AM3/8/16
to Scientific and Technical Hindi (वैज्ञानिक तथा तकनीकी हिन्दी)
Rawat जी,

    इस विस्तूत जानकारी के लिए

     आपका बहुत धन्यवाद !

V S Rawat

unread,
Jul 26, 2018, 2:06:01 AM7/26/18
to th
तो अनुनाद जी ने इस समूह में मेरा यह दिसम्बर 2015 का पोस्ट नहीं देखा था।

पहले पोस्ट में सिर्फ़ कृतिदेव-010 का कनवर्जन टेबल था, बाद को 10-12 और
फ़ॉण्ट्स के कनवर्जन टेबल बना कर पोस्ट किए थे।

प्रोग्राम (मैक्रो) में कोई परिवर्तन नहीं था, सिर्फ़ कनवर्जन टेबल को चुनने
के अलावा। एक ही मैक्रो आपकी चुनी गई कनवर्जन टेबल के हिसाब से फॉण्ट को
यूनीकोड में कनवर्ट करता है।

किसी भी नए फ़ॉण्ट के लिए, सिर्फ़ उस फ़ॉण्ट का कनवर्जन टेबल बनाने की ज़रूरत
पड़ती है। हाँ, उस टेबल को प्रोग्राम-मैक्रो में डालने के लिए एक लाइन डालनी
पड़ेगी और पुरानी सिलेक्टेड कनवर्जन टेबल को रिमार्क करना पड़ेगा। इसे
ऑनस्क्रीन इनपुट लेकर या ड्रॉप डाउन टेबल से सिलेक्ट करके कर सकते हैं
लेकिन उतना सब प्रोग्रामिंग कोड मुझे नहीं आता है।

एक ही मैक्रो सभी फ़ॉण्ट को कनवर्ट करता है।

उल्टे कनवर्जन (यूनीकोड से फ़ॉण्ट में) का मैक्रो नहीं बनाया था, किसी ने रुचि नहीं दिखाई।

अगर आप उन दिनों इस ग्रुप की पोस्टें नहीं पढ़ रहे थे, तो मुझे कोई सपना तो
आना नहीं था, कि आप जब ग्रुप में वापस आएँ तो उस बीच हुई सारी चर्चा को
आपको फिर से बताता।

धन्यवाद
रावत

On 12/24/2015 9:47 PM, V S Rawat wrote:

हरिराम

unread,
Jul 27, 2018, 3:14:18 AM7/27/18
to technic...@googlegroups.com
रावत जी,

आपका यह मैक्रो बहुत काम का है। थोड़ा-सा value addition किया जाए तो इससे त्रुटियों/भूलों को सुधारने का काम भी लिया जा सकता है।

कृपया BRH Devanagari_to_Arial Unicode MS_out.txt में

चार कॉलम में दिए गए डैटा के details समझायें 
यथा--
"SlNo","Code","FromChar","ToChar"
0,3,"0","०"
1,3,"1","१"
2,3,"2","२"
168,4,"༅ु༅ु","༅ु"
169,4,"༅ू༅ू","༅ू"

में दूसरे कॉलम में 3, व 4 का क्या प्रयोग है?

सादर।

हरिराम
प्रगत भारत <http://hariraama.blogspot.in>


On Thu, Jul 26, 2018 at 11:36 AM V S Rawat <vsr...@gmail.com> wrote:
...


पहले पोस्ट में सिर्फ़ कृतिदेव-010 का कनवर्जन टेबल था, बाद को 10-12 और
फ़ॉण्ट्स के कनवर्जन टेबल बना कर पोस्ट किए थे।

प्रोग्राम (मैक्रो) में कोई परिवर्तन नहीं था, सिर्फ़ कनवर्जन टेबल को चुनने
के अलावा। एक ही मैक्रो आपकी चुनी गई कनवर्जन टेबल के हिसाब से फॉण्ट को
यूनीकोड में कनवर्ट करता है।

किसी भी नए फ़ॉण्ट के लिए, सिर्फ़ उस फ़ॉण्ट का कनवर्जन टेबल बनाने की ज़रूरत
पड़ती है। हाँ, उस टेबल को प्रोग्राम-मैक्रो में डालने के लिए एक लाइन डालनी
पड़ेगी और पुरानी सिलेक्टेड कनवर्जन टेबल को रिमार्क करना पड़ेगा। इसे
ऑनस्क्रीन इनपुट लेकर या ड्रॉप डाउन टेबल से सिलेक्ट करके कर सकते हैं
लेकिन उतना सब प्रोग्रामिंग कोड मुझे नहीं आता है।

एक ही मैक्रो सभी फ़ॉण्ट को कनवर्ट करता है।

उल्टे कनवर्जन (यूनीकोड से फ़ॉण्ट में) का मैक्रो नहीं बनाया था, किसी ने रुचि नहीं दिखाई।

....

V S Rawat

unread,
Jul 27, 2018, 4:19:13 AM7/27/18
to technic...@googlegroups.com
पहले कॉलम का नम्बर सॉर्टिंग ऑडर बताता है।

अगर उसी क्रम में कनवर्ट नहीं किया जाए, तो उलट पुलट हो जाएगा।

जैसे अगर कृतिदेव में "नुक़्ता क" आ रहा है तो उसे "क़" (नुक्ते वाला क़) करना होता है
लेकिन उस कनवर्जन से पहले "नुक्ते" और "क" को कृतिदेव से यूनीकोड में बदलना
पड़ेगा, उसके बाद ही " ़ क" को "क़" को बदलने से सही अर्थ आएगा।

इसी तरह से कृतिदेव में ही ये कनवर्जन होते हैं
1 b± ईं
1 bZ ई
अगर ये दोनों अक्षर कृतिदेव में एकसाथ आ रहे हैं तो उनका यही एक मतलब हो
सकता है, तो उसे 1 पर सबसे ऊपर रख कर कनवर्ट करके नत्थी कर लिया है।

अगर इस पहले कॉलम में 0 है, तो उस लाइन की पढ़ी गई एण्ट्री इग्नोर कर दिया
जाता है। कोई कनवर्जन नहीं होता है।

अगर 1 से 4 तक है तो इनपुट स्ट्रिंग को आउटपुट स्ट्रिंग में कनवर्जन कर दिया जाता है

अगर 9 है तो इनपुट स्ट्रिंग को ही आउटपुट में कॉपी कर लिया जाता है, कनवर्जन नहीं होता है
- यह अंकों जैसे 0-9 या अंग्रेज़ी के पंक्च्यूएशन के लिए है जिनका
प्रोपराइटरी फ़ॉण्ट का एस्काई कोड और यूनीकोड का कोड एक ही होता है
- यह फ़ॉण्ट के ऐसे वर्णों के लिए है जो मुझे समझ नहीं आए, या जिनका यूनीकोड
में कोई कनवर्जन नहीं है, तो इन्हें वैसे का वैसा आउटपुट में ले लिया जाता है।

संलग्न एक excel फ़ाइल है, जिसमें सभी फ़ॉण्ट का एस्काई कोड और यूनीकोड अक्षर
दिया हुआ है। इसी फ़ाइल से ये कनवर्जन टेबल्स बनाई जाती हैं,
इसमें आप उस कोड को इसके अर्थ में सामने देख कर उसका मतलब आसानी से निकाल पाएँगे।

अब, अगर किसी नई फ़ॉण्ट का कनवर्जन टेबल बनाना है, तो
1. पहले वाली किसी भी फ़ॉण्ट के कॉलम्स (sl code from to len_fr ascii Kruti
Dev 010) को आख़िरी कॉलम्स में कॉपी कर लीजिए।

2. उन नए कॉपी किए कॉलम्स में "Kruti Dev 010" नाम को बदल कर उस नई फ़ॉण्ट
के नाम पर "NEWFONT" कर दीजिए ताकि याद रहे।

3. अब "NEWFONT" column की भरी सेल्स को सिलेक्ट करके, उसके फ़ॉण्ट को वो नई
फ़ॉण्ट कर दीजिए। इससे उस कॉलम के अक्षर उस नई फ़ॉण्ट में दिखने लगेंगे।

5. उस "NEWFONT" कॉलम में दिख रहे अक्षरों का एस्काई कोड पहले से "from"
column में दिख रहा है।

6. अब उस फ़ॉण्ट के कॉलम में दिख रहे अक्षरों को देखते हुए, "to" कॉलम में
यूनीकोड के अक्षर टाइप कर दीजिए।

7. जिसे पहले कनवर्ट करना ज़रूरी है, उसे तदनुसार 1-2-3-4 कोड दे दीजिए, जिस
लाइन को रखना तो है पर इग्नोर करना है, उसमें 0 कोड दे दीजिए, जिस अक्षर को
एस्काई से यूनीकोड में जस-का-तस ले जाना है, उसे 9 कोड दे दीजिए।

8. जब पूरा हो जाए, तो सिर्फ़ "code from to" किसी यूनीकोड कम्पेटिबल प्लेन
टेक्स्ट फ़ाइल में जैसे-का-तैसा कॉपी कर लीजिए।

9. मैक्रों में इस टेक्स्ट फ़ाइल का नाम एक नई लाइन पर दे दीजिए, पुरानी
एक्टिव फ़ॉण्ट वाली लाइन को कमेण्ट कर दीजिए।

बस।

जो भी पूछना हो पूछिएगा।

धन्यवाद
रावत

> --
> आपको यह संदश इसलिए मिला है क्योंकि आपने Google समूह के "Scientific and
> Technical Hindi (वैज्ञानिक तथा तकनीकी हिन्दी)" समूह की सदस्यता ली है.
> इस समूह की सदस्यता समाप्त करने और इससे ईमेल प्राप्त करना बंद करने के लिए,
> technical-hin...@googlegroups.com
> <mailto:technical-hin...@googlegroups.com> को ईमेल भेजें.
> अधिक विकल्पों के लिए, https://groups.google.com/d/optout में जाएं.
_macro_font_master_only_vba.xlsx
Reply all
Reply to author
Forward
0 new messages