Friday, February 13, 2015

Privacy Policy – AntiTranslit iOS Keyboard Extension


Privacy Policy – AntiTranslit iOS Keyboard Extension


This is the privacy policy for AntiTranslit Keyboard Extension. It outlines what information is gathered by your device, and how that information may be used. We take your privacy very seriously; we strive to not collect sensitive information without your explicit consent, and to treat any data that you permit us to collect securely and confidentially.

Data stored on your device

The Armenian keyboard extension operates without storing any personal data on your device.

Data transmitted

The Armenian keyboard extension for iOS8 operating system does not include connectivity with any service, therefore no data transmission takes place.

Data sharing with third parties

Armenian keyboard extension  does not share any data to third parties.
This policy was last updated on Feb14, 2015.

Tuesday, September 23, 2014

Privacy Policy – Armenian Keyboard Extension


Privacy Policy – Armenian Keyboard Extension


This is the privacy policy for Armenian Keyboard Extension. It outlines what information is gathered by your device, and how that information may be used. We take your privacy very seriously; we strive to not collect sensitive information without your explicit consent, and to treat any data that you permit us to collect securely and confidentially.

Data stored on your device

The Armenian keyboard extension operates without storing any personal data on your device.

Data transmitted

The Armenian keyboard extension for iOS8 operating system does not include connectivity with any service, therefore no data transmission takes place.

Data sharing with third parties

Armenian keyboard extension  does not share any data to third parties.
This policy was last updated on Sep 23, 2014.

Thursday, October 17, 2013

Changing the default Armenian system font in Mac OS

The default Armenian font in Mac OS operation system family is Mshtakan font.

Mshtakan font example
The font is totally not readable, painful for eyes, too small characters.

There is a very nice free font called DejaVu http://dejavu-fonts.org/wiki/Main_Page. Which provides way more readable fonts.
So let start changing the default Armenian system font.

  1. Download Armenian fonts from here
  2. Install all DejaVuSerif fonts by double clicking on them or selecting the files and command + "array down"
  3. Then go to following folder in Mac OS
    cd /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/CoreText.framework/Versions/A/Resources
  4. Backup DefaultFontFallbacks.plist file.
  5. Copy DefaultFontFallbacks.plist to Desktop and modify with Xcode, TextEdit or Vim (whatever editor you use)
  6. Replace Mshtakan word everywhere with desired font name. NOTE : The font name should not contain the spaces e.g. in my case is was DejaVuSerif.

Enjoy the better Armenian default system font which looks like this.
DejaVu Serif example


P.S. For those who are using the Firefox browser for internet surfing, changing the system default font will not affect display font in firefox as firefox has its own settings which should be modified like here
Changing the default Armenian font in firefox
 


 
 



Friday, June 22, 2012

Armenia Time issue on Mac OS X 10.6.8 Snow Leopard

Introduction

As you know government of Armenia announced a decision on 1/2012 that Armenia will remain permanently on "Winter Timer". As a consequence time on Mac OS X 10.6.8 and many other operating systems like Windows, GNU Linux (Ubuntu) the time was shown incorrectly i.e. it was behind of the actual time.

My bug to Apple filed on 22-May-2012


Summary: System time is an hour ahead of the actual time.
Steps to Reproduce: Set the time to updated automatically with the time zone of Yerevan, Armenia

Expected Results: It should be like here http://www.worldtimeserver.com/current_time_in_AM.aspx

Actual Results: The system time is an hour ahead
 

Apple responses to my bug on 22-Jun-2012

Hi Levon,

This is a follow-up regarding Bug ID# 11507120.   

Please update your report directly at http://bugreport.apple.com for the fastest response.  Please do not email your updates.

Engineering has provided the following information:

We believe this issue has been resolved in OS X 10.7.4.  Please verify this issue with OS X Lion 10.7.4 and update this report with your results.  

Note that the configuration summary indicates the problem was reported against 10.6.8, in which case the one hour discrepancy would be expected on 10.6.8 since that release predates the Armenian government's recent  announcement (1/2012) that the country will remain permanently on "winter time". Thus in the summer months 10.6.8 systems in Armenia will always be 1 hour ahead of actual time.

