1# Steps to regenerate background text images under res-*dpi/images/
2
31.  Build the recovery_l10n app:
4
5    cd bootable/recovery && mma -j32
6
72.  Install the app on the device (or emulator) with the intended dpi.
8
9    *   For example, we can use Nexus 5 to generate the text images under
10        res-xxhdpi.
11    *   We can set up the maximum width of the final png image in res/layout/main.xml
12        Currently, the image width is 1200px for xxxhdpi, 900px for xxhdpi and
13        480px for xhdpi/hdpi/mdpi.
14    *   When using the emulator, make sure the NDK version matches the current
15        repository. Otherwise, the app may not work properly.
16
17    adb install $PATH_TO_APP
18
193.  Run the app, select the string to translate and press the 'go' button.
20
214.  After the app goes through the strings for all locales, pull the output png
22    file from the device.
23
24    adb root && adb pull /data/data/com.android.recovery_l10n/files/text-out.png
25
265.  Compress the output file put it under the corresponding directory.
27
28    *   "pngcrush -c 0 ..." converts "text-out.png" into a 1-channel image,
29        which is accepted by Recovery. This also compresses the image file by
30        ~60%.
31    *   zopflipng could further compress the png files by ~10%, more details
32        in https://github.com/google/zopfli/blob/master/README.zopflipng
33    *   If you're using other png compression tools, make sure the final text
34        image works by running graphic tests under the recovery mode.
35
36    pngcrush -c 0 text-out.png $OUTPUT_PNG
37