diff --git a/.gitignore b/.gitignore index 72cc5bc11a2..ef17e135348 100644 --- a/.gitignore +++ b/.gitignore @@ -20,6 +20,7 @@ tools/editor/doc_data_compressed.h tools/editor/certs_compressed.h tools/editor/editor_icons.cpp tools/editor/translations.h +tools/editor/builtin_fonts.h -fpic .fscache make.bat diff --git a/core/hq2x.cpp b/core/hq2x.cpp new file mode 100644 index 00000000000..6495c77b2ae --- /dev/null +++ b/core/hq2x.cpp @@ -0,0 +1,2636 @@ +/* + * Copyright 2016 Bruno Ribeiro + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#include "hq2x.h" +#include "math_funcs.h" + + +static const uint32_t AMASK = 0xFF000000; +static const uint32_t YMASK = 0x00FF0000; +static const uint32_t UMASK = 0x0000FF00; +static const uint32_t VMASK = 0x000000FF; + +_FORCE_INLINE_ static uint32_t ARGBtoAYUV( + uint32_t value ) +{ + uint32_t A, R, G, B, Y, U, V; +//todo big endian check + A = value >> 24; + R = (value >> 16) & 0xFF; + G = (value >> 8) & 0xFF; + B = value & 0xFF; + + Y = Math::fast_ftoi( 0.299 * R + 0.587 * G + 0.114 * B); + U = Math::fast_ftoi(-0.169 * R - 0.331 * G + 0.5 * B) + 128; + V = Math::fast_ftoi( 0.5 * R - 0.419 * G - 0.081 * B) + 128; + return (A << 24) + (Y << 16) + (U << 8) + V; +} + + +/* + * Use this function for sharper images (good for cartoon style, used by DOSBOX) + */ + +_FORCE_INLINE_ static bool isDifferent( + uint32_t color1, + uint32_t color2, + uint32_t trY, + uint32_t trU, + uint32_t trV, + uint32_t trA ) +{ + color1 = ARGBtoAYUV(color1); + color2 = ARGBtoAYUV(color2); + + uint32_t value; + + value = ((color1 & YMASK) - (color2 & YMASK)); + value = (value ^ (value >> 31)) - (value >> 31); + if (value > trY) return true; + + value = ((color1 & UMASK) - (color2 & UMASK)); + value = (value ^ (value >> 31)) - (value >> 31); + if (value > trU) return true; + + value = ((color1 & VMASK) - (color2 & VMASK)); + value = (value ^ (value >> 31)) - (value >> 31); + if (value > trV) return true; + + value = ((color1 & AMASK) - (color2 & AMASK)); + value = (value ^ (value >> 31)) - (value >> 31); + if (value > trA) return true; + + return false; + +} + + + +#define MASK_RB 0x00FF00FF +#define MASK_G 0x0000FF00 +#define MASK_A 0xFF000000 + + +/** + * @brief Mixes two colors using the given weights. + */ +#define HQX_MIX_2(C0,C1,W0,W1) \ + ((((C0 & MASK_RB) * W0 + (C1 & MASK_RB) * W1) / (W0 + W1)) & MASK_RB) | \ + ((((C0 & MASK_G) * W0 + (C1 & MASK_G) * W1) / (W0 + W1)) & MASK_G) | \ + (((((C0 & MASK_A) >> 8) * W0 + ((C1 & MASK_A) >> 8) * W1) / (W0 + W1)) << 8) & MASK_A + +/** + * @brief Mixes three colors using the given weights. + */ +#define HQX_MIX_3(C0,C1,C2,W0,W1,W2) \ + ((((C0 & MASK_RB) * W0 + (C1 & MASK_RB) * W1 + (C2 & MASK_RB) * W2) / (W0 + W1 + W2)) & MASK_RB) | \ + ((((C0 & MASK_G) * W0 + (C1 & MASK_G) * W1 + (C2 & MASK_G) * W2) / (W0 + W1 + W2)) & MASK_G) | \ + (((((C0 & MASK_A) >> 8) * W0 + ((C1 & MASK_A) >> 8) * W1 + ((C2 & MASK_A) >> 8) * W2) / (W0 + W1 + W2)) << 8) & MASK_A + + +#define MIX_00_4 *output = w[4]; +#define MIX_00_MIX_00_4_0_3_1 *output = HQX_MIX_2(w[4],w[0],3U,1U); +#define MIX_00_4_3_3_1 *output = HQX_MIX_2(w[4],w[3],3U,1U); +#define MIX_00_4_1_3_1 *output = HQX_MIX_2(w[4],w[1],3U,1U); +#define MIX_00_3_1_1_1 *output = HQX_MIX_2(w[3],w[1],1U,1U); +#define MIX_00_4_3_1_2_1_1 *output = HQX_MIX_3(w[4],w[3],w[1],2U,1U,1U); +#define MIX_00_4_3_1_2_7_7 *output = HQX_MIX_3(w[4],w[3],w[1],2U,7U,7U); +#define MIX_00_4_0_1_2_1_1 *output = HQX_MIX_3(w[4],w[0],w[1],2U,1U,1U); +#define MIX_00_4_0_3_2_1_1 *output = HQX_MIX_3(w[4],w[0],w[3],2U,1U,1U); +#define MIX_00_4_1_3_5_2_1 *output = HQX_MIX_3(w[4],w[1],w[3],5U,2U,1U); +#define MIX_00_4_3_1_5_2_1 *output = HQX_MIX_3(w[4],w[3],w[1],5U,2U,1U); +#define MIX_00_4_3_1_6_1_1 *output = HQX_MIX_3(w[4],w[3],w[1],6U,1U,1U); +#define MIX_00_4_3_1_2_3_3 *output = HQX_MIX_3(w[4],w[3],w[1],2U,3U,3U); +#define MIX_00_MIX_00_4_0_3_10 *output = HQX_MIX_3(w[4],w[3],w[1],14U,1U,1U); + +#define MIX_01_4 *(output + 1) = w[4]; +#define MIX_01_4_2_3_1 *(output + 1) = HQX_MIX_2(w[4],w[2],3U,1U); +#define MIX_01_4_1_3_1 *(output + 1) = HQX_MIX_2(w[4],w[1],3U,1U); +#define MIX_01_1_4_3_1 *(output + 1) = HQX_MIX_2(w[1],w[4],3U,1U); +#define MIX_01_4_5_3_1 *(output + 1) = HQX_MIX_2(w[4],w[5],3U,1U); +#define MIX_01_4_1_7_1 *(output + 1) = HQX_MIX_2(w[4],w[1],7U,1U); +#define MIX_01_4_1_5_2_1_1 *(output + 1) = HQX_MIX_3(w[4],w[1],w[5],2U,1U,1U); +#define MIX_01_4_2_5_2_1_1 *(output + 1) = HQX_MIX_3(w[4],w[2],w[5],2U,1U,1U); +#define MIX_01_4_2_1_2_1_1 *(output + 1) = HQX_MIX_3(w[4],w[2],w[1],2U,1U,1U); +#define MIX_01_4_5_1_5_2_1 *(output + 1) = HQX_MIX_3(w[4],w[5],w[1],5U,2U,1U); +#define MIX_01_4_1_5_5_2_1 *(output + 1) = HQX_MIX_3(w[4],w[1],w[5],5U,2U,1U); +#define MIX_01_4_1_5_6_1_1 *(output + 1) = HQX_MIX_3(w[4],w[1],w[5],6U,1U,1U); +#define MIX_01_4_1_5_2_3_3 *(output + 1) = HQX_MIX_3(w[4],w[1],w[5],2U,3U,3U); +#define MIX_01_4_2_3_10 *(output + 1) = HQX_MIX_3(w[4],w[1],w[5],14U,1U,1U); + +#define MIX_02_4 *(output + 2) = w[4]; +#define MIX_02_4_2_3_1 *(output + 2) = HQX_MIX_2(w[4],w[2],3U,1U); +#define MIX_02_4_1_3_1 *(output + 2) = HQX_MIX_2(w[4],w[1],3U,1U); +#define MIX_02_4_5_3_1 *(output + 2) = HQX_MIX_2(w[4],w[5],3U,1U); +#define MIX_02_4_1_5_2_1_1 *(output + 2) = HQX_MIX_3(w[4],w[1],w[5],2U,1U,1U); +#define MIX_02_4_1_5_2_7_7 *(output + 2) = HQX_MIX_3(w[4],w[1],w[5],2U,7U,7U); +#define MIX_02_1_5_1_1 *(output + 2) = HQX_MIX_2(w[1],w[5],1U,1U); + +#define MIX_10_4 *(output + lineSize) = w[4]; +#define MIX_10_4_6_3_1 *(output + lineSize) = HQX_MIX_2(w[4],w[6],3U,1U); +#define MIX_10_4_7_3_1 *(output + lineSize) = HQX_MIX_2(w[4],w[7],3U,1U); +#define MIX_10_4_3_3_1 *(output + lineSize) = HQX_MIX_2(w[4],w[3],3U,1U); +#define MIX_10_4_7_3_2_1_1 *(output + lineSize) = HQX_MIX_3(w[4],w[7],w[3],2U,1U,1U); +#define MIX_10_4_6_3_2_1_1 *(output + lineSize) = HQX_MIX_3(w[4],w[6],w[3],2U,1U,1U); +#define MIX_10_4_6_7_2_1_1 *(output + lineSize) = HQX_MIX_3(w[4],w[6],w[7],2U,1U,1U); +#define MIX_10_4_3_7_5_2_1 *(output + lineSize) = HQX_MIX_3(w[4],w[3],w[7],5U,2U,1U); +#define MIX_10_4_7_3_5_2_1 *(output + lineSize) = HQX_MIX_3(w[4],w[7],w[3],5U,2U,1U); +#define MIX_10_4_7_3_6_1_1 *(output + lineSize) = HQX_MIX_3(w[4],w[7],w[3],6U,1U,1U); +#define MIX_10_4_7_3_2_3_3 *(output + lineSize) = HQX_MIX_3(w[4],w[7],w[3],2U,3U,3U); +#define MIX_10_4_6_3_10 *(output + lineSize) = HQX_MIX_3(w[4],w[7],w[3],14U,1U,1U); +#define MIX_10_4_3_7_1 *(output + lineSize) = HQX_MIX_2(w[4],w[3],7U,1U); +#define MIX_10_3_4_3_1 *(output + lineSize) = HQX_MIX_2(w[3],w[4],3U,1U); + +#define MIX_11_4 *(output + lineSize + 1) = w[4]; +#define MIX_11_4_8_3_1 *(output + lineSize + 1) = HQX_MIX_2(w[4],w[8],3U,1U); +#define MIX_11_4_5_3_1 *(output + lineSize + 1) = HQX_MIX_2(w[4],w[5],3U,1U); +#define MIX_11_4_7_3_1 *(output + lineSize + 1) = HQX_MIX_2(w[4],w[7],3U,1U); +#define MIX_11_4_5_7_2_1_1 *(output + lineSize + 1) = HQX_MIX_3(w[4],w[5],w[7],2U,1U,1U); +#define MIX_11_4_8_7_2_1_1 *(output + lineSize + 1) = HQX_MIX_3(w[4],w[8],w[7],2U,1U,1U); +#define MIX_11_4_8_5_2_1_1 *(output + lineSize + 1) = HQX_MIX_3(w[4],w[8],w[5],2U,1U,1U); +#define MIX_11_4_7_5_5_2_1 *(output + lineSize + 1) = HQX_MIX_3(w[4],w[7],w[5],5U,2U,1U); +#define MIX_11_4_5_7_5_2_1 *(output + lineSize + 1) = HQX_MIX_3(w[4],w[5],w[7],5U,2U,1U); +#define MIX_11_4_5_7_6_1_1 *(output + lineSize + 1) = HQX_MIX_3(w[4],w[5],w[7],6U,1U,1U); +#define MIX_11_4_5_7_2_3_3 *(output + lineSize + 1) = HQX_MIX_3(w[4],w[5],w[7],2U,3U,3U); +#define MIX_11_4_8_3_10 *(output + lineSize + 1) = HQX_MIX_3(w[4],w[5],w[7],14U,1U,1U); + +#define MIX_12_4 *(output + lineSize + 2) = w[4]; +#define MIX_12_4_5_3_1 *(output + lineSize + 2) = HQX_MIX_2(w[4],w[5],3U,1U); +#define MIX_12_4_5_7_1 *(output + lineSize + 2) = HQX_MIX_2(w[4],w[5],7U,1U); +#define MIX_12_5_4_3_1 *(output + lineSize + 2) = HQX_MIX_2(w[5],w[4],3U,1U); + +#define MIX_20_4 *(output + lineSize + lineSize) = w[4]; +#define MIX_20_4_6_3_1 *(output + lineSize + lineSize) = HQX_MIX_2(w[4],w[6],3U,1U); +#define MIX_20_4_7_3_1 *(output + lineSize + lineSize) = HQX_MIX_2(w[4],w[7],3U,1U); +#define MIX_20_4_3_3_1 *(output + lineSize + lineSize) = HQX_MIX_2(w[4],w[3],3U,1U); +#define MIX_20_4_7_3_2_1_1 *(output + lineSize + lineSize) = HQX_MIX_3(w[4],w[7],w[3],2U,1U,1U); +#define MIX_20_4_7_3_2_7_7 *(output + lineSize + lineSize) = HQX_MIX_3(w[4],w[7],w[3],2U,7U,7U); +#define MIX_20_7_3_1_1 *(output + lineSize + lineSize) = HQX_MIX_2(w[7],w[3],1U,1U); + +#define MIX_21_4 *(output + lineSize + lineSize + 1) = w[4]; +#define MIX_21_4_7_3_1 *(output + lineSize + lineSize + 1) = HQX_MIX_2(w[4],w[7],3U,1U); +#define MIX_21_4_7_7_1 *(output + lineSize + lineSize + 1) = HQX_MIX_2(w[4],w[7],7U,1U); +#define MIX_21_7_4_3_1 *(output + lineSize + lineSize + 1) = HQX_MIX_2(w[7],w[4],3U,1U); + +#define MIX_22_4 *(output + lineSize + lineSize + 2) = w[4]; +#define MIX_22_4_8_3_1 *(output + lineSize + lineSize + 2) = HQX_MIX_2(w[4],w[8],3U,1U); +#define MIX_22_4_7_3_1 *(output + lineSize + lineSize + 2) = HQX_MIX_2(w[4],w[7],3U,1U); +#define MIX_22_4_5_3_1 *(output + lineSize + lineSize + 2) = HQX_MIX_2(w[4],w[5],3U,1U); +#define MIX_22_4_5_7_2_1_1 *(output + lineSize + lineSize + 2) = HQX_MIX_3(w[4],w[5],w[7],2U,1U,1U); +#define MIX_22_4_5_7_2_7_7 *(output + lineSize + lineSize + 2) = HQX_MIX_3(w[4],w[5],w[7],2U,7U,7U); +#define MIX_22_5_7_1_1 *(output + lineSize + lineSize + 2) = HQX_MIX_2(w[5],w[7],1U,1U); + + + +uint32_t *hq2x_resize( + const uint32_t *image, + uint32_t width, + uint32_t height, + uint32_t *output, + uint32_t trY, + uint32_t trU, + uint32_t trV, + uint32_t trA, + bool wrapX, + bool wrapY ) +{ + int lineSize = width * 2; + + int previous, next; + uint32_t w[9]; + + trY <<= 16; + trU <<= 8; + trA <<= 24; + + // iterates between the lines + for (uint32_t row = 0; row < height; row++) + { + /* + * Note: this function uses a 3x3 sliding window over the original image. + * + * +----+----+----+ + * | | | | + * | w0 | w1 | w2 | + * +----+----+----+ + * | | | | + * | w3 | w4 | w5 | + * +----+----+----+ + * | | | | + * | w6 | w7 | w8 | + * +----+----+----+ + */ + + // adjusts the previous and next line pointers + if (row > 0) + previous = -width; + else + { + if (wrapY) + previous = width * (height - 1); + else + previous = 0; + } + if (row < height - 1) + next = width; + else + { + if (wrapY) + next = -(width * (height - 1)); + else + next = 0; + } + + // iterates between the columns + for (uint32_t col = 0; col < width; col++) + { + w[1] = *(image + previous); + w[4] = *image; + w[7] = *(image + next); + + if (col > 0) + { + w[0] = *(image + previous - 1); + w[3] = *(image - 1); + w[6] = *(image + next - 1); + } + else + { + if (wrapX) + { + w[0] = *(image + previous + width - 1); + w[3] = *(image + width - 1); + w[6] = *(image + next + width - 1); + } + else + { + w[0] = w[1]; + w[3] = w[4]; + w[6] = w[7]; + } + } + + if (col < width - 1) + { + w[2] = *(image + previous + 1); + w[5] = *(image + 1); + w[8] = *(image + next + 1); + } + else + { + if (wrapX) + { + w[2] = *(image + previous - width + 1); + w[5] = *(image - width + 1); + w[8] = *(image + next - width + 1); + } + else + { + w[2] = w[1]; + w[5] = w[4]; + w[8] = w[7]; + } + } + + int pattern = 0; + + // computes the pattern to be used considering the neighbor pixels + for (int k = 0, flag = 1; k < 9; k++) + { + // ignores the central pixel + if (k == 4) continue; + + if (w[k] != w[4]) + if (isDifferent(w[4], w[k], trY, trU, trV, trA)) pattern |= flag; + flag <<= 1; + } + + switch (pattern) + { + case 0: + case 1: + case 4: + case 32: + case 128: + case 5: + case 132: + case 160: + case 33: + case 129: + case 36: + case 133: + case 164: + case 161: + case 37: + case 165: + MIX_00_4_3_1_2_1_1 + MIX_01_4_1_5_2_1_1 + MIX_10_4_7_3_2_1_1 + MIX_11_4_5_7_2_1_1 + break; + case 2: + case 34: + case 130: + case 162: + MIX_00_4_0_3_2_1_1 + MIX_01_4_2_5_2_1_1 + MIX_10_4_7_3_2_1_1 + MIX_11_4_5_7_2_1_1 + break; + case 16: + case 17: + case 48: + case 49: + MIX_00_4_3_1_2_1_1 + MIX_01_4_2_1_2_1_1 + MIX_10_4_7_3_2_1_1 + MIX_11_4_8_7_2_1_1 + break; + case 64: + case 65: + case 68: + case 69: + MIX_00_4_3_1_2_1_1 + MIX_01_4_1_5_2_1_1 + MIX_10_4_6_3_2_1_1 + MIX_11_4_8_5_2_1_1 + break; + case 8: + case 12: + case 136: + case 140: + MIX_00_4_0_1_2_1_1 + MIX_01_4_1_5_2_1_1 + MIX_10_4_6_7_2_1_1 + MIX_11_4_5_7_2_1_1 + break; + case 3: + case 35: + case 131: + case 163: + MIX_00_4_3_3_1 + MIX_01_4_2_5_2_1_1 + MIX_10_4_7_3_2_1_1 + MIX_11_4_5_7_2_1_1 + break; + case 6: + case 38: + case 134: + case 166: + MIX_00_4_0_3_2_1_1 + MIX_01_4_5_3_1 + MIX_10_4_7_3_2_1_1 + MIX_11_4_5_7_2_1_1 + break; + case 20: + case 21: + case 52: + case 53: + MIX_00_4_3_1_2_1_1 + MIX_01_4_1_3_1 + MIX_10_4_7_3_2_1_1 + MIX_11_4_8_7_2_1_1 + break; + case 144: + case 145: + case 176: + case 177: + MIX_00_4_3_1_2_1_1 + MIX_01_4_2_1_2_1_1 + MIX_10_4_7_3_2_1_1 + MIX_11_4_7_3_1 + break; + case 192: + case 193: + case 196: + case 197: + MIX_00_4_3_1_2_1_1 + MIX_01_4_1_5_2_1_1 + MIX_10_4_6_3_2_1_1 + MIX_11_4_5_3_1 + break; + case 96: + case 97: + case 100: + case 101: + MIX_00_4_3_1_2_1_1 + MIX_01_4_1_5_2_1_1 + MIX_10_4_3_3_1 + MIX_11_4_8_5_2_1_1 + break; + case 40: + case 44: + case 168: + case 172: + MIX_00_4_0_1_2_1_1 + MIX_01_4_1_5_2_1_1 + MIX_10_4_7_3_1 + MIX_11_4_5_7_2_1_1 + break; + case 9: + case 13: + case 137: + case 141: + MIX_00_4_1_3_1 + MIX_01_4_1_5_2_1_1 + MIX_10_4_6_7_2_1_1 + MIX_11_4_5_7_2_1_1 + break; + case 18: + case 50: + MIX_00_4_0_3_2_1_1 + if (isDifferent(w[1], w[5], trY, trU, trV, trA)) + { + MIX_01_4_2_3_1 + } + else + { + MIX_01_4_1_5_2_1_1 + } + MIX_10_4_7_3_2_1_1 + MIX_11_4_8_7_2_1_1 + break; + case 80: + case 81: + MIX_00_4_3_1_2_1_1 + MIX_01_4_2_1_2_1_1 + MIX_10_4_6_3_2_1_1 + if (isDifferent(w[5], w[7], trY, trU, trV, trA)) + { + MIX_11_4_8_3_1 + } + else + { + MIX_11_4_5_7_2_1_1 + } + break; + case 72: + case 76: + MIX_00_4_0_1_2_1_1 + MIX_01_4_1_5_2_1_1 + if (isDifferent(w[7], w[3], trY, trU, trV, trA)) + { + MIX_10_4_6_3_1 + } + else + { + MIX_10_4_7_3_2_1_1 + } + MIX_11_4_8_5_2_1_1 + break; + case 10: + case 138: + if (isDifferent(w[3], w[1], trY, trU, trV, trA)) + { + MIX_00_MIX_00_4_0_3_1 + } + else + { + MIX_00_4_3_1_2_1_1 + } + MIX_01_4_2_5_2_1_1 + MIX_10_4_6_7_2_1_1 + MIX_11_4_5_7_2_1_1 + break; + case 66: + MIX_00_4_0_3_2_1_1 + MIX_01_4_2_5_2_1_1 + MIX_10_4_6_3_2_1_1 + MIX_11_4_8_5_2_1_1 + break; + case 24: + MIX_00_4_0_1_2_1_1 + MIX_01_4_2_1_2_1_1 + MIX_10_4_6_7_2_1_1 + MIX_11_4_8_7_2_1_1 + break; + case 7: + case 39: + case 135: + MIX_00_4_3_3_1 + MIX_01_4_5_3_1 + MIX_10_4_7_3_2_1_1 + MIX_11_4_5_7_2_1_1 + break; + case 148: + case 149: + case 180: + MIX_00_4_3_1_2_1_1 + MIX_01_4_1_3_1 + MIX_10_4_7_3_2_1_1 + MIX_11_4_7_3_1 + break; + case 224: + case 228: + case 225: + MIX_00_4_3_1_2_1_1 + MIX_01_4_1_5_2_1_1 + MIX_10_4_3_3_1 + MIX_11_4_5_3_1 + break; + case 41: + case 169: + case 45: + MIX_00_4_1_3_1 + MIX_01_4_1_5_2_1_1 + MIX_10_4_7_3_1 + MIX_11_4_5_7_2_1_1 + break; + case 22: + case 54: + MIX_00_4_0_3_2_1_1 + if (isDifferent(w[1], w[5], trY, trU, trV, trA)) + { + MIX_01_4 + } + else + { + MIX_01_4_1_5_2_1_1 + } + MIX_10_4_7_3_2_1_1 + MIX_11_4_8_7_2_1_1 + break; + case 208: + case 209: + MIX_00_4_3_1_2_1_1 + MIX_01_4_2_1_2_1_1 + MIX_10_4_6_3_2_1_1 + if (isDifferent(w[5], w[7], trY, trU, trV, trA)) + { + MIX_11_4 + } + else + { + MIX_11_4_5_7_2_1_1 + } + break; + case 104: + case 108: + MIX_00_4_0_1_2_1_1 + MIX_01_4_1_5_2_1_1 + if (isDifferent(w[7], w[3], trY, trU, trV, trA)) + { + MIX_10_4 + } + else + { + MIX_10_4_7_3_2_1_1 + } + MIX_11_4_8_5_2_1_1 + break; + case 11: + case 139: + if (isDifferent(w[3], w[1], trY, trU, trV, trA)) + { + MIX_00_4 + } + else + { + MIX_00_4_3_1_2_1_1 + } + MIX_01_4_2_5_2_1_1 + MIX_10_4_6_7_2_1_1 + MIX_11_4_5_7_2_1_1 + break; + case 19: + case 51: + if (isDifferent(w[1], w[5], trY, trU, trV, trA)) + { + MIX_00_4_3_3_1 + MIX_01_4_2_3_1 + } + else + { + MIX_00_4_1_3_5_2_1 + MIX_01_4_1_5_2_3_3 + } + MIX_10_4_7_3_2_1_1 + MIX_11_4_8_7_2_1_1 + break; + case 146: + case 178: + MIX_00_4_0_3_2_1_1 + if (isDifferent(w[1], w[5], trY, trU, trV, trA)) + { + MIX_01_4_2_3_1 + MIX_11_4_7_3_1 + } + else + { + MIX_01_4_1_5_2_3_3 + MIX_11_4_5_7_5_2_1 + } + MIX_10_4_7_3_2_1_1 + break; + case 84: + case 85: + MIX_00_4_3_1_2_1_1 + if (isDifferent(w[5], w[7], trY, trU, trV, trA)) + { + MIX_01_4_1_3_1 + MIX_11_4_8_3_1 + } + else + { + MIX_01_4_5_1_5_2_1 + MIX_11_4_5_7_2_3_3 + } + MIX_10_4_6_3_2_1_1 + break; + case 112: + case 113: + MIX_00_4_3_1_2_1_1 + MIX_01_4_2_1_2_1_1 + if (isDifferent(w[5], w[7], trY, trU, trV, trA)) + { + MIX_10_4_3_3_1 + MIX_11_4_8_3_1 + } + else + { + MIX_10_4_7_3_5_2_1 + MIX_11_4_5_7_2_3_3 + } + break; + case 200: + case 204: + MIX_00_4_0_1_2_1_1 + MIX_01_4_1_5_2_1_1 + if (isDifferent(w[7], w[3], trY, trU, trV, trA)) + { + MIX_10_4_6_3_1 + MIX_11_4_5_3_1 + } + else + { + MIX_10_4_7_3_2_3_3 + MIX_11_4_7_5_5_2_1 + } + break; + case 73: + case 77: + if (isDifferent(w[7], w[3], trY, trU, trV, trA)) + { + MIX_00_4_1_3_1 + MIX_10_4_6_3_1 + } + else + { + MIX_00_4_3_1_5_2_1 + MIX_10_4_7_3_2_3_3 + } + MIX_01_4_1_5_2_1_1 + MIX_11_4_8_5_2_1_1 + break; + case 42: + case 170: + if (isDifferent(w[3], w[1], trY, trU, trV, trA)) + { + MIX_00_MIX_00_4_0_3_1 + MIX_10_4_7_3_1 + } + else + { + MIX_00_4_3_1_2_3_3 + MIX_10_4_3_7_5_2_1 + } + MIX_01_4_2_5_2_1_1 + MIX_11_4_5_7_2_1_1 + break; + case 14: + case 142: + if (isDifferent(w[3], w[1], trY, trU, trV, trA)) + { + MIX_00_MIX_00_4_0_3_1 + MIX_01_4_5_3_1 + } + else + { + MIX_00_4_3_1_2_3_3 + MIX_01_4_1_5_5_2_1 + } + MIX_10_4_6_7_2_1_1 + MIX_11_4_5_7_2_1_1 + break; + case 67: + MIX_00_4_3_3_1 + MIX_01_4_2_5_2_1_1 + MIX_10_4_6_3_2_1_1 + MIX_11_4_8_5_2_1_1 + break; + case 70: + MIX_00_4_0_3_2_1_1 + MIX_01_4_5_3_1 + MIX_10_4_6_3_2_1_1 + MIX_11_4_8_5_2_1_1 + break; + case 28: + MIX_00_4_0_1_2_1_1 + MIX_01_4_1_3_1 + MIX_10_4_6_7_2_1_1 + MIX_11_4_8_7_2_1_1 + break; + case 152: + MIX_00_4_0_1_2_1_1 + MIX_01_4_2_1_2_1_1 + MIX_10_4_6_7_2_1_1 + MIX_11_4_7_3_1 + break; + case 194: + MIX_00_4_0_3_2_1_1 + MIX_01_4_2_5_2_1_1 + MIX_10_4_6_3_2_1_1 + MIX_11_4_5_3_1 + break; + case 98: + MIX_00_4_0_3_2_1_1 + MIX_01_4_2_5_2_1_1 + MIX_10_4_3_3_1 + MIX_11_4_8_5_2_1_1 + break; + case 56: + MIX_00_4_0_1_2_1_1 + MIX_01_4_2_1_2_1_1 + MIX_10_4_7_3_1 + MIX_11_4_8_7_2_1_1 + break; + case 25: + MIX_00_4_1_3_1 + MIX_01_4_2_1_2_1_1 + MIX_10_4_6_7_2_1_1 + MIX_11_4_8_7_2_1_1 + break; + case 26: + case 31: + if (isDifferent(w[3], w[1], trY, trU, trV, trA)) + { + MIX_00_4 + } + else + { + MIX_00_4_3_1_2_1_1 + } + if (isDifferent(w[1], w[5], trY, trU, trV, trA)) + { + MIX_01_4 + } + else + { + MIX_01_4_1_5_2_1_1 + } + MIX_10_4_6_7_2_1_1 + MIX_11_4_8_7_2_1_1 + break; + case 82: + case 214: + MIX_00_4_0_3_2_1_1 + if (isDifferent(w[1], w[5], trY, trU, trV, trA)) + { + MIX_01_4 + } + else + { + MIX_01_4_1_5_2_1_1 + } + MIX_10_4_6_3_2_1_1 + if (isDifferent(w[5], w[7], trY, trU, trV, trA)) + { + MIX_11_4 + } + else + { + MIX_11_4_5_7_2_1_1 + } + break; + case 88: + case 248: + MIX_00_4_0_1_2_1_1 + MIX_01_4_2_1_2_1_1 + if (isDifferent(w[7], w[3], trY, trU, trV, trA)) + { + MIX_10_4 + } + else + { + MIX_10_4_7_3_2_1_1 + } + if (isDifferent(w[5], w[7], trY, trU, trV, trA)) + { + MIX_11_4 + } + else + { + MIX_11_4_5_7_2_1_1 + } + break; + case 74: + case 107: + if (isDifferent(w[3], w[1], trY, trU, trV, trA)) + { + MIX_00_4 + } + else + { + MIX_00_4_3_1_2_1_1 + } + MIX_01_4_2_5_2_1_1 + if (isDifferent(w[7], w[3], trY, trU, trV, trA)) + { + MIX_10_4 + } + else + { + MIX_10_4_7_3_2_1_1 + } + MIX_11_4_8_5_2_1_1 + break; + case 27: + if (isDifferent(w[3], w[1], trY, trU, trV, trA)) + { + MIX_00_4 + } + else + { + MIX_00_4_3_1_2_1_1 + } + MIX_01_4_2_3_1 + MIX_10_4_6_7_2_1_1 + MIX_11_4_8_7_2_1_1 + break; + case 86: + MIX_00_4_0_3_2_1_1 + if (isDifferent(w[1], w[5], trY, trU, trV, trA)) + { + MIX_01_4 + } + else + { + MIX_01_4_1_5_2_1_1 + } + MIX_10_4_6_3_2_1_1 + MIX_11_4_8_3_1 + break; + case 216: + MIX_00_4_0_1_2_1_1 + MIX_01_4_2_1_2_1_1 + MIX_10_4_6_3_1 + if (isDifferent(w[5], w[7], trY, trU, trV, trA)) + { + MIX_11_4 + } + else + { + MIX_11_4_5_7_2_1_1 + } + break; + case 106: + MIX_00_MIX_00_4_0_3_1 + MIX_01_4_2_5_2_1_1 + if (isDifferent(w[7], w[3], trY, trU, trV, trA)) + { + MIX_10_4 + } + else + { + MIX_10_4_7_3_2_1_1 + } + MIX_11_4_8_5_2_1_1 + break; + case 30: + MIX_00_MIX_00_4_0_3_1 + if (isDifferent(w[1], w[5], trY, trU, trV, trA)) + { + MIX_01_4 + } + else + { + MIX_01_4_1_5_2_1_1 + } + MIX_10_4_6_7_2_1_1 + MIX_11_4_8_7_2_1_1 + break; + case 210: + MIX_00_4_0_3_2_1_1 + MIX_01_4_2_3_1 + MIX_10_4_6_3_2_1_1 + if (isDifferent(w[5], w[7], trY, trU, trV, trA)) + { + MIX_11_4 + } + else + { + MIX_11_4_5_7_2_1_1 + } + break; + case 120: + MIX_00_4_0_1_2_1_1 + MIX_01_4_2_1_2_1_1 + if (isDifferent(w[7], w[3], trY, trU, trV, trA)) + { + MIX_10_4 + } + else + { + MIX_10_4_7_3_2_1_1 + } + MIX_11_4_8_3_1 + break; + case 75: + if (isDifferent(w[3], w[1], trY, trU, trV, trA)) + { + MIX_00_4 + } + else + { + MIX_00_4_3_1_2_1_1 + } + MIX_01_4_2_5_2_1_1 + MIX_10_4_6_3_1 + MIX_11_4_8_5_2_1_1 + break; + case 29: + MIX_00_4_1_3_1 + MIX_01_4_1_3_1 + MIX_10_4_6_7_2_1_1 + MIX_11_4_8_7_2_1_1 + break; + case 198: + MIX_00_4_0_3_2_1_1 + MIX_01_4_5_3_1 + MIX_10_4_6_3_2_1_1 + MIX_11_4_5_3_1 + break; + case 184: + MIX_00_4_0_1_2_1_1 + MIX_01_4_2_1_2_1_1 + MIX_10_4_7_3_1 + MIX_11_4_7_3_1 + break; + case 99: + MIX_00_4_3_3_1 + MIX_01_4_2_5_2_1_1 + MIX_10_4_3_3_1 + MIX_11_4_8_5_2_1_1 + break; + case 57: + MIX_00_4_1_3_1 + MIX_01_4_2_1_2_1_1 + MIX_10_4_7_3_1 + MIX_11_4_8_7_2_1_1 + break; + case 71: + MIX_00_4_3_3_1 + MIX_01_4_5_3_1 + MIX_10_4_6_3_2_1_1 + MIX_11_4_8_5_2_1_1 + break; + case 156: + MIX_00_4_0_1_2_1_1 + MIX_01_4_1_3_1 + MIX_10_4_6_7_2_1_1 + MIX_11_4_7_3_1 + break; + case 226: + MIX_00_4_0_3_2_1_1 + MIX_01_4_2_5_2_1_1 + MIX_10_4_3_3_1 + MIX_11_4_5_3_1 + break; + case 60: + MIX_00_4_0_1_2_1_1 + MIX_01_4_1_3_1 + MIX_10_4_7_3_1 + MIX_11_4_8_7_2_1_1 + break; + case 195: + MIX_00_4_3_3_1 + MIX_01_4_2_5_2_1_1 + MIX_10_4_6_3_2_1_1 + MIX_11_4_5_3_1 + break; + case 102: + MIX_00_4_0_3_2_1_1 + MIX_01_4_5_3_1 + MIX_10_4_3_3_1 + MIX_11_4_8_5_2_1_1 + break; + case 153: + MIX_00_4_1_3_1 + MIX_01_4_2_1_2_1_1 + MIX_10_4_6_7_2_1_1 + MIX_11_4_7_3_1 + break; + case 58: + if (isDifferent(w[3], w[1], trY, trU, trV, trA)) + { + MIX_00_MIX_00_4_0_3_1 + } + else + { + MIX_00_4_3_1_6_1_1 + } + if (isDifferent(w[1], w[5], trY, trU, trV, trA)) + { + MIX_01_4_2_3_1 + } + else + { + MIX_01_4_1_5_6_1_1 + } + MIX_10_4_7_3_1 + MIX_11_4_8_7_2_1_1 + break; + case 83: + MIX_00_4_3_3_1 + if (isDifferent(w[1], w[5], trY, trU, trV, trA)) + { + MIX_01_4_2_3_1 + } + else + { + MIX_01_4_1_5_6_1_1 + } + MIX_10_4_6_3_2_1_1 + if (isDifferent(w[5], w[7], trY, trU, trV, trA)) + { + MIX_11_4_8_3_1 + } + else + { + MIX_11_4_5_7_6_1_1 + } + break; + case 92: + MIX_00_4_0_1_2_1_1 + MIX_01_4_1_3_1 + if (isDifferent(w[7], w[3], trY, trU, trV, trA)) + { + MIX_10_4_6_3_1 + } + else + { + MIX_10_4_7_3_6_1_1 + } + if (isDifferent(w[5], w[7], trY, trU, trV, trA)) + { + MIX_11_4_8_3_1 + } + else + { + MIX_11_4_5_7_6_1_1 + } + break; + case 202: + if (isDifferent(w[3], w[1], trY, trU, trV, trA)) + { + MIX_00_MIX_00_4_0_3_1 + } + else + { + MIX_00_4_3_1_6_1_1 + } + MIX_01_4_2_5_2_1_1 + if (isDifferent(w[7], w[3], trY, trU, trV, trA)) + { + MIX_10_4_6_3_1 + } + else + { + MIX_10_4_7_3_6_1_1 + } + MIX_11_4_5_3_1 + break; + case 78: + if (isDifferent(w[3], w[1], trY, trU, trV, trA)) + { + MIX_00_MIX_00_4_0_3_1 + } + else + { + MIX_00_4_3_1_6_1_1 + } + MIX_01_4_5_3_1 + if (isDifferent(w[7], w[3], trY, trU, trV, trA)) + { + MIX_10_4_6_3_1 + } + else + { + MIX_10_4_7_3_6_1_1 + } + MIX_11_4_8_5_2_1_1 + break; + case 154: + if (isDifferent(w[3], w[1], trY, trU, trV, trA)) + { + MIX_00_MIX_00_4_0_3_1 + } + else + { + MIX_00_4_3_1_6_1_1 + } + if (isDifferent(w[1], w[5], trY, trU, trV, trA)) + { + MIX_01_4_2_3_1 + } + else + { + MIX_01_4_1_5_6_1_1 + } + MIX_10_4_6_7_2_1_1 + MIX_11_4_7_3_1 + break; + case 114: + MIX_00_4_0_3_2_1_1 + if (isDifferent(w[1], w[5], trY, trU, trV, trA)) + { + MIX_01_4_2_3_1 + } + else + { + MIX_01_4_1_5_6_1_1 + } + MIX_10_4_3_3_1 + if (isDifferent(w[5], w[7], trY, trU, trV, trA)) + { + MIX_11_4_8_3_1 + } + else + { + MIX_11_4_5_7_6_1_1 + } + break; + case 89: + MIX_00_4_1_3_1 + MIX_01_4_2_1_2_1_1 + if (isDifferent(w[7], w[3], trY, trU, trV, trA)) + { + MIX_10_4_6_3_1 + } + else + { + MIX_10_4_7_3_6_1_1 + } + if (isDifferent(w[5], w[7], trY, trU, trV, trA)) + { + MIX_11_4_8_3_1 + } + else + { + MIX_11_4_5_7_6_1_1 + } + break; + case 90: + if (isDifferent(w[3], w[1], trY, trU, trV, trA)) + { + MIX_00_MIX_00_4_0_3_1 + } + else + { + MIX_00_4_3_1_6_1_1 + } + if (isDifferent(w[1], w[5], trY, trU, trV, trA)) + { + MIX_01_4_2_3_1 + } + else + { + MIX_01_4_1_5_6_1_1 + } + if (isDifferent(w[7], w[3], trY, trU, trV, trA)) + { + MIX_10_4_6_3_1 + } + else + { + MIX_10_4_7_3_6_1_1 + } + if (isDifferent(w[5], w[7], trY, trU, trV, trA)) + { + MIX_11_4_8_3_1 + } + else + { + MIX_11_4_5_7_6_1_1 + } + break; + case 55: + case 23: + if (isDifferent(w[1], w[5], trY, trU, trV, trA)) + { + MIX_00_4_3_3_1 + MIX_01_4 + } + else + { + MIX_00_4_1_3_5_2_1 + MIX_01_4_1_5_2_3_3 + } + MIX_10_4_7_3_2_1_1 + MIX_11_4_8_7_2_1_1 + break; + case 182: + case 150: + MIX_00_4_0_3_2_1_1 + if (isDifferent(w[1], w[5], trY, trU, trV, trA)) + { + MIX_01_4 + MIX_11_4_7_3_1 + } + else + { + MIX_01_4_1_5_2_3_3 + MIX_11_4_5_7_5_2_1 + } + MIX_10_4_7_3_2_1_1 + break; + case 213: + case 212: + MIX_00_4_3_1_2_1_1 + if (isDifferent(w[5], w[7], trY, trU, trV, trA)) + { + MIX_01_4_1_3_1 + MIX_11_4 + } + else + { + MIX_01_4_5_1_5_2_1 + MIX_11_4_5_7_2_3_3 + } + MIX_10_4_6_3_2_1_1 + break; + case 241: + case 240: + MIX_00_4_3_1_2_1_1 + MIX_01_4_2_1_2_1_1 + if (isDifferent(w[5], w[7], trY, trU, trV, trA)) + { + MIX_10_4_3_3_1 + MIX_11_4 + } + else + { + MIX_10_4_7_3_5_2_1 + MIX_11_4_5_7_2_3_3 + } + break; + case 236: + case 232: + MIX_00_4_0_1_2_1_1 + MIX_01_4_1_5_2_1_1 + if (isDifferent(w[7], w[3], trY, trU, trV, trA)) + { + MIX_10_4 + MIX_11_4_5_3_1 + } + else + { + MIX_10_4_7_3_2_3_3 + MIX_11_4_7_5_5_2_1 + } + break; + case 109: + case 105: + if (isDifferent(w[7], w[3], trY, trU, trV, trA)) + { + MIX_00_4_1_3_1 + MIX_10_4 + } + else + { + MIX_00_4_3_1_5_2_1 + MIX_10_4_7_3_2_3_3 + } + MIX_01_4_1_5_2_1_1 + MIX_11_4_8_5_2_1_1 + break; + case 171: + case 43: + if (isDifferent(w[3], w[1], trY, trU, trV, trA)) + { + MIX_00_4 + MIX_10_4_7_3_1 + } + else + { + MIX_00_4_3_1_2_3_3 + MIX_10_4_3_7_5_2_1 + } + MIX_01_4_2_5_2_1_1 + MIX_11_4_5_7_2_1_1 + break; + case 143: + case 15: + if (isDifferent(w[3], w[1], trY, trU, trV, trA)) + { + MIX_00_4 + MIX_01_4_5_3_1 + } + else + { + MIX_00_4_3_1_2_3_3 + MIX_01_4_1_5_5_2_1 + } + MIX_10_4_6_7_2_1_1 + MIX_11_4_5_7_2_1_1 + break; + case 124: + MIX_00_4_0_1_2_1_1 + MIX_01_4_1_3_1 + if (isDifferent(w[7], w[3], trY, trU, trV, trA)) + { + MIX_10_4 + } + else + { + MIX_10_4_7_3_2_1_1 + } + MIX_11_4_8_3_1 + break; + case 203: + if (isDifferent(w[3], w[1], trY, trU, trV, trA)) + { + MIX_00_4 + } + else + { + MIX_00_4_3_1_2_1_1 + } + MIX_01_4_2_5_2_1_1 + MIX_10_4_6_3_1 + MIX_11_4_5_3_1 + break; + case 62: + MIX_00_MIX_00_4_0_3_1 + if (isDifferent(w[1], w[5], trY, trU, trV, trA)) + { + MIX_01_4 + } + else + { + MIX_01_4_1_5_2_1_1 + } + MIX_10_4_7_3_1 + MIX_11_4_8_7_2_1_1 + break; + case 211: + MIX_00_4_3_3_1 + MIX_01_4_2_3_1 + MIX_10_4_6_3_2_1_1 + if (isDifferent(w[5], w[7], trY, trU, trV, trA)) + { + MIX_11_4 + } + else + { + MIX_11_4_5_7_2_1_1 + } + break; + case 118: + MIX_00_4_0_3_2_1_1 + if (isDifferent(w[1], w[5], trY, trU, trV, trA)) + { + MIX_01_4 + } + else + { + MIX_01_4_1_5_2_1_1 + } + MIX_10_4_3_3_1 + MIX_11_4_8_3_1 + break; + case 217: + MIX_00_4_1_3_1 + MIX_01_4_2_1_2_1_1 + MIX_10_4_6_3_1 + if (isDifferent(w[5], w[7], trY, trU, trV, trA)) + { + MIX_11_4 + } + else + { + MIX_11_4_5_7_2_1_1 + } + break; + case 110: + MIX_00_MIX_00_4_0_3_1 + MIX_01_4_5_3_1 + if (isDifferent(w[7], w[3], trY, trU, trV, trA)) + { + MIX_10_4 + } + else + { + MIX_10_4_7_3_2_1_1 + } + MIX_11_4_8_5_2_1_1 + break; + case 155: + if (isDifferent(w[3], w[1], trY, trU, trV, trA)) + { + MIX_00_4 + } + else + { + MIX_00_4_3_1_2_1_1 + } + MIX_01_4_2_3_1 + MIX_10_4_6_7_2_1_1 + MIX_11_4_7_3_1 + break; + case 188: + MIX_00_4_0_1_2_1_1 + MIX_01_4_1_3_1 + MIX_10_4_7_3_1 + MIX_11_4_7_3_1 + break; + case 185: + MIX_00_4_1_3_1 + MIX_01_4_2_1_2_1_1 + MIX_10_4_7_3_1 + MIX_11_4_7_3_1 + break; + case 61: + MIX_00_4_1_3_1 + MIX_01_4_1_3_1 + MIX_10_4_7_3_1 + MIX_11_4_8_7_2_1_1 + break; + case 157: + MIX_00_4_1_3_1 + MIX_01_4_1_3_1 + MIX_10_4_6_7_2_1_1 + MIX_11_4_7_3_1 + break; + case 103: + MIX_00_4_3_3_1 + MIX_01_4_5_3_1 + MIX_10_4_3_3_1 + MIX_11_4_8_5_2_1_1 + break; + case 227: + MIX_00_4_3_3_1 + MIX_01_4_2_5_2_1_1 + MIX_10_4_3_3_1 + MIX_11_4_5_3_1 + break; + case 230: + MIX_00_4_0_3_2_1_1 + MIX_01_4_5_3_1 + MIX_10_4_3_3_1 + MIX_11_4_5_3_1 + break; + case 199: + MIX_00_4_3_3_1 + MIX_01_4_5_3_1 + MIX_10_4_6_3_2_1_1 + MIX_11_4_5_3_1 + break; + case 220: + MIX_00_4_0_1_2_1_1 + MIX_01_4_1_3_1 + if (isDifferent(w[7], w[3], trY, trU, trV, trA)) + { + MIX_10_4_6_3_1 + } + else + { + MIX_10_4_7_3_6_1_1 + } + if (isDifferent(w[5], w[7], trY, trU, trV, trA)) + { + MIX_11_4 + } + else + { + MIX_11_4_5_7_2_1_1 + } + break; + case 158: + if (isDifferent(w[3], w[1], trY, trU, trV, trA)) + { + MIX_00_MIX_00_4_0_3_1 + } + else + { + MIX_00_4_3_1_6_1_1 + } + if (isDifferent(w[1], w[5], trY, trU, trV, trA)) + { + MIX_01_4 + } + else + { + MIX_01_4_1_5_2_1_1 + } + MIX_10_4_6_7_2_1_1 + MIX_11_4_7_3_1 + break; + case 234: + if (isDifferent(w[3], w[1], trY, trU, trV, trA)) + { + MIX_00_MIX_00_4_0_3_1 + } + else + { + MIX_00_4_3_1_6_1_1 + } + MIX_01_4_2_5_2_1_1 + if (isDifferent(w[7], w[3], trY, trU, trV, trA)) + { + MIX_10_4 + } + else + { + MIX_10_4_7_3_2_1_1 + } + MIX_11_4_5_3_1 + break; + case 242: + MIX_00_4_0_3_2_1_1 + if (isDifferent(w[1], w[5], trY, trU, trV, trA)) + { + MIX_01_4_2_3_1 + } + else + { + MIX_01_4_1_5_6_1_1 + } + MIX_10_4_3_3_1 + if (isDifferent(w[5], w[7], trY, trU, trV, trA)) + { + MIX_11_4 + } + else + { + MIX_11_4_5_7_2_1_1 + } + break; + case 59: + if (isDifferent(w[3], w[1], trY, trU, trV, trA)) + { + MIX_00_4 + } + else + { + MIX_00_4_3_1_2_1_1 + } + if (isDifferent(w[1], w[5], trY, trU, trV, trA)) + { + MIX_01_4_2_3_1 + } + else + { + MIX_01_4_1_5_6_1_1 + } + MIX_10_4_7_3_1 + MIX_11_4_8_7_2_1_1 + break; + case 121: + MIX_00_4_1_3_1 + MIX_01_4_2_1_2_1_1 + if (isDifferent(w[7], w[3], trY, trU, trV, trA)) + { + MIX_10_4 + } + else + { + MIX_10_4_7_3_2_1_1 + } + if (isDifferent(w[5], w[7], trY, trU, trV, trA)) + { + MIX_11_4_8_3_1 + } + else + { + MIX_11_4_5_7_6_1_1 + } + break; + case 87: + MIX_00_4_3_3_1 + if (isDifferent(w[1], w[5], trY, trU, trV, trA)) + { + MIX_01_4 + } + else + { + MIX_01_4_1_5_2_1_1 + } + MIX_10_4_6_3_2_1_1 + if (isDifferent(w[5], w[7], trY, trU, trV, trA)) + { + MIX_11_4_8_3_1 + } + else + { + MIX_11_4_5_7_6_1_1 + } + break; + case 79: + if (isDifferent(w[3], w[1], trY, trU, trV, trA)) + { + MIX_00_4 + } + else + { + MIX_00_4_3_1_2_1_1 + } + MIX_01_4_5_3_1 + if (isDifferent(w[7], w[3], trY, trU, trV, trA)) + { + MIX_10_4_6_3_1 + } + else + { + MIX_10_4_7_3_6_1_1 + } + MIX_11_4_8_5_2_1_1 + break; + case 122: + if (isDifferent(w[3], w[1], trY, trU, trV, trA)) + { + MIX_00_MIX_00_4_0_3_1 + } + else + { + MIX_00_4_3_1_6_1_1 + } + if (isDifferent(w[1], w[5], trY, trU, trV, trA)) + { + MIX_01_4_2_3_1 + } + else + { + MIX_01_4_1_5_6_1_1 + } + if (isDifferent(w[7], w[3], trY, trU, trV, trA)) + { + MIX_10_4 + } + else + { + MIX_10_4_7_3_2_1_1 + } + if (isDifferent(w[5], w[7], trY, trU, trV, trA)) + { + MIX_11_4_8_3_1 + } + else + { + MIX_11_4_5_7_6_1_1 + } + break; + case 94: + if (isDifferent(w[3], w[1], trY, trU, trV, trA)) + { + MIX_00_MIX_00_4_0_3_1 + } + else + { + MIX_00_4_3_1_6_1_1 + } + if (isDifferent(w[1], w[5], trY, trU, trV, trA)) + { + MIX_01_4 + } + else + { + MIX_01_4_1_5_2_1_1 + } + if (isDifferent(w[7], w[3], trY, trU, trV, trA)) + { + MIX_10_4_6_3_1 + } + else + { + MIX_10_4_7_3_6_1_1 + } + if (isDifferent(w[5], w[7], trY, trU, trV, trA)) + { + MIX_11_4_8_3_1 + } + else + { + MIX_11_4_5_7_6_1_1 + } + break; + case 218: + if (isDifferent(w[3], w[1], trY, trU, trV, trA)) + { + MIX_00_MIX_00_4_0_3_1 + } + else + { + MIX_00_4_3_1_6_1_1 + } + if (isDifferent(w[1], w[5], trY, trU, trV, trA)) + { + MIX_01_4_2_3_1 + } + else + { + MIX_01_4_1_5_6_1_1 + } + if (isDifferent(w[7], w[3], trY, trU, trV, trA)) + { + MIX_10_4_6_3_1 + } + else + { + MIX_10_4_7_3_6_1_1 + } + if (isDifferent(w[5], w[7], trY, trU, trV, trA)) + { + MIX_11_4 + } + else + { + MIX_11_4_5_7_2_1_1 + } + break; + case 91: + if (isDifferent(w[3], w[1], trY, trU, trV, trA)) + { + MIX_00_4 + } + else + { + MIX_00_4_3_1_2_1_1 + } + if (isDifferent(w[1], w[5], trY, trU, trV, trA)) + { + MIX_01_4_2_3_1 + } + else + { + MIX_01_4_1_5_6_1_1 + } + if (isDifferent(w[7], w[3], trY, trU, trV, trA)) + { + MIX_10_4_6_3_1 + } + else + { + MIX_10_4_7_3_6_1_1 + } + if (isDifferent(w[5], w[7], trY, trU, trV, trA)) + { + MIX_11_4_8_3_1 + } + else + { + MIX_11_4_5_7_6_1_1 + } + break; + case 229: + MIX_00_4_3_1_2_1_1 + MIX_01_4_1_5_2_1_1 + MIX_10_4_3_3_1 + MIX_11_4_5_3_1 + break; + case 167: + MIX_00_4_3_3_1 + MIX_01_4_5_3_1 + MIX_10_4_7_3_2_1_1 + MIX_11_4_5_7_2_1_1 + break; + case 173: + MIX_00_4_1_3_1 + MIX_01_4_1_5_2_1_1 + MIX_10_4_7_3_1 + MIX_11_4_5_7_2_1_1 + break; + case 181: + MIX_00_4_3_1_2_1_1 + MIX_01_4_1_3_1 + MIX_10_4_7_3_2_1_1 + MIX_11_4_7_3_1 + break; + case 186: + if (isDifferent(w[3], w[1], trY, trU, trV, trA)) + { + MIX_00_MIX_00_4_0_3_1 + } + else + { + MIX_00_4_3_1_6_1_1 + } + if (isDifferent(w[1], w[5], trY, trU, trV, trA)) + { + MIX_01_4_2_3_1 + } + else + { + MIX_01_4_1_5_6_1_1 + } + MIX_10_4_7_3_1 + MIX_11_4_7_3_1 + break; + case 115: + MIX_00_4_3_3_1 + if (isDifferent(w[1], w[5], trY, trU, trV, trA)) + { + MIX_01_4_2_3_1 + } + else + { + MIX_01_4_1_5_6_1_1 + } + MIX_10_4_3_3_1 + if (isDifferent(w[5], w[7], trY, trU, trV, trA)) + { + MIX_11_4_8_3_1 + } + else + { + MIX_11_4_5_7_6_1_1 + } + break; + case 93: + MIX_00_4_1_3_1 + MIX_01_4_1_3_1 + if (isDifferent(w[7], w[3], trY, trU, trV, trA)) + { + MIX_10_4_6_3_1 + } + else + { + MIX_10_4_7_3_6_1_1 + } + if (isDifferent(w[5], w[7], trY, trU, trV, trA)) + { + MIX_11_4_8_3_1 + } + else + { + MIX_11_4_5_7_6_1_1 + } + break; + case 206: + if (isDifferent(w[3], w[1], trY, trU, trV, trA)) + { + MIX_00_MIX_00_4_0_3_1 + } + else + { + MIX_00_4_3_1_6_1_1 + } + MIX_01_4_5_3_1 + if (isDifferent(w[7], w[3], trY, trU, trV, trA)) + { + MIX_10_4_6_3_1 + } + else + { + MIX_10_4_7_3_6_1_1 + } + MIX_11_4_5_3_1 + break; + case 205: + case 201: + MIX_00_4_1_3_1 + MIX_01_4_1_5_2_1_1 + if (isDifferent(w[7], w[3], trY, trU, trV, trA)) + { + MIX_10_4_6_3_1 + } + else + { + MIX_10_4_7_3_6_1_1 + } + MIX_11_4_5_3_1 + break; + case 174: + case 46: + if (isDifferent(w[3], w[1], trY, trU, trV, trA)) + { + MIX_00_MIX_00_4_0_3_1 + } + else + { + MIX_00_4_3_1_6_1_1 + } + MIX_01_4_5_3_1 + MIX_10_4_7_3_1 + MIX_11_4_5_7_2_1_1 + break; + case 179: + case 147: + MIX_00_4_3_3_1 + if (isDifferent(w[1], w[5], trY, trU, trV, trA)) + { + MIX_01_4_2_3_1 + } + else + { + MIX_01_4_1_5_6_1_1 + } + MIX_10_4_7_3_2_1_1 + MIX_11_4_7_3_1 + break; + case 117: + case 116: + MIX_00_4_3_1_2_1_1 + MIX_01_4_1_3_1 + MIX_10_4_3_3_1 + if (isDifferent(w[5], w[7], trY, trU, trV, trA)) + { + MIX_11_4_8_3_1 + } + else + { + MIX_11_4_5_7_6_1_1 + } + break; + case 189: + MIX_00_4_1_3_1 + MIX_01_4_1_3_1 + MIX_10_4_7_3_1 + MIX_11_4_7_3_1 + break; + case 231: + MIX_00_4_3_3_1 + MIX_01_4_5_3_1 + MIX_10_4_3_3_1 + MIX_11_4_5_3_1 + break; + case 126: + MIX_00_MIX_00_4_0_3_1 + if (isDifferent(w[1], w[5], trY, trU, trV, trA)) + { + MIX_01_4 + } + else + { + MIX_01_4_1_5_2_1_1 + } + if (isDifferent(w[7], w[3], trY, trU, trV, trA)) + { + MIX_10_4 + } + else + { + MIX_10_4_7_3_2_1_1 + } + MIX_11_4_8_3_1 + break; + case 219: + if (isDifferent(w[3], w[1], trY, trU, trV, trA)) + { + MIX_00_4 + } + else + { + MIX_00_4_3_1_2_1_1 + } + MIX_01_4_2_3_1 + MIX_10_4_6_3_1 + if (isDifferent(w[5], w[7], trY, trU, trV, trA)) + { + MIX_11_4 + } + else + { + MIX_11_4_5_7_2_1_1 + } + break; + case 125: + if (isDifferent(w[7], w[3], trY, trU, trV, trA)) + { + MIX_00_4_1_3_1 + MIX_10_4 + } + else + { + MIX_00_4_3_1_5_2_1 + MIX_10_4_7_3_2_3_3 + } + MIX_01_4_1_3_1 + MIX_11_4_8_3_1 + break; + case 221: + MIX_00_4_1_3_1 + if (isDifferent(w[5], w[7], trY, trU, trV, trA)) + { + MIX_01_4_1_3_1 + MIX_11_4 + } + else + { + MIX_01_4_5_1_5_2_1 + MIX_11_4_5_7_2_3_3 + } + MIX_10_4_6_3_1 + break; + case 207: + if (isDifferent(w[3], w[1], trY, trU, trV, trA)) + { + MIX_00_4 + MIX_01_4_5_3_1 + } + else + { + MIX_00_4_3_1_2_3_3 + MIX_01_4_1_5_5_2_1 + } + MIX_10_4_6_3_1 + MIX_11_4_5_3_1 + break; + case 238: + MIX_00_MIX_00_4_0_3_1 + MIX_01_4_5_3_1 + if (isDifferent(w[7], w[3], trY, trU, trV, trA)) + { + MIX_10_4 + MIX_11_4_5_3_1 + } + else + { + MIX_10_4_7_3_2_3_3 + MIX_11_4_7_5_5_2_1 + } + break; + case 190: + MIX_00_MIX_00_4_0_3_1 + if (isDifferent(w[1], w[5], trY, trU, trV, trA)) + { + MIX_01_4 + MIX_11_4_7_3_1 + } + else + { + MIX_01_4_1_5_2_3_3 + MIX_11_4_5_7_5_2_1 + } + MIX_10_4_7_3_1 + break; + case 187: + if (isDifferent(w[3], w[1], trY, trU, trV, trA)) + { + MIX_00_4 + MIX_10_4_7_3_1 + } + else + { + MIX_00_4_3_1_2_3_3 + MIX_10_4_3_7_5_2_1 + } + MIX_01_4_2_3_1 + MIX_11_4_7_3_1 + break; + case 243: + MIX_00_4_3_3_1 + MIX_01_4_2_3_1 + if (isDifferent(w[5], w[7], trY, trU, trV, trA)) + { + MIX_10_4_3_3_1 + MIX_11_4 + } + else + { + MIX_10_4_7_3_5_2_1 + MIX_11_4_5_7_2_3_3 + } + break; + case 119: + if (isDifferent(w[1], w[5], trY, trU, trV, trA)) + { + MIX_00_4_3_3_1 + MIX_01_4 + } + else + { + MIX_00_4_1_3_5_2_1 + MIX_01_4_1_5_2_3_3 + } + MIX_10_4_3_3_1 + MIX_11_4_8_3_1 + break; + case 237: + case 233: + MIX_00_4_1_3_1 + MIX_01_4_1_5_2_1_1 + if (isDifferent(w[7], w[3], trY, trU, trV, trA)) + { + MIX_10_4 + } + else + { + MIX_10_4_6_3_10 + } + MIX_11_4_5_3_1 + break; + case 175: + case 47: + if (isDifferent(w[3], w[1], trY, trU, trV, trA)) + { + MIX_00_4 + } + else + { + MIX_00_MIX_00_4_0_3_10 + } + MIX_01_4_5_3_1 + MIX_10_4_7_3_1 + MIX_11_4_5_7_2_1_1 + break; + case 183: + case 151: + MIX_00_4_3_3_1 + if (isDifferent(w[1], w[5], trY, trU, trV, trA)) + { + MIX_01_4 + } + else + { + MIX_01_4_2_3_10 + } + MIX_10_4_7_3_2_1_1 + MIX_11_4_7_3_1 + break; + case 245: + case 244: + MIX_00_4_3_1_2_1_1 + MIX_01_4_1_3_1 + MIX_10_4_3_3_1 + if (isDifferent(w[5], w[7], trY, trU, trV, trA)) + { + MIX_11_4 + } + else + { + MIX_11_4_8_3_10 + } + break; + case 250: + MIX_00_MIX_00_4_0_3_1 + MIX_01_4_2_3_1 + if (isDifferent(w[7], w[3], trY, trU, trV, trA)) + { + MIX_10_4 + } + else + { + MIX_10_4_7_3_2_1_1 + } + if (isDifferent(w[5], w[7], trY, trU, trV, trA)) + { + MIX_11_4 + } + else + { + MIX_11_4_5_7_2_1_1 + } + break; + case 123: + if (isDifferent(w[3], w[1], trY, trU, trV, trA)) + { + MIX_00_4 + } + else + { + MIX_00_4_3_1_2_1_1 + } + MIX_01_4_2_3_1 + if (isDifferent(w[7], w[3], trY, trU, trV, trA)) + { + MIX_10_4 + } + else + { + MIX_10_4_7_3_2_1_1 + } + MIX_11_4_8_3_1 + break; + case 95: + if (isDifferent(w[3], w[1], trY, trU, trV, trA)) + { + MIX_00_4 + } + else + { + MIX_00_4_3_1_2_1_1 + } + if (isDifferent(w[1], w[5], trY, trU, trV, trA)) + { + MIX_01_4 + } + else + { + MIX_01_4_1_5_2_1_1 + } + MIX_10_4_6_3_1 + MIX_11_4_8_3_1 + break; + case 222: + MIX_00_MIX_00_4_0_3_1 + if (isDifferent(w[1], w[5], trY, trU, trV, trA)) + { + MIX_01_4 + } + else + { + MIX_01_4_1_5_2_1_1 + } + MIX_10_4_6_3_1 + if (isDifferent(w[5], w[7], trY, trU, trV, trA)) + { + MIX_11_4 + } + else + { + MIX_11_4_5_7_2_1_1 + } + break; + case 252: + MIX_00_4_0_1_2_1_1 + MIX_01_4_1_3_1 + if (isDifferent(w[7], w[3], trY, trU, trV, trA)) + { + MIX_10_4 + } + else + { + MIX_10_4_7_3_2_1_1 + } + if (isDifferent(w[5], w[7], trY, trU, trV, trA)) + { + MIX_11_4 + } + else + { + MIX_11_4_8_3_10 + } + break; + case 249: + MIX_00_4_1_3_1 + MIX_01_4_2_1_2_1_1 + if (isDifferent(w[7], w[3], trY, trU, trV, trA)) + { + MIX_10_4 + } + else + { + MIX_10_4_6_3_10 + } + if (isDifferent(w[5], w[7], trY, trU, trV, trA)) + { + MIX_11_4 + } + else + { + MIX_11_4_5_7_2_1_1 + } + break; + case 235: + if (isDifferent(w[3], w[1], trY, trU, trV, trA)) + { + MIX_00_4 + } + else + { + MIX_00_4_3_1_2_1_1 + } + MIX_01_4_2_5_2_1_1 + if (isDifferent(w[7], w[3], trY, trU, trV, trA)) + { + MIX_10_4 + } + else + { + MIX_10_4_6_3_10 + } + MIX_11_4_5_3_1 + break; + case 111: + if (isDifferent(w[3], w[1], trY, trU, trV, trA)) + { + MIX_00_4 + } + else + { + MIX_00_MIX_00_4_0_3_10 + } + MIX_01_4_5_3_1 + if (isDifferent(w[7], w[3], trY, trU, trV, trA)) + { + MIX_10_4 + } + else + { + MIX_10_4_7_3_2_1_1 + } + MIX_11_4_8_5_2_1_1 + break; + case 63: + if (isDifferent(w[3], w[1], trY, trU, trV, trA)) + { + MIX_00_4 + } + else + { + MIX_00_MIX_00_4_0_3_10 + } + if (isDifferent(w[1], w[5], trY, trU, trV, trA)) + { + MIX_01_4 + } + else + { + MIX_01_4_1_5_2_1_1 + } + MIX_10_4_7_3_1 + MIX_11_4_8_7_2_1_1 + break; + case 159: + if (isDifferent(w[3], w[1], trY, trU, trV, trA)) + { + MIX_00_4 + } + else + { + MIX_00_4_3_1_2_1_1 + } + if (isDifferent(w[1], w[5], trY, trU, trV, trA)) + { + MIX_01_4 + } + else + { + MIX_01_4_2_3_10 + } + MIX_10_4_6_7_2_1_1 + MIX_11_4_7_3_1 + break; + case 215: + MIX_00_4_3_3_1 + if (isDifferent(w[1], w[5], trY, trU, trV, trA)) + { + MIX_01_4 + } + else + { + MIX_01_4_2_3_10 + } + MIX_10_4_6_3_2_1_1 + if (isDifferent(w[5], w[7], trY, trU, trV, trA)) + { + MIX_11_4 + } + else + { + MIX_11_4_5_7_2_1_1 + } + break; + case 246: + MIX_00_4_0_3_2_1_1 + if (isDifferent(w[1], w[5], trY, trU, trV, trA)) + { + MIX_01_4 + } + else + { + MIX_01_4_1_5_2_1_1 + } + MIX_10_4_3_3_1 + if (isDifferent(w[5], w[7], trY, trU, trV, trA)) + { + MIX_11_4 + } + else + { + MIX_11_4_8_3_10 + } + break; + case 254: + MIX_00_MIX_00_4_0_3_1 + if (isDifferent(w[1], w[5], trY, trU, trV, trA)) + { + MIX_01_4 + } + else + { + MIX_01_4_1_5_2_1_1 + } + if (isDifferent(w[7], w[3], trY, trU, trV, trA)) + { + MIX_10_4 + } + else + { + MIX_10_4_7_3_2_1_1 + } + if (isDifferent(w[5], w[7], trY, trU, trV, trA)) + { + MIX_11_4 + } + else + { + MIX_11_4_8_3_10 + } + break; + case 253: + MIX_00_4_1_3_1 + MIX_01_4_1_3_1 + if (isDifferent(w[7], w[3], trY, trU, trV, trA)) + { + MIX_10_4 + } + else + { + MIX_10_4_6_3_10 + } + if (isDifferent(w[5], w[7], trY, trU, trV, trA)) + { + MIX_11_4 + } + else + { + MIX_11_4_8_3_10 + } + break; + case 251: + if (isDifferent(w[3], w[1], trY, trU, trV, trA)) + { + MIX_00_4 + } + else + { + MIX_00_4_3_1_2_1_1 + } + MIX_01_4_2_3_1 + if (isDifferent(w[7], w[3], trY, trU, trV, trA)) + { + MIX_10_4 + } + else + { + MIX_10_4_6_3_10 + } + if (isDifferent(w[5], w[7], trY, trU, trV, trA)) + { + MIX_11_4 + } + else + { + MIX_11_4_5_7_2_1_1 + } + break; + case 239: + if (isDifferent(w[3], w[1], trY, trU, trV, trA)) + { + MIX_00_4 + } + else + { + MIX_00_MIX_00_4_0_3_10 + } + MIX_01_4_5_3_1 + if (isDifferent(w[7], w[3], trY, trU, trV, trA)) + { + MIX_10_4 + } + else + { + MIX_10_4_6_3_10 + } + MIX_11_4_5_3_1 + break; + case 127: + if (isDifferent(w[3], w[1], trY, trU, trV, trA)) + { + MIX_00_4 + } + else + { + MIX_00_MIX_00_4_0_3_10 + } + if (isDifferent(w[1], w[5], trY, trU, trV, trA)) + { + MIX_01_4 + } + else + { + MIX_01_4_1_5_2_1_1 + } + if (isDifferent(w[7], w[3], trY, trU, trV, trA)) + { + MIX_10_4 + } + else + { + MIX_10_4_7_3_2_1_1 + } + MIX_11_4_8_3_1 + break; + case 191: + if (isDifferent(w[3], w[1], trY, trU, trV, trA)) + { + MIX_00_4 + } + else + { + MIX_00_MIX_00_4_0_3_10 + } + if (isDifferent(w[1], w[5], trY, trU, trV, trA)) + { + MIX_01_4 + } + else + { + MIX_01_4_2_3_10 + } + MIX_10_4_7_3_1 + MIX_11_4_7_3_1 + break; + case 223: + if (isDifferent(w[3], w[1], trY, trU, trV, trA)) + { + MIX_00_4 + } + else + { + MIX_00_4_3_1_2_1_1 + } + if (isDifferent(w[1], w[5], trY, trU, trV, trA)) + { + MIX_01_4 + } + else + { + MIX_01_4_2_3_10 + } + MIX_10_4_6_3_1 + if (isDifferent(w[5], w[7], trY, trU, trV, trA)) + { + MIX_11_4 + } + else + { + MIX_11_4_5_7_2_1_1 + } + break; + case 247: + MIX_00_4_3_3_1 + if (isDifferent(w[1], w[5], trY, trU, trV, trA)) + { + MIX_01_4 + } + else + { + MIX_01_4_2_3_10 + } + MIX_10_4_3_3_1 + if (isDifferent(w[5], w[7], trY, trU, trV, trA)) + { + MIX_11_4 + } + else + { + MIX_11_4_8_3_10 + } + break; + case 255: + if (isDifferent(w[3], w[1], trY, trU, trV, trA)) + MIX_00_4 + else + MIX_00_MIX_00_4_0_3_10 + + if (isDifferent(w[1], w[5], trY, trU, trV, trA)) + MIX_01_4 + else + MIX_01_4_2_3_10 + + if (isDifferent(w[7], w[3], trY, trU, trV, trA)) + MIX_10_4 + else + MIX_10_4_6_3_10 + + if (isDifferent(w[5], w[7], trY, trU, trV, trA)) + MIX_11_4 + else + MIX_11_4_8_3_10 + break; + } + image++; + output += 2; + } + output += lineSize; + } + + return output; +} diff --git a/core/hq2x.h b/core/hq2x.h new file mode 100644 index 00000000000..8f119d2a01a --- /dev/null +++ b/core/hq2x.h @@ -0,0 +1,19 @@ +#ifndef HQ2X_H +#define HQ2X_H + +#include "typedefs.h" + + +uint32_t *hq2x_resize( + const uint32_t *image, + uint32_t width, + uint32_t height, + uint32_t *output, + uint32_t trY = 0x30, + uint32_t trU = 0x07, + uint32_t trV = 0x06, + uint32_t trA = 0x50, + bool wrapX = false, + bool wrapY = false ); + +#endif // HQ2X_H diff --git a/core/image.cpp b/core/image.cpp index 8635aa1b29d..57496683ef5 100644 --- a/core/image.cpp +++ b/core/image.cpp @@ -30,7 +30,7 @@ #include "hash_map.h" #include "core/io/image_loader.h" #include "core/os/copymem.h" - +#include "hq2x.h" #include "print_string.h" #include @@ -901,6 +901,44 @@ static void _generate_po2_mipmap(const uint8_t* p_src, uint8_t* p_dst, uint32_t } +void Image::expand_x2_hq2x() { + + ERR_FAIL_COND(format>=FORMAT_INDEXED); + + Format current = format; + bool mipmaps=get_mipmaps(); + if (mipmaps) { + clear_mipmaps(); + } + + if (current!=FORMAT_RGBA) + convert(FORMAT_RGBA); + + DVector dest; + dest.resize(width*2*height*2*4); + + { + DVector::Read r = data.read(); + DVector::Write w = dest.write(); + + hq2x_resize((const uint32_t*)r.ptr(),width,height,(uint32_t*)w.ptr()); + + } + + width*=2; + height*=2; + data=dest; + + + if (current!=FORMAT_RGBA) + convert(current); + + if (mipmaps) { + generate_mipmaps(); + } + +} + void Image::shrink_x2() { ERR_FAIL_COND(format==FORMAT_INDEXED || format==FORMAT_INDEXED_ALPHA); diff --git a/core/image.h b/core/image.h index 35bbd1a6849..0f0b345eb95 100644 --- a/core/image.h +++ b/core/image.h @@ -250,6 +250,7 @@ public: void resize( int p_width, int p_height, Interpolation p_interpolation=INTERPOLATE_BILINEAR ); Image resized( int p_width, int p_height, int p_interpolation=INTERPOLATE_BILINEAR ); void shrink_x2(); + void expand_x2_hq2x(); /** * Crop the image to a specific size, if larger, then the image is filled by black */ diff --git a/drivers/SCsub b/drivers/SCsub index 7337482628c..79cbe506855 100644 --- a/drivers/SCsub +++ b/drivers/SCsub @@ -59,6 +59,8 @@ if (env['musepack']=='yes'): SConscript("mpc/SCsub"); if (env["squish"]=="yes" and env["tools"]=="yes"): SConscript("squish/SCsub"); +if (env["freetype"]!="no"): + SConscript("freetype/SCsub"); num = 0 cur_base = "" diff --git a/tools/freetype/SCsub b/drivers/freetype/SCsub similarity index 99% rename from tools/freetype/SCsub rename to drivers/freetype/SCsub index 65b4827f9c6..75e872a06fe 100644 --- a/tools/freetype/SCsub +++ b/drivers/freetype/SCsub @@ -66,4 +66,6 @@ if (env["freetype"]=="builtin"): # lib = env.Library("freetype_builtin",ft_sources) # env.Prepend(LIBS=[lib]) + + Export('env') diff --git a/tools/freetype/freetype/include/freetype/config/ftconfig.h b/drivers/freetype/freetype/include/freetype/config/ftconfig.h similarity index 100% rename from tools/freetype/freetype/include/freetype/config/ftconfig.h rename to drivers/freetype/freetype/include/freetype/config/ftconfig.h diff --git a/tools/freetype/freetype/include/freetype/config/ftheader.h b/drivers/freetype/freetype/include/freetype/config/ftheader.h similarity index 100% rename from tools/freetype/freetype/include/freetype/config/ftheader.h rename to drivers/freetype/freetype/include/freetype/config/ftheader.h diff --git a/tools/freetype/freetype/include/freetype/config/ftmodule.h b/drivers/freetype/freetype/include/freetype/config/ftmodule.h similarity index 100% rename from tools/freetype/freetype/include/freetype/config/ftmodule.h rename to drivers/freetype/freetype/include/freetype/config/ftmodule.h diff --git a/tools/freetype/freetype/include/freetype/config/ftoption.h b/drivers/freetype/freetype/include/freetype/config/ftoption.h similarity index 100% rename from tools/freetype/freetype/include/freetype/config/ftoption.h rename to drivers/freetype/freetype/include/freetype/config/ftoption.h diff --git a/tools/freetype/freetype/include/freetype/config/ftstdlib.h b/drivers/freetype/freetype/include/freetype/config/ftstdlib.h similarity index 100% rename from tools/freetype/freetype/include/freetype/config/ftstdlib.h rename to drivers/freetype/freetype/include/freetype/config/ftstdlib.h diff --git a/tools/freetype/freetype/include/freetype/freetype.h b/drivers/freetype/freetype/include/freetype/freetype.h similarity index 100% rename from tools/freetype/freetype/include/freetype/freetype.h rename to drivers/freetype/freetype/include/freetype/freetype.h diff --git a/tools/freetype/freetype/include/freetype/ftadvanc.h b/drivers/freetype/freetype/include/freetype/ftadvanc.h similarity index 100% rename from tools/freetype/freetype/include/freetype/ftadvanc.h rename to drivers/freetype/freetype/include/freetype/ftadvanc.h diff --git a/tools/freetype/freetype/include/freetype/ftautoh.h b/drivers/freetype/freetype/include/freetype/ftautoh.h similarity index 100% rename from tools/freetype/freetype/include/freetype/ftautoh.h rename to drivers/freetype/freetype/include/freetype/ftautoh.h diff --git a/tools/freetype/freetype/include/freetype/ftbbox.h b/drivers/freetype/freetype/include/freetype/ftbbox.h similarity index 100% rename from tools/freetype/freetype/include/freetype/ftbbox.h rename to drivers/freetype/freetype/include/freetype/ftbbox.h diff --git a/tools/freetype/freetype/include/freetype/ftbdf.h b/drivers/freetype/freetype/include/freetype/ftbdf.h similarity index 100% rename from tools/freetype/freetype/include/freetype/ftbdf.h rename to drivers/freetype/freetype/include/freetype/ftbdf.h diff --git a/tools/freetype/freetype/include/freetype/ftbitmap.h b/drivers/freetype/freetype/include/freetype/ftbitmap.h similarity index 100% rename from tools/freetype/freetype/include/freetype/ftbitmap.h rename to drivers/freetype/freetype/include/freetype/ftbitmap.h diff --git a/tools/freetype/freetype/include/freetype/ftbzip2.h b/drivers/freetype/freetype/include/freetype/ftbzip2.h similarity index 100% rename from tools/freetype/freetype/include/freetype/ftbzip2.h rename to drivers/freetype/freetype/include/freetype/ftbzip2.h diff --git a/tools/freetype/freetype/include/freetype/ftcache.h b/drivers/freetype/freetype/include/freetype/ftcache.h similarity index 100% rename from tools/freetype/freetype/include/freetype/ftcache.h rename to drivers/freetype/freetype/include/freetype/ftcache.h diff --git a/tools/freetype/freetype/include/freetype/ftcffdrv.h b/drivers/freetype/freetype/include/freetype/ftcffdrv.h similarity index 100% rename from tools/freetype/freetype/include/freetype/ftcffdrv.h rename to drivers/freetype/freetype/include/freetype/ftcffdrv.h diff --git a/tools/freetype/freetype/include/freetype/ftchapters.h b/drivers/freetype/freetype/include/freetype/ftchapters.h similarity index 100% rename from tools/freetype/freetype/include/freetype/ftchapters.h rename to drivers/freetype/freetype/include/freetype/ftchapters.h diff --git a/tools/freetype/freetype/include/freetype/ftcid.h b/drivers/freetype/freetype/include/freetype/ftcid.h similarity index 100% rename from tools/freetype/freetype/include/freetype/ftcid.h rename to drivers/freetype/freetype/include/freetype/ftcid.h diff --git a/tools/freetype/freetype/include/freetype/fterrdef.h b/drivers/freetype/freetype/include/freetype/fterrdef.h similarity index 100% rename from tools/freetype/freetype/include/freetype/fterrdef.h rename to drivers/freetype/freetype/include/freetype/fterrdef.h diff --git a/tools/freetype/freetype/include/freetype/fterrors.h b/drivers/freetype/freetype/include/freetype/fterrors.h similarity index 100% rename from tools/freetype/freetype/include/freetype/fterrors.h rename to drivers/freetype/freetype/include/freetype/fterrors.h diff --git a/tools/freetype/freetype/include/freetype/ftgasp.h b/drivers/freetype/freetype/include/freetype/ftgasp.h similarity index 100% rename from tools/freetype/freetype/include/freetype/ftgasp.h rename to drivers/freetype/freetype/include/freetype/ftgasp.h diff --git a/tools/freetype/freetype/include/freetype/ftglyph.h b/drivers/freetype/freetype/include/freetype/ftglyph.h similarity index 100% rename from tools/freetype/freetype/include/freetype/ftglyph.h rename to drivers/freetype/freetype/include/freetype/ftglyph.h diff --git a/tools/freetype/freetype/include/freetype/ftgxval.h b/drivers/freetype/freetype/include/freetype/ftgxval.h similarity index 100% rename from tools/freetype/freetype/include/freetype/ftgxval.h rename to drivers/freetype/freetype/include/freetype/ftgxval.h diff --git a/tools/freetype/freetype/include/freetype/ftgzip.h b/drivers/freetype/freetype/include/freetype/ftgzip.h similarity index 100% rename from tools/freetype/freetype/include/freetype/ftgzip.h rename to drivers/freetype/freetype/include/freetype/ftgzip.h diff --git a/tools/freetype/freetype/include/freetype/ftimage.h b/drivers/freetype/freetype/include/freetype/ftimage.h similarity index 100% rename from tools/freetype/freetype/include/freetype/ftimage.h rename to drivers/freetype/freetype/include/freetype/ftimage.h diff --git a/tools/freetype/freetype/include/freetype/ftincrem.h b/drivers/freetype/freetype/include/freetype/ftincrem.h similarity index 100% rename from tools/freetype/freetype/include/freetype/ftincrem.h rename to drivers/freetype/freetype/include/freetype/ftincrem.h diff --git a/tools/freetype/freetype/include/freetype/ftlcdfil.h b/drivers/freetype/freetype/include/freetype/ftlcdfil.h similarity index 100% rename from tools/freetype/freetype/include/freetype/ftlcdfil.h rename to drivers/freetype/freetype/include/freetype/ftlcdfil.h diff --git a/tools/freetype/freetype/include/freetype/ftlist.h b/drivers/freetype/freetype/include/freetype/ftlist.h similarity index 100% rename from tools/freetype/freetype/include/freetype/ftlist.h rename to drivers/freetype/freetype/include/freetype/ftlist.h diff --git a/tools/freetype/freetype/include/freetype/ftlzw.h b/drivers/freetype/freetype/include/freetype/ftlzw.h similarity index 100% rename from tools/freetype/freetype/include/freetype/ftlzw.h rename to drivers/freetype/freetype/include/freetype/ftlzw.h diff --git a/tools/freetype/freetype/include/freetype/ftmac.h b/drivers/freetype/freetype/include/freetype/ftmac.h similarity index 100% rename from tools/freetype/freetype/include/freetype/ftmac.h rename to drivers/freetype/freetype/include/freetype/ftmac.h diff --git a/tools/freetype/freetype/include/freetype/ftmm.h b/drivers/freetype/freetype/include/freetype/ftmm.h similarity index 100% rename from tools/freetype/freetype/include/freetype/ftmm.h rename to drivers/freetype/freetype/include/freetype/ftmm.h diff --git a/tools/freetype/freetype/include/freetype/ftmodapi.h b/drivers/freetype/freetype/include/freetype/ftmodapi.h similarity index 100% rename from tools/freetype/freetype/include/freetype/ftmodapi.h rename to drivers/freetype/freetype/include/freetype/ftmodapi.h diff --git a/tools/freetype/freetype/include/freetype/ftmoderr.h b/drivers/freetype/freetype/include/freetype/ftmoderr.h similarity index 100% rename from tools/freetype/freetype/include/freetype/ftmoderr.h rename to drivers/freetype/freetype/include/freetype/ftmoderr.h diff --git a/tools/freetype/freetype/include/freetype/ftotval.h b/drivers/freetype/freetype/include/freetype/ftotval.h similarity index 100% rename from tools/freetype/freetype/include/freetype/ftotval.h rename to drivers/freetype/freetype/include/freetype/ftotval.h diff --git a/tools/freetype/freetype/include/freetype/ftoutln.h b/drivers/freetype/freetype/include/freetype/ftoutln.h similarity index 100% rename from tools/freetype/freetype/include/freetype/ftoutln.h rename to drivers/freetype/freetype/include/freetype/ftoutln.h diff --git a/tools/freetype/freetype/include/freetype/ftpfr.h b/drivers/freetype/freetype/include/freetype/ftpfr.h similarity index 100% rename from tools/freetype/freetype/include/freetype/ftpfr.h rename to drivers/freetype/freetype/include/freetype/ftpfr.h diff --git a/tools/freetype/freetype/include/freetype/ftrender.h b/drivers/freetype/freetype/include/freetype/ftrender.h similarity index 100% rename from tools/freetype/freetype/include/freetype/ftrender.h rename to drivers/freetype/freetype/include/freetype/ftrender.h diff --git a/tools/freetype/freetype/include/freetype/ftsizes.h b/drivers/freetype/freetype/include/freetype/ftsizes.h similarity index 100% rename from tools/freetype/freetype/include/freetype/ftsizes.h rename to drivers/freetype/freetype/include/freetype/ftsizes.h diff --git a/tools/freetype/freetype/include/freetype/ftsnames.h b/drivers/freetype/freetype/include/freetype/ftsnames.h similarity index 100% rename from tools/freetype/freetype/include/freetype/ftsnames.h rename to drivers/freetype/freetype/include/freetype/ftsnames.h diff --git a/tools/freetype/freetype/include/freetype/ftstroke.h b/drivers/freetype/freetype/include/freetype/ftstroke.h similarity index 100% rename from tools/freetype/freetype/include/freetype/ftstroke.h rename to drivers/freetype/freetype/include/freetype/ftstroke.h diff --git a/tools/freetype/freetype/include/freetype/ftsynth.h b/drivers/freetype/freetype/include/freetype/ftsynth.h similarity index 100% rename from tools/freetype/freetype/include/freetype/ftsynth.h rename to drivers/freetype/freetype/include/freetype/ftsynth.h diff --git a/tools/freetype/freetype/include/freetype/ftsystem.h b/drivers/freetype/freetype/include/freetype/ftsystem.h similarity index 100% rename from tools/freetype/freetype/include/freetype/ftsystem.h rename to drivers/freetype/freetype/include/freetype/ftsystem.h diff --git a/tools/freetype/freetype/include/freetype/fttrigon.h b/drivers/freetype/freetype/include/freetype/fttrigon.h similarity index 100% rename from tools/freetype/freetype/include/freetype/fttrigon.h rename to drivers/freetype/freetype/include/freetype/fttrigon.h diff --git a/tools/freetype/freetype/include/freetype/ftttdrv.h b/drivers/freetype/freetype/include/freetype/ftttdrv.h similarity index 100% rename from tools/freetype/freetype/include/freetype/ftttdrv.h rename to drivers/freetype/freetype/include/freetype/ftttdrv.h diff --git a/tools/freetype/freetype/include/freetype/fttypes.h b/drivers/freetype/freetype/include/freetype/fttypes.h similarity index 100% rename from tools/freetype/freetype/include/freetype/fttypes.h rename to drivers/freetype/freetype/include/freetype/fttypes.h diff --git a/tools/freetype/freetype/include/freetype/ftwinfnt.h b/drivers/freetype/freetype/include/freetype/ftwinfnt.h similarity index 100% rename from tools/freetype/freetype/include/freetype/ftwinfnt.h rename to drivers/freetype/freetype/include/freetype/ftwinfnt.h diff --git a/tools/freetype/freetype/include/freetype/ftxf86.h b/drivers/freetype/freetype/include/freetype/ftxf86.h similarity index 100% rename from tools/freetype/freetype/include/freetype/ftxf86.h rename to drivers/freetype/freetype/include/freetype/ftxf86.h diff --git a/tools/freetype/freetype/include/freetype/internal/autohint.h b/drivers/freetype/freetype/include/freetype/internal/autohint.h similarity index 100% rename from tools/freetype/freetype/include/freetype/internal/autohint.h rename to drivers/freetype/freetype/include/freetype/internal/autohint.h diff --git a/tools/freetype/freetype/include/freetype/internal/ftcalc.h b/drivers/freetype/freetype/include/freetype/internal/ftcalc.h similarity index 100% rename from tools/freetype/freetype/include/freetype/internal/ftcalc.h rename to drivers/freetype/freetype/include/freetype/internal/ftcalc.h diff --git a/tools/freetype/freetype/include/freetype/internal/ftdebug.h b/drivers/freetype/freetype/include/freetype/internal/ftdebug.h similarity index 100% rename from tools/freetype/freetype/include/freetype/internal/ftdebug.h rename to drivers/freetype/freetype/include/freetype/internal/ftdebug.h diff --git a/tools/freetype/freetype/include/freetype/internal/ftdriver.h b/drivers/freetype/freetype/include/freetype/internal/ftdriver.h similarity index 100% rename from tools/freetype/freetype/include/freetype/internal/ftdriver.h rename to drivers/freetype/freetype/include/freetype/internal/ftdriver.h diff --git a/tools/freetype/freetype/include/freetype/internal/ftgloadr.h b/drivers/freetype/freetype/include/freetype/internal/ftgloadr.h similarity index 100% rename from tools/freetype/freetype/include/freetype/internal/ftgloadr.h rename to drivers/freetype/freetype/include/freetype/internal/ftgloadr.h diff --git a/tools/freetype/freetype/include/freetype/internal/ftmemory.h b/drivers/freetype/freetype/include/freetype/internal/ftmemory.h similarity index 100% rename from tools/freetype/freetype/include/freetype/internal/ftmemory.h rename to drivers/freetype/freetype/include/freetype/internal/ftmemory.h diff --git a/tools/freetype/freetype/include/freetype/internal/ftobjs.h b/drivers/freetype/freetype/include/freetype/internal/ftobjs.h similarity index 100% rename from tools/freetype/freetype/include/freetype/internal/ftobjs.h rename to drivers/freetype/freetype/include/freetype/internal/ftobjs.h diff --git a/tools/freetype/freetype/include/freetype/internal/ftpic.h b/drivers/freetype/freetype/include/freetype/internal/ftpic.h similarity index 100% rename from tools/freetype/freetype/include/freetype/internal/ftpic.h rename to drivers/freetype/freetype/include/freetype/internal/ftpic.h diff --git a/tools/freetype/freetype/include/freetype/internal/ftrfork.h b/drivers/freetype/freetype/include/freetype/internal/ftrfork.h similarity index 100% rename from tools/freetype/freetype/include/freetype/internal/ftrfork.h rename to drivers/freetype/freetype/include/freetype/internal/ftrfork.h diff --git a/tools/freetype/freetype/include/freetype/internal/ftserv.h b/drivers/freetype/freetype/include/freetype/internal/ftserv.h similarity index 100% rename from tools/freetype/freetype/include/freetype/internal/ftserv.h rename to drivers/freetype/freetype/include/freetype/internal/ftserv.h diff --git a/tools/freetype/freetype/include/freetype/internal/ftstream.h b/drivers/freetype/freetype/include/freetype/internal/ftstream.h similarity index 100% rename from tools/freetype/freetype/include/freetype/internal/ftstream.h rename to drivers/freetype/freetype/include/freetype/internal/ftstream.h diff --git a/tools/freetype/freetype/include/freetype/internal/fttrace.h b/drivers/freetype/freetype/include/freetype/internal/fttrace.h similarity index 100% rename from tools/freetype/freetype/include/freetype/internal/fttrace.h rename to drivers/freetype/freetype/include/freetype/internal/fttrace.h diff --git a/tools/freetype/freetype/include/freetype/internal/ftvalid.h b/drivers/freetype/freetype/include/freetype/internal/ftvalid.h similarity index 100% rename from tools/freetype/freetype/include/freetype/internal/ftvalid.h rename to drivers/freetype/freetype/include/freetype/internal/ftvalid.h diff --git a/tools/freetype/freetype/include/freetype/internal/internal.h b/drivers/freetype/freetype/include/freetype/internal/internal.h similarity index 100% rename from tools/freetype/freetype/include/freetype/internal/internal.h rename to drivers/freetype/freetype/include/freetype/internal/internal.h diff --git a/tools/freetype/freetype/include/freetype/internal/psaux.h b/drivers/freetype/freetype/include/freetype/internal/psaux.h similarity index 100% rename from tools/freetype/freetype/include/freetype/internal/psaux.h rename to drivers/freetype/freetype/include/freetype/internal/psaux.h diff --git a/tools/freetype/freetype/include/freetype/internal/pshints.h b/drivers/freetype/freetype/include/freetype/internal/pshints.h similarity index 100% rename from tools/freetype/freetype/include/freetype/internal/pshints.h rename to drivers/freetype/freetype/include/freetype/internal/pshints.h diff --git a/tools/freetype/freetype/include/freetype/internal/services/svbdf.h b/drivers/freetype/freetype/include/freetype/internal/services/svbdf.h similarity index 100% rename from tools/freetype/freetype/include/freetype/internal/services/svbdf.h rename to drivers/freetype/freetype/include/freetype/internal/services/svbdf.h diff --git a/tools/freetype/freetype/include/freetype/internal/services/svcid.h b/drivers/freetype/freetype/include/freetype/internal/services/svcid.h similarity index 100% rename from tools/freetype/freetype/include/freetype/internal/services/svcid.h rename to drivers/freetype/freetype/include/freetype/internal/services/svcid.h diff --git a/tools/freetype/freetype/include/freetype/internal/services/svgldict.h b/drivers/freetype/freetype/include/freetype/internal/services/svgldict.h similarity index 100% rename from tools/freetype/freetype/include/freetype/internal/services/svgldict.h rename to drivers/freetype/freetype/include/freetype/internal/services/svgldict.h diff --git a/tools/freetype/freetype/include/freetype/internal/services/svgxval.h b/drivers/freetype/freetype/include/freetype/internal/services/svgxval.h similarity index 100% rename from tools/freetype/freetype/include/freetype/internal/services/svgxval.h rename to drivers/freetype/freetype/include/freetype/internal/services/svgxval.h diff --git a/tools/freetype/freetype/include/freetype/internal/services/svkern.h b/drivers/freetype/freetype/include/freetype/internal/services/svkern.h similarity index 100% rename from tools/freetype/freetype/include/freetype/internal/services/svkern.h rename to drivers/freetype/freetype/include/freetype/internal/services/svkern.h diff --git a/tools/freetype/freetype/include/freetype/internal/services/svmm.h b/drivers/freetype/freetype/include/freetype/internal/services/svmm.h similarity index 100% rename from tools/freetype/freetype/include/freetype/internal/services/svmm.h rename to drivers/freetype/freetype/include/freetype/internal/services/svmm.h diff --git a/tools/freetype/freetype/include/freetype/internal/services/svotval.h b/drivers/freetype/freetype/include/freetype/internal/services/svotval.h similarity index 100% rename from tools/freetype/freetype/include/freetype/internal/services/svotval.h rename to drivers/freetype/freetype/include/freetype/internal/services/svotval.h diff --git a/tools/freetype/freetype/include/freetype/internal/services/svpfr.h b/drivers/freetype/freetype/include/freetype/internal/services/svpfr.h similarity index 100% rename from tools/freetype/freetype/include/freetype/internal/services/svpfr.h rename to drivers/freetype/freetype/include/freetype/internal/services/svpfr.h diff --git a/tools/freetype/freetype/include/freetype/internal/services/svpostnm.h b/drivers/freetype/freetype/include/freetype/internal/services/svpostnm.h similarity index 100% rename from tools/freetype/freetype/include/freetype/internal/services/svpostnm.h rename to drivers/freetype/freetype/include/freetype/internal/services/svpostnm.h diff --git a/tools/freetype/freetype/include/freetype/internal/services/svprop.h b/drivers/freetype/freetype/include/freetype/internal/services/svprop.h similarity index 100% rename from tools/freetype/freetype/include/freetype/internal/services/svprop.h rename to drivers/freetype/freetype/include/freetype/internal/services/svprop.h diff --git a/tools/freetype/freetype/include/freetype/internal/services/svpscmap.h b/drivers/freetype/freetype/include/freetype/internal/services/svpscmap.h similarity index 100% rename from tools/freetype/freetype/include/freetype/internal/services/svpscmap.h rename to drivers/freetype/freetype/include/freetype/internal/services/svpscmap.h diff --git a/tools/freetype/freetype/include/freetype/internal/services/svpsinfo.h b/drivers/freetype/freetype/include/freetype/internal/services/svpsinfo.h similarity index 100% rename from tools/freetype/freetype/include/freetype/internal/services/svpsinfo.h rename to drivers/freetype/freetype/include/freetype/internal/services/svpsinfo.h diff --git a/tools/freetype/freetype/include/freetype/internal/services/svsfnt.h b/drivers/freetype/freetype/include/freetype/internal/services/svsfnt.h similarity index 100% rename from tools/freetype/freetype/include/freetype/internal/services/svsfnt.h rename to drivers/freetype/freetype/include/freetype/internal/services/svsfnt.h diff --git a/tools/freetype/freetype/include/freetype/internal/services/svttcmap.h b/drivers/freetype/freetype/include/freetype/internal/services/svttcmap.h similarity index 100% rename from tools/freetype/freetype/include/freetype/internal/services/svttcmap.h rename to drivers/freetype/freetype/include/freetype/internal/services/svttcmap.h diff --git a/tools/freetype/freetype/include/freetype/internal/services/svtteng.h b/drivers/freetype/freetype/include/freetype/internal/services/svtteng.h similarity index 100% rename from tools/freetype/freetype/include/freetype/internal/services/svtteng.h rename to drivers/freetype/freetype/include/freetype/internal/services/svtteng.h diff --git a/tools/freetype/freetype/include/freetype/internal/services/svttglyf.h b/drivers/freetype/freetype/include/freetype/internal/services/svttglyf.h similarity index 100% rename from tools/freetype/freetype/include/freetype/internal/services/svttglyf.h rename to drivers/freetype/freetype/include/freetype/internal/services/svttglyf.h diff --git a/tools/freetype/freetype/include/freetype/internal/services/svwinfnt.h b/drivers/freetype/freetype/include/freetype/internal/services/svwinfnt.h similarity index 100% rename from tools/freetype/freetype/include/freetype/internal/services/svwinfnt.h rename to drivers/freetype/freetype/include/freetype/internal/services/svwinfnt.h diff --git a/tools/freetype/freetype/include/freetype/internal/services/svxf86nm.h b/drivers/freetype/freetype/include/freetype/internal/services/svxf86nm.h similarity index 100% rename from tools/freetype/freetype/include/freetype/internal/services/svxf86nm.h rename to drivers/freetype/freetype/include/freetype/internal/services/svxf86nm.h diff --git a/tools/freetype/freetype/include/freetype/internal/sfnt.h b/drivers/freetype/freetype/include/freetype/internal/sfnt.h similarity index 100% rename from tools/freetype/freetype/include/freetype/internal/sfnt.h rename to drivers/freetype/freetype/include/freetype/internal/sfnt.h diff --git a/tools/freetype/freetype/include/freetype/internal/t1types.h b/drivers/freetype/freetype/include/freetype/internal/t1types.h similarity index 100% rename from tools/freetype/freetype/include/freetype/internal/t1types.h rename to drivers/freetype/freetype/include/freetype/internal/t1types.h diff --git a/tools/freetype/freetype/include/freetype/internal/tttypes.h b/drivers/freetype/freetype/include/freetype/internal/tttypes.h similarity index 100% rename from tools/freetype/freetype/include/freetype/internal/tttypes.h rename to drivers/freetype/freetype/include/freetype/internal/tttypes.h diff --git a/tools/freetype/freetype/include/freetype/t1tables.h b/drivers/freetype/freetype/include/freetype/t1tables.h similarity index 100% rename from tools/freetype/freetype/include/freetype/t1tables.h rename to drivers/freetype/freetype/include/freetype/t1tables.h diff --git a/tools/freetype/freetype/include/freetype/ttnameid.h b/drivers/freetype/freetype/include/freetype/ttnameid.h similarity index 100% rename from tools/freetype/freetype/include/freetype/ttnameid.h rename to drivers/freetype/freetype/include/freetype/ttnameid.h diff --git a/tools/freetype/freetype/include/freetype/tttables.h b/drivers/freetype/freetype/include/freetype/tttables.h similarity index 100% rename from tools/freetype/freetype/include/freetype/tttables.h rename to drivers/freetype/freetype/include/freetype/tttables.h diff --git a/tools/freetype/freetype/include/freetype/tttags.h b/drivers/freetype/freetype/include/freetype/tttags.h similarity index 100% rename from tools/freetype/freetype/include/freetype/tttags.h rename to drivers/freetype/freetype/include/freetype/tttags.h diff --git a/tools/freetype/freetype/include/freetype/ttunpat.h b/drivers/freetype/freetype/include/freetype/ttunpat.h similarity index 100% rename from tools/freetype/freetype/include/freetype/ttunpat.h rename to drivers/freetype/freetype/include/freetype/ttunpat.h diff --git a/tools/freetype/freetype/include/ftoption.h b/drivers/freetype/freetype/include/ftoption.h similarity index 100% rename from tools/freetype/freetype/include/ftoption.h rename to drivers/freetype/freetype/include/ftoption.h diff --git a/tools/freetype/freetype/src/Jamfile b/drivers/freetype/freetype/src/Jamfile similarity index 100% rename from tools/freetype/freetype/src/Jamfile rename to drivers/freetype/freetype/src/Jamfile diff --git a/tools/freetype/freetype/src/autofit/Jamfile b/drivers/freetype/freetype/src/autofit/Jamfile similarity index 100% rename from tools/freetype/freetype/src/autofit/Jamfile rename to drivers/freetype/freetype/src/autofit/Jamfile diff --git a/tools/freetype/freetype/src/autofit/afangles.c b/drivers/freetype/freetype/src/autofit/afangles.c similarity index 100% rename from tools/freetype/freetype/src/autofit/afangles.c rename to drivers/freetype/freetype/src/autofit/afangles.c diff --git a/tools/freetype/freetype/src/autofit/afangles.h b/drivers/freetype/freetype/src/autofit/afangles.h similarity index 100% rename from tools/freetype/freetype/src/autofit/afangles.h rename to drivers/freetype/freetype/src/autofit/afangles.h diff --git a/tools/freetype/freetype/src/autofit/afcjk.c b/drivers/freetype/freetype/src/autofit/afcjk.c similarity index 100% rename from tools/freetype/freetype/src/autofit/afcjk.c rename to drivers/freetype/freetype/src/autofit/afcjk.c diff --git a/tools/freetype/freetype/src/autofit/afcjk.h b/drivers/freetype/freetype/src/autofit/afcjk.h similarity index 100% rename from tools/freetype/freetype/src/autofit/afcjk.h rename to drivers/freetype/freetype/src/autofit/afcjk.h diff --git a/tools/freetype/freetype/src/autofit/afdummy.c b/drivers/freetype/freetype/src/autofit/afdummy.c similarity index 100% rename from tools/freetype/freetype/src/autofit/afdummy.c rename to drivers/freetype/freetype/src/autofit/afdummy.c diff --git a/tools/freetype/freetype/src/autofit/afdummy.h b/drivers/freetype/freetype/src/autofit/afdummy.h similarity index 100% rename from tools/freetype/freetype/src/autofit/afdummy.h rename to drivers/freetype/freetype/src/autofit/afdummy.h diff --git a/tools/freetype/freetype/src/autofit/aferrors.h b/drivers/freetype/freetype/src/autofit/aferrors.h similarity index 100% rename from tools/freetype/freetype/src/autofit/aferrors.h rename to drivers/freetype/freetype/src/autofit/aferrors.h diff --git a/tools/freetype/freetype/src/autofit/afglobal.c b/drivers/freetype/freetype/src/autofit/afglobal.c similarity index 100% rename from tools/freetype/freetype/src/autofit/afglobal.c rename to drivers/freetype/freetype/src/autofit/afglobal.c diff --git a/tools/freetype/freetype/src/autofit/afglobal.h b/drivers/freetype/freetype/src/autofit/afglobal.h similarity index 100% rename from tools/freetype/freetype/src/autofit/afglobal.h rename to drivers/freetype/freetype/src/autofit/afglobal.h diff --git a/tools/freetype/freetype/src/autofit/afhints.c b/drivers/freetype/freetype/src/autofit/afhints.c similarity index 100% rename from tools/freetype/freetype/src/autofit/afhints.c rename to drivers/freetype/freetype/src/autofit/afhints.c diff --git a/tools/freetype/freetype/src/autofit/afhints.h b/drivers/freetype/freetype/src/autofit/afhints.h similarity index 100% rename from tools/freetype/freetype/src/autofit/afhints.h rename to drivers/freetype/freetype/src/autofit/afhints.h diff --git a/tools/freetype/freetype/src/autofit/afindic.c b/drivers/freetype/freetype/src/autofit/afindic.c similarity index 100% rename from tools/freetype/freetype/src/autofit/afindic.c rename to drivers/freetype/freetype/src/autofit/afindic.c diff --git a/tools/freetype/freetype/src/autofit/afindic.h b/drivers/freetype/freetype/src/autofit/afindic.h similarity index 100% rename from tools/freetype/freetype/src/autofit/afindic.h rename to drivers/freetype/freetype/src/autofit/afindic.h diff --git a/tools/freetype/freetype/src/autofit/aflatin.c b/drivers/freetype/freetype/src/autofit/aflatin.c similarity index 100% rename from tools/freetype/freetype/src/autofit/aflatin.c rename to drivers/freetype/freetype/src/autofit/aflatin.c diff --git a/tools/freetype/freetype/src/autofit/aflatin.h b/drivers/freetype/freetype/src/autofit/aflatin.h similarity index 100% rename from tools/freetype/freetype/src/autofit/aflatin.h rename to drivers/freetype/freetype/src/autofit/aflatin.h diff --git a/tools/freetype/freetype/src/autofit/aflatin2.c b/drivers/freetype/freetype/src/autofit/aflatin2.c similarity index 100% rename from tools/freetype/freetype/src/autofit/aflatin2.c rename to drivers/freetype/freetype/src/autofit/aflatin2.c diff --git a/tools/freetype/freetype/src/autofit/aflatin2.h b/drivers/freetype/freetype/src/autofit/aflatin2.h similarity index 100% rename from tools/freetype/freetype/src/autofit/aflatin2.h rename to drivers/freetype/freetype/src/autofit/aflatin2.h diff --git a/tools/freetype/freetype/src/autofit/afloader.c b/drivers/freetype/freetype/src/autofit/afloader.c similarity index 100% rename from tools/freetype/freetype/src/autofit/afloader.c rename to drivers/freetype/freetype/src/autofit/afloader.c diff --git a/tools/freetype/freetype/src/autofit/afloader.h b/drivers/freetype/freetype/src/autofit/afloader.h similarity index 100% rename from tools/freetype/freetype/src/autofit/afloader.h rename to drivers/freetype/freetype/src/autofit/afloader.h diff --git a/tools/freetype/freetype/src/autofit/afmodule.c b/drivers/freetype/freetype/src/autofit/afmodule.c similarity index 100% rename from tools/freetype/freetype/src/autofit/afmodule.c rename to drivers/freetype/freetype/src/autofit/afmodule.c diff --git a/tools/freetype/freetype/src/autofit/afmodule.h b/drivers/freetype/freetype/src/autofit/afmodule.h similarity index 100% rename from tools/freetype/freetype/src/autofit/afmodule.h rename to drivers/freetype/freetype/src/autofit/afmodule.h diff --git a/tools/freetype/freetype/src/autofit/afpic.c b/drivers/freetype/freetype/src/autofit/afpic.c similarity index 100% rename from tools/freetype/freetype/src/autofit/afpic.c rename to drivers/freetype/freetype/src/autofit/afpic.c diff --git a/tools/freetype/freetype/src/autofit/afpic.h b/drivers/freetype/freetype/src/autofit/afpic.h similarity index 100% rename from tools/freetype/freetype/src/autofit/afpic.h rename to drivers/freetype/freetype/src/autofit/afpic.h diff --git a/tools/freetype/freetype/src/autofit/aftypes.h b/drivers/freetype/freetype/src/autofit/aftypes.h similarity index 100% rename from tools/freetype/freetype/src/autofit/aftypes.h rename to drivers/freetype/freetype/src/autofit/aftypes.h diff --git a/tools/freetype/freetype/src/autofit/afwarp.c b/drivers/freetype/freetype/src/autofit/afwarp.c similarity index 100% rename from tools/freetype/freetype/src/autofit/afwarp.c rename to drivers/freetype/freetype/src/autofit/afwarp.c diff --git a/tools/freetype/freetype/src/autofit/afwarp.h b/drivers/freetype/freetype/src/autofit/afwarp.h similarity index 100% rename from tools/freetype/freetype/src/autofit/afwarp.h rename to drivers/freetype/freetype/src/autofit/afwarp.h diff --git a/tools/freetype/freetype/src/autofit/autofit.c b/drivers/freetype/freetype/src/autofit/autofit.c similarity index 100% rename from tools/freetype/freetype/src/autofit/autofit.c rename to drivers/freetype/freetype/src/autofit/autofit.c diff --git a/tools/freetype/freetype/src/autofit/module.mk b/drivers/freetype/freetype/src/autofit/module.mk similarity index 100% rename from tools/freetype/freetype/src/autofit/module.mk rename to drivers/freetype/freetype/src/autofit/module.mk diff --git a/tools/freetype/freetype/src/autofit/rules.mk b/drivers/freetype/freetype/src/autofit/rules.mk similarity index 100% rename from tools/freetype/freetype/src/autofit/rules.mk rename to drivers/freetype/freetype/src/autofit/rules.mk diff --git a/tools/freetype/freetype/src/base/Jamfile b/drivers/freetype/freetype/src/base/Jamfile similarity index 100% rename from tools/freetype/freetype/src/base/Jamfile rename to drivers/freetype/freetype/src/base/Jamfile diff --git a/tools/freetype/freetype/src/base/basepic.c b/drivers/freetype/freetype/src/base/basepic.c similarity index 100% rename from tools/freetype/freetype/src/base/basepic.c rename to drivers/freetype/freetype/src/base/basepic.c diff --git a/tools/freetype/freetype/src/base/basepic.h b/drivers/freetype/freetype/src/base/basepic.h similarity index 100% rename from tools/freetype/freetype/src/base/basepic.h rename to drivers/freetype/freetype/src/base/basepic.h diff --git a/tools/freetype/freetype/src/base/ftadvanc.c b/drivers/freetype/freetype/src/base/ftadvanc.c similarity index 100% rename from tools/freetype/freetype/src/base/ftadvanc.c rename to drivers/freetype/freetype/src/base/ftadvanc.c diff --git a/tools/freetype/freetype/src/base/ftapi.c b/drivers/freetype/freetype/src/base/ftapi.c similarity index 100% rename from tools/freetype/freetype/src/base/ftapi.c rename to drivers/freetype/freetype/src/base/ftapi.c diff --git a/tools/freetype/freetype/src/base/ftbase.c b/drivers/freetype/freetype/src/base/ftbase.c similarity index 100% rename from tools/freetype/freetype/src/base/ftbase.c rename to drivers/freetype/freetype/src/base/ftbase.c diff --git a/tools/freetype/freetype/src/base/ftbase.h b/drivers/freetype/freetype/src/base/ftbase.h similarity index 100% rename from tools/freetype/freetype/src/base/ftbase.h rename to drivers/freetype/freetype/src/base/ftbase.h diff --git a/tools/freetype/freetype/src/base/ftbbox.c b/drivers/freetype/freetype/src/base/ftbbox.c similarity index 100% rename from tools/freetype/freetype/src/base/ftbbox.c rename to drivers/freetype/freetype/src/base/ftbbox.c diff --git a/tools/freetype/freetype/src/base/ftbdf.c b/drivers/freetype/freetype/src/base/ftbdf.c similarity index 100% rename from tools/freetype/freetype/src/base/ftbdf.c rename to drivers/freetype/freetype/src/base/ftbdf.c diff --git a/tools/freetype/freetype/src/base/ftbitmap.c b/drivers/freetype/freetype/src/base/ftbitmap.c similarity index 100% rename from tools/freetype/freetype/src/base/ftbitmap.c rename to drivers/freetype/freetype/src/base/ftbitmap.c diff --git a/tools/freetype/freetype/src/base/ftcalc.c b/drivers/freetype/freetype/src/base/ftcalc.c similarity index 100% rename from tools/freetype/freetype/src/base/ftcalc.c rename to drivers/freetype/freetype/src/base/ftcalc.c diff --git a/tools/freetype/freetype/src/base/ftcid.c b/drivers/freetype/freetype/src/base/ftcid.c similarity index 100% rename from tools/freetype/freetype/src/base/ftcid.c rename to drivers/freetype/freetype/src/base/ftcid.c diff --git a/tools/freetype/freetype/src/base/ftdbgmem.c b/drivers/freetype/freetype/src/base/ftdbgmem.c similarity index 100% rename from tools/freetype/freetype/src/base/ftdbgmem.c rename to drivers/freetype/freetype/src/base/ftdbgmem.c diff --git a/tools/freetype/freetype/src/base/ftdebug.c b/drivers/freetype/freetype/src/base/ftdebug.c similarity index 100% rename from tools/freetype/freetype/src/base/ftdebug.c rename to drivers/freetype/freetype/src/base/ftdebug.c diff --git a/tools/freetype/freetype/src/base/ftfstype.c b/drivers/freetype/freetype/src/base/ftfstype.c similarity index 100% rename from tools/freetype/freetype/src/base/ftfstype.c rename to drivers/freetype/freetype/src/base/ftfstype.c diff --git a/tools/freetype/freetype/src/base/ftgasp.c b/drivers/freetype/freetype/src/base/ftgasp.c similarity index 100% rename from tools/freetype/freetype/src/base/ftgasp.c rename to drivers/freetype/freetype/src/base/ftgasp.c diff --git a/tools/freetype/freetype/src/base/ftgloadr.c b/drivers/freetype/freetype/src/base/ftgloadr.c similarity index 100% rename from tools/freetype/freetype/src/base/ftgloadr.c rename to drivers/freetype/freetype/src/base/ftgloadr.c diff --git a/tools/freetype/freetype/src/base/ftglyph.c b/drivers/freetype/freetype/src/base/ftglyph.c similarity index 100% rename from tools/freetype/freetype/src/base/ftglyph.c rename to drivers/freetype/freetype/src/base/ftglyph.c diff --git a/tools/freetype/freetype/src/base/ftgxval.c b/drivers/freetype/freetype/src/base/ftgxval.c similarity index 100% rename from tools/freetype/freetype/src/base/ftgxval.c rename to drivers/freetype/freetype/src/base/ftgxval.c diff --git a/tools/freetype/freetype/src/base/ftinit.c b/drivers/freetype/freetype/src/base/ftinit.c similarity index 100% rename from tools/freetype/freetype/src/base/ftinit.c rename to drivers/freetype/freetype/src/base/ftinit.c diff --git a/tools/freetype/freetype/src/base/ftlcdfil.c b/drivers/freetype/freetype/src/base/ftlcdfil.c similarity index 100% rename from tools/freetype/freetype/src/base/ftlcdfil.c rename to drivers/freetype/freetype/src/base/ftlcdfil.c diff --git a/tools/freetype/freetype/src/base/ftmac.c b/drivers/freetype/freetype/src/base/ftmac.c similarity index 100% rename from tools/freetype/freetype/src/base/ftmac.c rename to drivers/freetype/freetype/src/base/ftmac.c diff --git a/tools/freetype/freetype/src/base/ftmm.c b/drivers/freetype/freetype/src/base/ftmm.c similarity index 100% rename from tools/freetype/freetype/src/base/ftmm.c rename to drivers/freetype/freetype/src/base/ftmm.c diff --git a/tools/freetype/freetype/src/base/ftobjs.c b/drivers/freetype/freetype/src/base/ftobjs.c similarity index 100% rename from tools/freetype/freetype/src/base/ftobjs.c rename to drivers/freetype/freetype/src/base/ftobjs.c diff --git a/tools/freetype/freetype/src/base/ftotval.c b/drivers/freetype/freetype/src/base/ftotval.c similarity index 100% rename from tools/freetype/freetype/src/base/ftotval.c rename to drivers/freetype/freetype/src/base/ftotval.c diff --git a/tools/freetype/freetype/src/base/ftoutln.c b/drivers/freetype/freetype/src/base/ftoutln.c similarity index 100% rename from tools/freetype/freetype/src/base/ftoutln.c rename to drivers/freetype/freetype/src/base/ftoutln.c diff --git a/tools/freetype/freetype/src/base/ftpatent.c b/drivers/freetype/freetype/src/base/ftpatent.c similarity index 100% rename from tools/freetype/freetype/src/base/ftpatent.c rename to drivers/freetype/freetype/src/base/ftpatent.c diff --git a/tools/freetype/freetype/src/base/ftpfr.c b/drivers/freetype/freetype/src/base/ftpfr.c similarity index 100% rename from tools/freetype/freetype/src/base/ftpfr.c rename to drivers/freetype/freetype/src/base/ftpfr.c diff --git a/tools/freetype/freetype/src/base/ftpic.c b/drivers/freetype/freetype/src/base/ftpic.c similarity index 100% rename from tools/freetype/freetype/src/base/ftpic.c rename to drivers/freetype/freetype/src/base/ftpic.c diff --git a/tools/freetype/freetype/src/base/ftrfork.c b/drivers/freetype/freetype/src/base/ftrfork.c similarity index 100% rename from tools/freetype/freetype/src/base/ftrfork.c rename to drivers/freetype/freetype/src/base/ftrfork.c diff --git a/tools/freetype/freetype/src/base/ftsnames.c b/drivers/freetype/freetype/src/base/ftsnames.c similarity index 100% rename from tools/freetype/freetype/src/base/ftsnames.c rename to drivers/freetype/freetype/src/base/ftsnames.c diff --git a/tools/freetype/freetype/src/base/ftstream.c b/drivers/freetype/freetype/src/base/ftstream.c similarity index 100% rename from tools/freetype/freetype/src/base/ftstream.c rename to drivers/freetype/freetype/src/base/ftstream.c diff --git a/tools/freetype/freetype/src/base/ftstroke.c b/drivers/freetype/freetype/src/base/ftstroke.c similarity index 100% rename from tools/freetype/freetype/src/base/ftstroke.c rename to drivers/freetype/freetype/src/base/ftstroke.c diff --git a/tools/freetype/freetype/src/base/ftsynth.c b/drivers/freetype/freetype/src/base/ftsynth.c similarity index 100% rename from tools/freetype/freetype/src/base/ftsynth.c rename to drivers/freetype/freetype/src/base/ftsynth.c diff --git a/tools/freetype/freetype/src/base/ftsystem.c b/drivers/freetype/freetype/src/base/ftsystem.c similarity index 100% rename from tools/freetype/freetype/src/base/ftsystem.c rename to drivers/freetype/freetype/src/base/ftsystem.c diff --git a/tools/freetype/freetype/src/base/fttrigon.c b/drivers/freetype/freetype/src/base/fttrigon.c similarity index 100% rename from tools/freetype/freetype/src/base/fttrigon.c rename to drivers/freetype/freetype/src/base/fttrigon.c diff --git a/tools/freetype/freetype/src/base/fttype1.c b/drivers/freetype/freetype/src/base/fttype1.c similarity index 100% rename from tools/freetype/freetype/src/base/fttype1.c rename to drivers/freetype/freetype/src/base/fttype1.c diff --git a/tools/freetype/freetype/src/base/ftutil.c b/drivers/freetype/freetype/src/base/ftutil.c similarity index 100% rename from tools/freetype/freetype/src/base/ftutil.c rename to drivers/freetype/freetype/src/base/ftutil.c diff --git a/tools/freetype/freetype/src/base/ftwinfnt.c b/drivers/freetype/freetype/src/base/ftwinfnt.c similarity index 100% rename from tools/freetype/freetype/src/base/ftwinfnt.c rename to drivers/freetype/freetype/src/base/ftwinfnt.c diff --git a/tools/freetype/freetype/src/base/ftxf86.c b/drivers/freetype/freetype/src/base/ftxf86.c similarity index 100% rename from tools/freetype/freetype/src/base/ftxf86.c rename to drivers/freetype/freetype/src/base/ftxf86.c diff --git a/tools/freetype/freetype/src/base/md5.c b/drivers/freetype/freetype/src/base/md5.c similarity index 100% rename from tools/freetype/freetype/src/base/md5.c rename to drivers/freetype/freetype/src/base/md5.c diff --git a/tools/freetype/freetype/src/base/md5.h b/drivers/freetype/freetype/src/base/md5.h similarity index 100% rename from tools/freetype/freetype/src/base/md5.h rename to drivers/freetype/freetype/src/base/md5.h diff --git a/tools/freetype/freetype/src/base/rules.mk b/drivers/freetype/freetype/src/base/rules.mk similarity index 100% rename from tools/freetype/freetype/src/base/rules.mk rename to drivers/freetype/freetype/src/base/rules.mk diff --git a/tools/freetype/freetype/src/bdf/Jamfile b/drivers/freetype/freetype/src/bdf/Jamfile similarity index 100% rename from tools/freetype/freetype/src/bdf/Jamfile rename to drivers/freetype/freetype/src/bdf/Jamfile diff --git a/tools/freetype/freetype/src/bdf/README b/drivers/freetype/freetype/src/bdf/README similarity index 100% rename from tools/freetype/freetype/src/bdf/README rename to drivers/freetype/freetype/src/bdf/README diff --git a/tools/freetype/freetype/src/bdf/bdf.c b/drivers/freetype/freetype/src/bdf/bdf.c similarity index 100% rename from tools/freetype/freetype/src/bdf/bdf.c rename to drivers/freetype/freetype/src/bdf/bdf.c diff --git a/tools/freetype/freetype/src/bdf/bdf.h b/drivers/freetype/freetype/src/bdf/bdf.h similarity index 100% rename from tools/freetype/freetype/src/bdf/bdf.h rename to drivers/freetype/freetype/src/bdf/bdf.h diff --git a/tools/freetype/freetype/src/bdf/bdfdrivr.c b/drivers/freetype/freetype/src/bdf/bdfdrivr.c similarity index 100% rename from tools/freetype/freetype/src/bdf/bdfdrivr.c rename to drivers/freetype/freetype/src/bdf/bdfdrivr.c diff --git a/tools/freetype/freetype/src/bdf/bdfdrivr.h b/drivers/freetype/freetype/src/bdf/bdfdrivr.h similarity index 100% rename from tools/freetype/freetype/src/bdf/bdfdrivr.h rename to drivers/freetype/freetype/src/bdf/bdfdrivr.h diff --git a/tools/freetype/freetype/src/bdf/bdferror.h b/drivers/freetype/freetype/src/bdf/bdferror.h similarity index 100% rename from tools/freetype/freetype/src/bdf/bdferror.h rename to drivers/freetype/freetype/src/bdf/bdferror.h diff --git a/tools/freetype/freetype/src/bdf/bdflib.c b/drivers/freetype/freetype/src/bdf/bdflib.c similarity index 100% rename from tools/freetype/freetype/src/bdf/bdflib.c rename to drivers/freetype/freetype/src/bdf/bdflib.c diff --git a/tools/freetype/freetype/src/bdf/module.mk b/drivers/freetype/freetype/src/bdf/module.mk similarity index 100% rename from tools/freetype/freetype/src/bdf/module.mk rename to drivers/freetype/freetype/src/bdf/module.mk diff --git a/tools/freetype/freetype/src/bdf/rules.mk b/drivers/freetype/freetype/src/bdf/rules.mk similarity index 100% rename from tools/freetype/freetype/src/bdf/rules.mk rename to drivers/freetype/freetype/src/bdf/rules.mk diff --git a/tools/freetype/freetype/src/cache/Jamfile b/drivers/freetype/freetype/src/cache/Jamfile similarity index 100% rename from tools/freetype/freetype/src/cache/Jamfile rename to drivers/freetype/freetype/src/cache/Jamfile diff --git a/tools/freetype/freetype/src/cache/ftcache.c b/drivers/freetype/freetype/src/cache/ftcache.c similarity index 100% rename from tools/freetype/freetype/src/cache/ftcache.c rename to drivers/freetype/freetype/src/cache/ftcache.c diff --git a/tools/freetype/freetype/src/cache/ftcbasic.c b/drivers/freetype/freetype/src/cache/ftcbasic.c similarity index 100% rename from tools/freetype/freetype/src/cache/ftcbasic.c rename to drivers/freetype/freetype/src/cache/ftcbasic.c diff --git a/tools/freetype/freetype/src/cache/ftccache.c b/drivers/freetype/freetype/src/cache/ftccache.c similarity index 100% rename from tools/freetype/freetype/src/cache/ftccache.c rename to drivers/freetype/freetype/src/cache/ftccache.c diff --git a/tools/freetype/freetype/src/cache/ftccache.h b/drivers/freetype/freetype/src/cache/ftccache.h similarity index 100% rename from tools/freetype/freetype/src/cache/ftccache.h rename to drivers/freetype/freetype/src/cache/ftccache.h diff --git a/tools/freetype/freetype/src/cache/ftccback.h b/drivers/freetype/freetype/src/cache/ftccback.h similarity index 100% rename from tools/freetype/freetype/src/cache/ftccback.h rename to drivers/freetype/freetype/src/cache/ftccback.h diff --git a/tools/freetype/freetype/src/cache/ftccmap.c b/drivers/freetype/freetype/src/cache/ftccmap.c similarity index 100% rename from tools/freetype/freetype/src/cache/ftccmap.c rename to drivers/freetype/freetype/src/cache/ftccmap.c diff --git a/tools/freetype/freetype/src/cache/ftcerror.h b/drivers/freetype/freetype/src/cache/ftcerror.h similarity index 100% rename from tools/freetype/freetype/src/cache/ftcerror.h rename to drivers/freetype/freetype/src/cache/ftcerror.h diff --git a/tools/freetype/freetype/src/cache/ftcglyph.c b/drivers/freetype/freetype/src/cache/ftcglyph.c similarity index 100% rename from tools/freetype/freetype/src/cache/ftcglyph.c rename to drivers/freetype/freetype/src/cache/ftcglyph.c diff --git a/tools/freetype/freetype/src/cache/ftcglyph.h b/drivers/freetype/freetype/src/cache/ftcglyph.h similarity index 100% rename from tools/freetype/freetype/src/cache/ftcglyph.h rename to drivers/freetype/freetype/src/cache/ftcglyph.h diff --git a/tools/freetype/freetype/src/cache/ftcimage.c b/drivers/freetype/freetype/src/cache/ftcimage.c similarity index 100% rename from tools/freetype/freetype/src/cache/ftcimage.c rename to drivers/freetype/freetype/src/cache/ftcimage.c diff --git a/tools/freetype/freetype/src/cache/ftcimage.h b/drivers/freetype/freetype/src/cache/ftcimage.h similarity index 100% rename from tools/freetype/freetype/src/cache/ftcimage.h rename to drivers/freetype/freetype/src/cache/ftcimage.h diff --git a/tools/freetype/freetype/src/cache/ftcmanag.c b/drivers/freetype/freetype/src/cache/ftcmanag.c similarity index 100% rename from tools/freetype/freetype/src/cache/ftcmanag.c rename to drivers/freetype/freetype/src/cache/ftcmanag.c diff --git a/tools/freetype/freetype/src/cache/ftcmanag.h b/drivers/freetype/freetype/src/cache/ftcmanag.h similarity index 100% rename from tools/freetype/freetype/src/cache/ftcmanag.h rename to drivers/freetype/freetype/src/cache/ftcmanag.h diff --git a/tools/freetype/freetype/src/cache/ftcmru.c b/drivers/freetype/freetype/src/cache/ftcmru.c similarity index 100% rename from tools/freetype/freetype/src/cache/ftcmru.c rename to drivers/freetype/freetype/src/cache/ftcmru.c diff --git a/tools/freetype/freetype/src/cache/ftcmru.h b/drivers/freetype/freetype/src/cache/ftcmru.h similarity index 100% rename from tools/freetype/freetype/src/cache/ftcmru.h rename to drivers/freetype/freetype/src/cache/ftcmru.h diff --git a/tools/freetype/freetype/src/cache/ftcsbits.c b/drivers/freetype/freetype/src/cache/ftcsbits.c similarity index 100% rename from tools/freetype/freetype/src/cache/ftcsbits.c rename to drivers/freetype/freetype/src/cache/ftcsbits.c diff --git a/tools/freetype/freetype/src/cache/ftcsbits.h b/drivers/freetype/freetype/src/cache/ftcsbits.h similarity index 100% rename from tools/freetype/freetype/src/cache/ftcsbits.h rename to drivers/freetype/freetype/src/cache/ftcsbits.h diff --git a/tools/freetype/freetype/src/cache/rules.mk b/drivers/freetype/freetype/src/cache/rules.mk similarity index 100% rename from tools/freetype/freetype/src/cache/rules.mk rename to drivers/freetype/freetype/src/cache/rules.mk diff --git a/tools/freetype/freetype/src/cff/Jamfile b/drivers/freetype/freetype/src/cff/Jamfile similarity index 100% rename from tools/freetype/freetype/src/cff/Jamfile rename to drivers/freetype/freetype/src/cff/Jamfile diff --git a/tools/freetype/freetype/src/cff/cf2arrst.c b/drivers/freetype/freetype/src/cff/cf2arrst.c similarity index 100% rename from tools/freetype/freetype/src/cff/cf2arrst.c rename to drivers/freetype/freetype/src/cff/cf2arrst.c diff --git a/tools/freetype/freetype/src/cff/cf2arrst.h b/drivers/freetype/freetype/src/cff/cf2arrst.h similarity index 100% rename from tools/freetype/freetype/src/cff/cf2arrst.h rename to drivers/freetype/freetype/src/cff/cf2arrst.h diff --git a/tools/freetype/freetype/src/cff/cf2blues.c b/drivers/freetype/freetype/src/cff/cf2blues.c similarity index 100% rename from tools/freetype/freetype/src/cff/cf2blues.c rename to drivers/freetype/freetype/src/cff/cf2blues.c diff --git a/tools/freetype/freetype/src/cff/cf2blues.h b/drivers/freetype/freetype/src/cff/cf2blues.h similarity index 100% rename from tools/freetype/freetype/src/cff/cf2blues.h rename to drivers/freetype/freetype/src/cff/cf2blues.h diff --git a/tools/freetype/freetype/src/cff/cf2error.c b/drivers/freetype/freetype/src/cff/cf2error.c similarity index 100% rename from tools/freetype/freetype/src/cff/cf2error.c rename to drivers/freetype/freetype/src/cff/cf2error.c diff --git a/tools/freetype/freetype/src/cff/cf2error.h b/drivers/freetype/freetype/src/cff/cf2error.h similarity index 100% rename from tools/freetype/freetype/src/cff/cf2error.h rename to drivers/freetype/freetype/src/cff/cf2error.h diff --git a/tools/freetype/freetype/src/cff/cf2fixed.h b/drivers/freetype/freetype/src/cff/cf2fixed.h similarity index 100% rename from tools/freetype/freetype/src/cff/cf2fixed.h rename to drivers/freetype/freetype/src/cff/cf2fixed.h diff --git a/tools/freetype/freetype/src/cff/cf2font.c b/drivers/freetype/freetype/src/cff/cf2font.c similarity index 100% rename from tools/freetype/freetype/src/cff/cf2font.c rename to drivers/freetype/freetype/src/cff/cf2font.c diff --git a/tools/freetype/freetype/src/cff/cf2font.h b/drivers/freetype/freetype/src/cff/cf2font.h similarity index 100% rename from tools/freetype/freetype/src/cff/cf2font.h rename to drivers/freetype/freetype/src/cff/cf2font.h diff --git a/tools/freetype/freetype/src/cff/cf2ft.c b/drivers/freetype/freetype/src/cff/cf2ft.c similarity index 100% rename from tools/freetype/freetype/src/cff/cf2ft.c rename to drivers/freetype/freetype/src/cff/cf2ft.c diff --git a/tools/freetype/freetype/src/cff/cf2ft.h b/drivers/freetype/freetype/src/cff/cf2ft.h similarity index 100% rename from tools/freetype/freetype/src/cff/cf2ft.h rename to drivers/freetype/freetype/src/cff/cf2ft.h diff --git a/tools/freetype/freetype/src/cff/cf2glue.h b/drivers/freetype/freetype/src/cff/cf2glue.h similarity index 100% rename from tools/freetype/freetype/src/cff/cf2glue.h rename to drivers/freetype/freetype/src/cff/cf2glue.h diff --git a/tools/freetype/freetype/src/cff/cf2hints.c b/drivers/freetype/freetype/src/cff/cf2hints.c similarity index 100% rename from tools/freetype/freetype/src/cff/cf2hints.c rename to drivers/freetype/freetype/src/cff/cf2hints.c diff --git a/tools/freetype/freetype/src/cff/cf2hints.h b/drivers/freetype/freetype/src/cff/cf2hints.h similarity index 100% rename from tools/freetype/freetype/src/cff/cf2hints.h rename to drivers/freetype/freetype/src/cff/cf2hints.h diff --git a/tools/freetype/freetype/src/cff/cf2intrp.c b/drivers/freetype/freetype/src/cff/cf2intrp.c similarity index 100% rename from tools/freetype/freetype/src/cff/cf2intrp.c rename to drivers/freetype/freetype/src/cff/cf2intrp.c diff --git a/tools/freetype/freetype/src/cff/cf2intrp.h b/drivers/freetype/freetype/src/cff/cf2intrp.h similarity index 100% rename from tools/freetype/freetype/src/cff/cf2intrp.h rename to drivers/freetype/freetype/src/cff/cf2intrp.h diff --git a/tools/freetype/freetype/src/cff/cf2read.c b/drivers/freetype/freetype/src/cff/cf2read.c similarity index 100% rename from tools/freetype/freetype/src/cff/cf2read.c rename to drivers/freetype/freetype/src/cff/cf2read.c diff --git a/tools/freetype/freetype/src/cff/cf2read.h b/drivers/freetype/freetype/src/cff/cf2read.h similarity index 100% rename from tools/freetype/freetype/src/cff/cf2read.h rename to drivers/freetype/freetype/src/cff/cf2read.h diff --git a/tools/freetype/freetype/src/cff/cf2stack.c b/drivers/freetype/freetype/src/cff/cf2stack.c similarity index 100% rename from tools/freetype/freetype/src/cff/cf2stack.c rename to drivers/freetype/freetype/src/cff/cf2stack.c diff --git a/tools/freetype/freetype/src/cff/cf2stack.h b/drivers/freetype/freetype/src/cff/cf2stack.h similarity index 100% rename from tools/freetype/freetype/src/cff/cf2stack.h rename to drivers/freetype/freetype/src/cff/cf2stack.h diff --git a/tools/freetype/freetype/src/cff/cf2types.h b/drivers/freetype/freetype/src/cff/cf2types.h similarity index 100% rename from tools/freetype/freetype/src/cff/cf2types.h rename to drivers/freetype/freetype/src/cff/cf2types.h diff --git a/tools/freetype/freetype/src/cff/cff.c b/drivers/freetype/freetype/src/cff/cff.c similarity index 100% rename from tools/freetype/freetype/src/cff/cff.c rename to drivers/freetype/freetype/src/cff/cff.c diff --git a/tools/freetype/freetype/src/cff/cffcmap.c b/drivers/freetype/freetype/src/cff/cffcmap.c similarity index 100% rename from tools/freetype/freetype/src/cff/cffcmap.c rename to drivers/freetype/freetype/src/cff/cffcmap.c diff --git a/tools/freetype/freetype/src/cff/cffcmap.h b/drivers/freetype/freetype/src/cff/cffcmap.h similarity index 100% rename from tools/freetype/freetype/src/cff/cffcmap.h rename to drivers/freetype/freetype/src/cff/cffcmap.h diff --git a/tools/freetype/freetype/src/cff/cffdrivr.c b/drivers/freetype/freetype/src/cff/cffdrivr.c similarity index 100% rename from tools/freetype/freetype/src/cff/cffdrivr.c rename to drivers/freetype/freetype/src/cff/cffdrivr.c diff --git a/tools/freetype/freetype/src/cff/cffdrivr.h b/drivers/freetype/freetype/src/cff/cffdrivr.h similarity index 100% rename from tools/freetype/freetype/src/cff/cffdrivr.h rename to drivers/freetype/freetype/src/cff/cffdrivr.h diff --git a/tools/freetype/freetype/src/cff/cfferrs.h b/drivers/freetype/freetype/src/cff/cfferrs.h similarity index 100% rename from tools/freetype/freetype/src/cff/cfferrs.h rename to drivers/freetype/freetype/src/cff/cfferrs.h diff --git a/tools/freetype/freetype/src/cff/cffgload.c b/drivers/freetype/freetype/src/cff/cffgload.c similarity index 100% rename from tools/freetype/freetype/src/cff/cffgload.c rename to drivers/freetype/freetype/src/cff/cffgload.c diff --git a/tools/freetype/freetype/src/cff/cffgload.h b/drivers/freetype/freetype/src/cff/cffgload.h similarity index 100% rename from tools/freetype/freetype/src/cff/cffgload.h rename to drivers/freetype/freetype/src/cff/cffgload.h diff --git a/tools/freetype/freetype/src/cff/cffload.c b/drivers/freetype/freetype/src/cff/cffload.c similarity index 100% rename from tools/freetype/freetype/src/cff/cffload.c rename to drivers/freetype/freetype/src/cff/cffload.c diff --git a/tools/freetype/freetype/src/cff/cffload.h b/drivers/freetype/freetype/src/cff/cffload.h similarity index 100% rename from tools/freetype/freetype/src/cff/cffload.h rename to drivers/freetype/freetype/src/cff/cffload.h diff --git a/tools/freetype/freetype/src/cff/cffobjs.c b/drivers/freetype/freetype/src/cff/cffobjs.c similarity index 100% rename from tools/freetype/freetype/src/cff/cffobjs.c rename to drivers/freetype/freetype/src/cff/cffobjs.c diff --git a/tools/freetype/freetype/src/cff/cffobjs.h b/drivers/freetype/freetype/src/cff/cffobjs.h similarity index 100% rename from tools/freetype/freetype/src/cff/cffobjs.h rename to drivers/freetype/freetype/src/cff/cffobjs.h diff --git a/tools/freetype/freetype/src/cff/cffparse.c b/drivers/freetype/freetype/src/cff/cffparse.c similarity index 100% rename from tools/freetype/freetype/src/cff/cffparse.c rename to drivers/freetype/freetype/src/cff/cffparse.c diff --git a/tools/freetype/freetype/src/cff/cffparse.h b/drivers/freetype/freetype/src/cff/cffparse.h similarity index 100% rename from tools/freetype/freetype/src/cff/cffparse.h rename to drivers/freetype/freetype/src/cff/cffparse.h diff --git a/tools/freetype/freetype/src/cff/cffpic.c b/drivers/freetype/freetype/src/cff/cffpic.c similarity index 100% rename from tools/freetype/freetype/src/cff/cffpic.c rename to drivers/freetype/freetype/src/cff/cffpic.c diff --git a/tools/freetype/freetype/src/cff/cffpic.h b/drivers/freetype/freetype/src/cff/cffpic.h similarity index 100% rename from tools/freetype/freetype/src/cff/cffpic.h rename to drivers/freetype/freetype/src/cff/cffpic.h diff --git a/tools/freetype/freetype/src/cff/cfftoken.h b/drivers/freetype/freetype/src/cff/cfftoken.h similarity index 100% rename from tools/freetype/freetype/src/cff/cfftoken.h rename to drivers/freetype/freetype/src/cff/cfftoken.h diff --git a/tools/freetype/freetype/src/cff/cfftypes.h b/drivers/freetype/freetype/src/cff/cfftypes.h similarity index 100% rename from tools/freetype/freetype/src/cff/cfftypes.h rename to drivers/freetype/freetype/src/cff/cfftypes.h diff --git a/tools/freetype/freetype/src/cff/module.mk b/drivers/freetype/freetype/src/cff/module.mk similarity index 100% rename from tools/freetype/freetype/src/cff/module.mk rename to drivers/freetype/freetype/src/cff/module.mk diff --git a/tools/freetype/freetype/src/cff/rules.mk b/drivers/freetype/freetype/src/cff/rules.mk similarity index 100% rename from tools/freetype/freetype/src/cff/rules.mk rename to drivers/freetype/freetype/src/cff/rules.mk diff --git a/tools/freetype/freetype/src/cid/Jamfile b/drivers/freetype/freetype/src/cid/Jamfile similarity index 100% rename from tools/freetype/freetype/src/cid/Jamfile rename to drivers/freetype/freetype/src/cid/Jamfile diff --git a/tools/freetype/freetype/src/cid/ciderrs.h b/drivers/freetype/freetype/src/cid/ciderrs.h similarity index 100% rename from tools/freetype/freetype/src/cid/ciderrs.h rename to drivers/freetype/freetype/src/cid/ciderrs.h diff --git a/tools/freetype/freetype/src/cid/cidgload.c b/drivers/freetype/freetype/src/cid/cidgload.c similarity index 100% rename from tools/freetype/freetype/src/cid/cidgload.c rename to drivers/freetype/freetype/src/cid/cidgload.c diff --git a/tools/freetype/freetype/src/cid/cidgload.h b/drivers/freetype/freetype/src/cid/cidgload.h similarity index 100% rename from tools/freetype/freetype/src/cid/cidgload.h rename to drivers/freetype/freetype/src/cid/cidgload.h diff --git a/tools/freetype/freetype/src/cid/cidload.c b/drivers/freetype/freetype/src/cid/cidload.c similarity index 100% rename from tools/freetype/freetype/src/cid/cidload.c rename to drivers/freetype/freetype/src/cid/cidload.c diff --git a/tools/freetype/freetype/src/cid/cidload.h b/drivers/freetype/freetype/src/cid/cidload.h similarity index 100% rename from tools/freetype/freetype/src/cid/cidload.h rename to drivers/freetype/freetype/src/cid/cidload.h diff --git a/tools/freetype/freetype/src/cid/cidobjs.c b/drivers/freetype/freetype/src/cid/cidobjs.c similarity index 100% rename from tools/freetype/freetype/src/cid/cidobjs.c rename to drivers/freetype/freetype/src/cid/cidobjs.c diff --git a/tools/freetype/freetype/src/cid/cidobjs.h b/drivers/freetype/freetype/src/cid/cidobjs.h similarity index 100% rename from tools/freetype/freetype/src/cid/cidobjs.h rename to drivers/freetype/freetype/src/cid/cidobjs.h diff --git a/tools/freetype/freetype/src/cid/cidparse.c b/drivers/freetype/freetype/src/cid/cidparse.c similarity index 100% rename from tools/freetype/freetype/src/cid/cidparse.c rename to drivers/freetype/freetype/src/cid/cidparse.c diff --git a/tools/freetype/freetype/src/cid/cidparse.h b/drivers/freetype/freetype/src/cid/cidparse.h similarity index 100% rename from tools/freetype/freetype/src/cid/cidparse.h rename to drivers/freetype/freetype/src/cid/cidparse.h diff --git a/tools/freetype/freetype/src/cid/cidriver.c b/drivers/freetype/freetype/src/cid/cidriver.c similarity index 100% rename from tools/freetype/freetype/src/cid/cidriver.c rename to drivers/freetype/freetype/src/cid/cidriver.c diff --git a/tools/freetype/freetype/src/cid/cidriver.h b/drivers/freetype/freetype/src/cid/cidriver.h similarity index 100% rename from tools/freetype/freetype/src/cid/cidriver.h rename to drivers/freetype/freetype/src/cid/cidriver.h diff --git a/tools/freetype/freetype/src/cid/cidtoken.h b/drivers/freetype/freetype/src/cid/cidtoken.h similarity index 100% rename from tools/freetype/freetype/src/cid/cidtoken.h rename to drivers/freetype/freetype/src/cid/cidtoken.h diff --git a/tools/freetype/freetype/src/cid/module.mk b/drivers/freetype/freetype/src/cid/module.mk similarity index 100% rename from tools/freetype/freetype/src/cid/module.mk rename to drivers/freetype/freetype/src/cid/module.mk diff --git a/tools/freetype/freetype/src/cid/rules.mk b/drivers/freetype/freetype/src/cid/rules.mk similarity index 100% rename from tools/freetype/freetype/src/cid/rules.mk rename to drivers/freetype/freetype/src/cid/rules.mk diff --git a/tools/freetype/freetype/src/cid/type1cid.c b/drivers/freetype/freetype/src/cid/type1cid.c similarity index 100% rename from tools/freetype/freetype/src/cid/type1cid.c rename to drivers/freetype/freetype/src/cid/type1cid.c diff --git a/tools/freetype/freetype/src/gxvalid/Jamfile b/drivers/freetype/freetype/src/gxvalid/Jamfile similarity index 100% rename from tools/freetype/freetype/src/gxvalid/Jamfile rename to drivers/freetype/freetype/src/gxvalid/Jamfile diff --git a/tools/freetype/freetype/src/gxvalid/README b/drivers/freetype/freetype/src/gxvalid/README similarity index 100% rename from tools/freetype/freetype/src/gxvalid/README rename to drivers/freetype/freetype/src/gxvalid/README diff --git a/tools/freetype/freetype/src/gxvalid/gxvalid.c b/drivers/freetype/freetype/src/gxvalid/gxvalid.c similarity index 100% rename from tools/freetype/freetype/src/gxvalid/gxvalid.c rename to drivers/freetype/freetype/src/gxvalid/gxvalid.c diff --git a/tools/freetype/freetype/src/gxvalid/gxvalid.h b/drivers/freetype/freetype/src/gxvalid/gxvalid.h similarity index 100% rename from tools/freetype/freetype/src/gxvalid/gxvalid.h rename to drivers/freetype/freetype/src/gxvalid/gxvalid.h diff --git a/tools/freetype/freetype/src/gxvalid/gxvbsln.c b/drivers/freetype/freetype/src/gxvalid/gxvbsln.c similarity index 100% rename from tools/freetype/freetype/src/gxvalid/gxvbsln.c rename to drivers/freetype/freetype/src/gxvalid/gxvbsln.c diff --git a/tools/freetype/freetype/src/gxvalid/gxvcommn.c b/drivers/freetype/freetype/src/gxvalid/gxvcommn.c similarity index 100% rename from tools/freetype/freetype/src/gxvalid/gxvcommn.c rename to drivers/freetype/freetype/src/gxvalid/gxvcommn.c diff --git a/tools/freetype/freetype/src/gxvalid/gxvcommn.h b/drivers/freetype/freetype/src/gxvalid/gxvcommn.h similarity index 100% rename from tools/freetype/freetype/src/gxvalid/gxvcommn.h rename to drivers/freetype/freetype/src/gxvalid/gxvcommn.h diff --git a/tools/freetype/freetype/src/gxvalid/gxverror.h b/drivers/freetype/freetype/src/gxvalid/gxverror.h similarity index 100% rename from tools/freetype/freetype/src/gxvalid/gxverror.h rename to drivers/freetype/freetype/src/gxvalid/gxverror.h diff --git a/tools/freetype/freetype/src/gxvalid/gxvfeat.c b/drivers/freetype/freetype/src/gxvalid/gxvfeat.c similarity index 100% rename from tools/freetype/freetype/src/gxvalid/gxvfeat.c rename to drivers/freetype/freetype/src/gxvalid/gxvfeat.c diff --git a/tools/freetype/freetype/src/gxvalid/gxvfeat.h b/drivers/freetype/freetype/src/gxvalid/gxvfeat.h similarity index 100% rename from tools/freetype/freetype/src/gxvalid/gxvfeat.h rename to drivers/freetype/freetype/src/gxvalid/gxvfeat.h diff --git a/tools/freetype/freetype/src/gxvalid/gxvfgen.c b/drivers/freetype/freetype/src/gxvalid/gxvfgen.c similarity index 100% rename from tools/freetype/freetype/src/gxvalid/gxvfgen.c rename to drivers/freetype/freetype/src/gxvalid/gxvfgen.c diff --git a/tools/freetype/freetype/src/gxvalid/gxvjust.c b/drivers/freetype/freetype/src/gxvalid/gxvjust.c similarity index 100% rename from tools/freetype/freetype/src/gxvalid/gxvjust.c rename to drivers/freetype/freetype/src/gxvalid/gxvjust.c diff --git a/tools/freetype/freetype/src/gxvalid/gxvkern.c b/drivers/freetype/freetype/src/gxvalid/gxvkern.c similarity index 100% rename from tools/freetype/freetype/src/gxvalid/gxvkern.c rename to drivers/freetype/freetype/src/gxvalid/gxvkern.c diff --git a/tools/freetype/freetype/src/gxvalid/gxvlcar.c b/drivers/freetype/freetype/src/gxvalid/gxvlcar.c similarity index 100% rename from tools/freetype/freetype/src/gxvalid/gxvlcar.c rename to drivers/freetype/freetype/src/gxvalid/gxvlcar.c diff --git a/tools/freetype/freetype/src/gxvalid/gxvmod.c b/drivers/freetype/freetype/src/gxvalid/gxvmod.c similarity index 100% rename from tools/freetype/freetype/src/gxvalid/gxvmod.c rename to drivers/freetype/freetype/src/gxvalid/gxvmod.c diff --git a/tools/freetype/freetype/src/gxvalid/gxvmod.h b/drivers/freetype/freetype/src/gxvalid/gxvmod.h similarity index 100% rename from tools/freetype/freetype/src/gxvalid/gxvmod.h rename to drivers/freetype/freetype/src/gxvalid/gxvmod.h diff --git a/tools/freetype/freetype/src/gxvalid/gxvmort.c b/drivers/freetype/freetype/src/gxvalid/gxvmort.c similarity index 100% rename from tools/freetype/freetype/src/gxvalid/gxvmort.c rename to drivers/freetype/freetype/src/gxvalid/gxvmort.c diff --git a/tools/freetype/freetype/src/gxvalid/gxvmort.h b/drivers/freetype/freetype/src/gxvalid/gxvmort.h similarity index 100% rename from tools/freetype/freetype/src/gxvalid/gxvmort.h rename to drivers/freetype/freetype/src/gxvalid/gxvmort.h diff --git a/tools/freetype/freetype/src/gxvalid/gxvmort0.c b/drivers/freetype/freetype/src/gxvalid/gxvmort0.c similarity index 100% rename from tools/freetype/freetype/src/gxvalid/gxvmort0.c rename to drivers/freetype/freetype/src/gxvalid/gxvmort0.c diff --git a/tools/freetype/freetype/src/gxvalid/gxvmort1.c b/drivers/freetype/freetype/src/gxvalid/gxvmort1.c similarity index 100% rename from tools/freetype/freetype/src/gxvalid/gxvmort1.c rename to drivers/freetype/freetype/src/gxvalid/gxvmort1.c diff --git a/tools/freetype/freetype/src/gxvalid/gxvmort2.c b/drivers/freetype/freetype/src/gxvalid/gxvmort2.c similarity index 100% rename from tools/freetype/freetype/src/gxvalid/gxvmort2.c rename to drivers/freetype/freetype/src/gxvalid/gxvmort2.c diff --git a/tools/freetype/freetype/src/gxvalid/gxvmort4.c b/drivers/freetype/freetype/src/gxvalid/gxvmort4.c similarity index 100% rename from tools/freetype/freetype/src/gxvalid/gxvmort4.c rename to drivers/freetype/freetype/src/gxvalid/gxvmort4.c diff --git a/tools/freetype/freetype/src/gxvalid/gxvmort5.c b/drivers/freetype/freetype/src/gxvalid/gxvmort5.c similarity index 100% rename from tools/freetype/freetype/src/gxvalid/gxvmort5.c rename to drivers/freetype/freetype/src/gxvalid/gxvmort5.c diff --git a/tools/freetype/freetype/src/gxvalid/gxvmorx.c b/drivers/freetype/freetype/src/gxvalid/gxvmorx.c similarity index 100% rename from tools/freetype/freetype/src/gxvalid/gxvmorx.c rename to drivers/freetype/freetype/src/gxvalid/gxvmorx.c diff --git a/tools/freetype/freetype/src/gxvalid/gxvmorx.h b/drivers/freetype/freetype/src/gxvalid/gxvmorx.h similarity index 100% rename from tools/freetype/freetype/src/gxvalid/gxvmorx.h rename to drivers/freetype/freetype/src/gxvalid/gxvmorx.h diff --git a/tools/freetype/freetype/src/gxvalid/gxvmorx0.c b/drivers/freetype/freetype/src/gxvalid/gxvmorx0.c similarity index 100% rename from tools/freetype/freetype/src/gxvalid/gxvmorx0.c rename to drivers/freetype/freetype/src/gxvalid/gxvmorx0.c diff --git a/tools/freetype/freetype/src/gxvalid/gxvmorx1.c b/drivers/freetype/freetype/src/gxvalid/gxvmorx1.c similarity index 100% rename from tools/freetype/freetype/src/gxvalid/gxvmorx1.c rename to drivers/freetype/freetype/src/gxvalid/gxvmorx1.c diff --git a/tools/freetype/freetype/src/gxvalid/gxvmorx2.c b/drivers/freetype/freetype/src/gxvalid/gxvmorx2.c similarity index 100% rename from tools/freetype/freetype/src/gxvalid/gxvmorx2.c rename to drivers/freetype/freetype/src/gxvalid/gxvmorx2.c diff --git a/tools/freetype/freetype/src/gxvalid/gxvmorx4.c b/drivers/freetype/freetype/src/gxvalid/gxvmorx4.c similarity index 100% rename from tools/freetype/freetype/src/gxvalid/gxvmorx4.c rename to drivers/freetype/freetype/src/gxvalid/gxvmorx4.c diff --git a/tools/freetype/freetype/src/gxvalid/gxvmorx5.c b/drivers/freetype/freetype/src/gxvalid/gxvmorx5.c similarity index 100% rename from tools/freetype/freetype/src/gxvalid/gxvmorx5.c rename to drivers/freetype/freetype/src/gxvalid/gxvmorx5.c diff --git a/tools/freetype/freetype/src/gxvalid/gxvopbd.c b/drivers/freetype/freetype/src/gxvalid/gxvopbd.c similarity index 100% rename from tools/freetype/freetype/src/gxvalid/gxvopbd.c rename to drivers/freetype/freetype/src/gxvalid/gxvopbd.c diff --git a/tools/freetype/freetype/src/gxvalid/gxvprop.c b/drivers/freetype/freetype/src/gxvalid/gxvprop.c similarity index 100% rename from tools/freetype/freetype/src/gxvalid/gxvprop.c rename to drivers/freetype/freetype/src/gxvalid/gxvprop.c diff --git a/tools/freetype/freetype/src/gxvalid/gxvtrak.c b/drivers/freetype/freetype/src/gxvalid/gxvtrak.c similarity index 100% rename from tools/freetype/freetype/src/gxvalid/gxvtrak.c rename to drivers/freetype/freetype/src/gxvalid/gxvtrak.c diff --git a/tools/freetype/freetype/src/gxvalid/module.mk b/drivers/freetype/freetype/src/gxvalid/module.mk similarity index 100% rename from tools/freetype/freetype/src/gxvalid/module.mk rename to drivers/freetype/freetype/src/gxvalid/module.mk diff --git a/tools/freetype/freetype/src/gxvalid/rules.mk b/drivers/freetype/freetype/src/gxvalid/rules.mk similarity index 100% rename from tools/freetype/freetype/src/gxvalid/rules.mk rename to drivers/freetype/freetype/src/gxvalid/rules.mk diff --git a/tools/freetype/freetype/src/otvalid/Jamfile b/drivers/freetype/freetype/src/otvalid/Jamfile similarity index 100% rename from tools/freetype/freetype/src/otvalid/Jamfile rename to drivers/freetype/freetype/src/otvalid/Jamfile diff --git a/tools/freetype/freetype/src/otvalid/module.mk b/drivers/freetype/freetype/src/otvalid/module.mk similarity index 100% rename from tools/freetype/freetype/src/otvalid/module.mk rename to drivers/freetype/freetype/src/otvalid/module.mk diff --git a/tools/freetype/freetype/src/otvalid/otvalid.c b/drivers/freetype/freetype/src/otvalid/otvalid.c similarity index 100% rename from tools/freetype/freetype/src/otvalid/otvalid.c rename to drivers/freetype/freetype/src/otvalid/otvalid.c diff --git a/tools/freetype/freetype/src/otvalid/otvalid.h b/drivers/freetype/freetype/src/otvalid/otvalid.h similarity index 100% rename from tools/freetype/freetype/src/otvalid/otvalid.h rename to drivers/freetype/freetype/src/otvalid/otvalid.h diff --git a/tools/freetype/freetype/src/otvalid/otvbase.c b/drivers/freetype/freetype/src/otvalid/otvbase.c similarity index 100% rename from tools/freetype/freetype/src/otvalid/otvbase.c rename to drivers/freetype/freetype/src/otvalid/otvbase.c diff --git a/tools/freetype/freetype/src/otvalid/otvcommn.c b/drivers/freetype/freetype/src/otvalid/otvcommn.c similarity index 100% rename from tools/freetype/freetype/src/otvalid/otvcommn.c rename to drivers/freetype/freetype/src/otvalid/otvcommn.c diff --git a/tools/freetype/freetype/src/otvalid/otvcommn.h b/drivers/freetype/freetype/src/otvalid/otvcommn.h similarity index 100% rename from tools/freetype/freetype/src/otvalid/otvcommn.h rename to drivers/freetype/freetype/src/otvalid/otvcommn.h diff --git a/tools/freetype/freetype/src/otvalid/otverror.h b/drivers/freetype/freetype/src/otvalid/otverror.h similarity index 100% rename from tools/freetype/freetype/src/otvalid/otverror.h rename to drivers/freetype/freetype/src/otvalid/otverror.h diff --git a/tools/freetype/freetype/src/otvalid/otvgdef.c b/drivers/freetype/freetype/src/otvalid/otvgdef.c similarity index 100% rename from tools/freetype/freetype/src/otvalid/otvgdef.c rename to drivers/freetype/freetype/src/otvalid/otvgdef.c diff --git a/tools/freetype/freetype/src/otvalid/otvgpos.c b/drivers/freetype/freetype/src/otvalid/otvgpos.c similarity index 100% rename from tools/freetype/freetype/src/otvalid/otvgpos.c rename to drivers/freetype/freetype/src/otvalid/otvgpos.c diff --git a/tools/freetype/freetype/src/otvalid/otvgpos.h b/drivers/freetype/freetype/src/otvalid/otvgpos.h similarity index 100% rename from tools/freetype/freetype/src/otvalid/otvgpos.h rename to drivers/freetype/freetype/src/otvalid/otvgpos.h diff --git a/tools/freetype/freetype/src/otvalid/otvgsub.c b/drivers/freetype/freetype/src/otvalid/otvgsub.c similarity index 100% rename from tools/freetype/freetype/src/otvalid/otvgsub.c rename to drivers/freetype/freetype/src/otvalid/otvgsub.c diff --git a/tools/freetype/freetype/src/otvalid/otvjstf.c b/drivers/freetype/freetype/src/otvalid/otvjstf.c similarity index 100% rename from tools/freetype/freetype/src/otvalid/otvjstf.c rename to drivers/freetype/freetype/src/otvalid/otvjstf.c diff --git a/tools/freetype/freetype/src/otvalid/otvmath.c b/drivers/freetype/freetype/src/otvalid/otvmath.c similarity index 100% rename from tools/freetype/freetype/src/otvalid/otvmath.c rename to drivers/freetype/freetype/src/otvalid/otvmath.c diff --git a/tools/freetype/freetype/src/otvalid/otvmod.c b/drivers/freetype/freetype/src/otvalid/otvmod.c similarity index 100% rename from tools/freetype/freetype/src/otvalid/otvmod.c rename to drivers/freetype/freetype/src/otvalid/otvmod.c diff --git a/tools/freetype/freetype/src/otvalid/otvmod.h b/drivers/freetype/freetype/src/otvalid/otvmod.h similarity index 100% rename from tools/freetype/freetype/src/otvalid/otvmod.h rename to drivers/freetype/freetype/src/otvalid/otvmod.h diff --git a/tools/freetype/freetype/src/otvalid/rules.mk b/drivers/freetype/freetype/src/otvalid/rules.mk similarity index 100% rename from tools/freetype/freetype/src/otvalid/rules.mk rename to drivers/freetype/freetype/src/otvalid/rules.mk diff --git a/tools/freetype/freetype/src/pcf/Jamfile b/drivers/freetype/freetype/src/pcf/Jamfile similarity index 100% rename from tools/freetype/freetype/src/pcf/Jamfile rename to drivers/freetype/freetype/src/pcf/Jamfile diff --git a/tools/freetype/freetype/src/pcf/README b/drivers/freetype/freetype/src/pcf/README similarity index 100% rename from tools/freetype/freetype/src/pcf/README rename to drivers/freetype/freetype/src/pcf/README diff --git a/tools/freetype/freetype/src/pcf/module.mk b/drivers/freetype/freetype/src/pcf/module.mk similarity index 100% rename from tools/freetype/freetype/src/pcf/module.mk rename to drivers/freetype/freetype/src/pcf/module.mk diff --git a/tools/freetype/freetype/src/pcf/pcf.c b/drivers/freetype/freetype/src/pcf/pcf.c similarity index 100% rename from tools/freetype/freetype/src/pcf/pcf.c rename to drivers/freetype/freetype/src/pcf/pcf.c diff --git a/tools/freetype/freetype/src/pcf/pcf.h b/drivers/freetype/freetype/src/pcf/pcf.h similarity index 100% rename from tools/freetype/freetype/src/pcf/pcf.h rename to drivers/freetype/freetype/src/pcf/pcf.h diff --git a/tools/freetype/freetype/src/pcf/pcfdrivr.c b/drivers/freetype/freetype/src/pcf/pcfdrivr.c similarity index 100% rename from tools/freetype/freetype/src/pcf/pcfdrivr.c rename to drivers/freetype/freetype/src/pcf/pcfdrivr.c diff --git a/tools/freetype/freetype/src/pcf/pcfdrivr.h b/drivers/freetype/freetype/src/pcf/pcfdrivr.h similarity index 100% rename from tools/freetype/freetype/src/pcf/pcfdrivr.h rename to drivers/freetype/freetype/src/pcf/pcfdrivr.h diff --git a/tools/freetype/freetype/src/pcf/pcferror.h b/drivers/freetype/freetype/src/pcf/pcferror.h similarity index 100% rename from tools/freetype/freetype/src/pcf/pcferror.h rename to drivers/freetype/freetype/src/pcf/pcferror.h diff --git a/tools/freetype/freetype/src/pcf/pcfread.c b/drivers/freetype/freetype/src/pcf/pcfread.c similarity index 100% rename from tools/freetype/freetype/src/pcf/pcfread.c rename to drivers/freetype/freetype/src/pcf/pcfread.c diff --git a/tools/freetype/freetype/src/pcf/pcfread.h b/drivers/freetype/freetype/src/pcf/pcfread.h similarity index 100% rename from tools/freetype/freetype/src/pcf/pcfread.h rename to drivers/freetype/freetype/src/pcf/pcfread.h diff --git a/tools/freetype/freetype/src/pcf/pcfutil.c b/drivers/freetype/freetype/src/pcf/pcfutil.c similarity index 100% rename from tools/freetype/freetype/src/pcf/pcfutil.c rename to drivers/freetype/freetype/src/pcf/pcfutil.c diff --git a/tools/freetype/freetype/src/pcf/pcfutil.h b/drivers/freetype/freetype/src/pcf/pcfutil.h similarity index 100% rename from tools/freetype/freetype/src/pcf/pcfutil.h rename to drivers/freetype/freetype/src/pcf/pcfutil.h diff --git a/tools/freetype/freetype/src/pcf/rules.mk b/drivers/freetype/freetype/src/pcf/rules.mk similarity index 100% rename from tools/freetype/freetype/src/pcf/rules.mk rename to drivers/freetype/freetype/src/pcf/rules.mk diff --git a/tools/freetype/freetype/src/pfr/Jamfile b/drivers/freetype/freetype/src/pfr/Jamfile similarity index 100% rename from tools/freetype/freetype/src/pfr/Jamfile rename to drivers/freetype/freetype/src/pfr/Jamfile diff --git a/tools/freetype/freetype/src/pfr/module.mk b/drivers/freetype/freetype/src/pfr/module.mk similarity index 100% rename from tools/freetype/freetype/src/pfr/module.mk rename to drivers/freetype/freetype/src/pfr/module.mk diff --git a/tools/freetype/freetype/src/pfr/pfr.c b/drivers/freetype/freetype/src/pfr/pfr.c similarity index 100% rename from tools/freetype/freetype/src/pfr/pfr.c rename to drivers/freetype/freetype/src/pfr/pfr.c diff --git a/tools/freetype/freetype/src/pfr/pfrcmap.c b/drivers/freetype/freetype/src/pfr/pfrcmap.c similarity index 100% rename from tools/freetype/freetype/src/pfr/pfrcmap.c rename to drivers/freetype/freetype/src/pfr/pfrcmap.c diff --git a/tools/freetype/freetype/src/pfr/pfrcmap.h b/drivers/freetype/freetype/src/pfr/pfrcmap.h similarity index 100% rename from tools/freetype/freetype/src/pfr/pfrcmap.h rename to drivers/freetype/freetype/src/pfr/pfrcmap.h diff --git a/tools/freetype/freetype/src/pfr/pfrdrivr.c b/drivers/freetype/freetype/src/pfr/pfrdrivr.c similarity index 100% rename from tools/freetype/freetype/src/pfr/pfrdrivr.c rename to drivers/freetype/freetype/src/pfr/pfrdrivr.c diff --git a/tools/freetype/freetype/src/pfr/pfrdrivr.h b/drivers/freetype/freetype/src/pfr/pfrdrivr.h similarity index 100% rename from tools/freetype/freetype/src/pfr/pfrdrivr.h rename to drivers/freetype/freetype/src/pfr/pfrdrivr.h diff --git a/tools/freetype/freetype/src/pfr/pfrerror.h b/drivers/freetype/freetype/src/pfr/pfrerror.h similarity index 100% rename from tools/freetype/freetype/src/pfr/pfrerror.h rename to drivers/freetype/freetype/src/pfr/pfrerror.h diff --git a/tools/freetype/freetype/src/pfr/pfrgload.c b/drivers/freetype/freetype/src/pfr/pfrgload.c similarity index 100% rename from tools/freetype/freetype/src/pfr/pfrgload.c rename to drivers/freetype/freetype/src/pfr/pfrgload.c diff --git a/tools/freetype/freetype/src/pfr/pfrgload.h b/drivers/freetype/freetype/src/pfr/pfrgload.h similarity index 100% rename from tools/freetype/freetype/src/pfr/pfrgload.h rename to drivers/freetype/freetype/src/pfr/pfrgload.h diff --git a/tools/freetype/freetype/src/pfr/pfrload.c b/drivers/freetype/freetype/src/pfr/pfrload.c similarity index 100% rename from tools/freetype/freetype/src/pfr/pfrload.c rename to drivers/freetype/freetype/src/pfr/pfrload.c diff --git a/tools/freetype/freetype/src/pfr/pfrload.h b/drivers/freetype/freetype/src/pfr/pfrload.h similarity index 100% rename from tools/freetype/freetype/src/pfr/pfrload.h rename to drivers/freetype/freetype/src/pfr/pfrload.h diff --git a/tools/freetype/freetype/src/pfr/pfrobjs.c b/drivers/freetype/freetype/src/pfr/pfrobjs.c similarity index 100% rename from tools/freetype/freetype/src/pfr/pfrobjs.c rename to drivers/freetype/freetype/src/pfr/pfrobjs.c diff --git a/tools/freetype/freetype/src/pfr/pfrobjs.h b/drivers/freetype/freetype/src/pfr/pfrobjs.h similarity index 100% rename from tools/freetype/freetype/src/pfr/pfrobjs.h rename to drivers/freetype/freetype/src/pfr/pfrobjs.h diff --git a/tools/freetype/freetype/src/pfr/pfrsbit.c b/drivers/freetype/freetype/src/pfr/pfrsbit.c similarity index 100% rename from tools/freetype/freetype/src/pfr/pfrsbit.c rename to drivers/freetype/freetype/src/pfr/pfrsbit.c diff --git a/tools/freetype/freetype/src/pfr/pfrsbit.h b/drivers/freetype/freetype/src/pfr/pfrsbit.h similarity index 100% rename from tools/freetype/freetype/src/pfr/pfrsbit.h rename to drivers/freetype/freetype/src/pfr/pfrsbit.h diff --git a/tools/freetype/freetype/src/pfr/pfrtypes.h b/drivers/freetype/freetype/src/pfr/pfrtypes.h similarity index 100% rename from tools/freetype/freetype/src/pfr/pfrtypes.h rename to drivers/freetype/freetype/src/pfr/pfrtypes.h diff --git a/tools/freetype/freetype/src/pfr/rules.mk b/drivers/freetype/freetype/src/pfr/rules.mk similarity index 100% rename from tools/freetype/freetype/src/pfr/rules.mk rename to drivers/freetype/freetype/src/pfr/rules.mk diff --git a/tools/freetype/freetype/src/psaux/Jamfile b/drivers/freetype/freetype/src/psaux/Jamfile similarity index 100% rename from tools/freetype/freetype/src/psaux/Jamfile rename to drivers/freetype/freetype/src/psaux/Jamfile diff --git a/tools/freetype/freetype/src/psaux/afmparse.c b/drivers/freetype/freetype/src/psaux/afmparse.c similarity index 100% rename from tools/freetype/freetype/src/psaux/afmparse.c rename to drivers/freetype/freetype/src/psaux/afmparse.c diff --git a/tools/freetype/freetype/src/psaux/afmparse.h b/drivers/freetype/freetype/src/psaux/afmparse.h similarity index 100% rename from tools/freetype/freetype/src/psaux/afmparse.h rename to drivers/freetype/freetype/src/psaux/afmparse.h diff --git a/tools/freetype/freetype/src/psaux/module.mk b/drivers/freetype/freetype/src/psaux/module.mk similarity index 100% rename from tools/freetype/freetype/src/psaux/module.mk rename to drivers/freetype/freetype/src/psaux/module.mk diff --git a/tools/freetype/freetype/src/psaux/psaux.c b/drivers/freetype/freetype/src/psaux/psaux.c similarity index 100% rename from tools/freetype/freetype/src/psaux/psaux.c rename to drivers/freetype/freetype/src/psaux/psaux.c diff --git a/tools/freetype/freetype/src/psaux/psauxerr.h b/drivers/freetype/freetype/src/psaux/psauxerr.h similarity index 100% rename from tools/freetype/freetype/src/psaux/psauxerr.h rename to drivers/freetype/freetype/src/psaux/psauxerr.h diff --git a/tools/freetype/freetype/src/psaux/psauxmod.c b/drivers/freetype/freetype/src/psaux/psauxmod.c similarity index 100% rename from tools/freetype/freetype/src/psaux/psauxmod.c rename to drivers/freetype/freetype/src/psaux/psauxmod.c diff --git a/tools/freetype/freetype/src/psaux/psauxmod.h b/drivers/freetype/freetype/src/psaux/psauxmod.h similarity index 100% rename from tools/freetype/freetype/src/psaux/psauxmod.h rename to drivers/freetype/freetype/src/psaux/psauxmod.h diff --git a/tools/freetype/freetype/src/psaux/psconv.c b/drivers/freetype/freetype/src/psaux/psconv.c similarity index 100% rename from tools/freetype/freetype/src/psaux/psconv.c rename to drivers/freetype/freetype/src/psaux/psconv.c diff --git a/tools/freetype/freetype/src/psaux/psconv.h b/drivers/freetype/freetype/src/psaux/psconv.h similarity index 100% rename from tools/freetype/freetype/src/psaux/psconv.h rename to drivers/freetype/freetype/src/psaux/psconv.h diff --git a/tools/freetype/freetype/src/psaux/psobjs.c b/drivers/freetype/freetype/src/psaux/psobjs.c similarity index 100% rename from tools/freetype/freetype/src/psaux/psobjs.c rename to drivers/freetype/freetype/src/psaux/psobjs.c diff --git a/tools/freetype/freetype/src/psaux/psobjs.h b/drivers/freetype/freetype/src/psaux/psobjs.h similarity index 100% rename from tools/freetype/freetype/src/psaux/psobjs.h rename to drivers/freetype/freetype/src/psaux/psobjs.h diff --git a/tools/freetype/freetype/src/psaux/rules.mk b/drivers/freetype/freetype/src/psaux/rules.mk similarity index 100% rename from tools/freetype/freetype/src/psaux/rules.mk rename to drivers/freetype/freetype/src/psaux/rules.mk diff --git a/tools/freetype/freetype/src/psaux/t1cmap.c b/drivers/freetype/freetype/src/psaux/t1cmap.c similarity index 100% rename from tools/freetype/freetype/src/psaux/t1cmap.c rename to drivers/freetype/freetype/src/psaux/t1cmap.c diff --git a/tools/freetype/freetype/src/psaux/t1cmap.h b/drivers/freetype/freetype/src/psaux/t1cmap.h similarity index 100% rename from tools/freetype/freetype/src/psaux/t1cmap.h rename to drivers/freetype/freetype/src/psaux/t1cmap.h diff --git a/tools/freetype/freetype/src/psaux/t1decode.c b/drivers/freetype/freetype/src/psaux/t1decode.c similarity index 100% rename from tools/freetype/freetype/src/psaux/t1decode.c rename to drivers/freetype/freetype/src/psaux/t1decode.c diff --git a/tools/freetype/freetype/src/psaux/t1decode.h b/drivers/freetype/freetype/src/psaux/t1decode.h similarity index 100% rename from tools/freetype/freetype/src/psaux/t1decode.h rename to drivers/freetype/freetype/src/psaux/t1decode.h diff --git a/tools/freetype/freetype/src/pshinter/Jamfile b/drivers/freetype/freetype/src/pshinter/Jamfile similarity index 100% rename from tools/freetype/freetype/src/pshinter/Jamfile rename to drivers/freetype/freetype/src/pshinter/Jamfile diff --git a/tools/freetype/freetype/src/pshinter/module.mk b/drivers/freetype/freetype/src/pshinter/module.mk similarity index 100% rename from tools/freetype/freetype/src/pshinter/module.mk rename to drivers/freetype/freetype/src/pshinter/module.mk diff --git a/tools/freetype/freetype/src/pshinter/pshalgo.c b/drivers/freetype/freetype/src/pshinter/pshalgo.c similarity index 100% rename from tools/freetype/freetype/src/pshinter/pshalgo.c rename to drivers/freetype/freetype/src/pshinter/pshalgo.c diff --git a/tools/freetype/freetype/src/pshinter/pshalgo.h b/drivers/freetype/freetype/src/pshinter/pshalgo.h similarity index 100% rename from tools/freetype/freetype/src/pshinter/pshalgo.h rename to drivers/freetype/freetype/src/pshinter/pshalgo.h diff --git a/tools/freetype/freetype/src/pshinter/pshglob.c b/drivers/freetype/freetype/src/pshinter/pshglob.c similarity index 100% rename from tools/freetype/freetype/src/pshinter/pshglob.c rename to drivers/freetype/freetype/src/pshinter/pshglob.c diff --git a/tools/freetype/freetype/src/pshinter/pshglob.h b/drivers/freetype/freetype/src/pshinter/pshglob.h similarity index 100% rename from tools/freetype/freetype/src/pshinter/pshglob.h rename to drivers/freetype/freetype/src/pshinter/pshglob.h diff --git a/tools/freetype/freetype/src/pshinter/pshinter.c b/drivers/freetype/freetype/src/pshinter/pshinter.c similarity index 100% rename from tools/freetype/freetype/src/pshinter/pshinter.c rename to drivers/freetype/freetype/src/pshinter/pshinter.c diff --git a/tools/freetype/freetype/src/pshinter/pshmod.c b/drivers/freetype/freetype/src/pshinter/pshmod.c similarity index 100% rename from tools/freetype/freetype/src/pshinter/pshmod.c rename to drivers/freetype/freetype/src/pshinter/pshmod.c diff --git a/tools/freetype/freetype/src/pshinter/pshmod.h b/drivers/freetype/freetype/src/pshinter/pshmod.h similarity index 100% rename from tools/freetype/freetype/src/pshinter/pshmod.h rename to drivers/freetype/freetype/src/pshinter/pshmod.h diff --git a/tools/freetype/freetype/src/pshinter/pshnterr.h b/drivers/freetype/freetype/src/pshinter/pshnterr.h similarity index 100% rename from tools/freetype/freetype/src/pshinter/pshnterr.h rename to drivers/freetype/freetype/src/pshinter/pshnterr.h diff --git a/tools/freetype/freetype/src/pshinter/pshpic.c b/drivers/freetype/freetype/src/pshinter/pshpic.c similarity index 100% rename from tools/freetype/freetype/src/pshinter/pshpic.c rename to drivers/freetype/freetype/src/pshinter/pshpic.c diff --git a/tools/freetype/freetype/src/pshinter/pshpic.h b/drivers/freetype/freetype/src/pshinter/pshpic.h similarity index 100% rename from tools/freetype/freetype/src/pshinter/pshpic.h rename to drivers/freetype/freetype/src/pshinter/pshpic.h diff --git a/tools/freetype/freetype/src/pshinter/pshrec.c b/drivers/freetype/freetype/src/pshinter/pshrec.c similarity index 100% rename from tools/freetype/freetype/src/pshinter/pshrec.c rename to drivers/freetype/freetype/src/pshinter/pshrec.c diff --git a/tools/freetype/freetype/src/pshinter/pshrec.h b/drivers/freetype/freetype/src/pshinter/pshrec.h similarity index 100% rename from tools/freetype/freetype/src/pshinter/pshrec.h rename to drivers/freetype/freetype/src/pshinter/pshrec.h diff --git a/tools/freetype/freetype/src/pshinter/rules.mk b/drivers/freetype/freetype/src/pshinter/rules.mk similarity index 100% rename from tools/freetype/freetype/src/pshinter/rules.mk rename to drivers/freetype/freetype/src/pshinter/rules.mk diff --git a/tools/freetype/freetype/src/psnames/Jamfile b/drivers/freetype/freetype/src/psnames/Jamfile similarity index 100% rename from tools/freetype/freetype/src/psnames/Jamfile rename to drivers/freetype/freetype/src/psnames/Jamfile diff --git a/tools/freetype/freetype/src/psnames/module.mk b/drivers/freetype/freetype/src/psnames/module.mk similarity index 100% rename from tools/freetype/freetype/src/psnames/module.mk rename to drivers/freetype/freetype/src/psnames/module.mk diff --git a/tools/freetype/freetype/src/psnames/psmodule.c b/drivers/freetype/freetype/src/psnames/psmodule.c similarity index 100% rename from tools/freetype/freetype/src/psnames/psmodule.c rename to drivers/freetype/freetype/src/psnames/psmodule.c diff --git a/tools/freetype/freetype/src/psnames/psmodule.h b/drivers/freetype/freetype/src/psnames/psmodule.h similarity index 100% rename from tools/freetype/freetype/src/psnames/psmodule.h rename to drivers/freetype/freetype/src/psnames/psmodule.h diff --git a/tools/freetype/freetype/src/psnames/psnamerr.h b/drivers/freetype/freetype/src/psnames/psnamerr.h similarity index 100% rename from tools/freetype/freetype/src/psnames/psnamerr.h rename to drivers/freetype/freetype/src/psnames/psnamerr.h diff --git a/tools/freetype/freetype/src/psnames/psnames.c b/drivers/freetype/freetype/src/psnames/psnames.c similarity index 100% rename from tools/freetype/freetype/src/psnames/psnames.c rename to drivers/freetype/freetype/src/psnames/psnames.c diff --git a/tools/freetype/freetype/src/psnames/pspic.c b/drivers/freetype/freetype/src/psnames/pspic.c similarity index 100% rename from tools/freetype/freetype/src/psnames/pspic.c rename to drivers/freetype/freetype/src/psnames/pspic.c diff --git a/tools/freetype/freetype/src/psnames/pspic.h b/drivers/freetype/freetype/src/psnames/pspic.h similarity index 100% rename from tools/freetype/freetype/src/psnames/pspic.h rename to drivers/freetype/freetype/src/psnames/pspic.h diff --git a/tools/freetype/freetype/src/psnames/pstables.h b/drivers/freetype/freetype/src/psnames/pstables.h similarity index 100% rename from tools/freetype/freetype/src/psnames/pstables.h rename to drivers/freetype/freetype/src/psnames/pstables.h diff --git a/tools/freetype/freetype/src/psnames/rules.mk b/drivers/freetype/freetype/src/psnames/rules.mk similarity index 100% rename from tools/freetype/freetype/src/psnames/rules.mk rename to drivers/freetype/freetype/src/psnames/rules.mk diff --git a/tools/freetype/freetype/src/raster/Jamfile b/drivers/freetype/freetype/src/raster/Jamfile similarity index 100% rename from tools/freetype/freetype/src/raster/Jamfile rename to drivers/freetype/freetype/src/raster/Jamfile diff --git a/tools/freetype/freetype/src/raster/ftmisc.h b/drivers/freetype/freetype/src/raster/ftmisc.h similarity index 100% rename from tools/freetype/freetype/src/raster/ftmisc.h rename to drivers/freetype/freetype/src/raster/ftmisc.h diff --git a/tools/freetype/freetype/src/raster/ftraster.c b/drivers/freetype/freetype/src/raster/ftraster.c similarity index 100% rename from tools/freetype/freetype/src/raster/ftraster.c rename to drivers/freetype/freetype/src/raster/ftraster.c diff --git a/tools/freetype/freetype/src/raster/ftraster.h b/drivers/freetype/freetype/src/raster/ftraster.h similarity index 100% rename from tools/freetype/freetype/src/raster/ftraster.h rename to drivers/freetype/freetype/src/raster/ftraster.h diff --git a/tools/freetype/freetype/src/raster/ftrend1.c b/drivers/freetype/freetype/src/raster/ftrend1.c similarity index 100% rename from tools/freetype/freetype/src/raster/ftrend1.c rename to drivers/freetype/freetype/src/raster/ftrend1.c diff --git a/tools/freetype/freetype/src/raster/ftrend1.h b/drivers/freetype/freetype/src/raster/ftrend1.h similarity index 100% rename from tools/freetype/freetype/src/raster/ftrend1.h rename to drivers/freetype/freetype/src/raster/ftrend1.h diff --git a/tools/freetype/freetype/src/raster/module.mk b/drivers/freetype/freetype/src/raster/module.mk similarity index 100% rename from tools/freetype/freetype/src/raster/module.mk rename to drivers/freetype/freetype/src/raster/module.mk diff --git a/tools/freetype/freetype/src/raster/raster.c b/drivers/freetype/freetype/src/raster/raster.c similarity index 100% rename from tools/freetype/freetype/src/raster/raster.c rename to drivers/freetype/freetype/src/raster/raster.c diff --git a/tools/freetype/freetype/src/raster/rasterrs.h b/drivers/freetype/freetype/src/raster/rasterrs.h similarity index 100% rename from tools/freetype/freetype/src/raster/rasterrs.h rename to drivers/freetype/freetype/src/raster/rasterrs.h diff --git a/tools/freetype/freetype/src/raster/rastpic.c b/drivers/freetype/freetype/src/raster/rastpic.c similarity index 100% rename from tools/freetype/freetype/src/raster/rastpic.c rename to drivers/freetype/freetype/src/raster/rastpic.c diff --git a/tools/freetype/freetype/src/raster/rastpic.h b/drivers/freetype/freetype/src/raster/rastpic.h similarity index 100% rename from tools/freetype/freetype/src/raster/rastpic.h rename to drivers/freetype/freetype/src/raster/rastpic.h diff --git a/tools/freetype/freetype/src/raster/rules.mk b/drivers/freetype/freetype/src/raster/rules.mk similarity index 100% rename from tools/freetype/freetype/src/raster/rules.mk rename to drivers/freetype/freetype/src/raster/rules.mk diff --git a/tools/freetype/freetype/src/sfnt/Jamfile b/drivers/freetype/freetype/src/sfnt/Jamfile similarity index 100% rename from tools/freetype/freetype/src/sfnt/Jamfile rename to drivers/freetype/freetype/src/sfnt/Jamfile diff --git a/tools/freetype/freetype/src/sfnt/module.mk b/drivers/freetype/freetype/src/sfnt/module.mk similarity index 100% rename from tools/freetype/freetype/src/sfnt/module.mk rename to drivers/freetype/freetype/src/sfnt/module.mk diff --git a/tools/freetype/freetype/src/sfnt/pngshim.c b/drivers/freetype/freetype/src/sfnt/pngshim.c similarity index 100% rename from tools/freetype/freetype/src/sfnt/pngshim.c rename to drivers/freetype/freetype/src/sfnt/pngshim.c diff --git a/tools/freetype/freetype/src/sfnt/pngshim.h b/drivers/freetype/freetype/src/sfnt/pngshim.h similarity index 100% rename from tools/freetype/freetype/src/sfnt/pngshim.h rename to drivers/freetype/freetype/src/sfnt/pngshim.h diff --git a/tools/freetype/freetype/src/sfnt/rules.mk b/drivers/freetype/freetype/src/sfnt/rules.mk similarity index 100% rename from tools/freetype/freetype/src/sfnt/rules.mk rename to drivers/freetype/freetype/src/sfnt/rules.mk diff --git a/tools/freetype/freetype/src/sfnt/sfdriver.c b/drivers/freetype/freetype/src/sfnt/sfdriver.c similarity index 100% rename from tools/freetype/freetype/src/sfnt/sfdriver.c rename to drivers/freetype/freetype/src/sfnt/sfdriver.c diff --git a/tools/freetype/freetype/src/sfnt/sfdriver.h b/drivers/freetype/freetype/src/sfnt/sfdriver.h similarity index 100% rename from tools/freetype/freetype/src/sfnt/sfdriver.h rename to drivers/freetype/freetype/src/sfnt/sfdriver.h diff --git a/tools/freetype/freetype/src/sfnt/sferrors.h b/drivers/freetype/freetype/src/sfnt/sferrors.h similarity index 100% rename from tools/freetype/freetype/src/sfnt/sferrors.h rename to drivers/freetype/freetype/src/sfnt/sferrors.h diff --git a/tools/freetype/freetype/src/sfnt/sfnt.c b/drivers/freetype/freetype/src/sfnt/sfnt.c similarity index 100% rename from tools/freetype/freetype/src/sfnt/sfnt.c rename to drivers/freetype/freetype/src/sfnt/sfnt.c diff --git a/tools/freetype/freetype/src/sfnt/sfntpic.c b/drivers/freetype/freetype/src/sfnt/sfntpic.c similarity index 100% rename from tools/freetype/freetype/src/sfnt/sfntpic.c rename to drivers/freetype/freetype/src/sfnt/sfntpic.c diff --git a/tools/freetype/freetype/src/sfnt/sfntpic.h b/drivers/freetype/freetype/src/sfnt/sfntpic.h similarity index 100% rename from tools/freetype/freetype/src/sfnt/sfntpic.h rename to drivers/freetype/freetype/src/sfnt/sfntpic.h diff --git a/tools/freetype/freetype/src/sfnt/sfobjs.c b/drivers/freetype/freetype/src/sfnt/sfobjs.c similarity index 100% rename from tools/freetype/freetype/src/sfnt/sfobjs.c rename to drivers/freetype/freetype/src/sfnt/sfobjs.c diff --git a/tools/freetype/freetype/src/sfnt/sfobjs.h b/drivers/freetype/freetype/src/sfnt/sfobjs.h similarity index 100% rename from tools/freetype/freetype/src/sfnt/sfobjs.h rename to drivers/freetype/freetype/src/sfnt/sfobjs.h diff --git a/tools/freetype/freetype/src/sfnt/ttbdf.c b/drivers/freetype/freetype/src/sfnt/ttbdf.c similarity index 100% rename from tools/freetype/freetype/src/sfnt/ttbdf.c rename to drivers/freetype/freetype/src/sfnt/ttbdf.c diff --git a/tools/freetype/freetype/src/sfnt/ttbdf.h b/drivers/freetype/freetype/src/sfnt/ttbdf.h similarity index 100% rename from tools/freetype/freetype/src/sfnt/ttbdf.h rename to drivers/freetype/freetype/src/sfnt/ttbdf.h diff --git a/tools/freetype/freetype/src/sfnt/ttcmap.c b/drivers/freetype/freetype/src/sfnt/ttcmap.c similarity index 100% rename from tools/freetype/freetype/src/sfnt/ttcmap.c rename to drivers/freetype/freetype/src/sfnt/ttcmap.c diff --git a/tools/freetype/freetype/src/sfnt/ttcmap.h b/drivers/freetype/freetype/src/sfnt/ttcmap.h similarity index 100% rename from tools/freetype/freetype/src/sfnt/ttcmap.h rename to drivers/freetype/freetype/src/sfnt/ttcmap.h diff --git a/tools/freetype/freetype/src/sfnt/ttcmapc.h b/drivers/freetype/freetype/src/sfnt/ttcmapc.h similarity index 100% rename from tools/freetype/freetype/src/sfnt/ttcmapc.h rename to drivers/freetype/freetype/src/sfnt/ttcmapc.h diff --git a/tools/freetype/freetype/src/sfnt/ttkern.c b/drivers/freetype/freetype/src/sfnt/ttkern.c similarity index 100% rename from tools/freetype/freetype/src/sfnt/ttkern.c rename to drivers/freetype/freetype/src/sfnt/ttkern.c diff --git a/tools/freetype/freetype/src/sfnt/ttkern.h b/drivers/freetype/freetype/src/sfnt/ttkern.h similarity index 100% rename from tools/freetype/freetype/src/sfnt/ttkern.h rename to drivers/freetype/freetype/src/sfnt/ttkern.h diff --git a/tools/freetype/freetype/src/sfnt/ttload.c b/drivers/freetype/freetype/src/sfnt/ttload.c similarity index 100% rename from tools/freetype/freetype/src/sfnt/ttload.c rename to drivers/freetype/freetype/src/sfnt/ttload.c diff --git a/tools/freetype/freetype/src/sfnt/ttload.h b/drivers/freetype/freetype/src/sfnt/ttload.h similarity index 100% rename from tools/freetype/freetype/src/sfnt/ttload.h rename to drivers/freetype/freetype/src/sfnt/ttload.h diff --git a/tools/freetype/freetype/src/sfnt/ttmtx.c b/drivers/freetype/freetype/src/sfnt/ttmtx.c similarity index 100% rename from tools/freetype/freetype/src/sfnt/ttmtx.c rename to drivers/freetype/freetype/src/sfnt/ttmtx.c diff --git a/tools/freetype/freetype/src/sfnt/ttmtx.h b/drivers/freetype/freetype/src/sfnt/ttmtx.h similarity index 100% rename from tools/freetype/freetype/src/sfnt/ttmtx.h rename to drivers/freetype/freetype/src/sfnt/ttmtx.h diff --git a/tools/freetype/freetype/src/sfnt/ttpost.c b/drivers/freetype/freetype/src/sfnt/ttpost.c similarity index 100% rename from tools/freetype/freetype/src/sfnt/ttpost.c rename to drivers/freetype/freetype/src/sfnt/ttpost.c diff --git a/tools/freetype/freetype/src/sfnt/ttpost.h b/drivers/freetype/freetype/src/sfnt/ttpost.h similarity index 100% rename from tools/freetype/freetype/src/sfnt/ttpost.h rename to drivers/freetype/freetype/src/sfnt/ttpost.h diff --git a/tools/freetype/freetype/src/sfnt/ttsbit.c b/drivers/freetype/freetype/src/sfnt/ttsbit.c similarity index 100% rename from tools/freetype/freetype/src/sfnt/ttsbit.c rename to drivers/freetype/freetype/src/sfnt/ttsbit.c diff --git a/tools/freetype/freetype/src/sfnt/ttsbit.h b/drivers/freetype/freetype/src/sfnt/ttsbit.h similarity index 100% rename from tools/freetype/freetype/src/sfnt/ttsbit.h rename to drivers/freetype/freetype/src/sfnt/ttsbit.h diff --git a/tools/freetype/freetype/src/smooth/Jamfile b/drivers/freetype/freetype/src/smooth/Jamfile similarity index 100% rename from tools/freetype/freetype/src/smooth/Jamfile rename to drivers/freetype/freetype/src/smooth/Jamfile diff --git a/tools/freetype/freetype/src/smooth/ftgrays.c b/drivers/freetype/freetype/src/smooth/ftgrays.c similarity index 100% rename from tools/freetype/freetype/src/smooth/ftgrays.c rename to drivers/freetype/freetype/src/smooth/ftgrays.c diff --git a/tools/freetype/freetype/src/smooth/ftgrays.h b/drivers/freetype/freetype/src/smooth/ftgrays.h similarity index 100% rename from tools/freetype/freetype/src/smooth/ftgrays.h rename to drivers/freetype/freetype/src/smooth/ftgrays.h diff --git a/tools/freetype/freetype/src/smooth/ftsmerrs.h b/drivers/freetype/freetype/src/smooth/ftsmerrs.h similarity index 100% rename from tools/freetype/freetype/src/smooth/ftsmerrs.h rename to drivers/freetype/freetype/src/smooth/ftsmerrs.h diff --git a/tools/freetype/freetype/src/smooth/ftsmooth.c b/drivers/freetype/freetype/src/smooth/ftsmooth.c similarity index 100% rename from tools/freetype/freetype/src/smooth/ftsmooth.c rename to drivers/freetype/freetype/src/smooth/ftsmooth.c diff --git a/tools/freetype/freetype/src/smooth/ftsmooth.h b/drivers/freetype/freetype/src/smooth/ftsmooth.h similarity index 100% rename from tools/freetype/freetype/src/smooth/ftsmooth.h rename to drivers/freetype/freetype/src/smooth/ftsmooth.h diff --git a/tools/freetype/freetype/src/smooth/ftspic.c b/drivers/freetype/freetype/src/smooth/ftspic.c similarity index 100% rename from tools/freetype/freetype/src/smooth/ftspic.c rename to drivers/freetype/freetype/src/smooth/ftspic.c diff --git a/tools/freetype/freetype/src/smooth/ftspic.h b/drivers/freetype/freetype/src/smooth/ftspic.h similarity index 100% rename from tools/freetype/freetype/src/smooth/ftspic.h rename to drivers/freetype/freetype/src/smooth/ftspic.h diff --git a/tools/freetype/freetype/src/smooth/module.mk b/drivers/freetype/freetype/src/smooth/module.mk similarity index 100% rename from tools/freetype/freetype/src/smooth/module.mk rename to drivers/freetype/freetype/src/smooth/module.mk diff --git a/tools/freetype/freetype/src/smooth/rules.mk b/drivers/freetype/freetype/src/smooth/rules.mk similarity index 100% rename from tools/freetype/freetype/src/smooth/rules.mk rename to drivers/freetype/freetype/src/smooth/rules.mk diff --git a/tools/freetype/freetype/src/smooth/smooth.c b/drivers/freetype/freetype/src/smooth/smooth.c similarity index 100% rename from tools/freetype/freetype/src/smooth/smooth.c rename to drivers/freetype/freetype/src/smooth/smooth.c diff --git a/tools/freetype/freetype/src/truetype/Jamfile b/drivers/freetype/freetype/src/truetype/Jamfile similarity index 100% rename from tools/freetype/freetype/src/truetype/Jamfile rename to drivers/freetype/freetype/src/truetype/Jamfile diff --git a/tools/freetype/freetype/src/truetype/module.mk b/drivers/freetype/freetype/src/truetype/module.mk similarity index 100% rename from tools/freetype/freetype/src/truetype/module.mk rename to drivers/freetype/freetype/src/truetype/module.mk diff --git a/tools/freetype/freetype/src/truetype/rules.mk b/drivers/freetype/freetype/src/truetype/rules.mk similarity index 100% rename from tools/freetype/freetype/src/truetype/rules.mk rename to drivers/freetype/freetype/src/truetype/rules.mk diff --git a/tools/freetype/freetype/src/truetype/truetype.c b/drivers/freetype/freetype/src/truetype/truetype.c similarity index 100% rename from tools/freetype/freetype/src/truetype/truetype.c rename to drivers/freetype/freetype/src/truetype/truetype.c diff --git a/tools/freetype/freetype/src/truetype/ttdriver.c b/drivers/freetype/freetype/src/truetype/ttdriver.c similarity index 100% rename from tools/freetype/freetype/src/truetype/ttdriver.c rename to drivers/freetype/freetype/src/truetype/ttdriver.c diff --git a/tools/freetype/freetype/src/truetype/ttdriver.h b/drivers/freetype/freetype/src/truetype/ttdriver.h similarity index 100% rename from tools/freetype/freetype/src/truetype/ttdriver.h rename to drivers/freetype/freetype/src/truetype/ttdriver.h diff --git a/tools/freetype/freetype/src/truetype/tterrors.h b/drivers/freetype/freetype/src/truetype/tterrors.h similarity index 100% rename from tools/freetype/freetype/src/truetype/tterrors.h rename to drivers/freetype/freetype/src/truetype/tterrors.h diff --git a/tools/freetype/freetype/src/truetype/ttgload.c b/drivers/freetype/freetype/src/truetype/ttgload.c similarity index 100% rename from tools/freetype/freetype/src/truetype/ttgload.c rename to drivers/freetype/freetype/src/truetype/ttgload.c diff --git a/tools/freetype/freetype/src/truetype/ttgload.h b/drivers/freetype/freetype/src/truetype/ttgload.h similarity index 100% rename from tools/freetype/freetype/src/truetype/ttgload.h rename to drivers/freetype/freetype/src/truetype/ttgload.h diff --git a/tools/freetype/freetype/src/truetype/ttgxvar.c b/drivers/freetype/freetype/src/truetype/ttgxvar.c similarity index 100% rename from tools/freetype/freetype/src/truetype/ttgxvar.c rename to drivers/freetype/freetype/src/truetype/ttgxvar.c diff --git a/tools/freetype/freetype/src/truetype/ttgxvar.h b/drivers/freetype/freetype/src/truetype/ttgxvar.h similarity index 100% rename from tools/freetype/freetype/src/truetype/ttgxvar.h rename to drivers/freetype/freetype/src/truetype/ttgxvar.h diff --git a/tools/freetype/freetype/src/truetype/ttinterp.c b/drivers/freetype/freetype/src/truetype/ttinterp.c similarity index 100% rename from tools/freetype/freetype/src/truetype/ttinterp.c rename to drivers/freetype/freetype/src/truetype/ttinterp.c diff --git a/tools/freetype/freetype/src/truetype/ttinterp.h b/drivers/freetype/freetype/src/truetype/ttinterp.h similarity index 100% rename from tools/freetype/freetype/src/truetype/ttinterp.h rename to drivers/freetype/freetype/src/truetype/ttinterp.h diff --git a/tools/freetype/freetype/src/truetype/ttobjs.c b/drivers/freetype/freetype/src/truetype/ttobjs.c similarity index 100% rename from tools/freetype/freetype/src/truetype/ttobjs.c rename to drivers/freetype/freetype/src/truetype/ttobjs.c diff --git a/tools/freetype/freetype/src/truetype/ttobjs.h b/drivers/freetype/freetype/src/truetype/ttobjs.h similarity index 100% rename from tools/freetype/freetype/src/truetype/ttobjs.h rename to drivers/freetype/freetype/src/truetype/ttobjs.h diff --git a/tools/freetype/freetype/src/truetype/ttpic.c b/drivers/freetype/freetype/src/truetype/ttpic.c similarity index 100% rename from tools/freetype/freetype/src/truetype/ttpic.c rename to drivers/freetype/freetype/src/truetype/ttpic.c diff --git a/tools/freetype/freetype/src/truetype/ttpic.h b/drivers/freetype/freetype/src/truetype/ttpic.h similarity index 100% rename from tools/freetype/freetype/src/truetype/ttpic.h rename to drivers/freetype/freetype/src/truetype/ttpic.h diff --git a/tools/freetype/freetype/src/truetype/ttpload.c b/drivers/freetype/freetype/src/truetype/ttpload.c similarity index 100% rename from tools/freetype/freetype/src/truetype/ttpload.c rename to drivers/freetype/freetype/src/truetype/ttpload.c diff --git a/tools/freetype/freetype/src/truetype/ttpload.h b/drivers/freetype/freetype/src/truetype/ttpload.h similarity index 100% rename from tools/freetype/freetype/src/truetype/ttpload.h rename to drivers/freetype/freetype/src/truetype/ttpload.h diff --git a/tools/freetype/freetype/src/truetype/ttsubpix.c b/drivers/freetype/freetype/src/truetype/ttsubpix.c similarity index 100% rename from tools/freetype/freetype/src/truetype/ttsubpix.c rename to drivers/freetype/freetype/src/truetype/ttsubpix.c diff --git a/tools/freetype/freetype/src/truetype/ttsubpix.h b/drivers/freetype/freetype/src/truetype/ttsubpix.h similarity index 100% rename from tools/freetype/freetype/src/truetype/ttsubpix.h rename to drivers/freetype/freetype/src/truetype/ttsubpix.h diff --git a/tools/freetype/freetype/src/type1/Jamfile b/drivers/freetype/freetype/src/type1/Jamfile similarity index 100% rename from tools/freetype/freetype/src/type1/Jamfile rename to drivers/freetype/freetype/src/type1/Jamfile diff --git a/tools/freetype/freetype/src/type1/module.mk b/drivers/freetype/freetype/src/type1/module.mk similarity index 100% rename from tools/freetype/freetype/src/type1/module.mk rename to drivers/freetype/freetype/src/type1/module.mk diff --git a/tools/freetype/freetype/src/type1/rules.mk b/drivers/freetype/freetype/src/type1/rules.mk similarity index 100% rename from tools/freetype/freetype/src/type1/rules.mk rename to drivers/freetype/freetype/src/type1/rules.mk diff --git a/tools/freetype/freetype/src/type1/t1afm.c b/drivers/freetype/freetype/src/type1/t1afm.c similarity index 100% rename from tools/freetype/freetype/src/type1/t1afm.c rename to drivers/freetype/freetype/src/type1/t1afm.c diff --git a/tools/freetype/freetype/src/type1/t1afm.h b/drivers/freetype/freetype/src/type1/t1afm.h similarity index 100% rename from tools/freetype/freetype/src/type1/t1afm.h rename to drivers/freetype/freetype/src/type1/t1afm.h diff --git a/tools/freetype/freetype/src/type1/t1driver.c b/drivers/freetype/freetype/src/type1/t1driver.c similarity index 100% rename from tools/freetype/freetype/src/type1/t1driver.c rename to drivers/freetype/freetype/src/type1/t1driver.c diff --git a/tools/freetype/freetype/src/type1/t1driver.h b/drivers/freetype/freetype/src/type1/t1driver.h similarity index 100% rename from tools/freetype/freetype/src/type1/t1driver.h rename to drivers/freetype/freetype/src/type1/t1driver.h diff --git a/tools/freetype/freetype/src/type1/t1errors.h b/drivers/freetype/freetype/src/type1/t1errors.h similarity index 100% rename from tools/freetype/freetype/src/type1/t1errors.h rename to drivers/freetype/freetype/src/type1/t1errors.h diff --git a/tools/freetype/freetype/src/type1/t1gload.c b/drivers/freetype/freetype/src/type1/t1gload.c similarity index 100% rename from tools/freetype/freetype/src/type1/t1gload.c rename to drivers/freetype/freetype/src/type1/t1gload.c diff --git a/tools/freetype/freetype/src/type1/t1gload.h b/drivers/freetype/freetype/src/type1/t1gload.h similarity index 100% rename from tools/freetype/freetype/src/type1/t1gload.h rename to drivers/freetype/freetype/src/type1/t1gload.h diff --git a/tools/freetype/freetype/src/type1/t1load.c b/drivers/freetype/freetype/src/type1/t1load.c similarity index 100% rename from tools/freetype/freetype/src/type1/t1load.c rename to drivers/freetype/freetype/src/type1/t1load.c diff --git a/tools/freetype/freetype/src/type1/t1load.h b/drivers/freetype/freetype/src/type1/t1load.h similarity index 100% rename from tools/freetype/freetype/src/type1/t1load.h rename to drivers/freetype/freetype/src/type1/t1load.h diff --git a/tools/freetype/freetype/src/type1/t1objs.c b/drivers/freetype/freetype/src/type1/t1objs.c similarity index 100% rename from tools/freetype/freetype/src/type1/t1objs.c rename to drivers/freetype/freetype/src/type1/t1objs.c diff --git a/tools/freetype/freetype/src/type1/t1objs.h b/drivers/freetype/freetype/src/type1/t1objs.h similarity index 100% rename from tools/freetype/freetype/src/type1/t1objs.h rename to drivers/freetype/freetype/src/type1/t1objs.h diff --git a/tools/freetype/freetype/src/type1/t1parse.c b/drivers/freetype/freetype/src/type1/t1parse.c similarity index 100% rename from tools/freetype/freetype/src/type1/t1parse.c rename to drivers/freetype/freetype/src/type1/t1parse.c diff --git a/tools/freetype/freetype/src/type1/t1parse.h b/drivers/freetype/freetype/src/type1/t1parse.h similarity index 100% rename from tools/freetype/freetype/src/type1/t1parse.h rename to drivers/freetype/freetype/src/type1/t1parse.h diff --git a/tools/freetype/freetype/src/type1/t1tokens.h b/drivers/freetype/freetype/src/type1/t1tokens.h similarity index 100% rename from tools/freetype/freetype/src/type1/t1tokens.h rename to drivers/freetype/freetype/src/type1/t1tokens.h diff --git a/tools/freetype/freetype/src/type1/type1.c b/drivers/freetype/freetype/src/type1/type1.c similarity index 100% rename from tools/freetype/freetype/src/type1/type1.c rename to drivers/freetype/freetype/src/type1/type1.c diff --git a/tools/freetype/freetype/src/type42/Jamfile b/drivers/freetype/freetype/src/type42/Jamfile similarity index 100% rename from tools/freetype/freetype/src/type42/Jamfile rename to drivers/freetype/freetype/src/type42/Jamfile diff --git a/tools/freetype/freetype/src/type42/module.mk b/drivers/freetype/freetype/src/type42/module.mk similarity index 100% rename from tools/freetype/freetype/src/type42/module.mk rename to drivers/freetype/freetype/src/type42/module.mk diff --git a/tools/freetype/freetype/src/type42/rules.mk b/drivers/freetype/freetype/src/type42/rules.mk similarity index 100% rename from tools/freetype/freetype/src/type42/rules.mk rename to drivers/freetype/freetype/src/type42/rules.mk diff --git a/tools/freetype/freetype/src/type42/t42drivr.c b/drivers/freetype/freetype/src/type42/t42drivr.c similarity index 100% rename from tools/freetype/freetype/src/type42/t42drivr.c rename to drivers/freetype/freetype/src/type42/t42drivr.c diff --git a/tools/freetype/freetype/src/type42/t42drivr.h b/drivers/freetype/freetype/src/type42/t42drivr.h similarity index 100% rename from tools/freetype/freetype/src/type42/t42drivr.h rename to drivers/freetype/freetype/src/type42/t42drivr.h diff --git a/tools/freetype/freetype/src/type42/t42error.h b/drivers/freetype/freetype/src/type42/t42error.h similarity index 100% rename from tools/freetype/freetype/src/type42/t42error.h rename to drivers/freetype/freetype/src/type42/t42error.h diff --git a/tools/freetype/freetype/src/type42/t42objs.c b/drivers/freetype/freetype/src/type42/t42objs.c similarity index 100% rename from tools/freetype/freetype/src/type42/t42objs.c rename to drivers/freetype/freetype/src/type42/t42objs.c diff --git a/tools/freetype/freetype/src/type42/t42objs.h b/drivers/freetype/freetype/src/type42/t42objs.h similarity index 100% rename from tools/freetype/freetype/src/type42/t42objs.h rename to drivers/freetype/freetype/src/type42/t42objs.h diff --git a/tools/freetype/freetype/src/type42/t42parse.c b/drivers/freetype/freetype/src/type42/t42parse.c similarity index 100% rename from tools/freetype/freetype/src/type42/t42parse.c rename to drivers/freetype/freetype/src/type42/t42parse.c diff --git a/tools/freetype/freetype/src/type42/t42parse.h b/drivers/freetype/freetype/src/type42/t42parse.h similarity index 100% rename from tools/freetype/freetype/src/type42/t42parse.h rename to drivers/freetype/freetype/src/type42/t42parse.h diff --git a/tools/freetype/freetype/src/type42/t42types.h b/drivers/freetype/freetype/src/type42/t42types.h similarity index 100% rename from tools/freetype/freetype/src/type42/t42types.h rename to drivers/freetype/freetype/src/type42/t42types.h diff --git a/tools/freetype/freetype/src/type42/type42.c b/drivers/freetype/freetype/src/type42/type42.c similarity index 100% rename from tools/freetype/freetype/src/type42/type42.c rename to drivers/freetype/freetype/src/type42/type42.c diff --git a/tools/freetype/freetype/src/winfonts/Jamfile b/drivers/freetype/freetype/src/winfonts/Jamfile similarity index 100% rename from tools/freetype/freetype/src/winfonts/Jamfile rename to drivers/freetype/freetype/src/winfonts/Jamfile diff --git a/tools/freetype/freetype/src/winfonts/fnterrs.h b/drivers/freetype/freetype/src/winfonts/fnterrs.h similarity index 100% rename from tools/freetype/freetype/src/winfonts/fnterrs.h rename to drivers/freetype/freetype/src/winfonts/fnterrs.h diff --git a/tools/freetype/freetype/src/winfonts/module.mk b/drivers/freetype/freetype/src/winfonts/module.mk similarity index 100% rename from tools/freetype/freetype/src/winfonts/module.mk rename to drivers/freetype/freetype/src/winfonts/module.mk diff --git a/tools/freetype/freetype/src/winfonts/rules.mk b/drivers/freetype/freetype/src/winfonts/rules.mk similarity index 100% rename from tools/freetype/freetype/src/winfonts/rules.mk rename to drivers/freetype/freetype/src/winfonts/rules.mk diff --git a/tools/freetype/freetype/src/winfonts/winfnt.c b/drivers/freetype/freetype/src/winfonts/winfnt.c similarity index 100% rename from tools/freetype/freetype/src/winfonts/winfnt.c rename to drivers/freetype/freetype/src/winfonts/winfnt.c diff --git a/tools/freetype/freetype/src/winfonts/winfnt.h b/drivers/freetype/freetype/src/winfonts/winfnt.h similarity index 100% rename from tools/freetype/freetype/src/winfonts/winfnt.h rename to drivers/freetype/freetype/src/winfonts/winfnt.h diff --git a/tools/freetype/ft2build.h b/drivers/freetype/ft2build.h similarity index 100% rename from tools/freetype/ft2build.h rename to drivers/freetype/ft2build.h diff --git a/drivers/register_driver_types.cpp b/drivers/register_driver_types.cpp index 235438f1267..afa5f34bead 100644 --- a/drivers/register_driver_types.cpp +++ b/drivers/register_driver_types.cpp @@ -113,6 +113,7 @@ static ResourceFormatLoaderAudioStreamMPC * mpc_stream_loader=NULL; #endif + static ResourceFormatPBM * pbm_loader=NULL; void register_core_driver_types() { @@ -141,6 +142,7 @@ void register_core_driver_types() { ImageLoader::add_image_format_loader( image_loader_jpg ); #endif + pbm_loader = memnew( ResourceFormatPBM ); ResourceLoader::add_resource_format_loader(pbm_loader); @@ -250,6 +252,7 @@ void register_driver_types() { void unregister_driver_types() { + #ifdef TREMOR_ENABLED memdelete( vorbis_stream_loader ); #endif diff --git a/modules/gdscript/gd_parser.cpp b/modules/gdscript/gd_parser.cpp index b713dc318f7..9e90027a706 100644 --- a/modules/gdscript/gd_parser.cpp +++ b/modules/gdscript/gd_parser.cpp @@ -86,7 +86,7 @@ bool GDParser::_enter_indent_block(BlockNode* p_block) { while(true) { if (tokenizer->get_token()!=GDTokenizer::TK_NEWLINE) { - print_line("no newline"); + return false; //wtf } else if (tokenizer->get_token(1)!=GDTokenizer::TK_NEWLINE) { diff --git a/platform/windows/detect.py b/platform/windows/detect.py index 56e8a5d45d4..ed0049b3623 100644 --- a/platform/windows/detect.py +++ b/platform/windows/detect.py @@ -204,8 +204,8 @@ def configure(env): if (env["freetype"]!="no"): env.Append(CCFLAGS=['/DFREETYPE_ENABLED']) - env.Append(CPPPATH=['#tools/freetype']) - env.Append(CPPPATH=['#tools/freetype/freetype/include']) + env.Append(CPPPATH=['#drivers/freetype']) + env.Append(CPPPATH=['#drivers/freetype/freetype/include']) if (env["target"]=="release"): diff --git a/platform/x11/detect.py b/platform/x11/detect.py index 6b3f7147efc..5a43bf9323e 100644 --- a/platform/x11/detect.py +++ b/platform/x11/detect.py @@ -143,8 +143,8 @@ def configure(env): if (env["freetype"]!="no"): env.Append(CCFLAGS=['-DFREETYPE_ENABLED']) if (env["freetype"]=="builtin"): - env.Append(CPPPATH=['#tools/freetype']) - env.Append(CPPPATH=['#tools/freetype/freetype/include']) + env.Append(CPPPATH=['#drivers/freetype']) + env.Append(CPPPATH=['#drivers/freetype/freetype/include']) env.Append(CPPFLAGS=['-DOPENGL_ENABLED','-DGLEW_ENABLED']) diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 03024daff5b..d021c7b40e7 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -412,7 +412,7 @@ void TextEdit::_notification(int p_what) { case NOTIFICATION_THEME_CHANGED: { _update_caches(); - }; + } break; case NOTIFICATION_DRAW: { int line_number_char_count=0; diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp index 8327473a605..1fd1c77dca0 100644 --- a/scene/register_scene_types.cpp +++ b/scene/register_scene_types.cpp @@ -133,6 +133,7 @@ #include "scene/resources/mesh_data_tool.h" #include "scene/resources/scene_preloader.h" #include "scene/resources/dynamic_font.h" +#include "scene/resources/dynamic_font_stb.h" #include "scene/main/timer.h" @@ -254,7 +255,6 @@ void register_scene_types() { resource_loader_wav = memnew( ResourceFormatLoaderWAV ); ResourceLoader::add_resource_format_loader( resource_loader_wav ); - resource_loader_dynamic_font = memnew( ResourceFormatLoaderDynamicFont ); ResourceLoader::add_resource_format_loader( resource_loader_dynamic_font ); @@ -578,8 +578,10 @@ void register_scene_types() { ObjectTypeDB::register_type(); ObjectTypeDB::register_virtual_type(); ObjectTypeDB::register_type(); + ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); + ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); @@ -647,6 +649,7 @@ void unregister_scene_types() { memdelete( resource_loader_image ); memdelete( resource_loader_wav ); memdelete( resource_loader_dynamic_font ); + #ifdef TOOLS_ENABLED diff --git a/scene/resources/dynamic_font.cpp b/scene/resources/dynamic_font.cpp index 19aa0e79cca..c76b5f3d3ac 100644 --- a/scene/resources/dynamic_font.cpp +++ b/scene/resources/dynamic_font.cpp @@ -1,65 +1,11 @@ +#ifdef FREETYPE_ENABLED #include "dynamic_font.h" -#define STB_TRUETYPE_IMPLEMENTATION -#include "stb_truetype.h" #include "os/file_access.h" -void DynamicFontData::lock() { - fr=font_data.read(); - - if (fr.ptr()!=last_data_ptr) { - - last_data_ptr=fr.ptr(); - - if (!stbtt_InitFont(&info, last_data_ptr, 0)) { - valid=false; - } else { - valid=true; - } - - last_data_ptr=fr.ptr(); - } -} - -void DynamicFontData::unlock() { - - fr = DVector::Read(); -} - -void DynamicFontData::set_font_data(const DVector& p_font) { - //clear caches and stuff - ERR_FAIL_COND(font_data.size()) ; - font_data=p_font; - - lock(); - - if (valid) { - stbtt_GetFontVMetrics(&info, &ascent, &descent, &linegap); - descent=-descent + linegap; - - for(int i=32;i<1024;i++) { - for(int j=32;j<1024;j++) { - - int kern = stbtt_GetCodepointKernAdvance(&info, i,j); - if (kern!=0) { - KerningPairKey kpk; - kpk.A=i; - kpk.B=j; - kerning_map[kpk]=kern; - } - } - } - } - - unlock(); - //clear existing stuff - - ERR_FAIL_COND(!valid); -} Ref DynamicFontData::_get_dynamic_font_at_size(int p_size) { - ERR_FAIL_COND_V(!valid,Ref()); if (size_cache.has(p_size)) { return Ref( size_cache[p_size] ); @@ -67,6 +13,7 @@ Ref DynamicFontData::_get_dynamic_font_at_size(int p_size) { Ref dfas; + dfas.instance(); dfas->font=Ref( this ); @@ -74,21 +21,34 @@ Ref DynamicFontData::_get_dynamic_font_at_size(int p_size) { size_cache[p_size]=dfas.ptr(); dfas->size=p_size; - - lock(); - - dfas->scale = stbtt_ScaleForPixelHeight(&info, p_size); - - unlock(); + dfas->_load(); return dfas; } +void DynamicFontData::set_font_ptr(const uint8_t* p_font_mem,int p_font_mem_size) { + + font_mem=p_font_mem; + font_mem_size=p_font_mem_size; +} + +void DynamicFontData::set_font_path(const String& p_path) { + + font_path=p_path; +} + +void DynamicFontData::set_force_autohinter(bool p_force) { + + force_autohinter=p_force; +} + DynamicFontData::DynamicFontData() { - last_data_ptr=NULL; - valid=false; + + force_autohinter=false; + font_mem=NULL; + font_mem_size=0; } DynamicFontData::~DynamicFontData() @@ -100,22 +60,106 @@ DynamicFontData::~DynamicFontData() //////////////////// +Error DynamicFontAtSize::_load() { + + + int error = FT_Init_FreeType( &library ); + + ERR_EXPLAIN(TTR("Error initializing FreeType.")); + ERR_FAIL_COND_V( error !=0, ERR_CANT_CREATE ); + + if (font->font_path!=String()) { + + FileAccess *f=FileAccess::open(font->font_path,FileAccess::READ); + ERR_FAIL_COND_V(!f,ERR_CANT_OPEN); + + memset(&stream,0,sizeof(FT_StreamRec)); + stream.base=NULL; + stream.size=f->get_len(); + stream.pos=0; + stream.descriptor.pointer=f; + stream.read=_ft_stream_io; + stream.close=_ft_stream_close; + + FT_Open_Args fargs; + memset(&fargs,0,sizeof(FT_Open_Args)); + fargs.flags=FT_OPEN_STREAM; + fargs.stream=&stream; + error = FT_Open_Face( library,&fargs,0,&face); + } else if (font->font_mem) { + + memset(&stream,0,sizeof(FT_StreamRec)); + stream.base=(unsigned char*)font->font_mem; + stream.size=font->font_mem_size; + stream.pos=0; + + FT_Open_Args fargs; + memset(&fargs,0,sizeof(FT_Open_Args)); + fargs.memory_base=(unsigned char*)font->font_mem; + fargs.memory_size=font->font_mem_size; + fargs.flags= FT_OPEN_MEMORY; + fargs.stream=&stream; + error = FT_Open_Face( library,&fargs,0,&face); + + } else { + ERR_EXPLAIN("DynamicFont uninitialized"); + ERR_FAIL_V(ERR_UNCONFIGURED); + } + + //error = FT_New_Face( library, src_path.utf8().get_data(),0,&face ); + + if ( error == FT_Err_Unknown_File_Format ) { + ERR_EXPLAIN(TTR("Unknown font format.")); + FT_Done_FreeType( library ); + + } else if ( error ) { + + ERR_EXPLAIN(TTR("Error loading font.")); + FT_Done_FreeType( library ); + + } + + ERR_FAIL_COND_V(error,ERR_FILE_CANT_OPEN); + + + /*error = FT_Set_Char_Size(face,0,64*size,512,512); + + if ( error ) { + FT_Done_FreeType( library ); + ERR_EXPLAIN(TTR("Invalid font size.")); + ERR_FAIL_COND_V( error, ERR_INVALID_PARAMETER ); + }*/ + + error = FT_Set_Pixel_Sizes(face,0,size); + + ascent=face->size->metrics.ascender>>6; + descent=-face->size->metrics.descender>>6; + linegap=0; + + //print_line("ASCENT: "+itos(ascent)+" descent "+itos(descent)+" hinted: "+itos(face->face_flags&FT_FACE_FLAG_HINTER)); + + valid=true; + return OK; +} + float DynamicFontAtSize::get_height() const { - return (font->ascent+font->descent)*scale; + return ascent+descent; } float DynamicFontAtSize::get_ascent() const { - return font->ascent*scale; + return ascent; } float DynamicFontAtSize::get_descent() const { - return font->descent*scale; + return descent; } Size2 DynamicFontAtSize::get_char_size(CharType p_char,CharType p_next) const { + if (!valid) + return Size2(1,1); const_cast(this)->_update_char(p_char); const Character *c = char_map.getptr(p_char); @@ -124,14 +168,9 @@ Size2 DynamicFontAtSize::get_char_size(CharType p_char,CharType p_next) const { Size2 ret( c->advance, get_height()); if (p_next) { - DynamicFontData::KerningPairKey kpk; - kpk.A=p_char; - kpk.B=p_next; - - const Map::Element *K=font->kerning_map.find(kpk); - if (K) { - ret.x+=K->get()*scale; - } + FT_Vector delta; + FT_Get_Kerning( face, p_char,p_next, FT_KERNING_DEFAULT, &delta ); + ret.x+=delta.x>>6; } @@ -141,6 +180,9 @@ Size2 DynamicFontAtSize::get_char_size(CharType p_char,CharType p_next) const { float DynamicFontAtSize::draw_char(RID p_canvas_item, const Point2& p_pos, const CharType& p_char,const CharType& p_next,const Color& p_modulate) const { + if (!valid) + return 0; + const_cast(this)->_update_char(p_char); const Character * c = char_map.getptr(p_char); @@ -161,58 +203,84 @@ float DynamicFontAtSize::draw_char(RID p_canvas_item, const Point2& p_pos, const float ret = c->advance; if (p_next) { - DynamicFontData::KerningPairKey kpk; - kpk.A=p_char; - kpk.B=p_next; - const Map::Element *K=font->kerning_map.find(kpk); - if (K) { - ret+=K->get()*scale; - } + FT_Vector delta; + FT_Get_Kerning( face, p_char,p_next, FT_KERNING_DEFAULT, &delta ); + ret+=delta.x>>6; } return ret; } +unsigned long DynamicFontAtSize::_ft_stream_io(FT_Stream stream, unsigned long offset, unsigned char* buffer, unsigned long count ) { + + + FileAccess *f=(FileAccess*)stream->descriptor.pointer; + + if (f->get_pos()!=offset) { + f->seek(offset); + + } + + if (count==0) + return 0; + + return f->get_buffer(buffer,count); +} +void DynamicFontAtSize::_ft_stream_close(FT_Stream stream) { + + FileAccess *f=(FileAccess*)stream->descriptor.pointer; + f->close(); + memdelete(f); +} + void DynamicFontAtSize::_update_char(CharType p_char) { if (char_map.has(p_char)) return; - font->lock(); + _THREAD_SAFE_METHOD_ + FT_GlyphSlot slot = face->glyph; - int w,h,xofs,yofs; - unsigned char * cpbitmap = stbtt_GetCodepointBitmap(&font->info, scale, scale, p_char, &w, &h, &xofs, &yofs ); + int error = FT_Load_Char( face, p_char, FT_LOAD_RENDER|(font->force_autohinter?FT_LOAD_FORCE_AUTOHINT:0) ); + if (!error) { + error = FT_Render_Glyph( face->glyph, ft_render_mode_normal ); + } + if (error) { - if (!cpbitmap) { - //no glyph - - int advance; - stbtt_GetCodepointHMetrics(&font->info, p_char, &advance, 0); + int advance=0; + //stbtt_GetCodepointHMetrics(&font->info, p_char, &advance, 0); //print_line("char has no bitmap: "+itos(p_char)+" but advance is "+itos(advance*scale)); Character ch; ch.texture_idx=-1; - ch.advance=advance*scale; + ch.advance=advance; ch.h_align=0; ch.v_align=0; char_map[p_char]=ch; - font->unlock(); return; } + + + int w = slot->bitmap.width; + int h = slot->bitmap.rows; + int p = slot->bitmap.pitch; + int yofs=slot->bitmap_top; + int xofs=slot->bitmap_left; + int advance=slot->advance.x>>6; + + int mw=w+rect_margin*2; int mh=h+rect_margin*2; if (mw>4096 || mh>4096) { - stbtt_FreeBitmap(cpbitmap,NULL); - font->unlock(); ERR_FAIL_COND(mw>4096); ERR_FAIL_COND(mh>4096); } @@ -304,13 +372,14 @@ void DynamicFontAtSize::_update_char(CharType p_char) { { DVector::Write wr = tex.imgdata.write(); + for(int i=0;i= tex.imgdata.size()); wr[ofs+0]=255; //grayscale as 1 - wr[ofs+1]=cpbitmap[i*w+j]; //alpha as 0 + wr[ofs+1]=slot->bitmap.buffer[i*slot->bitmap.width+j]; } } } @@ -322,7 +391,7 @@ void DynamicFontAtSize::_update_char(CharType p_char) { if (tex.texture.is_null()) { tex.texture.instance(); - tex.texture->create_from_image(img,Texture::FLAG_FILTER); + tex.texture->create_from_image(img,0/*Texture::FLAG_FILTER*/); } else { tex.texture->set_data(img); //update } @@ -337,13 +406,11 @@ void DynamicFontAtSize::_update_char(CharType p_char) { tex.offsets[k]=tex_y+mh; } - int advance; - stbtt_GetCodepointHMetrics(&font->info, p_char, &advance, 0); Character chr; chr.h_align=xofs; - chr.v_align=yofs + get_ascent(); - chr.advance=advance*scale; + chr.v_align=ascent-yofs;// + ascent - descent; + chr.advance=advance; chr.texture_idx=tex_index; @@ -353,21 +420,24 @@ void DynamicFontAtSize::_update_char(CharType p_char) { char_map[p_char]=chr; - stbtt_FreeBitmap(cpbitmap,NULL); - - font->unlock(); } DynamicFontAtSize::DynamicFontAtSize() { + valid=false; rect_margin=1; + ascent=1; + descent=1; + linegap=1; } DynamicFontAtSize::~DynamicFontAtSize(){ - ERR_FAIL_COND(!font.ptr()); - font->size_cache.erase(size); + if (valid) { + FT_Done_FreeType( library ); + font->size_cache.erase(size); + } } ///////////////////////// @@ -478,34 +548,21 @@ RES ResourceFormatLoaderDynamicFont::load(const String &p_path, const String& p_ if (r_error) *r_error=ERR_FILE_CANT_OPEN; + Ref dfont; + dfont.instance();; + dfont->set_font_path(p_path); - FileAccess *f = FileAccess::open(p_path,FileAccess::READ); - ERR_FAIL_COND_V(!f,RES()); - - DVector data; - - data.resize(f->get_len()); - - ERR_FAIL_COND_V(data.size()==0,RES()); - - { - DVector::Write w = data.write(); - f->get_buffer(w.ptr(),data.size()); - } - - Ref dfd; - dfd.instance(); - dfd->set_font_data(data); if (r_error) *r_error=OK; - return dfd; + return dfont; } void ResourceFormatLoaderDynamicFont::get_recognized_extensions(List *p_extensions) const { p_extensions->push_back("ttf"); + p_extensions->push_back("otf"); } bool ResourceFormatLoaderDynamicFont::handles_type(const String& p_type) const { @@ -516,8 +573,10 @@ bool ResourceFormatLoaderDynamicFont::handles_type(const String& p_type) const { String ResourceFormatLoaderDynamicFont::get_resource_type(const String &p_path) const { String el = p_path.extension().to_lower(); - if (el=="ttf") + if (el=="ttf" || el=="otf") return "DynamicFontData"; return ""; } + +#endif diff --git a/scene/resources/dynamic_font.h b/scene/resources/dynamic_font.h index ba7249a7b74..f0cf80b042e 100644 --- a/scene/resources/dynamic_font.h +++ b/scene/resources/dynamic_font.h @@ -1,10 +1,14 @@ -#ifndef DYNAMICFONT_H -#define DYNAMICFONT_H +#ifndef DYNAMIC_FONT_H +#define DYNAMIC_FONT_H -#include "font.h" -#include "stb_truetype.h" +#ifdef FREETYPE_ENABLED +#include "scene/resources/font.h" +#include "os/thread_safe.h" #include "io/resource_loader.h" +#include +#include FT_FREETYPE_H + class DynamicFontAtSize; class DynamicFont; @@ -13,39 +17,16 @@ class DynamicFontData : public Resource { OBJ_TYPE(DynamicFontData,Resource); - bool valid; - - DVector font_data; - DVector::Read fr; - const uint8_t* last_data_ptr; - - struct KerningPairKey { - - union { - struct { - uint32_t A,B; - }; - - uint64_t pair; - }; - - _FORCE_INLINE_ bool operator<(const KerningPairKey& p_r) const { return pair kerning_map; + const uint8_t *font_mem; + int font_mem_size; + bool force_autohinter; + + String font_path; Map size_cache; -friend class DynamicFontAtSize; - - stbtt_fontinfo info; - int ascent; - int descent; - int linegap; - - void lock(); - void unlock(); + friend class DynamicFontAtSize; friend class DynamicFont; @@ -53,7 +34,10 @@ friend class DynamicFont; Ref _get_dynamic_font_at_size(int p_size); public: - void set_font_data(const DVector& p_font); + void set_font_ptr(const uint8_t* p_font_mem,int p_font_mem_size); + void set_font_path(const String& p_path); + void set_force_autohinter(bool p_force); + DynamicFontData(); ~DynamicFontData(); }; @@ -61,11 +45,21 @@ public: class DynamicFontAtSize : public Reference { - OBJ_TYPE(DynamicFontAtSize,Reference); + OBJ_TYPE(DynamicFontAtSize,Reference) + _THREAD_SAFE_CLASS_ + FT_Library library; /* handle to library */ + FT_Face face; /* handle to face object */ + FT_StreamRec stream; + + int ascent; + int descent; + int linegap; int rect_margin; + bool valid; + struct CharTexture { DVector imgdata; @@ -88,6 +82,8 @@ class DynamicFontAtSize : public Reference { }; + static unsigned long _ft_stream_io(FT_Stream stream, unsigned long offset, unsigned char* buffer, unsigned long count ); + static void _ft_stream_close(FT_Stream stream); HashMap< CharType, Character > char_map; @@ -95,13 +91,18 @@ class DynamicFontAtSize : public Reference { friend class DynamicFontData; Ref font; - float scale; int size; + + + Error _load(); protected: + + public: + float get_height() const; float get_ascent() const; @@ -126,7 +127,7 @@ class DynamicFont : public Font { Ref data; Ref data_at_size; int size; - + bool valid; protected: @@ -171,5 +172,6 @@ public: }; +#endif -#endif // DYNAMICFONT_H +#endif diff --git a/scene/resources/dynamic_font_stb.cpp b/scene/resources/dynamic_font_stb.cpp new file mode 100644 index 00000000000..344043fcdde --- /dev/null +++ b/scene/resources/dynamic_font_stb.cpp @@ -0,0 +1,527 @@ +#include "dynamic_font_stb.h" + +#ifndef FREETYPE_ENABLED + +#define STB_TRUETYPE_IMPLEMENTATION +#include "stb_truetype.h" +#include "os/file_access.h" + +void DynamicFontData::lock() { + + fr=font_data.read(); + + if (fr.ptr()!=last_data_ptr) { + + last_data_ptr=fr.ptr(); + + if (!stbtt_InitFont(&info, last_data_ptr, 0)) { + valid=false; + } else { + valid=true; + } + + last_data_ptr=fr.ptr(); + } +} + +void DynamicFontData::unlock() { + + fr = DVector::Read(); +} + +void DynamicFontData::set_font_data(const DVector& p_font) { + //clear caches and stuff + ERR_FAIL_COND(font_data.size()) ; + font_data=p_font; + + lock(); + + if (valid) { + stbtt_GetFontVMetrics(&info, &ascent, &descent, &linegap); + descent=-descent + linegap; + + for(int i=32;i<1024;i++) { + for(int j=32;j<1024;j++) { + + int kern = stbtt_GetCodepointKernAdvance(&info, i,j); + if (kern!=0) { + KerningPairKey kpk; + kpk.A=i; + kpk.B=j; + kerning_map[kpk]=kern; + } + } + } + } + + unlock(); + //clear existing stuff + + ERR_FAIL_COND(!valid); +} + +Ref DynamicFontData::_get_dynamic_font_at_size(int p_size) { + + ERR_FAIL_COND_V(!valid,Ref()); + + if (size_cache.has(p_size)) { + return Ref( size_cache[p_size] ); + } + + + Ref dfas; + dfas.instance(); + + dfas->font=Ref( this ); + + size_cache[p_size]=dfas.ptr(); + + dfas->size=p_size; + + lock(); + + dfas->scale = stbtt_ScaleForPixelHeight(&info, p_size); + + unlock(); + + return dfas; + +} + +DynamicFontData::DynamicFontData() +{ + last_data_ptr=NULL; + valid=false; +} + +DynamicFontData::~DynamicFontData() +{ + +} + + + +//////////////////// + +float DynamicFontAtSize::get_height() const { + + return (font->ascent+font->descent)*scale; +} + +float DynamicFontAtSize::get_ascent() const { + + return font->ascent*scale; +} +float DynamicFontAtSize::get_descent() const { + + return font->descent*scale; +} + +Size2 DynamicFontAtSize::get_char_size(CharType p_char,CharType p_next) const { + + const_cast(this)->_update_char(p_char); + + const Character *c = char_map.getptr(p_char); + ERR_FAIL_COND_V(!c,Size2()); + + Size2 ret( c->advance, get_height()); + + if (p_next) { + DynamicFontData::KerningPairKey kpk; + kpk.A=p_char; + kpk.B=p_next; + + const Map::Element *K=font->kerning_map.find(kpk); + if (K) { + ret.x+=K->get()*scale; + } + + } + + return ret; +} + + +float DynamicFontAtSize::draw_char(RID p_canvas_item, const Point2& p_pos, const CharType& p_char,const CharType& p_next,const Color& p_modulate) const { + + const_cast(this)->_update_char(p_char); + + const Character * c = char_map.getptr(p_char); + + if (!c) { + return 0; + } + + Point2 cpos=p_pos; + cpos.x+=c->h_align; + cpos.y-=get_ascent(); + cpos.y+=c->v_align; + ERR_FAIL_COND_V( c->texture_idx<-1 || c->texture_idx>=textures.size(),0); + if (c->texture_idx!=-1) + VisualServer::get_singleton()->canvas_item_add_texture_rect_region( p_canvas_item, Rect2( cpos, c->rect.size ), textures[c->texture_idx].texture->get_rid(),c->rect, p_modulate ); + + //textures[c->texture_idx].texture->draw(p_canvas_item,Vector2()); + + float ret = c->advance; + if (p_next) { + DynamicFontData::KerningPairKey kpk; + kpk.A=p_char; + kpk.B=p_next; + + const Map::Element *K=font->kerning_map.find(kpk); + if (K) { + ret+=K->get()*scale; + } + + } + + return ret; +} + + +void DynamicFontAtSize::_update_char(CharType p_char) { + + if (char_map.has(p_char)) + return; + + font->lock(); + + + int w,h,xofs,yofs; + unsigned char * cpbitmap = stbtt_GetCodepointBitmap(&font->info, scale, scale, p_char, &w, &h, &xofs, &yofs ); + + if (!cpbitmap) { + //no glyph + + int advance; + stbtt_GetCodepointHMetrics(&font->info, p_char, &advance, 0); + //print_line("char has no bitmap: "+itos(p_char)+" but advance is "+itos(advance*scale)); + Character ch; + ch.texture_idx=-1; + ch.advance=advance*scale; + ch.h_align=0; + ch.v_align=0; + + char_map[p_char]=ch; + + font->unlock(); + + return; + } + + int mw=w+rect_margin*2; + int mh=h+rect_margin*2; + + if (mw>4096 || mh>4096) { + + stbtt_FreeBitmap(cpbitmap,NULL); + font->unlock(); + ERR_FAIL_COND(mw>4096); + ERR_FAIL_COND(mh>4096); + } + + //find a texture to fit this... + + int tex_index=-1; + int tex_x=0; + int tex_y=0; + + for(int i=0;i ct.texture_size || mh > ct.texture_size) //too big for this texture + continue; + + tex_y=0x7FFFFFFF; + tex_x=0; + + for(int j=0;jmax_y) + max_y=y; + } + + if (max_y ct.texture_size) + continue; //fail, could not fit it here + + tex_index=i; + break; + } + +// print_line("CHAR: "+String::chr(p_char)+" TEX INDEX: "+itos(tex_index)+" X: "+itos(tex_x)+" Y: "+itos(tex_y)); + + if (tex_index==-1) { + //could not find texture to fit, create one + tex_x = 0; + tex_y = 0; + + int texsize = MAX(size*8,256); + if (mw>texsize) + texsize=mw; //special case, adapt to it? + if (mh>texsize) + texsize=mh; //special case, adapt to it? + + texsize=nearest_power_of_2(texsize); + + texsize=MIN(texsize,4096); + + + CharTexture tex; + tex.texture_size=texsize; + tex.imgdata.resize(texsize*texsize*2); //grayscale alpha + + { + //zero texture + DVector::Write w = tex.imgdata.write(); + ERR_FAIL_COND(texsize*texsize*2 > tex.imgdata.size()); + for(int i=0;i::Write wr = tex.imgdata.write(); + + for(int i=0;i= tex.imgdata.size()); + wr[ofs+0]=255; //grayscale as 1 + wr[ofs+1]=cpbitmap[i*w+j]; //alpha as 0 + } + } + } + + //blit to image and texture + { + + Image img(tex.texture_size,tex.texture_size,0,Image::FORMAT_GRAYSCALE_ALPHA,tex.imgdata); + + if (tex.texture.is_null()) { + tex.texture.instance(); + tex.texture->create_from_image(img,Texture::FLAG_FILTER); + } else { + tex.texture->set_data(img); //update + } + + } + + + // update height array + + for(int k=tex_x;kinfo, p_char, &advance, 0); + + Character chr; + chr.h_align=xofs; + chr.v_align=yofs + get_ascent(); + chr.advance=advance*scale; + chr.texture_idx=tex_index; + + + chr.rect=Rect2(tex_x+rect_margin,tex_y+rect_margin,w,h); + + //print_line("CHAR: "+String::chr(p_char)+" TEX INDEX: "+itos(tex_index)+" RECT: "+chr.rect+" X OFS: "+itos(xofs)+" Y OFS: "+itos(yofs)); + + char_map[p_char]=chr; + + stbtt_FreeBitmap(cpbitmap,NULL); + + font->unlock(); + +} + +DynamicFontAtSize::DynamicFontAtSize() { + + rect_margin=1; +} + +DynamicFontAtSize::~DynamicFontAtSize(){ + + ERR_FAIL_COND(!font.ptr()); + font->size_cache.erase(size); +} + +///////////////////////// + + +void DynamicFont::_bind_methods() { + + ObjectTypeDB::bind_method(_MD("set_font_data","data:DynamicFontData"),&DynamicFont::set_font_data); + ObjectTypeDB::bind_method(_MD("get_font_data:DynamicFontData"),&DynamicFont::get_font_data); + + ObjectTypeDB::bind_method(_MD("set_size","data"),&DynamicFont::set_size); + ObjectTypeDB::bind_method(_MD("get_size"),&DynamicFont::get_size); + + ADD_PROPERTY(PropertyInfo(Variant::INT,"size"),_SCS("set_size"),_SCS("get_size")); + ADD_PROPERTY(PropertyInfo(Variant::OBJECT,"font",PROPERTY_HINT_RESOURCE_TYPE,"DynamicFontData"),_SCS("set_font_data"),_SCS("get_font_data")); +} + + +void DynamicFont::set_font_data(const Ref& p_data) { + + data=p_data; + data_at_size=data->_get_dynamic_font_at_size(size); +} + +Ref DynamicFont::get_font_data() const{ + + return data; +} + +void DynamicFont::set_size(int p_size){ + + if (size==p_size) + return; + size=p_size; + ERR_FAIL_COND(p_size<1); + if (!data.is_valid()) + return; + data_at_size=data->_get_dynamic_font_at_size(size); + +} +int DynamicFont::get_size() const{ + + return size; +} + +float DynamicFont::get_height() const{ + + if (!data_at_size.is_valid()) + return 1; + + return data_at_size->get_height(); +} + +float DynamicFont::get_ascent() const{ + + if (!data_at_size.is_valid()) + return 1; + + return data_at_size->get_ascent(); +} + +float DynamicFont::get_descent() const{ + + if (!data_at_size.is_valid()) + return 1; + + return data_at_size->get_descent(); + +} + +Size2 DynamicFont::get_char_size(CharType p_char,CharType p_next) const{ + + if (!data_at_size.is_valid()) + return Size2(1,1); + + return data_at_size->get_char_size(p_char,p_next); + +} + +bool DynamicFont::is_distance_field_hint() const{ + + return false; +} + +float DynamicFont::draw_char(RID p_canvas_item, const Point2& p_pos, const CharType& p_char,const CharType& p_next,const Color& p_modulate) const { + + if (!data_at_size.is_valid()) + return 0; + + return data_at_size->draw_char(p_canvas_item,p_pos,p_char,p_next,p_modulate); + +} + +DynamicFont::DynamicFont() { + + size=16; +} + +DynamicFont::~DynamicFont() { + +} + +///////////////////////// + + +RES ResourceFormatLoaderDynamicFont::load(const String &p_path, const String& p_original_path, Error *r_error) { + + if (r_error) + *r_error=ERR_FILE_CANT_OPEN; + + + FileAccess *f = FileAccess::open(p_path,FileAccess::READ); + ERR_FAIL_COND_V(!f,RES()); + + DVector data; + + data.resize(f->get_len()); + + ERR_FAIL_COND_V(data.size()==0,RES()); + + { + DVector::Write w = data.write(); + f->get_buffer(w.ptr(),data.size()); + } + + Ref dfd; + dfd.instance(); + dfd->set_font_data(data); + + if (r_error) + *r_error=OK; + + return dfd; +} + +void ResourceFormatLoaderDynamicFont::get_recognized_extensions(List *p_extensions) const { + + p_extensions->push_back("ttf"); +} + +bool ResourceFormatLoaderDynamicFont::handles_type(const String& p_type) const { + + return (p_type=="DynamicFontData"); +} + +String ResourceFormatLoaderDynamicFont::get_resource_type(const String &p_path) const { + + String el = p_path.extension().to_lower(); + if (el=="ttf") + return "DynamicFontData"; + return ""; +} + +#endif diff --git a/scene/resources/dynamic_font_stb.h b/scene/resources/dynamic_font_stb.h new file mode 100644 index 00000000000..6b72fb37033 --- /dev/null +++ b/scene/resources/dynamic_font_stb.h @@ -0,0 +1,178 @@ +#ifndef DYNAMICFONT_STB_H +#define DYNAMICFONT_STB_H + +#ifndef FREETYPE_ENABLED + +#include "font.h" +#include "stb_truetype.h" +#include "io/resource_loader.h" + + + +class DynamicFontAtSize; +class DynamicFont; + +class DynamicFontData : public Resource { + + OBJ_TYPE(DynamicFontData,Resource); + + bool valid; + + DVector font_data; + DVector::Read fr; + const uint8_t* last_data_ptr; + + struct KerningPairKey { + + union { + struct { + uint32_t A,B; + }; + + uint64_t pair; + }; + + _FORCE_INLINE_ bool operator<(const KerningPairKey& p_r) const { return pair kerning_map; + + + Map size_cache; + +friend class DynamicFontAtSize; + + stbtt_fontinfo info; + int ascent; + int descent; + int linegap; + + void lock(); + void unlock(); + +friend class DynamicFont; + + + Ref _get_dynamic_font_at_size(int p_size); +public: + + void set_font_data(const DVector& p_font); + DynamicFontData(); + ~DynamicFontData(); +}; + + +class DynamicFontAtSize : public Reference { + + OBJ_TYPE(DynamicFontAtSize,Reference); + + + int rect_margin; + + struct CharTexture { + + DVector imgdata; + int texture_size; + Vector offsets; + Ref texture; + }; + + Vector textures; + + struct Character { + + int texture_idx; + Rect2 rect; + float v_align; + float h_align; + float advance; + + Character() { texture_idx=0; v_align=0; } + }; + + + + HashMap< CharType, Character > char_map; + + _FORCE_INLINE_ void _update_char(CharType p_char); + +friend class DynamicFontData; + Ref font; + float scale; + int size; + +protected: + +public: + + float get_height() const; + + float get_ascent() const; + float get_descent() const; + + Size2 get_char_size(CharType p_char,CharType p_next=0) const; + + float draw_char(RID p_canvas_item, const Point2& p_pos, const CharType& p_char,const CharType& p_next=0,const Color& p_modulate=Color(1,1,1)) const; + + + + DynamicFontAtSize(); + ~DynamicFontAtSize(); +}; + +/////////////// + +class DynamicFont : public Font { + + OBJ_TYPE( DynamicFont, Font ); + + Ref data; + Ref data_at_size; + int size; + + +protected: + + static void _bind_methods(); + +public: + + void set_font_data(const Ref& p_data); + Ref get_font_data() const; + + void set_size(int p_size); + int get_size() const; + + virtual float get_height() const; + + virtual float get_ascent() const; + virtual float get_descent() const; + + virtual Size2 get_char_size(CharType p_char,CharType p_next=0) const; + + virtual bool is_distance_field_hint() const; + + virtual float draw_char(RID p_canvas_item, const Point2& p_pos, const CharType& p_char,const CharType& p_next=0,const Color& p_modulate=Color(1,1,1)) const; + + DynamicFont(); + ~DynamicFont(); + +}; + + + +///////////// + +class ResourceFormatLoaderDynamicFont : public ResourceFormatLoader { +public: + + virtual RES load(const String &p_path,const String& p_original_path="",Error *r_error=NULL); + virtual void get_recognized_extensions(List *p_extensions) const; + virtual bool handles_type(const String& p_type) const; + virtual String get_resource_type(const String &p_path) const; + +}; + + +#endif +#endif // DYNAMICFONT_H diff --git a/tools/SCsub b/tools/SCsub index 2210538a252..7a0feb6e3dd 100644 --- a/tools/SCsub +++ b/tools/SCsub @@ -58,7 +58,41 @@ def make_translations_header(target,source,env): g.write("#endif") +def make_fonts_header(target,source,env): + + dst = target[0].srcnode().abspath + + g = open(dst,"wb") + + + """" + """ + + g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n") + g.write("#ifndef _EDITOR_FONTS_H\n") + g.write("#define _EDITOR_FONTS_H\n") + + #saving uncompressed, since freetype will reference from memory pointer + xl_names=[] + for i in range(len(source)): + print("Appending font: "+source[i].srcnode().abspath) + f = open(source[i].srcnode().abspath,"rb") + buf = f.read() + import os.path + + name = os.path.splitext(os.path.basename(source[i].srcnode().abspath))[0] + + g.write("static const int _font_"+name+"_size="+str(len(buf))+";\n") + g.write("static const unsigned char _font_"+name+"[]={\n") + for i in range(len(buf)): + g.write(str(ord(buf[i]))+",\n") + + g.write("};\n") + + g.write("#endif") + + if (env["tools"]!="no"): import glob @@ -70,11 +104,18 @@ if (env["tools"]!="no"): env.Depends('#tools/editor/translations.h',tlist) env.Command('#tools/editor/translations.h',tlist,make_translations_header) + flist = glob.glob(dir + "/editor_fonts/*.ttf") + flist.append( glob.glob(dir + "/editor_fonts/*.otf") ) + + print("fonts: ",flist) + env.Depends('#tools/editor/builtin_fonts.h',flist) + env.Command('#tools/editor/builtin_fonts.h',flist,make_fonts_header) + SConscript('editor/SCsub'); #SConscript('scintilla/SCsub'); SConscript('collada/SCsub'); SConscript('docdump/SCsub'); - SConscript('freetype/SCsub'); + #SConscript('freetype/SCsub'); SConscript('doc/SCsub') SConscript('pck/SCsub') diff --git a/tools/doc/doc_data.h b/tools/doc/doc_data.h index 877f30defbb..d1aebff4ce5 100644 --- a/tools/doc/doc_data.h +++ b/tools/doc/doc_data.h @@ -50,6 +50,9 @@ public: String qualifiers; String description; Vector arguments; + bool operator<(const MethodDoc& p_md) const { + return nameadd_font_override("font",get_font("source","Fonts")); + text_editor->add_font_override("font",get_font("source","EditorFonts")); +} + +void CodeTextEditor::_on_settings_change() { + + _update_font(); // AUTO BRACE COMPLETION text_editor->set_auto_brace_completion( @@ -588,6 +593,9 @@ void CodeTextEditor::_notification(int p_what) { if (p_what==EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) _load_theme_settings(); + if (p_what==NOTIFICATION_ENTER_TREE) { + _update_font(); + } } void CodeTextEditor::_bind_methods() { @@ -607,19 +615,6 @@ CodeTextEditor::CodeTextEditor() { text_editor->set_area_as_parent_rect(); text_editor->set_margin(MARGIN_BOTTOM,20); - String editor_font = EDITOR_DEF("text_editor/font", ""); - bool font_overrode = false; - if (editor_font!="") { - Ref fnt = ResourceLoader::load(editor_font); - if (fnt.is_valid()) { - text_editor->add_font_override("font",fnt); - font_overrode = true; - } - } - - if (!font_overrode) - text_editor->add_font_override("font",get_font("source","Fonts")); - text_editor->set_show_line_numbers(true); text_editor->set_brace_matching(true); text_editor->set_auto_indent(true); diff --git a/tools/editor/code_editor.h b/tools/editor/code_editor.h index e28517c6010..f1a1a7072fc 100644 --- a/tools/editor/code_editor.h +++ b/tools/editor/code_editor.h @@ -135,6 +135,7 @@ class CodeTextEditor : public Control { void _on_settings_change(); + void _update_font(); void _complete_request(); protected: diff --git a/tools/editor/editor_fonts.cpp b/tools/editor/editor_fonts.cpp index a3ec08f9862..e04dce294a7 100644 --- a/tools/editor/editor_fonts.cpp +++ b/tools/editor/editor_fonts.cpp @@ -30,6 +30,9 @@ #include "doc_font.h" #include "doc_title_font.h" #include "doc_code_font.h" +#include "builtin_fonts.h" +#include "editor_settings.h" +#include "scene/resources/dynamic_font.h" static Ref make_font(int p_height,int p_ascent, int p_valign, int p_charcount, const int *p_chars,const Ref &p_texture) { @@ -64,12 +67,54 @@ static Ref make_font(int p_height,int p_ascent, int p_valign, int p_ void editor_register_fonts(Ref p_theme) { + Ref dfd; + dfd.instance(); + dfd->set_font_ptr(_font_droid_sans,_font_droid_sans_size); + dfd->set_force_autohinter(true); //just looks better..i think? - Ref doc_font = make_font(_bi_font_doc_font_height,_bi_font_doc_font_ascent,0,_bi_font_doc_font_charcount,_bi_font_doc_font_characters,p_theme->get_icon("DocFont","EditorIcons")); - Ref doc_code_font = make_font(_bi_font_doc_code_font_height,_bi_font_doc_code_font_ascent,0,_bi_font_doc_code_font_charcount,_bi_font_doc_code_font_characters,p_theme->get_icon("DocCodeFont","EditorIcons")); - Ref doc_title_font = make_font(_bi_font_doc_title_font_height,_bi_font_doc_title_font_ascent,0,_bi_font_doc_title_font_charcount,_bi_font_doc_title_font_characters,p_theme->get_icon("DocTitleFont","EditorIcons")); - p_theme->set_font("doc","EditorFonts",doc_font); - p_theme->set_font("doc_code","EditorFonts",doc_code_font); - p_theme->set_font("doc_title","EditorFonts",doc_title_font); + Ref dfmono; + dfmono.instance(); + dfmono->set_font_ptr(_font_source_code_pro,_font_source_code_pro_size); + //dfd->set_force_autohinter(true); //just looks better..i think? + + Ref df; + df.instance(); + df->set_size(int(EditorSettings::get_singleton()->get("global/font_size"))); + df->set_font_data(dfd); + + + p_theme->set_default_theme_font(df); + +// Ref doc_font = make_font(_bi_font_doc_font_height,_bi_font_doc_font_ascent,0,_bi_font_doc_font_charcount,_bi_font_doc_font_characters,p_theme->get_icon("DocFont","EditorIcons")); +// Ref doc_title_font = make_font(_bi_font_doc_title_font_height,_bi_font_doc_title_font_ascent,0,_bi_font_doc_title_font_charcount,_bi_font_doc_title_font_characters,p_theme->get_icon("DocTitleFont","EditorIcons")); +// Ref doc_code_font = make_font(_bi_font_doc_code_font_height,_bi_font_doc_code_font_ascent,0,_bi_font_doc_code_font_charcount,_bi_font_doc_code_font_characters,p_theme->get_icon("DocCodeFont","EditorIcons")); + + Ref df_title; + df_title.instance(); + df_title->set_size(int(EDITOR_DEF("help/help_title_font_size",18))); + df_title->set_font_data(dfd); + + Ref df_doc; + df_doc.instance(); + df_doc->set_size(int(EDITOR_DEF("help/help_font_size",16))); + df_doc->set_font_data(dfd); + + p_theme->set_font("doc","EditorFonts",df_doc); + p_theme->set_font("doc_title","EditorFonts",df_title); + + + Ref df_code; + df_code.instance(); + df_code->set_size(int(EditorSettings::get_singleton()->get("global/source_font_size"))); + df_code->set_font_data(dfmono); + + p_theme->set_font("source","EditorFonts",df_code); + + Ref df_doc_code; + df_doc_code.instance(); + df_doc_code->set_size(int(EDITOR_DEF("help/help_source_font_size",14))); + df_doc_code->set_font_data(dfmono); + + p_theme->set_font("doc_source","EditorFonts",df_doc_code); } diff --git a/tools/editor/editor_help.cpp b/tools/editor/editor_help.cpp index 616037c5455..b426def5033 100644 --- a/tools/editor/editor_help.cpp +++ b/tools/editor/editor_help.cpp @@ -130,6 +130,7 @@ void EditorHelpSearch::_update_search() { else cicon=def_icon; + for(int i=0;ishow(); - DocData::ClassDoc &cd=doc->class_list[p_class]; + DocData::ClassDoc cd=doc->class_list[p_class]; //make a copy, so we can sort without worrying Color h_color; - Ref doc_font = get_font("normal","Fonts"); - Ref doc_code_font = get_font("source","Fonts"); - Ref doc_title_font = get_font("large","Fonts"); + Ref doc_font = get_font("doc","EditorFonts"); + Ref doc_title_font = get_font("doc_title","EditorFonts"); + Ref doc_code_font = get_font("doc_source","EditorFonts"); h_color=Color(1,1,1,1); @@ -794,7 +795,7 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { //class_desc->add_newline(); class_desc->add_newline(); class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/text_color")); - class_desc->push_font( get_font("normal","Fonts") ); + class_desc->push_font( doc_font ); class_desc->push_indent(1); _add_text(cd.brief_description); class_desc->pop(); @@ -805,9 +806,14 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { } bool method_descr=false; + bool sort_methods = EditorSettings::get_singleton()->get("help/sort_functions_alphabetically"); + if (cd.methods.size()) { + if (sort_methods) + cd.methods.sort(); + class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/keyword_color")); class_desc->push_font(doc_title_font); class_desc->add_text(TTR("Public Methods:")); @@ -979,6 +985,9 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { } if (cd.signals.size()) { + if (sort_methods) { + cd.signals.sort(); + } class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/keyword_color")); class_desc->push_font(doc_title_font); class_desc->add_text(TTR("Signals:")); @@ -1098,7 +1107,7 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { class_desc->add_newline(); class_desc->add_newline(); class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/text_color")); - class_desc->push_font( get_font("normal","Fonts") ); + class_desc->push_font( doc_font ); class_desc->push_indent(1); _add_text(cd.description); class_desc->pop(); @@ -1168,7 +1177,7 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { class_desc->add_newline(); class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/text_color")); - class_desc->push_font( get_font("normal","Fonts") ); + class_desc->push_font( doc_font ); class_desc->push_indent(1); _add_text(cd.methods[i].description); class_desc->pop(); @@ -1248,9 +1257,12 @@ void EditorHelp::_add_text(const String& p_bbcode) { class_desc->push_indent(1);*/ int pos = 0; + Ref doc_font = get_font("doc","EditorFonts"); + Ref doc_code_font = get_font("doc_source","EditorFonts"); + String bbcode=p_bbcode.replace("\t"," ").replace("\r"," ").strip_edges(); - //find double newlines, keep them + //change newlines for double newlines for(int i=0;ipush_color(EditorSettings::get_singleton()->get("text_editor/keyword_color")); class_desc->push_meta("@"+m); class_desc->add_text(m+"()"); class_desc->pop(); + class_desc->pop(); pos=brk_end+1; } else if (doc->class_list.has(tag)) { + class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/keyword_color")); class_desc->push_meta("#"+tag); class_desc->add_text(tag); class_desc->pop(); + class_desc->pop(); pos=brk_end+1; } else if (tag=="b") { //use bold font - class_desc->push_font(get_font("source","Fonts")); + class_desc->push_font(doc_code_font); pos=brk_end+1; tag_stack.push_front(tag); } else if (tag=="i") { //use italics font - class_desc->push_font(get_font("italic","Fonts")); + Color text_color = EditorSettings::get_singleton()->get("text_editor/text_color"); + //no italics so emphasize with color + text_color.r*=1.1; + text_color.g*=1.1; + text_color.b*=1.1; + class_desc->push_color(text_color); + //class_desc->push_font(get_font("italic","Fonts")); pos=brk_end+1; tag_stack.push_front(tag); } else if (tag=="code" || tag=="codeblock") { //use monospace font - class_desc->push_font(get_font("source","EditorFonts")); + class_desc->push_font(doc_code_font); pos=brk_end+1; tag_stack.push_front(tag); } else if (tag=="center") { @@ -1496,7 +1521,7 @@ void EditorHelp::_add_text(const String& p_bbcode) { if (font.is_valid()) class_desc->push_font(font); else { - class_desc->push_font(get_font("source","rFonts")); + class_desc->push_font(doc_font); } pos=brk_end+1; @@ -1618,6 +1643,7 @@ EditorHelp::EditorHelp() { VBoxContainer *vbc = this; + EDITOR_DEF("help/sort_functions_alphabetically",true); //class_list->connect("meta_clicked",this,"_class_list_select"); //class_list->set_selection_enabled(true); diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index fedf738af43..8313e38f02b 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -5225,7 +5225,7 @@ EditorNode::EditorNode() { //theme->set_icon("folder","EditorFileDialog",Theme::get_default()->get_icon("folder","EditorFileDialog")); //theme->set_color("files_disabled","EditorFileDialog",Color(0,0,0,0.7)); - String global_font = EditorSettings::get_singleton()->get("global/font"); + String global_font = EditorSettings::get_singleton()->get("global/custom_font"); if (global_font!="") { Ref fnt = ResourceLoader::load(global_font); if (fnt.is_valid()) { diff --git a/tools/editor/editor_settings.cpp b/tools/editor/editor_settings.cpp index 0b7e389773e..96ced0d5e3c 100644 --- a/tools/editor/editor_settings.cpp +++ b/tools/editor/editor_settings.cpp @@ -443,8 +443,12 @@ void EditorSettings::_load_defaults(Ref p_extra_config) { } set("global/show_script_in_scene_tabs",false); - set("global/font",""); - hints["global/font"]=PropertyInfo(Variant::STRING,"global/font",PROPERTY_HINT_GLOBAL_FILE,"*.fnt"); + set("global/font_size",14); + hints["global/font_size"]=PropertyInfo(Variant::INT,"global/font_size",PROPERTY_HINT_RANGE,"10,40,1",PROPERTY_USAGE_DEFAULT|PROPERTY_USAGE_RESTART_IF_CHANGED); + set("global/source_font_size",14); + hints["global/source_font_size"]=PropertyInfo(Variant::INT,"global/source_font_size",PROPERTY_HINT_RANGE,"10,40,1",PROPERTY_USAGE_DEFAULT|PROPERTY_USAGE_RESTART_IF_CHANGED); + set("global/custom_font",""); + hints["global/custom_font"]=PropertyInfo(Variant::STRING,"global/custom_font",PROPERTY_HINT_GLOBAL_FILE,"*.fnt",PROPERTY_USAGE_DEFAULT|PROPERTY_USAGE_RESTART_IF_CHANGED); set("global/autoscan_project_path",""); hints["global/autoscan_project_path"]=PropertyInfo(Variant::STRING,"global/autoscan_project_path",PROPERTY_HINT_GLOBAL_DIR); set("global/default_project_path",""); diff --git a/tools/editor/icons/SCsub b/tools/editor/icons/SCsub index addf6879a22..14d2be66f6e 100644 --- a/tools/editor/icons/SCsub +++ b/tools/editor/icons/SCsub @@ -35,7 +35,9 @@ def make_editor_icons_action(target, source, env): s.write("static Ref make_icon(const uint8_t* p_png) {\n") s.write("\tRef texture( memnew( ImageTexture ) );\n") - s.write("\ttexture->create_from_image( Image(p_png),ImageTexture::FLAG_FILTER );\n") + s.write("\tImage img(p_png);\n") + #s.write("\timg.expand_x2_hq2x();\n") + s.write("\ttexture->create_from_image( img,ImageTexture::FLAG_FILTER );\n") s.write("\treturn texture;\n") s.write("}\n\n") diff --git a/tools/editor_fonts/droid_sans.ttf b/tools/editor_fonts/droid_sans.ttf new file mode 100644 index 00000000000..a117feac855 Binary files /dev/null and b/tools/editor_fonts/droid_sans.ttf differ diff --git a/tools/editor_fonts/source_code_pro.otf b/tools/editor_fonts/source_code_pro.otf new file mode 100644 index 00000000000..4e3b9d0bcd9 Binary files /dev/null and b/tools/editor_fonts/source_code_pro.otf differ