This issue is resolved in recent releases of OS X that incorporate more recent changes in Time Zone Data. The latest update of OS X Lion contains a Time Zone Data update that observes the new Time Zone schedule in Armenia (i.e. permanent adoption of Winter Time with no further Daylight Savings Time changes ).

OS X 10.7.4
Posted Date:  May 9, 2012

Bug reports requiring your attention will appear under ‘My Originated Problems’.  Please review this bug report and provide the requested information via the Apple Bug Reporter at http://bugreport.apple.com.  Once your report has been updated, Engineering will be alerted of the new information.

Thank you for your assistance in helping us discover and isolate bugs within our products. 

Best Regards,

Developer Bug Reporting Team 
Apple Worldwide Developer Relations

Conclusion

I'm happy to inform that the issue is solved for Mac OS X Lion but still exists on running Snow Leopard hosts. I understand that the version 10.6.8 is prior to Armenia's government decision, but still there are lots of people using Snow Leopard on their Macs, and this issue need to be fixed for them, i.e. if Apple doesn't have any mechanism to fix this kind of situation for 10.6.8 system users, this will be really "pity". Anyway I and many other people will hope that this issue will be fixed in 10.6.9 update of Snow Leopard system if it ever happen.

Thursday, May 24, 2012

Quartz : Getting the diff image of two images

Suppose there are following two images the background may be totally different image, e.g. not just plain color.

Image number one
Image number two











So basically I want to get the diff image of these two images i.e.

Diffed image
The diff image of two images is the image with the same size but the pixels are set to be transparent that haven't been changed. The difference image is constructed from the diff pixels with the color from the second image

Using difference blending mode Actually if we use the difference blending mode it doesn't solve the problem as it doesn't keep right colors of the pixels. If we apply difference blend mode to above 2 images we'll get following

Difference blended image








Which seems to have inverted color but, so after inverted the colors we will get  

Inverted diff blended image
So basically this method doesn't solve the issue, so what we need is to use mask the second image where there are differences. Please find below the Objective-C code implementation of the initially setup problem.


Download link




Solution implementation with Objective-C, tested on iPhone/iPad
- (CGContextRef)createCGContextFromCGImage:(CGImageRef)img
{
    size_t width = CGImageGetWidth(img);
    size_t height = CGImageGetHeight(img);
    size_t bitsPerComponent = CGImageGetBitsPerComponent(img);
    size_t bytesPerRow = CGImageGetBytesPerRow(img);
    
    CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceGray(); //CGColorSpaceCreateDeviceRGB();
    CGContextRef ctx = CGBitmapContextCreate(NULL, // Let CG allocate it for us
                                             width,
                                             height,
                                             bitsPerComponent,
                                             bytesPerRow,
                                             colorSpace,
                                             kCGImageAlphaNone); // RGBA
    CGColorSpaceRelease(colorSpace);
    NSAssert(ctx, @"CGContext creation fail");
    return ctx;
}

- (UIImage*) computeDifferenceOfImage:(CGImageRef)oldImage withImage:(CGImageRef)newImage
{
    // Return the old image if the newImage is nil
    if (newImage == nil) {
        return [UIImage imageWithCGImage:oldImage];
    }
    
    // We assume both images are the same size, but it's just a matter of finding the biggest
    // CGRect that contains both image sizes and create the CGContext with that size
    CGRect imageRect = CGRectMake(0, 0,
                                  CGImageGetWidth(oldImage),
                                  CGImageGetHeight(oldImage));
    // Create our context based on the old image
    CGContextRef ctx = [self createCGContextFromCGImage:oldImage];
    
    // Draw the old image with the default (normal) blendmode 
    CGContextDrawImage(ctx, imageRect, oldImage);
    // Change the blendmode for the remaining drawing operations
    CGContextSetBlendMode(ctx, kCGBlendModeDifference);
    // Draw the new image "on top" of the old one
    CGContextDrawImage(ctx, imageRect, newImage);
    // Grab the composed CGImage
    CGImageRef diffed = CGBitmapContextCreateImage(ctx);

    // Make the gray color based image black and white based
    const CGFloat myMaskingColors[6] = { 1, 255, 1, 255, 1, 255 };
    // Get the masked image consisting of black and transparent pixels
    CGImageRef myColorMaskedImage = CGImageCreateWithMaskingColors(diffed, myMaskingColors);
    // Clean the context
    CGContextClearRect(ctx, imageRect);
    // Fill the context with white color 
    CGContextSetFillColorWithColor(ctx, [[UIColor whiteColor] CGColor]);
    CGContextFillRect(ctx, imageRect);
    CGContextDrawImage(ctx, imageRect, myColorMaskedImage);
    
    // Memory cleanup 
    CGImageRelease(diffed);
    CGImageRelease(myColorMaskedImage);
    // Grab the composed CGImage
    diffed = CGBitmapContextCreateImage(ctx);
    // Close the context 
    CGContextRelease(ctx);
    
    // Apply the constructed diff mask to newImage
    CGImageRef mask = CGImageMaskCreate(CGImageGetWidth(diffed),
                                        CGImageGetHeight(diffed), 
                                        CGImageGetBitsPerComponent(diffed),
                                        CGImageGetBitsPerPixel(diffed),
                                        CGImageGetBytesPerRow(diffed),
                                        CGImageGetDataProvider(diffed), NULL, false);
    CGImageRef masked = CGImageCreateWithMask(newImage, mask);
    UIImage *finalDiffedImage = [UIImage imageWithCGImage:masked];

    CGImageRelease(mask);
    CGImageRelease(masked);
    CGImageRelease(diffed);
    
    return finalDiffedImage;
}

Tuesday, September 6, 2011

GNU Gettext library

gettext is a l10n and i18n library

1. The texts inside source code should be wrapped by gettext function

So the text "My Name is..." becomes _("My Name is...")

2. Then xgettext runs on source code to generate .pot file, which contains the a list of all translatable strings. Translator edits .po files.

msginit --locale=fr --input=name.pot 

3. The .po files are compile into binary .mo file with msgfmt


4. The user, on Unix-type systems, sets the enviroment variable LC_MESSAGES, and the program will display strings in the selected language, if there is an .mo file for it.Then using msginit program translator derives .po file for example for french it will be

Wednesday, March 30, 2011

PDF docs with Mixed Rasted Content

Mixed Rasted Content is the way of keeping images in PDF docs. With couple of words the background image or generally the images in PDF docs are kept in pieces (in segments) for improving the contrast resolution of a raster image composed of pixels. More info on MRC can be found here

Now the problem is that lots of PDF viewers including Okular, Evince, and lots of others are showing the PDF docs with complete noisy background image, i.e. the background image of the docs is just random composition of some colors. Even in Ubuntu distribution the thumbnails are shown in that way.

This is especially problematic when viewing scanned documents in MRC PDFs. Even the converted tools like swftool could not solve the problem, so the only reasonable way is to create PDFs without MRC enabled options. In ABBYY Finereader that can be achieved easily from the saving options.

Another options of doing this is using pdf2pdf converter below which will convert PDFs with MRC to ordinary ones.

The code pdf2pdf converter is:


#!/bin/sh
#
# Convert a PDF to another PDF. This effectively strips
# out a lot of stuff from most PDF files.

gs=`which gs 2>/dev/null`
if [ ! -x "$gs" ]; then
    echo "Error: install ghostscript first" >&2
    exit 1
fi

OPTS=""
pdfver="1.2"
while true; do
    case "$1" in
    --pdf-version)
        shift
        pdfver="$1"
        ;;
    -?*) OPTS="$OPTS $1";;
    *) break;;
    esac
    shift
done

if [ $# -eq 2 ]; then
    outfile="$2"
elif [ $# -eq 1 ]; then
    outfile="`basename \"$1\" .pdf`.new.pdf"
else
    cat <&2
Usage: pdf2pdf [--pdf-version (1.2|1.3|1.4)] [gs-options ...]  [output.pdf|-]

Converts a PDF from whatever PDF specification version it currently
exists as to the one specified by \`--pdf-version'. Default: 1.2

One side-effect of this conversion is the resulting document will have
the no-printing and no-copying flags removed in the output document if
they are set in the input document.
EOF
    exit 1
fi

exec "$gs" $OPTIONS -q -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pdfwrite \
    -dCompatibilityLevel="$pdfver" -sOutputFile="$outfile" -f "$1"